Conversation
soh/soh/SohGui/SohMenuBar.cpp
Outdated
| UIWidgets::PaddedEnhancementCheckbox("Original RBA Values", CVAR_ENHANCEMENT("RestoreRBAValues"), true, false); | ||
| UIWidgets::Tooltip("Restores the original outcomes when performing Reverse Bottle Adventure."); |
There was a problem hiding this comment.
this is the biggest reason i'd like to see this land. having (R)BA "just work" is much better than having people check a box to restore the values
|
i didn't mention the other reason i'd like to land this (which is the reason #4650 was made in the first place) - relying on out of bounds indexing of arrays is bad. even though byteswapping the inventory "works" - it's still relying on memory layout in a very fragile way. |
Pepe20129
left a comment
There was a problem hiding this comment.
ITEM_MASK_GERUDO, ITEM_MASK_TRUTH, ITEM_SONG_NOCTURNE & ITEM_SONG_PRELUDE do land in padding bytes, but in n64, they're still stored, meaning it's possible to write something to the bytes with RBA to then read them with BA.
I don't know if we should reproduce this or if it's too niche, but good to mention it anyways.
| #include "variables.h" | ||
| } | ||
|
|
||
| void DoBA(u8 itemOnCRight) { |
There was a problem hiding this comment.
itemOnCRight is always gSaveContext.equips.buttonItems[3], could not pass it
| } | ||
| } | ||
|
|
||
| void DoRBA(uint8_t itemOnCRight, uint8_t itemToPutInBottle) { |
nocturne and prelude were mentioned in the original PR's description #4650
didn't see anything about |
|
It is my mistake, I forgot to mention To support it, I'd recommend adding additional fields in the save struct. But I do think it's rather niche. Also, thanks for taking the time to convert this to |
|
Is there any particular reason you converted the Sorry if the comment is unexpected, but since you've essentially taken over my PR, I felt it was appropriate. |
|
i updated the PR description after changing that, where i said
re:
do you expect to add things to the end of the function? if so, why would it go in there instead of in a new function? re:
i feel the opposite. when i first saw the giant i'd like to get other opinions on this. if the general sense is the |
I have no idea, but I shouldn't have to worry about it. Perhaps I am debugging an issue and want to add some logging at the end of the function. It would be much more convenient if the function didn't have a ton of unneeded early returns.
I disagree. At least with an if/else chain the intent is obvious that only one scenario could happen. With individual ifs, theoritically each condition could happen and you have to consider each one to see if there's a return in there to see if they're actually mutually exclusive. I know this is the eternal early return debate but I am proselytizing that this is a situation where it is not appropriate. |
|
also @Rozelette re:
i'm sorry for stepping on your toes like that. it started as just moving the existing stuff over to use shipinit, but then i "self reviewed" the PR and remembered my thoughts from when you first made the PR my thoughts then were:
with this PR i started by addressing the "thrown straight into z_param" part, but then started on the "giant combo of if/else and switch/case" part i'm happy to close this PR if you'd like to just pull the shipinit part (changes up through c009bc8) over into your PR |
I don't have a problem with it at all! In fact I think the best course of action would be to merge this PR and close my original one, since this uses the modern ShipInit methodology. I just said that as a justification to throw in my 2c, since I don't usually review PRs and, to be honest, I felt a little bit of ownership. RBA was always going to be implementing a complicated table into code so it's bound to be a little messy. |
good deal! i think it sounds like we both want to get to a place where this is at least somewhat easy to read/understand. i'll revert the early return changes and see if i can come up with something that better aligns with your original intent |
d70efeb to
c009bc8
Compare
|
@Rozelette i pushed a commit breaking up the logic into functions, separating the "which cases are we handling" and the "how do we handle those cases" logic i think it makes it a lot easier to glance at i'd love to hear your thoughts! |
|
I think this is a much better way at handling the BA/RBA behaviors. It chunks it into digestible portions. And, it isolates the padding bytes, which is where we may want to improve our behavior in the future. I have no qualms. I apprentice your considerations! |
|
I looked at the logic and it seems to be correct. I know you mentioned that there is some bit magic and there indeed is, but it seems to be correct to me. At the very least, if we do get bug reports that it is incorrect, the logic is isolated so that it is easy to correct. |
|
Merge pending conflicts |
what this does:
what this doesn't do:
Build Artifacts