cxd4 / zs-flash

N64 flash RAM editor for "Legend of Zelda: Majora's Mask".
Creative Commons Zero v1.0 Universal
11 stars 3 forks source link

Game doesn't register that I have the items that are in my inventory #7

Closed ehowe closed 2 years ago

ehowe commented 2 years ago

Acknowledging that this project hasn't had any commits for a very long time and isn't being maintained or updated, I was hoping you could at least point me in the direction of being able to fix this issue myself. I'm trying to recreate a save that I had lost so I can finish playing the game, and this editor got me like 95% of the way there, saving me many hours of grinding, awesome!

I edited the bow, bombs, and other items in that take ammo, but the game still doesn't register that I have those items. They appear in my inventory appropriately though. If I cut down bushes, they drop the ammo, but when I collect it, nothing happens. Similarly, I can't purchase ammo. If I try to buy arrows, the shopkeepers tell me I don't have a bow. If I use the editor to hack in ammo, no matter what quantity I put in, I can only use 1 of them before the counter drops to 0 and I'm back at square 1. I assume there is some flag that needs to be set that isn't there?

Thanks in advance!

cxd4 commented 2 years ago

You'll understand if I'm a bit rusty with this project. (As you noted it's been years.) But I still care about the code...I think, what you might be observing is the game checking the maximum ammo counter in your equipment upgrades. I forgot if Deku Sticks and Deku Nuts have a configurable ammo cap that's just hidden/beta in the save file somewhere, unlike OOT where it was just plainly shown. Powder Kegs I know always behave the way you described: Resets back to 1 ammo even if you gave yourself 99 kegs so may as well just give yourself 2.

I forgot what flag I designated for this but have you tried installing the Hero's Bow, Bombs etc. under the Item Subscreen in the same X,Y position as what the game officially aligns them at (e.g. Ocarina of Time is always top-left-most in Item screen)? I'm almost positive the game assumes you don't have ammo/can't get it because you may have customized the location of sticks, nuts, bow et al against where the game is used to putting them in the Item subscreen and therefore reading from. Let me know. Feel free to post some commands/batch file you use my editor with so I can see what you're running exactly if you're still having trouble.

ehowe commented 2 years ago

Thanks for getting back to me! As far as I can tell, I put all of the items in the right spot, I've attached a screenshot of what the inventory screen looks like. I followed a screenshot that I found online, so it's entirely possible that I put things in the wrong spot, but it seems right. The ammo there was added with the tool, but like I said before, it only allows one use before resetting to 0. The powershell script I used to create the save file, and a copy of the save file itself, are in the zip file attached here:

Zelda - Majora's Mask.zip

And here is the inventory screen:

inventory

Any advice is greatly appreciated!

cxd4 commented 2 years ago

I see. I find in your .ps batch file you have tried to set multiple flags for non_equip_register:

    -U 0x00000003 `
    -U 0X00000018 `
    -U 0x00002000 `

So what this does is redefine the setting twice, writing over what bits you had meant to flag previously. My guess is you wanted all three of those bit masks in combination, which would be simple enough with just one line: -U 0x0000201B.

You do have the Giant's Wallet I see from when I finally got a N64 emulator working on this platform after some time on break from this now, but that was only because of your final redefinition to -U 0x00002000 overriding the previous requests. You can test this with just -U (no suffixing argument) by itself and it shows me this is the word stored in your .fla. Did you try that?

ehowe commented 2 years ago

Well, I just tried that and still no luck. I appreciate your help so far though.

cxd4 commented 2 years ago

So what is your new output when you run -U?

ehowe commented 2 years ago

I now see 0x0000201B, but it seems like it isn't related to that flag since I have the issue with deku sticks and nuts as well.

cxd4 commented 2 years ago

You still cannot buy arrows or shoot more than one?

ehowe commented 2 years ago

Both. If I collect them, the ammo count does not increase and if I try to buy them it says I don't have a bow.

cxd4 commented 2 years ago

For some reason, I could not reproduce this on your save file after the -U fix. Could you send me your new save file?

cxd4 commented 2 years ago

"I think, what you might be observing is the game checking the maximum ammo counter in your equipment upgrades."

@ehowe We'll defer back to my initial post on this issue. The game is not letting you shoot arrows or lay bombs because the save file you are loading does not have a quiver or a bomb bag. But if your equipment screen shows otherwise, you are welcome to send me the updated save file so I can look.

ehowe commented 2 years ago

I finally figured this one out. There must be something wrong with the combination of 0x0000201B because the emulator was resetting it to 0x00002000 every time I loaded it, but since I'm using retroarch I had to convert the .fla to an .srm so I couldn't easily tell what was going on. Using mupen instead showed me that the emulator was doing this. I used the 0x12201B combination that I didn't notice in the documentation before and that worked to get me back on track. Thanks for all of your help!

cxd4 commented 2 years ago

Yes, had updated the Wiki page documentation with notes on fixing Deku sticks and nuts after I read into the issue. I did not realize the game was reusing OOT's old code for Deku item upgrades since you can't really "get" them in MM, but, apparently you can edit the save file to have them. Alternatively...I think historically what I would have done, is not put nuts or seeds in the Item subscreen as you had done, but then buy one/pick one up and then the game auto-assigns the ammo bags for those.

I have no idea what RetroArch is doing. That actually sounds more like a bug in my program to be honest because if the 0x201B got reset, I should think everything else did as well to the last backed up save buffer from before the editor was used. From what I remember off Twinaphex on the old IRC channel I think they had some interest in making .srm correct byte order instead of the little-endian like what Mupen64/Project64 uses. I kind of wanted to get RA set up on here after so many years ago since I had it working but just could not figure it out these days with the lack of documentation.