Skip to content

main: decompile a few small helper functions#28

Merged
Xeeynamo merged 1 commit into
Xeeynamo:mainfrom
khasinski:main-small-helper-decomp
Jun 30, 2026
Merged

main: decompile a few small helper functions#28
Xeeynamo merged 1 commit into
Xeeynamo:mainfrom
khasinski:main-small-helper-decomp

Conversation

@khasinski

Copy link
Copy Markdown
Contributor

This decompiles a few small helper functions in src/main/18B8.c:

  • func_80014B70
  • func_80014C80
  • func_80015B44
  • func_80015B50
  • func_80015B88
  • func_800211B8

This is a small first contribution as I get familiar with the project.

A few naming observations, left out of the patch to keep the change focused:

  • func_80014B70 appears to return the next pseudo-random byte from an 8-byte state and lookup table.
  • func_80014BA8 appears to scale that byte into a range.
  • func_80014C80 appears to allocate/register text buffer offsets.
  • func_80015B44, func_80015B50, and func_80015B88 appear to operate on entries in the BIN-GZIP/kernel archive stream: setting the current entry pointer, reading entry type, and reading entry id.

Thank you for maintaining this project.

Verification:

  • make build passes
  • all SHA1 checks pass

@khasinski khasinski force-pushed the main-small-helper-decomp branch from b2f25e4 to 3a499fe Compare June 29, 2026 17:18

@Xeeynamo Xeeynamo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for contributing. I left a minor nit that could be addressed in a follow-up PR

Comment thread src/main/18B8.c
text_offset = D_80062E20;
D_80069490[text_index] = text_offset;
D_80062E20 = text_offset + arg0;
return (s32)(D_80063690 + text_offset);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you verify if you can remove both cast and parentheses?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review and merge!

I didn’t verify removing both the cast and parentheses before this PR. I’ll test that form locally and send it with the next small cleanup/decomp PR if it still matches.

@Xeeynamo Xeeynamo merged commit f5c6755 into Xeeynamo:main Jun 30, 2026
1 check passed
@khasinski khasinski deleted the main-small-helper-decomp branch June 30, 2026 16:38
@khasinski

khasinski commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

I checked this locally. Removing the cast and parentheses still matches; changing func_80014C80 to return u8* also avoids introducing a pointer-to-int warning. Opened the cleanup as follow-up PR #30.

Xeeynamo pushed a commit that referenced this pull request Jun 30, 2026
## Summary

- Update `func_80014C80` to return `u8*`, matching the text buffer
pointer it produces
- Remove the now-unneeded cast and parentheses from the return
expression

Follow-up to the review note in #28.

## Verification

- Docker `make build`: all built executables reported `OK`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants