Shortcut to Finding the Cause of a Crash - Printable Version +- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com) +-- Forum: Hacks/Modding (https://mariokartwii.com/forumdisplay.php?fid=14) +--- Forum: Coding & Hacking General Discussion (https://mariokartwii.com/forumdisplay.php?fid=23) +--- Thread: Shortcut to Finding the Cause of a Crash (/showthread.php?tid=1198) |
Shortcut to Finding the Cause of a Crash - JoshuaMK - 08-04-2019 So you created a code, and while testing, the game crashes. What do you do? Normally, you would restart the game, set a breakpoint on your code address, and painstakingly go stepping through code, frame by frame in some cases to try and pinpoint the cause of the crash. This can take a long time, (you might get lucky though) and this in the long run, is extremely inefficient. So what you do is take advantage of these steps to skip all the hassle and go straight to the cause of the crash. 1.) Use Star's Exception Recovery code, which can be found here > https://mkwii.com/showthread.php?tid=1164&pid=2283#pid2283 2.) With your faulty code and Exception Recovery activated, boot the game, and set a breakpoint on the instruction address: 00000300 3.) Play the game normally with the set breakpoint, and it will pause the game the instant the game crashes. 4.) You will see this set of code: Code: 00000300 mtspr SPRG0, r3 5.) All you need to do now is look at the instruction ABOVE the one you are on. This instruction is what caused the crash. Like this example: Code: 8039C8B8 lis r3, 0x807E 6.) Using what you found, look at your code and try to single out the cause, it could be bad coding that could be remedied with some fixes, or it could be an unsafe register. 7.) Once you have "fixed" the code, do the same steps again and if the game never breaks, you are good to go. There you go! A nifty shortcut to bypass the struggles of predicting crashes and stepping through unneeded amounts of code. Credits: Star (Exception Recovery) RE: Shortcut to Finding the Cause of a Crash - Vega - 08-04-2019 Nice thread I'm still impressed at how fast you are learning all this ASM stuff, it took me AGES to learn the basics. Only thing I haven't seen you touch on is Function Calls (static analysis). RE: Shortcut to Finding the Cause of a Crash - JoshuaMK - 08-04-2019 I simply haven't needed to do any yet. Once I need to I will do it. RE: Shortcut to Finding the Cause of a Crash - Hackwiz - 03-13-2023 I'm going to try this, to figure out why a code that works fine in Dolphin, immediately crashes the Wii. I made a Button toggled code for Manhunt 2, that makes the enemies blind/restores their vision. Now when I say works fine, that was until last night, when I activated the code, in Dolphin, and it generated an error for the first time. I was able to click on ignore, and game play continued, with the code working fine. Hopefully I can make it "error" again with the Exception Recovery code running, and it will give me an idea of what may be causing the Wii to crash. The code is not a C2 or C0 type. I'm NOPing (4) branch conditionals and changing (1) to a direct branch using 32 bit RAM writes. |