Skip to content

Commit c63cc5c

Browse files
committed
v2: Address Copilot PR review (#1609)
1. Hooks.cpp: RE7/MHRISE runtime exclusion for hook_update_before_lock_scene The original compile-time guards (#ifndef RE7 / #ifndef MHRISE) explicitly excluded these two games from the updateBeforeLockScene hook list because via.render.EntityRenderer::updateBeforeLockScene does not exist on them. The universal-build guard change broadened the #if to let every game reach the hook. The body had a tdb_ver()<74 runtime gate but that gate still *admits* RE7 (70) and MHRISE (71), so the hook would scan for a method that never existed, return an error string, and Hooks::on_initialize aborts on the first error — killing the whole Hooks mod on those two games. Added a runtime early-return at the top of hook_update_before_lock_scene for is_re7() || is_mhrise(), restoring the original exclusion behaviour. Verified on RE7: Hooks::on_initialize reaches 'Finished hooking' without the updateBeforeLockScene error. Verified on RE2 (control): updateBeforeLockScene: 7ff74df58f10, hooks still install normally. 2. GameIdentity.cpp: corrected misleading comment derive_engine_params comment claimed runtime TDB auto-detection 'will override' the hardcoded m_tdb_ver for legacy binaries, but no override path exists — members are private and there is no setter or friend accessor that writes m_tdb_ver after initialize(). Rewrote the comment to document actual behaviour: the hardcoded values stand for the lifetime of the process, and demo/trial versions with different TDB versions than the full game must be handled by either a dedicated GameID entry or by hardcoding the correct value (see PRAGMATA_SKETCHBOOK -> TDB 83).
1 parent dc98094 commit c63cc5c

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

shared/sdk/GameIdentity.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,15 @@ void GameIdentity::detect_game() {
136136
void GameIdentity::derive_engine_params() {
137137
// This mapping mirrors the old TDBVer.hpp #ifdef chain.
138138
// Note: the old build had variant builds (RE2_TDB66, RE3_TDB67, RE7_TDB49)
139-
// for older TDB versions of the same game. In the monolithic DLL, we detect
140-
// the TDB version from the actual running binary at SDK init time, not here.
141-
// The values below are the MODERN/LATEST TDB version for each game.
142-
// If a user runs an older game version, the TDB auto-detection in RETypeDB
143-
// will override this.
139+
// for older TDB versions of the same game.
140+
//
141+
// In the monolithic DLL, the values below provide the default per-game
142+
// engine parameters used by GameIdentity, including the modern/latest
143+
// TDB version associated with each title. This function does not perform
144+
// runtime override/mutation of m_tdb_ver for legacy binaries — if a demo
145+
// or trial ships with a different TDB version than the full game, it must
146+
// be handled either by a dedicated GameID entry or by hardcoding the
147+
// correct version here (see PRAGMATA_SKETCHBOOK → TDB 83).
144148

145149
switch (m_game) {
146150
case GameID::RE7:

src/mods/Hooks.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,16 @@ std::optional<std::string> Hooks::hook_all_application_entries() {
508508

509509
std::optional<std::string> Hooks::hook_update_before_lock_scene() {
510510
// This function is removed (or not reflected) >= TDB74...
511+
// Additionally, it never existed in RE7 or MHRISE — attempting to hook
512+
// there returns an error string and aborts the whole Hooks init chain.
513+
#ifdef REFRAMEWORK_UNIVERSAL
514+
{
515+
const auto& gi = sdk::GameIdentity::get();
516+
if (gi.is_re7() || gi.is_mhrise()) {
517+
return std::nullopt;
518+
}
519+
}
520+
#endif
511521
#ifdef REFRAMEWORK_UNIVERSAL
512522
if (sdk::GameIdentity::get().tdb_ver() < 74) {
513523
#else

0 commit comments

Comments
 (0)