Added UUID for game sessions

Allows the SavegameManager to destroy all saves related to the current UUID session so hardcore mods can enforce this safely instead of needing to go nuclear.
This commit is contained in:
Boondorl 2025-07-20 14:00:05 -04:00 committed by Ricardo Luís Vaz Silva
commit 66c5beccbd
8 changed files with 52 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#include "gstrings.h"
#include "version.h"
#include "m_argv.h"
#include "m_random.h"
static_assert(sizeof(void*) == 8,
"Only LP64/LLP64 builds are officially supported. "
@ -182,3 +183,12 @@ int FStartupSelectionInfo::SaveInfo()
return DefaultIWAD;
}
FString GameUUID;
static FRandom pr_uuid("GameUUID");
FString GenerateUUID()
{
FString uuid;
uuid.AppendFormat("%08X-%04X-4%03X-9%03X-%08X%04X", pr_uuid.GenRand32(), pr_uuid(UINT16_MAX), pr_uuid(4095), pr_uuid(4095), pr_uuid.GenRand32(), pr_uuid(UINT16_MAX));
return uuid;
}

View file

@ -13,6 +13,9 @@ class FConfigFile;
class FArgs;
struct FTranslationID;
extern FString GameUUID;
FString GenerateUUID();
struct SystemCallbacks
{
bool (*G_Responder)(event_t* ev); // this MUST be set, otherwise nothing will work