Skip to content

Support for ppcomp, LS.dat & BetterAEP #3363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

florianessl
Copy link
Member

@florianessl florianessl commented Mar 5, 2025

Support for the "Compact" version of Cherry's PowerPatch features. This version wasn't really a patch but just an external utility program named "ppcomp.exe" (sometimes renamed to ppcomp.dat or ppcomp.dll) which provided access to some new functions by accessing the memory of the running game process.

Detecting the original PowerPatch to give info about compatibility

This is not the full version of the original "Power Patch", which goes way deeper (including early Lua support) & barely found use in any games. But I also added a small heuristic check to detect the "Full" version & log a warning about limited compatibility:

  • This just check for the existence of a file named "powerp.oex" in the game's root
  • Another commit also checks for "warp.dll" which was bundled with PowerMode2003, another popular patch at this particular time period of RPG2003's lifecycle. (Reversing & documenting the origins/versions of that patch actually seems quite tricky - more about that in a future issue...)

Supported PPCOMP functions

  • Quitting & Resetting the game ("QUIT", "RESTART")
  • Calling of in-game scenes
    • "DEBUG"
    • "CALLLOADMENU"
    • "CALLSAVEMENU"
    • "CALLGAMEMENU" (+ setting the cursor position)
    • "CALLTITLESCREEN" (+setting the cursor position)
  • Enabling / Disabling the "UnlockPictures" patch ("UNLOCKPICTURES")
  • Load / Save operations
    • Loading from source [slot-id] ("LOAD")
    • Saving to target [slot-id] ("SAVE")
    • Checking existence of Save [slot id] ("CHECKSAVE")
    • Copying individual save files ("COPYSAVE")
    • Deleting individual save files ("DELETESAVE") (Would require an update for FileFinder -> Support File deletion through VFS  #3266 )
  • GetSaveDateTime
  • GetSystemDateTime
  • SimulateKeyPress (Drafted, but not tested yet - allows for simulating keypresses for a targeted amount of time)
  • ChangeFunctionKey
  • SetMsgBoxColor
  • PauseGame
  • PauseTimer
  • SetVar

NOT PLANNED:

  • SetGlobalBrightness (Apparently this was only implemented to address a blackscreen issue caused by the original patch)
  • ChangeScene (Sounds a bit too dangerous)

For the remaining features, I only found instances of "DELETESAVE" & "SIMULATEKEYPRESS" actually being used in some archived games.
-> These are still TODO

Adjustments to Ineluki KeyPatch implementation

  • I refactored handling for script execution, so that the encountered script.wav files aren't solely handled in the audio mechanism inside Game_System, but will be handled inside the interpreter, when a PlaySE command comes across them there. This is, so that it is possible to get some context for the result of executed scripts & to properly set the field "_async_op" in some cases.
  • Async requests: While a script file isn't yet available, the PlaySE command will result in a "YieldRepeat" async op.
  • Added support for script.wav execution for the "PlayBGM" command. This is rarely seen in games, but is still possible & would have resulted in a warning by the Player when it tried to parse a script INI as Music.
  • I also added support for the known program "LS.dat" which was another way many games with custom title screens used to call the Load Scene.

BetterAEP patch support

While testing this implementation, it quickly became obvious, that many games that were using ppcomp, also relied on BetterAEP, and some used this patches' special functionality to access the Load Scene or even exiting the game via command. (Even though ppcomp also had these options).

So I added support for this patch as well:
Player.exe --patch-better-aep 3350 So far I've only seen games that use the default var-id of '3350' for this.
-> Issue #1182

Some games using ppcomp

Info

@github-actions github-actions bot added Window/Scenes FileFinder Building Settings All about customizable features, storing and applying them Input Input related (gamepads, keyboard mappings, mouse support). For KeyInputProc, add event/interpreter labels Mar 5, 2025
… one call in FileFinder; Moved constant for save file count to "Player::Constants::MaxSaveFiles" (Many instances did not check the overridden count)
… Maniac commands into "Game_Interpreter_Shared" (Many other patches implemented something similar before MP)
…mulation support for some external programs can be properly handled.
…euristic check for the "full" version of PowerPatch (unsupported)
…avior. (Could maybe also be used for improving compatibility the Maniac Load command)
…ript handling (Re-enabling it by default, for easier testing)
- Make options code more dynamic, similar to Scene_Menu, so the option positions could theoretically be swapped or removed entirely
- Added static field "force_cursor_index" to allow overriding the default cursor position
@Ghabry
Copy link
Member

Ghabry commented Mar 23, 2025

The keystate stuff is already in maniac patch https://github.com/EasyRPG/Player/blob/master/src/maniac_patch.cpp#L674

So this could be unified in the file you proposed

@florianessl
Copy link
Member Author

The keystate stuff is already in maniac patch https://github.com/EasyRPG/Player/blob/master/src/maniac_patch.cpp#L674

So this could be unified in the file you proposed

Yeah, I already moved that mapping code as part of another branch that's still WIP:
adb3f37
I included a small "FIXME" note in my last PPCOMP commit.

Copy link
Member Author

@florianessl florianessl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

99c559d

Needs some explanation:
While testing around with the ppcomp debug utility, I first came to the conclusion, that this command is meant to always force the Title Scene, even if something like BetterAEP (also made by Cherry) is used.
At least, I had managed this once in RPG_RT & then promptly added this new force flag to the Player, to ignore the "new-game" option set by other patches/configurations.

But then I couldn't reproduce this at all later. Using this command in a BetterAEP-patched RPG_RT seems to always skip the title screen.

Didn't mean to commit this line at first, but the flag could still be a useful feature.

@Ghabry
Copy link
Member

Ghabry commented Mar 24, 2025

hm that the Ineluki script ran async is another bug. Makes no sense to execute a script this way. Though there are almost no games using Ineluki in the web player so was never noticed 🤔

@florianessl
Copy link
Member Author

florianessl commented Mar 24, 2025

hm that the Ineluki script ran async is another bug. Makes no sense to execute a script this way. Though there are almost no games using Ineluki in the web player so was never noticed 🤔

KeyPatch scripts actually do have a setting for "Wait" that is ignored by EasyRPG but I never checked the details of that one out for myself. So this could maybe lead to behavior changes in some instances :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Building FileFinder Input Input related (gamepads, keyboard mappings, mouse support). For KeyInputProc, add event/interpreter RPG_RT Patches Settings All about customizable features, storing and applying them Window/Scenes
Development

Successfully merging this pull request may close these issues.

3 participants