-
Notifications
You must be signed in to change notification settings - Fork 42
Decompiled search_level_by_id and fixed a symbol metadata issue that was preventing a matching rebuild. #267
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?
Changes from all commits
237541d
f968e31
48a6244
a2801b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,28 @@ JUNK_WORD(0x0000102D); | |
|
|
||
| INCLUDE_ASM("asm/nonmatchings/P2/game", search_level_by_load_data); | ||
|
|
||
| INCLUDE_ASM("asm/nonmatchings/P2/game", search_level_by_id); | ||
| extern LevelLoadData D_00247AF0[46]; | ||
|
|
||
| LevelLoadData *search_level_by_id(int search_id) | ||
| { | ||
| LevelLoadData *level = D_00247AF0; | ||
| LevelLoadData *end = D_00247AF0 + 46; | ||
|
|
||
| loop: | ||
| if (search_id != level->level_id) | ||
| { | ||
| level++; | ||
|
|
||
| if (level < end) | ||
| { | ||
| goto loop; | ||
| } | ||
|
|
||
| return NULL; | ||
| } | ||
|
Comment on lines
+46
to
+57
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this could be done with a while loop? It's unlikely that they used
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I originally tried, and retested today, rewriting the function using more common loop constructs, such as a while loop, but was only able to produce a matching build using goto. Yes, I agree - odd...
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I managed to get a full match with a for loop. Do a for loop for each LevelLoadData *search_level_by_id(int search_id)
{
for (uint i = 0; i < sizeof(D_00247AF0) / sizeof(LevelLoadData); i++)
{
LevelLoadData *level = &D_00247AF0[i];
if (search_id == level->level_id)
{
return level;
}
}
return NULL;
} |
||
|
|
||
| return level; | ||
| } | ||
|
|
||
| INCLUDE_ASM("asm/nonmatchings/P2/game", PchzFriendlyFromWid); | ||
|
|
||
|
|
||
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.
You need to mangle the name instead of treating it as C code. Take a look at the
config/symbol_addrs.txtfile and find the entry forsearch_level_by_id. Change it tosearch_level_by_id__Fiand then remove theextern "C"from the declaration.