Skip to content
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

code_80140DC.s -> string_format #243

Merged
merged 16 commits into from
Nov 1, 2024

Conversation

DizzyEggg
Copy link
Contributor

WIP

@DizzyEggg DizzyEggg marked this pull request as ready for review October 29, 2024 14:57
@DizzyEggg
Copy link
Contributor Author

Ready for review

@AnonymousRandomPerson
Copy link
Collaborator

Looks like there are merge conflicts from the GetEntInfo changes.

@@ -54,7 +54,7 @@ bool8 sub_802DB28(u8 jobSlotIndex, u8 dungeon)
sUnknown_203B2FC->monPortrait.pos.y = 8;

if (sUnknown_203B2FC->monPortrait.faceFile != NULL)
sUnknown_203B2FC->monPortrait.faceData = sUnknown_203B2FC->monPortrait.faceFile->data;
sUnknown_203B2FC->monPortrait.faceData = (void *) sUnknown_203B2FC->monPortrait.faceFile->data;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are all these casts to void* instead of the new PortraitGfx struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because, void * is faster to type 😂

@@ -74,7 +74,7 @@ _0801F2E0:
b _0801F31A
.align 2, 0
_0801F30C: .4byte gUnknown_203B270
_0801F310: .4byte gAvailablePokemonNames
_0801F310: .4byte gFormatBuffer_Monsters
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm unsure about these particular names for the format string buffers.
gFormatBuffer_Monsters and gFormatBuffer_Items ($m and $i formats) do not actually correspond to pokemon and items.
$nX does actually correspond to the name of the X'th gGroundLives entity (at 0x202E2B8, currently incorrectly named gPlayerName - since the first GroundLives does seem to always correspond to the players), but the others are rather generic slots for format strings, and are used as such.
gFormatArgs is fine but unclear it refers to numeric format arguments specifically.

Copy link
Contributor

Choose a reason for hiding this comment

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

Disregard the gPlayerName part - I didn't see you fully decompiled xxx_format_string when I was writing this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used the names from charmap.txt

src/string_format.c Outdated Show resolved Hide resolved
src/string_format.c Outdated Show resolved Hide resolved
src/string_format.c Outdated Show resolved Hide resolved
src/string_format.c Outdated Show resolved Hide resolved
@@ -71,11 +70,11 @@ void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction)
else
{
if (pokemon == target) {
SetMessageArgument(gAvailablePokemonNames,target,0);
SetMessageArgument(gFormatBuffer_Monsters[0],target,0);
Copy link
Contributor

Choose a reason for hiding this comment

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

There needs to be a lot of work done, not in this PR, but properly renaming all the functions that write to the format buffers.
You can't trust the name of the buffer itself to know what's being written, you have to name the functions appropriately, in that case.
This one should be PrintEntityName, SetMessageArgument_2 should be PrintMonsterName, and so on.

(Maybe I can do that once this gets merged, seems like a fun reversing project)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's definitely a good idea to do so. But as you said, let's keep it for another PR.

src/luminous_cave.c Outdated Show resolved Hide resolved
src/party_list_menu.c Outdated Show resolved Hide resolved
@DizzyEggg
Copy link
Contributor Author

Looks like there are merge conflicts from the GetEntInfo changes.

Done

@DizzyEggg DizzyEggg changed the title code_80140DC.s (WIP) code_80140DC.s -> string_format Oct 31, 2024
@AnonymousRandomPerson AnonymousRandomPerson merged commit f0e0a22 into pret:master Nov 1, 2024
1 check passed
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.

3 participants