Closed i8sigmapi closed 3 months ago
I've done some testing on my own Pt save file and can confirm intermittent crashing. The location names for the first pair of trees always displayed fine. The times when I didn't crash had gibberish shown for the second pair of trees.
The crash seems to be the result of an out-of-bounds read by line 47, or line 48 trying to display the result.
sprintf(message, "%s\n%s", trees[res[2]], trees[res[3]]);
gui_warn(message);
I'll try a DP save later but suspect the results will be the same.
As DPPt - Honey Tree Manipulator.c
uses the same tree determination and location name lookup logic and didn't crash, this narrows the cause to:
DPPt - Munchlax Tree Checker.c
(string length or bad characters)Transferring to Scripts repo.
This is definitely a spooky bug. I have tried 3 different DPPt saves so far, each with different results:
In hopes that the fix might be this easy, @i8sigmapi can you test something for me?
Y
then X
DPPt - Munchlax Trees Checker.c
scriptIf this works, then I'll commit the fix so it'll be in the next PKSM release.
ahh, i'm so sorry i didn't see this until now!
unfortunately, it still crashes. it hasn't ever even displayed the first pair of trees for me.
[edit] could the varying behavior be tied to which trees it's trying to detect? [edit 2] actually i am now realizing that's probably kind of a ridiculous idea [edit 3] tested with my cartridge save too, since that's distinct from the one i use with twilight menu. same behavior. [edit 4] using the honey tree manipulator, the munchlax trees for these two crashing saves are:
route 210 (celestic), route 212 (pastoria), route 213, route 221
route 208, route 210 (solaceon), route 212 (pastoria), route 215
[edit 5] restoring my shame (the first two edits). like you said, obviously it's probably string related
I should have made this post nearly a month ago (1ba4238) but the script is now fixed.
Instead of being a string issue like I thought, the problem ended up being that IDs were being pulled from the save file as signed int
but the code was expecting unsigned int
.
The fixed version of the script will be bundled in the next release of PKSM. If you want to use the script before then, extract the attached zip to the root of your SD card and run the script by doing the following:
Y
to bring up the Universal scriptsX
to bring up the scripts on your SD cardDPPt - Munchlax Trees Checker.c
Describe the bug Attempting to run the script to determine which trees can give you Munchlax in Platinum version crashes the device.
To Reproduce Steps to reproduce the behavior:
Expected behavior The script should run as intended and inform me of which Honey Trees can contain Munchlax without crashing.
Information about your environment
Additional context Tested on both a dump save and a cartridge save. Happens in both cases.