mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Changed the load order of sfall.dat to after patchXXX.dat
Code edits to Interface.cpp due to the previous commit.
This commit is contained in:
@@ -417,6 +417,8 @@ FUNC(movieStop_, 0x487150)
|
||||
FUNC(movieUpdate_, 0x487BEC)
|
||||
FUNC(my_free_, 0x4C5C2C)
|
||||
FUNC(new_obj_id_, 0x4A386C)
|
||||
FUNC(nfree_, 0x4EF2B4)
|
||||
FUNC(nmalloc_, 0x4EF1C5)
|
||||
FUNC(nrealloc_, 0x4F1669)
|
||||
FUNC(objPMAttemptPlacement_, 0x49D628)
|
||||
FUNC(obj_ai_blocking_at_, 0x48BA20)
|
||||
|
||||
@@ -135,16 +135,6 @@ static VertexFormat ShaderVertices[] = {
|
||||
{639.5, 479.5, 0, 1, 1, 1} // 3 - bottom right
|
||||
};
|
||||
|
||||
HWND Graphics::GetFalloutWindowInfo(RECT* rect) {
|
||||
if (rect) {
|
||||
rect->left = windowLeft;
|
||||
rect->top = windowTop;
|
||||
rect->right = gWidth;
|
||||
rect->bottom = gHeight;
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
long Graphics::GetGameWidthRes() {
|
||||
return (fo::ptr::scr_size->offx - fo::ptr::scr_size->x) + 1;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ public:
|
||||
static DWORD mode;
|
||||
static DWORD GPUBlt;
|
||||
|
||||
static HWND GetFalloutWindowInfo(RECT* rect);
|
||||
static long GetGameWidthRes();
|
||||
static long GetGameHeightRes();
|
||||
|
||||
|
||||
@@ -672,11 +672,6 @@ static void UIAnimationSpeedPatch() {
|
||||
SimplePatch<BYTE>(&addrs[4], 2, "Misc", "PipboyTimeAnimDelay", 50, 0, 127);
|
||||
}
|
||||
|
||||
void Interface::OnBeforeGameInit() {
|
||||
if (hrpVersionValid) IFACE_BAR_MODE = (GetIntHRPValue(HRP_VAR_IFACE_BAR_MODE) != 0);
|
||||
HookCall(0x44C018, gmouse_handle_event_hook); // replaces hack function from HRP
|
||||
}
|
||||
|
||||
void Interface::OnGameLoad() {
|
||||
dots.clear();
|
||||
}
|
||||
@@ -699,6 +694,8 @@ void Interface::init() {
|
||||
// Transparent/Hidden - will not toggle the mouse cursor when the cursor hovers over a transparent/hidden window
|
||||
// ScriptWindow - prevents the player from moving when clicking on the window if the 'Transparent' flag is not set
|
||||
HookCall(0x44B737, gmouse_bk_process_hook);
|
||||
HookCall(0x44C018, gmouse_handle_event_hook); // replaces hack function from HRP
|
||||
if (hrpVersionValid) IFACE_BAR_MODE = (GetIntHRPValue(HRP_VAR_IFACE_BAR_MODE) != 0);
|
||||
}
|
||||
|
||||
void Interface::exit() {
|
||||
|
||||
@@ -10,7 +10,6 @@ public:
|
||||
static void exit();
|
||||
|
||||
static void OnGameLoad();
|
||||
static void OnBeforeGameInit();
|
||||
|
||||
static long ActiveInterfaceWID();
|
||||
static fo::Window* GetWindow(long winType);
|
||||
|
||||
@@ -366,7 +366,6 @@ static void __declspec(naked) main_load_new_hook() {
|
||||
|
||||
static void __stdcall GameInitialization() { // OnBeforeGameInit
|
||||
BugFixes::OnBeforeGameInit();
|
||||
Interface::OnBeforeGameInit();
|
||||
}
|
||||
|
||||
static void __stdcall game_init_hook() { // OnGameInit
|
||||
|
||||
@@ -138,7 +138,7 @@ static void __declspec(naked) game_init_databases_hack1() {
|
||||
mov ecx, [esp + 0x104 + 4]; // path_patches
|
||||
call RemoveDatabase;
|
||||
skip:
|
||||
mov ds:[FO_VAR_master_db_handle], eax; // the pointer of master_patches node will be saved here
|
||||
mov ds:[FO_VAR_master_db_handle], eax; // the pointer of master_patches node will be saved here
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -151,21 +151,21 @@ static void __declspec(naked) game_init_databases_hack2() {
|
||||
mov eax, ds:[FO_VAR_master_db_handle]; // pointer to master_patches node
|
||||
mov eax, [eax]; // eax = master_patches.path
|
||||
call fo::funcoffs::xremovepath_;
|
||||
dec eax; // remove path (critter_patches == master_patches)?
|
||||
jz end; // Yes (jump if 0)
|
||||
dec eax; // 1 = remove path (critter_patches == master_patches)?
|
||||
jz end; // yes (jump if removed)
|
||||
mov ecx, [esp + 0x104 + 4]; // path_patches
|
||||
call RemoveDatabase;
|
||||
end:
|
||||
mov ds:[FO_VAR_critter_db_handle], eax; // the pointer of critter_patches node will be saved here
|
||||
xor ebx, ebx;
|
||||
lea eax, [sfallRes];
|
||||
call fo::funcoffs::db_init_; // init sfall resource file
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __fastcall game_init_databases_hook() { // eax = _master_db_handle
|
||||
fo::PathNode* master_patches = *fo::ptr::master_db_handle;
|
||||
|
||||
fo::func::db_init(sfallRes, 0);
|
||||
|
||||
fo::PathNode* critter_patches = *fo::ptr::critter_db_handle;
|
||||
fo::PathNode* paths = *fo::ptr::paths; // beginning of the chain of paths
|
||||
// insert master_patches/critter_patches at the beginning of the chain of paths
|
||||
@@ -175,6 +175,26 @@ static void __fastcall game_init_databases_hook() { // eax = _master_db_handle
|
||||
}
|
||||
master_patches->next = paths; // master_patches.next -> paths
|
||||
*fo::ptr::paths = master_patches; // set master_patches node at the beginning of the chain of paths
|
||||
|
||||
// remove paths that are identical to master_patches (usually the DATA folder)
|
||||
fo::PathNode* parentPath = *fo::ptr::paths;
|
||||
paths = parentPath->next;
|
||||
while (paths) {
|
||||
if (!paths->isDat && _stricmp(paths->path, (*fo::ptr::paths)->path) == 0) {
|
||||
fo::PathNode* nextPaths = paths->next;
|
||||
__asm {
|
||||
mov eax, [paths];
|
||||
call fo::funcoffs::nfree_; // free path string
|
||||
mov eax, paths;
|
||||
call fo::funcoffs::nfree_; // free self
|
||||
}
|
||||
parentPath->next = nextPaths;
|
||||
paths = nextPaths;
|
||||
} else {
|
||||
parentPath = paths;
|
||||
paths = paths->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
static void __fastcall game_init_databases_hook1() {
|
||||
@@ -187,8 +207,6 @@ static void __fastcall game_init_databases_hook1() {
|
||||
node = node->next;
|
||||
}
|
||||
*fo::ptr::master_db_handle = node; // set pointer to master_patches node
|
||||
|
||||
fo::func::db_init(sfallRes, 0);
|
||||
}
|
||||
*/
|
||||
static void MultiPatchesPatch() {
|
||||
@@ -432,7 +450,7 @@ void LoadOrder::OnGameLoad() {
|
||||
}
|
||||
|
||||
void LoadOrder::init() {
|
||||
SfallResourceFile(); // Add external sfall resource file (load order is before patchXXX.dat)
|
||||
SfallResourceFile(); // Add external sfall resource file (load order: > patchXXX.dat > sfall.dat > ... [last])
|
||||
MultiPatchesPatch();
|
||||
|
||||
//if (IniReader::GetConfigInt("Misc", "DataLoadOrderPatch", 1)) {
|
||||
|
||||
@@ -859,7 +859,7 @@ static void __declspec(naked) sf_inven_display_msg() {
|
||||
static void __declspec(naked) sf_display_print_alt() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push fo::funcoffs::display_print_;
|
||||
push fo::funcoffs::display_print_; // func replaced by HRP
|
||||
push eax; // message
|
||||
call SplitPrintMessage;
|
||||
pop ecx;
|
||||
|
||||
Reference in New Issue
Block a user