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

Let us help you solve any problems you might have with TNM. This forum should remain spoiler-free - if your problem is spoilery in nature, please post in the forum above.

Moderator: TNM Team

Forum rules
Please only use this forum for problems of a technical nature. If you're stuck somewhere in the game, post in the TNM Spoiler Zone forum. If the game crashes, you can't load a savegame, or something just plain isn't working, this is the place to post.
Post Reply
ericjmz
Thug
Posts: 23
Joined: Wed Jun 02, 2010 12:32 am

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

Post 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
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

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

Post 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.
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
ericjmz
Thug
Posts: 23
Joined: Wed Jun 02, 2010 12:32 am

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

Post by ericjmz »

nope...administrator mode does nothing

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

ericjmz
Made in China
MJ12
Posts: 466
Joined: Thu Apr 02, 2009 7:55 pm

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

Post 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).
ericjmz
Thug
Posts: 23
Joined: Wed Jun 02, 2010 12:32 am

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

Post by ericjmz »

A GENIUS you are!
Yehaaah ! :-))

I thank you sir

ericjmz
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

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

Post 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.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Made in China
MJ12
Posts: 466
Joined: Thu Apr 02, 2009 7:55 pm

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

Post 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).
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

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

Post by Jonas »

Those are quite a few terabytes.
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

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

Post 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.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Post Reply