mirror of
https://github.com/open-goal/jak-project
synced 2026-06-11 21:19:11 -04:00
jakx: Commit existing work from other PRs (#4112)
This attempts to get into master whatever work was done in this PR / it's earlier PR https://github.com/open-goal/jak-project/pull/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>
This commit is contained in:
@@ -350,6 +350,7 @@ FormElement* rewrite_as_send_event(LetElement* in,
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
case GameVersion::Jak3:
|
||||
case GameVersion::JakX:
|
||||
// in jak 2, the event message block holds a ppointer instead.
|
||||
set_from_matcher = Matcher::set(
|
||||
Matcher::deref(Matcher::reg(block_var_reg), false, {DerefTokenMatcher::string("from")}),
|
||||
@@ -370,6 +371,7 @@ FormElement* rewrite_as_send_event(LetElement* in,
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
case GameVersion::Jak3:
|
||||
case GameVersion::JakX:
|
||||
set_from_form_matcher = Matcher::set(
|
||||
Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string("from")}),
|
||||
Matcher::op_fixed(FixedOperatorKind::PROCESS_TO_PPOINTER, {Matcher::any(1)}));
|
||||
@@ -1913,7 +1915,7 @@ FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) {
|
||||
auto ra = in->entries().at(0).dest;
|
||||
std::vector<Matcher> get_process_args = {Matcher::any(0), Matcher::any_symbol(1),
|
||||
Matcher::any(2)};
|
||||
if (env.version >= GameVersion::Jak3) {
|
||||
if (env.version == GameVersion::Jak3 || env.version == GameVersion::JakX) {
|
||||
// this flag appears unused...
|
||||
get_process_args.push_back(Matcher::any_integer(3));
|
||||
}
|
||||
@@ -1924,8 +1926,8 @@ FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) {
|
||||
|
||||
const auto& proc_type = mr_get_proc.maps.strings.at(1);
|
||||
|
||||
// part-tracker-spawn macro for jak 3
|
||||
if (env.version >= GameVersion::Jak3 &&
|
||||
// part-tracker-spawn macro for jak 3 / jak x
|
||||
if ((env.version == GameVersion::Jak3 || env.version == GameVersion::JakX) &&
|
||||
(proc_type == "part-tracker" || proc_type == "part-tracker-subsampler")) {
|
||||
auto form = rewrite_part_tracker_new_jak3(proc_type, in, env, pool);
|
||||
if (form) {
|
||||
@@ -2045,6 +2047,7 @@ FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) {
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
case GameVersion::Jak3:
|
||||
case GameVersion::JakX:
|
||||
expected_name = fmt::format("(symbol->string (-> {} symbol))", proc_type);
|
||||
break;
|
||||
default:
|
||||
@@ -2073,7 +2076,7 @@ FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) {
|
||||
if (!mr_get_proc.maps.forms.at(2)->to_form(env).is_int(0x4000)) {
|
||||
ja_push_form_to_args(pool, args, mr_get_proc.maps.forms.at(2), "stack-size");
|
||||
}
|
||||
if (env.version >= GameVersion::Jak3) {
|
||||
if (env.version == GameVersion::Jak3 || env.version == GameVersion::JakX) {
|
||||
if (mr_get_proc.maps.ints.at(3) != 1) {
|
||||
// TODO better name
|
||||
args.push_back(pool.form<ConstantTokenElement>(":unk"));
|
||||
@@ -2195,7 +2198,7 @@ FormElement* rewrite_attack_info(LetElement* in, const Env& env, FormPool& pool)
|
||||
if (env.version == GameVersion::Jak2) {
|
||||
possible_args = possible_args_jak2;
|
||||
}
|
||||
if (env.version == GameVersion::Jak3) {
|
||||
if (env.version == GameVersion::Jak3 || env.version == GameVersion::JakX) {
|
||||
possible_args = possible_args_jak3;
|
||||
}
|
||||
|
||||
@@ -2742,7 +2745,8 @@ FormElement* rewrite_with_dma_buf_add_bucket(LetElement* in, const Env& env, For
|
||||
|
||||
// New for Jak 3: they check to see if nothing was added, and skip adding an empty DMA transfer
|
||||
// if so. This means the usual 2 ending let body forms are now wrapped in a `when`.
|
||||
const int expected_last_let_body_size = env.version == GameVersion::Jak3 ? 1 : 2;
|
||||
const int expected_last_let_body_size =
|
||||
env.version == GameVersion::Jak3 || env.version == GameVersion::JakX ? 1 : 2;
|
||||
if (last_part->entries().size() != 1 ||
|
||||
last_part->body()->size() != expected_last_let_body_size) {
|
||||
return nullptr;
|
||||
@@ -2752,7 +2756,7 @@ FormElement* rewrite_with_dma_buf_add_bucket(LetElement* in, const Env& env, For
|
||||
LetElement* dmatag_let;
|
||||
FormElement* insert_tag_call;
|
||||
|
||||
if (env.version == GameVersion::Jak3) {
|
||||
if (env.version == GameVersion::Jak3 || env.version == GameVersion::JakX) {
|
||||
// check for the when:
|
||||
auto outer_when = dynamic_cast<CondNoElseElement*>(last_part->body()->at(0));
|
||||
if (!outer_when) {
|
||||
|
||||
Reference in New Issue
Block a user