Get Item Manipulation Hotpatched#6633
Conversation
Added GIM HotPatch to handle specific item ID cases. No universal meens of making gim work, something is weird about SoH specific changes (probably to do with rando implementation) and a per item hotpatch is required.
Added conditional logic for displaying different textboxes based on item ID.
| ItemTable* itemTable = RetrieveItemTable(tableID); | ||
|
|
||
| // GIM HotPatch | ||
| if (getItemID > 32767) |
There was a problem hiding this comment.
can this mapping be made complete?
There was a problem hiding this comment.
It can but based on how ship is moving the item table around and not using a contiguous item table, we would need to actually mod the chest values in wiivc or n64 with a good emu, and just test it over and over to swap over. I have the tables on an image to know what values to swap for every item in the game if we want to go that route.
There was a problem hiding this comment.
There isnt any math i could find to auto swap around properly but i did test this with seeds and know 100% that the other items you invoke gim with do NOT affect the outcome, its purely the chest id's that are moving it. Realistically a variation of this could be supported in rando as well as you would still get negative id's and we could hot swap them around too (with a dedicated gim lookup table) to move around which items you grab from the pool.
There was a problem hiding this comment.
I just messaged a romhacker friend hoping hell set me up a romhack with a bunch of chests 😅 so Ill get a full table... afaik any places that people have found to do gim in vanilla game right now though only grabs light arrows and that blue potion and theres not a lot of places its totally possible to begin with... thats why I didnt hunt em out before trying to submit this.
There was a problem hiding this comment.
Never mind! Give me a short bit, i found a table someone generated out that I can reuse -> They found all the item swaps! Theyre right here:
https://docs.google.com/spreadsheets/d/1iC55h-oy3NAIW739yNQ8Cg9QNpDGTyVRys_NLHpnG_o/edit?gid=0#gid=0
Those ids on the left are if you take the unsigned first byte of the value (184 and 191).
There was a problem hiding this comment.
Okay @serprex I have padded out a full lookup table... this should restore functionality for any SRM OOB items too (But i suck at srm so its untested).
Reasonably if the gim table lookup is applied to rando, GIM could also be used in randos to grab values from the primary item table prematurely just so this is another glitch useful to rando for those with the skill.
|
Just to showcase what this is if anyone doesnt know: 3:25 is where the action begins, burning the web is an unrelated task... Upon entering the room ID 65 is loaded on the actor init for the chest (dungeon map). Upon falling down to basement, ID 72 is loaded on the small chest (recovery heart). Once he bugs links state so it thinks hes swimming while walking around, he cancels the pickup of the Nut. The game does try to invoke some collection code of the nut but gives up. Once he walks into one of the chests, it does store that 65 or 72, however upon entering water the game is turning that value negative (-65 or -72). This patch is swapping those negative values that otherwise crash with the same items wiivc and n64 versions would do when you prevent the game from crashing (wiivc already just works, n64 blocks crash with certain gfx plugins). You will see at 5:18 he is awarded a bottle, (the official games give a blue pot bottle but I couldnt get it to award a bottle slot when setting that directly) and at 5:49 he is awarded light arrows. There was a detection for negative values which should only happen with GIM/SRM so the textbox could swap with compass as the original game did. The compass textbox for speedrunners is also necessary for timing on tricks because the natural textbox for the item awards is long and causes issues lining up. |
Any SRM values that go out of bounds now correctly returns the correct results, and GIM still works!
|
|
||
| // GIM HotPatch | ||
| if (getItemID > 32767) | ||
| getItemID = GimIdTable[(getItemID & 0xFF)-128]; |
There was a problem hiding this comment.
this seems like it'd be an out-of-bounds read when getItemID & 0xFF < 127
There was a problem hiding this comment.
im assuming that case would never happen... the check above is for negative numbers coming in (since its converted to unsigned). The tables that were documented never showed more than the 128 values and we would have to dump 128 dummy values in the array just to ensure a value that probably is impossible to occur wouldnt crash (which still is crashing rn anyway)
The glitch is occuring from taking what would already be valid item ids from a chest and flipping them negative so realistically i dont see that ever happening anyway.
There was a problem hiding this comment.
i just put in extra stuff anyway. 🤷♀️
There was a problem hiding this comment.
good god just realized i typod... i been putting the stuff into git by hand, unsure how the github thing can take my changes without putting 90 other files from setup
My bad, typing stuff into github directly... dunno how to sync properly from client yet, it forces me to stash my changes.
serprex
left a comment
There was a problem hiding this comment.
won't be able to test until next week
|
no worries 🤣 i appreciate you taking time to interact here as you have! i wanna help fix any bugs related to speedrunning singleplayer and co op so expect to see my name some more haha. Im tryna shake up the wiivc leaderboards by taking excuse away to do stuff on ship (the competition is fresh here, and the smoother run and accessibility can make it more approachable). Edit: Also I have no idea why its showing the clang-format fail, cause it looks like it tried to run both code from the typo fix I added and the pre-typo fix at the same time despite it not showing that combination in the source i submitted last? And if you have any insight onto how I can submit my changes directly from my machine to a git client I would appreciate it... maybe it was in the docs and I missed it, but I use the github client and it was just trying to sync a bunch of random crap and forcing me to stash the code changes I made and so its been a pain just trying to replicate it over... Yesterday or the day before whenever I submitted the borked thing I was literally typing it from my phone to github 😅 and just didnt even copy it correctly and when I posted the correction i reduced the verbosity as well... Id like to not do stupid things like that in my future pull requests. |
This doesnt realistically break anything but restores GIM on ship so speedruns are possible while also preventing the game from crashing.
Build Artifacts