Romhacking => Newcomer's Board => Topic started by: BassFace on August 18, 2022, 05:11:41 PM

Title: Mega Man X4 Dash Behavior and How to Implement a Hack
Post by: BassFace on August 18, 2022, 05:11:41 PM
Hello all,

I've been messing around with how dashing works in the PSX X games to get them to work more like X1-3 and the Zero games and managed to do this pretty cleanly in Cheat Engine. Where do I start to turn this into an actual patch anyone can apply?
Title: Re: Mega Man X4 Dash Behavior and How to Implement a Hack
Post by: Jorpho on August 18, 2022, 11:32:40 PM
The first thing to do is search around and see if other people have done some work on these games already.

Otherwise, is Cheat Engine something that modifies values in RAM? Because there isn't a particularly easy, standard way to apply that to a game's data – simply because there's no easy, standard way to load data into RAM from the disc. Pretty much the only way is to use a debugger to try to trace how the game writes to the values in question, and hopefully find how it loads that data from the disc.
Title: Re: Mega Man X4 Dash Behavior and How to Implement a Hack
Post by: FAST6191 on August 19, 2022, 06:38:28 AM
Yeah Cheat Engine is an external cheat searching tool many use when their emulators of choice are not up to snuff (and most things that are not 16 bit or older or Nintendo consoles are fairly poor on that front if you are used to the finer stuff in cheat searching).

As above then RAM values to ROM is a more involved process to do it "properly".

That said two provisos, and maybe a third.

1) Where are these cheats? PS1 and such will not read code from the CD (2x CD plus latency is not good for read speeds when you are clocked in MHz) and instead copy a binary to RAM and operate from that. RAM cheats can edit this and thus gain the powers more normally associated with ROM edits/game genies. If the cheats you found interfere with the binary (doubtful if RAM based searching was your thing but not impossible*) then you can trivially transpose that to the ROM where the binary is found (give or take any encryption or compression).

*that said dashing behaviours outside of moon jump usually speaks to something more fundamental in the game, unless it is you replicating pickups/potions/whatever with flags, which is less commonly the domain of cheat search be able to be worked up to the point of a cheat end users can use (you might use a memory viewer to analyse position behaviours to then set breakpoints to analyse the actual movement instructions to make things faster/different distances/different max height/different cooldowns/different charge up/different invincibility frames/...).

2) I don't think there are any for the PS1 (saw some early work for the N64 a while back though) but some systems can have cheats hardcoded in by fairly simple tools as they have enough overhead, and easy enough to find instructions/hooking points for automated tools to get at. GBAATM and DSATM on the GBA and DS respectively being some of the more noted examples of such a thing in action.
2a) Hardpatching cheats is not so bad as an intro to assembly. Usual methods are find the vblank routine (runs 50-60 times a second depending upon region/graphics mode) and insert a write or whatever you are doing into that or find where the value in question is changed and alter that (if death subtract one from lives count can be if death add one to lives count/do nothing fairly easily, though more annoying if there are 50 different death types with their own take on that where the basic write it every frame/on button press approach has fewer annoyances).

3) Depending upon where you are planning on running this PS1 game there might be enough for an underlying OS to do the cheat for you instead. PS3 and PSP on up most likely, though some of the new PS2 stuff might need some investigation. Such methods are however popular on newer consoles with a hacked firmware that continues to run in the background of games.