Commit graph

74 commits

Author SHA1 Message Date
KeybadeBlox
d372c17094 Miscellaneous name mangling improvements
Improved error reporting, skipping undesirable symbols like jump tables,
skipping special symbols like intrinsics, etc.
2026-02-12 21:15:52 -05:00
KeybadeBlox
78127e64ef Arguments via environment variables in delink.sh
It was really annoying having to type all that in every time.
2026-02-12 16:16:07 -05:00
KeybadeBlox
13048fef71 Tidy up compiler options
Nothing affecting codegen.
2026-02-12 16:07:14 -05:00
KeybadeBlox
05b4da2f78 Mangle referenced symbols in mangling script
This produces correct symbol names in disassembly in objdiff.
2026-02-12 00:36:40 -05:00
KeybadeBlox
0e84f9ab1f Refine for virtual method check in mangling script
We used the flimsy heuristic of a reference from non-executable memory
to try to guess at whether a reference was a vtable, but now we just
check whether it's been named as a vtable.
2026-02-11 21:14:46 -05:00
KeybadeBlox
53b0e82417 Include headless demangling in delink.sh
This means we get delinked objects with proper mangled names matching
our recompiled files.
2026-02-11 20:23:26 -05:00
KeybadeBlox
55046bf009 Better handle undefined types in mangling script 2026-02-11 20:17:22 -05:00
KeybadeBlox
e9b0c3c6bc Complete mangler script
Now to hook it up to the delinker script.

(I totally accidentally said "demangling" in the last commit)
2026-02-11 00:46:33 -05:00
KeybadeBlox
febf9fc172 Finish function demangling
Data demangling should be much easier.
2026-02-10 00:06:29 -05:00
KeybadeBlox
f193fef3ce Enable string pooling
JSRF evidently has string pooling enabled (i.e. program-wide
deduplication of strings), so we'll want it in our compiler settings as
well.
2026-02-09 23:53:24 -05:00
KeybadeBlox
e6d7acfa05 Fix some disconnected symbols in objdiff
This will be so much easier when we can export with name mangling.
2026-02-07 22:09:26 -05:00
KeybadeBlox
576a60d331 Mostly finish function name mangling
Still need to do function pointers.
2026-02-07 22:08:02 -05:00
KeybadeBlox
76e39fdd27 Begin Ghidra mangling script
Looks like we'll be writing our own Ghidra scripts.  At least these
should enable pretty thorough sharing of work and decent UX.
2026-02-05 22:31:36 -05:00
KeybadeBlox
e668b52cd0 Add to GameObj::removeChildrenFromObjList() 2026-02-05 21:11:11 -05:00
KeybadeBlox
35c8844529 Move everything else to ghidra/ directory
The only stuff left in delink/ was also for using with Ghidra, so we may
as well also put it in ghidra/.
2026-02-04 20:01:06 -05:00
KeybadeBlox
63002e0f08 Add data type import for Ghidra 2026-02-04 19:52:12 -05:00
KeybadeBlox
30f8a5879e Include namespace in symbol table
This introduces its own issues, but without namespaces, symbol names end
up repeated and delinking fails.  The delinked symbols also end up
without namespaces, introducing yet more problems.  This is an
improvement for now, but we'll need proper namespace importing into
Ghidra at some point.
2026-02-01 21:11:26 -05:00
KeybadeBlox
cef08bf624 Documentation enhancements for delink.sh
Thanks to Shanghao for helping find and test these different issues.
2026-02-01 17:35:49 -05:00
KeybadeBlox
91537e765a Fix unwanted delinking path expansion on Windows
In short, we ran afoul of this issue because the Ghidra delinking
headless script begins its arguments with slashes, making them look like
absolute paths:

    https://stackoverflow.com/questions/7250130/how-to-stop-mingw-and-msys-from-mangling-path-names-given-at-the-command-line
2026-02-01 17:02:13 -05:00
KeybadeBlox
a8b04d24d5 Fix POSIX shell compatibility of delink script
Accidentally used == for a comparison instead of =, while only the
latter is in the standard.

Ref. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
2026-02-01 15:36:35 -05:00
KeybadeBlox
ddc10a878c Minor correction to Decompiling C++
Destructors are not directly registered for exit, but instead called by a
tiny function that's registered.
2026-01-13 21:55:22 -05:00
KeybadeBlox
44a8d704ef Populate JSRF/GameData.cpp 2026-01-12 22:59:47 -05:00
KeybadeBlox
cbcc22ec9d Fix contribution guide link 2026-01-12 09:51:56 -05:00
KeybadeBlox
fbc5619d6a Begin populating JSRF/GameData.hpp 2026-01-12 09:46:56 -05:00
KeybadeBlox
d11f2fd538 Delink JSRF/GameData 2026-01-11 20:46:54 -05:00
KeybadeBlox
8c9f622ab5 Decompiling C++: Add static object initialization 2026-01-09 21:06:28 -05:00
KeybadeBlox
ee519090c1 Add "estimated total progress"
There have been cases of the "decompilation progress" metric being
confused for total progress, so a new figure has been added (in bold)
roughly estimating the total progress by multiplying the other two
together.
2026-01-09 19:29:44 -05:00
KeybadeBlox
d06de00855 Complete Decompiling C++ article (for now) 2026-01-05 23:04:51 -05:00
KeybadeBlox
547f2ba179 Create docs directory; begin "Decompiling C++" 2026-01-03 23:20:39 -05:00
KeybadeBlox
683818b637 Separate compiler optimization flags
The /O2 used before was actually a preset for a bunch of more specific
flags, which are now written explicitly for clarity and easier
modification later.
2026-01-03 16:13:44 -05:00
KeybadeBlox
4dae5206c0 Minor decompiling in JSRF/Core 2026-01-02 23:14:59 -05:00
KeybadeBlox
1b08163c08 Disable inlining
JSRF appears to have it disabled despite other optimizations.  Even if
it was enabled, anyways, we'd still be decompiling the post-inlining
functions and wouldn't want any further inlining to take place (we want
the compiler to compile each function the way we write it).
2026-01-02 22:38:23 -05:00
KeybadeBlox
08abfd3913 Finish populating JSRF/Core 2026-01-02 00:05:52 -05:00
KeybadeBlox
f8578b0871 Continue populating JSRF/Core 2025-12-31 23:03:36 -05:00
KeybadeBlox
f65876135d Remove redundant compilation flag
The flag in question was already the default setting.
2025-12-31 23:02:58 -05:00
KeybadeBlox
71937e4a97 Begin populating JSRF/Core 2025-12-31 11:14:07 -05:00
KeybadeBlox
22a8c350eb Correct .data section ranges in delinked objects
The change in the previous commit was a silly case of not thinking
things through, not realizing that the .data range moved to Core.obj was
nowhere near the beginning of the section as it should be.  g_game has
been moved back into Jet2.obj (time will tell if this is correct) and a
missed data strucure at the beginning of .data (where it ought to be)
now makes up Core.obj's .data portion.
2025-12-30 00:39:14 -05:00
KeybadeBlox
9e638e0ec2 Add note to avoid symbol conflicts when delinking 2025-12-29 09:43:59 -05:00
KeybadeBlox
22a0e1fa9a Update progress 2025-12-29 00:54:59 -05:00
KeybadeBlox
a25790e8a6 Delink Core.obj 2025-12-29 00:44:27 -05:00
KeybadeBlox
8eda56dcdf Change executable section flags to please objiff
objdiff assumes that all symbols in executable memory sections are code,
which led to misbehaviour due to .rdata and .data being marked as
executable in JSRF.  We now set these sections to non-executable in
Ghidra to work around this.
2025-12-21 19:36:09 -05:00
KeybadeBlox
70cc4ca688 Add stylistic consistency to contribution guide 2025-12-21 09:39:55 -05:00
KeybadeBlox
fe94d467df Update repository URLs 2025-12-18 22:41:08 -05:00
KeybadeBlox
115052d2a5 Rewrite readme for official decomp repository
I guess this isn't just notes anymore.
2025-12-18 22:38:21 -05:00
KeybadeBlox
5692ee9531 Minor code tidying
Mostly consistency with file headers and other such trifling things.
2025-12-18 22:09:47 -05:00
KeybadeBlox
b40e9a0c56 Rename Microsoft decompile directory to XDK
Felt more appropriate to name it after the library it's implementing
than the vendor.
2025-12-18 21:55:03 -05:00
KeybadeBlox
6ac4cdc5ed First-er draft of contributing.md
Some notes on keeping data structure definitions in decompiled source
files have been added, and a section was added for specific topics in
the future.
2025-12-18 21:53:53 -05:00
KeybadeBlox
83553a3d24 Remove padding from Jet2.obj address ranges 2025-12-18 09:30:29 -05:00
KeybadeBlox
070b2f9376 Finish first draft of contributing.md 2025-12-18 00:16:21 -05:00
KeybadeBlox
aabd8337b3 Complete "Setting Up Decompilation" documentation 2025-12-17 22:08:15 -05:00