|
|
|
@ -63,28 +63,41 @@ namespace Papyrus::PapyrusFunctions |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Copied from Named Quicksaves by Ryan McKenzie (MIT)
|
|
|
|
|
RE::BSFixedString GetPlayerHash(RE::StaticFunctionTag*) |
|
|
|
|
RE::BSFixedString GetAutosaveName(RE::StaticFunctionTag*, std::int32_t a_index) |
|
|
|
|
{ |
|
|
|
|
char buf[] = "DEADBEEF"; |
|
|
|
|
auto saveData = RE::BSWin32SaveDataSystemUtility::GetSingleton(); |
|
|
|
|
if (saveData->profileHash == static_cast<std::uint32_t>(-1)) { |
|
|
|
|
std::snprintf(buf, sizeof(buf), "%08o", 0); |
|
|
|
|
} else { |
|
|
|
|
std::snprintf(buf, sizeof(buf), "%08X", saveData->profileHash); |
|
|
|
|
} |
|
|
|
|
return buf; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RE::BSFixedString StringToHex(RE::StaticFunctionTag*, RE::BSFixedString a_string) |
|
|
|
|
{ |
|
|
|
|
std::string_view str(a_string); |
|
|
|
|
/*
|
|
|
|
|
Save Name Structure (from NQS NamedQuicksaves by Ryan McKenzie) |
|
|
|
|
|
|
|
|
|
Save3_0C2D58E2_0_507269736F6E6572_Tamriel_000002_20180503063315_4_1.ess |
|
|
|
|
Save3: Type and index of save |
|
|
|
|
0C2D58E2: Unique hash used to identify your save profile. Regenerated on closing racemenu. |
|
|
|
|
0: Flag for modded game. |
|
|
|
|
507269736F6E6572: Character name in hex. |
|
|
|
|
Tamriel: coc code. |
|
|
|
|
000002: Days, hours, minutes played. |
|
|
|
|
20180503063315: Year, month, day, hour, minute, second in GMT + 0. |
|
|
|
|
4: Player level. |
|
|
|
|
1: Unknown flag. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
std::stringstream sstream; |
|
|
|
|
for (auto ch : str) { |
|
|
|
|
sstream << std::uppercase << std::hex << static_cast<int>(ch); |
|
|
|
|
sstream << "Autosave0"; |
|
|
|
|
sstream << a_index; |
|
|
|
|
sstream << "_"; |
|
|
|
|
sstream << GetPlayerHash().c_str(); |
|
|
|
|
sstream << "_0_"; |
|
|
|
|
sstream << StringToHex(RE::PlayerCharacter::GetSingleton()->GetName()).c_str(); |
|
|
|
|
sstream << "_"; |
|
|
|
|
|
|
|
|
|
RE::TESObjectCELL* parentCell = RE::PlayerCharacter::GetSingleton()->parentCell; |
|
|
|
|
if (parentCell->IsInteriorCell()) { |
|
|
|
|
sstream << parentCell->GetFormEditorID(); |
|
|
|
|
} else { |
|
|
|
|
sstream << RE::PlayerCharacter::GetSingleton()->GetWorldspace()->GetFormEditorID(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sstream << "_000000_00000000000000_1_1"; |
|
|
|
|
|
|
|
|
|
return sstream.str(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -165,10 +178,8 @@ namespace Papyrus::PapyrusFunctions |
|
|
|
|
logger::info("{}", "Registered GetCurrentContainer"sv); |
|
|
|
|
BIND(GetPlayerFollowers); |
|
|
|
|
logger::info("{}", "Registered GetPlayerFollowers"sv); |
|
|
|
|
BIND(GetPlayerHash); |
|
|
|
|
logger::info("{}", "Registered GetPlayerHash"sv); |
|
|
|
|
BIND(StringToHex); |
|
|
|
|
logger::info("{}", "Registered StringToHex"sv); |
|
|
|
|
BIND(GetAutosaveName); |
|
|
|
|
logger::info("{}", "Registered GetAutosaveName"sv); |
|
|
|
|
BIND(DisableDialogueQuitting); |
|
|
|
|
logger::info("{}", "Registered DisableDialogueQuitting"sv); |
|
|
|
|
BIND(EnableDialogueQuitting); |
|
|
|
|