mirror of
https://github.com/open-goal/jak-project
synced 2026-07-07 14:13:45 -04:00
[decomp] Jak 2 mips2c, collide-func (#1805)
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@ enum class GameVersion { Jak1 = 1, Jak2 = 2 };
|
||||
template <typename T>
|
||||
struct PerGameVersion {
|
||||
constexpr PerGameVersion(T jak1, T jak2) : data{jak1, jak2} {}
|
||||
constexpr T operator[](GameVersion v) const { return data[(int)v - 1]; }
|
||||
constexpr const T& operator[](GameVersion v) const { return data[(int)v - 1]; }
|
||||
T data[2];
|
||||
};
|
||||
|
||||
|
||||
@@ -153,14 +153,17 @@ struct Mips2C_Output {
|
||||
* Convert the output to a string.
|
||||
*/
|
||||
std::string write_to_string(const FunctionName& goal_func_name,
|
||||
GameVersion version,
|
||||
const std::string& extra = "") const {
|
||||
std::string name = goal_to_c_function_name(goal_func_name);
|
||||
std::string result = "//--------------------------MIPS2C---------------------\n";
|
||||
result += "// clang-format off\n";
|
||||
result += "#include \"game/mips2c/mips2c_private.h\"\n";
|
||||
result += "#include \"game/kernel/kscheme.h\"\n";
|
||||
result += fmt::format("#include \"game/kernel/{}/kscheme.h\"\n", game_version_names[version]);
|
||||
result += fmt::format("using ::{}::intern_from_c;\n", game_version_names[version]);
|
||||
|
||||
// start of namespace for this function
|
||||
result += "namespace Mips2C {\n";
|
||||
result += fmt::format("namespace Mips2C::{} {{\n", game_version_names[version]);
|
||||
result += fmt::format("namespace {} {{\n", name);
|
||||
|
||||
// definition of the symbol cache.
|
||||
@@ -227,8 +230,8 @@ struct Mips2C_Output {
|
||||
result += fmt::format(" cache.{} = intern_from_c(\"{}\").c();\n", goal_to_c_name(sym), sym);
|
||||
}
|
||||
// this adds us to a table for lookup later, and also allocates our trampoline.
|
||||
result +=
|
||||
fmt::format(" gLinkedFunctionTable.reg(\"{}\", execute);\n", goal_func_name.to_string());
|
||||
result += fmt::format(" gLinkedFunctionTable.reg(\"{}\", execute, PUT_STACK_SIZE_HERE);\n",
|
||||
goal_func_name.to_string());
|
||||
result += "}\n\n";
|
||||
|
||||
result += extra;
|
||||
@@ -1313,7 +1316,7 @@ void run_mips2c_jump_table(Function* f,
|
||||
}
|
||||
jump_loc_table += "};\n\n";
|
||||
|
||||
f->mips2c_output = output.write_to_string(f->guessed_name, jump_loc_table);
|
||||
f->mips2c_output = output.write_to_string(f->guessed_name, version, jump_loc_table);
|
||||
if (g_unknown > 0) {
|
||||
lg::error("Mips to C pass in {} hit {} unknown instructions", f->name(), g_unknown);
|
||||
}
|
||||
@@ -1431,7 +1434,7 @@ void run_mips2c(Function* f, GameVersion version) {
|
||||
}
|
||||
}
|
||||
|
||||
f->mips2c_output = output.write_to_string(f->guessed_name);
|
||||
f->mips2c_output = output.write_to_string(f->guessed_name, version);
|
||||
if (g_unknown > 0) {
|
||||
lg::error("Mips to C pass in {} hit {} unknown instructions", f->name(), g_unknown);
|
||||
}
|
||||
|
||||
@@ -4562,7 +4562,7 @@
|
||||
(:methods
|
||||
(new (symbol type int level) _type_ 0)
|
||||
(load-dir-method-9 () none 9) ;; (load-to-heap-by-name (_type_ string symbol kheap int) art-group 9)
|
||||
(load-dir-method-10 () none 10) ;; (set-loaded-art (_type_ art-group) art-group 10)
|
||||
(set-loaded-art (_type_ art-group) art-group 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -9876,7 +9876,7 @@
|
||||
:size-assert #x74
|
||||
:flag-assert #x1000000074
|
||||
(:methods
|
||||
(add-to-loading-level (_type_) none 15)
|
||||
(add-to-loading-level (_type_) skeleton-group 15)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -229,7 +229,10 @@
|
||||
// where "op" is the op number for the call to format.
|
||||
"dynamic_format_arg_counts": {},
|
||||
|
||||
"mips2c_functions_by_name": [],
|
||||
"mips2c_functions_by_name": [
|
||||
"collide-do-primitives",
|
||||
"moving-sphere-triangle-intersect"
|
||||
],
|
||||
|
||||
"mips2c_jump_table_functions": {},
|
||||
|
||||
|
||||
+26
-25
@@ -57,31 +57,32 @@ set(RUNTIME_SOURCE
|
||||
kernel/jak2/ksound.cpp
|
||||
kernel/asm_funcs.asm
|
||||
mips2c/mips2c_table.cpp
|
||||
mips2c/functions/bones.cpp
|
||||
mips2c/functions/collide_cache.cpp
|
||||
mips2c/functions/collide_edge_grab.cpp
|
||||
mips2c/functions/collide_func.cpp
|
||||
mips2c/functions/collide_mesh.cpp
|
||||
mips2c/functions/collide_probe.cpp
|
||||
mips2c/functions/draw_string.cpp
|
||||
mips2c/functions/generic_effect.cpp
|
||||
mips2c/functions/generic_effect2.cpp
|
||||
mips2c/functions/generic_merc.cpp
|
||||
mips2c/functions/generic_tie.cpp
|
||||
mips2c/functions/joint.cpp
|
||||
mips2c/functions/merc_blend_shape.cpp
|
||||
mips2c/functions/ocean.cpp
|
||||
mips2c/functions/ocean_vu0.cpp
|
||||
mips2c/functions/ripple.cpp
|
||||
mips2c/functions/shadow.cpp
|
||||
mips2c/functions/sky_tng.cpp
|
||||
mips2c/functions/sparticle.cpp
|
||||
mips2c/functions/sparticle_launcher.cpp
|
||||
mips2c/functions/test_func.cpp
|
||||
mips2c/functions/texture.cpp
|
||||
mips2c/functions/tfrag.cpp
|
||||
mips2c/functions/tie_methods.cpp
|
||||
mips2c/functions/time_of_day.cpp
|
||||
mips2c/jak1_functions/bones.cpp
|
||||
mips2c/jak1_functions/collide_cache.cpp
|
||||
mips2c/jak1_functions/collide_edge_grab.cpp
|
||||
mips2c/jak1_functions/collide_func.cpp
|
||||
mips2c/jak1_functions/collide_mesh.cpp
|
||||
mips2c/jak1_functions/collide_probe.cpp
|
||||
mips2c/jak1_functions/draw_string.cpp
|
||||
mips2c/jak1_functions/generic_effect.cpp
|
||||
mips2c/jak1_functions/generic_effect2.cpp
|
||||
mips2c/jak1_functions/generic_merc.cpp
|
||||
mips2c/jak1_functions/generic_tie.cpp
|
||||
mips2c/jak1_functions/joint.cpp
|
||||
mips2c/jak1_functions/merc_blend_shape.cpp
|
||||
mips2c/jak1_functions/ocean.cpp
|
||||
mips2c/jak1_functions/ocean_vu0.cpp
|
||||
mips2c/jak1_functions/ripple.cpp
|
||||
mips2c/jak1_functions/shadow.cpp
|
||||
mips2c/jak1_functions/sky_tng.cpp
|
||||
mips2c/jak1_functions/sparticle.cpp
|
||||
mips2c/jak1_functions/sparticle_launcher.cpp
|
||||
mips2c/jak1_functions/test_func.cpp
|
||||
mips2c/jak1_functions/texture.cpp
|
||||
mips2c/jak1_functions/tfrag.cpp
|
||||
mips2c/jak1_functions/tie_methods.cpp
|
||||
mips2c/jak1_functions/time_of_day.cpp
|
||||
mips2c/jak2_functions/collide_func.cpp
|
||||
overlord/dma.cpp
|
||||
overlord/fake_iso.cpp
|
||||
overlord/iso.cpp
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "game/kernel/common/kernel_types.h"
|
||||
#include "game/kernel/common/kprint.h"
|
||||
#include "game/kernel/common/kscheme.h"
|
||||
#include "game/mips2c/mips2c_table.h"
|
||||
#include "game/sce/libcdvd_ee.h"
|
||||
#include "game/sce/libpad.h"
|
||||
#include "game/sce/libscf.h"
|
||||
@@ -491,3 +492,13 @@ void vif_interrupt_callback() {
|
||||
u32 offset_of_s7() {
|
||||
return s7.offset;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Called from the game thread at initialization.
|
||||
* The game thread is the only one to touch the mips2c function table (through the linker and
|
||||
* through this function), so no locking is needed.
|
||||
*/
|
||||
u64 pc_get_mips2c(u32 name) {
|
||||
const char* n = Ptr<String>(name).c()->data();
|
||||
return Mips2C::gLinkedFunctionTable.get(n);
|
||||
}
|
||||
@@ -78,3 +78,4 @@ u32 get_collision_mask(GfxGlobalSettings::CollisionRendererMode mode, int mask);
|
||||
void set_gfx_hack(u64 which, u32 symptr);
|
||||
u32 offset_of_s7();
|
||||
void vif_interrupt_callback();
|
||||
u64 pc_get_mips2c(u32 name);
|
||||
@@ -531,8 +531,11 @@ void link_control::jak1_finish(bool jump_from_c_to_goal) {
|
||||
// todo check function type of entry
|
||||
|
||||
// setup mips2c functions
|
||||
for (auto& x : Mips2C::gMips2CLinkCallbacks[m_object_name]) {
|
||||
x();
|
||||
const auto& it = Mips2C::gMips2CLinkCallbacks[GameVersion::Jak1].find(m_object_name);
|
||||
if (it != Mips2C::gMips2CLinkCallbacks[GameVersion::Jak1].end()) {
|
||||
for (auto& x : it->second) {
|
||||
x();
|
||||
}
|
||||
}
|
||||
|
||||
// execute top level!
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/kernel/jak1/ksound.h"
|
||||
#include "game/kernel/svnrev.h"
|
||||
#include "game/mips2c/mips2c_table.h"
|
||||
#include "game/sce/deci2.h"
|
||||
#include "game/sce/libcdvd_ee.h"
|
||||
#include "game/sce/libdma.h"
|
||||
@@ -405,16 +404,6 @@ void pc_texture_relocate(u32 dst, u32 src, u32 format) {
|
||||
Gfx::texture_relocate(dst, src, format);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Called from the game thread at initialization.
|
||||
* The game thread is the only one to touch the mips2c function table (through the linker and
|
||||
* through this function), so no locking is needed.
|
||||
*/
|
||||
u64 pc_get_mips2c(u32 name) {
|
||||
const char* n = Ptr<String>(name).c()->data();
|
||||
return Mips2C::gLinkedFunctionTable.get(n);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Called from the game thread at each frame to tell the PC rendering code which levels to start
|
||||
* loading. The loader internally handles locking.
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
#include "game/kernel/common/kscheme.h"
|
||||
#include "game/kernel/common/memory_layout.h"
|
||||
#include "game/kernel/jak2/kscheme.h"
|
||||
#include "game/mips2c/mips2c_table.h"
|
||||
|
||||
#include "third-party/fmt/core.h"
|
||||
|
||||
static constexpr bool link_debug_printfs = false;
|
||||
|
||||
/*!
|
||||
@@ -540,11 +542,12 @@ void link_control::jak2_finish(bool jump_from_c_to_goal) {
|
||||
// todo check function type of entry
|
||||
|
||||
// setup mips2c functions
|
||||
/*
|
||||
for (auto& x : Mips2C::gMips2CLinkCallbacks[m_object_name]) {
|
||||
x();
|
||||
const auto& it = Mips2C::gMips2CLinkCallbacks[GameVersion::Jak2].find(m_object_name);
|
||||
if (it != Mips2C::gMips2CLinkCallbacks[GameVersion::Jak2].end()) {
|
||||
for (auto& x : it->second) {
|
||||
x();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// execute top level!
|
||||
if (m_entry.offset && (m_flags & LINK_FLAG_EXECUTE)) {
|
||||
|
||||
@@ -465,7 +465,7 @@ void InitMachine_PCPort() {
|
||||
// make_function_symbol_from_c("__send-gfx-dma-chain", (void*)send_gfx_dma_chain);
|
||||
// make_function_symbol_from_c("__pc-texture-upload-now", (void*)pc_texture_upload_now);
|
||||
// make_function_symbol_from_c("__pc-texture-relocate", (void*)pc_texture_relocate);
|
||||
// make_function_symbol_from_c("__pc-get-mips2c", (void*)pc_get_mips2c);
|
||||
make_function_symbol_from_c("__pc-get-mips2c", (void*)pc_get_mips2c);
|
||||
// make_function_symbol_from_c("__pc-set-levels", (void*)pc_set_levels);
|
||||
|
||||
// pad stuff
|
||||
|
||||
@@ -57,4 +57,6 @@ u64 loado(u32 file_name_in, u32 heap_in);
|
||||
u64 unload(u32 name);
|
||||
u64 call_method_of_type(u32 arg, Ptr<Type> type, u32 method_id);
|
||||
u64 call_goal_function_by_name(const char* name);
|
||||
u64 alloc_heap_object(u32 heap, u32 type, u32 size, u32 pp);
|
||||
u32 u32_in_fixed_sym(u32 offset);
|
||||
} // namespace jak2
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace bones_mtx_calc {
|
||||
|
||||
struct Cache {
|
||||
@@ -693,7 +693,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_bones_merc {
|
||||
struct Cache {
|
||||
void* merc_bucket_info; // *merc-bucket-info*
|
||||
@@ -1046,7 +1046,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_bones_check_longest_edge_asm {
|
||||
struct Cache {
|
||||
void* math_camera; // *math-camera*
|
||||
+13
-13
@@ -16,7 +16,7 @@ void vlqi(Mips2C::ExecutionContext* c, int reg) {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
|
||||
namespace pc_upload_collide_frag {
|
||||
u64 execute(void* ctxt) {
|
||||
@@ -508,7 +508,7 @@ void link() {
|
||||
} // namespace Mips2C
|
||||
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
|
||||
// clip by box
|
||||
namespace method_26_collide_cache {
|
||||
@@ -794,7 +794,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_28_collide_cache {
|
||||
struct Cache {
|
||||
void* already_printed_exeeded_max_cache_tris; // *already-printed-exeeded-max-cache-tris*
|
||||
@@ -1077,7 +1077,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_27_collide_cache {
|
||||
struct Cache {
|
||||
void* already_printed_exeeded_max_cache_tris; // *already-printed-exeeded-max-cache-tris*
|
||||
@@ -1373,7 +1373,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_29_collide_cache {
|
||||
struct Cache {
|
||||
void* collide_work; // *collide-work*
|
||||
@@ -1562,7 +1562,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_12_collide_shape_prim_mesh {
|
||||
struct Cache {
|
||||
void* already_printed_exeeded_max_cache_tris; // *already-printed-exeeded-max-cache-tris*
|
||||
@@ -1808,7 +1808,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_14_collide_shape_prim_mesh {
|
||||
struct Cache {
|
||||
void* already_printed_exeeded_max_cache_tris; // *already-printed-exeeded-max-cache-tris*
|
||||
@@ -2053,7 +2053,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_13_collide_shape_prim_mesh {
|
||||
struct Cache {
|
||||
void* already_printed_exeeded_max_cache_tris; // *already-printed-exeeded-max-cache-tris*
|
||||
@@ -2304,7 +2304,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_30_collide_cache {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -2506,7 +2506,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_9_collide_cache_prim {
|
||||
struct Cache {
|
||||
void* moving_sphere_triangle_intersect; // moving-sphere-triangle-intersect
|
||||
@@ -2694,7 +2694,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_10_collide_cache_prim {
|
||||
struct Cache {
|
||||
void* moving_sphere_sphere_intersect; // moving-sphere-sphere-intersect
|
||||
@@ -2906,7 +2906,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_10_collide_puss_work {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -3075,7 +3075,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_9_collide_puss_work {
|
||||
struct Cache {
|
||||
void* closest_pt_in_triangle; // closest-pt-in-triangle
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_16_collide_edge_work {
|
||||
struct Cache {
|
||||
void* format; // format
|
||||
@@ -195,7 +195,7 @@ void link() {
|
||||
} // namespace method_16_collide_edge_work
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_15_collide_edge_work {
|
||||
struct Cache {
|
||||
void* format; // format
|
||||
@@ -596,7 +596,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_10_collide_edge_hold_list {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -690,7 +690,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_18_collide_edge_work {
|
||||
struct Cache {
|
||||
void* collide_edge_hold_list; // collide-edge-hold-list
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
// clang-format off
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace collide_do_primitives {
|
||||
struct Cache {
|
||||
void* ray_cylinder_intersect; // ray-cylinder-intersect
|
||||
@@ -262,7 +262,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace moving_sphere_triangle_intersect {
|
||||
struct Cache {
|
||||
void* collide_do_primitives; // collide-do-primitives
|
||||
+4
-4
@@ -4,7 +4,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
// clang-format off
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_12_collide_mesh {
|
||||
struct Cache {
|
||||
void* closest_pt_in_triangle; // closest-pt-in-triangle
|
||||
@@ -204,7 +204,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_11_collide_mesh {
|
||||
struct Cache {
|
||||
void* closest_pt_in_triangle; // closest-pt-in-triangle
|
||||
@@ -379,7 +379,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_14_collide_mesh {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -583,7 +583,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace method_15_collide_mesh {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace collide_probe_node {
|
||||
struct Cache {
|
||||
void* collide_probe_stack; // *collide-probe-stack*
|
||||
@@ -355,7 +355,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace collide_probe_instance_tie {
|
||||
struct Cache {
|
||||
void* collide_probe_stack; // *collide-probe-stack*
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_string {
|
||||
struct Cache {
|
||||
void* font_work; // *font-work*
|
||||
+4
-4
@@ -6,7 +6,7 @@
|
||||
using namespace jak1;
|
||||
// clang-format off
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_prepare_dma_double {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -451,7 +451,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_light_proc {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -891,7 +891,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_envmap_proc {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -1660,7 +1660,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_prepare_dma_single {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
|
||||
// clang-format off
|
||||
void vcallms48(ExecutionContext* c) {
|
||||
@@ -659,7 +659,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_interp_dproc {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -838,7 +838,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_no_light_dproc {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
+6
-6
@@ -2,7 +2,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_prepare_dma_single {
|
||||
u64 execute(void* ctxt);
|
||||
}
|
||||
@@ -21,11 +21,11 @@ u64 execute(void* ctxt);
|
||||
namespace high_speed_reject {
|
||||
u64 execute(void* ctxt);
|
||||
}
|
||||
} // namespace Mips2C
|
||||
} // namespace Mips2C::jak1
|
||||
|
||||
//--------------------------MIPS2C---------------------
|
||||
// clang-format off
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_merc_init_asm {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -284,7 +284,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_merc_execute_asm {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -1352,7 +1352,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace mercneric_convert {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -3539,7 +3539,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace high_speed_reject {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace generic_tie_dma_to_spad_sync {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -108,7 +108,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
|
||||
namespace generic_prepare_dma_double {
|
||||
extern u64 execute(void* ctxt);
|
||||
@@ -16,7 +16,7 @@ struct Cache {
|
||||
} cache;
|
||||
}
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace decompress_frame_data_pair_to_accumulator {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -820,7 +820,7 @@ u32 jump_table_vals[16] = {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace decompress_frame_data_to_accumulator {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -1420,7 +1420,7 @@ u32 jump_table_vals[16] = {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace decompress_fixed_data_to_accumulator {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -2036,7 +2036,7 @@ u32 jump_table_vals[16] = {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace normalize_frame_quaternions {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -2090,7 +2090,7 @@ u64 execute(void* ctxt) {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace clear_frame_accumulator {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -2150,7 +2150,7 @@ u64 execute(void* ctxt) {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace calc_animation_from_spr {
|
||||
|
||||
|
||||
@@ -2396,7 +2396,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace cspace_parented_transformq_joint {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace blerc_execute {
|
||||
struct Cache {
|
||||
void* blerc_globals; // *blerc-globals*
|
||||
@@ -408,7 +408,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace setup_blerc_chains_for_one_fragment {
|
||||
struct Cache {
|
||||
void* blerc_globals; // *blerc-globals*
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
ExecutionContext ocean_regs_vfs;
|
||||
|
||||
namespace init_ocean_far_regs {
|
||||
@@ -64,7 +64,7 @@ void link() {
|
||||
} // namespace init_ocean_far_regs
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace clip_polygon_against_positive_hyperplane {
|
||||
u64 execute(void* ctxt);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ u64 execute(void* ctxt);
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_large_polygon_ocean {
|
||||
struct Cache {
|
||||
void* clip_polygon_against_negative_hyperplane; // clip-polygon-against-negative-hyperplane
|
||||
@@ -269,7 +269,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace render_ocean_quad {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace ocean_interp_wave {
|
||||
struct Cache {
|
||||
void* ocean_wave_frames; // *ocean-wave-frames*
|
||||
@@ -204,7 +204,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace ocean_generate_verts {
|
||||
struct Cache {
|
||||
void* ocean_vu0_work; // *ocean-vu0-work*
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
|
||||
struct RippleVu0 {
|
||||
Vf data_mem[256];
|
||||
@@ -90,7 +90,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace ripple_create_wave_table {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -421,7 +421,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace ripple_apply_wave_table {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -525,7 +525,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace ripple_matrix_scale {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
// clang-format off
|
||||
namespace {
|
||||
void exec_0(ExecutionContext* c) {
|
||||
@@ -376,7 +376,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_calc_dual_verts {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -582,7 +582,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_scissor_edges {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -690,7 +690,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_scissor_top {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -766,7 +766,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_init_vars {
|
||||
struct Cache {
|
||||
void* math_camera; // *math-camera*
|
||||
@@ -832,7 +832,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_find_facing_single_tris {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -1136,7 +1136,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_find_single_edges {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -1236,7 +1236,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_find_facing_double_tris {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -1518,7 +1518,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_find_double_edges {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -1624,7 +1624,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_add_verts {
|
||||
struct Cache {
|
||||
void* shadow_data; // *shadow-data*
|
||||
@@ -1808,7 +1808,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_add_facing_single_tris {
|
||||
struct Cache {
|
||||
void* shadow_data; // *shadow-data*
|
||||
@@ -1887,7 +1887,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_add_single_edges {
|
||||
struct Cache {
|
||||
void* shadow_data; // *shadow-data*
|
||||
@@ -1970,7 +1970,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_add_double_tris {
|
||||
struct Cache {
|
||||
void* shadow_data; // *shadow-data*
|
||||
@@ -2047,7 +2047,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_add_double_edges {
|
||||
struct Cache {
|
||||
void* shadow_data; // *shadow-data*
|
||||
@@ -2130,7 +2130,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace shadow_execute {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -3,17 +3,17 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
|
||||
ExecutionContext sky_regs_vfs;
|
||||
|
||||
} // namespace Mips2C
|
||||
} // namespace Mips2C::jak1
|
||||
|
||||
// clang-format off
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace init_sky_regs {
|
||||
struct Cache {
|
||||
void* math_camera; // *math-camera*
|
||||
@@ -108,7 +108,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace set_tex_offset {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -156,7 +156,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace clip_polygon_against_positive_hyperplane {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -441,7 +441,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace clip_polygon_against_negative_hyperplane {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -736,7 +736,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_large_polygon {
|
||||
struct Cache {
|
||||
void* clip_polygon_against_negative_hyperplane; // clip-polygon-against-negative-hyperplane
|
||||
@@ -886,7 +886,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace render_sky_quad {
|
||||
struct Cache {
|
||||
void* math_camera; // *math-camera*
|
||||
@@ -990,7 +990,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace render_sky_tri {
|
||||
struct Cache {
|
||||
void* draw_large_polygon; // draw-large-polygon
|
||||
@@ -1075,7 +1075,7 @@ void link() {
|
||||
} // namespace render_sky_tri
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace set_sky_vf27 {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -1091,7 +1091,7 @@ void link() {
|
||||
} // namespace set_sky_vf27
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace set_sky_vf23_value {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -1108,7 +1108,7 @@ void link() {
|
||||
} // namespace set_sky_vf23_value
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace init_boundary_regs {
|
||||
struct Cache {
|
||||
void* math_camera; // *math-camera*
|
||||
@@ -1169,7 +1169,7 @@ void link() {
|
||||
} // namespace Mips2C
|
||||
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_boundary_polygon {
|
||||
struct Cache {
|
||||
void* clip_polygon_against_negative_hyperplane; // clip-polygon-against-negative-hyperplane
|
||||
@@ -1303,7 +1303,7 @@ void link() {
|
||||
} // namespace Mips2C
|
||||
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace render_boundary_quad {
|
||||
struct Cache {
|
||||
void* math_camera; // *math-camera*
|
||||
@@ -1437,7 +1437,7 @@ void link() {
|
||||
} // namespace render_boundary_quad
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace render_boundary_tri {
|
||||
struct Cache {
|
||||
void* draw_boundary_polygon; // draw-boundary-polygon
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace sp_process_block_3d {
|
||||
struct Cache {
|
||||
void* sp_frame_time; // *sp-frame-time*
|
||||
@@ -371,7 +371,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace sp_process_block_2d {
|
||||
struct Cache {
|
||||
void* sp_frame_time; // *sp-frame-time*
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace sp_init_fields {
|
||||
struct Cache {
|
||||
void* part_id_table; // *part-id-table*
|
||||
@@ -343,7 +343,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace particle_adgif {
|
||||
struct Cache {
|
||||
void* particle_adgif_cache; // *particle-adgif-cache*
|
||||
@@ -479,7 +479,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace sp_launch_particles_var {
|
||||
struct Cache {
|
||||
void* level; // *level*
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace test_func {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -16,12 +16,12 @@ u64 execute(void* ctxt) {
|
||||
return 0;
|
||||
}
|
||||
} // namespace test_func
|
||||
} // namespace Mips2C
|
||||
} // namespace Mips2C::jak1
|
||||
|
||||
//--------------------------MIPS2C---------------------
|
||||
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace goal_call_test {
|
||||
struct Cache {
|
||||
void* goal_check_function;
|
||||
@@ -65,4 +65,4 @@ void link() {
|
||||
}
|
||||
|
||||
} // namespace goal_call_test
|
||||
} // namespace Mips2C
|
||||
} // namespace Mips2C::jak1
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace adgif_shader_texture_with_update {
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_inline_array_tfrag {
|
||||
struct Cache {
|
||||
void* tfrag_work; // *tfrag-work*
|
||||
@@ -710,13 +710,13 @@ void link() {
|
||||
}
|
||||
|
||||
} // namespace draw_inline_array_tfrag
|
||||
} // namespace Mips2C
|
||||
} // namespace Mips2C::jak1
|
||||
|
||||
// clang-format off
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace stats_tfrag_asm {
|
||||
struct Cache {
|
||||
void* tfrag_work; // *tfrag-work*
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
using namespace jak1;
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_inline_array_instance_tie {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -1349,7 +1349,7 @@ void link() {
|
||||
//--------------------------MIPS2C---------------------
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace draw_inline_array_prototype_tie_generic_asm {
|
||||
struct Cache {
|
||||
void* fake_scratchpad_data; // *fake-scratchpad-data*
|
||||
@@ -6,7 +6,7 @@
|
||||
using namespace jak1;
|
||||
|
||||
// clang-format off
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace time_of_day_interp_colors_scratch {
|
||||
|
||||
struct Cache {
|
||||
@@ -0,0 +1,500 @@
|
||||
//--------------------------MIPS2C---------------------
|
||||
// clang-format off
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak2/kscheme.h"
|
||||
using ::jak2::intern_from_c;
|
||||
namespace Mips2C::jak2 {
|
||||
namespace moving_sphere_triangle_intersect {
|
||||
struct Cache {
|
||||
void* collide_do_primitives; // collide-do-primitives
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
|
||||
c->sd(ra, 0, sp); // sd ra, 0(sp)
|
||||
c->lqc2(vf14, 0, a0); // lqc2 vf14, 0(a0)
|
||||
c->lqc2(vf15, 0, a1); // lqc2 vf15, 0(a1)
|
||||
c->lqc2(vf11, 0, a3); // lqc2 vf11, 0(a3)
|
||||
c->lqc2(vf12, 16, a3); // lqc2 vf12, 16(a3)
|
||||
c->lqc2(vf13, 32, a3); // lqc2 vf13, 32(a3)
|
||||
c->mov128_vf_gpr(vf1, a2); // qmtc2.i vf1, a2
|
||||
c->vadd(DEST::xyzw, vf6, vf14, vf15); // vadd.xyzw vf6, vf14, vf15
|
||||
c->vsub(DEST::xyzw, vf11, vf11, vf12); // vsub.xyzw vf11, vf11, vf12
|
||||
c->vsub(DEST::xyzw, vf13, vf13, vf12); // vsub.xyzw vf13, vf13, vf12
|
||||
c->vsub(DEST::xyzw, vf14, vf14, vf12); // vsub.xyzw vf14, vf14, vf12
|
||||
c->vsub(DEST::xyzw, vf6, vf6, vf12); // vsub.xyzw vf6, vf6, vf12
|
||||
c->vmini(DEST::xyzw, vf2, vf11, vf0); // vmini.xyzw vf2, vf11, vf0
|
||||
c->vopmula(vf13, vf11); // vopmula.xyz acc, vf13, vf11
|
||||
c->vopmsub(vf16, vf11, vf13); // vopmsub.xyz vf16, vf11, vf13
|
||||
c->vmax(DEST::xyzw, vf3, vf11, vf0); // vmax.xyzw vf3, vf11, vf0
|
||||
c->vmini(DEST::xyzw, vf4, vf14, vf6); // vmini.xyzw vf4, vf14, vf6
|
||||
c->vmax(DEST::xyzw, vf5, vf14, vf6); // vmax.xyzw vf5, vf14, vf6
|
||||
c->vmul(DEST::xyzw, vf7, vf16, vf16); // vmul.xyzw vf7, vf16, vf16
|
||||
c->vmini(DEST::xyzw, vf2, vf2, vf13); // vmini.xyzw vf2, vf2, vf13
|
||||
c->vmax(DEST::xyzw, vf3, vf3, vf13); // vmax.xyzw vf3, vf3, vf13
|
||||
c->vsub_bc(DEST::xyzw, BC::x, vf4, vf4, vf1); // vsubx.xyzw vf4, vf4, vf1
|
||||
c->vadd_bc(DEST::x, BC::y, vf7, vf7, vf7); // vaddy.x vf7, vf7, vf7
|
||||
c->vadd_bc(DEST::xyzw, BC::x, vf5, vf5, vf1); // vaddx.xyzw vf5, vf5, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub(DEST::xyzw, vf3, vf3, vf4); // vsub.xyzw vf3, vf3, vf4
|
||||
c->vadd_bc(DEST::x, BC::z, vf7, vf7, vf7); // vaddz.x vf7, vf7, vf7
|
||||
c->vsub(DEST::xyzw, vf5, vf5, vf2); // vsub.xyzw vf5, vf5, vf2
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(t2, vf3); // qmfc2.i t2, vf3
|
||||
c->mov128_gpr_vf(v1, vf5); // qmfc2.i v1, vf5
|
||||
c->vrsqrt(vf0, BC::w, vf7, BC::x); // vrsqrt Q, vf0.w, vf7.x
|
||||
c->or_(v1, t2, v1); // or v1, t2, v1
|
||||
c->pcgtw(v1, r0, v1); // pcgtw v1, r0, v1
|
||||
c->ppach(v1, r0, v1); // ppach v1, r0, v1
|
||||
c->dsll(v1, v1, 16); // dsll v1, v1, 16
|
||||
bc = c->sgpr64(v1) != 0; // bne v1, r0, L14
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_14;} // branch non-likely
|
||||
|
||||
c->vmul(DEST::xyzw, vf2, vf16, vf15); // vmul.xyzw vf2, vf16, vf15
|
||||
c->vmul(DEST::xyzw, vf3, vf16, vf14); // vmul.xyzw vf3, vf16, vf14
|
||||
c->vadd_bc(DEST::x, BC::y, vf2, vf2, vf2); // vaddy.x vf2, vf2, vf2
|
||||
c->vsub_bc(DEST::y, BC::y, vf3, vf0, vf3); // vsuby.y vf3, vf0, vf3
|
||||
c->vadd_bc(DEST::x, BC::z, vf2, vf2, vf2); // vaddz.x vf2, vf2, vf2
|
||||
c->vsub_bc(DEST::y, BC::x, vf3, vf3, vf3); // vsubx.y vf3, vf3, vf3
|
||||
c->vsub_bc(DEST::y, BC::z, vf3, vf3, vf3); // vsubz.y vf3, vf3, vf3
|
||||
c->vadd_bc(DEST::x, BC::x, vf3, vf0, vf0); // vaddx.x vf3, vf0, vf0
|
||||
c->vadd_bc(DEST::x, BC::x, vf4, vf0, vf0); // vaddx.x vf4, vf0, vf0
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf16, vf16); // vmulq.xyzw vf16, vf16, Q
|
||||
c->vmove(DEST::w, vf16, vf0); // vmove.w vf16, vf0
|
||||
c->vmulq(DEST::xyzw, vf2, vf2); // vmulq.xyzw vf2, vf2, Q
|
||||
c->vmulq(DEST::xyzw, vf4, vf3); // vmulq.xyzw vf4, vf3, Q
|
||||
c->vmulq(DEST::xyzw, vf3, vf3); // vmulq.xyzw vf3, vf3, Q
|
||||
c->sqc2(vf16, 0, t1); // sqc2 vf16, 0(t1)
|
||||
// nop // vnop
|
||||
// nop // vnop
|
||||
c->vdiv(vf0, BC::w, vf2, BC::x); // vdiv Q, vf0.w, vf2.x
|
||||
c->vadd_bc(DEST::y, BC::x, vf3, vf3, vf1); // vaddx.y vf3, vf3, vf1
|
||||
c->vsub_bc(DEST::y, BC::x, vf4, vf4, vf1); // vsubx.y vf4, vf4, vf1
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf3, vf3); // vmulq.xyzw vf3, vf3, Q
|
||||
c->vmulq(DEST::xyzw, vf4, vf4); // vmulq.xyzw vf4, vf4, Q
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(v1, vf3); // qmfc2.i v1, vf3
|
||||
c->mov128_gpr_vf(t1, vf4); // qmfc2.i t1, vf4
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L12
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_11;} // branch non-likely
|
||||
|
||||
bc = ((s64)c->sgpr64(t1)) < 0; // bltz t1, L13
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_12;} // branch non-likely
|
||||
|
||||
c->dsubu(v1, v1, t1); // dsubu v1, v1, t1
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L9
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_6;} // branch non-likely
|
||||
|
||||
c->vsub_bc(DEST::xyzw, BC::w, vf2, vf4, vf0); // vsubw.xyzw vf2, vf4, vf0
|
||||
c->mov128_gpr_vf(v1, vf2); // qmfc2.i v1, vf2
|
||||
bc = ((s64)c->sgpr64(v1)) >= 0; // bgez v1, L14
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_14;} // branch non-likely
|
||||
|
||||
c->mov128_gpr_vf(v0, vf4); // qmfc2.i v0, vf4
|
||||
c->vmula_bc(DEST::xyzw, BC::w, vf14, vf0); // vmulaw.xyzw acc, vf14, vf0
|
||||
c->vmadd_bc(DEST::xyzw, BC::y, vf8, vf15, vf4); // vmaddy.xyzw vf8, vf15, vf4
|
||||
//beq r0, r0, L10 // beq r0, r0, L10
|
||||
// nop // sll r0, r0, 0
|
||||
goto block_8; // branch always
|
||||
|
||||
|
||||
block_6:
|
||||
c->vsub_bc(DEST::xyzw, BC::w, vf2, vf3, vf0); // vsubw.xyzw vf2, vf3, vf0
|
||||
c->mov128_gpr_vf(v1, vf2); // qmfc2.i v1, vf2
|
||||
bc = ((s64)c->sgpr64(v1)) >= 0; // bgez v1, L14
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_14;} // branch non-likely
|
||||
|
||||
c->vmula_bc(DEST::xyzw, BC::w, vf14, vf0); // vmulaw.xyzw acc, vf14, vf0
|
||||
c->vmadd_bc(DEST::xyzw, BC::y, vf8, vf15, vf3); // vmaddy.xyzw vf8, vf15, vf3
|
||||
c->mov128_gpr_vf(v0, vf3); // qmfc2.i v0, vf3
|
||||
|
||||
block_8:
|
||||
c->dsra32(v0, v0, 0); // dsra32 v0, v0, 0
|
||||
c->vsub(DEST::xyzw, vf9, vf8, vf13); // vsub.xyzw vf9, vf8, vf13
|
||||
c->vsub(DEST::xyzw, vf10, vf8, vf11); // vsub.xyzw vf10, vf8, vf11
|
||||
c->vopmula(vf13, vf8); // vopmula.xyz acc, vf13, vf8
|
||||
c->vopmsub(vf5, vf8, vf13); // vopmsub.xyz vf5, vf8, vf13
|
||||
c->vopmula(vf8, vf11); // vopmula.xyz acc, vf8, vf11
|
||||
c->vopmsub(vf6, vf11, vf8); // vopmsub.xyz vf6, vf11, vf8
|
||||
c->vopmula(vf9, vf10); // vopmula.xyz acc, vf9, vf10
|
||||
c->vopmsub(vf7, vf10, vf9); // vopmsub.xyz vf7, vf10, vf9
|
||||
c->vmul(DEST::xyzw, vf5, vf5, vf16); // vmul.xyzw vf5, vf5, vf16
|
||||
c->vmul(DEST::xyzw, vf6, vf6, vf16); // vmul.xyzw vf6, vf6, vf16
|
||||
c->vmul(DEST::xyzw, vf7, vf7, vf16); // vmul.xyzw vf7, vf7, vf16
|
||||
c->vadd_bc(DEST::y, BC::x, vf5, vf5, vf5); // vaddx.y vf5, vf5, vf5
|
||||
c->vadd_bc(DEST::y, BC::x, vf6, vf6, vf6); // vaddx.y vf6, vf6, vf6
|
||||
c->vadd_bc(DEST::y, BC::x, vf7, vf7, vf7); // vaddx.y vf7, vf7, vf7
|
||||
c->vadd_bc(DEST::y, BC::z, vf5, vf5, vf5); // vaddz.y vf5, vf5, vf5
|
||||
c->vadd_bc(DEST::y, BC::z, vf6, vf6, vf6); // vaddz.y vf6, vf6, vf6
|
||||
c->vadd_bc(DEST::y, BC::z, vf7, vf7, vf7); // vaddz.y vf7, vf7, vf7
|
||||
c->mov128_gpr_vf(t1, vf5); // qmfc2.i t1, vf5
|
||||
c->mov128_gpr_vf(t2, vf6); // qmfc2.i t2, vf6
|
||||
c->mov128_gpr_vf(v1, vf7); // qmfc2.i v1, vf7
|
||||
c->or_(t1, t1, t2); // or t1, t1, t2
|
||||
c->or_(v1, t1, v1); // or v1, t1, v1
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L11
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_10;} // branch non-likely
|
||||
|
||||
c->vopmula(vf8, vf16); // vopmula.xyz acc, vf8, vf16
|
||||
c->vopmsub(vf5, vf16, vf8); // vopmsub.xyz vf5, vf16, vf8
|
||||
c->vopmula(vf16, vf5); // vopmula.xyz acc, vf16, vf5
|
||||
c->vopmsub(vf5, vf5, vf16); // vopmsub.xyz vf5, vf5, vf16
|
||||
c->vadd(DEST::xyzw, vf5, vf5, vf12); // vadd.xyzw vf5, vf5, vf12
|
||||
c->sqc2(vf5, 0, t0); // sqc2 vf5, 0(t0)
|
||||
//beq r0, r0, L15 // beq r0, r0, L15
|
||||
// nop // sll r0, r0, 0
|
||||
goto block_15; // branch always
|
||||
|
||||
|
||||
block_10:
|
||||
c->load_symbol(t9, cache.collide_do_primitives); // lw t9, collide-do-primitives(s7)
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
c->jalr(call_addr); // jalr ra, t9
|
||||
c->mov64(v1, v0); // or v1, v0, r0
|
||||
//beq r0, r0, L15 // beq r0, r0, L15
|
||||
// nop // sll r0, r0, 0
|
||||
goto block_15; // branch always
|
||||
|
||||
|
||||
block_11:
|
||||
bc = ((s64)c->sgpr64(t1)) < 0; // bltz t1, L14
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_14;} // branch non-likely
|
||||
|
||||
|
||||
block_12:
|
||||
c->vsub(DEST::xyzw, vf9, vf14, vf13); // vsub.xyzw vf9, vf14, vf13
|
||||
c->vsub(DEST::xyzw, vf10, vf14, vf11); // vsub.xyzw vf10, vf14, vf11
|
||||
c->vopmula(vf13, vf14); // vopmula.xyz acc, vf13, vf14
|
||||
c->vopmsub(vf5, vf14, vf13); // vopmsub.xyz vf5, vf14, vf13
|
||||
c->vopmula(vf14, vf11); // vopmula.xyz acc, vf14, vf11
|
||||
c->vopmsub(vf6, vf11, vf14); // vopmsub.xyz vf6, vf11, vf14
|
||||
c->vopmula(vf9, vf10); // vopmula.xyz acc, vf9, vf10
|
||||
c->vopmsub(vf7, vf10, vf9); // vopmsub.xyz vf7, vf10, vf9
|
||||
c->vmul(DEST::xyzw, vf5, vf5, vf16); // vmul.xyzw vf5, vf5, vf16
|
||||
c->vmul(DEST::xyzw, vf6, vf6, vf16); // vmul.xyzw vf6, vf6, vf16
|
||||
c->vmul(DEST::xyzw, vf7, vf7, vf16); // vmul.xyzw vf7, vf7, vf16
|
||||
c->vadd_bc(DEST::y, BC::x, vf5, vf5, vf5); // vaddx.y vf5, vf5, vf5
|
||||
c->vadd_bc(DEST::y, BC::x, vf6, vf6, vf6); // vaddx.y vf6, vf6, vf6
|
||||
c->vadd_bc(DEST::y, BC::x, vf7, vf7, vf7); // vaddx.y vf7, vf7, vf7
|
||||
c->vadd_bc(DEST::y, BC::z, vf5, vf5, vf5); // vaddz.y vf5, vf5, vf5
|
||||
c->vadd_bc(DEST::y, BC::z, vf6, vf6, vf6); // vaddz.y vf6, vf6, vf6
|
||||
c->vadd_bc(DEST::y, BC::z, vf7, vf7, vf7); // vaddz.y vf7, vf7, vf7
|
||||
c->mov128_gpr_vf(t1, vf5); // qmfc2.i t1, vf5
|
||||
c->mov128_gpr_vf(t2, vf6); // qmfc2.i t2, vf6
|
||||
c->mov128_gpr_vf(v1, vf7); // qmfc2.i v1, vf7
|
||||
c->or_(t1, t1, t2); // or t1, t1, t2
|
||||
c->or_(v1, t1, v1); // or v1, t1, v1
|
||||
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L11
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_10;} // branch non-likely
|
||||
|
||||
c->vopmula(vf14, vf16); // vopmula.xyz acc, vf14, vf16
|
||||
c->vopmsub(vf5, vf16, vf14); // vopmsub.xyz vf5, vf16, vf14
|
||||
c->vopmula(vf16, vf5); // vopmula.xyz acc, vf16, vf5
|
||||
c->vopmsub(vf5, vf5, vf16); // vopmsub.xyz vf5, vf5, vf16
|
||||
c->vadd(DEST::xyzw, vf5, vf5, vf12); // vadd.xyzw vf5, vf5, vf12
|
||||
c->sqc2(vf5, 0, t0); // sqc2 vf5, 0(t0)
|
||||
//beq r0, r0, L15 // beq r0, r0, L15
|
||||
c->addiu(v0, r0, 0); // addiu v0, r0, 0
|
||||
goto block_15; // branch always
|
||||
|
||||
|
||||
block_14:
|
||||
c->lui(v0, -13122); // lui v0, -13122
|
||||
c->ori(v0, v0, 48160); // ori v0, v0, 48160
|
||||
|
||||
block_15:
|
||||
c->ld(ra, 0, sp); // ld ra, 0(sp)
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 16); // daddiu sp, sp, 16
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
cache.collide_do_primitives = intern_from_c("collide-do-primitives").c();
|
||||
gLinkedFunctionTable.reg("moving-sphere-triangle-intersect", execute, 512);
|
||||
}
|
||||
|
||||
} // namespace moving_sphere_triangle_intersect
|
||||
} // namespace Mips2C
|
||||
|
||||
|
||||
//--------------------------MIPS2C---------------------
|
||||
// clang-format off
|
||||
#include "game/mips2c/mips2c_private.h"
|
||||
#include "game/kernel/jak2/kscheme.h"
|
||||
using ::jak2::intern_from_c;
|
||||
namespace Mips2C::jak2 {
|
||||
namespace collide_do_primitives {
|
||||
struct Cache {
|
||||
void* ray_cylinder_intersect; // ray-cylinder-intersect
|
||||
void* ray_sphere_intersect; // ray-sphere-intersect
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
bool cop1_bc = false;
|
||||
c->daddiu(sp, sp, -144); // daddiu sp, sp, -144
|
||||
c->sd(ra, 0, sp); // sd ra, 0(sp)
|
||||
c->sq(s1, 32, sp); // sq s1, 32(sp)
|
||||
c->sq(s2, 48, sp); // sq s2, 48(sp)
|
||||
c->sq(s3, 64, sp); // sq s3, 64(sp)
|
||||
c->sq(s4, 80, sp); // sq s4, 80(sp)
|
||||
c->sq(s5, 96, sp); // sq s5, 96(sp)
|
||||
c->sq(gp, 112, sp); // sq gp, 112(sp)
|
||||
c->swc1(f28, 128, sp); // swc1 f28, 128(sp)
|
||||
c->swc1(f30, 132, sp); // swc1 f30, 132(sp)
|
||||
c->mov64(s4, a0); // or s4, a0, r0
|
||||
c->mov64(s3, a1); // or s3, a1, r0
|
||||
c->mov64(s1, a2); // or s1, a2, r0
|
||||
c->mov64(s5, a3); // or s5, a3, r0
|
||||
c->mov64(gp, t0); // or gp, t0, r0
|
||||
c->daddiu(s2, sp, 16); // daddiu s2, sp, 16
|
||||
c->lui(v1, 16384); // lui v1, 16384
|
||||
c->mtc1(f31, v1); // mtc1 f31, v1
|
||||
c->mtc1(f28, r0); // mtc1 f28, r0
|
||||
c->load_symbol(t9, cache.ray_sphere_intersect); // lw t9, ray-sphere-intersect(s7)
|
||||
c->mov64(a0, s4); // or a0, s4, r0
|
||||
c->mov64(a1, s3); // or a1, s3, r0
|
||||
c->daddu(a2, r0, s5); // daddu a2, r0, s5
|
||||
c->mov64(a3, s1); // or a3, s1, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
c->jalr(call_addr); // jalr ra, t9
|
||||
c->mov64(v1, v0); // or v1, v0, r0
|
||||
c->mtc1(f30, v0); // mtc1 f30, v0
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f28]; // c.lt.s f30, f28
|
||||
bc = cop1_bc; // bc1t L17
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_2;} // branch non-likely
|
||||
|
||||
c->mtc1(f31, v0); // mtc1 f31, v0
|
||||
c->lqc2(vf31, 0, s5); // lqc2 vf31, 0(s5)
|
||||
|
||||
block_2:
|
||||
c->load_symbol(t9, cache.ray_sphere_intersect); // lw t9, ray-sphere-intersect(s7)
|
||||
c->mov64(a0, s4); // or a0, s4, r0
|
||||
c->mov64(a1, s3); // or a1, s3, r0
|
||||
c->daddiu(a2, s5, 16); // daddiu a2, s5, 16
|
||||
c->mov64(a3, s1); // or a3, s1, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
c->jalr(call_addr); // jalr ra, t9
|
||||
c->mov64(v1, v0); // or v1, v0, r0
|
||||
c->mtc1(f30, v0); // mtc1 f30, v0
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f28]; // c.lt.s f30, f28
|
||||
bc = cop1_bc; // bc1t L18
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f31]; // c.lt.s f30, f31
|
||||
if (bc) {goto block_5;} // branch non-likely
|
||||
|
||||
bc = !cop1_bc; // bc1f L18
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_5;} // branch non-likely
|
||||
|
||||
c->mtc1(f31, v0); // mtc1 f31, v0
|
||||
c->lqc2(vf31, 16, s5); // lqc2 vf31, 16(s5)
|
||||
|
||||
block_5:
|
||||
c->load_symbol(t9, cache.ray_sphere_intersect); // lw t9, ray-sphere-intersect(s7)
|
||||
c->mov64(a0, s4); // or a0, s4, r0
|
||||
c->mov64(a1, s3); // or a1, s3, r0
|
||||
c->daddiu(a2, s5, 32); // daddiu a2, s5, 32
|
||||
c->mov64(a3, s1); // or a3, s1, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
c->jalr(call_addr); // jalr ra, t9
|
||||
c->mov64(v1, v0); // or v1, v0, r0
|
||||
c->mtc1(f30, v0); // mtc1 f30, v0
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f28]; // c.lt.s f30, f28
|
||||
bc = cop1_bc; // bc1t L19
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f31]; // c.lt.s f30, f31
|
||||
if (bc) {goto block_8;} // branch non-likely
|
||||
|
||||
bc = !cop1_bc; // bc1f L19
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_8;} // branch non-likely
|
||||
|
||||
c->mtc1(f31, v0); // mtc1 f31, v0
|
||||
c->lqc2(vf31, 32, s5); // lqc2 vf31, 32(s5)
|
||||
|
||||
block_8:
|
||||
c->lqc2(vf1, 0, s5); // lqc2 vf1, 0(s5)
|
||||
c->lqc2(vf2, 16, s5); // lqc2 vf2, 16(s5)
|
||||
c->vsub(DEST::xyzw, vf2, vf2, vf1); // vsub.xyzw vf2, vf2, vf1
|
||||
c->vmul(DEST::xyzw, vf3, vf2, vf2); // vmul.xyzw vf3, vf2, vf2
|
||||
c->vadd_bc(DEST::x, BC::y, vf3, vf3, vf3); // vaddy.x vf3, vf3, vf3
|
||||
c->vadd_bc(DEST::x, BC::z, vf3, vf3, vf3); // vaddz.x vf3, vf3, vf3
|
||||
c->vrsqrt(vf0, BC::w, vf3, BC::x); // vrsqrt Q, vf0.w, vf3.x
|
||||
c->mov128_gpr_vf(v1, vf3); // qmfc2.i v1, vf3
|
||||
c->mtc1(f30, v1); // mtc1 f30, v1
|
||||
c->sqrts(f30, f30); // sqrt.s f30, f30
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf2, vf2); // vmulq.xyzw vf2, vf2, Q
|
||||
c->sqc2(vf2, 0, s2); // sqc2 vf2, 0(s2)
|
||||
c->mfc1(t1, f30); // mfc1 t1, f30
|
||||
c->load_symbol(t9, cache.ray_cylinder_intersect); // lw t9, ray-cylinder-intersect(s7)
|
||||
c->mov64(a0, s4); // or a0, s4, r0
|
||||
c->mov64(a1, s3); // or a1, s3, r0
|
||||
c->daddu(a2, r0, s5); // daddu a2, r0, s5
|
||||
c->mov64(a3, s2); // or a3, s2, r0
|
||||
c->mov64(t0, s1); // or t0, s1, r0
|
||||
c->mov64(t2, gp); // or t2, gp, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
c->jalr(call_addr); // jalr ra, t9
|
||||
c->mov64(v1, v0); // or v1, v0, r0
|
||||
c->mtc1(f30, v0); // mtc1 f30, v0
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f28]; // c.lt.s f30, f28
|
||||
bc = cop1_bc; // bc1t L20
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f31]; // c.lt.s f30, f31
|
||||
if (bc) {goto block_11;} // branch non-likely
|
||||
|
||||
bc = !cop1_bc; // bc1f L20
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_11;} // branch non-likely
|
||||
|
||||
c->mtc1(f31, v0); // mtc1 f31, v0
|
||||
c->lqc2(vf31, 0, gp); // lqc2 vf31, 0(gp)
|
||||
|
||||
block_11:
|
||||
c->lqc2(vf1, 16, s5); // lqc2 vf1, 16(s5)
|
||||
c->lqc2(vf2, 32, s5); // lqc2 vf2, 32(s5)
|
||||
c->vsub(DEST::xyzw, vf2, vf2, vf1); // vsub.xyzw vf2, vf2, vf1
|
||||
c->vmul(DEST::xyzw, vf3, vf2, vf2); // vmul.xyzw vf3, vf2, vf2
|
||||
c->vadd_bc(DEST::x, BC::y, vf3, vf3, vf3); // vaddy.x vf3, vf3, vf3
|
||||
c->vadd_bc(DEST::x, BC::z, vf3, vf3, vf3); // vaddz.x vf3, vf3, vf3
|
||||
c->vrsqrt(vf0, BC::w, vf3, BC::x); // vrsqrt Q, vf0.w, vf3.x
|
||||
c->mov128_gpr_vf(v1, vf3); // qmfc2.i v1, vf3
|
||||
c->mtc1(f30, v1); // mtc1 f30, v1
|
||||
c->sqrts(f30, f30); // sqrt.s f30, f30
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf2, vf2); // vmulq.xyzw vf2, vf2, Q
|
||||
c->sqc2(vf2, 0, s2); // sqc2 vf2, 0(s2)
|
||||
c->mfc1(t1, f30); // mfc1 t1, f30
|
||||
c->load_symbol(t9, cache.ray_cylinder_intersect); // lw t9, ray-cylinder-intersect(s7)
|
||||
c->mov64(a0, s4); // or a0, s4, r0
|
||||
c->mov64(a1, s3); // or a1, s3, r0
|
||||
c->daddiu(a2, s5, 16); // daddiu a2, s5, 16
|
||||
c->mov64(a3, s2); // or a3, s2, r0
|
||||
c->mov64(t0, s1); // or t0, s1, r0
|
||||
c->mov64(t2, gp); // or t2, gp, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
c->jalr(call_addr); // jalr ra, t9
|
||||
c->mov64(v1, v0); // or v1, v0, r0
|
||||
c->mtc1(f30, v0); // mtc1 f30, v0
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f28]; // c.lt.s f30, f28
|
||||
bc = cop1_bc; // bc1t L21
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f31]; // c.lt.s f30, f31
|
||||
if (bc) {goto block_14;} // branch non-likely
|
||||
|
||||
bc = !cop1_bc; // bc1f L21
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_14;} // branch non-likely
|
||||
|
||||
c->mtc1(f31, v0); // mtc1 f31, v0
|
||||
c->lqc2(vf31, 0, gp); // lqc2 vf31, 0(gp)
|
||||
|
||||
block_14:
|
||||
c->lqc2(vf1, 32, s5); // lqc2 vf1, 32(s5)
|
||||
c->lqc2(vf2, 0, s5); // lqc2 vf2, 0(s5)
|
||||
c->vsub(DEST::xyzw, vf2, vf2, vf1); // vsub.xyzw vf2, vf2, vf1
|
||||
c->vmul(DEST::xyzw, vf3, vf2, vf2); // vmul.xyzw vf3, vf2, vf2
|
||||
c->vadd_bc(DEST::x, BC::y, vf3, vf3, vf3); // vaddy.x vf3, vf3, vf3
|
||||
c->vadd_bc(DEST::x, BC::z, vf3, vf3, vf3); // vaddz.x vf3, vf3, vf3
|
||||
c->vrsqrt(vf0, BC::w, vf3, BC::x); // vrsqrt Q, vf0.w, vf3.x
|
||||
c->mov128_gpr_vf(v1, vf3); // qmfc2.i v1, vf3
|
||||
c->mtc1(f30, v1); // mtc1 f30, v1
|
||||
c->sqrts(f30, f30); // sqrt.s f30, f30
|
||||
c->vwaitq(); // vwaitq
|
||||
c->vmulq(DEST::xyzw, vf2, vf2); // vmulq.xyzw vf2, vf2, Q
|
||||
c->sqc2(vf2, 0, s2); // sqc2 vf2, 0(s2)
|
||||
c->mfc1(t1, f30); // mfc1 t1, f30
|
||||
c->load_symbol(t9, cache.ray_cylinder_intersect); // lw t9, ray-cylinder-intersect(s7)
|
||||
c->daddiu(a2, s5, 32); // daddiu a2, s5, 32
|
||||
c->mov64(t2, gp); // or t2, gp, r0
|
||||
c->mov64(a0, s4); // or a0, s4, r0
|
||||
c->mov64(a1, s3); // or a1, s3, r0
|
||||
c->mov64(a3, s2); // or a3, s2, r0
|
||||
c->mov64(t0, s1); // or t0, s1, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(v0, ra, 0); // sll v0, ra, 0
|
||||
c->jalr(call_addr); // jalr ra, t9
|
||||
c->mov64(v1, v0); // or v1, v0, r0
|
||||
c->mtc1(f30, v0); // mtc1 f30, v0
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f28]; // c.lt.s f30, f28
|
||||
bc = cop1_bc; // bc1t L22
|
||||
cop1_bc = c->fprs[f30] < c->fprs[f31]; // c.lt.s f30, f31
|
||||
if (bc) {goto block_17;} // branch non-likely
|
||||
|
||||
bc = !cop1_bc; // bc1f L22
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_17;} // branch non-likely
|
||||
|
||||
c->mtc1(f31, v0); // mtc1 f31, v0
|
||||
c->lqc2(vf31, 0, gp); // lqc2 vf31, 0(gp)
|
||||
|
||||
block_17:
|
||||
c->lui(v1, 16256); // lui v1, 16256
|
||||
c->mtc1(f0, v1); // mtc1 f0, v1
|
||||
c->lui(v1, -13122); // lui v1, -13122
|
||||
c->ori(v1, v1, 48160); // ori v1, v1, 48160
|
||||
cop1_bc = c->fprs[f0] < c->fprs[f31]; // c.lt.s f0, f31
|
||||
if (cop1_bc) { // bc1tl L23
|
||||
c->mtc1(f31, v1); // mtc1 f31, v1
|
||||
goto block_19;
|
||||
}
|
||||
|
||||
block_19:
|
||||
c->mfc1(v0, f31); // mfc1 v0, f31
|
||||
c->sqc2(vf31, 0, gp); // sqc2 vf31, 0(gp)
|
||||
c->ld(ra, 0, sp); // ld ra, 0(sp)
|
||||
c->lwc1(f30, 132, sp); // lwc1 f30, 132(sp)
|
||||
c->lwc1(f28, 128, sp); // lwc1 f28, 128(sp)
|
||||
c->lq(gp, 112, sp); // lq gp, 112(sp)
|
||||
c->lq(s5, 96, sp); // lq s5, 96(sp)
|
||||
c->lq(s4, 80, sp); // lq s4, 80(sp)
|
||||
c->lq(s3, 64, sp); // lq s3, 64(sp)
|
||||
c->lq(s2, 48, sp); // lq s2, 48(sp)
|
||||
c->lq(s1, 32, sp); // lq s1, 32(sp)
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 144); // daddiu sp, sp, 144
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
cache.ray_cylinder_intersect = intern_from_c("ray-cylinder-intersect").c();
|
||||
cache.ray_sphere_intersect = intern_from_c("ray-sphere-intersect").c();
|
||||
gLinkedFunctionTable.reg("collide-do-primitives", execute, 512);
|
||||
}
|
||||
|
||||
} // namespace collide_do_primitives
|
||||
} // namespace Mips2C
|
||||
+191
-388
@@ -6,405 +6,195 @@
|
||||
#include "game/kernel/common/kmalloc.h"
|
||||
#include "game/kernel/common/kscheme.h"
|
||||
#include "game/kernel/jak1/kscheme.h"
|
||||
|
||||
using namespace jak1_symbols;
|
||||
#include "game/kernel/jak2/kscheme.h"
|
||||
#include "game/runtime.h"
|
||||
|
||||
extern "C" {
|
||||
void _mips2c_call_linux();
|
||||
void _mips2c_call_windows();
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
namespace Mips2C {
|
||||
|
||||
namespace draw_string {
|
||||
extern void link();
|
||||
}
|
||||
namespace jak1 {
|
||||
namespace draw_string { extern void link(); }
|
||||
namespace sp_init_fields { extern void link(); }
|
||||
namespace particle_adgif { extern void link(); }
|
||||
namespace sp_launch_particles_var { extern void link(); }
|
||||
namespace sp_process_block_3d { extern void link(); }
|
||||
namespace sp_process_block_2d { extern void link(); }
|
||||
namespace draw_large_polygon { extern void link(); }
|
||||
namespace init_sky_regs { extern void link(); }
|
||||
namespace clip_polygon_against_positive_hyperplane { extern void link(); }
|
||||
namespace render_sky_quad { extern void link(); }
|
||||
namespace render_sky_tri { extern void link(); }
|
||||
namespace set_tex_offset { extern void link(); }
|
||||
namespace set_sky_vf27 { extern void link(); }
|
||||
namespace set_sky_vf23_value { extern void link(); }
|
||||
namespace adgif_shader_texture_with_update { extern void link(); }
|
||||
namespace init_boundary_regs { extern void link(); }
|
||||
namespace render_boundary_quad { extern void link(); }
|
||||
namespace render_boundary_tri { extern void link(); }
|
||||
namespace draw_boundary_polygon { extern void link(); }
|
||||
namespace draw_inline_array_tfrag { extern void link(); }
|
||||
namespace stats_tfrag_asm { extern void link(); }
|
||||
namespace time_of_day_interp_colors_scratch { extern void link(); }
|
||||
namespace collide_do_primitives { extern void link(); }
|
||||
namespace moving_sphere_triangle_intersect { extern void link(); }
|
||||
namespace method_12_collide_mesh { extern void link(); }
|
||||
namespace method_11_collide_mesh { extern void link(); }
|
||||
namespace collide_probe_node { extern void link(); }
|
||||
namespace collide_probe_instance_tie { extern void link(); }
|
||||
namespace method_26_collide_cache { extern void link(); }
|
||||
namespace method_32_collide_cache { extern void link(); }
|
||||
namespace pc_upload_collide_frag { extern void link(); }
|
||||
namespace method_28_collide_cache { extern void link(); }
|
||||
namespace method_27_collide_cache { extern void link(); }
|
||||
namespace method_29_collide_cache { extern void link(); }
|
||||
namespace method_12_collide_shape_prim_mesh { extern void link(); }
|
||||
namespace method_14_collide_shape_prim_mesh { extern void link(); }
|
||||
namespace method_13_collide_shape_prim_mesh { extern void link(); }
|
||||
namespace method_30_collide_cache { extern void link(); }
|
||||
namespace method_9_collide_cache_prim { extern void link(); }
|
||||
namespace method_10_collide_cache_prim { extern void link(); }
|
||||
namespace method_10_collide_puss_work { extern void link(); }
|
||||
namespace method_9_collide_puss_work { extern void link(); }
|
||||
namespace method_15_collide_mesh { extern void link(); }
|
||||
namespace method_14_collide_mesh { extern void link(); }
|
||||
namespace method_16_collide_edge_work { extern void link(); }
|
||||
namespace method_15_collide_edge_work { extern void link(); }
|
||||
namespace method_10_collide_edge_hold_list { extern void link(); }
|
||||
namespace method_18_collide_edge_work { extern void link(); }
|
||||
namespace calc_animation_from_spr { extern void link(); }
|
||||
namespace bones_mtx_calc { extern void link(); }
|
||||
namespace cspace_parented_transformq_joint { extern void link(); }
|
||||
namespace draw_bones_merc { extern void link(); }
|
||||
namespace draw_bones_check_longest_edge_asm { extern void link(); }
|
||||
namespace blerc_execute { extern void link(); }
|
||||
namespace setup_blerc_chains_for_one_fragment { extern void link(); }
|
||||
namespace generic_merc_init_asm { extern void link(); }
|
||||
namespace generic_merc_execute_asm { extern void link(); }
|
||||
namespace mercneric_convert { extern void link(); }
|
||||
namespace generic_prepare_dma_double { extern void link(); }
|
||||
namespace generic_light_proc { extern void link(); }
|
||||
namespace generic_envmap_proc { extern void link(); }
|
||||
namespace high_speed_reject { extern void link(); }
|
||||
namespace generic_prepare_dma_single { extern void link(); }
|
||||
namespace ripple_create_wave_table { extern void link(); }
|
||||
namespace ripple_execute_init { extern void link(); }
|
||||
namespace ripple_apply_wave_table { extern void link(); }
|
||||
namespace ripple_matrix_scale { extern void link(); }
|
||||
namespace init_ocean_far_regs { extern void link(); }
|
||||
namespace render_ocean_quad { extern void link(); }
|
||||
namespace draw_large_polygon_ocean { extern void link(); }
|
||||
namespace ocean_interp_wave { extern void link(); }
|
||||
namespace ocean_generate_verts { extern void link(); }
|
||||
namespace shadow_execute { extern void link(); }
|
||||
namespace shadow_add_double_edges { extern void link(); }
|
||||
namespace shadow_add_double_tris { extern void link(); }
|
||||
namespace shadow_add_single_edges { extern void link(); }
|
||||
namespace shadow_add_facing_single_tris { extern void link(); }
|
||||
namespace shadow_add_verts { extern void link(); }
|
||||
namespace shadow_find_double_edges { extern void link(); }
|
||||
namespace shadow_find_facing_double_tris { extern void link(); }
|
||||
namespace shadow_find_single_edges { extern void link(); }
|
||||
namespace shadow_find_facing_single_tris { extern void link(); }
|
||||
namespace shadow_init_vars { extern void link(); }
|
||||
namespace shadow_scissor_top { extern void link(); }
|
||||
namespace shadow_scissor_edges { extern void link(); }
|
||||
namespace shadow_calc_dual_verts { extern void link(); }
|
||||
namespace shadow_xform_verts { extern void link(); }
|
||||
namespace draw_inline_array_instance_tie { extern void link(); }
|
||||
namespace draw_inline_array_prototype_tie_generic_asm { extern void link(); }
|
||||
namespace generic_tie_dma_to_spad_sync { extern void link(); }
|
||||
namespace generic_envmap_dproc { extern void link(); }
|
||||
namespace generic_interp_dproc { extern void link(); }
|
||||
namespace generic_no_light_dproc { extern void link(); }
|
||||
namespace generic_tie_convert { extern void link(); }
|
||||
} // namespace jak1
|
||||
|
||||
namespace sp_init_fields {
|
||||
extern void link();
|
||||
}
|
||||
namespace jak2 {
|
||||
namespace collide_do_primitives { extern void link(); }
|
||||
namespace moving_sphere_triangle_intersect { extern void link(); }
|
||||
|
||||
namespace particle_adgif {
|
||||
extern void link();
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
namespace sp_launch_particles_var {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace sp_process_block_3d {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace sp_process_block_2d {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace draw_large_polygon {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace init_sky_regs {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace clip_polygon_against_positive_hyperplane {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace render_sky_quad {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace render_sky_tri {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace set_tex_offset {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace set_sky_vf27 {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace set_sky_vf23_value {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace adgif_shader_texture_with_update {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace init_boundary_regs {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace render_boundary_quad {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace render_boundary_tri {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace draw_boundary_polygon {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace draw_inline_array_tfrag {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace stats_tfrag_asm {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace time_of_day_interp_colors_scratch {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace collide_do_primitives {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace moving_sphere_triangle_intersect {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_12_collide_mesh {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_11_collide_mesh {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace collide_probe_node {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace collide_probe_instance_tie {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_26_collide_cache {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_32_collide_cache {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace pc_upload_collide_frag {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_28_collide_cache {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_27_collide_cache {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_29_collide_cache {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_12_collide_shape_prim_mesh {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_14_collide_shape_prim_mesh {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_13_collide_shape_prim_mesh {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_30_collide_cache {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_9_collide_cache_prim {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_10_collide_cache_prim {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_10_collide_puss_work {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_9_collide_puss_work {
|
||||
extern void link();
|
||||
}
|
||||
namespace method_15_collide_mesh {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_14_collide_mesh {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_16_collide_edge_work {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_15_collide_edge_work {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_10_collide_edge_hold_list {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace method_18_collide_edge_work {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace calc_animation_from_spr {
|
||||
extern void link();
|
||||
}
|
||||
namespace bones_mtx_calc {
|
||||
extern void link();
|
||||
}
|
||||
namespace cspace_parented_transformq_joint {
|
||||
extern void link();
|
||||
}
|
||||
namespace draw_bones_merc {
|
||||
extern void link();
|
||||
}
|
||||
namespace draw_bones_check_longest_edge_asm {
|
||||
extern void link();
|
||||
}
|
||||
namespace blerc_execute {
|
||||
extern void link();
|
||||
}
|
||||
namespace setup_blerc_chains_for_one_fragment {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_merc_init_asm {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_merc_execute_asm {
|
||||
extern void link();
|
||||
}
|
||||
namespace mercneric_convert {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_prepare_dma_double {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_light_proc {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_envmap_proc {
|
||||
extern void link();
|
||||
}
|
||||
namespace high_speed_reject {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_prepare_dma_single {
|
||||
extern void link();
|
||||
}
|
||||
namespace ripple_create_wave_table {
|
||||
extern void link();
|
||||
}
|
||||
namespace ripple_execute_init {
|
||||
extern void link();
|
||||
}
|
||||
namespace ripple_apply_wave_table {
|
||||
extern void link();
|
||||
}
|
||||
namespace ripple_matrix_scale {
|
||||
extern void link();
|
||||
}
|
||||
namespace init_ocean_far_regs {
|
||||
extern void link();
|
||||
}
|
||||
namespace render_ocean_quad {
|
||||
extern void link();
|
||||
}
|
||||
namespace draw_large_polygon_ocean {
|
||||
extern void link();
|
||||
}
|
||||
namespace ocean_interp_wave {
|
||||
extern void link();
|
||||
}
|
||||
namespace ocean_generate_verts {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_execute {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_add_double_edges {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_add_double_tris {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_add_single_edges {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_add_facing_single_tris {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_add_verts {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_find_double_edges {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_find_facing_double_tris {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_find_single_edges {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_find_facing_single_tris {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_init_vars {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_scissor_top {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_scissor_edges {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_calc_dual_verts {
|
||||
extern void link();
|
||||
}
|
||||
namespace shadow_xform_verts {
|
||||
extern void link();
|
||||
}
|
||||
namespace draw_inline_array_instance_tie {
|
||||
extern void link();
|
||||
}
|
||||
namespace draw_inline_array_prototype_tie_generic_asm {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace generic_tie_dma_to_spad_sync {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_envmap_dproc {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_interp_dproc {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_no_light_dproc {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace generic_tie_convert {
|
||||
extern void link();
|
||||
}
|
||||
LinkedFunctionTable gLinkedFunctionTable;
|
||||
Rng gRng;
|
||||
std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks = {
|
||||
{"font", {draw_string::link}},
|
||||
{"sparticle-launcher",
|
||||
{sp_init_fields::link, particle_adgif::link, sp_launch_particles_var::link}},
|
||||
{"sparticle", {sp_process_block_3d::link, sp_process_block_2d::link}},
|
||||
{"texture", {adgif_shader_texture_with_update::link}},
|
||||
{"sky-tng",
|
||||
{draw_large_polygon::link, init_sky_regs::link, clip_polygon_against_positive_hyperplane::link,
|
||||
render_sky_quad::link, render_sky_tri::link, set_tex_offset::link, set_sky_vf27::link,
|
||||
set_sky_vf23_value::link}},
|
||||
{"load-boundary",
|
||||
{init_boundary_regs::link, render_boundary_quad::link, render_boundary_tri::link,
|
||||
draw_boundary_polygon::link}},
|
||||
{"tfrag", {draw_inline_array_tfrag::link, stats_tfrag_asm::link}},
|
||||
{"time-of-day", {time_of_day_interp_colors_scratch::link}},
|
||||
{"collide-func", {collide_do_primitives::link, moving_sphere_triangle_intersect::link}},
|
||||
{"collide-probe", {collide_probe_node::link, collide_probe_instance_tie::link}},
|
||||
{"collide-mesh",
|
||||
{method_12_collide_mesh::link, method_11_collide_mesh::link, method_15_collide_mesh::link,
|
||||
method_14_collide_mesh::link}},
|
||||
{"collide-cache",
|
||||
{method_26_collide_cache::link, method_32_collide_cache::link, pc_upload_collide_frag::link,
|
||||
method_28_collide_cache::link, method_27_collide_cache::link, method_29_collide_cache::link,
|
||||
method_12_collide_shape_prim_mesh::link, method_14_collide_shape_prim_mesh::link,
|
||||
method_13_collide_shape_prim_mesh::link, method_30_collide_cache::link,
|
||||
method_9_collide_cache_prim::link, method_10_collide_cache_prim::link,
|
||||
method_10_collide_puss_work::link, method_9_collide_puss_work::link}},
|
||||
{"collide-edge-grab",
|
||||
{method_16_collide_edge_work::link, method_15_collide_edge_work::link,
|
||||
method_10_collide_edge_hold_list::link, method_18_collide_edge_work::link}},
|
||||
{"joint", {calc_animation_from_spr::link, cspace_parented_transformq_joint::link}},
|
||||
{"bones",
|
||||
{bones_mtx_calc::link, draw_bones_merc::link, draw_bones_check_longest_edge_asm::link}},
|
||||
{"merc-blend-shape", {blerc_execute::link, setup_blerc_chains_for_one_fragment::link}},
|
||||
{"generic-merc",
|
||||
{generic_merc_init_asm::link, generic_merc_execute_asm::link, mercneric_convert::link,
|
||||
high_speed_reject::link}},
|
||||
{"generic-effect",
|
||||
{generic_prepare_dma_double::link, generic_light_proc::link, generic_envmap_proc::link,
|
||||
generic_prepare_dma_single::link, generic_envmap_dproc::link, generic_interp_dproc::link,
|
||||
generic_no_light_dproc::link}},
|
||||
{"ripple",
|
||||
{ripple_execute_init::link, ripple_create_wave_table::link, ripple_apply_wave_table::link,
|
||||
ripple_matrix_scale::link}},
|
||||
{"ocean", {init_ocean_far_regs::link, render_ocean_quad::link, draw_large_polygon_ocean::link}},
|
||||
{"ocean-vu0", {ocean_interp_wave::link, ocean_generate_verts::link}},
|
||||
{"shadow-cpu",
|
||||
{shadow_execute::link, shadow_add_double_edges::link, shadow_add_double_tris::link,
|
||||
shadow_add_single_edges::link, shadow_add_facing_single_tris::link, shadow_add_verts::link,
|
||||
shadow_find_double_edges::link, shadow_find_facing_double_tris::link,
|
||||
shadow_find_single_edges::link, shadow_find_facing_single_tris::link, shadow_init_vars::link,
|
||||
shadow_scissor_top::link, shadow_scissor_edges::link, shadow_calc_dual_verts::link,
|
||||
shadow_xform_verts::link}},
|
||||
{"tie-methods",
|
||||
{draw_inline_array_instance_tie::link, draw_inline_array_prototype_tie_generic_asm::link}},
|
||||
{"generic-tie", {generic_tie_dma_to_spad_sync::link, generic_tie_convert::link}}};
|
||||
PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2CLinkCallbacks = {
|
||||
//////// JAK 1
|
||||
{{"font", {jak1::draw_string::link}},
|
||||
{"sparticle-launcher",
|
||||
{jak1::sp_init_fields::link, jak1::particle_adgif::link,
|
||||
jak1::sp_launch_particles_var::link}},
|
||||
{"sparticle", {jak1::sp_process_block_3d::link, jak1::sp_process_block_2d::link}},
|
||||
{"texture", {jak1::adgif_shader_texture_with_update::link}},
|
||||
{"sky-tng",
|
||||
{jak1::draw_large_polygon::link, jak1::init_sky_regs::link,
|
||||
jak1::clip_polygon_against_positive_hyperplane::link, jak1::render_sky_quad::link,
|
||||
jak1::render_sky_tri::link, jak1::set_tex_offset::link, jak1::set_sky_vf27::link,
|
||||
jak1::set_sky_vf23_value::link}},
|
||||
{"load-boundary",
|
||||
{jak1::init_boundary_regs::link, jak1::render_boundary_quad::link,
|
||||
jak1::render_boundary_tri::link, jak1::draw_boundary_polygon::link}},
|
||||
{"tfrag", {jak1::draw_inline_array_tfrag::link, jak1::stats_tfrag_asm::link}},
|
||||
{"time-of-day", {jak1::time_of_day_interp_colors_scratch::link}},
|
||||
{"collide-func",
|
||||
{jak1::collide_do_primitives::link, jak1::moving_sphere_triangle_intersect::link}},
|
||||
{"collide-probe", {jak1::collide_probe_node::link, jak1::collide_probe_instance_tie::link}},
|
||||
{"collide-mesh",
|
||||
{jak1::method_12_collide_mesh::link, jak1::method_11_collide_mesh::link,
|
||||
jak1::method_15_collide_mesh::link, jak1::method_14_collide_mesh::link}},
|
||||
{"collide-cache",
|
||||
{jak1::method_26_collide_cache::link, jak1::method_32_collide_cache::link,
|
||||
jak1::pc_upload_collide_frag::link, jak1::method_28_collide_cache::link,
|
||||
jak1::method_27_collide_cache::link, jak1::method_29_collide_cache::link,
|
||||
jak1::method_12_collide_shape_prim_mesh::link, jak1::method_14_collide_shape_prim_mesh::link,
|
||||
jak1::method_13_collide_shape_prim_mesh::link, jak1::method_30_collide_cache::link,
|
||||
jak1::method_9_collide_cache_prim::link, jak1::method_10_collide_cache_prim::link,
|
||||
jak1::method_10_collide_puss_work::link, jak1::method_9_collide_puss_work::link}},
|
||||
{"collide-edge-grab",
|
||||
{jak1::method_16_collide_edge_work::link, jak1::method_15_collide_edge_work::link,
|
||||
jak1::method_10_collide_edge_hold_list::link, jak1::method_18_collide_edge_work::link}},
|
||||
{"joint", {jak1::calc_animation_from_spr::link, jak1::cspace_parented_transformq_joint::link}},
|
||||
{"bones",
|
||||
{jak1::bones_mtx_calc::link, jak1::draw_bones_merc::link,
|
||||
jak1::draw_bones_check_longest_edge_asm::link}},
|
||||
{"merc-blend-shape",
|
||||
{jak1::blerc_execute::link, jak1::setup_blerc_chains_for_one_fragment::link}},
|
||||
{"generic-merc",
|
||||
{jak1::generic_merc_init_asm::link, jak1::generic_merc_execute_asm::link,
|
||||
jak1::mercneric_convert::link, jak1::high_speed_reject::link}},
|
||||
{"generic-effect",
|
||||
{jak1::generic_prepare_dma_double::link, jak1::generic_light_proc::link,
|
||||
jak1::generic_envmap_proc::link, jak1::generic_prepare_dma_single::link,
|
||||
jak1::generic_envmap_dproc::link, jak1::generic_interp_dproc::link,
|
||||
jak1::generic_no_light_dproc::link}},
|
||||
{"ripple",
|
||||
{jak1::ripple_execute_init::link, jak1::ripple_create_wave_table::link,
|
||||
jak1::ripple_apply_wave_table::link, jak1::ripple_matrix_scale::link}},
|
||||
{"ocean",
|
||||
{jak1::init_ocean_far_regs::link, jak1::render_ocean_quad::link,
|
||||
jak1::draw_large_polygon_ocean::link}},
|
||||
{"ocean-vu0", {jak1::ocean_interp_wave::link, jak1::ocean_generate_verts::link}},
|
||||
{"shadow-cpu",
|
||||
{jak1::shadow_execute::link, jak1::shadow_add_double_edges::link,
|
||||
jak1::shadow_add_double_tris::link, jak1::shadow_add_single_edges::link,
|
||||
jak1::shadow_add_facing_single_tris::link, jak1::shadow_add_verts::link,
|
||||
jak1::shadow_find_double_edges::link, jak1::shadow_find_facing_double_tris::link,
|
||||
jak1::shadow_find_single_edges::link, jak1::shadow_find_facing_single_tris::link,
|
||||
jak1::shadow_init_vars::link, jak1::shadow_scissor_top::link,
|
||||
jak1::shadow_scissor_edges::link, jak1::shadow_calc_dual_verts::link,
|
||||
jak1::shadow_xform_verts::link}},
|
||||
{"tie-methods",
|
||||
{jak1::draw_inline_array_instance_tie::link,
|
||||
jak1::draw_inline_array_prototype_tie_generic_asm::link}},
|
||||
{"generic-tie", {jak1::generic_tie_dma_to_spad_sync::link, jak1::generic_tie_convert::link}}},
|
||||
/////////// JAK 2
|
||||
{{"collide-func",
|
||||
{jak2::collide_do_primitives::link, jak2::moving_sphere_triangle_intersect::link}}}};
|
||||
|
||||
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
|
||||
const auto& it = m_executes.insert({name, {exec, Ptr<u8>()}});
|
||||
@@ -414,9 +204,22 @@ void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 s
|
||||
}
|
||||
|
||||
// this is short stub that will jump to the appropriate function.
|
||||
// todo jak1
|
||||
auto jump_to_asm = Ptr<u8>(jak1::alloc_heap_object(
|
||||
s7.offset + FIX_SYM_GLOBAL_HEAP, *(s7 + FIX_SYM_FUNCTION_TYPE), 0x40, UNKNOWN_PP));
|
||||
Ptr<u8> jump_to_asm;
|
||||
switch (g_game_version) {
|
||||
case GameVersion::Jak1:
|
||||
jump_to_asm = Ptr<u8>(::jak1::alloc_heap_object(s7.offset + jak1_symbols::FIX_SYM_GLOBAL_HEAP,
|
||||
*(s7 + jak1_symbols::FIX_SYM_FUNCTION_TYPE),
|
||||
0x40, UNKNOWN_PP));
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
jump_to_asm = Ptr<u8>(::jak2::alloc_heap_object(
|
||||
s7.offset + jak2_symbols::FIX_SYM_GLOBAL_HEAP,
|
||||
::jak2::u32_in_fixed_sym(jak2_symbols::FIX_SYM_FUNCTION_TYPE), 0x40, UNKNOWN_PP));
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
it.first->second.goal_trampoline = jump_to_asm;
|
||||
|
||||
u8* ptr = jump_to_asm.c();
|
||||
|
||||
@@ -26,7 +26,8 @@ class LinkedFunctionTable {
|
||||
std::unordered_map<std::string, Func> m_executes;
|
||||
};
|
||||
|
||||
extern std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks;
|
||||
extern PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>>
|
||||
gMips2CLinkCallbacks;
|
||||
extern LinkedFunctionTable gLinkedFunctionTable;
|
||||
|
||||
struct Rng {
|
||||
|
||||
@@ -3,7 +3,399 @@
|
||||
|
||||
;; name: collide-func.gc
|
||||
;; name in dgo: collide-func
|
||||
;; dgos: ENGINE, GAME
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
;; This file contains the primitive intersection functions used for collision.
|
||||
;; Most take a description of primitive and a "probe"
|
||||
;; The probe has an origin and a direction. The length of the direction vector is the length
|
||||
;; of the probe.
|
||||
|
||||
;; Generally, collision functions will return the fraction of the probe to reach the primitive.
|
||||
;; For example, if the probe is 5.0 long, and hits the primitive 2.0 away from the probe origin,
|
||||
;; the return value (u) would be 0.4.
|
||||
|
||||
;; If (u) would be > 1.0, then it counts as "not intersecting" (object too far away)
|
||||
;; If (u) would be < 0.0, then it counts as "not intersecting" (object behind probe)
|
||||
;; If there's a miss, return COLLISION_MISS, a large negative number.
|
||||
;; If we are inside of the primitive, return 0.0
|
||||
|
||||
|
||||
(defconstant COLLISION_MISS -100000000.0)
|
||||
|
||||
|
||||
(defun raw-ray-sphere-intersect ((arg0 float))
|
||||
"DANGER: this function takes two arguments by vf registers.
|
||||
As a result, it doesn't work properly in OpenGOAL. See the functions below."
|
||||
(local-vars
|
||||
(v1-1 float)
|
||||
(v1-2 float)
|
||||
(v1-4 number)
|
||||
(a0-1 float)
|
||||
(a0-2 float)
|
||||
(a0-3 int)
|
||||
(a1-0 float)
|
||||
)
|
||||
(crash!)
|
||||
(rlet ((Q :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.mov vf3 arg0) ;; vf3 = radius
|
||||
;; sphere is at the origin, vf1 is source of the ray (o)
|
||||
;; vf2 is the ray's unit vector (u)
|
||||
(.mul.vf vf4 vf2 vf2) ;; vf4 = u.^2
|
||||
(.mul.vf vf3 vf3 vf3) ;; vf3 = r^2
|
||||
(.mul.vf vf6 vf1 vf1) ;; vf6 = o.^2
|
||||
(.mul.vf vf5 vf2 vf1) ;; vf5 = u . o
|
||||
(.add.y.vf vf4 vf4 vf4 :mask #b1)
|
||||
(let ((result (the-as float 0)))
|
||||
(.add.x.vf vf6 vf6 vf6 :mask #b10)
|
||||
(.sub.x.vf vf6 vf6 vf3 :mask #b100)
|
||||
(.add.z.vf vf4 vf4 vf4 :mask #b1)
|
||||
(.add.x.vf vf5 vf5 vf5 :mask #b10)
|
||||
(let ((v1-0 (the-as float 0)))
|
||||
(.add.z.vf vf6 vf6 vf6 :mask #b10)
|
||||
(.div.vf Q vf0 vf4 :fsf #b11 :ftf #b0)
|
||||
(.add.z.vf vf5 vf5 vf5 :mask #b10)
|
||||
(.mov a0-1 vf4)
|
||||
(.mul.x.vf vf7 vf6 vf4)
|
||||
(.mov a1-0 vf6)
|
||||
(.mul.vf vf8 vf5 vf5)
|
||||
(b! (< (the-as int a1-0) 0) cfg-7 :delay (set! a0-2 a0-1))
|
||||
(.mul.vf vf4 vf0 Q :mask #b1000)
|
||||
(.sub.vf vf9 vf8 vf7)
|
||||
(b! (= a0-2 v1-0) cfg-6 :delay (.mov v1-1 vf5))
|
||||
)
|
||||
(.sqrt.vf Q vf9 :ftf #b1)
|
||||
(b! (>= (the-as int v1-1) 0) cfg-6 :delay (.mov v1-2 vf9))
|
||||
(b! (< (the-as int v1-2) 0) cfg-6 :delay 1.0)
|
||||
(.add.x.vf vf6 vf5 vf4)
|
||||
(.mov v1-4 vf6)
|
||||
(.mul.vf vf6 vf6 vf6)
|
||||
(.mul.vf vf9 vf0 Q :mask #b1000)
|
||||
(.sub.vf vf6 vf9 vf6)
|
||||
(.add.w.vf vf9 vf5 vf9 :mask #b10)
|
||||
(.mov a0-3 vf6)
|
||||
(.mul.w.vf vf9 vf9 vf4 :mask #b10)
|
||||
(b!
|
||||
(< (logand (the-as uint v1-4) (the-as uint a0-3)) 0)
|
||||
cfg-6
|
||||
:delay
|
||||
(.sub.y.vf vf4 vf0 vf9)
|
||||
)
|
||||
(b! #t cfg-7 :delay (.mov result vf4))
|
||||
(label cfg-6)
|
||||
(set! result -100000000.0)
|
||||
(label cfg-7)
|
||||
(the-as float result)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro pc-port-do-raw-ray-sphere-intersect (rad vf1-val vf2-val)
|
||||
"Calls to raw-ray-sphere-intersect should be replaced with this macro,
|
||||
and this should be given vf1, vf2, which contain the origin and direction of the probe."
|
||||
`(let ((vf1-storage (new 'stack-no-clear 'vector))
|
||||
(vf2-storage (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(.svf (&-> vf1-storage quad) ,vf1-val)
|
||||
(.svf (&-> vf2-storage quad) ,vf2-val)
|
||||
(pc-port-raw-ray-sphere-implementation ,rad vf1-storage vf2-storage)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun pc-port-raw-ray-sphere-implementation ((rad float) (vf1-val vector) (vf2-val vector))
|
||||
"This is one of the main primitives for collision.
|
||||
Assumes a sphere of radius rad is at the origin.
|
||||
Handles:
|
||||
- miss (return MISS)
|
||||
- behind (return MISS)
|
||||
- too far away (return MISS)
|
||||
- inside (return 0)
|
||||
"
|
||||
(local-vars
|
||||
(v1-1 int)
|
||||
(v1-2 int)
|
||||
(v1-4 int)
|
||||
(a0-1 float)
|
||||
(a0-2 float)
|
||||
(a0-3 int)
|
||||
(a1-0 int)
|
||||
)
|
||||
(rlet ((Q :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf1 (&-> vf1-val quad))
|
||||
(.lvf vf2 (&-> vf2-val quad))
|
||||
(.mov vf3 rad)
|
||||
(.mul.vf vf4 vf2 vf2)
|
||||
(.mul.vf vf3 vf3 vf3)
|
||||
(.mul.vf vf6 vf1 vf1)
|
||||
(.mul.vf vf5 vf2 vf1)
|
||||
(.add.y.vf vf4 vf4 vf4 :mask #b1)
|
||||
(let ((result (the-as float 0)))
|
||||
(.add.x.vf vf6 vf6 vf6 :mask #b10)
|
||||
(.sub.x.vf vf6 vf6 vf3 :mask #b100)
|
||||
(.add.z.vf vf4 vf4 vf4 :mask #b1)
|
||||
(.add.x.vf vf5 vf5 vf5 :mask #b10)
|
||||
(let ((v1-0 (the-as float 0)))
|
||||
(.add.z.vf vf6 vf6 vf6 :mask #b10)
|
||||
(.div.vf Q vf0 vf4 :fsf #b11 :ftf #b0)
|
||||
(.add.z.vf vf5 vf5 vf5 :mask #b10)
|
||||
(.mov a0-1 vf4)
|
||||
(.mul.x.vf vf7 vf6 vf4)
|
||||
(.mov a1-0 vf6)
|
||||
(.mul.vf vf8 vf5 vf5)
|
||||
(b! (< (the-as int a1-0) 0) cfg-7 :delay (set! a0-2 a0-1)) ;; in the sphere
|
||||
(.mul.vf vf4 vf0 Q :mask #b1000)
|
||||
(.sub.vf vf9 vf8 vf7)
|
||||
(b! (= a0-2 v1-0) cfg-6 :delay (.mov v1-1 vf5)) ;; bad denominator in division
|
||||
)
|
||||
(.sqrt.vf Q vf9 :ftf #b1)
|
||||
(b! (>= (the-as int v1-1) 0) cfg-6 :delay (.mov v1-2 vf9)) ;; wrong dir
|
||||
(b! (< (the-as int v1-2) 0) cfg-6 :delay 1.0) ;; bad sqrt
|
||||
(.add.x.vf vf6 vf5 vf4)
|
||||
(.mov v1-4 vf6)
|
||||
(.mul.vf vf6 vf6 vf6)
|
||||
(.mul.vf vf9 vf0 Q :mask #b1000)
|
||||
(.sub.vf vf6 vf9 vf6)
|
||||
(.add.w.vf vf9 vf5 vf9 :mask #b10)
|
||||
(.mov a0-3 vf6)
|
||||
(.mul.w.vf vf9 vf9 vf4 :mask #b10)
|
||||
|
||||
;; too far.
|
||||
(b! (< (logand (the-as int v1-4) (the-as int a0-3)) 0)
|
||||
cfg-6
|
||||
:delay (.sub.y.vf vf4 vf0 vf9)
|
||||
)
|
||||
(b! #t cfg-7 :delay (.mov result vf4))
|
||||
(label cfg-6)
|
||||
(set! result -100000000.0)
|
||||
(label cfg-7)
|
||||
(the-as float result)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun ray-sphere-intersect ((ray-origin vector) (ray-dir vector) (sph-origin vector) (radius float))
|
||||
"Intersect a ray and sphere. Will return 0 if you are in the sphere, -huge number if you don't hit it.
|
||||
Returns the length of the ray to the first intersection."
|
||||
|
||||
;; offset stuff as if the sphere is at the origin.
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
)
|
||||
(.lvf vf1 (&-> ray-origin quad))
|
||||
(.lvf vf2 (&-> sph-origin quad))
|
||||
(.sub.vf vf1 vf1 vf2) ;; the sphere is at the origin in the actual intersection.
|
||||
(.lvf vf2 (&-> ray-dir quad))
|
||||
;;(raw-ray-sphere-intersect radius)
|
||||
(pc-port-do-raw-ray-sphere-intersect radius vf1 vf2)
|
||||
)
|
||||
)
|
||||
|
||||
(defun ray-circle-intersect ((ray-origin vector) (ray-dir vector) (circle-origin vector) (radius float))
|
||||
"Intersect ray with circle. Circle is on the y plane and this throws out the y components
|
||||
of ray-origin, circle-origin, and ray-dir"
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf1 (&-> ray-origin quad))
|
||||
(.mov.vf vf1 vf0 :mask #b10)
|
||||
(.lvf vf2 (&-> circle-origin quad))
|
||||
(.mov.vf vf2 vf0 :mask #b10)
|
||||
(.sub.vf vf1 vf1 vf2)
|
||||
(.lvf vf2 (&-> ray-dir quad))
|
||||
(.mov.vf vf2 vf0 :mask #b10)
|
||||
;;(raw-ray-sphere-intersect radius)
|
||||
(pc-port-do-raw-ray-sphere-intersect radius vf1 vf2)
|
||||
)
|
||||
)
|
||||
|
||||
(defun ray-cylinder-intersect ((ray-origin vector) (ray-dir vector) (cyl-origin vector) (cyl-axis vector) (cyl-rad float) (cyl-len float) (pt-out vector))
|
||||
"Intersect with a cylinder.
|
||||
Currently this is untested."
|
||||
(local-vars
|
||||
(v0-1 float)
|
||||
(v1-0 int)
|
||||
(v1-2 int)
|
||||
(a0-1 int)
|
||||
(a0-2 int)
|
||||
(a0-4 int)
|
||||
(a0-5 int)
|
||||
)
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
(vf12 :class vf)
|
||||
(vf13 :class vf)
|
||||
(vf14 :class vf)
|
||||
(vf15 :class vf)
|
||||
(vf16 :class vf)
|
||||
(vf17 :class vf)
|
||||
(vf18 :class vf)
|
||||
(vf19 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf20 :class vf)
|
||||
(vf21 :class vf)
|
||||
)
|
||||
(.lvf vf10 (&-> ray-origin quad))
|
||||
(.lvf vf12 (&-> cyl-origin quad))
|
||||
(.sub.vf vf15 vf10 vf12)
|
||||
(.lvf vf11 (&-> ray-dir quad))
|
||||
(.lvf vf13 (&-> cyl-axis quad))
|
||||
(.mov vf14 cyl-len)
|
||||
(.mul.vf vf16 vf15 vf13)
|
||||
(.mul.vf vf17 vf11 vf13)
|
||||
(.add.x.vf vf16 vf16 vf16 :mask #b10)
|
||||
(.add.x.vf vf17 vf17 vf17 :mask #b10)
|
||||
(.add.z.vf vf16 vf16 vf16 :mask #b10)
|
||||
(.add.z.vf vf17 vf17 vf17 :mask #b10)
|
||||
(.mul.y.vf vf1 vf13 vf16)
|
||||
(.add.vf vf18 vf17 vf16)
|
||||
(.sub.x.vf vf19 vf16 vf14)
|
||||
(.mul.y.vf vf2 vf13 vf17)
|
||||
(.mov v1-0 vf16)
|
||||
(.sub.x.vf vf20 vf18 vf14)
|
||||
(.mov a0-1 vf18)
|
||||
(let ((v1-1 (logand v1-0 (the-as uint a0-1))))
|
||||
(.sub.vf vf1 vf15 vf1)
|
||||
(b! (< v1-1 0) cfg-6 :delay (.sub.vf vf2 vf11 vf2))
|
||||
)
|
||||
(.mov v1-2 vf19)
|
||||
(.mov a0-2 vf20)
|
||||
(b! (>= (the-as int (logior v1-2 (the-as uint a0-2))) 0) cfg-6 :delay (nop!))
|
||||
;;(let ((v1-4 (raw-ray-sphere-intersect cyl-rad)))
|
||||
(let ((v1-4 (pc-port-do-raw-ray-sphere-intersect cyl-rad vf1 vf2)))
|
||||
(b! (< (the-as int v1-4) 0) cfg-6 :delay (.mov vf21 v1-4))
|
||||
(.mul.x.vf vf17 vf17 vf21)
|
||||
(.add.vf vf16 vf16 vf17)
|
||||
(.mul.y.vf vf13 vf13 vf16)
|
||||
(.sub.x.vf vf19 vf16 vf14)
|
||||
(.mov a0-4 vf16)
|
||||
(b!
|
||||
(< (the-as int a0-4) 0)
|
||||
cfg-6
|
||||
:delay
|
||||
(.add.vf vf12 vf12 vf13 :mask #b111)
|
||||
)
|
||||
(.mov a0-5 vf19)
|
||||
(b! (>= (the-as int a0-5) 0) cfg-6 :delay (.svf (&-> pt-out quad) vf12))
|
||||
(b! #t cfg-7 :delay (set! v0-1 v1-4))
|
||||
)
|
||||
(label cfg-6)
|
||||
(set! v0-1 -100000000.0)
|
||||
(label cfg-7)
|
||||
v0-1
|
||||
)
|
||||
)
|
||||
|
||||
(defun ray-plane-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 vector) (arg6 vector))
|
||||
"Unused."
|
||||
(local-vars (v1-0 float) (v1-1 float) (a2-1 float))
|
||||
(rlet ((acc :class vf)
|
||||
(Q :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf3 (&-> arg5 quad))
|
||||
(.lvf vf1 (&-> arg4 quad))
|
||||
(.lvf vf2 (&-> arg6 quad))
|
||||
(.sub.vf vf1 vf3 vf1)
|
||||
(.sub.vf vf2 vf3 vf2)
|
||||
(.lvf vf6 (&-> arg2 quad))
|
||||
(.lvf vf7 (&-> arg3 quad))
|
||||
(.sub.vf vf8 vf3 vf6)
|
||||
(.outer.product.a.vf acc vf2 vf1)
|
||||
(.outer.product.b.vf vf4 vf1 vf2 acc)
|
||||
(.mul.vf vf8 vf8 vf4)
|
||||
(.mul.vf vf9 vf7 vf4)
|
||||
(.mul.vf vf5 vf4 vf4)
|
||||
(.add.y.vf vf8 vf8 vf8 :mask #b1)
|
||||
(.add.y.vf vf9 vf9 vf9 :mask #b1)
|
||||
(.add.y.vf vf5 vf5 vf5 :mask #b1)
|
||||
(.add.z.vf vf8 vf8 vf8 :mask #b1)
|
||||
(.add.z.vf vf9 vf9 vf9 :mask #b1)
|
||||
(.add.z.vf vf5 vf5 vf5 :mask #b1)
|
||||
(.mov v1-0 vf9)
|
||||
(.mov a2-1 vf8)
|
||||
(.isqrt.vf Q vf0 vf5 :fsf #b11 :ftf #b0)
|
||||
(let ((f1-0 a2-1)
|
||||
(f2-0 v1-0)
|
||||
)
|
||||
(cond
|
||||
((!= f2-0 0.0)
|
||||
(let ((f1-1 (/ f1-0 f2-0)))
|
||||
(.mov.vf vf4 vf0 :mask #b1000)
|
||||
(.wait.vf)
|
||||
(.mul.vf vf4 vf4 Q :mask #b111)
|
||||
(let ((v0-0 f1-1))
|
||||
(.mov vf8 v0-0)
|
||||
(.svf (&-> arg1 quad) vf4)
|
||||
(.mul.x.vf acc vf7 vf8)
|
||||
(.add.mul.w.vf vf7 vf6 vf0 acc :mask #b111)
|
||||
(.svf (&-> arg0 quad) vf7)
|
||||
(.mov v1-1 vf7)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
-100000000.0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; ray-triangle-intersect (unused)
|
||||
;; collide-do-primitives (used in moving-sphere-triangle-intersect)
|
||||
(def-mips2c collide-do-primitives (function float))
|
||||
;; moving-sphere-triangle-intersect (used in cam)
|
||||
(def-mips2c moving-sphere-triangle-intersect (function vector vector float collide-cache-tri vector vector float))
|
||||
;; moving-sphere-sphere-intersect (used in collide)
|
||||
(defun moving-sphere-sphere-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
|
||||
(let ((f30-0 (ray-sphere-intersect arg0 arg1 arg2 (+ (-> arg0 w) (-> arg2 w)))))
|
||||
(when (>= f30-0 0.0)
|
||||
(let ((s3-1 (vector-normalize! (vector-! (new-stack-vector0) arg2 arg0) (-> arg0 w))))
|
||||
(vector+*! arg3 arg0 arg1 f30-0)
|
||||
(vector+! arg3 arg3 s3-1)
|
||||
)
|
||||
)
|
||||
f30-0
|
||||
)
|
||||
)
|
||||
|
||||
;; moving-sphere-moving-sphere-intersect (unused)
|
||||
|
||||
@@ -309,7 +309,7 @@
|
||||
:size-assert #x74
|
||||
:flag-assert #x1000000074
|
||||
(:methods
|
||||
(add-to-loading-level (_type_) none 15)
|
||||
(add-to-loading-level (_type_) skeleton-group 15)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
;; todo: more specific
|
||||
(define-extern external-art-buffer-init function)
|
||||
(declare-type art basic)
|
||||
(declare-type art-group art)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
@@ -23,12 +25,10 @@
|
||||
(:methods
|
||||
(new (symbol type int level) _type_ 0)
|
||||
(load-dir-method-9 () none 9)
|
||||
(load-dir-method-10 () none 10)
|
||||
(set-loaded-art (_type_ art-group) art-group 10)
|
||||
)
|
||||
)
|
||||
|
||||
(declare-type art-group basic)
|
||||
|
||||
(deftype load-dir-art-group (load-dir)
|
||||
((art-group-array (array art-group) :offset 12)
|
||||
)
|
||||
|
||||
@@ -5,5 +5,25 @@
|
||||
;; name in dgo: loader
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
;; temporary hack to avoid crash at startup
|
||||
|
||||
(defmethod set-loaded-art load-dir-art-group ((obj load-dir-art-group) (arg0 art-group))
|
||||
(let ((s4-0 (-> obj string-array)))
|
||||
(dotimes (s3-0 (-> s4-0 length))
|
||||
(when (string= (-> arg0 name) (-> s4-0 s3-0))
|
||||
(set! (-> obj art-group-array s3-0) arg0)
|
||||
(set! arg0 (-> obj art-group-array s3-0))
|
||||
(goto cfg-7)
|
||||
)
|
||||
)
|
||||
(set! (-> s4-0 (-> s4-0 length)) (-> arg0 name))
|
||||
(set! (-> obj art-group-array (-> s4-0 length)) arg0)
|
||||
(+! (-> s4-0 length) 1)
|
||||
)
|
||||
(+! (-> obj art-group-array length) 1)
|
||||
(label cfg-7)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
|
||||
@@ -5,5 +5,15 @@
|
||||
;; name in dgo: process-drawable
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
;; temp hacks to avoid crash at startup
|
||||
(defmethod add-to-loading-level skeleton-group ((obj skeleton-group))
|
||||
(let ((v1-1 (-> *level* loading-level)))
|
||||
(if v1-1
|
||||
(set-loaded-art (-> v1-1 art-group) obj)
|
||||
)
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
(define-extern link-begin (function pointer (pointer uint8) int kheap link-flag int))
|
||||
(define-extern kset-language (function language-enum int))
|
||||
(define-extern syncv (function int int))
|
||||
(define-extern __pc-get-mips2c (function string function))
|
||||
|
||||
|
||||
;; PC stuff
|
||||
|
||||
@@ -701,3 +701,17 @@
|
||||
(deactivate pp)
|
||||
)
|
||||
)
|
||||
|
||||
;; Some assembly functions in GOAL are ported to C++, then accessed from GOAL using these mips2c macros.
|
||||
(defmacro def-mips2c (name type)
|
||||
"Define a mips2c object (typically a function)."
|
||||
`(begin
|
||||
(define-extern ,name ,type)
|
||||
(set! ,name (the-as ,type (__pc-get-mips2c ,(symbol->string name))))
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro defmethod-mips2c (name method-id method-type)
|
||||
"Define a mips2c method."
|
||||
`(method-set! ,method-type ,method-id (__pc-get-mips2c ,name))
|
||||
)
|
||||
+1
-1
@@ -471,7 +471,7 @@
|
||||
:size-assert #x74
|
||||
:flag-assert #x1000000074
|
||||
(:methods
|
||||
(add-to-loading-level (_type_) none 15)
|
||||
(add-to-loading-level (_type_) skeleton-group 15)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
(:methods
|
||||
(new (symbol type int level) _type_ 0)
|
||||
(load-dir-method-9 () none 9)
|
||||
(load-dir-method-10 () none 10)
|
||||
(set-loaded-art (_type_ art-group) art-group 10)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -844,7 +844,7 @@ TEST_F(WithGameTests, StackSingletonType) {
|
||||
{"#t\n0\n"});
|
||||
}
|
||||
|
||||
namespace Mips2C {
|
||||
namespace Mips2C::jak1 {
|
||||
namespace test_func {
|
||||
extern u64 execute(void*);
|
||||
}
|
||||
@@ -852,16 +852,16 @@ namespace goal_call_test {
|
||||
extern u64 execute(void*);
|
||||
extern void link();
|
||||
} // namespace goal_call_test
|
||||
} // namespace Mips2C
|
||||
} // namespace Mips2C::jak1
|
||||
|
||||
TEST_F(WithGameTests, Mips2CBasic) {
|
||||
Mips2C::gLinkedFunctionTable.reg("test-func", Mips2C::test_func::execute, 0);
|
||||
Mips2C::gLinkedFunctionTable.reg("test-func", Mips2C::jak1::test_func::execute, 0);
|
||||
shared_compiler->runner.run_static_test(testCategory, "test-mips2c-call.gc", {"36\n0\n"});
|
||||
}
|
||||
|
||||
TEST_F(WithGameTests, Mips2C_CallGoal) {
|
||||
Mips2C::gLinkedFunctionTable.reg("test-func2", Mips2C::goal_call_test::execute, 128);
|
||||
Mips2C::goal_call_test::link();
|
||||
Mips2C::gLinkedFunctionTable.reg("test-func2", Mips2C::jak1::goal_call_test::execute, 128);
|
||||
Mips2C::jak1::goal_call_test::link();
|
||||
shared_compiler->runner.run_static_test(testCategory, "test-mips2c-goal.gc",
|
||||
{"1 2 3 4 5 6 7 8\n12\n"});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user