maximegmd/CyberEngineTweaks

Possible "IsDebug" function & other findings

emoose opened this issue · 8 comments

Found an "IsDebug" function at 140207F70 (GOG v1.04), editing it to return 1 seems to enable debug option on the menus just like the current IsFinal hook (without needing IsFinal hook applied), but there might be other things this enables too (WorldMapMenuGameController::CanDebugTeleport seems to point to this function, didn't see any way to teleport yet though...)

Maybe worth investigating some more. Looks like this func might also be used as a nullsub for a few funcs that return 0 though (eg. some IsInGameMenuVisible/IsMessageBoxVisible things also point to this func), so probably better to hook the debug-related xrefs/binds to this instead of patching the func itself.

E: Also found that nopping the JZ at 1428C4F7B (or the one at 1428A2BB9) allows skipping the "Breaching..." screen on startup (the same as using -skipStartScreen param), might be nice to have this as a config option instead so that the param isn't required (also hoping there's some way to skip the whole intro/splash screens too...)

E2: Found a way to mostly get rid of all peds/traffic too (besides peds that I guess were manually placed/hardcoded to certain spots, still removes pretty much all the peds that walk around though), just patch the JLE at 141D5E70E to a JMP instead (0F 8E E1 02 00 -> E9 E2 02 00 00), saw a lot of people ask about this on NexusMods since the INI settings didn't seem to disable them properly, maybe it'd help performance for some people.

Thanks for the info I will take a look at this and let you know

I have integrated both the Breaching skip and pedestrians/traffic. Thanks for your work, don't hesitate to let me know if you find something else you find or make a PR :)

Found how to disable the map barriers, normally game shows a "you can't go this way... at the moment" text and then teleports you back in bounds, but patching 141A929A8 to RET should get rid of the text & stop the teleport (game still seems to do the glitchy-screen effect that happens when it teleports you though, but the actual teleporting shouldn't happen)

AFAIK this is changing the WorldBoundarySystem/Tick function, so this should only be affecting the map boundary teleport hopefully.

Got a way to disable vignette on crouch too, just patch 140085520 to RET.
Think this prevents effectVignettePlayData from being created, or is stopping something to do with that anyway.
Doesn't seem to give any problems in-game, but I haven't tested it all that much yet.

E: just checked photo mode as well, vignette setting still seems to work fine there too :)

E2: found a better way to do it I think, 141154CF0 seems to be a func that returns a bool if vignette should be on/off, patching it to xor al, al/ret seems to work fine, probably better than the other patch since this one could be enabled/disabled without needing to restart the game.

Found how to get debug teleport working, r6\config\inputUserMappings.xml needs to be edited so that "world_map_menu_debug_teleport" has a keyboard mapping for it, since they only mapped it to a controller it seems >.>

Search "world_map_menu_debug_teleport" and then add
<button id="IK_O"/>
under it.

With that in place, if you patch the IsDebug function I mentioned to return 1 now you can highlight an icon on the map screen and hold O to teleport there.
(like I mentioned earlier it's probably not a good idea to patch this IsDebug func though since some other non-debug stuff uses it, maybe could hook "CanDebugTeleport" script func instead? there's like 5 other debug things that also use this IsDebug thing too though, would be nice if we could get them all hooked)

@emoose any luck yet on looking into the other intro videos/start screen? When I start the game there is still a screen after the intro/logo videos where I have to press Space to continue to the main menu.

@dwasss spent a few hours looking into it, but think I finally got something.

Seems skipping the SplashScreenLoadingScreenLogicController::logoTrainWBBink/logoTrainNamcoBink/logoTrainStadiaBink/logoTrainNoRTXBink/logoTrainRTXBink/introMessageBink variables from being created should hopefully stop the intro logos from starting.
(still leaves the intro audio playing though, seems that needs to be loaded in for the game to advance for some reason)

Unfortunately with the intro movies removed the game replaces it with a loading screen instead, which for me takes almost as long as the movies themselves did... it's still a few seconds shorter than the logos were though (can tell by the audio)

Really this is a pretty nasty hack though, but I guess it's good enough until we're able to edit the splash screen scripts ourselves IMO.

E: oh and this doesn't help with needing to press space unfortunately. I'll try looking into that later on.

E2: also updated unlock_menu_patch.cpp so it can hook the IsDebug stuff I mentioned earlier too, works fine for enabling debug teleport (as long as inputUserMappings.xml is updated)

https://pastebin.com/8NjMxKtp

There's still some things I want to tidy up before I PR that though, was also thinking maybe this patch should be renamed from unlock_menu to enable_debug or something like that, any thoughts?

I agree that this patch should be renamed if we add more stuff but for compatibility's sake, the old unlock_menu json option should be upgraded automatically by the mod if present.

Also I agree that we must avoid modified EXEs, that's why I would suggest not posting the address and patterns and just make it available via PR when ready.

Good work :)