mlafeldt / ps2rd

Collection of tools to remotely debug PS2 games
GNU Lesser General Public License v3.0
61 stars 7 forks source link

Code parsing error with multi-address codes #7

Closed root670 closed 12 years ago

root670 commented 12 years ago

When using a multi-address code (aka code type 4, http://www.codemasters-project.net/guides/showentry.php?e=847&epage=6) if the value's first character is a 9, the engine treats it as a hook code (i think?). For example, if you enable the "Have All Accessories" cheat for Final Fantasy X-2, the game will fail to boot on real PS2 hardware. However, if you do the same while using an emulator, the game will boot but there are messages of TLB misses near the address that the engine was installed to (0x00080000 for me).

Here's the Have All Accessories cheat for reference: 40374380 00400001 90019000 00020002 40374480 00200001 63636363 00000000

mlafeldt commented 12 years ago

Oh, good catch.

The current implementation is pretty dumb in that it scans the whole cheat list for lines starting with 90 or 91 and adds them as hook codes. Actually, I even put a TODO in said code. :)

See https://github.com/mlafeldt/ps2rd/blob/master/ee/loader/cheatman.c#L138-142

In any case, we either have to improve the parser or use two separate lists for hooks and normal codes.

root670 commented 12 years ago

I think I fixed it in my fork. The game boots, but I haven't checked if multi-address codes are working correctly yet. See here: https://github.com/root670/ps2rd/commit/c87008d5d1f04a86ca0a319ae5e366a163071857

mlafeldt commented 12 years ago

Actually, code type 3 might cause trouble too: https://github.com/mlafeldt/ps2rd/blob/master/Documentation/code_types.txt#L87-93

Also, your commit adds ee/loader/newcheats.txt which is really unrelated to the fix.

Mind cleaning that up and sending me a pull request?

root670 commented 12 years ago

Sure, I'll see if I can fix it up today or tomorrow. I'm still kind of new to git... I'll have to monkey with it.

root670 commented 12 years ago

OK, here's my new commit: https://github.com/root670/ps2rd/commit/1f843f48d7d6b3dbbcf8bef28ecfeff13f272d23

I would like to send you a pull request for this change, bu I don't know how to make a request for just one commit.

mlafeldt commented 12 years ago

Simple enough: Create a branch from master that only contains that commit. Name it something like better-hook-code-detection and push it to GitHub where you can open a pull request for that branch.

root670 commented 12 years ago

Pull request sent.

mlafeldt commented 12 years ago

Merged.