Name all sacred.exe addresses in src/game/addresses.h

Hooks now refer to addr::* instead of literal addresses; the header also
lists the world view's users of the 1024.0/768.0 constants and the ortho
projection extent pushes for the widescreen work.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-14 00:20:26 +02:00
1 parent b2dc1338d2
commit c8dc689bc6
4 files changed
+56 -6

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
#pragma once
// Every sacred.exe address we use, in one place (Sacred Gold 2.28, image base
// 0x400000, no ASLR). Hooks, patches and docs refer to these names; see
// docs/function-map.md and docs/widescreen.md for what each one does.
#include <cstdint>
namespace game::addr {
// --- functions ---------------------------------------------------------------
constexpr uint32_t Log = 0x0066f1c0;
constexpr uint32_t CmdLineHasFlag = 0x00813140;
constexpr uint32_t GetMouseClientPos = 0x0066e500;
constexpr uint32_t MainWindowProc = 0x008122a0;
constexpr uint32_t DxDriver7_SetDisplayMode = 0x00645390;
constexpr uint32_t DxDriver7_Flip = 0x00645f70;
constexpr uint32_t WorldView0_SetupView = 0x00624ae0;
constexpr uint32_t WorldView0_SetZoom = 0x00628210;
constexpr uint32_t WorldView0_Render = 0x006322b0;
constexpr uint32_t WorldToScreen = 0x00623c40;
// --- globals -----------------------------------------------------------------
constexpr uint32_t g_dxDriver = 0x00cda99c; // DxDriver7*
constexpr uint32_t g_appFlags = 0x0182cdb8; // uint32_t, 0x20000 = inactive
// --- read-only constants -----------------------------------------------------
constexpr uint32_t kScreenWidthF = 0x0088e6f4; // float 1024.0
constexpr uint32_t kScreenHeightF = 0x00890040; // float 768.0
// Instructions in the world view that read kScreenWidthF / kScreenHeightF as
// a memory operand (fmul/fcomp dword ptr [addr]). Redirecting their operand
// resizes the world view without touching the UI's uses of the same floats.
constexpr uint32_t kViewWidthUsers[] = {
0x0061e5c2, 0x00623c82, 0x00624af2, 0x00628f65, 0x00629294,
0x0062b43a, 0x0062dc32, 0x0062ea2b, 0x0062f30d, 0x00630656, 0x00630f3f,
};
constexpr uint32_t kViewHeightUsers[] = {
0x0061e5ec, 0x00623c9c, 0x00624b03, 0x00628f8f, 0x006292bc,
0x0062ea5e, 0x0062f345, 0x0063068a, 0x00630f77,
};
// push sequences of the 3D models' ortho extents (-267, 267, -200, 200).
constexpr uint32_t kOrthoExtentPushes[] = {
0x0060c1f7, 0x0060da54, 0x00625039, 0x006283b3, 0x0062858d, 0x00628d3b,
};
} // namespace game::addr