-
Notifications
You must be signed in to change notification settings - Fork 7
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
MK1.EXE missing/incorrect function and/or branch labels #15
Comments
Hi there, you kind of guessed right. It's not so much that names are missing, it's more that they aren't there to begin with. Lets stick to Also, named labels (i.e. those from debug info) only come with a start offset, but not with an end offset (or a size indicator). Thus, there is no reliable information available regarding how long function To cut a long story short: |
To quickly answer that:
|
Thank you for your detailed reply—much appreciated. So it seems the issue might be related to the compile flags they used. It’s a shame about MK1, as the full arcade source has leaked for that version yet. On the other hand, MK2 doesn’t appear to suffer from the same reduction in symbol information. When I look at mains.mk2.asm, it seems to retain many more function names, possibly all of them. |
You're welcome. It's always an interesting topic to talk about.
Well, maybe. Hard to say. The debug info of With MK1, there is also one major difference: it was originally written in Assembler, not C. It was a direct port of the arcade version, which can be deducted from object 2, which contains variables that emulate the arcade machine's register set (offset
|
I've taken a closer look at the decompilation output, and it’s clear that many functions are not correctly named and they are they're not just labels for branches. However, these misnamed functions seem to be internal to the compiled module. It appears that only the function symbols with linkages to other compiled modules retain their names. For instance, here are the function symbols in MAIN.ASM that are correctly named: P1_START_BUTTON All of these functions are either called or jumped to from other modules.
Are you sure that core of it is written in C? When I look at the decomp of mains.mk2.asm it very much seems like MK1 style port from TMS34010 to x86 ASM. I would have thought that the variable names and ASM structure would different if it was compiled C |
Which functions do you consider to be named incorrectly and what makes you come to that conclusion?
I might have been thinking about a different project. It's been several years since had a good look at MK disassembly (started this project over 10 years ago). Looking at it again now, MK2 also was Assembler (e.g. same |
There are too many to list, but one example is WHO_IS_ALONE. This function is actually very simple and short:
However, the |
Now I see what you mean. Interesting, nice find. I never did do a comprehensive deep-dive into MK's disassembly, as my attention at some point shifted towards developing my then MK-only disassembly tool further into a multi-purpose one (which is what wcdatool is now). I planned on resuming code analysis later on, but then a couple of years later actual MK sources surfaced (PlayStation port, iirc), thus further probing the disassembly became a lot less appealing. From a quick look at my notes from back then, I can tell that at some point I hypothesized that MK1's debug info might either be corrupted, truncated/incomplete or limited to exported symbols only (which is essentially the same as your "only the function symbols with linkages to other compiled modules" assumption). So yes, those labels can be considered incorrect, but there is not a lot that could be done to improve the tool's handling of those (other than resorting to labeling them as Be aware though that wcdatool was designed with manual intervention/correction in mind:
(see output file |
Do you have an email that I can contact you? |
Further discussion moved to email. |
I’ve noticed that several function or branch names are missing, with the previous symbol name being propagated downwards. For example, in the decompilation of MK1.EXE, within MAIN.ASM, the DO_A11_BACKGROUND symbol seems to extend beyond its intended scope. Specifically, DO_A11_BACKGROUND should represent more than one branch, but it continues to be used down to DO_A11_BACKGROUND_branch_41, causing the symbols for branches below it to be lost.
Could this be an issue with the decompilation tool, or is it possible that the compiler optimised these symbols out, preventing them from being included? I did a quick search for strings in the executable and suspect it might be the latter, but I’d appreciate your insights.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: