Page 1 of 1

TNM says I have no space to save a game...but I have loads?!

Posted: Wed Aug 02, 2017 11:53 am
by ericjmz
8/2

I have just downlaoded,installed,fired up to play TNM on my new computer, having not played in years.
..but I can't save any game (except a single quick-save spot)
When I do it says TNM needs 100 mg of free space, windows needs to free-it-up, and then lists me asd having (-) 1.2 terabytes of free space
...thats right...'negative' free space (for the record i DO have 2.7 terabytes of free space)

If this helps to resolve the issue,here is my setup:-

1. Windows 10 Professional
2. steam Deus Ex GOTY installed
3. TNM 1.04 + (yup, the 'plus' fan patch)
4. New_Vision_v1-5 (installed first...)
5. HDTP-Release3 (installed 2nd)
6. steam (& thus Deus Ex GOTY & TNM) are installed on my secondary hard drive (internal)...my 'F' drive

...and I THINK thats all the relevant issue

So, anyone know:

1. whats going wrong?
2. ...and how can I get TNM to realize I have loads of free space??

just to say, Deus EX GOTY works fine...no 'saving/free' space issues
...and TNM otherwise LOOKS great...but I obviously can't play it without the ability to save

thank you anyone,in advance, for trouble-shooting
I REALLY REALLY wish to replay this :-(

ericjmz

Re: TNM says I have no space to save a game...but I have loa

Posted: Wed Aug 02, 2017 12:06 pm
by Jonas
Well jeez, uhm... it's been about 8 years so I don't know how much help I can be any more. My only idea is to see if it helps to launch the game in administrator mode?

Maybe someone else who's still an active modder has a better idea.

Re: TNM says I have no space to save a game...but I have loa

Posted: Wed Aug 02, 2017 12:21 pm
by ericjmz
nope...administrator mode does nothing

but I am assuming this is still an active forum,so maybe someone has an idea? :-)

ericjmz

Re: TNM says I have no space to save a game...but I have loa

Posted: Wed Aug 02, 2017 3:46 pm
by Made in China
You have too much space, so the integer overflows into the negative side. It happens at 2TB. Use Kentie's Launcher and launch it with the -localdata command, which will force it to use the F drive instead of the C drive, or without it if it's the other way around (I forgot which vanilla Deus Ex uses).

Re: TNM says I have no space to save a game...but I have loa

Posted: Wed Aug 02, 2017 6:13 pm
by ericjmz
A GENIUS you are!
Yehaaah ! :-))

I thank you sir

ericjmz

Re: TNM says I have no space to save a game...but I have loa

Posted: Thu Aug 03, 2017 8:31 pm
by Hanfling
One can actually go to 4 TB with an uc only fix btw, though afterwards it wraps unless backed by clamping native code.

Re: TNM says I have no space to save a game...but I have loa

Posted: Thu Aug 03, 2017 8:37 pm
by Made in China
Making the signed unsigned is easy - making the int long is hard.

Solution: remove the check (feed it max signed int at all times) altogether because it's an edge case that won't be realized by most players nowadays. There are games with bigger saves nowadays that don't check for that, while storage is getting bigger every year (we've reached 12TB now for consumers).

Re: TNM says I have no space to save a game...but I have loa

Posted: Thu Aug 03, 2017 9:38 pm
by Jonas
Those are quite a few terabytes.

Re: TNM says I have no space to save a game...but I have loa

Posted: Fri Aug 04, 2017 4:05 pm
by Hanfling
For Rev I went the way to replace the GetSaveFreeSpace() native and make it clamp the maximum value to (unsigned int) 0xFFFFFFFF and use this as sort of a magic value in UC code to make it green and add a +.

Code: Select all

// ----------------------------------------------------------------------
// UpdateFreeDiskSpace()
// ----------------------------------------------------------------------

function UpdateFreeDiskSpace()
{
	local GameDirectory saveDir;
	local int freeDiskSpaceMegaByte;

	saveDir = player.CreateGameDirectoryObject();
	freeDiskSpace = saveDir.GetSaveFreeSpace();
	//freeDiskSpace = -1545314777; // Testing.

	// Special value indicating 4GB+
	if ( freeDiskSpace==0xFFFFFFFF )
	{
		winFreeSpace.SetText(Sprintf(FreeSpaceLabel,"4194304")$"+");
		winFreeSpace.SetTextColorRGB(0,255,0);
	}
	else
	{
		// Emulate a logic shift.
		if ( freeDiskSpace>=0 ) // Checks sign bit.
			freeDiskSpaceMegaByte = freeDiskSpace>>10;
		else
			freeDiskSpaceMegaByte = ((freeDiskSpace&0x7FFFFFFF)>>10)+0x200000;

		//winFreeSpace.SetText(Sprintf(FreeSpaceLabel,freeDiskSpace>>10));
		winFreeSpace.SetText(Sprintf(FreeSpaceLabel,freeDiskSpaceMegaByte));

		// If free space is below the minimum, show in RED
		//else if ( (freeDiskSpace>>10)<minFreeDiskSpace )
		if ( freeDiskSpaceMegaByte<minFreeDiskSpace )
			winFreeSpace.SetTextColorRGB(255,0,0);
		else
			winFreeSpace.StyleChanged();
	}

	CriticalDelete(savedir);
}

Code: Select all


#define GetDiskFreeSpaceX(a,b,c,d,e)	TCHAR_CALL_OS(GetDiskFreeSpaceW(a,b,c,d,e),GetDiskFreeSpaceA(TCHAR_TO_ANSI(a),b,c,d,e))

class XRevisionGameDirectoryNatives : public XGameDirectory
{
	DECLARE_CLASS(XRevisionGameDirectoryNatives,XGameDirectory,0)
	
	/*-------------------------------------------------------------------------
		Synopsis:
		Reported free space wraps at 4 TB. So clamp it to magic value 0xFFFFFFFF
	-------------------------------------------------------------------------*/

	INT GetSaveFreeSpace()
	{
		guard(XRevisionGameDirectoryNatives::GetSaveFreeSpace);
		ANSICHAR  RootPathNameA[4] = "C:\\";
		TCHAR     RootPathNameW[4] = TEXT("C:\\");

		RootPathNameA[0] = **GFileManager->GetDefaultDirectory();
		RootPathNameW[0] = **GFileManager->GetDefaultDirectory();

		HMODULE hKernel32 = GetModuleHandleA("KERNEL32");
		typedef BOOL (WINAPI *GetDiskFreeSpaceExAFunc)( ANSICHAR*, QWORD*, QWORD*, QWORD* );
		GetDiskFreeSpaceExAFunc pGetDiskFreeSpaceExA = (GetDiskFreeSpaceExAFunc)GetProcAddress( hKernel32, "GetDiskFreeSpaceExA" );
		if ( pGetDiskFreeSpaceExA )
		{
			QWORD FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
			if ( !pGetDiskFreeSpaceExA(RootPathNameA,&FreeBytesAvailable,&TotalNumberOfBytes,&TotalNumberOfFreeBytes) )
				return 0;

			QWORD FreeMegsAvailable = Min( FreeBytesAvailable/((QWORD)1024), (QWORD)0xFFFFFFFFu );
			return FreeMegsAvailable;
		}
		else
		{
			DWORD SectorsPerCluster     = 0;
			DWORD BytesPerSector        = 0;
			DWORD NumberOfFreeClusters  = 0;
			DWORD TotalNumberOfClusters = 0;

			if ( !GetDiskFreeSpaceX(RootPathNameW,&SectorsPerCluster,&BytesPerSector,&NumberOfFreeClusters,&TotalNumberOfClusters) )
				return 0;

			QWORD FreeMegsAvailable = Min( ((QWORD)SectorsPerCluster)*((QWORD)BytesPerSector)*((QWORD)NumberOfFreeClusters)/((QWORD)1024), (QWORD)0xFFFFFFFFu );
			return FreeMegsAvailable;
		}
		unguard;
	}

	void execGetSaveFreeSpace( FFrame& Stack, RESULT_DECL )
	{
		guard(XRevisionGameDirectoryNatives::execGetSaveFreeSpace);
		P_FINISH;
		*(INT*)Result = GetSaveFreeSpace();
		unguardexec;
	}
};
IMPLEMENT_CLASS(XRevisionGameDirectoryNatives);
In case anyone might have some use for it.

Afterwards we couldn't find anyone with 4TB+ free space to actually test it, but we never had any bug reports regarding this since. Probably a better approach is to just return the values as megabyte anyway, and well, probably one should probably also format to GB and TB instead for enough space.