yling / yPokeStats

yPokeStats is a LUA script used to display information about Pokemon games. It can be used with GBC/GBA/NDS emulators that support LUA scripts.
The Unlicense
24 stars 3 forks source link

Pokemon White BUG found for ROM and Nature calculation #3

Open pdevereux1 opened 1 year ago

pdevereux1 commented 1 year ago

Using Pokemon White version for the DSI USA edition, I found a couple of bugs in the program and found easy fixes for them.

FIRST: To fix the common bug of a version not being supported, I found my version of the game with these properties:

games["POKEMON W"]["O"]={"Pokemon White (US)", 0x022349D4, 0x0226AD14, 0xDC}

The above code also adds the correct hex values for trainer memory location and enemy memory location for this version. This was added to line 113 of gamesdata.lua

SECOND: Starting in generation 5, nature is no longer calculated using the PID and instead is a location in the Pokemon data structure. Nature is located at 0x41, thus the correct nature is found via the following:

pokemon["nature"]["nature"]=getbits(decrypted[0x40+offset["B"]],8,8)

Because I was programming super lazily, I just redid the whole calc at line 418 of memory.lua

The rest of the math still works, as the table for natures remains unchanged. If this repo is still being updated, I recommend taking a look at this, otherwise for people who are having issues, follow the steps above to fix it.

yling commented 1 year ago

Thank you for your report, I'll make sure to update the script with these after I try and verify them.

Le sam. 3 juin 2023, 03:23, pdevereux1 @.***> a écrit :

Using Pokemon White version for the DSI USA edition, I found a couple of bugs in the program and found easy fixes for them.

FIRST: To fix the common bug of a version not being supported, I found my version of the game with these properties:

games["POKEMON W"]["O"]={"Pokemon White (US)", 0x022349D4, 0x0226AD14, 0xDC}

The above code also adds the correct hex values for trainer memory location and enemy memory location for this version. This was added to line 113 of gamesdata.lua

SECOND: Starting in generation 5, nature is no longer calculated using the PID and instead is a location in the Pokemon data structure. Nature is located at 0x41, thus the correct nature is found via the following:

pokemon["nature"]["nature"]=getbits(decrypted[0x40+offset["B"]],8,8)

Because I was programming super lazily, I just redid the whole calc at line 418 of memory.lua

The rest of the math still works, as the table for natures remains unchanged. If this repo is still being updated, I recommend taking a look at this, otherwise for people who are having issues, follow the steps above to fix it.

— Reply to this email directly, view it on GitHub https://github.com/yling/yPokeStats/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD676VT7CH5F7KVEYW54P3XJKGXPANCNFSM6AAAAAAYY6RTDA . You are receiving this because you are subscribed to this thread.Message ID: @.***>