Skip to content

Comments

jakx: Kernel work#3965

Draft
yodaxtah wants to merge 29 commits intoopen-goal:masterfrom
yodaxtah:jakx-ckernel
Draft

jakx: Kernel work#3965
yodaxtah wants to merge 29 commits intoopen-goal:masterfrom
yodaxtah:jakx-ckernel

Conversation

@yodaxtah
Copy link
Contributor

@yodaxtah yodaxtah commented Jun 22, 2025

A draft branch to integrate the next ckernel code. Most of the labeling and decompiling has already been done, this list includes the hardest/remaining parts:

Decompile track list

  • module UNDERLRD.IRX (not part of CKernel, but necessary)
  • common/kmachine.cpp:CPadGetData (uses never module, still necessary ?)
  • common/kmachine.cpp:CPadOpen (uses never module, still necessary ?)

C++ port track list

  • common/kmachine.cpp:InitVideo
  • jakx/klink.cpp:link_control::jakx_begin (compare memcpy, investigate random decomp var)
  • jakx/klink.cpp:link_control::jakx_work
  • jakx/klink.cpp:link_control::jakx_work_v5
  • jakx/klink.cpp:link_control::jakx_finish (structure alignment mismatch aside added version check)
  • jakx/klink.cpp:ultimate_memcpy
  • jakx/kmachine.cpp:InitIOP
  • jakx/kmachine.cpp:InitMachine
  • jakx/kprint.cpp:format_impl_jakx

References

content
  1. Jak 3 Open Goal (or jak 3 base copy commit)
  2. Jak 3 Ghidra demo
  3. Jak X Ghidra labeled (and reproducible as described here)
  4. Jak X Ghidra raw export
  5. Jak X Open Goal --- the added code in this PR, based on latest commit in decompiled project

Compare between versions:

set FILE jakx/kmachine.cpp; delta -@U999 --side-by-side $DECOMP/$FILE $JAKPROJ/$FILE

Discussion/knowledge track list (new to old)

Original post

content

Here is the code I'm working from. See this Discord discussion for more details: https://discord.com/channels/756287461377703987/1386044162326921346

The currently stubbed jak3 code builds when I hit "Build all" in Visual Studio, but that's about all I can say about it. Still searching for a way to test the new code without too much overhead.

I've built further upon the code from PR #3633 and updated the branch as it was 10 months behind.

After commit 246fb8f, I'll be adding commits with changes from the decompiled project that will make the code incompatible with Jak 3 (probably), but hopefully I can at least setup something without having to test everything at once at the end.

@OpenGOALBot
Copy link
Collaborator

Can one of the admins verify this patch?

Copy link
Member

Choose a reason for hiding this comment

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

are these legitimate type casts as part of decompilation or has this (and potentially a lot of this PR) just been copy and pasted from jak 3's

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what type casts you mean, but yes, about all code up until 246fb8f is copy-pasted from jak3. I wanted to start off with something that builds. So this is intended as a draft branch -- did I miss an option to mark it as such?

I just pushed some commits to move over updated code from Jak X's kernel: https://github.com/yodaxtah/jakx-c-kernel-decompiled/tree/main/elf/kernel
They appear above your comment.

As I don't see any other way to check for bugs, I'm currently just adding these updates one by one and rebuilding. I guess I'll just deal with the run-time problems afterward then. Fortunately, the code is very similar ^^

@yodaxtah yodaxtah marked this pull request as draft June 22, 2025 20:41
@xTVaser xTVaser self-assigned this Dec 9, 2025
@xTVaser xTVaser changed the title Setup for new CKernel jakx: Kernel work Dec 31, 2025
@xTVaser xTVaser added the jakx label Dec 31, 2025
xTVaser added a commit that referenced this pull request Jan 1, 2026
This attempts to get into master whatever work was done in this PR /
it's earlier PR #3965

I don't want this work to be lost / floating around in massive PRs.

However the changes are:
- switch to ntsc_v1 instead of PAL as the development target, as we have
done for all other games
- remove most of the copied-from-jak2/3 changes as they need to be
confirmed during the decompilation process not just assumed
- avoids committing any changes to `game/kernel/common` as it was not
clear to me if these were changes made in jak x's kernel that were not
properly broken out into it's own functions. We don't want to
accidentally introduce bugs into jak1-3's kernel code.
- in other words, if the change in the kernel only happens in jak x...it
should likely be specific to jak x's kernel, not common.

---------

Co-authored-by: VodBox <dillon@vodbox.io>
Co-authored-by: yodah <greenboyyodah@gmail.com>
@xTVaser xTVaser removed their assignment Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants