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:
1 parent
b2dc1338d2
commit
c8dc689bc6
4 files changed
+56
-6
No files matched your search
@@ -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
|
||||
@@ -16,11 +16,12 @@
|
||||
#include <cstring>
|
||||
|
||||
#include "game/engine/log.h"
|
||||
#include "game/addresses.h"
|
||||
#include "re/hook.h"
|
||||
|
||||
namespace game {
|
||||
|
||||
RE_HOOK(0x00813140, CmdLineHasFlag);
|
||||
RE_HOOK(addr::CmdLineHasFlag, CmdLineHasFlag);
|
||||
|
||||
bool __cdecl CmdLineHasFlag(const char* cmdline, const char* flag, bool quiet) {
|
||||
char needle[256];
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include "game/addresses.h"
|
||||
#include "re/hook.h"
|
||||
#include "re/log.h"
|
||||
|
||||
namespace game {
|
||||
|
||||
RE_HOOK(0x0066f1c0, Log);
|
||||
RE_HOOK(addr::Log, Log);
|
||||
|
||||
void __cdecl Log(const char* fmt, ...) {
|
||||
char message[1024];
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "game/engine/input.h"
|
||||
#include "game/render/dx_driver7.h"
|
||||
#include "re/config.h"
|
||||
#include "game/addresses.h"
|
||||
#include "re/hook.h"
|
||||
#include "re/log.h"
|
||||
|
||||
@@ -138,10 +139,10 @@ bool IsMouseMessageWithClientCoords(UINT message) {
|
||||
|
||||
namespace game {
|
||||
|
||||
RE_HOOK(0x00645390, DxDriver7_SetDisplayMode);
|
||||
RE_HOOK(0x00645f70, DxDriver7_Flip);
|
||||
RE_HOOK(0x0066e500, GetMouseClientPos);
|
||||
RE_HOOK(0x008122a0, MainWindowProc);
|
||||
RE_HOOK(addr::DxDriver7_SetDisplayMode, DxDriver7_SetDisplayMode);
|
||||
RE_HOOK(addr::DxDriver7_Flip, DxDriver7_Flip);
|
||||
RE_HOOK(addr::GetMouseClientPos, GetMouseClientPos);
|
||||
RE_HOOK(addr::MainWindowProc, MainWindowProc);
|
||||
|
||||
int __fastcall DxDriver7_SetDisplayMode(DxDriver7* self, void* edx, void* deviceCaps, const DxDisplayMode* mode,
|
||||
uint32_t unknown) {
|
||||
|
||||
Reference in new issue
Block a user