Rename project to sacredK
sacred_re.dll/.exe/.ini/.log/_crash files are now sacredK.*; inventory saves with the old "sacred_re.inventory" format id still load. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
462ebf8c0b
commit
70673dc301
34 files changed
+95
-93
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
// sacred_re.ini next to sacred_re.dll / sacred_re.exe.
|
||||
// sacredK.ini next to sacredK.dll / sacredK.exe.
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace re {
|
||||
|
||||
void SetConfigPath(const std::wstring& path);
|
||||
const std::wstring& ConfigPath();
|
||||
// Folder of sacred_re.dll (with trailing separator), derived from the config path.
|
||||
// Folder of sacredK.dll (with trailing separator), derived from the config path.
|
||||
std::wstring ModuleDirectory();
|
||||
int ConfigInt(const char* section, const char* key, int fallback);
|
||||
std::string ConfigString(const char* section, const char* key, const char* fallback);
|
||||
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
// Crash report: on an unhandled exception, writes sacred_re_crash.txt (code,
|
||||
// Crash report: on an unhandled exception, writes sacredK_crash.txt (code,
|
||||
// address as module + offset, registers, return addresses found on the stack)
|
||||
// and sacred_re_crash.dmp next to the DLL. The game may install its own
|
||||
// and sacredK_crash.dmp next to the DLL. The game may install its own
|
||||
// filter later; SetUnhandledExceptionFilter is hooked so ours stays first and
|
||||
// passes the crash on to the game's afterwards.
|
||||
//
|
||||
// Hangs: a watchdog thread writes sacred_re_hang.dmp (all threads) when the
|
||||
// Hangs: a watchdog thread writes sacredK_hang.dmp (all threads) when the
|
||||
// engine tick (re::EngineHeartbeat) has stopped for kHangMs while the game
|
||||
// window is in front; once per hang. The game freezing on F2 while walking
|
||||
// (2026-10-18) left no report.
|
||||
@@ -52,7 +52,7 @@ bool IsCode(uintptr_t address) {
|
||||
}
|
||||
|
||||
void WriteReport(EXCEPTION_POINTERS* info) {
|
||||
FILE* file = _wfopen((g_dir + L"sacred_re_crash.txt").c_str(), L"w");
|
||||
FILE* file = _wfopen((g_dir + L"sacredK_crash.txt").c_str(), L"w");
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void WriteReport(EXCEPTION_POINTERS* info) {
|
||||
}
|
||||
fclose(file);
|
||||
|
||||
HANDLE dump = CreateFileW((g_dir + L"sacred_re_crash.dmp").c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS,
|
||||
HANDLE dump = CreateFileW((g_dir + L"sacredK_crash.dmp").c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (dump != INVALID_HANDLE_VALUE) {
|
||||
MINIDUMP_EXCEPTION_INFORMATION exception = {GetCurrentThreadId(), info, FALSE};
|
||||
@@ -120,7 +120,7 @@ bool GameInFront() {
|
||||
}
|
||||
|
||||
void WriteHangDump() {
|
||||
HANDLE dump = CreateFileW((g_dir + L"sacred_re_hang.dmp").c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS,
|
||||
HANDLE dump = CreateFileW((g_dir + L"sacredK_hang.dmp").c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (dump != INVALID_HANDLE_VALUE) {
|
||||
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), dump,
|
||||
@@ -142,7 +142,7 @@ DWORD WINAPI Watchdog(void*) {
|
||||
}
|
||||
if (!reported && GameInFront()) {
|
||||
reported = true;
|
||||
Log("hang: no engine tick for %lu ms, writing sacred_re_hang.dmp", GetTickCount() - beat);
|
||||
Log("hang: no engine tick for %lu ms, writing sacredK_hang.dmp", GetTickCount() - beat);
|
||||
WriteHangDump();
|
||||
Log("hang: dump written");
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
|
||||
namespace re {
|
||||
|
||||
// Writes sacred_re_crash.txt / .dmp into `dir` when the game crashes, and
|
||||
// sacred_re_hang.dmp when the engine stops ticking (see EngineHeartbeat).
|
||||
// Writes sacredK_crash.txt / .dmp into `dir` when the game crashes, and
|
||||
// sacredK_hang.dmp when the engine stops ticking (see EngineHeartbeat).
|
||||
void InstallCrashHandler(const std::wstring& dir);
|
||||
|
||||
// The engine ticked (running), or the game ended (not running).
|
||||
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
// sacred_re.dll entry point. Loaded into sacred.exe by the launcher before the
|
||||
// sacredK.dll entry point. Loaded into sacred.exe by the launcher before the
|
||||
// game's own entry point runs, so every hook is in place from the first
|
||||
// instruction of game code.
|
||||
|
||||
@@ -40,17 +40,17 @@ bool IsSupportedGameBuild() {
|
||||
|
||||
void Startup(HMODULE module) {
|
||||
std::wstring dir = ModuleDir(module);
|
||||
re::OpenLog((dir + L"sacred_re.log").c_str());
|
||||
re::SetConfigPath(dir + L"sacred_re.ini");
|
||||
re::Log("sacred_re loaded");
|
||||
re::OpenLog((dir + L"sacredK.log").c_str());
|
||||
re::SetConfigPath(dir + L"sacredK.ini");
|
||||
re::Log("sacredK loaded");
|
||||
re::InstallCrashHandler(dir);
|
||||
|
||||
if (!IsSupportedGameBuild()) {
|
||||
re::Log("unsupported sacred.exe build, no hooks installed");
|
||||
MessageBoxW(nullptr,
|
||||
L"This sacred.exe is not the supported Sacred Gold 2.28 build.\n"
|
||||
L"sacred_re will not patch it; the game runs unmodified.",
|
||||
L"sacred_re", MB_OK | MB_ICONWARNING);
|
||||
L"sacredK will not patch it; the game runs unmodified.",
|
||||
L"sacredK", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
}
|
||||
if (re::ConfigInt("debug", "WaitForDebugger", 0)) {
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
//
|
||||
// The signature, including the calling convention, must match the original
|
||||
// exactly (`__cdecl`, `__stdcall`, `__thiscall` / `__fastcall` stand-in, ...).
|
||||
// Hooks can be disabled individually at runtime in sacred_re.ini:
|
||||
// Hooks can be disabled individually at runtime in sacredK.ini:
|
||||
//
|
||||
// [hooks]
|
||||
// Log=0
|
||||
@@ -40,7 +40,7 @@ bool AttachRuntimeHook(const char* name, void** original, void* replacement);
|
||||
|
||||
// Hooks a Windows API function for the whole process (game and DLLs alike).
|
||||
// `replacement` must have the API's exact signature; defines
|
||||
// `replacement##_original`. Disabled in sacred_re.ini under the API's name.
|
||||
// `replacement##_original`. Disabled in sacredK.ini under the API's name.
|
||||
#define RE_HOOK_API(api, replacement) \
|
||||
static decltype(&replacement) replacement##_original = &api; \
|
||||
static ::re::HookRegistration replacement##_registration( \
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
// sacred_re's own log: sacred_re.log next to sacred_re.dll, plus OutputDebugString.
|
||||
// sacredK's own log: sacredK.log next to sacredK.dll, plus OutputDebugString.
|
||||
|
||||
namespace re {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
LIBRARY sacred_re
|
||||
LIBRARY sacredK
|
||||
EXPORTS
|
||||
; Detours requires ordinal 1 on any DLL injected via DetourCreateProcessWithDll.
|
||||
DetourFinishHelperProcess @1 NONAME
|
||||
Reference in new issue
Block a user