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

WIP - Jak 2 Support #4

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

WIP - Jak 2 Support #4

wants to merge 10 commits into from

Conversation

xTVaser
Copy link
Owner

@xTVaser xTVaser commented Jul 22, 2020

Changes So Far

  • The disassembly will not abort on the first sign of failure, it will try disassembling every file, and if a symbol cant be resolved it gets replaced with ???. This is mostly to speed up resolving issues, solving the ones that effect multiple files first and foremost.

Active Issues:

  • id 25 support needs to be added
  • assertion failures in link.cppL529
  • mtnext-vis: (00010060) Unknown SPECIAL opcode r0, r1, r0, 0x01, 0x20 is a unique one
  • Frequently across many files, the id 8191 tries to be resolved when the symbol table only contains <1000 elements. This fails, but with this being so consistent it is a very weird bug that needs to be tracked down.

Questions / Confusion:

  • I don't currently understand how the parentTypeSym was determined when calling set_fixed_type aka the third argument. At first I thought I saw a pattern, but now I'm not so sure. Take the following snippets from InitHeapAndSymbol
set_fixed_type(0x1c,"object",iVar4 + 0x801d,4,unaff_retaddr,in_stack_fffffff8);
set_fixed_type(0x6c,"structure",iVar4 + 0x801d,4,unaff_retaddr,in_stack_fffffff8);
set_fixed_type(0xc,"basic",iVar4 + 0x806d,4,unaff_retaddr,in_stack_fffffff8);
set_fixed_type(0x90,"kheap",iVar4 + 0x806d,0x10,unaff_retaddr,in_stack_fffffff8);

As is described in machine.cpp, a structure's parent is an object, and an object's parent is itself. This seems to follow from the 3rd arguments being the same. However, in machine.cpp, basic's parent is described as being a structure. Where as if we follow the same pattern, basic is the base type, and other types likes kheap are children of it.

Differences between Jak 1 and Jak 2 so Far

  • Jak 2's Symbol Table is 0x10000 bytes larger

Jak 3 Support Hell Fun

  • Looks like they modified the file headers, the version number is not where its expected to be in jak 1/2

Cleanup that I sloppily added:

  • Look into the disasm functions, ive just been copy and pasting them for the most part, and this is very likely wrong!
  • Add back CLI usage / allow decompression

dicarlo236 and others added 10 commits January 2, 2018 23:57
I think it's
slt a1, a0, v1   ;a0 is type->allocated, v1 is shifted flags
beqz a1, flags_larger_than_type
move a0, va
flags_larger_than_type:
andi v1, a0, 0xffff
sh v1, 0xe(v0) ;v0 is type

Additionally, the "unknown_fn" returns a size used when copying.
Switch condition for set_fixed_type
Implemented miniLZO to decompress jak 2 and 3 files.
TODO: Some files are still unable to be decompressed
TODO: The decompressed files crash the disassembler.
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.

4 participants