- Launcher (sacred_re.exe) starts sacred.exe with sacred_re.dll injected via Detours; the DLL verifies the Sacred Gold 2.28 build before hooking. - Hook framework: RE_HOOK for game addresses, RE_HOOK_API for Windows APIs, per-hook enable/disable in sacred_re.ini, sacred_re.log. - Game code: Log (0x66f1c0) hooked, CmdLineHasFlag (0x813140) rewritten. - Borderless mod: forces windowed mode, covers the monitor, scales the 1024x768 image aspect-correct, remaps mouse input, keeps running in the background with keyboard input hidden while unfocused. - CMake/Ninja/MSVC x86 build, VS Code setup, disasm tool, function map. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
3.1 KiB
3.1 KiB
Function map
Addresses are sacred.exe virtual addresses (image base 0x400000).
Status: rewritten (our code replaces the original), hooked (our code wraps the original), identified (purpose known, not touched yet).
Startup
| Address | Name | Conv. | Status | Notes |
|---|---|---|---|---|
0x0084c704 |
entry |
— | identified | MSVC 6 CRT startup (WinMainCRTStartup) |
0x00816bd0 |
WinMain |
stdcall | identified | single-instance mutex SACRED_INSTANCE, OS check, logging setup, Settings.cfg, language selection, main window, message loop, shutdown |
0x00813240 |
CreateMainWindow? |
identified | "WinMain : unable to create main window" on failure | |
0x00815620 |
InitGame? |
identified | "WinMain : initialization failed" on failure |
Engine
| Address | Name | Conv. | Status | Notes |
|---|---|---|---|---|
0x0066f1c0 |
Log |
cdecl, varargs | hooked | printf-style; writes DEBUG.LOG when enabled; see src/game/engine/log.cpp |
0x0066ed80 |
SetLogEnabled |
cdecl | identified | sets byte 0x017e5ee0 |
0x0066ef60 |
OpenLogFiles |
cdecl | identified | (re)opens DEBUG.LOG, ExpLog.LOG |
0x00813140 |
CmdLineHasFlag |
cdecl | rewritten | src/game/engine/cmdline.cpp |
0x00813240 |
CreateMainWindow |
cdecl | identified | registers class "Sacred" (wndproc 0x008122a0), WS_POPUP|WS_VISIBLE screen-sized window unless win flag |
0x008122a0 |
MainWindowProc |
stdcall | hooked | borderless mod remaps mouse message coordinates |
0x0066e500 |
GetMouseClientPos |
cdecl | hooked | GetCursorPos relative to client area; borderless mod maps to game pixels |
0x00610650 |
? | thiscall | identified | player input; only SetCursorPos caller (cursor nudging) |
Renderer (dxDriver7, instance pointer 0x00cda99c)
Layout: src/game/render/dx_driver7.h.
| Address | Name | Conv. | Status | Notes |
|---|---|---|---|---|
0x00645390 |
DxDriver7::SetDisplayMode |
thiscall, ret 0xc |
hooked | args (deviceCaps, DxDisplayMode*, ?); borderless mod forces windowed + resizes window |
0x00645f70 |
DxDriver7::Flip |
thiscall | hooked | windowed: primary->Blt(+0x1ec, back, +0x1dc); borderless mod sets both rects |
0x00645000 |
DxDriver7::CreateZBuffer? |
identified | ||
0x00644be0 |
DxDriver7::CreateSurface? |
identified |
Globals
| Address | Type | Name | Notes |
|---|---|---|---|
0x017e5ee0 |
bool |
g_logEnabled |
set by log flag |
0x017e5ed4 |
FILE* |
g_debugLog |
DEBUG.LOG |
0x017e5ed8 |
FILE* |
g_expLog |
ExpLog.LOG |
0x017e5ee4 |
void(*)(const char*) |
g_logCallback |
|
0x017e5cb4 |
int |
g_language |
index into code table 0x00897394 (US DE FR SP IT PL HU JP VC RU CZ, 16-byte stride) |
0x0182cd38 |
HANDLE |
g_instanceMutex |
|
0x00cda99c |
DxDriver7* |
g_dxDriver |
|
0x0182cdb8 |
uint32_t |
g_appFlags |
bit 0x20000 = app inactive (set/cleared on WM_ACTIVATEAPP at 0x00812421) |
Command-line flags seen so far
log (enable logging), tabblocker, win, language codes us, de, fr,
sp, it, pl, hu, jp, vc, ru, cz (lowercased before matching).