-
Notifications
You must be signed in to change notification settings - Fork 38
zTalkBox Updates #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
zTalkBox Updates #716
Conversation
AARJL
commented
Jan 4, 2026
- Made small cosmetic changes for empty space and neatness
- Moved reset_auto_wait to lower down the file
- Changed "unsigned long" to "size_t" for ztalkbox::load
- ztalkbox::load_settings(xIniFile& ini) at 95%, seems to be missing a string but could not solve in scratch
- read_bool to 99%, not sure how to fix the issue with the negative and positive arrays
- parse_tag_trap to 99%, I could get to 100% when the if statements are triple nested and goto is used. Might be a better way.
- reset_tag_sound, reset_tag_trap, reset_tag_allow_quit, trigger_allow_quit, trigger_auto_wait all done at 100%
- wait_context& wait_context::operator=(const wait_context& rhs)... yeah....
- stop_audio_effect to 32%, still working on this
- reset_auto_wait, reset_tag_auto_wait, and trigger_trap at 100%
- Added various offsets in zTalkBox.h
- Added struct sound_context in zTalkBox.h
…o used code formmatting tool
|
| Section | From | To | Bytes | |
|---|---|---|---|---|
| 📈 | .rodata |
0.00% | 15.29% | +69 |
| 📈 | .sdata2 |
0.00% | 42.86% | +13 |
| 📈 | .text |
13.36% | 20.27% | +994 |
| Function | From | To | Bytes | |
|---|---|---|---|---|
| ✅ | @unnamed@zTalkBox_cpp@::read_bool(const substr&, bool) |
0.00% | 100.00% | +188 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_auto_wait() |
2.22% | 100.00% | +176 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_auto_wait(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +112 |
| ✅ | @unnamed@zTalkBox_cpp@::trigger_auto_wait(const xtextbox::jot&) |
0.00% | 100.00% | +56 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_sound(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_allow_quit(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| ✅ | @unnamed@zTalkBox_cpp@::trigger_allow_quit(const xtextbox::jot&) |
0.00% | 100.00% | +40 |
| 📈 | @unnamed@zTalkBox_cpp@::parse_tag_trap(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 99.63% | +107 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_trap(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| 📈 | @unnamed@zTalkBox_cpp@::stop_audio_effect() |
0.00% | 32.14% | +27 |
| 📈 | ztalkbox::load_settings(xIniFile&) |
0.00% | 95.96% | +95 |
JoshSanch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice progress :)
Left some feedback so we can work to get this in a merge-ready state.
src/SB/Game/zTalkBox.cpp
Outdated
| } | ||
|
|
||
| void ztalkbox::load(xBase& data, xDynAsset& asset, unsigned long) | ||
| void ztalkbox::load(xBase& data, xDynAsset& asset, size_t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you made this change? It differs from the signature in objdiff which already matched:
ztalkbox::load(xBase&, xDynAsset&, unsigned long)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I made this change because at some point I was asked to use the types.h file when defining variables as signed or unsigned. I guess this does not apply to function signatures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see - good instincts then, but we don't want to use size_t in this instance. Use lowercase u32 instead. size_t has a specific semantic meaning wherein it is the size the particular CPU architecture uses for iterator variables in bits. Since this argument isn't used as an iterator for a loop or anything, u32 is more appropriate.
This article is a solid discussion on size_t to reference: https://www.embedded.com/why-size_t-matters/
src/SB/Game/zTalkBox.cpp
Outdated
| void ztalkbox::load_settings(xIniFile& ini) //TODO | ||
| { | ||
| shared.volume = xIniGetFloat(&ini, "talk_box.volume", 2.0f); | ||
| xDebugAddTweak("Talk Box|\u{1}Globals|volume", &shared.volume, 0.1f, 10.0f, NULL, NULL, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objdiff displays literal characters a little strange - we haven't figured out yet why these particular strings are this way but this is probably a better match for this one:
| xDebugAddTweak("Talk Box|\u{1}Globals|volume", &shared.volume, 0.1f, 10.0f, NULL, NULL, 0); | |
| xDebugAddTweak("Talk Box|\01Globals|volume", &shared.volume, 0.1f, 10.0f, NULL, NULL, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the change but no change in objdiff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's prefer the changed code but share in the Discord somehow so we can help you finish the match. Might just be that the string data memory location is off but the actual code matches.
src/SB/Game/zTalkBox.cpp
Outdated
| ((ztalkbox&)data).load((const ztalkbox::asset_type&)asset); | ||
| } | ||
|
|
||
| void ztalkbox::load_settings(xIniFile& ini) //TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to leave these TODO comments - objdiff and our reporting tooling will show these as not matching 100% so it's redundant here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left these in by mistake, they were for me when I was coding to remember what I was doing. I will remove them along with the DONE comments.
src/SB/Game/zTalkBox.cpp
Outdated
|
|
||
| namespace | ||
| { | ||
| static U8 read_bool(const substr& s, bool def) //TODO 99% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as earlier here - no need for the TODO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
| static U8 read_bool(const substr& s, bool def) //TODO 99% | ||
| { | ||
| extern const substr negative[6]; | ||
| extern const substr positive[6]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I see this but was not sure what to make of it. I will reach out in Discord. Given that I can't seem to use decomp.me for this function due to namespacing issues, what is the best way to get help with that? Most of zTalkBox is in an anonymous namespace and that makes it difficult to reach out for help using that tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a vc screenshare or just sharing pics as we go. I have some thoughts already since it'll have some form like:
| extern const substr positive[6]; | |
| const substr positive[6] = { | |
| {"string1", 1}, | |
| ... | |
| }; |
src/SB/Game/zTalkBox.cpp
Outdated
| shared.auto_wait.query = Q_SKIP; | ||
| } | ||
| static void reset_tag_auto_wait(xtextbox::jot& j, const xtextbox&, const xtextbox& ctb, | ||
| const xtextbox::split_tag&) //DONE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the DONE comment in line with the other review comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
src/SB/Game/zTalkBox.cpp
Outdated
| *(U16*)&this->type = 0; | ||
| } | ||
|
|
||
| static U8 trigger_trap(const xtextbox::jot& j) //DONE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the DONE comment in line with the other review comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
src/SB/Game/zTalkBox.h
Outdated
| ACTION_SET = 0, | ||
| ACTION_PUSH = 1, | ||
| ACTION_POP = 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When enums start at 0 and increment by one, we leave them implicitly defined to avoid visual noise. Opt for this instead, please:
| ACTION_SET = 0, | |
| ACTION_PUSH = 1, | |
| ACTION_POP = 2, | |
| ACTION_SET, | |
| ACTION_PUSH, | |
| ACTION_POP, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these I simply copy and pasted from the dwarf file. I will go ahead and make the changes for all enums from here.
src/SB/Game/zTalkBox.h
Outdated
| TYPE_INVALID = 0, | ||
| TYPE_VOLUME = 1, | ||
| TYPE_TARGET = 2, | ||
| TYPE_ORIGIN = 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply general enum styling feedback from the other one here as well, please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
src/SB/Game/zTalkBox.h
Outdated
| SOURCE_MEMORY = 0, | ||
| SOURCE_STREAM = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply general enum styling feedback from the other one here as well, please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
|
Any comment on I am not sure why it didn't show up as a change here, but we briefly went over this during our VC and I was asked to include it in my next PR to go over it. Line 501 |
I'm going to spend some time seeing if I can get this to match on my own. |
|
| Section | From | To | Bytes | |
|---|---|---|---|---|
| 📈 | .rodata |
0.00% | 15.48% | +70 |
| 📈 | .sdata2 |
0.00% | 42.86% | +13 |
| 📈 | .text |
13.36% | 18.96% | +806 |
| Function | From | To | Bytes | |
|---|---|---|---|---|
| ✅ | @unnamed@zTalkBox_cpp@::reset_auto_wait() |
2.22% | 100.00% | +176 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_auto_wait(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +112 |
| ✅ | @unnamed@zTalkBox_cpp@::trigger_auto_wait(const xtextbox::jot&) |
0.00% | 100.00% | +56 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_sound(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_allow_quit(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| ✅ | @unnamed@zTalkBox_cpp@::trigger_allow_quit(const xtextbox::jot&) |
0.00% | 100.00% | +40 |
| 📈 | @unnamed@zTalkBox_cpp@::parse_tag_trap(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 99.63% | +107 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_trap(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| 📈 | @unnamed@zTalkBox_cpp@::stop_audio_effect() |
0.00% | 32.14% | +27 |
| 📈 | ztalkbox::load_settings(xIniFile&) |
0.00% | 95.96% | +95 |
|
|
|
| Section | From | To | Bytes | |
|---|---|---|---|---|
| 📈 | .rodata |
0.00% | 15.48% | +70 |
| 📈 | .sdata2 |
0.00% | 42.86% | +13 |
| 📈 | .text |
13.36% | 20.27% | +994 |
| Function | From | To | Bytes | |
|---|---|---|---|---|
| ✅ | @unnamed@zTalkBox_cpp@::read_bool(const substr&, bool) |
0.00% | 100.00% | +188 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_auto_wait() |
2.22% | 100.00% | +176 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_auto_wait(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +112 |
| ✅ | @unnamed@zTalkBox_cpp@::trigger_auto_wait(const xtextbox::jot&) |
0.00% | 100.00% | +56 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_sound(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_allow_quit(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| ✅ | @unnamed@zTalkBox_cpp@::trigger_allow_quit(const xtextbox::jot&) |
0.00% | 100.00% | +40 |
| 📈 | @unnamed@zTalkBox_cpp@::parse_tag_trap(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 99.63% | +107 |
| ✅ | @unnamed@zTalkBox_cpp@::reset_tag_trap(xtextbox::jot&, const xtextbox&, const xtextbox&, const xtextbox::split_tag&) |
0.00% | 100.00% | +64 |
| 📈 | @unnamed@zTalkBox_cpp@::stop_audio_effect() |
0.00% | 32.14% | +27 |
| 📈 | ztalkbox::load_settings(xIniFile&) |
0.00% | 95.96% | +95 |
