mirror of
https://github.com/open-goal/jak-project
synced 2026-09-06 03:08:29 -04:00
W/misc fixes (#1838)
* temp * temp * before cleaning up * cleanup merge * fix warnings * merge fix * clang format
This commit is contained in:
@@ -219,6 +219,6 @@ inline u32 rgba16_to_rgba32(u32 in) {
|
||||
}
|
||||
|
||||
// texture format enums
|
||||
enum class PSM { PSMCT16 = 0x02, PSMT8 = 0x13, PSMT4 = 0x14 };
|
||||
enum class PSM { PSMCT32 = 0x0, PSMCT16 = 0x02, PSMT8 = 0x13, PSMT4 = 0x14 };
|
||||
// clut format enums
|
||||
enum class CPSM { PSMCT32 = 0x0, PSMCT16 = 0x02 };
|
||||
|
||||
@@ -734,6 +734,7 @@ void AsmOp::update_register_info() {
|
||||
case InstructionKind::VFTOI0:
|
||||
case InstructionKind::VFTOI4:
|
||||
case InstructionKind::VFTOI12:
|
||||
case InstructionKind::VFTOI15:
|
||||
case InstructionKind::VITOF0:
|
||||
case InstructionKind::VITOF12:
|
||||
case InstructionKind::VITOF15:
|
||||
|
||||
@@ -4913,7 +4913,7 @@ void ReturnElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
|
||||
namespace {
|
||||
|
||||
void push_asm_srl_to_stack(const AsmOp* op,
|
||||
FormElement* /*form_elt*/,
|
||||
FormElement* form_elt,
|
||||
const Env& env,
|
||||
FormPool& pool,
|
||||
FormStack& stack) {
|
||||
@@ -4940,7 +4940,7 @@ void push_asm_srl_to_stack(const AsmOp* op,
|
||||
stack.push_value_to_reg(*dst, pool.alloc_single_form(nullptr, other), true,
|
||||
env.get_variable_type(*dst, true));
|
||||
} else {
|
||||
// stack.push_form_element(form_elt, true);
|
||||
//
|
||||
auto src_var = pop_to_forms({*var}, env, pool, stack, true).at(0);
|
||||
auto as_ba = src_var->try_as_element<BitfieldAccessElement>();
|
||||
if (as_ba) {
|
||||
@@ -4950,9 +4950,10 @@ void push_asm_srl_to_stack(const AsmOp* op,
|
||||
stack.push_value_to_reg(*dst, pool.alloc_single_form(nullptr, other), true,
|
||||
env.get_variable_type(*dst, true));
|
||||
} else {
|
||||
throw std::runtime_error(
|
||||
fmt::format("Got invalid bitfield manip for srl at op {}: {} type was {}", op->op_id(),
|
||||
src_var->to_string(env), arg0_type.print()));
|
||||
stack.push_form_element(form_elt, true);
|
||||
// throw std::runtime_error(
|
||||
// fmt::format("Got invalid bitfield manip for srl at op {}: {} type was {}", op->op_id(),
|
||||
// src_var->to_string(env), arg0_type.print()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ ObjectFileDB::ObjectFileDB(const std::vector<fs::path>& _dgos,
|
||||
const std::vector<fs::path>& object_files,
|
||||
const std::vector<fs::path>& str_files,
|
||||
const Config& config)
|
||||
: dts(config.game_version) {
|
||||
: dts(config.game_version), m_version(config.game_version) {
|
||||
Timer timer;
|
||||
|
||||
lg::info("-Loading types...");
|
||||
|
||||
@@ -343,6 +343,11 @@ class ObjectFileDB {
|
||||
uint32_t unique_obj_files = 0;
|
||||
uint32_t unique_obj_bytes = 0;
|
||||
} stats;
|
||||
|
||||
GameVersion version() const { return m_version; }
|
||||
|
||||
private:
|
||||
GameVersion m_version;
|
||||
};
|
||||
|
||||
std::string print_art_elt_for_dump(const std::string& group_name, const std::string& name, int idx);
|
||||
|
||||
@@ -253,6 +253,7 @@ std::unique_ptr<AtomicOp> make_asm_op(const Instruction& i0, int idx) {
|
||||
case InstructionKind::VFTOI0:
|
||||
case InstructionKind::VFTOI4:
|
||||
case InstructionKind::VFTOI12:
|
||||
case InstructionKind::VFTOI15:
|
||||
case InstructionKind::VITOF0:
|
||||
case InstructionKind::VITOF12:
|
||||
case InstructionKind::VITOF15:
|
||||
@@ -337,6 +338,7 @@ std::unique_ptr<AtomicOp> make_asm_op(const Instruction& i0, int idx) {
|
||||
case InstructionKind::PEXTLW:
|
||||
case InstructionKind::PPACH:
|
||||
case InstructionKind::PSUBW:
|
||||
case InstructionKind::PCGTB:
|
||||
case InstructionKind::PCGTW:
|
||||
case InstructionKind::PEXTLH:
|
||||
case InstructionKind::PEXTLB:
|
||||
|
||||
@@ -1420,7 +1420,19 @@ FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) {
|
||||
args.push_back(as_func->elts().at(i));
|
||||
}
|
||||
|
||||
if (mr_ac_call.maps.forms.at(1)->to_string(env) != fmt::format("'{}", proc_type)) {
|
||||
std::string expected_name;
|
||||
switch (env.version) {
|
||||
case GameVersion::Jak1:
|
||||
expected_name = fmt::format("'{}", proc_type);
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
expected_name = fmt::format("(symbol->string (-> {} symbol))", proc_type);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
if (mr_ac_call.maps.forms.at(1)->to_string(env) != expected_name) {
|
||||
ja_push_form_to_args(pool, args, mr_ac_call.maps.forms.at(1), "name");
|
||||
}
|
||||
if (!mr_get_proc.maps.forms.at(0)->to_form(env).is_symbol("*default-dead-pool*")) {
|
||||
|
||||
@@ -1082,6 +1082,7 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
|
||||
case InstructionKind::DADDIU:
|
||||
return handle_daddiu(output, i0, instr_str, version);
|
||||
case InstructionKind::ADDIU:
|
||||
case InstructionKind::SLTI:
|
||||
return handle_generic_op2_u16(i0, instr_str);
|
||||
case InstructionKind::QMTC2:
|
||||
return handle_generic_op2(i0, instr_str, "mov128_vf_gpr");
|
||||
|
||||
+211
-193
@@ -96,6 +96,7 @@
|
||||
(define-extern link-resume (function int))
|
||||
(define-extern link-reset (function none))
|
||||
(define-extern kset-language (function language-enum int))
|
||||
(define-extern reset-graph (function int int int int none))
|
||||
|
||||
(define-extern loading-level kheap)
|
||||
|
||||
@@ -3537,6 +3538,11 @@
|
||||
:copy-entries gs-reg
|
||||
)
|
||||
|
||||
(defenum gs-reg32
|
||||
:type uint32
|
||||
:copy-entries gs-reg
|
||||
)
|
||||
|
||||
(defenum gs-prim-type
|
||||
:type uint8
|
||||
(point 0)
|
||||
@@ -4890,6 +4896,7 @@
|
||||
(reg-1 uint8 :offset 24)
|
||||
(reg-2 uint8 :offset 40)
|
||||
(reg-3 uint8 :offset 56)
|
||||
(reg-4-u32 gs-reg32 :offset 72)
|
||||
(reg-4 uint8 :offset 72)
|
||||
(tex0 gs-tex0 :offset 0)
|
||||
(tex1 gs-tex1 :offset 16)
|
||||
@@ -4897,6 +4904,8 @@
|
||||
(clamp gs-clamp :offset 48)
|
||||
(clamp-reg gs-reg64 :offset 56)
|
||||
(alpha gs-alpha :offset 64)
|
||||
(alpha-as-miptb2 gs-miptbp :offset 64)
|
||||
|
||||
(link-test link-test-flags :offset 8)
|
||||
(texture-id texture-id :offset 24)
|
||||
(next shader-ptr :offset 40)
|
||||
@@ -5413,6 +5422,7 @@
|
||||
(deftype mood-context (mood-context-core3)
|
||||
((itimes vector4w 4 :inline :offset-assert 1776)
|
||||
(state uint32 32 :offset-assert 1840) ;; arbitrary data - can be floats | symbols
|
||||
(clear uint128 123 :offset 0) ;; added
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x7b0
|
||||
@@ -5848,15 +5858,15 @@
|
||||
(get-level-by-heap-ptr-and-status (_type_ pointer symbol) level 11) ;;
|
||||
(level-get-for-use (_type_ symbol symbol) level 12)
|
||||
(activate-levels! (_type_) int 13) ;; (debug-print-entities (_type_ symbol type) none 13)
|
||||
(level-group-method-14 () none 14) ;; (debug-draw-actors (_type_ symbol) none 14)
|
||||
(level-group-method-15 () none 15) ;; (actors-update (_type_) object 15)
|
||||
(level-group-method-14 () none 14)
|
||||
(debug-draw-actors (_type_ symbol) none 15)
|
||||
(assign-draw-indices (_type_) none 16) ;; (level-update (_type_) int 16)
|
||||
(level-group-method-17 () none 17) ;; (level-get-target-inside (_type_) level 17)
|
||||
(actors-update (_type_) none 17) ;; (level-get-target-inside (_type_) level 17)
|
||||
(level-group-method-18 () none 18) ;; (alloc-levels! (_type_ symbol) int 18)
|
||||
(level-update (_type_) none 19) ;;
|
||||
(level-get-target-inside (_type_) level 20) ;; (art-group-get-by-name (_type_ string) art-group 20)
|
||||
(alloc-levels-if-needed (_type_ symbol) none 21)
|
||||
(load-commands-set! (_type_ pair) pair 22) ;; (update-vis-volumes (_type_) none 22)
|
||||
(load-commands-set! (_type_ pair) none 22) ;; (update-vis-volumes (_type_) none 22)
|
||||
(art-group-get-by-name (_type_ string (pointer uint32)) art-group 23) ;; (update-vis-volumes-from-nav-mesh (_type_) none 23)
|
||||
(load-command-get-index (_type_ symbol int) pair 24) ;; (print-volume-sizes (_type_) none 24)
|
||||
(level-group-method-25 () none 25) ;; (level-status (_type_ symbol) symbol 25)
|
||||
@@ -6233,7 +6243,7 @@
|
||||
(define-extern draw-sprite2d-xy-absolute (function dma-buffer int int int int rgba none))
|
||||
(define-extern draw-quad2d (function dma-buffer draw-context none))
|
||||
(define-extern screen-gradient (function dma-buffer rgba rgba rgba rgba none))
|
||||
(define-extern vif1-handler-debug (function none))
|
||||
(define-extern vif1-handler-debug (function int none))
|
||||
(define-extern vif1-handler (function none))
|
||||
(define-extern vblank-handler (function int))
|
||||
(define-extern set-display-gs-state (function dma-buffer int int int int int dma-buffer))
|
||||
@@ -7340,9 +7350,9 @@
|
||||
:size-assert #x710
|
||||
:flag-assert #xc00000710
|
||||
(:methods
|
||||
(memory-usage-block-method-9 () none 9) ;; (reset! (_type_) _type_ 9)
|
||||
(reset! (_type_) _type_ 9)
|
||||
(memory-usage-block-method-10 () none 10) ;; (calculate-total (_type_) int 10)
|
||||
(memory-usage-block-method-11 () none 11) ;; (print-mem-usage (_type_ level object) none 11)
|
||||
(print-mem-usage (_type_ level object) none 11)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -7424,7 +7434,7 @@
|
||||
(define-extern texture-page-level-allocate (function texture-pool texture-page kheap int texture-page))
|
||||
;; (define-extern texture-page-size-check function) ;; (function texture-pool level symbol int)
|
||||
;; (define-extern set-skull-gem-masks function)
|
||||
;; (define-extern upload-textures function)
|
||||
(define-extern upload-textures (function texture-pool none))
|
||||
(define-extern *txt-dma-list* dma-buffer)
|
||||
;; (define-extern texture-relocate function) ;; (function dma-buffer texture int gs-psm int dma-buffer)
|
||||
(define-extern relocate-later (function symbol))
|
||||
@@ -7437,7 +7447,7 @@
|
||||
(define-extern *shader-list* pair)
|
||||
(define-extern *edit-shader* texture-id)
|
||||
;; (define-extern link-texture-by-id function) ;; (function texture-id adgif-shader texture-page-dir-entry)
|
||||
(define-extern adgif-shader<-texture! (function adgif-shader texture adgif-shader)) ;;
|
||||
(define-extern adgif-shader<-texture! (function adgif-shader texture adgif-shader)) ;;
|
||||
(define-extern adgif-shader-update! (function adgif-shader texture none))
|
||||
;; (define-extern adgif-shader<-texture-with-update! function) ;; (function adgif-shader texture adgif-shader)
|
||||
;; (define-extern hack-texture function)
|
||||
@@ -7445,7 +7455,7 @@
|
||||
(define-extern adgif-shader-login-no-remap (function adgif-shader texture))
|
||||
;; (define-extern adgif-shader-login-fast function) ;; (function adgif-shader texture)
|
||||
;; (define-extern adgif-shader-login-no-remap-fast function) ;; (function adgif-shader texture)
|
||||
(define-extern adgif-shader<-texture-simple! (function adgif-shader texture adgif-shader)) ;;
|
||||
(define-extern adgif-shader<-texture-simple! (function adgif-shader texture adgif-shader)) ;;
|
||||
(define-extern set-dirty-mask!
|
||||
"First arg is the level name off the [[*level*]]'s `default-level`"
|
||||
(function string int int int none))
|
||||
@@ -7813,6 +7823,7 @@
|
||||
;; drawable-h ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(declare-type region-prim-list structure)
|
||||
|
||||
(deftype drawable (basic)
|
||||
((id int16 :offset-assert 4)
|
||||
@@ -7826,10 +7837,10 @@
|
||||
(draw (_type_ _type_ display-frame) none 10)
|
||||
(drawable-method-11 () none 11) ;; (collide-with-box (_type_ int collide-list) none 11)
|
||||
(drawable-method-12 () none 12) ;; (collide-y-probe (_type_ int collide-list) none 12)
|
||||
(drawable-method-13 () none 13) ;; (collide-ray (_type_ int collide-list) none 13)
|
||||
(debug-draw (_type_ drawable display-frame) none 14) ;; (collect-stats (_type_) none 14)
|
||||
(collect-stats (_type_) none 13) ;; (collide-ray (_type_ int collide-list) none 13)
|
||||
(debug-draw (_type_ drawable display-frame) none 14)
|
||||
(unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 15) ;;
|
||||
(drawable-method-16 () none 16) ;;
|
||||
(collect-regions (_type_ sphere int region-prim-list) none 16)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -9073,7 +9084,7 @@
|
||||
(init-orbit-settings! (_type_ int float float float float float float) none 10)
|
||||
(sky-work-method-11 () none 11)
|
||||
(sky-work-method-12 () none 12)
|
||||
(sky-work-method-13 () none 13)
|
||||
(draw (_type_) none 13)
|
||||
(sky-work-method-14 () none 14)
|
||||
(sky-work-method-15 () none 15)
|
||||
(sky-work-method-16 () none 16)
|
||||
@@ -9578,8 +9589,8 @@
|
||||
:flag-assert #x5c0000206c
|
||||
(:methods
|
||||
(ocean-method-11 (_type_ (inline-array vector) symbol) float 11)
|
||||
(ocean-method-12 () none 12)
|
||||
(ocean-method-13 () none 13)
|
||||
(draw! (_type_) none 12)
|
||||
(update-map (_type_) none 13)
|
||||
(ocean-method-14 () none 14)
|
||||
(ocean-method-15 () none 15)
|
||||
(ocean-method-16 () none 16)
|
||||
@@ -11707,7 +11718,7 @@
|
||||
(game-info-method-14 () none 14) ;; 14)
|
||||
(game-info-method-15 () none 15)
|
||||
(copy-perms-from-level! (_type_ level) none 16)
|
||||
(copy-perms-to-level! (_type_ level) none 17)
|
||||
(copy-perms-to-level! (_type_ level) none 17)
|
||||
(game-info-method-18 () none 18)
|
||||
(get-current-continue-point (_type_) continue-point 19)
|
||||
(get-continue-by-name (_type_ string) continue-point 20)
|
||||
@@ -15533,9 +15544,9 @@
|
||||
(:methods
|
||||
(new (symbol type) _type_ 0)
|
||||
(touching-list-method-9 () none 9) ;; (add-touching-prims (_type_ collide-shape-prim collide-shape-prim float collide-tri-result collide-tri-result) none 9)
|
||||
(touching-list-method-10 () none 10) ;; (dummy-10 () none 10)
|
||||
(free-nodes (_type_) none 10) ;; (dummy-10 () none 10)
|
||||
(touching-list-method-11 () none 11) ;; (update-from-step-size (_type_ float) none 11)
|
||||
(touching-list-method-12 () none 12) ;; (send-events-for-touching-shapes (_type_) none 12)
|
||||
(send-events-for-touching-shapes (_type_) none 12)
|
||||
(touching-list-method-13 () none 13) ;; (get-shapes-entry (_type_ collide-shape collide-shape) touching-shapes-entry 13)
|
||||
)
|
||||
)
|
||||
@@ -16493,50 +16504,52 @@
|
||||
(declare-type entity-nav-mesh entity)
|
||||
(declare-type actor-group basic)
|
||||
|
||||
(defenum texture-page-flag
|
||||
:type uint16
|
||||
:bitfield #t)
|
||||
|
||||
(deftype bsp-header (drawable)
|
||||
(
|
||||
(info file-info :offset 4)
|
||||
(all-visible-list (pointer uint16) :offset-assert 32)
|
||||
(visible-list-length int16 :offset-assert 36)
|
||||
(drawable-trees drawable-tree-array :offset-assert 40)
|
||||
(pat pointer :offset-assert 44)
|
||||
(pat-length int32 :offset-assert 48)
|
||||
|
||||
; ;; some sort of texture remapping info (seems to be same in jak2)
|
||||
; (texture-remap-table (pointer uint64) :offset-assert 52)
|
||||
; (texture-remap-table-len int32 :offset-assert 56)
|
||||
|
||||
(texture-ids (pointer texture-id) :offset 60)
|
||||
(texture-page-count int32 :offset 64)
|
||||
|
||||
; (unk-zero-0 basic :offset-assert 68)
|
||||
|
||||
(name symbol :offset 72)
|
||||
(nickname symbol :offset-assert 76)
|
||||
(vis-info level-vis-info 8 :offset 80)
|
||||
(actors drawable-inline-array-actor :offset-assert 112)
|
||||
(cameras (array entity-camera) :offset-assert 116)
|
||||
(nodes (inline-array bsp-node) :offset 120)
|
||||
(level level :offset-assert 124)
|
||||
(current-leaf-idx uint16 :offset-assert 128)
|
||||
(unk-data-2 uint16 9 :offset 130)
|
||||
|
||||
; (boxes box8s-array :offset-assert 148)
|
||||
; (current-bsp-back-flags uint32 :offset-assert 152)
|
||||
(unk-byte1 uint8 :offset 152)
|
||||
(unk-byte2 uint8 :offset 153)
|
||||
(unk-half-word uint16 :offset-assert 154)
|
||||
(ambients symbol :offset-assert 156) ;; now just #t?
|
||||
(unk-data-4 float :offset 160)
|
||||
(unk-data-5 float :offset-assert 164)
|
||||
; (adgifs adgif-shader-array :offset-assert 168)
|
||||
(race-meshes (array entity-race-mesh) :offset 168)
|
||||
;; 172 is something
|
||||
(light-hash light-hash :offset 176)
|
||||
(nav-meshes (array entity-nav-mesh) :offset 180)
|
||||
(actor-groups (array actor-group) :offset 184)
|
||||
|
||||
(collide-hash collide-hash :offset 196)
|
||||
;; TYPE 0
|
||||
(info file-info :offset 4)
|
||||
;; 0 8
|
||||
;; 0 12
|
||||
;; 0 16
|
||||
;; 0 20
|
||||
;; 0 24
|
||||
;; 0 28
|
||||
(all-visible-list (pointer uint16) :offset-assert 32)
|
||||
(visible-list-length int16 :offset-assert 36)
|
||||
(drawable-trees drawable-tree-array :offset-assert 40)
|
||||
(pat pointer :offset-assert 44)
|
||||
(pat-length int32 :offset-assert 48)
|
||||
(texture-remap-table (pointer uint64) :offset-assert 52)
|
||||
(texture-remap-table-len int32 :offset-assert 56)
|
||||
(texture-ids (pointer texture-id) :offset-assert 60)
|
||||
(texture-page-count int32 :offset-assert 64)
|
||||
;; 0 68
|
||||
(name symbol :offset 72)
|
||||
(nickname symbol :offset-assert 76)
|
||||
(vis-info level-vis-info 8 :offset-assert 80)
|
||||
(actors drawable-inline-array-actor :offset-assert 112)
|
||||
(cameras (array entity-camera) :offset-assert 116)
|
||||
(nodes (inline-array bsp-node) :offset-assert 120)
|
||||
(level level :offset-assert 124)
|
||||
;; 0 (maybe current-leaf-idx?) 128
|
||||
(texture-flags texture-page-flag 10 :offset 130)
|
||||
;; 0 (maybe padding) 150
|
||||
;; 0 (was boxes, current back flags?, byte?) 152
|
||||
;; #t (was ambients?) 156
|
||||
(subdivide-close float :offset 160)
|
||||
(subdivide-far float :offset-assert 164)
|
||||
(race-meshes (array entity-race-mesh) :offset-assert 168)
|
||||
;; pointer to table of sorted floats 172
|
||||
(light-hash light-hash :offset 176)
|
||||
(nav-meshes (array entity-nav-mesh) :offset-assert 180)
|
||||
(actor-groups (array actor-group) :offset-assert 184)
|
||||
(region-trees (array drawable-tree-region-prim) :offset-assert 188)
|
||||
(region-array region-array :offset-assert 192)
|
||||
(collide-hash collide-hash :offset-assert 196)
|
||||
;; 200 is some array
|
||||
;; 204 is maybe that array's length
|
||||
;; 216 is a vector array
|
||||
@@ -18407,7 +18420,7 @@
|
||||
:size-assert #x40
|
||||
:flag-assert #xa00000040
|
||||
(:methods
|
||||
(create-launch-control (_type_ process) sparticle-launch-control 9) ;;
|
||||
(create-launch-control (_type_ process) sparticle-launch-control 9) ;;
|
||||
)
|
||||
)
|
||||
|
||||
@@ -18429,7 +18442,7 @@
|
||||
:size-assert #x70
|
||||
:flag-assert #x1000000070
|
||||
(:methods
|
||||
(initialize (_type_ sparticle-launch-group process) none 9) ;;
|
||||
(initialize (_type_ sparticle-launch-group process) none 9) ;;
|
||||
(sparticle-launch-control-method-10 (_type_ vector) symbol 10) ;; (is-visible? (_type_ vector) symbol 10)
|
||||
(sparticle-launch-control-method-11 (_type_ vector) none 11) ;; TODO - CFG ;; (spawn (_type_ vector) object 11)
|
||||
(sparticle-launch-control-method-12 (_type_ matrix) none 12)
|
||||
@@ -21112,7 +21125,7 @@
|
||||
;; (define-extern ray-plane-intersect function) ;; (function vector vector vector vector vector vector vector float)
|
||||
;; (define-extern ray-triangle-intersect function) ;; (function vector vector float matrix vector vector float)
|
||||
;; (define-extern collide-do-primitives function) ;; (function float)
|
||||
(define-extern moving-sphere-triangle-intersect (function vector vector float collide-cache-tri vector vector float)) ;;
|
||||
(define-extern moving-sphere-triangle-intersect (function vector vector float collide-cache-tri vector vector float)) ;;
|
||||
;; (define-extern moving-sphere-sphere-intersect function) ;; (function vector vector vector vector float)
|
||||
;; (define-extern moving-sphere-moving-sphere-intersect function) ;; (function vector vector vector vector vector float)
|
||||
|
||||
@@ -21233,7 +21246,7 @@
|
||||
|
||||
;; (define-extern mem-usage-bsp-tree function) ;; (function bsp-header bsp-node memory-usage-block int none)
|
||||
;; (define-extern *test-shrub* object) ;; int
|
||||
(define-extern bsp-camera-asm (function bsp-header vector none)) ;;
|
||||
(define-extern bsp-camera-asm (function bsp-header vector none)) ;;
|
||||
(define-extern print-collide-stats (function none))
|
||||
;; (define-extern level-remap-texture function) ;; (function texture-id texture-id)
|
||||
(define-extern build-masks (function bsp-header none))
|
||||
@@ -21609,14 +21622,14 @@
|
||||
;; (define-extern internal-draw-debug-text-3d function) ;; (function bucket-id string vector font-color vector2h pointer)
|
||||
;; (define-extern add-debug-outline-triangle function) ;; (function symbol bucket-id vector vector vector rgba symbol)
|
||||
;; (define-extern add-debug-triangle-normal function) ;; (function symbol bucket-id vector vector vector rgba symbol)
|
||||
(define-extern add-debug-flat-triangle (function symbol bucket-id vector vector vector rgba symbol)) ;;
|
||||
(define-extern add-debug-flat-triangle (function symbol bucket-id vector vector vector rgba symbol)) ;;
|
||||
;; (define-extern *debug-lines* object) ;; (inline-array debug-line)
|
||||
;; (define-extern *debug-lines-trk* object) ;; debug-tracking-thang
|
||||
;; (define-extern *debug-text-3ds* object) ;; (inline-array debug-text-3d)
|
||||
;; (define-extern *debug-text-3d-trk* object) ;; debug-tracking-thang
|
||||
;; (define-extern get-debug-line function) ;; (function debug-line)
|
||||
;; (define-extern get-debug-text-3d function) ;; (function debug-text-3d)
|
||||
;; (define-extern debug-reset-buffers function) ;; (function symbol)
|
||||
(define-extern debug-reset-buffers (function symbol))
|
||||
(define-extern debug-draw-buffers (function symbol))
|
||||
(define-extern add-debug-line (function symbol bucket-id vector vector rgba symbol rgba symbol))
|
||||
(define-extern add-debug-line2d (function symbol bucket-id vector vector vector symbol))
|
||||
@@ -21924,7 +21937,7 @@
|
||||
(define-extern merc-vu1-add-vu-function (function dma-packet vu-function int dma-gif-packet))
|
||||
;; (define-extern merc-vu1-initialize-chain function) ;; (function dma-gif-packet dma-packet)
|
||||
;; (define-extern merc-vu1-init-buffer function) ;; (function bucket-id gs-test int none)
|
||||
;; (define-extern merc-vu1-init-buffers function) ;; (function none)
|
||||
(define-extern merc-vu1-init-buffers (function none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; emerc ;;
|
||||
@@ -22064,7 +22077,7 @@
|
||||
;; (define-extern generic-init-buf function) ;; (function dma-buffer int gs-zbuf none)
|
||||
;; (define-extern generic-vu1-init-buf function)
|
||||
;; (define-extern generic-vu1-init-buf-special function)
|
||||
;; (define-extern generic-vu1-init-buffers function)
|
||||
(define-extern generic-vu1-init-buffers (function none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; generic-effect ;;
|
||||
@@ -22382,12 +22395,17 @@
|
||||
;; font ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; (define-extern gen-font-12 function)
|
||||
;; (define-extern draw-string-asm function)
|
||||
(define-extern draw-string (function string dma-buffer font-context float))
|
||||
(deftype draw-string-result (uint64)
|
||||
((length float :offset 0)
|
||||
(b float :offset 32))
|
||||
)
|
||||
|
||||
(define-extern gen-font-12 (function string none))
|
||||
(define-extern draw-string-asm (function string dma-buffer font-context uint))
|
||||
(define-extern draw-string (function string dma-buffer font-context draw-string-result))
|
||||
(define-extern get-string-length (function string font-context float))
|
||||
(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags float))
|
||||
;; (define-extern draw-string-adv function) ;; (function string dma-buffer font-context none)
|
||||
(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags draw-string-result))
|
||||
(define-extern draw-string-adv (function string dma-buffer font-context none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; decomp ;;
|
||||
@@ -22458,7 +22476,7 @@
|
||||
;; (define-extern mem-usage-shrub-walk function) ;; (function draw-node int memory-usage-block int draw-node)
|
||||
;; (define-extern shrub-vu1-block object) ;; vu-function
|
||||
;; (define-extern shrub-num-tris function) ;; (function shrubbery uint)
|
||||
(define-extern shrub-make-perspective-matrix (function matrix matrix)) ;;
|
||||
(define-extern shrub-make-perspective-matrix (function matrix matrix)) ;;
|
||||
;; (define-extern shrub-init-view-data function) ;; (function shrub-view-data symbol)
|
||||
;; (define-extern shrub-upload-view-data function) ;; (function dma-buffer symbol)
|
||||
;; (define-extern shrub-time function) ;; (function int int int int int int)
|
||||
@@ -22478,7 +22496,7 @@
|
||||
;; shrub-work ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-extern *instance-shrub-work* instance-shrub-work) ;;
|
||||
(define-extern *instance-shrub-work* instance-shrub-work) ;;
|
||||
;; (define-extern upload-generic-shrub function) ;; (function dma-buffer generic-shrub-fragment int int dma-buffer)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -22535,7 +22553,7 @@
|
||||
;; (define-extern tfrag-vu1-init-buf function)
|
||||
;; (define-extern tfrag-scissor-vu1-init-buf function)
|
||||
;; (define-extern *tfrag-init-table* object)
|
||||
;; (define-extern tfrag-vu1-init-buffers function)
|
||||
(define-extern tfrag-vu1-init-buffers (function none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; tfrag-work ;;
|
||||
@@ -22743,7 +22761,7 @@
|
||||
;; tie-work ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-extern *instance-tie-work* instance-tie-work) ;;
|
||||
(define-extern *instance-tie-work* instance-tie-work) ;;
|
||||
;; (define-extern *prototype-tie-work* object) ;; prototype-tie-work
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -22801,7 +22819,7 @@
|
||||
;; (define-extern tie-init-envmap-buf function)
|
||||
;; (define-extern tie-init-envmap-scissor-buf function)
|
||||
;; (define-extern *tie-init-table* object)
|
||||
;; (define-extern tie-vu1-init-buffers function)
|
||||
(define-extern tie-vu1-init-buffers (function none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; sync-info ;;
|
||||
@@ -22889,48 +22907,48 @@
|
||||
)
|
||||
|
||||
(define-extern *part-id-table* (array sparticle-launcher))
|
||||
(define-extern *part-group-id-table* (array sparticle-launch-group)) ;;
|
||||
(define-extern *part-group-id-table* (array sparticle-launch-group)) ;;
|
||||
(define-extern *sp-temp* int)
|
||||
(define-extern lookup-part-group-by-name
|
||||
"Iterate through the [[*part-group-id-table*]] and return the matching [[sparticle-launch-group]], or [[#f]] otherwise"
|
||||
(function string sparticle-launch-group))
|
||||
(define-extern lookup-part-group-pointer-by-name
|
||||
(define-extern lookup-part-group-pointer-by-name
|
||||
"Similar to [[lookup-part-group-by-name]] but returns a pointer instead"
|
||||
(function string (pointer object))) ;;
|
||||
(define-extern part-group-pointer?
|
||||
(function string (pointer object))) ;;
|
||||
(define-extern part-group-pointer?
|
||||
"Verifies if the given pointer, points to a [[sparticle-launch-group]]"
|
||||
(function pointer symbol))
|
||||
(define-extern unlink-part-group-by-heap (function kheap int)) ;;
|
||||
(define-extern sp-init-fields! (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object)) ;; TODO - mips2c
|
||||
(define-extern *sp-launcher-lock* symbol) ;;
|
||||
(define-extern *sp-launch-queue* sp-launch-queue) ;;
|
||||
(define-extern *sp-launcher-enable* symbol) ;;
|
||||
(define-extern unlink-part-group-by-heap (function kheap int)) ;;
|
||||
(define-extern sp-init-fields! (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object)) ;; TODO - mips2c
|
||||
(define-extern *sp-launcher-lock* symbol) ;;
|
||||
(define-extern *sp-launch-queue* sp-launch-queue) ;;
|
||||
(define-extern *sp-launcher-enable* symbol) ;;
|
||||
;; (define-extern particle-setup-adgif (function adgif-shader texture-id none)) ;; TODO - assertion failure
|
||||
(define-extern *particle-adgif-cache* particle-adgif-cache) ;;
|
||||
(define-extern *particle-adgif-cache* particle-adgif-cache) ;;
|
||||
(define-extern particle-adgif-cache-flush "Clear [[*particle-adgif-cache*]]" (function none))
|
||||
(define-extern particle-adgif (function adgif-shader texture-id none)) ;; TODO - particle-adgif atomic ops, MIPS2C
|
||||
(define-extern particle-adgif-callback (function adgif-shader none)) ;; TODO bad VF dependencies
|
||||
(define-extern sp-queue-launch (function sparticle-system sparticle-launcher matrix int))
|
||||
(define-extern sp-adjust-launch (function sparticle-launchinfo sparticle-cpuinfo (inline-array sp-field-init-spec) matrix symbol none)) ;;
|
||||
(define-extern sp-euler-convert (function sparticle-launchinfo sparticle-cpuinfo none)) ;;
|
||||
(define-extern sp-rotate-system (function sparticle-launchinfo sparticle-cpuinfo transformq none)) ;;
|
||||
(define-extern sp-adjust-launch (function sparticle-launchinfo sparticle-cpuinfo (inline-array sp-field-init-spec) matrix symbol none)) ;;
|
||||
(define-extern sp-euler-convert (function sparticle-launchinfo sparticle-cpuinfo none)) ;;
|
||||
(define-extern sp-rotate-system (function sparticle-launchinfo sparticle-cpuinfo transformq none)) ;;
|
||||
(define-extern sp-launch-particles-var (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none)) ;; TODO - mips2c
|
||||
(define-extern *death-adgif* adgif-shader) ;;
|
||||
(define-extern sp-launch-particles-death (function sparticle-system sparticle-launcher vector none)) ;;
|
||||
(define-extern sp-clear-queue (function none)) ;;
|
||||
(define-extern sp-relaunch-setup-fields (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;;
|
||||
(define-extern sp-relaunch-particle-2d (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;;
|
||||
(define-extern sp-relaunch-particle-3d (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;;
|
||||
(define-extern *death-adgif* adgif-shader) ;;
|
||||
(define-extern sp-launch-particles-death (function sparticle-system sparticle-launcher vector none)) ;;
|
||||
(define-extern sp-clear-queue (function none)) ;;
|
||||
(define-extern sp-relaunch-setup-fields (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;;
|
||||
(define-extern sp-relaunch-particle-2d (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;;
|
||||
(define-extern sp-relaunch-particle-3d (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;;
|
||||
(define-extern execute-part-engine (function none)) ;; TODO - whats the basic off the connection?
|
||||
(define-extern sparticle-track-root (function object sparticle-cpuinfo vector none)) ;;
|
||||
(define-extern sparticle-track-root-prim (function object sparticle-cpuinfo vector none)) ;;
|
||||
(define-extern sparticle-track-root (function object sparticle-cpuinfo vector none)) ;;
|
||||
(define-extern sparticle-track-root-prim (function object sparticle-cpuinfo vector none)) ;;
|
||||
(define-extern sparticle-track-joint (function sparticle-system sparticle-cpuinfo vector none))
|
||||
(define-extern sparticle-turn-to-vel (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d none))
|
||||
(define-extern birth-func-copy-rot-color (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;;
|
||||
(define-extern *global-toggle* int) ;;
|
||||
(define-extern birth-func-copy2-rot-color (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;;
|
||||
(define-extern birth-func-copy-omega-to-z (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;;
|
||||
(define-extern birth-func-random-next-time (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;;
|
||||
(define-extern birth-func-copy-rot-color (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;;
|
||||
(define-extern *global-toggle* int) ;;
|
||||
(define-extern birth-func-copy2-rot-color (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;;
|
||||
(define-extern birth-func-copy-omega-to-z (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;;
|
||||
(define-extern birth-func-random-next-time (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;;
|
||||
(define-extern sparticle-respawn-heights (function sparticle-system sparticle-cpuinfo vector none))
|
||||
(define-extern sparticle-respawn-timer (function sparticle-system sparticle-cpuinfo vector none))
|
||||
(define-extern sparticle-texture-animate (function sparticle-system sparticle-cpuinfo vector none))
|
||||
@@ -22942,11 +22960,11 @@
|
||||
(define-extern sparticle-next-on-mode-1 (function sparticle-system sparticle-cpuinfo sparticle-launchinfo float))
|
||||
(define-extern check-ground-bounce (function sparticle-system sparticle-cpuinfo sparticle-launchinfo float))
|
||||
(define-extern check-drop-group-center (function sparticle-system sparticle-cpuinfo sparticle-launchinfo none))
|
||||
(define-extern birth-func-y->userdata (function sparticle-system sparticle-cpuinfo matrix none)) ;;
|
||||
(define-extern birth-func-ocean-height (function sparticle-system sparticle-cpuinfo matrix none)) ;;
|
||||
(define-extern birth-func-y->userdata (function sparticle-system sparticle-cpuinfo matrix none)) ;;
|
||||
(define-extern birth-func-ocean-height (function sparticle-system sparticle-cpuinfo matrix none)) ;;
|
||||
(define-extern birth-func-camera-orient (function int sparticle-cpuinfo sparticle-launchinfo none))
|
||||
(define-extern *particle-quat* quaternion) ;;
|
||||
(define-extern birth-func-set-quat (function int sparticle-cpuinfo sparticle-launchinfo none)) ;;
|
||||
(define-extern *particle-quat* quaternion) ;;
|
||||
(define-extern birth-func-set-quat (function int sparticle-cpuinfo sparticle-launchinfo none)) ;;
|
||||
(define-extern *particle-vel* vector)
|
||||
(define-extern birth-func-set-vel (function object sparticle-cpuinfo sparticle-launchinfo none))
|
||||
(define-extern birth-func-texture-group (function int sparticle-cpuinfo sparticle-launchinfo none))
|
||||
@@ -22955,39 +22973,39 @@
|
||||
;; sparticle ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-extern sp-particle-copy! (function sparticle-cpuinfo sparticle-cpuinfo none)) ;;
|
||||
(define-extern *sp-particle-system-2d* sparticle-system) ;;
|
||||
(define-extern sp-particle-copy! (function sparticle-cpuinfo sparticle-cpuinfo none)) ;;
|
||||
(define-extern *sp-particle-system-2d* sparticle-system) ;;
|
||||
(define-extern *sp-particle-system-3d* sparticle-system) ;; sparticle-system
|
||||
(define-extern sp-get-block-size (function sparticle-system int int)) ;;
|
||||
(define-extern sp-get-approx-alloc-size (function sparticle-system int int)) ;;
|
||||
(define-extern sp-free-particle (function sparticle-system int sparticle-cpuinfo sprite-vec-data-2d none)) ;;
|
||||
(define-extern sp-get-block-size (function sparticle-system int int)) ;;
|
||||
(define-extern sp-get-approx-alloc-size (function sparticle-system int int)) ;;
|
||||
(define-extern sp-free-particle (function sparticle-system int sparticle-cpuinfo sprite-vec-data-2d none)) ;;
|
||||
(define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo)) ;; TODO - manually fixed in jak 1? gross
|
||||
(define-extern sp-kill-particle (function sparticle-system sparticle-cpuinfo symbol)) ;;
|
||||
(define-extern sp-orbiter (function sparticle-system sparticle-cpuinfo vector none)) ;;
|
||||
(define-extern sp-kill-particle (function sparticle-system sparticle-cpuinfo symbol)) ;;
|
||||
(define-extern sp-orbiter (function sparticle-system sparticle-cpuinfo vector none)) ;;
|
||||
(define-extern sp-process-block-2d (function sparticle-system int int int int symbol none)) ;; TODO - mips2c
|
||||
(define-extern sp-process-block-3d (function sparticle-system int int int int symbol none)) ;; TODO - mips2c
|
||||
(define-extern sp-copy-to-spr (function int pointer int none)) ;; TODO - these are all actually uints, but this is needed to get the casts right...
|
||||
(define-extern sp-copy-from-spr (function int pointer int none)) ;; TODO - these are all actually uints, but this is needed to get the casts right...
|
||||
(define-extern memcpy function) ;; TODO - was done manually as well?
|
||||
(define-extern sp-process-block (function sparticle-system int sprite-array-2d int none)) ;;
|
||||
(define-extern sp-process-particle-system (function sparticle-system int sprite-array-2d none)) ;;
|
||||
(define-extern *particles-flag* symbol) ;;
|
||||
(define-extern forall-particles-with-key-runner (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) sparticle-system none)) ;;
|
||||
(define-extern sp-process-block (function sparticle-system int sprite-array-2d int none)) ;;
|
||||
(define-extern sp-process-particle-system (function sparticle-system int sprite-array-2d none)) ;;
|
||||
(define-extern *particles-flag* symbol) ;;
|
||||
(define-extern forall-particles-with-key-runner (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) sparticle-system none)) ;;
|
||||
(define-extern forall-particles-with-key (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) symbol symbol none))
|
||||
(define-extern sparticle-kill-it (function sparticle-system sparticle-cpuinfo none)) ;;
|
||||
(define-extern sparticle-kill-it (function sparticle-system sparticle-cpuinfo none)) ;;
|
||||
(define-extern sparticle-kill-it-level0 (function sparticle-system sparticle-cpuinfo none)) ;; (function sparticle-system sparticle-cpuinfo none)
|
||||
(define-extern sparticle-kill-it-level1 (function sparticle-system sparticle-cpuinfo none)) ;; (function sparticle-system sparticle-cpuinfo none)
|
||||
(define-extern sparticle-kill-it-level2 (function sparticle-system sparticle-cpuinfo none))
|
||||
(define-extern sparticle-kill-it-level3 (function sparticle-system sparticle-cpuinfo none))
|
||||
(define-extern sparticle-kill-it-level4 (function sparticle-system sparticle-cpuinfo none))
|
||||
(define-extern sparticle-kill-it-level5 (function sparticle-system sparticle-cpuinfo none))
|
||||
(define-extern sparticle-60-to-50 (function sparticle-system sparticle-cpuinfo pointer none)) ;;
|
||||
(define-extern sparticle-60-to-50 (function sparticle-system sparticle-cpuinfo pointer none)) ;;
|
||||
(define-extern sparticle-50-to-60 (function sparticle-system sparticle-cpuinfo pointer none)) ;; (function sparticle-system sparticle-cpuinfo pointer none)
|
||||
(define-extern kill-all-particles-with-key (function sparticle-launch-control none)) ;;
|
||||
(define-extern forall-particles-runner (function (function sparticle-system sparticle-cpuinfo pointer none) sparticle-system none)) ;;
|
||||
(define-extern forall-particles (function function symbol symbol none)) ;;
|
||||
(define-extern kill-all-particles-with-key (function sparticle-launch-control none)) ;;
|
||||
(define-extern forall-particles-runner (function (function sparticle-system sparticle-cpuinfo pointer none) sparticle-system none)) ;;
|
||||
(define-extern forall-particles (function function symbol symbol none)) ;;
|
||||
(define-extern kill-all-particles-in-level (function level int))
|
||||
(define-extern all-particles-50-to-60 (function none)) ;;
|
||||
(define-extern all-particles-50-to-60 (function none)) ;;
|
||||
(define-extern all-particles-60-to-50 (function none)) ;; (function none)
|
||||
(define-extern remap-particle (function sparticle-system sparticle-cpuinfo pointer none))
|
||||
(define-extern remap-all-particles (function none))
|
||||
@@ -23347,7 +23365,7 @@
|
||||
(define-extern update-mood-exterior (function mood-context-core3 mood-table float int object)) ;; TODO - so many potential return values...
|
||||
(define-extern copy-mood-exterior (function mood-context symbol))
|
||||
(define-extern copy-mood-exterior-ambi (function mood-context symbol none))
|
||||
(define-extern clear-mood-context (function int none))
|
||||
(define-extern clear-mood-context (function mood-context none))
|
||||
;; (define-extern update-mood-interior function)
|
||||
(define-extern update-mood-flames (function mood-context int int int float float float float :behavior process))
|
||||
(define-extern *flash0* (array float))
|
||||
@@ -24226,7 +24244,7 @@
|
||||
;; weather-part ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-extern group-rain-screend-drop sparticle-launch-group) ;;
|
||||
(define-extern group-rain-screend-drop sparticle-launch-group) ;;
|
||||
(define-extern update-snow (function target none))
|
||||
;; (define-extern birth-func-omega-normal-orient function)
|
||||
;; (define-extern birth-func-rain function)
|
||||
@@ -24234,7 +24252,7 @@
|
||||
;; (define-extern check-drop-level-rain2 function)
|
||||
;; (define-extern check-drop-level-splash function)
|
||||
(define-extern update-rain (function target none))
|
||||
(define-extern cam-master-effect (function none :behavior camera-master)) ;;
|
||||
(define-extern cam-master-effect (function none :behavior camera-master)) ;;
|
||||
;; (define-extern sparticle-track-sun function) ;; (function int sparticle-cpuinfo matrix none)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -24245,7 +24263,7 @@
|
||||
(define-extern time-of-day-update (function none :behavior time-of-day-proc))
|
||||
(define-extern update-counters (function float :behavior time-of-day-proc))
|
||||
(define-extern time-of-day-tick (state time-of-day-proc))
|
||||
(define-extern init-time-of-day (function object :behavior time-of-day-proc)) ;;
|
||||
(define-extern init-time-of-day (function object :behavior time-of-day-proc)) ;;
|
||||
(define-extern start-time-of-day (function (pointer process)))
|
||||
(define-extern time-of-day-setup (function symbol symbol))
|
||||
;; (define-extern time-of-day-interp-colors function) ;; (function (pointer rgba) uint mood-context none)
|
||||
@@ -24254,7 +24272,7 @@
|
||||
(define-extern set-filter-color! (function float float int none))
|
||||
(define-extern tod-madd! (function vector vector vector float))
|
||||
(define-extern update-environment-colors (function time-of-day-context vector))
|
||||
;; (define-extern update-time-of-day (function time-of-day-context none))
|
||||
(define-extern update-time-of-day (function time-of-day-context none))
|
||||
(define-extern calc-fade-from-fog (function vector float))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -24469,7 +24487,7 @@
|
||||
(define-extern *print-login* symbol)
|
||||
(define-extern load-buffer-resize (function level pointer none))
|
||||
(define-extern level-update-after-load (function level login-state level))
|
||||
(define-extern bg (function symbol int))
|
||||
(define-extern bg (function symbol none))
|
||||
(define-extern play (function symbol symbol int))
|
||||
(define-extern play-boot (function none))
|
||||
;; (define-extern update-sound-banks function) ;; (function int)
|
||||
@@ -25143,30 +25161,30 @@
|
||||
;; (define-extern cam-circular-position (function symbol vector :behavior camera-slave)) ;; TODO - hang
|
||||
(define-extern cam-circular-code (function float :behavior camera-slave))
|
||||
(define-extern *CAM_STRING-bank* cam-string-bank) ;; cam-string-bank
|
||||
(define-extern cam-string-find-position-rel! (function vector symbol)) ;;
|
||||
(define-extern cam-string-find-position-rel! (function vector symbol)) ;;
|
||||
(define-extern cam-string-set-position-rel! (function vector cam-slave-options :behavior camera-slave))
|
||||
(define-extern string-push-help (function float)) ;;
|
||||
(define-extern cam-draw-collide-cache (function collide-cache none)) ;;
|
||||
(define-extern dist-info-init (function collide-los-dist-info none)) ;;
|
||||
(define-extern dist-info-valid? (function collide-los-dist-info symbol)) ;;
|
||||
(define-extern dist-info-append (function collide-los-dist-info vector none)) ;;
|
||||
(define-extern dist-info-print (function collide-los-dist-info string object)) ;;
|
||||
(define-extern los-cw-ccw (function (inline-array collide-cache-tri) vector vector float collide-los-result vector float symbol)) ;;
|
||||
(define-extern string-push-help (function float)) ;;
|
||||
(define-extern cam-draw-collide-cache (function collide-cache none)) ;;
|
||||
(define-extern dist-info-init (function collide-los-dist-info none)) ;;
|
||||
(define-extern dist-info-valid? (function collide-los-dist-info symbol)) ;;
|
||||
(define-extern dist-info-append (function collide-los-dist-info vector none)) ;;
|
||||
(define-extern dist-info-print (function collide-los-dist-info string object)) ;;
|
||||
(define-extern los-cw-ccw (function (inline-array collide-cache-tri) vector vector float collide-los-result vector float symbol)) ;;
|
||||
(define-extern cam-los-spline-collide (function vector vector pat-surface float)) ;;
|
||||
(define-extern cam-los-setup-lateral (function collide-los-result vector vector symbol :behavior camera-slave)) ;;
|
||||
(define-extern cam-los-collide (function vector vector collide-los-result pat-surface symbol :behavior camera-slave)) ;;
|
||||
(define-extern cam-string-follow (function object :behavior camera-slave)) ;;
|
||||
(define-extern cam-los-setup-lateral (function collide-los-result vector vector symbol :behavior camera-slave)) ;;
|
||||
(define-extern cam-los-collide (function vector vector collide-los-result pat-surface symbol :behavior camera-slave)) ;;
|
||||
(define-extern cam-string-follow (function object :behavior camera-slave)) ;;
|
||||
;; (define-extern cam-string-line-of-sight (function vector :behavior camera-slave)) ;; TODO - hang
|
||||
(define-extern cam-dist-analog-input (function int float float)) ;;
|
||||
(define-extern cam-string-joystick (function vector :behavior camera-slave)) ;;
|
||||
(define-extern cam-string-find-hidden (function none :behavior camera-slave)) ;;
|
||||
(define-extern cam-string-move (function object :behavior camera-slave)) ;;
|
||||
(define-extern cam-string-code (function vector :behavior camera-slave)) ;;
|
||||
(define-extern cam-dist-analog-input (function int float float)) ;;
|
||||
(define-extern cam-string-joystick (function vector :behavior camera-slave)) ;;
|
||||
(define-extern cam-string-find-hidden (function none :behavior camera-slave)) ;;
|
||||
(define-extern cam-string-move (function object :behavior camera-slave)) ;;
|
||||
(define-extern cam-string-code (function vector :behavior camera-slave)) ;;
|
||||
(define-extern set-string-params (function vector :behavior camera-slave))
|
||||
(define-extern *CAM_STICK-bank* cam-stick-bank) ;; cam-stick-bank
|
||||
;; (define-extern cam-stick-code (function none :behavior camera-slave)) ;; TODO - hang
|
||||
(define-extern *CAM_BIKE-bank* cam-bike-bank) ;; cam-bike-bank
|
||||
(define-extern cam-calc-bike-follow! (function cam-rotation-tracker vector symbol vector :behavior camera-slave)) ;;
|
||||
(define-extern cam-calc-bike-follow! (function cam-rotation-tracker vector symbol vector :behavior camera-slave)) ;;
|
||||
;; (define-extern cam-bike-code (function none :behavior camera-slave)) ;; TODO - hang
|
||||
|
||||
|
||||
@@ -25222,17 +25240,17 @@
|
||||
;; cam-update ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-extern plane-from-points (function (inline-array plane) vector vector vector int float)) ;;
|
||||
(define-extern set-point (function vector float float float float)) ;;
|
||||
(define-extern update-view-planes (function math-camera (inline-array plane) float matrix float)) ;;
|
||||
(define-extern *update-leaf-when-outside-bsp* symbol) ;;
|
||||
(define-extern update-visible (function math-camera symbol)) ;;
|
||||
(define-extern *save-camera-inv-rot* matrix) ;;
|
||||
(define-extern move-camera-from-pad (function math-camera math-camera)) ;;
|
||||
(define-extern plane-from-points (function (inline-array plane) vector vector vector int float)) ;;
|
||||
(define-extern set-point (function vector float float float float)) ;;
|
||||
(define-extern update-view-planes (function math-camera (inline-array plane) float matrix float)) ;;
|
||||
(define-extern *update-leaf-when-outside-bsp* symbol) ;;
|
||||
(define-extern update-visible (function math-camera symbol)) ;;
|
||||
(define-extern *save-camera-inv-rot* matrix) ;;
|
||||
(define-extern move-camera-from-pad (function math-camera math-camera)) ;;
|
||||
(define-extern external-cam-reset! (function none))
|
||||
(define-extern *start-timer* int) ;;
|
||||
(define-extern *timer-value* int) ;;
|
||||
(define-extern *start-pos* vector) ;;
|
||||
(define-extern *start-timer* int) ;;
|
||||
(define-extern *timer-value* int) ;;
|
||||
(define-extern *start-pos* vector) ;;
|
||||
(define-extern update-camera (function symbol)) ;;
|
||||
(define-extern move-level-by-name (function symbol float float float vector))
|
||||
|
||||
@@ -25601,40 +25619,40 @@
|
||||
(define-extern cam-slave-options->string (function cam-slave-options object string))
|
||||
(define-extern cam-index-options->string (function cam-index-options object string))
|
||||
(define-extern slave-los-state->string (function slave-los-state string))
|
||||
(define-extern cam-line-dma (function pointer)) ;;
|
||||
(define-extern camera-line2d (function vector4w vector4w pointer)) ;;
|
||||
(define-extern camera-plot-float-func (function float float float float (function float float) vector4w none)) ;;
|
||||
(define-extern camera-line-setup (function vector4w none)) ;;
|
||||
(define-extern camera-line-draw (function vector vector none)) ;;
|
||||
(define-extern cam-line-dma (function pointer)) ;;
|
||||
(define-extern camera-line2d (function vector4w vector4w pointer)) ;;
|
||||
(define-extern camera-plot-float-func (function float float float float (function float float) vector4w none)) ;;
|
||||
(define-extern camera-line-setup (function vector4w none)) ;;
|
||||
(define-extern camera-line-draw (function vector vector none)) ;;
|
||||
(define-extern camera-line (function vector vector vector4w none))
|
||||
(define-extern camera-line-rel (function vector vector vector4w none)) ;;
|
||||
(define-extern camera-line-rel (function vector vector vector4w none)) ;;
|
||||
(define-extern camera-line-rel-len (function vector vector float vector4w none))
|
||||
(define-extern camera-sphere (function vector float vector4w none)) ;;
|
||||
(define-extern camera-cross (function vector vector vector vector4w meters none)) ;;
|
||||
(define-extern camera-bounding-box-draw (function bounding-box basic rgba none)) ;;
|
||||
(define-extern camera-sphere (function vector float vector4w none)) ;;
|
||||
(define-extern camera-cross (function vector vector vector vector4w meters none)) ;;
|
||||
(define-extern camera-bounding-box-draw (function bounding-box basic rgba none)) ;;
|
||||
(define-extern *cam-debug-los-tri-current* int) ;; int
|
||||
(define-extern *cam-debug-los-tri* (inline-array cam-debug-tri)) ;;
|
||||
(define-extern *cam-debug-los-tri* (inline-array cam-debug-tri)) ;;
|
||||
(define-extern *cam-debug-coll-tri-current* int) ;; int
|
||||
(define-extern *cam-debug-coll-tri* (inline-array cam-debug-tri)) ;; (inline-array cam-debug-tri)
|
||||
(define-extern cam-debug-reset-coll-tri (function none)) ;;
|
||||
(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none)) ;;
|
||||
(define-extern cam-debug-add-coll-tri (function cam-debug-tri vector cam-debug-tri none)) ;;
|
||||
(define-extern cam-debug-draw-tris (function symbol)) ;;
|
||||
(define-extern camera-fov-draw (function int int vector float float vector4w none)) ;;
|
||||
(define-extern camera-fov-frame (function matrix vector float float float vector4w symbol)) ;;
|
||||
(define-extern debug-euler (function cam-dbg-scratch object)) ;;
|
||||
(define-extern bike-cam-limit (function float float)) ;;
|
||||
(define-extern cam-debug-reset-coll-tri (function none)) ;;
|
||||
(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none)) ;;
|
||||
(define-extern cam-debug-add-coll-tri (function cam-debug-tri vector cam-debug-tri none)) ;;
|
||||
(define-extern cam-debug-draw-tris (function symbol)) ;;
|
||||
(define-extern camera-fov-draw (function int int vector float float vector4w none)) ;;
|
||||
(define-extern camera-fov-frame (function matrix vector float float float vector4w symbol)) ;;
|
||||
(define-extern debug-euler (function cam-dbg-scratch object)) ;;
|
||||
(define-extern bike-cam-limit (function float float)) ;;
|
||||
(define-extern camera-slave-debug (function camera-slave none))
|
||||
(define-extern master-draw-coordinates (function vector none)) ;;
|
||||
(define-extern master-draw-coordinates (function vector none)) ;;
|
||||
(define-extern *cam-collision-record-first* int) ;; int
|
||||
(define-extern *cam-collision-record-last* int) ;; int
|
||||
(define-extern *cam-collision-record-show* int) ;; int
|
||||
(define-extern *cam-collision-record* cam-collision-record-array) ;;
|
||||
(define-extern cam-collision-record-save (function vector vector int symbol camera-slave none)) ;;
|
||||
(define-extern cam-collision-record-step (function int none)) ;;
|
||||
(define-extern cam-collision-record-draw (function none)) ;;
|
||||
(define-extern camera-master-debug (function camera-master none)) ;;
|
||||
(define-extern debug-set-camera-pos-rot! (function vector matrix vector)) ;;
|
||||
(define-extern *cam-collision-record* cam-collision-record-array) ;;
|
||||
(define-extern cam-collision-record-save (function vector vector int symbol camera-slave none)) ;;
|
||||
(define-extern cam-collision-record-step (function int none)) ;;
|
||||
(define-extern cam-collision-record-draw (function none)) ;;
|
||||
(define-extern camera-master-debug (function camera-master none)) ;;
|
||||
(define-extern debug-set-camera-pos-rot! (function vector matrix vector)) ;;
|
||||
(define-extern cam-restore (function none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -27447,7 +27465,7 @@
|
||||
;; (define-extern vis-cull-debug function)
|
||||
(define-extern error-sphere (function drawable-error string none))
|
||||
(define-extern *edit-instance* string)
|
||||
;; (define-extern *instance-mem-usage* object) ;; memory-usage-block
|
||||
(define-extern *instance-mem-usage* memory-usage-block)
|
||||
;; (define-extern find-instance-by-name-level function)
|
||||
(define-extern find-instance-by-name (function string prototype-bucket))
|
||||
;; (define-extern prototypes-game-visible-set! function)
|
||||
@@ -27460,26 +27478,26 @@
|
||||
;; (define-extern get-shadow-by-name function)
|
||||
;; (define-extern teleport-camera-by-name function)
|
||||
;; (define-extern dma-add-process-drawable function) ;; (function process-drawable draw-control symbol dma-buffer none)
|
||||
;; (define-extern *hud-lights* object) ;; vu-lights
|
||||
(define-extern *hud-lights* vu-lights)
|
||||
;; (define-extern dma-add-process-drawable-hud function) ;; (function process-drawable draw-control symbol dma-buffer none)
|
||||
;; (define-extern add-process-drawable function) ;; (function process-drawable draw-control symbol dma-buffer none)
|
||||
(define-extern foreground-engine-execute (function engine display-frame none))
|
||||
;; (define-extern main-debug-hook function) ;; (function none)
|
||||
;; (define-extern *debug-hook* object) ;; (function none)
|
||||
(define-extern *add-sphere* symbol)
|
||||
;; (define-extern *generic-effect-mode* object) ;; int
|
||||
(define-extern *generic-effect-mode* int)
|
||||
(define-extern foreground-initialize-engines (function none))
|
||||
(define-extern foreground-execute-cpu-vu0-engines (function none))
|
||||
(define-extern real-main-draw-hook (function none))
|
||||
(define-extern main-draw-hook (function none))
|
||||
(define-extern *draw-hook* (function none))
|
||||
;; (define-extern default-init-buffer function)
|
||||
;; (define-extern default-end-buffer function)
|
||||
(define-extern default-init-buffer (function bucket-id gs-zbuf gs-test none))
|
||||
(define-extern default-end-buffer (function bucket-id gs-zbuf gs-test none))
|
||||
;; (define-extern screen-shot-scale function)
|
||||
;; (define-extern screen-shot function)
|
||||
;; (define-extern display-frame-start function) ;; (function display int int none)
|
||||
(define-extern display-frame-start (function display int float none))
|
||||
(define-extern display-frame-finish (function display display))
|
||||
;; (define-extern determine-pause-mode function) ;; (function int)
|
||||
(define-extern determine-pause-mode (function int))
|
||||
(define-extern display-sync (function display none))
|
||||
(define-extern swap-display (function display none))
|
||||
|
||||
@@ -27521,7 +27539,7 @@
|
||||
;; (define-extern get-aspect-ratio function) ;; (function symbol)
|
||||
;; (define-extern set-progressive-scan function)
|
||||
;; (define-extern get-progressive-scan function)
|
||||
;; (define-extern *smode2* object)
|
||||
(define-extern *smode2* int)
|
||||
(define-extern set-graphics-mode (function none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -28685,7 +28703,7 @@
|
||||
;; (define-extern render-eyes-64 function)
|
||||
;; (define-extern render-eyes-64-different function)
|
||||
;; (define-extern debug-eyes function)
|
||||
;; (define-extern update-eyes function) ;; (function none)
|
||||
(define-extern update-eyes (function none))
|
||||
;; (define-extern get-eye-block function) ;; (function int int int)
|
||||
;; (define-extern convert-eye-data function) ;; (function eye uint float)
|
||||
;; (define-extern merc-eye-anim function) ;; (function process-drawable none)
|
||||
|
||||
@@ -223,7 +223,9 @@
|
||||
|
||||
"(method 12 perf-stat)": [0],
|
||||
"(method 11 perf-stat)": [0],
|
||||
"(method 22 gui-control)": [117, 121, 127, 128, 129, 139]
|
||||
"(method 22 gui-control)": [117, 121, 127, 128, 129, 139],
|
||||
"bsp-camera-asm": [1, 2, 3, 4, 6, 7],
|
||||
"level-remap-texture": [2, 3, 4, 5, 6]
|
||||
},
|
||||
|
||||
// Sometimes the game might use format strings that are fetched dynamically,
|
||||
@@ -236,7 +238,8 @@
|
||||
"mips2c_functions_by_name": [
|
||||
"collide-do-primitives",
|
||||
"moving-sphere-triangle-intersect",
|
||||
"calc-animation-from-spr"
|
||||
"calc-animation-from-spr",
|
||||
"draw-string-asm", "draw-string", "get-string-length"
|
||||
],
|
||||
|
||||
"mips2c_jump_table_functions": {},
|
||||
|
||||
@@ -302,6 +302,8 @@
|
||||
[32, "vector4w"]
|
||||
],
|
||||
"cam-debug-draw-tris": [[16, "vector4w"]],
|
||||
"draw-string-xy": [[16, "font-context"]],
|
||||
|
||||
"(code die gun)": [
|
||||
[16, "matrix"],
|
||||
[112, "vector"],
|
||||
|
||||
@@ -392,7 +392,9 @@
|
||||
"display-loop-main": [[223, "t9", "(function none)"]],
|
||||
"end-display": [
|
||||
[205, "f1", "float"],
|
||||
[205, "f0", "float"]
|
||||
[205, "f0", "float"],
|
||||
[[85, 90], "v1", "dma-packet"],
|
||||
[[235, 240], "v1", "dma-packet"]
|
||||
],
|
||||
"(method 18 res-lump)": [["_stack_", 16, "object"]],
|
||||
"(method 21 res-lump)": [
|
||||
@@ -1478,6 +1480,80 @@
|
||||
[14, "v1", "gui-connection"]
|
||||
],
|
||||
"(method 10 gui-control)": [[[4, 32], "s3", "gui-connection"]],
|
||||
// placeholder
|
||||
"placeholder-do-not-add-below": []
|
||||
|
||||
"(method 10 bsp-header)": [
|
||||
[49, "a3", "(pointer uint128)"]
|
||||
],
|
||||
|
||||
"bsp-camera-asm": [
|
||||
[26, "v1", "pointer"],
|
||||
[[26, 63], "t1", "bsp-node"],
|
||||
[43, "t3", "uint"]
|
||||
],
|
||||
|
||||
"ja-post": [
|
||||
[[42, 46], "a0", "collide-shape"]
|
||||
],
|
||||
|
||||
"display-frame-start": [
|
||||
[4, "v1", "vif-bank"],
|
||||
[9, "a0", "vif-bank"]
|
||||
],
|
||||
|
||||
"display-frame-finish": [
|
||||
[[178, 185], "a0", "dma-packet"],
|
||||
[[193, 194], "a0", "dma-packet"],
|
||||
[194, "a0", "(pointer int64)"]
|
||||
],
|
||||
|
||||
"default-end-buffer": [
|
||||
[9, "v1", "dma-bucket"],
|
||||
[[20, 28], "t1", "dma-packet"],
|
||||
[[30, 36], "t1", "gs-gif-tag"],
|
||||
[40, "t1", "(pointer gs-zbuf)"],
|
||||
[42, "t1", "(pointer gs-reg64)"],
|
||||
[43, "t1", "(pointer gs-test)"],
|
||||
[45, "t1", "(pointer gs-reg64)"],
|
||||
[47, "t1", "(pointer gs-alpha)"],
|
||||
[49, "t1", "(pointer gs-reg64)"],
|
||||
[50, "t1", "(pointer uint64)"],
|
||||
[52, "t1", "(pointer gs-reg64)"],
|
||||
[54, "t1", "(pointer gs-clamp)"],
|
||||
[56, "t1", "(pointer gs-reg64)"],
|
||||
[58, "t1", "(pointer gs-tex0)"],
|
||||
[60, "t1", "(pointer gs-reg64)"],
|
||||
[63, "t1", "(pointer gs-texa)"],
|
||||
[65, "t1", "(pointer gs-reg64)"],
|
||||
[67, "t1", "(pointer gs-texclut)"],
|
||||
[69, "t1", "(pointer gs-reg64)"],
|
||||
[71, "t1", "(pointer uint64)"],
|
||||
[73, "t1", "(pointer gs-reg64)"],
|
||||
[[79, 82], "a1", "dma-packet"],
|
||||
[85, "a1", "dma-bucket"]
|
||||
],
|
||||
|
||||
"default-init-buffer": [
|
||||
[[20, 28], "t1", "dma-packet"],
|
||||
[[30, 36], "t1", "gs-gif-tag"],
|
||||
[40, "t1", "(pointer gs-zbuf)"],
|
||||
[42, "t1", "(pointer gs-reg64)"],
|
||||
[43, "t1", "(pointer gs-test)"],
|
||||
[45, "t1", "(pointer gs-reg64)"],
|
||||
[47, "t1", "(pointer gs-alpha)"],
|
||||
[49, "t1", "(pointer gs-reg64)"],
|
||||
[50, "t1", "(pointer uint64)"],
|
||||
[52, "t1", "(pointer gs-reg64)"],
|
||||
[54, "t1", "(pointer gs-clamp)"],
|
||||
[56, "t1", "(pointer gs-reg64)"],
|
||||
[58, "t1", "(pointer gs-tex0)"],
|
||||
[60, "t1", "(pointer gs-reg64)"],
|
||||
[63, "t1", "(pointer gs-texa)"],
|
||||
[65, "t1", "(pointer gs-reg64)"],
|
||||
[67, "t1", "(pointer gs-texclut)"],
|
||||
[69, "t1", "(pointer gs-reg64)"],
|
||||
[71, "t1", "(pointer uint64)"],
|
||||
[73, "t1", "(pointer gs-reg64)"],
|
||||
[[82, 85], "a1", "dma-packet"]
|
||||
//[85, "a1", "dma-bucket"]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -7,16 +7,19 @@
|
||||
"v1-25": "resource-mem"
|
||||
}
|
||||
},
|
||||
|
||||
"(method 0 lightning-control)": {
|
||||
"vars": {
|
||||
"gp-0": ["obj", "lightning-control"]
|
||||
}
|
||||
},
|
||||
|
||||
"(method 0 align-control)": {
|
||||
"vars": {
|
||||
"v0-0": ["obj", "align-control"]
|
||||
}
|
||||
},
|
||||
|
||||
"(method 16 nav-mesh)": {
|
||||
"args": ["obj", "ray"],
|
||||
"vars": {
|
||||
@@ -217,12 +220,15 @@
|
||||
"v0-3": ["lightning-sound-id", "sound-id"]
|
||||
}
|
||||
},
|
||||
|
||||
"(method 10 mood-control)": {
|
||||
"args": ["obj", "cloud-target", "fog-target", "cloud-speed", "fog-speed"]
|
||||
},
|
||||
|
||||
"(method 11 mood-control)": {
|
||||
"args": ["obj", "min-cloud", "max-cloud", "min-fog", "max-fog"]
|
||||
},
|
||||
|
||||
"copy-mood-exterior": {
|
||||
"vars": {
|
||||
"a1-4": ["a1-4", "(inline-array vector)"],
|
||||
@@ -230,16 +236,19 @@
|
||||
"a0-2": ["a0-2", "(inline-array vector)"]
|
||||
}
|
||||
},
|
||||
|
||||
"update-mood-strip": {
|
||||
"vars": {
|
||||
"s4-1": ["s4-1", "(pointer float)"]
|
||||
}
|
||||
},
|
||||
|
||||
"update-mood-ruins": {
|
||||
"vars": {
|
||||
"gp-1": ["gp-1", "(pointer float)"]
|
||||
}
|
||||
},
|
||||
|
||||
"desaturate-mood-colors": {
|
||||
"vars": {
|
||||
"a0-8": ["mood-colors", "(inline-array mood-color)"]
|
||||
@@ -250,15 +259,19 @@
|
||||
"v1-2": "current-gun"
|
||||
}
|
||||
},
|
||||
|
||||
"(method 10 cylinder)": {
|
||||
"args": ["obj", "ray1", "ray2"]
|
||||
},
|
||||
|
||||
"ripple-make-request": {
|
||||
"args": ["waveform", "effect"]
|
||||
},
|
||||
|
||||
"command-get-entity": {
|
||||
"args": ["search", "fallback"]
|
||||
},
|
||||
|
||||
"(method 10 cam-setting-data)": {
|
||||
"vars": {
|
||||
"v1-5": ["v1-5", "handle"],
|
||||
@@ -269,11 +282,13 @@
|
||||
"v1-112": ["v1-112", "handle"]
|
||||
}
|
||||
},
|
||||
|
||||
"(method 17 setting-control)": {
|
||||
"vars": {
|
||||
"v1-84": ["v1-84", "task-mask"]
|
||||
}
|
||||
},
|
||||
|
||||
"(method 18 setting-control)": {
|
||||
"vars": {
|
||||
"a0-147": ["a0-147", "process-focusable"]
|
||||
@@ -297,5 +312,24 @@
|
||||
"gp-0": "bucket",
|
||||
"s4-0": "dma-buf"
|
||||
}
|
||||
},
|
||||
"display-sync": {
|
||||
"arg0":["disp"],
|
||||
"vars": {
|
||||
"s4-0" : "just-rendered-frame",
|
||||
"a1-1" : "current-time",
|
||||
"s5-0" : "just-rendered-frame-start-time",
|
||||
"a0-3" : "prev-vblank-time-1",
|
||||
"v1-6" : "prev-vblank-time-2",
|
||||
"f28-0": "ticks-per-frame-f",
|
||||
"f1-0" : "frame-duration",
|
||||
"f0-2" : "frame-time-ratio",
|
||||
"f26-0": "vysnc-progress",
|
||||
"f30-0": "last-dog",
|
||||
"f30-1": "next-dog",
|
||||
"s4-1": "frame-to-render",
|
||||
"v1-48": "time-after-vsync",
|
||||
"s5-1": "next-dma-buf"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ DirTpageResult process_dir_tpages(ObjectFileData& data) {
|
||||
word_idx++;
|
||||
}
|
||||
|
||||
word_idx = ((word_idx + 3) / 4) * 4;
|
||||
ASSERT(word_idx == (int)words.size());
|
||||
|
||||
return result;
|
||||
|
||||
@@ -75,7 +75,8 @@ namespace {
|
||||
*/
|
||||
|
||||
// texture format names.
|
||||
const std::unordered_map<u8, std::string> psms = {{0x02, "PSMCT16"},
|
||||
const std::unordered_map<u8, std::string> psms = {{0x00, "PSM32"},
|
||||
{0x02, "PSMCT16"},
|
||||
{0x13, "PSMT8"},
|
||||
{0x14, "PSMT4"}};
|
||||
|
||||
@@ -343,7 +344,16 @@ TexturePage read_texture_page(ObjectFileData& data,
|
||||
tpage.info_label = get_label(data, words.at(offset));
|
||||
tpage.info = read_file_info(data, words, label_to_word_offset(tpage.info_label, true));
|
||||
ASSERT(tpage.info.file_type == "texture-page");
|
||||
ASSERT(tpage.info.major_version == versions::jak1::TX_PAGE_VERSION);
|
||||
switch (data.linked_data.version) {
|
||||
case GameVersion::Jak1:
|
||||
ASSERT(tpage.info.major_version == versions::jak1::TX_PAGE_VERSION);
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
ASSERT(tpage.info.major_version == versions::jak2::TX_PAGE_VERSION);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
ASSERT(tpage.info.minor_version == 0);
|
||||
ASSERT(tpage.info.maya_file_name == "Unknown");
|
||||
ASSERT(tpage.info.mdb_file_name == 0);
|
||||
@@ -673,6 +683,31 @@ TPageResultStats process_tpage(ObjectFileData& data,
|
||||
}
|
||||
}
|
||||
|
||||
// write texture to a PNG.
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
|
||||
texture_page.name, level_names);
|
||||
stats.successful_textures++;
|
||||
} else if (tex.psm == int(PSM::PSMCT32) && tex.clutpsm == 0) {
|
||||
// not a clut.
|
||||
// will store output pixels, rgba (8888)
|
||||
std::vector<u32> out;
|
||||
|
||||
// width is like the TEX0 register, in 64 texel units.
|
||||
// not sure what the other widths are yet.
|
||||
int read_width = 64 * tex.width[0];
|
||||
|
||||
// loop over pixels in output texture image
|
||||
for (int y = 0; y < tex.h; y++) {
|
||||
for (int x = 0; x < tex.w; x++) {
|
||||
// read as the PSMT32 type. The dest field tells us a block offset.
|
||||
auto addr32 = psmct32_addr(x, y, read_width) + tex.dest[0] * 256;
|
||||
u32 value = *(u32*)(vram.data() + addr32);
|
||||
out.push_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
// write texture to a PNG.
|
||||
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
|
||||
tex.w, tex.h);
|
||||
|
||||
@@ -93,7 +93,8 @@ std::string FileInfo::print(int indent) const {
|
||||
|
||||
void DrawableTreeUnknown::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& /*dts*/,
|
||||
DrawStats* /*stats*/) {
|
||||
DrawStats* /*stats*/,
|
||||
GameVersion /*version*/) {
|
||||
type_name = ref.type->get_name();
|
||||
}
|
||||
|
||||
@@ -110,7 +111,8 @@ std::string DrawableTreeUnknown::my_type() const {
|
||||
|
||||
void DrawableInlineArrayUnknown::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& /*dts*/,
|
||||
DrawStats* /*stats*/) {
|
||||
DrawStats* /*stats*/,
|
||||
GameVersion /*version*/) {
|
||||
type_name = ref.type->get_name();
|
||||
}
|
||||
|
||||
@@ -127,26 +129,27 @@ std::string DrawableInlineArrayUnknown::my_type() const {
|
||||
|
||||
std::unique_ptr<Drawable> make_draw_node_child(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
if (ref.type->get_name() == "draw-node") {
|
||||
auto result = std::make_unique<DrawNode>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
} else if (ref.type->get_name() == "tfragment") {
|
||||
auto result = std::make_unique<TFragment>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
} else if (ref.type->get_name() == "instance-tie") {
|
||||
auto result = std::make_unique<InstanceTie>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
} else if (ref.type->get_name() == "drawable-actor") {
|
||||
auto result = std::make_unique<DrawableActor>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
} else if (ref.type->get_name() == "instance-shrubbery") {
|
||||
auto result = std::make_unique<shrub_types::InstanceShrubbery>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
} else {
|
||||
throw Error("Unknown child of draw node: {}\n", ref.type->get_name());
|
||||
@@ -314,7 +317,8 @@ std::vector<u8> read_dma_chain(Ref& start, u32 qwc) {
|
||||
|
||||
void TFragment::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
stats->total_tfragments++;
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
color_index = read_plain_data_field<s16>(ref, "color-index", dts);
|
||||
@@ -401,9 +405,13 @@ void TFragment::read_from_file(TypedRef ref,
|
||||
|
||||
ASSERT(num_colors / 4 == color_count);
|
||||
// fmt::print("colors: {} {} {}\n", num_base_colors, num_level0_colors, num_level1_colors);
|
||||
ASSERT(read_plain_data_field<u8>(ref, "pad0", dts) == 0);
|
||||
ASSERT(read_plain_data_field<u8>(ref, "pad1", dts) == 0);
|
||||
ASSERT(read_plain_data_field<u32>(ref, "generic-u32", dts) == 0);
|
||||
if (version == GameVersion::Jak1) {
|
||||
ASSERT(read_plain_data_field<u8>(ref, "pad0", dts) == 0);
|
||||
ASSERT(read_plain_data_field<u8>(ref, "pad1", dts) == 0);
|
||||
ASSERT(read_plain_data_field<u32>(ref, "generic-u32", dts) == 0);
|
||||
} else {
|
||||
lg::warn("Skipping padding check in TFragment");
|
||||
}
|
||||
}
|
||||
|
||||
std::string TFragment::print(const PrintSettings& settings, int indent) const {
|
||||
@@ -438,10 +446,24 @@ std::string TFragment::print(const PrintSettings& settings, int indent) const {
|
||||
|
||||
void TieFragment::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
num_tris = read_plain_data_field<u16>(ref, "num-tris", dts);
|
||||
num_dverts = read_plain_data_field<u16>(ref, "num-dverts", dts);
|
||||
switch (version) {
|
||||
case GameVersion::Jak1:
|
||||
num_tris = read_plain_data_field<u16>(ref, "num-tris", dts);
|
||||
num_dverts = read_plain_data_field<u16>(ref, "num-dverts", dts);
|
||||
break;
|
||||
case GameVersion::Jak2: {
|
||||
auto debug_data_ref = TypedRef(deref_label(get_field_ref(ref, "debug", dts)),
|
||||
dts.ts.lookup_type("tie-fragment-debug"));
|
||||
num_tris = read_plain_data_field<u16>(debug_data_ref, "num-tris", dts);
|
||||
num_dverts = read_plain_data_field<u16>(debug_data_ref, "num-dverts", dts);
|
||||
} break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
tex_count = read_plain_data_field<u16>(ref, "tex-count", dts);
|
||||
gif_count = read_plain_data_field<u16>(ref, "gif-count", dts);
|
||||
vertex_count = read_plain_data_field<u16>(ref, "vertex-count", dts);
|
||||
@@ -482,7 +504,8 @@ std::string TieFragment::print(const PrintSettings& /*settings*/, int indent) co
|
||||
|
||||
void DrawableActor::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion /*version*/) {
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
stats->total_actors++;
|
||||
}
|
||||
@@ -496,7 +519,8 @@ std::string DrawableActor::print(const PrintSettings& /*settings*/, int indent)
|
||||
|
||||
void InstanceTie::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion /*version*/) {
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
bucket_index = read_plain_data_field<u16>(ref, "bucket-index", dts);
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
@@ -518,7 +542,8 @@ std::string InstanceTie::print(const PrintSettings& /*settings*/, int indent) co
|
||||
|
||||
void DrawNode::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts); // 4
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts)); // 16
|
||||
child_count = read_plain_data_field<u8>(ref, "child-count", dts);
|
||||
@@ -530,7 +555,7 @@ void DrawNode::read_from_file(TypedRef ref,
|
||||
|
||||
for (int i = 0; i < child_count; i++) {
|
||||
children.push_back(
|
||||
make_draw_node_child(typed_ref_from_basic(first_child_obj, dts), dts, stats));
|
||||
make_draw_node_child(typed_ref_from_basic(first_child_obj, dts), dts, stats, version));
|
||||
first_child_obj.byte_offset += get_child_stride(get_type_of_basic(first_child_obj));
|
||||
}
|
||||
|
||||
@@ -562,7 +587,8 @@ std::string DrawNode::my_type() const {
|
||||
|
||||
void DrawableInlineArrayNode::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -576,7 +602,7 @@ void DrawableInlineArrayNode::read_from_file(TypedRef ref,
|
||||
throw Error("bad draw node type: {}", type);
|
||||
}
|
||||
draw_nodes.emplace_back();
|
||||
draw_nodes.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats);
|
||||
draw_nodes.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,7 +630,8 @@ std::string DrawableInlineArrayNode::my_type() const {
|
||||
|
||||
void DrawableInlineArrayTFrag::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -618,7 +645,7 @@ void DrawableInlineArrayTFrag::read_from_file(TypedRef ref,
|
||||
throw Error("bad draw node type: {}", type);
|
||||
}
|
||||
tfragments.emplace_back();
|
||||
tfragments.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats);
|
||||
tfragments.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +673,8 @@ std::string DrawableInlineArrayTFrag::my_type() const {
|
||||
|
||||
void DrawableInlineArrayInstanceTie::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -660,7 +688,7 @@ void DrawableInlineArrayInstanceTie::read_from_file(TypedRef ref,
|
||||
throw Error("bad draw node type: {}", type);
|
||||
}
|
||||
instances.emplace_back();
|
||||
instances.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats);
|
||||
instances.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,7 +720,8 @@ std::string PrototypeTie::my_type() const {
|
||||
|
||||
void PrototypeTie::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -706,7 +735,7 @@ void PrototypeTie::read_from_file(TypedRef ref,
|
||||
throw Error("bad draw node type: {}", type);
|
||||
}
|
||||
tie_fragments.emplace_back();
|
||||
tie_fragments.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats);
|
||||
tie_fragments.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,45 +760,47 @@ std::string PrototypeTie::print(const PrintSettings& settings, int indent) const
|
||||
std::unique_ptr<DrawableInlineArray> make_drawable_inline_array(
|
||||
TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
if (ref.type->get_name() == "drawable-inline-array-node") {
|
||||
auto result = std::make_unique<DrawableInlineArrayNode>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-inline-array-tfrag") {
|
||||
auto result = std::make_unique<DrawableInlineArrayTFrag>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-inline-array-trans-tfrag") {
|
||||
auto result = std::make_unique<DrawableInlineArrayTransTFrag>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-inline-array-instance-tie") {
|
||||
auto result = std::make_unique<DrawableInlineArrayInstanceTie>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-inline-array-instance-shrub") {
|
||||
auto result = std::make_unique<shrub_types::DrawableInlineArrayInstanceShrub>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
}
|
||||
|
||||
auto result = std::make_unique<DrawableInlineArrayUnknown>();
|
||||
result->read_from_file(ref, dts, stats);
|
||||
result->read_from_file(ref, dts, stats, version);
|
||||
return result;
|
||||
}
|
||||
|
||||
void DrawableTreeTfrag::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -797,7 +828,8 @@ void DrawableTreeTfrag::read_from_file(TypedRef ref,
|
||||
Ref object_ref = deref_label(array_slot_ref);
|
||||
object_ref.byte_offset -= 4;
|
||||
|
||||
arrays.push_back(make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats));
|
||||
arrays.push_back(
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats, version));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -830,7 +862,8 @@ std::string DrawableTreeTfrag::my_type() const {
|
||||
|
||||
void DrawableTreeActor::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -847,7 +880,8 @@ void DrawableTreeActor::read_from_file(TypedRef ref,
|
||||
Ref object_ref = deref_label(array_slot_ref);
|
||||
object_ref.byte_offset -= 4;
|
||||
|
||||
arrays.push_back(make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats));
|
||||
arrays.push_back(
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats, version));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -876,23 +910,39 @@ std::string DrawableTreeActor::my_type() const {
|
||||
|
||||
void PrototypeBucketTie::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
name = read_string_field(ref, "name", dts, true);
|
||||
flags = read_plain_data_field<u32>(ref, "flags", dts);
|
||||
ASSERT(flags == 0 || flags == 2);
|
||||
switch (version) {
|
||||
case GameVersion::Jak1:
|
||||
flags = read_plain_data_field<u32>(ref, "flags", dts);
|
||||
ASSERT(flags == 0 || flags == 2);
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
flags = read_plain_data_field<u16>(ref, "flags", dts);
|
||||
fmt::print("flag: {}\n", flags);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
in_level = read_plain_data_field<u16>(ref, "in-level", dts);
|
||||
utextures = read_plain_data_field<u16>(ref, "utextures", dts);
|
||||
dists.read_from_file(get_field_ref(ref, "dists", dts));
|
||||
rdists.read_from_file(get_field_ref(ref, "rdists", dts));
|
||||
stiffness = read_plain_data_field<float>(ref, "stiffness", dts);
|
||||
auto fr = get_field_ref(ref, "collide-frag", dts);
|
||||
{
|
||||
const auto& word = fr.data->words_by_seg.at(fr.seg).at(fr.byte_offset / 4);
|
||||
if (word.kind() == decompiler::LinkedWord::PTR) {
|
||||
auto p = deref_label(fr);
|
||||
p.byte_offset -= 4;
|
||||
collide_frag.read_from_file(typed_ref_from_basic(p, dts), dts, stats);
|
||||
|
||||
if (version == GameVersion::Jak1) {
|
||||
auto fr = get_field_ref(ref, "collide-frag", dts);
|
||||
{
|
||||
const auto& word = fr.data->words_by_seg.at(fr.seg).at(fr.byte_offset / 4);
|
||||
if (word.kind() == decompiler::LinkedWord::PTR) {
|
||||
auto p = deref_label(fr);
|
||||
p.byte_offset -= 4;
|
||||
collide_frag.read_from_file(typed_ref_from_basic(p, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lg::warn("Skipping prototype-bucket-tie collision");
|
||||
}
|
||||
|
||||
auto next_slot = get_field_ref(ref, "next", dts);
|
||||
@@ -913,9 +963,9 @@ void PrototypeBucketTie::read_from_file(TypedRef ref,
|
||||
memcpy(count + 2 * i, &word.data, 4);
|
||||
}
|
||||
|
||||
auto block_slot = get_field_ref(ref, "generic-count", dts);
|
||||
u8* block_start = (u8*)generic_count;
|
||||
for (int i = 0; i < 12; i++) {
|
||||
auto block_slot = get_field_ref(ref, "frag-count", dts);
|
||||
u8* block_start = (u8*)frag_count;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
auto& word = ref.ref.data->words_by_seg.at(block_slot.seg).at(i + (block_slot.byte_offset / 4));
|
||||
if (word.kind() != decompiler::LinkedWord::PLAIN_DATA) {
|
||||
throw Error("bad word type in PrototypeBucketTie slot");
|
||||
@@ -931,7 +981,7 @@ void PrototypeBucketTie::read_from_file(TypedRef ref,
|
||||
if (get_type_of_basic(geom) != "prototype-tie") {
|
||||
throw Error("bad type in prototype-bucket-tie: {}", get_type_of_basic(geom));
|
||||
}
|
||||
geometry[i].read_from_file(typed_ref_from_basic(geom, dts), dts, stats);
|
||||
geometry[i].read_from_file(typed_ref_from_basic(geom, dts), dts, stats, version);
|
||||
geom_start.byte_offset += 4;
|
||||
}
|
||||
|
||||
@@ -941,12 +991,12 @@ void PrototypeBucketTie::read_from_file(TypedRef ref,
|
||||
for (auto x : count) {
|
||||
ASSERT(x == 0);
|
||||
}
|
||||
for (auto x : generic_count) {
|
||||
ASSERT(x == 0);
|
||||
}
|
||||
for (auto x : generic_next) {
|
||||
ASSERT(x == 0);
|
||||
}
|
||||
// for (auto x : generic_count) {
|
||||
// ASSERT(x == 0);
|
||||
// }
|
||||
// for (auto x : generic_next) {
|
||||
// ASSERT(x == 0);
|
||||
// }
|
||||
|
||||
// get the color count data
|
||||
{
|
||||
@@ -954,7 +1004,6 @@ void PrototypeBucketTie::read_from_file(TypedRef ref,
|
||||
for (int i = 0; i < 4; i++) {
|
||||
u32 start = index_start[i];
|
||||
u32 end = start + frag_count[i];
|
||||
// fmt::print("i = {}: {} -> {}\n", i, start, end);
|
||||
ASSERT(num_color_qwcs <= end);
|
||||
num_color_qwcs = std::max(end, num_color_qwcs);
|
||||
}
|
||||
@@ -1018,7 +1067,8 @@ std::string PrototypeBucketTie::print(const PrintSettings& settings, int indent)
|
||||
|
||||
void PrototypeArrayTie::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
length = read_plain_data_field<u32>(ref, "length", dts);
|
||||
allocated_length = read_plain_data_field<u32>(ref, "allocated-length", dts);
|
||||
content_type = read_type_field(ref, "content-type", dts, true);
|
||||
@@ -1034,7 +1084,7 @@ void PrototypeArrayTie::read_from_file(TypedRef ref,
|
||||
throw Error("bad type in PrototypeArrayTie data: {}\n", type);
|
||||
}
|
||||
data.emplace_back();
|
||||
data.back().read_from_file(typed_ref_from_basic(thing, dts), dts, stats);
|
||||
data.back().read_from_file(typed_ref_from_basic(thing, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1055,10 +1105,11 @@ std::string PrototypeArrayTie::print(const PrintSettings& settings, int indent)
|
||||
|
||||
void ProxyPrototypeArrayTie::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
prototype_array_tie.read_from_file(
|
||||
get_and_check_ref_to_basic(ref, "prototype-array-tie", "prototype-array-tie", dts), dts,
|
||||
stats);
|
||||
stats, version);
|
||||
wind_vectors = deref_label(get_field_ref(ref, "wind-vectors", dts));
|
||||
}
|
||||
|
||||
@@ -1069,7 +1120,8 @@ std::string ProxyPrototypeArrayTie::print(const PrintSettings& settings, int ind
|
||||
|
||||
void DrawableTreeInstanceTie::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -1077,7 +1129,7 @@ void DrawableTreeInstanceTie::read_from_file(TypedRef ref,
|
||||
auto pt = deref_label(get_field_ref(ref, "prototypes", dts));
|
||||
pt.byte_offset -= 4;
|
||||
|
||||
prototypes.read_from_file(typed_ref_from_basic(pt, dts), dts, stats);
|
||||
prototypes.read_from_file(typed_ref_from_basic(pt, dts), dts, stats, version);
|
||||
|
||||
auto data_ref = get_field_ref(ref, "data", dts);
|
||||
if ((data_ref.byte_offset % 4) != 0) {
|
||||
@@ -1090,7 +1142,8 @@ void DrawableTreeInstanceTie::read_from_file(TypedRef ref,
|
||||
Ref object_ref = deref_label(array_slot_ref);
|
||||
object_ref.byte_offset -= 4;
|
||||
|
||||
arrays.push_back(make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats));
|
||||
arrays.push_back(
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats, version));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1126,7 +1179,8 @@ std::string DrawableTreeInstanceTie::my_type() const {
|
||||
|
||||
void DrawableTreeCollideFragment::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
s16 length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
auto data_ref = get_field_ref(ref, "data", dts);
|
||||
if ((data_ref.byte_offset % 4) != 0) {
|
||||
@@ -1138,7 +1192,7 @@ void DrawableTreeCollideFragment::read_from_file(TypedRef ref,
|
||||
|
||||
Ref object_ref = deref_label(array_slot_ref);
|
||||
object_ref.byte_offset -= 4;
|
||||
last_array.read_from_file(typed_ref_from_basic(object_ref, dts), dts, stats);
|
||||
last_array.read_from_file(typed_ref_from_basic(object_ref, dts), dts, stats, version);
|
||||
}
|
||||
|
||||
std::string DrawableTreeCollideFragment::print(const PrintSettings& settings, int indent) const {
|
||||
@@ -1151,7 +1205,8 @@ std::string DrawableTreeCollideFragment::my_type() const {
|
||||
|
||||
void DrawableInlineArrayCollideFragment::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion /*version*/) {
|
||||
ASSERT(ref.type->get_name() == "drawable-inline-array-collide-fragment");
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
@@ -1246,7 +1301,8 @@ namespace shrub_types {
|
||||
|
||||
void DrawableTreeInstanceShrub::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) {
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) {
|
||||
// the usual drawable stuff
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
@@ -1266,7 +1322,8 @@ void DrawableTreeInstanceShrub::read_from_file(TypedRef ref,
|
||||
Ref object_ref = deref_label(array_slot_ref);
|
||||
object_ref.byte_offset -= 4;
|
||||
|
||||
arrays.push_back(make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats));
|
||||
arrays.push_back(
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats, version));
|
||||
}
|
||||
// confirm that we have the weird shrub pattern and only found one array.
|
||||
ASSERT(length == 1);
|
||||
@@ -1280,7 +1337,7 @@ void DrawableTreeInstanceShrub::read_from_file(TypedRef ref,
|
||||
Ref object_ref = deref_label(data_ref);
|
||||
object_ref.byte_offset -= 4;
|
||||
discovered_arrays.push_back(
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats));
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats, version));
|
||||
|
||||
bool done = false;
|
||||
object_ref.byte_offset += 16;
|
||||
@@ -1289,13 +1346,16 @@ void DrawableTreeInstanceShrub::read_from_file(TypedRef ref,
|
||||
if (word.kind() == decompiler::LinkedWord::TYPE_PTR) {
|
||||
if (word.symbol_name() == "drawable-inline-array-node") {
|
||||
discovered_arrays.push_back(
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats));
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats, version));
|
||||
} else if (word.symbol_name() == "drawable-inline-array-instance-shrub") {
|
||||
discovered_arrays.push_back(
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats));
|
||||
} else if (word.symbol_name() == "time-of-day-palette") {
|
||||
make_drawable_inline_array(typed_ref_from_basic(object_ref, dts), dts, stats, version));
|
||||
} else if (word.symbol_name() == "time-of-day-palette" ||
|
||||
word.symbol_name() == "light-hash" ||
|
||||
word.symbol_name() == "collide-hash-fragment") {
|
||||
done = true;
|
||||
} else {
|
||||
fmt::print("unknown next thing: {}\n", word.symbol_name());
|
||||
ASSERT(word.symbol_name() == "draw-node" || word.symbol_name() == "instance-shrubbery");
|
||||
}
|
||||
}
|
||||
@@ -1305,7 +1365,7 @@ void DrawableTreeInstanceShrub::read_from_file(TypedRef ref,
|
||||
// this "info" thing holds all the prototypes
|
||||
auto pt = deref_label(get_field_ref(ref, "info", dts));
|
||||
pt.byte_offset -= 4;
|
||||
info.read_from_file(typed_ref_from_basic(pt, dts), dts, stats);
|
||||
info.read_from_file(typed_ref_from_basic(pt, dts), dts, stats, version);
|
||||
|
||||
// time of day palette. we'll want these colors in the FR3 file.
|
||||
auto palette = deref_label(get_field_ref(ref, "colors-added", dts));
|
||||
@@ -1350,7 +1410,8 @@ std::string DrawableTreeInstanceShrub::print(const level_tools::PrintSettings& s
|
||||
|
||||
void InstanceShrubbery::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* /*stats*/) {
|
||||
level_tools::DrawStats* /*stats*/,
|
||||
GameVersion /*version*/) {
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
bucket_index = read_plain_data_field<u16>(ref, "bucket-index", dts);
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
@@ -1374,7 +1435,8 @@ std::string InstanceShrubbery::print(const level_tools::PrintSettings& /*setting
|
||||
|
||||
void DrawableInlineArrayInstanceShrub::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -1388,7 +1450,7 @@ void DrawableInlineArrayInstanceShrub::read_from_file(TypedRef ref,
|
||||
throw Error("bad draw node type: {}", type);
|
||||
}
|
||||
instances.emplace_back();
|
||||
instances.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats);
|
||||
instances.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1413,11 +1475,12 @@ std::string DrawableInlineArrayInstanceShrub::print(const PrintSettings& setting
|
||||
|
||||
void PrototypeArrayShrubInfo::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) {
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) {
|
||||
prototype_inline_array_shrub.read_from_file(
|
||||
get_and_check_ref_to_basic(ref, "prototype-inline-array-shrub",
|
||||
"prototype-inline-array-shrub", dts),
|
||||
dts, stats);
|
||||
dts, stats, version);
|
||||
wind_vectors = deref_label(get_field_ref(ref, "wind-vectors", dts));
|
||||
}
|
||||
|
||||
@@ -1428,7 +1491,8 @@ std::string PrototypeArrayShrubInfo::print(const level_tools::PrintSettings& set
|
||||
|
||||
void PrototypeInlineArrayShrub::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) {
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) {
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
auto data_ref = get_field_ref(ref, "data", dts);
|
||||
|
||||
@@ -1441,7 +1505,7 @@ void PrototypeInlineArrayShrub::read_from_file(TypedRef ref,
|
||||
throw Error("bad type in PrototypeInlineArrayShrub data: {}\n", type);
|
||||
}
|
||||
data.emplace_back();
|
||||
data.back().read_from_file(typed_ref_from_basic(thing, dts), dts, stats);
|
||||
data.back().read_from_file(typed_ref_from_basic(thing, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1461,7 +1525,8 @@ std::string PrototypeGenericShrub::print(const level_tools::PrintSettings& setti
|
||||
|
||||
void PrototypeGenericShrub::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) {
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) {
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
auto data_ref = get_field_ref(ref, "data", dts);
|
||||
@@ -1476,7 +1541,7 @@ void PrototypeGenericShrub::read_from_file(TypedRef ref,
|
||||
throw Error("bad type in PrototypeGenericShrub data: {}\n", type);
|
||||
}
|
||||
shrubs.emplace_back();
|
||||
shrubs.back().read_from_file(typed_ref_from_basic(thing, dts), dts, stats);
|
||||
shrubs.back().read_from_file(typed_ref_from_basic(thing, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1496,14 +1561,24 @@ std::string PrototypeInlineArrayShrub::print(const level_tools::PrintSettings& s
|
||||
|
||||
void PrototypeBucketShrub::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) {
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) {
|
||||
name = read_string_field(ref, "name", dts, true);
|
||||
flags = read_plain_data_field<u32>(ref, "flags", dts);
|
||||
switch (version) {
|
||||
case GameVersion::Jak1:
|
||||
flags = read_plain_data_field<u32>(ref, "flags", dts);
|
||||
ASSERT(flags == 0 || flags == 2);
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
flags = read_plain_data_field<u16>(ref, "flags", dts);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
if (flags) {
|
||||
// lid in misty has flag 2, not sure what it means yet.
|
||||
fmt::print("proto: {} flags: {}\n", name, flags);
|
||||
}
|
||||
ASSERT(flags == 0 || flags == 2);
|
||||
in_level = read_plain_data_field<u16>(ref, "in-level", dts);
|
||||
utextures = read_plain_data_field<u16>(ref, "utextures", dts);
|
||||
dists.read_from_file(get_field_ref(ref, "dists", dts));
|
||||
@@ -1530,10 +1605,10 @@ void PrototypeBucketShrub::read_from_file(TypedRef ref,
|
||||
if (get_type_of_basic(normal_geom) != "prototype-shrubbery") {
|
||||
throw Error("bad normal shrub type: {}", get_type_of_basic(normal_geom));
|
||||
}
|
||||
shrubbery_geom.read_from_file(typed_ref_from_basic(normal_geom, dts), dts, stats);
|
||||
shrubbery_geom.read_from_file(typed_ref_from_basic(normal_geom, dts), dts, stats, version);
|
||||
geom_start.byte_offset += 4;
|
||||
|
||||
generic_geom.read_from_file(typed_ref_from_basic(generic_geom_l, dts), dts, stats);
|
||||
generic_geom.read_from_file(typed_ref_from_basic(generic_geom_l, dts), dts, stats, version);
|
||||
|
||||
// todo transparent version
|
||||
// todo billboard version.
|
||||
@@ -1557,7 +1632,8 @@ std::string PrototypeBucketShrub::print(const level_tools::PrintSettings& settin
|
||||
|
||||
void PrototypeShrubbery::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) {
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
@@ -1571,7 +1647,7 @@ void PrototypeShrubbery::read_from_file(TypedRef ref,
|
||||
throw Error("bad draw node type: {}", type);
|
||||
}
|
||||
shrubs.emplace_back();
|
||||
shrubs.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats);
|
||||
shrubs.back().read_from_file(typed_ref_from_basic(obj_ref, dts), dts, stats, version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1602,7 +1678,8 @@ void copy_dma_to_vector(std::vector<u8>* out, Ref data_start, int qwc) {
|
||||
|
||||
void Shrubbery::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* /*stats*/) {
|
||||
level_tools::DrawStats* /*stats*/,
|
||||
GameVersion /*version*/) {
|
||||
// read the easy ones.
|
||||
obj_qwc = read_plain_data_field<u8>(ref, "obj-qwc", dts);
|
||||
vtx_qwc = read_plain_data_field<u8>(ref, "vtx-qwc", dts);
|
||||
@@ -1640,7 +1717,8 @@ std::string GenericShrubFragment::print(const level_tools::PrintSettings& /*sett
|
||||
|
||||
void GenericShrubFragment::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* /*stats*/) {
|
||||
level_tools::DrawStats* /*stats*/,
|
||||
GameVersion /*version*/) {
|
||||
cnt_qwc = read_plain_data_field<u8>(ref, "cnt-qwc", dts);
|
||||
vtx_qwc = read_plain_data_field<u8>(ref, "vtx-qwc", dts);
|
||||
col_qwc = read_plain_data_field<u8>(ref, "col-qwc", dts);
|
||||
@@ -1657,69 +1735,71 @@ void GenericShrubFragment::read_from_file(TypedRef ref,
|
||||
|
||||
std::unique_ptr<DrawableTree> make_drawable_tree(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
if (ref.type->get_name() == "drawable-tree-tfrag") {
|
||||
auto tree = std::make_unique<DrawableTreeTfrag>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-tree-trans-tfrag") {
|
||||
auto tree = std::make_unique<DrawableTreeTransTfrag>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-tree-lowres-tfrag") {
|
||||
auto tree = std::make_unique<DrawableTreeLowresTfrag>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-tree-dirt-tfrag") {
|
||||
auto tree = std::make_unique<DrawableTreeDirtTfrag>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-tree-ice-tfrag") {
|
||||
auto tree = std::make_unique<DrawableTreeIceTfrag>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-tree-instance-tie") {
|
||||
auto tree = std::make_unique<DrawableTreeInstanceTie>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-tree-actor") {
|
||||
auto tree = std::make_unique<DrawableTreeActor>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-tree-instance-shrub") {
|
||||
auto tree = std::make_unique<shrub_types::DrawableTreeInstanceShrub>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
if (ref.type->get_name() == "drawable-tree-collide-fragment") {
|
||||
auto tree = std::make_unique<DrawableTreeCollideFragment>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
auto tree = std::make_unique<DrawableTreeUnknown>();
|
||||
tree->read_from_file(ref, dts, stats);
|
||||
tree->read_from_file(ref, dts, stats, version);
|
||||
return tree;
|
||||
}
|
||||
|
||||
void DrawableTreeArray::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
id = read_plain_data_field<s16>(ref, "id", dts);
|
||||
length = read_plain_data_field<s16>(ref, "length", dts);
|
||||
|
||||
@@ -1735,7 +1815,7 @@ void DrawableTreeArray::read_from_file(TypedRef ref,
|
||||
Ref object_ref = deref_label(array_slot_ref);
|
||||
object_ref.byte_offset -= 4;
|
||||
|
||||
trees.push_back(make_drawable_tree(typed_ref_from_basic(object_ref, dts), dts, stats));
|
||||
trees.push_back(make_drawable_tree(typed_ref_from_basic(object_ref, dts), dts, stats, version));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1756,7 +1836,8 @@ std::string DrawableTreeArray::print(const PrintSettings& settings, int indent)
|
||||
|
||||
void BspHeader::read_from_file(const decompiler::LinkedObjectFile& file,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) {
|
||||
DrawStats* stats,
|
||||
GameVersion version) {
|
||||
TypedRef ref;
|
||||
ref.ref.byte_offset = 0;
|
||||
ref.ref.seg = 0;
|
||||
@@ -1766,10 +1847,20 @@ void BspHeader::read_from_file(const decompiler::LinkedObjectFile& file,
|
||||
file_info.read_from_file(get_and_check_ref_to_basic(ref, "info", "file-info", dts), dts);
|
||||
bsphere.read_from_file(get_field_ref(ref, "bsphere", dts));
|
||||
|
||||
visible_list_length = read_plain_data_field<s32>(ref, "visible-list-length", dts);
|
||||
switch (version) {
|
||||
case GameVersion::Jak1:
|
||||
visible_list_length = read_plain_data_field<s32>(ref, "visible-list-length", dts);
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
visible_list_length = read_plain_data_field<s16>(ref, "visible-list-length", dts);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
drawable_tree_array.read_from_file(
|
||||
get_and_check_ref_to_basic(ref, "drawable-trees", "drawable-tree-array", dts), dts, stats);
|
||||
get_and_check_ref_to_basic(ref, "drawable-trees", "drawable-tree-array", dts), dts, stats,
|
||||
version);
|
||||
|
||||
texture_remap_table.clear();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/versions.h"
|
||||
|
||||
#include "decompiler/level_extractor/common_formats.h"
|
||||
#include "decompiler/util/goal_data_reader.h"
|
||||
@@ -85,7 +86,8 @@ struct TimeOfDayPalette {
|
||||
struct Drawable {
|
||||
virtual void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) = 0;
|
||||
DrawStats* stats,
|
||||
GameVersion version) = 0;
|
||||
virtual std::string print(const PrintSettings& settings, int indent) const = 0;
|
||||
virtual std::string my_type() const = 0;
|
||||
virtual ~Drawable() = default;
|
||||
@@ -97,7 +99,8 @@ struct Drawable {
|
||||
struct DrawNode : public Drawable {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
|
||||
@@ -122,7 +125,8 @@ struct DrawableInlineArrayNode : public DrawableInlineArray {
|
||||
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
};
|
||||
@@ -135,7 +139,8 @@ struct DrawableTree : public Drawable {};
|
||||
struct DrawableTreeUnknown : public DrawableTree {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
std::string type_name;
|
||||
@@ -144,7 +149,8 @@ struct DrawableTreeUnknown : public DrawableTree {
|
||||
struct DrawableInlineArrayUnknown : public DrawableInlineArray {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
std::string type_name;
|
||||
@@ -166,7 +172,8 @@ struct DrawableActor : public Drawable {
|
||||
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "drawable-actor"; }
|
||||
};
|
||||
@@ -174,7 +181,8 @@ struct DrawableActor : public Drawable {
|
||||
struct DrawableTreeActor : public DrawableTree {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
|
||||
@@ -229,7 +237,8 @@ struct CollideFragment {
|
||||
struct DrawableInlineArrayCollideFragment : public DrawableInlineArray {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
std::vector<CollideFragment> collide_fragments;
|
||||
@@ -241,7 +250,8 @@ struct DrawableInlineArrayCollideFragment : public DrawableInlineArray {
|
||||
struct DrawableTreeCollideFragment : public DrawableTree {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
|
||||
@@ -265,7 +275,8 @@ struct TFragmentDebugData {
|
||||
struct TFragment : public Drawable {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "tfragment"; }
|
||||
|
||||
@@ -306,7 +317,8 @@ struct DrawableInlineArrayTFrag : public DrawableInlineArray {
|
||||
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
};
|
||||
@@ -316,7 +328,8 @@ struct DrawableInlineArrayTFrag : public DrawableInlineArray {
|
||||
struct DrawableTreeTfrag : public DrawableTree {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
|
||||
@@ -360,7 +373,8 @@ struct DrawableInlineArrayTransTFrag : public DrawableInlineArrayTFrag {
|
||||
struct TieFragment : public Drawable {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "tie-fragment"; }
|
||||
|
||||
@@ -386,7 +400,8 @@ struct TieFragment : public Drawable {
|
||||
struct InstanceTie : public Drawable {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "instance-tie"; }
|
||||
|
||||
@@ -407,7 +422,8 @@ struct InstanceTie : public Drawable {
|
||||
struct PrototypeTie : public DrawableInlineArray {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
s16 id;
|
||||
@@ -432,8 +448,8 @@ struct PrototypeBucketTie {
|
||||
u32 next[4];
|
||||
u16 count[4];
|
||||
|
||||
u16 generic_count[4];
|
||||
u32 generic_next[4];
|
||||
// u16 generic_count[4];
|
||||
// u32 generic_next[4];
|
||||
u8 frag_count[4] = {0};
|
||||
u8 index_start[4];
|
||||
u16 base_qw[4];
|
||||
@@ -453,7 +469,10 @@ struct PrototypeBucketTie {
|
||||
// todo tie-colors
|
||||
// todo data
|
||||
|
||||
void read_from_file(TypedRef ref, const decompiler::DecompilerTypeSystem& dts, DrawStats* stats);
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats,
|
||||
GameVersion version);
|
||||
std::string print(const PrintSettings& settings, int indent) const;
|
||||
};
|
||||
|
||||
@@ -465,14 +484,20 @@ struct PrototypeArrayTie {
|
||||
std::string content_type;
|
||||
std::vector<PrototypeBucketTie> data;
|
||||
|
||||
void read_from_file(TypedRef ref, const decompiler::DecompilerTypeSystem& dts, DrawStats* stats);
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats,
|
||||
GameVersion version);
|
||||
std::string print(const PrintSettings& settings, int indent) const;
|
||||
};
|
||||
|
||||
// the reason for this type is somewhat unknown, but it just contains the prototype array and
|
||||
// wind vectors. The wind vector data is all 0's and is updated as the game runs.
|
||||
struct ProxyPrototypeArrayTie {
|
||||
void read_from_file(TypedRef ref, const decompiler::DecompilerTypeSystem& dts, DrawStats* stats);
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats,
|
||||
GameVersion version);
|
||||
std::string print(const PrintSettings& settings, int indent) const;
|
||||
|
||||
PrototypeArrayTie prototype_array_tie;
|
||||
@@ -489,7 +514,8 @@ struct DrawableInlineArrayInstanceTie : public DrawableInlineArray {
|
||||
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
};
|
||||
@@ -498,7 +524,8 @@ struct DrawableInlineArrayInstanceTie : public DrawableInlineArray {
|
||||
struct DrawableTreeInstanceTie : public DrawableTree {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats) override;
|
||||
DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
|
||||
@@ -519,7 +546,8 @@ namespace shrub_types {
|
||||
struct Shrubbery : public level_tools::Drawable {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) override;
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "shrubbery"; }
|
||||
|
||||
@@ -541,7 +569,8 @@ struct Shrubbery : public level_tools::Drawable {
|
||||
struct PrototypeShrubbery : public level_tools::DrawableInlineArray {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) override;
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "prototype-shrubbery"; }
|
||||
s16 id; // 0
|
||||
@@ -556,7 +585,8 @@ struct Billboard {};
|
||||
struct GenericShrubFragment : public level_tools::Drawable {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) override;
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "generic-shrub-fragment"; }
|
||||
|
||||
@@ -587,7 +617,8 @@ struct GenericShrubFragment : public level_tools::Drawable {
|
||||
struct PrototypeGenericShrub : public level_tools::Drawable {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) override;
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "prototype-generic-shrub"; }
|
||||
s16 length; // 4
|
||||
@@ -625,7 +656,8 @@ struct PrototypeBucketShrub {
|
||||
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats);
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version);
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const;
|
||||
};
|
||||
|
||||
@@ -637,14 +669,16 @@ struct PrototypeInlineArrayShrub {
|
||||
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats);
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version);
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const;
|
||||
};
|
||||
|
||||
struct PrototypeArrayShrubInfo {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats);
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version);
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const;
|
||||
|
||||
PrototypeInlineArrayShrub prototype_inline_array_shrub;
|
||||
@@ -654,7 +688,8 @@ struct PrototypeArrayShrubInfo {
|
||||
struct InstanceShrubbery : public level_tools::Drawable {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) override;
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "instance-shrubbery"; }
|
||||
|
||||
@@ -678,7 +713,8 @@ struct DrawableInlineArrayInstanceShrub : public level_tools::DrawableInlineArra
|
||||
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) override;
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override { return "drawable-inline-array-instance-shrub"; }
|
||||
};
|
||||
@@ -686,7 +722,8 @@ struct DrawableInlineArrayInstanceShrub : public level_tools::DrawableInlineArra
|
||||
struct DrawableTreeInstanceShrub : public level_tools::DrawableTree {
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats) override;
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) override;
|
||||
std::string print(const level_tools::PrintSettings& settings, int indent) const override;
|
||||
std::string my_type() const override;
|
||||
|
||||
@@ -719,7 +756,10 @@ struct DrawableTreeArray {
|
||||
s16 id;
|
||||
s16 length;
|
||||
|
||||
void read_from_file(TypedRef ref, const decompiler::DecompilerTypeSystem& dts, DrawStats* stats);
|
||||
void read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats,
|
||||
GameVersion version);
|
||||
|
||||
std::string print(const PrintSettings& settings, int indent) const;
|
||||
|
||||
@@ -793,7 +833,8 @@ struct BspHeader {
|
||||
|
||||
void read_from_file(const decompiler::LinkedObjectFile& file,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats);
|
||||
DrawStats* stats,
|
||||
GameVersion version);
|
||||
|
||||
std::string print(const PrintSettings& settings) const;
|
||||
};
|
||||
|
||||
@@ -341,7 +341,13 @@ void MercEffect::from_ref(TypedRef tr,
|
||||
blend_frag_count = read_plain_data_field<u16>(tr, "blend-frag-count", dts);
|
||||
tri_count = read_plain_data_field<u16>(tr, "tri-count", dts);
|
||||
dvert_count = read_plain_data_field<u16>(tr, "dvert-count", dts);
|
||||
envmap_usage = read_plain_data_field<u8>(tr, "envmap-usage", dts);
|
||||
auto* type = dynamic_cast<StructureType*>(dts.ts.lookup_type("merc-effect"));
|
||||
Field temp;
|
||||
if (type->lookup_field("envmap-usage", &temp)) {
|
||||
envmap_or_effect_usage = read_plain_data_field<u8>(tr, "envmap-usage", dts);
|
||||
} else {
|
||||
envmap_or_effect_usage = read_plain_data_field<u8>(tr, "effect-usage", dts);
|
||||
}
|
||||
|
||||
// do frag-ctrls
|
||||
TypedRef fc(deref_label(get_field_ref(tr, "frag-ctrl", dts)),
|
||||
@@ -364,7 +370,7 @@ std::string MercEffect::print() {
|
||||
result += fmt::format(" blend_frag_count: {}\n", blend_frag_count);
|
||||
result += fmt::format(" tri_count: {}\n", tri_count);
|
||||
result += fmt::format(" dvert_count: {}\n", dvert_count);
|
||||
result += fmt::format(" envmap_usage: {}\n", envmap_usage);
|
||||
result += fmt::format(" envmap_or_effect_usage: {}\n", envmap_or_effect_usage);
|
||||
|
||||
for (u32 i = 0; i < frag_count; i++) {
|
||||
result += fmt::format(" +FRAGMENT {}\n", i);
|
||||
|
||||
@@ -175,7 +175,7 @@ struct MercEffect {
|
||||
u16 tri_count;
|
||||
u16 dvert_count;
|
||||
// (dummy1 uint8 :offset-assert 26) ??
|
||||
u8 envmap_usage;
|
||||
u8 envmap_or_effect_usage;
|
||||
// (extra-info merc-extra-info :offset-assert 28) ??
|
||||
|
||||
void from_ref(TypedRef tr, const DecompilerTypeSystem& dts, const MercCtrlHeader& main_control);
|
||||
|
||||
@@ -130,7 +130,7 @@ std::vector<level_tools::TextureRemap> extract_bsp_from_level(const ObjectFileDB
|
||||
level_tools::DrawStats draw_stats;
|
||||
// draw_stats.debug_print_dma_data = true;
|
||||
level_tools::BspHeader bsp_header;
|
||||
bsp_header.read_from_file(bsp_file.linked_data, db.dts, &draw_stats);
|
||||
bsp_header.read_from_file(bsp_file.linked_data, db.dts, &draw_stats, db.version());
|
||||
ASSERT((int)bsp_header.drawable_tree_array.trees.size() == bsp_header.drawable_tree_array.length);
|
||||
|
||||
/*
|
||||
|
||||
@@ -1728,20 +1728,22 @@ void StoreOp::propagate_types2(types2::Instruction& instr,
|
||||
extras.needs_rerun = true;
|
||||
}
|
||||
} else {
|
||||
auto location_type = try_get_type_of_expr(input_types, m_addr, env, dts);
|
||||
if (!location_type.empty()) { // need to know where we're storing
|
||||
if (m_addr.is_identity() && !m_addr.get_arg(0).is_var()) {
|
||||
auto location_type = try_get_type_of_expr(input_types, m_addr, env, dts);
|
||||
if (!location_type.empty()) { // need to know where we're storing
|
||||
|
||||
// temp warning if we have multiple store types
|
||||
if (location_type.size() > 1) {
|
||||
fmt::print("StoreOp::propagate_types2: multiple possible store types: ");
|
||||
for (auto& t : location_type) {
|
||||
fmt::print("{} ", t.print());
|
||||
// temp warning if we have multiple store types
|
||||
if (location_type.size() > 1) {
|
||||
fmt::print("StoreOp::propagate_types2: multiple possible store types: ");
|
||||
for (auto& t : location_type) {
|
||||
fmt::print("{} ", t.print());
|
||||
}
|
||||
fmt::print("\n");
|
||||
}
|
||||
fmt::print("\n");
|
||||
}
|
||||
|
||||
if (backprop_tagged_type(location_type.at(0), *value_type, dts)) {
|
||||
extras.needs_rerun = true;
|
||||
if (backprop_tagged_type(location_type.at(0), *value_type, dts)) {
|
||||
extras.needs_rerun = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2442,8 +2444,8 @@ void StackSpillStoreOp::propagate_types2(types2::Instruction& instr,
|
||||
void StackSpillLoadOp::propagate_types2(types2::Instruction& instr,
|
||||
const Env& env,
|
||||
types2::TypeState& input_types,
|
||||
DecompilerTypeSystem& dts,
|
||||
types2::TypePropExtras& extras) {
|
||||
DecompilerTypeSystem& /*dts*/,
|
||||
types2::TypePropExtras& /*extras*/) {
|
||||
// stack slot load
|
||||
auto& info = env.stack_spills().lookup(m_offset);
|
||||
if (info.size != m_size) {
|
||||
|
||||
@@ -434,7 +434,6 @@ bool propagate_block(FunctionCache& cache,
|
||||
Function& func,
|
||||
DecompilerTypeSystem& dts,
|
||||
bool tag_lock) {
|
||||
bool debug = false; // func.name() == "string->float";
|
||||
auto& cblock = cache.blocks.at(block_idx);
|
||||
auto& block = func.basic_blocks.at(block_idx);
|
||||
// for now, assume we'll be done. something might change this later, we'll see
|
||||
|
||||
@@ -421,8 +421,8 @@ int DecompilerTypeSystem::get_format_arg_count(const std::string& str) const {
|
||||
}
|
||||
|
||||
static const std::vector<std::string> code_ignore_list = {
|
||||
"%", "T", "0L", "1L", "3L", "1k", "1K", "2j",
|
||||
"0k", "0K", "30L", "1T", "2T", "100h", "200h", "350h"};
|
||||
"%", "T", "0L", "1L", "3L", "1k", "1K", "2j", "0k",
|
||||
"0K", "30L", "1T", "2T", "100h", "200h", "350h", "t"};
|
||||
|
||||
int arg_count = 0;
|
||||
for (size_t i = 0; i < str.length(); i++) {
|
||||
|
||||
@@ -1552,10 +1552,7 @@ goos::Object decompile_pair(const DecompilerLabel& label,
|
||||
to_print = labels.at(cdr_word.label_id());
|
||||
continue;
|
||||
}
|
||||
// invalid.
|
||||
lg::error(
|
||||
"There is an improper list. This is probably okay, but should be checked manually "
|
||||
"because we could not find a test case yet.");
|
||||
// improper
|
||||
list_tokens.push_back(pretty_print::to_symbol("."));
|
||||
list_tokens.push_back(decompile_pair_elt(cdr_word, labels, words, ts, file));
|
||||
if (add_quote) {
|
||||
@@ -1568,12 +1565,7 @@ goos::Object decompile_pair(const DecompilerLabel& label,
|
||||
throw std::runtime_error(
|
||||
fmt::format("Invalid alignment for pair {}\n", to_print.offset % 16));
|
||||
} else {
|
||||
auto& word = words.at(to_print.target_segment).at(to_print.offset / 4);
|
||||
// improper list
|
||||
lg::error(
|
||||
"There is an improper list. This is probably okay, but should be checked manually "
|
||||
"because we "
|
||||
"could not find a test case yet.");
|
||||
// improper
|
||||
list_tokens.push_back(pretty_print::to_symbol("."));
|
||||
list_tokens.push_back(decompile_pair_elt(
|
||||
words.at(to_print.target_segment).at(to_print.offset / 4), labels, words, ts, file));
|
||||
|
||||
@@ -83,6 +83,7 @@ set(RUNTIME_SOURCE
|
||||
mips2c/jak1_functions/tie_methods.cpp
|
||||
mips2c/jak1_functions/time_of_day.cpp
|
||||
mips2c/jak2_functions/collide_func.cpp
|
||||
mips2c/jak2_functions/font.cpp
|
||||
mips2c/jak2_functions/joint.cpp
|
||||
overlord/dma.cpp
|
||||
overlord/fake_iso.cpp
|
||||
@@ -142,6 +143,7 @@ set(RUNTIME_SOURCE
|
||||
graphics/opengl_renderer/TextureUploadHandler.cpp
|
||||
graphics/opengl_renderer/DepthCue.cpp
|
||||
graphics/texture/jak1_tpage_dir.cpp
|
||||
graphics/texture/jak2_tpage_dir.cpp
|
||||
graphics/texture/TextureConverter.cpp
|
||||
graphics/texture/TexturePool.cpp
|
||||
graphics/pipelines/opengl.cpp
|
||||
|
||||
@@ -7,48 +7,57 @@ std::string BucketRenderer::name_and_id() const {
|
||||
return fmt::format("[{:2d}] {}", (int)m_my_id, m_name);
|
||||
}
|
||||
|
||||
EmptyBucketRenderer::EmptyBucketRenderer(const std::string& name, BucketId my_id)
|
||||
EmptyBucketRenderer::EmptyBucketRenderer(const std::string& name, int my_id)
|
||||
: BucketRenderer(name, my_id) {}
|
||||
|
||||
void EmptyBucketRenderer::render(DmaFollower& dma,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& /*prof*/) {
|
||||
// an empty bucket should have 4 things:
|
||||
// a NEXT in the bucket buffer
|
||||
// a CALL that calls the default register buffer chain
|
||||
// a CNT then RET to get out of the default register buffer chain
|
||||
// a NEXT to get to the next bucket.
|
||||
if (render_state->version == GameVersion::Jak1) {
|
||||
// an empty bucket should have 4 things:
|
||||
// a NEXT in the bucket buffer
|
||||
// a CALL that calls the default register buffer chain
|
||||
// a CNT then RET to get out of the default register buffer chain
|
||||
// a NEXT to get to the next bucket.
|
||||
|
||||
// NEXT
|
||||
auto first_tag = dma.current_tag();
|
||||
dma.read_and_advance();
|
||||
ASSERT(first_tag.kind == DmaTag::Kind::NEXT && first_tag.qwc == 0);
|
||||
// NEXT
|
||||
auto first_tag = dma.current_tag();
|
||||
dma.read_and_advance();
|
||||
ASSERT(first_tag.kind == DmaTag::Kind::NEXT && first_tag.qwc == 0);
|
||||
|
||||
// CALL
|
||||
auto call_tag = dma.current_tag();
|
||||
dma.read_and_advance();
|
||||
if (!(call_tag.kind == DmaTag::Kind::CALL && call_tag.qwc == 0)) {
|
||||
fmt::print("Bucket renderer {} ({}) was supposed to be empty, but wasn't\n", m_my_id, m_name);
|
||||
// CALL
|
||||
auto call_tag = dma.current_tag();
|
||||
dma.read_and_advance();
|
||||
if (!(call_tag.kind == DmaTag::Kind::CALL && call_tag.qwc == 0)) {
|
||||
fmt::print("Bucket renderer {} ({}) was supposed to be empty, but wasn't\n", m_my_id, m_name);
|
||||
}
|
||||
ASSERT(call_tag.kind == DmaTag::Kind::CALL && call_tag.qwc == 0);
|
||||
|
||||
// in the default reg buffer:
|
||||
ASSERT(dma.current_tag_offset() == render_state->default_regs_buffer);
|
||||
dma.read_and_advance();
|
||||
ASSERT(dma.current_tag().kind == DmaTag::Kind::RET);
|
||||
dma.read_and_advance();
|
||||
|
||||
// NEXT to next buffer
|
||||
auto to_next_buffer = dma.current_tag();
|
||||
ASSERT(to_next_buffer.kind == DmaTag::Kind::NEXT);
|
||||
ASSERT(to_next_buffer.qwc == 0);
|
||||
dma.read_and_advance();
|
||||
|
||||
// and we should now be in the next bucket!
|
||||
ASSERT(dma.current_tag_offset() == render_state->next_bucket);
|
||||
} else {
|
||||
auto first_tag = dma.current_tag();
|
||||
dma.read_and_advance();
|
||||
if (first_tag.kind != DmaTag::Kind::CNT || first_tag.qwc != 0) {
|
||||
fmt::print("Bucket renderer {} ({}) was supposed to be empty, but wasn't\n", m_my_id, m_name);
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
ASSERT(call_tag.kind == DmaTag::Kind::CALL && call_tag.qwc == 0);
|
||||
|
||||
// in the default reg buffer:
|
||||
ASSERT(dma.current_tag_offset() == render_state->default_regs_buffer);
|
||||
dma.read_and_advance();
|
||||
ASSERT(dma.current_tag().kind == DmaTag::Kind::RET);
|
||||
dma.read_and_advance();
|
||||
|
||||
// NEXT to next buffer
|
||||
auto to_next_buffer = dma.current_tag();
|
||||
ASSERT(to_next_buffer.kind == DmaTag::Kind::NEXT);
|
||||
ASSERT(to_next_buffer.qwc == 0);
|
||||
dma.read_and_advance();
|
||||
|
||||
// and we should now be in the next bucket!
|
||||
ASSERT(dma.current_tag_offset() == render_state->next_bucket);
|
||||
}
|
||||
|
||||
SkipRenderer::SkipRenderer(const std::string& name, BucketId my_id) : BucketRenderer(name, my_id) {}
|
||||
SkipRenderer::SkipRenderer(const std::string& name, int my_id) : BucketRenderer(name, my_id) {}
|
||||
|
||||
void SkipRenderer::render(DmaFollower& dma,
|
||||
SharedRenderState* render_state,
|
||||
@@ -67,7 +76,7 @@ void SharedRenderState::reset() {
|
||||
}
|
||||
|
||||
RenderMux::RenderMux(const std::string& name,
|
||||
BucketId my_id,
|
||||
int my_id,
|
||||
std::vector<std::unique_ptr<BucketRenderer>> renderers)
|
||||
: BucketRenderer(name, my_id), m_renderers(std::move(renderers)) {
|
||||
for (auto& r : m_renderers) {
|
||||
|
||||
@@ -23,8 +23,9 @@ class EyeRenderer;
|
||||
*/
|
||||
struct SharedRenderState {
|
||||
explicit SharedRenderState(std::shared_ptr<TexturePool> _texture_pool,
|
||||
std::shared_ptr<Loader> _loader)
|
||||
: texture_pool(_texture_pool), loader(_loader) {}
|
||||
std::shared_ptr<Loader> _loader,
|
||||
GameVersion version)
|
||||
: shaders(version), texture_pool(_texture_pool), loader(_loader) {}
|
||||
ShaderLibrary shaders;
|
||||
std::shared_ptr<TexturePool> texture_pool;
|
||||
std::shared_ptr<Loader> loader;
|
||||
@@ -74,6 +75,9 @@ struct SharedRenderState {
|
||||
int draw_region_h = 0;
|
||||
int draw_offset_x = 0;
|
||||
int draw_offset_y = 0;
|
||||
|
||||
int bucket_for_vis_copy = 0;
|
||||
GameVersion version;
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -81,7 +85,7 @@ struct SharedRenderState {
|
||||
*/
|
||||
class BucketRenderer {
|
||||
public:
|
||||
BucketRenderer(const std::string& name, BucketId my_id) : m_name(name), m_my_id(my_id) {}
|
||||
BucketRenderer(const std::string& name, int my_id) : m_name(name), m_my_id(my_id) {}
|
||||
virtual void render(DmaFollower& dma,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof) = 0;
|
||||
@@ -95,14 +99,14 @@ class BucketRenderer {
|
||||
|
||||
protected:
|
||||
std::string m_name;
|
||||
BucketId m_my_id;
|
||||
int m_my_id;
|
||||
bool m_enabled = true;
|
||||
};
|
||||
|
||||
class RenderMux : public BucketRenderer {
|
||||
public:
|
||||
RenderMux(const std::string& name,
|
||||
BucketId my_id,
|
||||
int my_id,
|
||||
std::vector<std::unique_ptr<BucketRenderer>> renderers);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
@@ -122,7 +126,7 @@ class RenderMux : public BucketRenderer {
|
||||
*/
|
||||
class EmptyBucketRenderer : public BucketRenderer {
|
||||
public:
|
||||
EmptyBucketRenderer(const std::string& name, BucketId my_id);
|
||||
EmptyBucketRenderer(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
bool empty() const override { return true; }
|
||||
void draw_debug_window() override {}
|
||||
@@ -130,7 +134,7 @@ class EmptyBucketRenderer : public BucketRenderer {
|
||||
|
||||
class SkipRenderer : public BucketRenderer {
|
||||
public:
|
||||
SkipRenderer(const std::string& name, BucketId my_id);
|
||||
SkipRenderer(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
bool empty() const override { return true; }
|
||||
void draw_debug_window() override {}
|
||||
|
||||
@@ -20,7 +20,7 @@ math::Vector2f fixed_to_floating_point(const math::Vector<s32, 2>& fixed_vec) {
|
||||
// Total number of loops depth-cue performs to draw to the framebuffer
|
||||
constexpr int TOTAL_DRAW_SLICES = 16;
|
||||
|
||||
DepthCue::DepthCue(const std::string& name, BucketId my_id) : BucketRenderer(name, my_id) {
|
||||
DepthCue::DepthCue(const std::string& name, int my_id) : BucketRenderer(name, my_id) {
|
||||
opengl_setup();
|
||||
|
||||
m_draw_slices.resize(TOTAL_DRAW_SLICES);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
class DepthCue : public BucketRenderer {
|
||||
public:
|
||||
DepthCue(const std::string& name, BucketId my_id);
|
||||
DepthCue(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "third-party/fmt/core.h"
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
DirectRenderer::DirectRenderer(const std::string& name, BucketId my_id, int batch_size)
|
||||
DirectRenderer::DirectRenderer(const std::string& name, int my_id, int batch_size)
|
||||
: BucketRenderer(name, my_id), m_prim_buffer(batch_size) {
|
||||
glGenBuffers(1, &m_ogl.vertex_buffer);
|
||||
glGenVertexArrays(1, &m_ogl.vao);
|
||||
@@ -572,6 +572,9 @@ void DirectRenderer::render_gif(const u8* data,
|
||||
case GifTag::RegisterDescriptor::XYZF2:
|
||||
handle_xyzf2_packed(data + offset, render_state, prof);
|
||||
break;
|
||||
case GifTag::RegisterDescriptor::XYZ2:
|
||||
handle_xyz2_packed(data + offset, render_state, prof);
|
||||
break;
|
||||
case GifTag::RegisterDescriptor::PRIM:
|
||||
handle_prim_packed(data + offset, render_state, prof);
|
||||
break;
|
||||
@@ -793,6 +796,22 @@ void DirectRenderer::handle_xyzf2_packed(const u8* data,
|
||||
handle_xyzf2_common(x << 16, y << 16, z << 8, f, render_state, prof, !adc);
|
||||
}
|
||||
|
||||
void DirectRenderer::handle_xyz2_packed(const u8* data,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof) {
|
||||
u32 x, y;
|
||||
memcpy(&x, data, 4);
|
||||
memcpy(&y, data + 4, 4);
|
||||
|
||||
u64 upper;
|
||||
memcpy(&upper, data + 8, 8);
|
||||
u32 z = upper;
|
||||
|
||||
bool adc = upper & (1ull << 47);
|
||||
handle_xyzf2_common(x << 16, y << 16, z, 0, render_state, prof, !adc);
|
||||
}
|
||||
|
||||
PerGameVersion<u32> normal_zbp = {448, 304};
|
||||
void DirectRenderer::handle_zbuf1(u64 val,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof) {
|
||||
@@ -800,7 +819,7 @@ void DirectRenderer::handle_zbuf1(u64 val,
|
||||
// way - 24-bit, at offset 448.
|
||||
GsZbuf x(val);
|
||||
ASSERT(x.psm() == TextureFormat::PSMZ24);
|
||||
ASSERT(x.zbp() == 448);
|
||||
ASSERT(x.zbp() == normal_zbp[render_state->version]);
|
||||
|
||||
bool write = !x.zmsk();
|
||||
// ASSERT(write);
|
||||
@@ -925,9 +944,6 @@ void DirectRenderer::handle_xyzf2_common(u32 x,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof,
|
||||
bool advance) {
|
||||
if (m_my_id == BucketId::MERC_TFRAG_TEX_LEVEL0) {
|
||||
// fmt::print("0x{:x}, 0x{:x}, 0x{:x}\n", x, y, z);
|
||||
}
|
||||
if (m_prim_buffer.is_full()) {
|
||||
lg::warn("Buffer wrapped in {} ({} verts, {} bytes)", m_name, m_ogl.vertex_buffer_max_verts,
|
||||
m_prim_buffer.vert_count * sizeof(Vertex));
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
class DirectRenderer : public BucketRenderer {
|
||||
public:
|
||||
DirectRenderer(const std::string& name, BucketId my_id, int batch_size);
|
||||
DirectRenderer(const std::string& name, int my_id, int batch_size);
|
||||
~DirectRenderer();
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
|
||||
@@ -86,6 +86,9 @@ class DirectRenderer : public BucketRenderer {
|
||||
void handle_xyzf2_packed(const u8* data,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof);
|
||||
void handle_xyz2_packed(const u8* data,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof);
|
||||
void handle_tex0_1_packed(const u8* data);
|
||||
void handle_tex0_1(u64 val);
|
||||
void handle_tex1_1(u64 val);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/////////////////////////
|
||||
// Bucket Renderer
|
||||
/////////////////////////
|
||||
EyeRenderer::EyeRenderer(const std::string& name, BucketId id) : BucketRenderer(name, id) {}
|
||||
EyeRenderer::EyeRenderer(const std::string& name, int id) : BucketRenderer(name, id) {}
|
||||
|
||||
void EyeRenderer::init_textures(TexturePool& texture_pool) {
|
||||
// set up eyes
|
||||
|
||||
@@ -12,7 +12,7 @@ constexpr int SINGLE_EYE_SIZE = 32;
|
||||
|
||||
class EyeRenderer : public BucketRenderer {
|
||||
public:
|
||||
EyeRenderer(const std::string& name, BucketId id);
|
||||
EyeRenderer(const std::string& name, int id);
|
||||
~EyeRenderer();
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
|
||||
@@ -57,8 +57,9 @@ void GLAPIENTRY opengl_error_callback(GLenum source,
|
||||
}
|
||||
|
||||
OpenGLRenderer::OpenGLRenderer(std::shared_ptr<TexturePool> texture_pool,
|
||||
std::shared_ptr<Loader> loader)
|
||||
: m_render_state(texture_pool, loader) {
|
||||
std::shared_ptr<Loader> loader,
|
||||
GameVersion version)
|
||||
: m_render_state(texture_pool, loader, version), m_version(version) {
|
||||
// setup OpenGL errors
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glDebugMessageCallback(opengl_error_callback, nullptr);
|
||||
@@ -70,14 +71,46 @@ OpenGLRenderer::OpenGLRenderer(std::shared_ptr<TexturePool> texture_pool,
|
||||
lg::debug("OpenGL context information: {}", (const char*)glGetString(GL_VERSION));
|
||||
|
||||
// initialize all renderers
|
||||
init_bucket_renderers();
|
||||
switch (m_version) {
|
||||
case GameVersion::Jak1:
|
||||
init_bucket_renderers_jak1();
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
init_bucket_renderers_jak2();
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLRenderer::init_bucket_renderers_jak2() {
|
||||
using namespace jak2;
|
||||
m_bucket_renderers.resize((int)BucketId::MAX_BUCKETS);
|
||||
m_bucket_categories.resize((int)BucketId::MAX_BUCKETS, BucketCategory::OTHER);
|
||||
|
||||
init_bucket_renderer<DirectRenderer>("debug-no-zbuf", BucketCategory::OTHER,
|
||||
BucketId::DEBUG_NO_ZBUF, 0x8000);
|
||||
|
||||
// for now, for any unset renderers, just set them to an EmptyBucketRenderer.
|
||||
for (size_t i = 0; i < m_bucket_renderers.size(); i++) {
|
||||
if (!m_bucket_renderers[i]) {
|
||||
init_bucket_renderer<EmptyBucketRenderer>(fmt::format("bucket{}", i), BucketCategory::OTHER,
|
||||
i);
|
||||
}
|
||||
|
||||
m_bucket_renderers[i]->init_shaders(m_render_state.shaders);
|
||||
m_bucket_renderers[i]->init_textures(*m_render_state.texture_pool);
|
||||
}
|
||||
m_render_state.loader->load_common(*m_render_state.texture_pool, "GAME");
|
||||
}
|
||||
/*!
|
||||
* Construct bucket renderers. We can specify different renderers for different buckets
|
||||
*/
|
||||
void OpenGLRenderer::init_bucket_renderers() {
|
||||
m_bucket_categories.fill(BucketCategory::OTHER);
|
||||
void OpenGLRenderer::init_bucket_renderers_jak1() {
|
||||
using namespace jak1;
|
||||
m_bucket_renderers.resize((int)BucketId::MAX_BUCKETS);
|
||||
m_bucket_categories.resize((int)BucketId::MAX_BUCKETS, BucketCategory::OTHER);
|
||||
|
||||
std::vector<tfrag3::TFragmentTreeKind> normal_tfrags = {tfrag3::TFragmentTreeKind::NORMAL,
|
||||
tfrag3::TFragmentTreeKind::LOWRES};
|
||||
std::vector<tfrag3::TFragmentTreeKind> dirt_tfrags = {tfrag3::TFragmentTreeKind::DIRT};
|
||||
@@ -271,8 +304,9 @@ void OpenGLRenderer::init_bucket_renderers() {
|
||||
|
||||
std::vector<std::unique_ptr<BucketRenderer>> sprite_renderers;
|
||||
// the first renderer added will be the default for sprite.
|
||||
sprite_renderers.push_back(std::make_unique<Sprite3>("sprite-3", BucketId::SPRITE));
|
||||
sprite_renderers.push_back(std::make_unique<SpriteRenderer>("sprite-renderer", BucketId::SPRITE));
|
||||
sprite_renderers.push_back(std::make_unique<Sprite3>("sprite-3", (int)BucketId::SPRITE));
|
||||
sprite_renderers.push_back(
|
||||
std::make_unique<SpriteRenderer>("sprite-renderer", (int)BucketId::SPRITE));
|
||||
init_bucket_renderer<RenderMux>("sprite", BucketCategory::SPRITE, BucketId::SPRITE,
|
||||
std::move(sprite_renderers)); // 66
|
||||
|
||||
@@ -344,7 +378,7 @@ void OpenGLRenderer::render(DmaFollower dma, const RenderOptions& settings) {
|
||||
auto prof = m_profiler.root()->make_scoped_child("render-window");
|
||||
draw_renderer_selection_window();
|
||||
// add a profile bar for the imgui stuff
|
||||
vif_interrupt_callback();
|
||||
// vif_interrupt_callback(0);
|
||||
if (settings.gpu_sync) {
|
||||
glFinish();
|
||||
}
|
||||
@@ -637,12 +671,9 @@ void OpenGLRenderer::setup_frame(const RenderOptions& settings) {
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* This function finds buckets and dispatches them to the appropriate part.
|
||||
*/
|
||||
void OpenGLRenderer::dispatch_buckets(DmaFollower dma,
|
||||
ScopedProfilerNode& prof,
|
||||
bool sync_after_buckets) {
|
||||
void OpenGLRenderer::dispatch_buckets_jak1(DmaFollower dma,
|
||||
ScopedProfilerNode& prof,
|
||||
bool sync_after_buckets) {
|
||||
// The first thing the DMA chain should be a call to a common default-registers chain.
|
||||
// this chain resets the state of the GS. After this is buckets
|
||||
m_category_times.fill(0);
|
||||
@@ -650,6 +681,7 @@ void OpenGLRenderer::dispatch_buckets(DmaFollower dma,
|
||||
m_render_state.buckets_base =
|
||||
dma.current_tag_offset() + 16; // offset by 1 qw for the initial call
|
||||
m_render_state.next_bucket = m_render_state.buckets_base;
|
||||
m_render_state.bucket_for_vis_copy = (int)jak1::BucketId::TFRAG_LEVEL0;
|
||||
|
||||
// Find the default regs buffer
|
||||
auto initial_call_tag = dma.current_tag();
|
||||
@@ -674,7 +706,7 @@ void OpenGLRenderer::dispatch_buckets(DmaFollower dma,
|
||||
m_render_state.next_bucket += 16;
|
||||
|
||||
// loop over the buckets!
|
||||
for (int bucket_id = 0; bucket_id < (int)BucketId::MAX_BUCKETS; bucket_id++) {
|
||||
for (size_t bucket_id = 0; bucket_id < m_bucket_renderers.size(); bucket_id++) {
|
||||
auto& renderer = m_bucket_renderers[bucket_id];
|
||||
auto bucket_prof = prof.make_scoped_child(renderer->name_and_id());
|
||||
g_current_render = renderer->name_and_id();
|
||||
@@ -689,12 +721,11 @@ void OpenGLRenderer::dispatch_buckets(DmaFollower dma,
|
||||
// should have ended at the start of the next chain
|
||||
ASSERT(dma.current_tag_offset() == m_render_state.next_bucket);
|
||||
m_render_state.next_bucket += 16;
|
||||
vif_interrupt_callback();
|
||||
vif_interrupt_callback(bucket_id);
|
||||
m_category_times[(int)m_bucket_categories[bucket_id]] += bucket_prof.get_elapsed_time();
|
||||
|
||||
// hack to draw the collision mesh in the middle the drawing
|
||||
if (bucket_id == (int)BucketId::ALPHA_TEX_LEVEL0 - 1 &&
|
||||
Gfx::g_global_settings.collision_enable) {
|
||||
if (bucket_id == 31 - 1 && Gfx::g_global_settings.collision_enable) {
|
||||
auto p = prof.make_scoped_child("collision-draw");
|
||||
m_collide_renderer.render(&m_render_state, p);
|
||||
}
|
||||
@@ -704,6 +735,57 @@ void OpenGLRenderer::dispatch_buckets(DmaFollower dma,
|
||||
// TODO ending data.
|
||||
}
|
||||
|
||||
void OpenGLRenderer::dispatch_buckets_jak2(DmaFollower dma,
|
||||
ScopedProfilerNode& prof,
|
||||
bool sync_after_buckets) {
|
||||
// The first thing the DMA chain should be a call to a common default-registers chain.
|
||||
// this chain resets the state of the GS. After this is buckets
|
||||
m_category_times.fill(0);
|
||||
|
||||
m_render_state.buckets_base = dma.current_tag_offset(); // starts at 0 in jak 2
|
||||
m_render_state.next_bucket = m_render_state.buckets_base + 16;
|
||||
m_render_state.bucket_for_vis_copy = 0; // TODO
|
||||
|
||||
for (size_t bucket_id = 0; bucket_id < m_bucket_renderers.size(); bucket_id++) {
|
||||
auto& renderer = m_bucket_renderers[bucket_id];
|
||||
auto bucket_prof = prof.make_scoped_child(renderer->name_and_id());
|
||||
g_current_render = renderer->name_and_id();
|
||||
// lg::info("Render: {} start", g_current_render);
|
||||
renderer->render(dma, &m_render_state, bucket_prof);
|
||||
if (sync_after_buckets) {
|
||||
auto pp = scoped_prof("finish");
|
||||
glFinish();
|
||||
}
|
||||
|
||||
// lg::info("Render: {} end", g_current_render);
|
||||
// should have ended at the start of the next chain
|
||||
ASSERT(dma.current_tag_offset() == m_render_state.next_bucket);
|
||||
m_render_state.next_bucket += 16;
|
||||
vif_interrupt_callback(bucket_id);
|
||||
m_category_times[(int)m_bucket_categories[bucket_id]] += bucket_prof.get_elapsed_time();
|
||||
}
|
||||
|
||||
// TODO ending data.
|
||||
}
|
||||
/*!
|
||||
* This function finds buckets and dispatches them to the appropriate part.
|
||||
*/
|
||||
void OpenGLRenderer::dispatch_buckets(DmaFollower dma,
|
||||
ScopedProfilerNode& prof,
|
||||
bool sync_after_buckets) {
|
||||
m_render_state.version = m_version;
|
||||
switch (m_version) {
|
||||
case GameVersion::Jak1:
|
||||
dispatch_buckets_jak1(dma, prof, sync_after_buckets);
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
dispatch_buckets_jak2(dma, prof, sync_after_buckets);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Take a screenshot!
|
||||
*/
|
||||
@@ -777,7 +859,7 @@ void OpenGLRenderer::do_pcrtc_effects(float alp,
|
||||
);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
if (alp < 1) {
|
||||
if (alp < 1 && m_version != GameVersion::Jak2) { // TODO: enable blackout on jak 2.
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||
|
||||
@@ -98,7 +98,9 @@ struct Fbo {
|
||||
*/
|
||||
class OpenGLRenderer {
|
||||
public:
|
||||
OpenGLRenderer(std::shared_ptr<TexturePool> texture_pool, std::shared_ptr<Loader> loader);
|
||||
OpenGLRenderer(std::shared_ptr<TexturePool> texture_pool,
|
||||
std::shared_ptr<Loader> loader,
|
||||
GameVersion version);
|
||||
|
||||
// rendering interface: takes the dma chain from the game, and some size/debug settings from
|
||||
// the graphics system.
|
||||
@@ -107,8 +109,12 @@ class OpenGLRenderer {
|
||||
private:
|
||||
void setup_frame(const RenderOptions& settings);
|
||||
void dispatch_buckets(DmaFollower dma, ScopedProfilerNode& prof, bool sync_after_buckets);
|
||||
void dispatch_buckets_jak1(DmaFollower dma, ScopedProfilerNode& prof, bool sync_after_buckets);
|
||||
void dispatch_buckets_jak2(DmaFollower dma, ScopedProfilerNode& prof, bool sync_after_buckets);
|
||||
|
||||
void do_pcrtc_effects(float alp, SharedRenderState* render_state, ScopedProfilerNode& prof);
|
||||
void init_bucket_renderers();
|
||||
void init_bucket_renderers_jak1();
|
||||
void init_bucket_renderers_jak2();
|
||||
void draw_renderer_selection_window();
|
||||
void finish_screenshot(const std::string& output_name,
|
||||
int px,
|
||||
@@ -117,12 +123,9 @@ class OpenGLRenderer {
|
||||
int y,
|
||||
GLuint fbo,
|
||||
int read_buffer);
|
||||
template <typename T, class... Args>
|
||||
T* init_bucket_renderer(const std::string& name,
|
||||
BucketCategory cat,
|
||||
BucketId id,
|
||||
Args&&... args) {
|
||||
auto renderer = std::make_unique<T>(name, id, std::forward<Args>(args)...);
|
||||
template <typename T, typename U, class... Args>
|
||||
T* init_bucket_renderer(const std::string& name, BucketCategory cat, U id, Args&&... args) {
|
||||
auto renderer = std::make_unique<T>(name, (int)id, std::forward<Args>(args)...);
|
||||
T* ret = renderer.get();
|
||||
m_bucket_renderers.at((int)id) = std::move(renderer);
|
||||
m_bucket_categories.at((int)id) = cat;
|
||||
@@ -134,8 +137,8 @@ class OpenGLRenderer {
|
||||
SmallProfiler m_small_profiler;
|
||||
SubtitleEditor m_subtitle_editor;
|
||||
|
||||
std::array<std::unique_ptr<BucketRenderer>, (int)BucketId::MAX_BUCKETS> m_bucket_renderers;
|
||||
std::array<BucketCategory, (int)BucketId::MAX_BUCKETS> m_bucket_categories;
|
||||
std::vector<std::unique_ptr<BucketRenderer>> m_bucket_renderers;
|
||||
std::vector<BucketCategory> m_bucket_categories;
|
||||
|
||||
std::array<float, (int)BucketCategory::MAX_CATEGORIES> m_category_times;
|
||||
FullScreenDraw m_blackout_renderer;
|
||||
@@ -153,4 +156,6 @@ class OpenGLRenderer {
|
||||
|
||||
Fbo* render_fbo = nullptr; // the selected fbo from the three above to use for rendering
|
||||
} m_fbo_state;
|
||||
|
||||
GameVersion m_version;
|
||||
};
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
|
||||
#include "game/graphics/pipelines/opengl.h"
|
||||
|
||||
Shader::Shader(const std::string& shader_name) {
|
||||
Shader::Shader(const std::string& shader_name, GameVersion version) {
|
||||
std::string height_scale = version == GameVersion::Jak1 ? "1.0" : "0.5";
|
||||
// read the shader source
|
||||
auto vert_src =
|
||||
file_util::read_text_file(file_util::get_file_path({shader_folder, shader_name + ".vert"}));
|
||||
auto frag_src =
|
||||
file_util::read_text_file(file_util::get_file_path({shader_folder, shader_name + ".frag"}));
|
||||
|
||||
vert_src = std::regex_replace(vert_src, std::regex("HEIGHT_SCALE"), height_scale);
|
||||
|
||||
m_vert_shader = glCreateShader(GL_VERTEX_SHADER);
|
||||
const char* src = vert_src.c_str();
|
||||
glShaderSource(m_vert_shader, 1, &src, nullptr);
|
||||
@@ -66,31 +69,31 @@ void Shader::activate() const {
|
||||
glUseProgram(m_program);
|
||||
}
|
||||
|
||||
ShaderLibrary::ShaderLibrary() {
|
||||
at(ShaderId::SOLID_COLOR) = {"solid_color"};
|
||||
at(ShaderId::DIRECT_BASIC) = {"direct_basic"};
|
||||
at(ShaderId::DIRECT_BASIC_TEXTURED) = {"direct_basic_textured"};
|
||||
at(ShaderId::DEBUG_RED) = {"debug_red"};
|
||||
at(ShaderId::SPRITE) = {"sprite_3d"};
|
||||
at(ShaderId::SKY) = {"sky"};
|
||||
at(ShaderId::SKY_BLEND) = {"sky_blend"};
|
||||
at(ShaderId::TFRAG3) = {"tfrag3"};
|
||||
at(ShaderId::TFRAG3_NO_TEX) = {"tfrag3_no_tex"};
|
||||
at(ShaderId::SPRITE3) = {"sprite3_3d"};
|
||||
at(ShaderId::DIRECT2) = {"direct2"};
|
||||
at(ShaderId::EYE) = {"eye"};
|
||||
at(ShaderId::GENERIC) = {"generic"};
|
||||
at(ShaderId::OCEAN_TEXTURE) = {"ocean_texture"};
|
||||
at(ShaderId::OCEAN_TEXTURE_MIPMAP) = {"ocean_texture_mipmap"};
|
||||
at(ShaderId::OCEAN_COMMON) = {"ocean_common"};
|
||||
at(ShaderId::SHRUB) = {"shrub"};
|
||||
at(ShaderId::SHADOW) = {"shadow"};
|
||||
at(ShaderId::COLLISION) = {"collision"};
|
||||
at(ShaderId::MERC2) = {"merc2"};
|
||||
at(ShaderId::SPRITE_DISTORT) = {"sprite_distort"};
|
||||
at(ShaderId::SPRITE_DISTORT_INSTANCED) = {"sprite_distort_instanced"};
|
||||
at(ShaderId::POST_PROCESSING) = {"post_processing"};
|
||||
at(ShaderId::DEPTH_CUE) = {"depth_cue"};
|
||||
ShaderLibrary::ShaderLibrary(GameVersion version) {
|
||||
at(ShaderId::SOLID_COLOR) = {"solid_color", version};
|
||||
at(ShaderId::DIRECT_BASIC) = {"direct_basic", version};
|
||||
at(ShaderId::DIRECT_BASIC_TEXTURED) = {"direct_basic_textured", version};
|
||||
at(ShaderId::DEBUG_RED) = {"debug_red", version};
|
||||
at(ShaderId::SPRITE) = {"sprite_3d", version};
|
||||
at(ShaderId::SKY) = {"sky", version};
|
||||
at(ShaderId::SKY_BLEND) = {"sky_blend", version};
|
||||
at(ShaderId::TFRAG3) = {"tfrag3", version};
|
||||
at(ShaderId::TFRAG3_NO_TEX) = {"tfrag3_no_tex", version};
|
||||
at(ShaderId::SPRITE3) = {"sprite3_3d", version};
|
||||
at(ShaderId::DIRECT2) = {"direct2", version};
|
||||
at(ShaderId::EYE) = {"eye", version};
|
||||
at(ShaderId::GENERIC) = {"generic", version};
|
||||
at(ShaderId::OCEAN_TEXTURE) = {"ocean_texture", version};
|
||||
at(ShaderId::OCEAN_TEXTURE_MIPMAP) = {"ocean_texture_mipmap", version};
|
||||
at(ShaderId::OCEAN_COMMON) = {"ocean_common", version};
|
||||
at(ShaderId::SHRUB) = {"shrub", version};
|
||||
at(ShaderId::SHADOW) = {"shadow", version};
|
||||
at(ShaderId::COLLISION) = {"collision", version};
|
||||
at(ShaderId::MERC2) = {"merc2", version};
|
||||
at(ShaderId::SPRITE_DISTORT) = {"sprite_distort", version};
|
||||
at(ShaderId::SPRITE_DISTORT_INSTANCED) = {"sprite_distort_instanced", version};
|
||||
at(ShaderId::POST_PROCESSING) = {"post_processing", version};
|
||||
at(ShaderId::DEPTH_CUE) = {"depth_cue", version};
|
||||
|
||||
for (auto& shader : m_shaders) {
|
||||
ASSERT_MSG(shader.okay(), "error compiling shader");
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
#include <string>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/versions.h"
|
||||
|
||||
class Shader {
|
||||
public:
|
||||
static constexpr char shader_folder[] = "game/graphics/opengl_renderer/shaders/";
|
||||
Shader(const std::string& shader_name);
|
||||
Shader(const std::string& shader_name, GameVersion version);
|
||||
Shader() = default;
|
||||
void activate() const;
|
||||
bool okay() const { return m_is_okay; }
|
||||
@@ -51,7 +52,7 @@ enum class ShaderId {
|
||||
|
||||
class ShaderLibrary {
|
||||
public:
|
||||
ShaderLibrary();
|
||||
ShaderLibrary(GameVersion version);
|
||||
Shader& operator[](ShaderId id) { return m_shaders[(int)id]; }
|
||||
Shader& at(ShaderId id) { return m_shaders[(int)id]; }
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
ShadowRenderer::ShadowRenderer(const std::string& name, BucketId my_id)
|
||||
: BucketRenderer(name, my_id) {
|
||||
ShadowRenderer::ShadowRenderer(const std::string& name, int my_id) : BucketRenderer(name, my_id) {
|
||||
// create OpenGL objects
|
||||
glGenBuffers(1, &m_ogl.vertex_buffer);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class ShadowRenderer : public BucketRenderer {
|
||||
public:
|
||||
ShadowRenderer(const std::string& name, BucketId my_id);
|
||||
ShadowRenderer(const std::string& name, int my_id);
|
||||
~ShadowRenderer();
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// size of the sky texture is 64x96, but it's actually a 64x64 (clouds) and a 32x32 (sky)
|
||||
|
||||
SkyBlendHandler::SkyBlendHandler(const std::string& name,
|
||||
BucketId my_id,
|
||||
int my_id,
|
||||
int level_id,
|
||||
std::shared_ptr<SkyBlendGPU> shared_blender,
|
||||
std::shared_ptr<SkyBlendCPU> shared_blender_cpu)
|
||||
@@ -122,7 +122,7 @@ void SkyBlendHandler::draw_debug_window() {
|
||||
}
|
||||
}
|
||||
|
||||
SkyRenderer::SkyRenderer(const std::string& name, BucketId my_id)
|
||||
SkyRenderer::SkyRenderer(const std::string& name, int my_id)
|
||||
: BucketRenderer(name, my_id), m_direct_renderer("sky-direct", my_id, 100) {}
|
||||
|
||||
void SkyRenderer::render(DmaFollower& dma,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
class SkyBlendHandler : public BucketRenderer {
|
||||
public:
|
||||
SkyBlendHandler(const std::string& name,
|
||||
BucketId my_id,
|
||||
int my_id,
|
||||
int level_id,
|
||||
std::shared_ptr<SkyBlendGPU> shared_gpu_blender,
|
||||
std::shared_ptr<SkyBlendCPU> shared_cpu_blender);
|
||||
@@ -36,7 +36,7 @@ class SkyBlendHandler : public BucketRenderer {
|
||||
*/
|
||||
class SkyRenderer : public BucketRenderer {
|
||||
public:
|
||||
SkyRenderer(const std::string& name, BucketId my_id);
|
||||
SkyRenderer(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ constexpr int SPRITE_RENDERER_MAX_SPRITES = 1920 * 10;
|
||||
constexpr int SPRITE_RENDERER_MAX_DISTORT_SPRITES =
|
||||
256 * 10; // size of sprite-aux-list in GOAL code * SPRITE_MAX_AMOUNT_MULT
|
||||
|
||||
Sprite3::Sprite3(const std::string& name, BucketId my_id)
|
||||
Sprite3::Sprite3(const std::string& name, int my_id)
|
||||
: BucketRenderer(name, my_id), m_direct(name, my_id, 1024) {
|
||||
opengl_setup();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
class Sprite3 : public BucketRenderer {
|
||||
public:
|
||||
Sprite3(const std::string& name, BucketId my_id);
|
||||
Sprite3(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
static constexpr int SPRITES_PER_CHUNK = 48;
|
||||
|
||||
@@ -35,8 +35,7 @@ u32 process_sprite_chunk_header(DmaFollower& dma) {
|
||||
|
||||
constexpr int SPRITE_RENDERER_MAX_SPRITES = 8000;
|
||||
|
||||
SpriteRenderer::SpriteRenderer(const std::string& name, BucketId my_id)
|
||||
: BucketRenderer(name, my_id) {
|
||||
SpriteRenderer::SpriteRenderer(const std::string& name, int my_id) : BucketRenderer(name, my_id) {
|
||||
glGenBuffers(1, &m_ogl.vertex_buffer);
|
||||
glGenVertexArrays(1, &m_ogl.vao);
|
||||
glBindVertexArray(m_ogl.vao);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class SpriteRenderer : public BucketRenderer {
|
||||
public:
|
||||
SpriteRenderer(const std::string& name, BucketId my_id);
|
||||
SpriteRenderer(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
static constexpr int SPRITES_PER_CHUNK = 48;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "third-party/fmt/core.h"
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
TextureUploadHandler::TextureUploadHandler(const std::string& name, BucketId my_id)
|
||||
TextureUploadHandler::TextureUploadHandler(const std::string& name, int my_id)
|
||||
: BucketRenderer(name, my_id) {}
|
||||
|
||||
void TextureUploadHandler::render(DmaFollower& dma,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
class TextureUploadHandler : public BucketRenderer {
|
||||
public:
|
||||
TextureUploadHandler(const std::string& name, BucketId my_id);
|
||||
TextureUploadHandler(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "Shrub.h"
|
||||
|
||||
Shrub::Shrub(const std::string& name, BucketId my_id) : BucketRenderer(name, my_id) {
|
||||
Shrub::Shrub(const std::string& name, int my_id) : BucketRenderer(name, my_id) {
|
||||
m_color_result.resize(TIME_OF_DAY_COLOR_COUNT);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class Shrub : public BucketRenderer {
|
||||
public:
|
||||
Shrub(const std::string& name, BucketId my_id);
|
||||
Shrub(const std::string& name, int my_id);
|
||||
~Shrub();
|
||||
bool setup_for_level(const std::string& level, SharedRenderState* render_state);
|
||||
void render_all_trees(const TfragRenderSettings& settings,
|
||||
|
||||
@@ -17,7 +17,7 @@ bool looks_like_tfrag_init(const DmaFollower& follow) {
|
||||
} // namespace
|
||||
|
||||
TFragment::TFragment(const std::string& name,
|
||||
BucketId my_id,
|
||||
int my_id,
|
||||
const std::vector<tfrag3::TFragmentTreeKind>& trees,
|
||||
bool child_mode,
|
||||
int level_id)
|
||||
@@ -60,7 +60,7 @@ void TFragment::render(DmaFollower& dma,
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_my_id == BucketId::TFRAG_LEVEL0) {
|
||||
if (m_my_id == render_state->bucket_for_vis_copy) {
|
||||
DmaTransfer transfers[2];
|
||||
|
||||
transfers[0] = dma.read_and_advance();
|
||||
|
||||
@@ -37,7 +37,7 @@ static_assert(sizeof(TFragBufferedData) == 328 * 16);
|
||||
class TFragment : public BucketRenderer {
|
||||
public:
|
||||
TFragment(const std::string& name,
|
||||
BucketId my_id,
|
||||
int my_id,
|
||||
const std::vector<tfrag3::TFragmentTreeKind>& trees,
|
||||
bool child_mode,
|
||||
int level_id);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
Tie3::Tie3(const std::string& name, BucketId my_id, int level_id)
|
||||
Tie3::Tie3(const std::string& name, int my_id, int level_id)
|
||||
: BucketRenderer(name, my_id), m_level_id(level_id) {
|
||||
// regardless of how many we use some fixed max
|
||||
// we won't actually interp or upload to gpu the unused ones, but we need a fixed maximum so
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class Tie3 : public BucketRenderer {
|
||||
public:
|
||||
Tie3(const std::string& name, BucketId my_id, int level_id);
|
||||
Tie3(const std::string& name, int my_id, int level_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
~Tie3();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/*!
|
||||
* Matches the bucket-id enum in GOAL
|
||||
*/
|
||||
namespace jak1 {
|
||||
enum class BucketId {
|
||||
BUCKET0 = 0,
|
||||
BUCKET1 = 1,
|
||||
@@ -75,6 +76,11 @@ enum class BucketId {
|
||||
SUBTITLE = 69,
|
||||
MAX_BUCKETS = 70
|
||||
};
|
||||
}
|
||||
|
||||
namespace jak2 {
|
||||
enum class BucketId { DEBUG_NO_ZBUF = 325, MAX_BUCKETS = 327 };
|
||||
}
|
||||
|
||||
enum class BucketCategory {
|
||||
TFRAG,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
Generic2::Generic2(const std::string& name,
|
||||
BucketId my_id,
|
||||
int my_id,
|
||||
u32 num_verts,
|
||||
u32 num_frags,
|
||||
u32 num_adgif,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
class Generic2 : public BucketRenderer {
|
||||
public:
|
||||
Generic2(const std::string& name,
|
||||
BucketId my_id,
|
||||
int my_id,
|
||||
u32 num_verts = 200000,
|
||||
u32 num_frags = 2000,
|
||||
u32 num_adgif = 6000,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
Merc2::Merc2(const std::string& name, BucketId my_id) : BucketRenderer(name, my_id) {
|
||||
Merc2::Merc2(const std::string& name, int my_id) : BucketRenderer(name, my_id) {
|
||||
glGenVertexArrays(1, &m_vao);
|
||||
glBindVertexArray(m_vao);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
class Merc2 : public BucketRenderer {
|
||||
public:
|
||||
Merc2(const std::string& name, BucketId my_id);
|
||||
Merc2(const std::string& name, int my_id);
|
||||
void draw_debug_window() override;
|
||||
void init_shaders(ShaderLibrary& shaders) override;
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
|
||||
@@ -542,7 +542,7 @@ class CollideLoaderStage : public LoaderStage {
|
||||
class StallLoaderStage : public LoaderStage {
|
||||
public:
|
||||
StallLoaderStage() : LoaderStage("stall") {}
|
||||
bool run(Timer&, LoaderInput& data) override {
|
||||
bool run(Timer&, LoaderInput& /*data*/) override {
|
||||
m_count++;
|
||||
if (m_count > 10) {
|
||||
return true;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
OceanMidAndFar::OceanMidAndFar(const std::string& name, BucketId my_id)
|
||||
OceanMidAndFar::OceanMidAndFar(const std::string& name, int my_id)
|
||||
: BucketRenderer(name, my_id), m_direct(name, my_id, 4096), m_texture_renderer(true) {}
|
||||
|
||||
void OceanMidAndFar::draw_debug_window() {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
class OceanMidAndFar : public BucketRenderer {
|
||||
public:
|
||||
OceanMidAndFar(const std::string& name, BucketId my_id);
|
||||
OceanMidAndFar(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
void init_textures(TexturePool& pool) override;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
OceanNear::OceanNear(const std::string& name, BucketId my_id)
|
||||
OceanNear::OceanNear(const std::string& name, int my_id)
|
||||
: BucketRenderer(name, my_id), m_texture_renderer(false) {
|
||||
for (auto& a : m_vu_data) {
|
||||
a.fill(0);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
class OceanNear : public BucketRenderer {
|
||||
public:
|
||||
OceanNear(const std::string& name, BucketId my_id);
|
||||
OceanNear(const std::string& name, int my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
void init_textures(TexturePool& pool) override;
|
||||
|
||||
@@ -9,7 +9,7 @@ out vec4 fragment_color;
|
||||
|
||||
void main() {
|
||||
// Note: position.y is multiplied by 32 instead of 16 to undo the half-height for interlacing stuff.
|
||||
gl_Position = vec4((position_in.x - 0.5) * 16., -(position_in.y - 0.5) * 32, position_in.z * 2 - 1., 1.0);
|
||||
gl_Position = vec4((position_in.x - 0.5) * 16., -(position_in.y - 0.5) * 32 * HEIGHT_SCALE, position_in.z * 2 - 1., 1.0);
|
||||
// scissoring area adjust
|
||||
gl_Position.y *= 512.0/448.0;
|
||||
fragment_color = vec4(rgba_in.x, rgba_in.y, rgba_in.z, rgba_in.w * 2.);
|
||||
|
||||
@@ -13,7 +13,7 @@ layout (location = 3) in uvec4 tex_info_in;
|
||||
out flat uvec4 tex_info;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4((position_in.x - 0.5) * 16., -(position_in.y - 0.5) * 32, position_in.z * 2 - 1., 1.0);
|
||||
gl_Position = vec4((position_in.x - 0.5) * 16., -(position_in.y - 0.5) * 32 * HEIGHT_SCALE, position_in.z * 2 - 1., 1.0);
|
||||
// scissoring area adjust
|
||||
gl_Position.y *= 512.0/448.0;
|
||||
fragment_color = vec4(rgba_in.x, rgba_in.y, rgba_in.z, rgba_in.w * 2.);
|
||||
|
||||
@@ -71,10 +71,10 @@ struct GraphicsData {
|
||||
|
||||
GraphicsData(GameVersion version)
|
||||
: dma_copier(EE_MAIN_MEM_SIZE),
|
||||
texture_pool(std::make_shared<TexturePool>()),
|
||||
texture_pool(std::make_shared<TexturePool>(version)),
|
||||
loader(std::make_shared<Loader>(file_util::get_jak_project_dir() / "out" /
|
||||
game_version_names[version] / "fr3")),
|
||||
ogl_renderer(texture_pool, loader),
|
||||
ogl_renderer(texture_pool, loader, version),
|
||||
version(version) {}
|
||||
};
|
||||
|
||||
@@ -339,7 +339,7 @@ void GLDisplay::on_key(GLFWwindow* window, int key, int /*scancode*/, int action
|
||||
}
|
||||
}
|
||||
|
||||
void GLDisplay::on_mouse_key(GLFWwindow* window, int button, int action, int mode) {
|
||||
void GLDisplay::on_mouse_key(GLFWwindow* /*window*/, int button, int action, int /*mode*/) {
|
||||
int key =
|
||||
button + GLFW_KEY_LAST; // Mouse button index are appended after initial GLFW keys in newpad
|
||||
|
||||
@@ -356,7 +356,7 @@ void GLDisplay::on_mouse_key(GLFWwindow* window, int button, int action, int mod
|
||||
}
|
||||
}
|
||||
|
||||
void GLDisplay::on_cursor_position(GLFWwindow* window, double xposition, double yposition) {
|
||||
void GLDisplay::on_cursor_position(GLFWwindow* /*window*/, double xposition, double yposition) {
|
||||
Pad::MappingInfo mapping_info = Gfx::get_button_mapping();
|
||||
if (is_imgui_visible() || !mapping_info.use_mouse) {
|
||||
if (is_cursor_position_valid == true) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "game/graphics/pipelines/opengl.h"
|
||||
#include "game/graphics/texture/jak1_tpage_dir.h"
|
||||
#include "game/graphics/texture/jak2_tpage_dir.h"
|
||||
|
||||
#include "third-party/fmt/core.h"
|
||||
#include "third-party/imgui/imgui.h"
|
||||
@@ -281,8 +282,23 @@ std::optional<u64> TexturePool::lookup_mt4hh(u32 location) {
|
||||
return {};
|
||||
}
|
||||
|
||||
TexturePool::TexturePool()
|
||||
: m_loaded_textures(get_jak1_tpage_dir()), m_id_to_name(get_jak1_tpage_dir()) {
|
||||
namespace {
|
||||
const std::vector<u32>& get_tpage_dir(GameVersion version) {
|
||||
switch (version) {
|
||||
case GameVersion::Jak1:
|
||||
return get_jak1_tpage_dir();
|
||||
case GameVersion::Jak2:
|
||||
return get_jak2_tpage_dir();
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TexturePool::TexturePool(GameVersion version)
|
||||
: m_loaded_textures(get_tpage_dir(version)),
|
||||
m_id_to_name(get_tpage_dir(version)),
|
||||
m_tpage_dir_size(get_tpage_dir(version).size()) {
|
||||
m_placeholder_data.resize(16 * 16);
|
||||
u32 c0 = 0xa0303030;
|
||||
u32 c1 = 0xa0e0e0e0;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "common/common_types.h"
|
||||
#include "common/util/Serializer.h"
|
||||
#include "common/util/SmallVector.h"
|
||||
#include "common/versions.h"
|
||||
|
||||
#include "game/graphics/texture/TextureConverter.h"
|
||||
|
||||
@@ -300,7 +301,7 @@ struct GoalTexturePage {
|
||||
*/
|
||||
class TexturePool {
|
||||
public:
|
||||
TexturePool();
|
||||
TexturePool(GameVersion version);
|
||||
void handle_upload_now(const u8* tpage, int mode, const u8* memory_base, u32 s7_ptr);
|
||||
GpuTexture* give_texture(const TextureInput& in);
|
||||
GpuTexture* give_texture_and_load_to_vram(const TextureInput& in, u32 vram_slot);
|
||||
@@ -379,6 +380,7 @@ class TexturePool {
|
||||
std::unordered_map<std::string, PcTextureId> m_name_to_id;
|
||||
|
||||
u32 m_next_pc_texture_to_allocate = 0;
|
||||
u32 m_tpage_dir_size = 0;
|
||||
|
||||
std::mutex m_mutex;
|
||||
};
|
||||
@@ -99,6 +99,6 @@ std::vector<u32> tpage_dir = {
|
||||
EXTRA_PC_PORT_TEXTURE_COUNT};
|
||||
}
|
||||
|
||||
const std::vector<u32> get_jak1_tpage_dir() {
|
||||
const std::vector<u32>& get_jak1_tpage_dir() {
|
||||
return tpage_dir;
|
||||
}
|
||||
@@ -4,5 +4,5 @@
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
const std::vector<u32> get_jak1_tpage_dir();
|
||||
const std::vector<u32>& get_jak1_tpage_dir();
|
||||
constexpr u32 EXTRA_PC_PORT_TEXTURE_COUNT = 50;
|
||||
@@ -0,0 +1,275 @@
|
||||
#include "jak2_tpage_dir.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
#include "jak1_tpage_dir.h"
|
||||
|
||||
// clang-format off
|
||||
namespace {
|
||||
std::vector<u32> tpage_dir = {
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x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
const std::vector<u32>& get_jak2_tpage_dir() {
|
||||
return tpage_dir;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
const std::vector<u32>& get_jak2_tpage_dir();
|
||||
@@ -33,6 +33,7 @@ u8 pad_dma_buf[2 * SCE_PAD_DMA_BUFFER_SIZE];
|
||||
|
||||
// added
|
||||
u32 vif1_interrupt_handler = 0;
|
||||
u32 vblank_interrupt_handler = 0;
|
||||
|
||||
Timer ee_clock_timer;
|
||||
|
||||
@@ -42,6 +43,7 @@ void kmachine_init_globals_common() {
|
||||
modsrc = 1;
|
||||
reboot = 1;
|
||||
vif1_interrupt_handler = 0;
|
||||
vblank_interrupt_handler = 0;
|
||||
ee_clock_timer = Timer();
|
||||
}
|
||||
|
||||
@@ -213,8 +215,17 @@ u64 CPadGetData(u64 cpad_info) {
|
||||
|
||||
// should make sure this works the same way in jak 2
|
||||
void InstallHandler(u32 handler_idx, u32 handler_func) {
|
||||
ASSERT(handler_idx == 5); // vif1
|
||||
vif1_interrupt_handler = handler_func;
|
||||
switch (handler_idx) {
|
||||
case 3:
|
||||
vblank_interrupt_handler = handler_func;
|
||||
break;
|
||||
case 5:
|
||||
vif1_interrupt_handler = handler_func;
|
||||
break;
|
||||
default:
|
||||
printf("unknown handler: %d\n", handler_idx);
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
// nothing used this in jak1, hopefully same for 2
|
||||
@@ -479,10 +490,10 @@ void set_gfx_hack(u64 which, u32 symptr) {
|
||||
* PC PORT FUNCTIONS END
|
||||
*/
|
||||
|
||||
void vif_interrupt_callback() {
|
||||
void vif_interrupt_callback(int bucket_id) {
|
||||
// added for the PC port for faking VIF interrupts from the graphics system.
|
||||
if (vif1_interrupt_handler && MasterExit == RuntimeExitStatus::RUNNING) {
|
||||
call_goal(Ptr<Function>(vif1_interrupt_handler), 0, 0, 0, s7.offset, g_ee_main_mem);
|
||||
call_goal(Ptr<Function>(vif1_interrupt_handler), bucket_id, 0, 0, s7.offset, g_ee_main_mem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,4 +512,11 @@ u32 offset_of_s7() {
|
||||
u64 pc_get_mips2c(u32 name) {
|
||||
const char* n = Ptr<String>(name).c()->data();
|
||||
return Mips2C::gLinkedFunctionTable.get(n);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Called from game thread to submit rendering DMA chain.
|
||||
*/
|
||||
void send_gfx_dma_chain(u32 /*bank*/, u32 chain) {
|
||||
Gfx::send_chain(g_ee_main_mem, chain);
|
||||
}
|
||||
@@ -22,6 +22,7 @@ extern u32 modsrc;
|
||||
extern u32 reboot;
|
||||
|
||||
extern const char* init_types[];
|
||||
extern u32 vblank_interrupt_handler;
|
||||
|
||||
void kmachine_init_globals_common();
|
||||
|
||||
@@ -77,5 +78,6 @@ void set_collision_mask(GfxGlobalSettings::CollisionRendererMode mode, int mask,
|
||||
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);
|
||||
void vif_interrupt_callback(int bucket_id);
|
||||
u64 pc_get_mips2c(u32 name);
|
||||
void send_gfx_dma_chain(u32 /*bank*/, u32 chain);
|
||||
@@ -386,12 +386,6 @@ int ShutdownMachine() {
|
||||
}
|
||||
|
||||
// todo, these could probably be moved to common
|
||||
/*!
|
||||
* Called from game thread to submit rendering DMA chain.
|
||||
*/
|
||||
void send_gfx_dma_chain(u32 /*bank*/, u32 chain) {
|
||||
Gfx::send_chain(g_ee_main_mem, chain);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Called from game thread to upload a texture outside of the main DMA chain.
|
||||
|
||||
@@ -462,7 +462,7 @@ void InitMachine_PCPort() {
|
||||
|
||||
make_function_symbol_from_c("__read-ee-timer", (void*)read_ee_timer);
|
||||
make_function_symbol_from_c("__mem-move", (void*)c_memmove);
|
||||
// make_function_symbol_from_c("__send-gfx-dma-chain", (void*)send_gfx_dma_chain);
|
||||
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);
|
||||
@@ -531,23 +531,19 @@ void PutDisplayEnv(u32 /*ptr*/) {
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
u32 sceGsSyncV(u32 /*mode*/) {
|
||||
// stub, jak2 probably works differently here
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
/*
|
||||
u32 sceGsSyncV(u32 mode) {
|
||||
ASSERT(mode == 0);
|
||||
VBlank_Handler();
|
||||
// VBlank_Handler(); meh...
|
||||
if (vblank_interrupt_handler && MasterExit == RuntimeExitStatus::RUNNING) {
|
||||
call_goal(Ptr<Function>(vblank_interrupt_handler), 0, 0, 0, s7.offset, g_ee_main_mem);
|
||||
}
|
||||
|
||||
return Gfx::vsync();
|
||||
*/
|
||||
}
|
||||
|
||||
u32 sceGsSyncPath(u32 mode, u32 timeout) {
|
||||
// stub, jak2 probably works differently here
|
||||
ASSERT(mode == 0 && timeout == 0);
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
// return Gfx::sync_path();
|
||||
return Gfx::sync_path();
|
||||
}
|
||||
|
||||
void aybabtu() {}
|
||||
|
||||
@@ -160,7 +160,7 @@ u64 execute(void* ctxt) {
|
||||
|
||||
|
||||
block_10:
|
||||
c->load_symbol(t9, cache.collide_do_primitives); // lw t9, collide-do-primitives(s7)
|
||||
c->load_symbol2(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
|
||||
@@ -276,7 +276,7 @@ u64 execute(void* ctxt) {
|
||||
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->load_symbol2(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
|
||||
@@ -295,7 +295,7 @@ u64 execute(void* ctxt) {
|
||||
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->load_symbol2(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
|
||||
@@ -318,7 +318,7 @@ u64 execute(void* ctxt) {
|
||||
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->load_symbol2(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
|
||||
@@ -355,7 +355,7 @@ u64 execute(void* ctxt) {
|
||||
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->load_symbol2(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
|
||||
@@ -394,7 +394,7 @@ u64 execute(void* ctxt) {
|
||||
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->load_symbol2(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
|
||||
@@ -433,7 +433,7 @@ u64 execute(void* ctxt) {
|
||||
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->load_symbol2(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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2202,7 +2202,7 @@ u64 execute(void* ctxt) {
|
||||
//c->sw(v1, 0, s0); // sw v1, 0(s0)
|
||||
spad_to_dma_no_sadr_off(cache.fake_scratchpad_data, madr, sadr, qwc);
|
||||
// Unknown instr: sync.l
|
||||
c->load_symbol(t9, cache.clear_frame_accumulator);// lw t9, clear-frame-accumulator(s7)
|
||||
c->load_symbol2(t9, cache.clear_frame_accumulator);// lw t9, clear-frame-accumulator(s7)
|
||||
c->vadd(DEST::yz, vf14, vf14, vf14); // vadd.yz vf14, vf14, vf14
|
||||
c->lw(s2, 0, sp); // lw s2, 0(sp)
|
||||
// nop // sll r0, r0, 0
|
||||
@@ -2241,7 +2241,7 @@ u64 execute(void* ctxt) {
|
||||
c->lw(a2, 16, t7); // lw a2, 16(t7)
|
||||
//c->lui(a1, 28672); // lui a1, 28672
|
||||
get_fake_spad_addr(a1, cache.fake_scratchpad_data, 0, c);
|
||||
c->load_symbol(t9, cache.decompress_fixed_data_to_accumulator);// lw t9, decompress-fixed-data-to-accumulator(s7)
|
||||
c->load_symbol2(t9, cache.decompress_fixed_data_to_accumulator);// lw t9, decompress-fixed-data-to-accumulator(s7)
|
||||
c->daddiu(a1, a1, 7392); // daddiu a1, a1, 7408
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->daddiu(s1, s1, -1); // daddiu s1, s1, -1
|
||||
@@ -2292,7 +2292,7 @@ u64 execute(void* ctxt) {
|
||||
|
||||
c->lw(a3, 12, t7); // lw a3, 12(t7)
|
||||
// nop // sll r0, r0, 0
|
||||
c->load_symbol(t9, cache.decompress_frame_data_pair_to_accumulator);// lw t9, decompress-frame-data-pair-to-accumulator(s7)
|
||||
c->load_symbol2(t9, cache.decompress_frame_data_pair_to_accumulator);// lw t9, decompress-frame-data-pair-to-accumulator(s7)
|
||||
// nop // sll r0, r0, 0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->sll(a3, a3, 3); // sll a3, a3, 3
|
||||
@@ -2302,7 +2302,7 @@ u64 execute(void* ctxt) {
|
||||
c->daddiu(t7, t7, 24); // daddiu t7, t7, 24
|
||||
if (bc) {goto block_2;} // branch non-likely
|
||||
|
||||
c->load_symbol(t9, cache.normalize_frame_quaternions);// lw t9, normalize-frame-quaternions(s7)
|
||||
c->load_symbol2(t9, cache.normalize_frame_quaternions);// lw t9, normalize-frame-quaternions(s7)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lw(s2, 0, sp); // lw s2, 0(sp)
|
||||
// nop // sll r0, r0, 0
|
||||
@@ -2330,7 +2330,7 @@ u64 execute(void* ctxt) {
|
||||
|
||||
|
||||
block_10:
|
||||
c->load_symbol(t9, cache.decompress_frame_data_to_accumulator);// lw t9, decompress-frame-data-to-accumulator(s7)
|
||||
c->load_symbol2(t9, cache.decompress_frame_data_to_accumulator);// lw t9, decompress-frame-data-to-accumulator(s7)
|
||||
// nop // sll r0, r0, 0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
// nop // sll r0, r0, 0
|
||||
@@ -2340,7 +2340,7 @@ u64 execute(void* ctxt) {
|
||||
c->daddiu(t7, t7, 24); // daddiu t7, t7, 24
|
||||
if (bc) {goto block_2;} // branch non-likely
|
||||
|
||||
c->load_symbol(t9, cache.normalize_frame_quaternions);// lw t9, normalize-frame-quaternions(s7)
|
||||
c->load_symbol2(t9, cache.normalize_frame_quaternions);// lw t9, normalize-frame-quaternions(s7)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lw(s2, 0, sp); // lw s2, 0(sp)
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
@@ -268,6 +268,12 @@ struct ExecutionContext {
|
||||
gprs[gpr].ds64[0] = val; // sign extend and set
|
||||
}
|
||||
|
||||
void load_symbol2(int gpr, void* sym_addr) {
|
||||
s32 val;
|
||||
memcpy(&val, (u8*)sym_addr - 1, 4);
|
||||
gprs[gpr].ds64[0] = val; // sign extend and set
|
||||
}
|
||||
|
||||
void load_symbol_addr(int gpr, void* sym_addr) {
|
||||
gprs[gpr].du64[0] = ((const u8*)sym_addr) - g_ee_main_mem;
|
||||
}
|
||||
@@ -1018,6 +1024,8 @@ struct ExecutionContext {
|
||||
gprs[dst].du64[0] = (gpr_src(src).du64[0] < imm) ? 1 : 0;
|
||||
}
|
||||
|
||||
void slti(int dst, int src, s64 imm) { gprs[dst].du64[0] = (gpr_src(src).ds64[0] < imm) ? 1 : 0; }
|
||||
|
||||
void sll(int dst, int src, int sa) {
|
||||
u32 value = gpr_src(src).du32[0] << sa;
|
||||
s32 value_signed = value;
|
||||
|
||||
@@ -119,8 +119,9 @@ namespace collide_do_primitives { extern void link(); }
|
||||
namespace moving_sphere_triangle_intersect { extern void link(); }
|
||||
namespace calc_animation_from_spr { extern void link(); }
|
||||
namespace cspace_parented_transformq_joint { extern void link(); }
|
||||
|
||||
|
||||
namespace draw_string_asm { extern void link(); }
|
||||
namespace draw_string { extern void link(); }
|
||||
namespace get_string_length { extern void link(); }
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
@@ -198,8 +199,9 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
|
||||
/////////// JAK 2
|
||||
{{"collide-func",
|
||||
{jak2::collide_do_primitives::link, jak2::moving_sphere_triangle_intersect::link}},
|
||||
{"joint",
|
||||
{jak2::calc_animation_from_spr::link, jak2::cspace_parented_transformq_joint::link}}},
|
||||
{"joint", {jak2::calc_animation_from_spr::link, jak2::cspace_parented_transformq_joint::link}},
|
||||
{"font",
|
||||
{jak2::draw_string::link, jak2::get_string_length::link, jak2::draw_string_asm::link}}},
|
||||
};
|
||||
|
||||
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ s32 WakeupThread(s32 thid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 RegisterVblankHandler(int edge, int priority, int (*handler)(void*), void* userdata) {
|
||||
s32 RegisterVblankHandler(int edge, int priority, int (*handler)(void*), void* /*userdata*/) {
|
||||
(void)edge;
|
||||
(void)priority;
|
||||
return iop->kernel.RegisterVblankHandler(handler);
|
||||
|
||||
@@ -259,6 +259,8 @@ void midi_handler::channel_pressure() {
|
||||
void midi_handler::channel_pitch() {
|
||||
u8 channel = m_status & 0xF;
|
||||
u32 pitch = (m_seq_ptr[0] << 7) | m_seq_ptr[1];
|
||||
(void)pitch;
|
||||
(void)channel;
|
||||
// fmt::print("{}: pitch ch{:01x} {:04x}\n", m_time, channel, pitch);
|
||||
m_seq_ptr += 2;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
("COMMON.CGO"
|
||||
("los-control-h.o" "los-control-h")
|
||||
("airlock.o" "airlock")
|
||||
("water-anim.o" "water-anim")
|
||||
("blocking-plane.o" "blocking-plane")
|
||||
("idle-control.o" "idle-control")
|
||||
("dark-eco-pool.o" "dark-eco-pool")
|
||||
("enemy-h.o" "enemy-h")
|
||||
("nav-enemy-h.o" "nav-enemy-h")
|
||||
("rigid-body-h.o" "rigid-body-h")
|
||||
("enemy.o" "enemy")
|
||||
("nav-enemy.o" "nav-enemy")
|
||||
("base-plat.o" "base-plat")
|
||||
("plat.o" "plat")
|
||||
("basebutton.o" "basebutton")
|
||||
("bouncer.o" "bouncer")
|
||||
("conveyor.o" "conveyor")
|
||||
("elevator.o" "elevator")
|
||||
("rigid-body.o" "rigid-body")
|
||||
("rigid-body-queue.o" "rigid-body-queue")
|
||||
("rigid-body-plat.o" "rigid-body-plat")
|
||||
("joint-exploder.o" "joint-exploder")
|
||||
("simple-focus.o" "simple-focus")
|
||||
("simple-nav-sphere.o" "simple-nav-sphere")
|
||||
("process-taskable.o" "process-taskable")
|
||||
("scene-actor.o" "scene-actor")
|
||||
("scene-looper.o" "scene-looper")
|
||||
("warp-gate.o" "warp-gate")
|
||||
("guard-projectile.o" "guard-projectile")
|
||||
("metalhead-projectile.o" "metalhead-projectile")
|
||||
("los-control.o" "los-control")
|
||||
("grunt.o" "grunt")
|
||||
("flitter.o" "flitter")
|
||||
("battle.o" "battle")
|
||||
("elec-gate.o" "elec-gate")
|
||||
("cty-guard-turret-button.o" "cty-guard-turret-button")
|
||||
)
|
||||
@@ -0,0 +1,437 @@
|
||||
("GAME.CGO"
|
||||
("types-h.o" "types-h")
|
||||
("vu1-macros.o" "vu1-macros")
|
||||
("math.o" "math")
|
||||
("vector-h.o" "vector-h")
|
||||
("gravity-h.o" "gravity-h")
|
||||
("bounding-box-h.o" "bounding-box-h")
|
||||
("matrix-h.o" "matrix-h")
|
||||
("quaternion-h.o" "quaternion-h")
|
||||
("euler-h.o" "euler-h")
|
||||
("transform-h.o" "transform-h")
|
||||
("geometry-h.o" "geometry-h")
|
||||
("trigonometry-h.o" "trigonometry-h")
|
||||
("transformq-h.o" "transformq-h")
|
||||
("bounding-box.o" "bounding-box")
|
||||
("matrix.o" "matrix")
|
||||
("transform.o" "transform")
|
||||
("quaternion.o" "quaternion")
|
||||
("euler.o" "euler")
|
||||
("trigonometry.o" "trigonometry")
|
||||
("gsound-h.o" "gsound-h")
|
||||
("timer-h.o" "timer-h")
|
||||
("vif-h.o" "vif-h")
|
||||
("dma-h.o" "dma-h")
|
||||
("video-h.o" "video-h")
|
||||
("vu1-user-h.o" "vu1-user-h")
|
||||
("profile-h.o" "profile-h")
|
||||
("dma.o" "dma")
|
||||
("dma-buffer.o" "dma-buffer")
|
||||
("dma-bucket.o" "dma-bucket")
|
||||
("dma-disasm.o" "dma-disasm")
|
||||
("pad.o" "pad")
|
||||
("gs.o" "gs")
|
||||
("display-h.o" "display-h")
|
||||
("geometry.o" "geometry")
|
||||
("timer.o" "timer")
|
||||
("vector.o" "vector")
|
||||
("file-io.o" "file-io")
|
||||
("loader-h.o" "loader-h")
|
||||
("texture-h.o" "texture-h")
|
||||
("texture-anim-h.o" "texture-anim-h")
|
||||
("lights-h.o" "lights-h")
|
||||
("mood-h.o" "mood-h")
|
||||
("level-h.o" "level-h")
|
||||
("capture-h.o" "capture-h")
|
||||
("math-camera-h.o" "math-camera-h")
|
||||
("math-camera.o" "math-camera")
|
||||
("font-h.o" "font-h")
|
||||
("decomp-h.o" "decomp-h")
|
||||
("profile.o" "profile")
|
||||
("display.o" "display")
|
||||
("connect.o" "connect")
|
||||
("text-id-h.o" "text-id-h")
|
||||
("text-h.o" "text-h")
|
||||
("camera-defs-h.o" "camera-defs-h")
|
||||
("trail-h.o" "trail-h")
|
||||
("minimap-h.o" "minimap-h")
|
||||
("bigmap-h.o" "bigmap-h")
|
||||
("settings-h.o" "settings-h")
|
||||
("capture.o" "capture")
|
||||
("memory-usage-h.o" "memory-usage-h")
|
||||
("blit-displays-h.o" "blit-displays-h")
|
||||
("texture.o" "texture")
|
||||
("main-h.o" "main-h")
|
||||
("mspace-h.o" "mspace-h")
|
||||
("drawable-h.o" "drawable-h")
|
||||
("drawable-group-h.o" "drawable-group-h")
|
||||
("drawable-inline-array-h.o" "drawable-inline-array-h")
|
||||
("draw-node-h.o" "draw-node-h")
|
||||
("drawable-tree-h.o" "drawable-tree-h")
|
||||
("drawable-actor-h.o" "drawable-actor-h")
|
||||
("region-h.o" "region-h")
|
||||
("traffic-h.o" "traffic-h")
|
||||
("game-task-h.o" "game-task-h")
|
||||
("task-control-h.o" "task-control-h")
|
||||
("generic-h.o" "generic-h")
|
||||
("sky-h.o" "sky-h")
|
||||
("ocean-h.o" "ocean-h")
|
||||
("ocean-trans-tables.o" "ocean-trans-tables")
|
||||
("ocean-tables.o" "ocean-tables")
|
||||
("ocean-frames.o" "ocean-frames")
|
||||
("time-of-day-h.o" "time-of-day-h")
|
||||
("art-h.o" "art-h")
|
||||
("generic-vu1-h.o" "generic-vu1-h")
|
||||
("merc-h.o" "merc-h")
|
||||
("generic-merc-h.o" "generic-merc-h")
|
||||
("generic-tie-h.o" "generic-tie-h")
|
||||
("generic-work-h.o" "generic-work-h")
|
||||
("shadow-cpu-h.o" "shadow-cpu-h")
|
||||
("shadow-vu1-h.o" "shadow-vu1-h")
|
||||
("memcard-h.o" "memcard-h")
|
||||
("game-info-h.o" "game-info-h")
|
||||
("gui-h.o" "gui-h")
|
||||
("ambient-h.o" "ambient-h")
|
||||
("speech-h.o" "speech-h")
|
||||
("wind-h.o" "wind-h")
|
||||
("prototype-h.o" "prototype-h")
|
||||
("joint-h.o" "joint-h")
|
||||
("bones-h.o" "bones-h")
|
||||
("foreground-h.o" "foreground-h")
|
||||
("engines.o" "engines")
|
||||
("lightning-h.o" "lightning-h")
|
||||
("res-h.o" "res-h")
|
||||
("res.o" "res")
|
||||
("lights.o" "lights")
|
||||
("dynamics-h.o" "dynamics-h")
|
||||
("surface-h.o" "surface-h")
|
||||
("pat-h.o" "pat-h")
|
||||
("fact-h.o" "fact-h")
|
||||
("aligner-h.o" "aligner-h")
|
||||
("penetrate-h.o" "penetrate-h")
|
||||
("game-h.o" "game-h")
|
||||
("script-h.o" "script-h")
|
||||
("scene-h.o" "scene-h")
|
||||
("sync-info-h.o" "sync-info-h")
|
||||
("pov-camera-h.o" "pov-camera-h")
|
||||
("smush-control-h.o" "smush-control-h")
|
||||
("debug-h.o" "debug-h")
|
||||
("joint-mod-h.o" "joint-mod-h")
|
||||
("collide-func-h.o" "collide-func-h")
|
||||
("collide-mesh-h.o" "collide-mesh-h")
|
||||
("collide-shape-h.o" "collide-shape-h")
|
||||
("generic-obs-h.o" "generic-obs-h")
|
||||
("trajectory-h.o" "trajectory-h")
|
||||
("collide-target-h.o" "collide-target-h")
|
||||
("collide-touch-h.o" "collide-touch-h")
|
||||
("collide-edge-grab-h.o" "collide-edge-grab-h")
|
||||
("process-drawable-h.o" "process-drawable-h")
|
||||
("process-focusable.o" "process-focusable")
|
||||
("process-taskable-h.o" "process-taskable-h")
|
||||
("focus.o" "focus")
|
||||
("effect-control-h.o" "effect-control-h")
|
||||
("collide-frag-h.o" "collide-frag-h")
|
||||
("collide-hash-h.o" "collide-hash-h")
|
||||
("chain-physics-h.o" "chain-physics-h")
|
||||
("projectile-h.o" "projectile-h")
|
||||
("find-nearest-h.o" "find-nearest-h")
|
||||
("target-h.o" "target-h")
|
||||
("stats-h.o" "stats-h")
|
||||
("bsp-h.o" "bsp-h")
|
||||
("collide-cache-h.o" "collide-cache-h")
|
||||
("collide-h.o" "collide-h")
|
||||
("shrubbery-h.o" "shrubbery-h")
|
||||
("tie-h.o" "tie-h")
|
||||
("tfrag-h.o" "tfrag-h")
|
||||
("background-h.o" "background-h")
|
||||
("subdivide-h.o" "subdivide-h")
|
||||
("entity-h.o" "entity-h")
|
||||
("sprite-h.o" "sprite-h")
|
||||
("simple-sprite-h.o" "simple-sprite-h")
|
||||
("eye-h.o" "eye-h")
|
||||
("sparticle-launcher-h.o" "sparticle-launcher-h")
|
||||
("sparticle-h.o" "sparticle-h")
|
||||
("actor-link-h.o" "actor-link-h")
|
||||
("camera-h.o" "camera-h")
|
||||
("cam-debug-h.o" "cam-debug-h")
|
||||
("cam-interface-h.o" "cam-interface-h")
|
||||
("cam-update-h.o" "cam-update-h")
|
||||
("hud-h.o" "hud-h")
|
||||
("progress-h.o" "progress-h")
|
||||
("rpc-h.o" "rpc-h")
|
||||
("path-h.o" "path-h")
|
||||
("nav-mesh-h.o" "nav-mesh-h")
|
||||
("nav-control-h.o" "nav-control-h")
|
||||
("spatial-hash-h.o" "spatial-hash-h")
|
||||
("actor-hash-h.o" "actor-hash-h")
|
||||
("load-dgo.o" "load-dgo")
|
||||
("ramdisk.o" "ramdisk")
|
||||
("gsound.o" "gsound")
|
||||
("transformq.o" "transformq")
|
||||
("collide-func.o" "collide-func")
|
||||
("joint.o" "joint")
|
||||
("joint-mod.o" "joint-mod")
|
||||
("chain-physics.o" "chain-physics")
|
||||
("cylinder.o" "cylinder")
|
||||
("wind-work.o" "wind-work")
|
||||
("wind.o" "wind")
|
||||
("bsp.o" "bsp")
|
||||
("subdivide.o" "subdivide")
|
||||
("sprite.o" "sprite")
|
||||
("sprite-distort.o" "sprite-distort")
|
||||
("sprite-glow.o" "sprite-glow")
|
||||
("debug-sphere.o" "debug-sphere")
|
||||
("debug.o" "debug")
|
||||
("history.o" "history")
|
||||
("merc-vu1.o" "merc-vu1")
|
||||
("emerc-vu1.o" "emerc-vu1")
|
||||
("merc-blend-shape.o" "merc-blend-shape")
|
||||
("merc.o" "merc")
|
||||
("emerc.o" "emerc")
|
||||
("ripple.o" "ripple")
|
||||
("bones.o" "bones")
|
||||
("debug-foreground.o" "debug-foreground")
|
||||
("foreground.o" "foreground")
|
||||
("generic-vu0.o" "generic-vu0")
|
||||
("generic-vu1.o" "generic-vu1")
|
||||
("generic-effect.o" "generic-effect")
|
||||
("generic-merc.o" "generic-merc")
|
||||
("generic-tie.o" "generic-tie")
|
||||
("shadow-cpu.o" "shadow-cpu")
|
||||
("shadow-vu1.o" "shadow-vu1")
|
||||
("warp.o" "warp")
|
||||
("texture-anim.o" "texture-anim")
|
||||
("texture-anim-funcs.o" "texture-anim-funcs")
|
||||
("texture-anim-tables.o" "texture-anim-tables")
|
||||
("blit-displays.o" "blit-displays")
|
||||
("font-data.o" "font-data")
|
||||
("font.o" "font")
|
||||
("decomp.o" "decomp")
|
||||
("background.o" "background")
|
||||
("draw-node.o" "draw-node")
|
||||
("shrubbery.o" "shrubbery")
|
||||
("shrub-work.o" "shrub-work")
|
||||
("tfrag-near.o" "tfrag-near")
|
||||
("tfrag.o" "tfrag")
|
||||
("tfrag-methods.o" "tfrag-methods")
|
||||
("tfrag-work.o" "tfrag-work")
|
||||
("tie.o" "tie")
|
||||
("etie-vu1.o" "etie-vu1")
|
||||
("etie-near-vu1.o" "etie-near-vu1")
|
||||
("tie-near.o" "tie-near")
|
||||
("tie-work.o" "tie-work")
|
||||
("tie-methods.o" "tie-methods")
|
||||
("sync-info.o" "sync-info")
|
||||
("trajectory.o" "trajectory")
|
||||
("sparticle-launcher.o" "sparticle-launcher")
|
||||
("sparticle.o" "sparticle")
|
||||
("entity-table.o" "entity-table")
|
||||
("loader.o" "loader")
|
||||
("game-info.o" "game-info")
|
||||
("game-task.o" "game-task")
|
||||
("game-save.o" "game-save")
|
||||
("settings.o" "settings")
|
||||
("mood-tables.o" "mood-tables")
|
||||
("mood-tables2.o" "mood-tables2")
|
||||
("mood.o" "mood")
|
||||
("mood-funcs.o" "mood-funcs")
|
||||
("mood-funcs2.o" "mood-funcs2")
|
||||
("weather-part.o" "weather-part")
|
||||
("time-of-day.o" "time-of-day")
|
||||
("sky-data.o" "sky-data")
|
||||
("sky-tng.o" "sky-tng")
|
||||
("load-state.o" "load-state")
|
||||
("level-info.o" "level-info")
|
||||
("level.o" "level")
|
||||
("text.o" "text")
|
||||
("collide-hash.o" "collide-hash")
|
||||
("collide-probe.o" "collide-probe")
|
||||
("collide-frag.o" "collide-frag")
|
||||
("collide-mesh.o" "collide-mesh")
|
||||
("collide-touch.o" "collide-touch")
|
||||
("collide-edge-grab.o" "collide-edge-grab")
|
||||
("collide-shape.o" "collide-shape")
|
||||
("collide-shape-rider.o" "collide-shape-rider")
|
||||
("collide.o" "collide")
|
||||
("collide-planes.o" "collide-planes")
|
||||
("spatial-hash.o" "spatial-hash")
|
||||
("actor-hash.o" "actor-hash")
|
||||
("merc-death.o" "merc-death")
|
||||
("water-flow.o" "water-flow")
|
||||
("water-h.o" "water-h")
|
||||
("camera.o" "camera")
|
||||
("cam-interface.o" "cam-interface")
|
||||
("cam-master.o" "cam-master")
|
||||
("cam-states.o" "cam-states")
|
||||
("cam-states-dbg.o" "cam-states-dbg")
|
||||
("cam-combiner.o" "cam-combiner")
|
||||
("cam-update.o" "cam-update")
|
||||
("vol-h.o" "vol-h")
|
||||
("cam-layout.o" "cam-layout")
|
||||
("cam-debug.o" "cam-debug")
|
||||
("cam-start.o" "cam-start")
|
||||
("process-drawable.o" "process-drawable")
|
||||
("ambient.o" "ambient")
|
||||
("speech.o" "speech")
|
||||
("region.o" "region")
|
||||
("fma-sphere.o" "fma-sphere")
|
||||
("script.o" "script")
|
||||
("generic-obs.o" "generic-obs")
|
||||
("lightning.o" "lightning")
|
||||
("carry-h.o" "carry-h")
|
||||
("pilot-h.o" "pilot-h")
|
||||
("gun-h.o" "gun-h")
|
||||
("board-h.o" "board-h")
|
||||
("darkjak-h.o" "darkjak-h")
|
||||
("target-util.o" "target-util")
|
||||
("target-part.o" "target-part")
|
||||
("gun-part.o" "gun-part")
|
||||
("collide-reaction-target.o" "collide-reaction-target")
|
||||
("logic-target.o" "logic-target")
|
||||
("sidekick.o" "sidekick")
|
||||
("voicebox.o" "voicebox")
|
||||
("collectables-part.o" "collectables-part")
|
||||
("debug-part.o" "debug-part")
|
||||
("find-nearest.o" "find-nearest")
|
||||
("task-arrow.o" "task-arrow")
|
||||
("projectile.o" "projectile")
|
||||
("target-handler.o" "target-handler")
|
||||
("target-anim.o" "target-anim")
|
||||
("target.o" "target")
|
||||
("target2.o" "target2")
|
||||
("target-swim.o" "target-swim")
|
||||
("target-carry.o" "target-carry")
|
||||
("target-darkjak.o" "target-darkjak")
|
||||
("target-death.o" "target-death")
|
||||
("target-gun.o" "target-gun")
|
||||
("gun-util.o" "gun-util")
|
||||
("gun-blue-shot.o" "gun-blue-shot")
|
||||
("gun-yellow-shot.o" "gun-yellow-shot")
|
||||
("gun-red-shot.o" "gun-red-shot")
|
||||
("gun-dark-shot.o" "gun-dark-shot")
|
||||
("gun-states.o" "gun-states")
|
||||
("board-util.o" "board-util")
|
||||
("target-board.o" "target-board")
|
||||
("board-part.o" "board-part")
|
||||
("board-states.o" "board-states")
|
||||
("mech-h.o" "mech-h")
|
||||
("menu.o" "menu")
|
||||
("drawable.o" "drawable")
|
||||
("drawable-group.o" "drawable-group")
|
||||
("drawable-inline-array.o" "drawable-inline-array")
|
||||
("drawable-tree.o" "drawable-tree")
|
||||
("prototype.o" "prototype")
|
||||
("main-collide.o" "main-collide")
|
||||
("video.o" "video")
|
||||
("main.o" "main")
|
||||
("collide-cache.o" "collide-cache")
|
||||
("collide-debug.o" "collide-debug")
|
||||
("relocate.o" "relocate")
|
||||
("memory-usage.o" "memory-usage")
|
||||
("entity.o" "entity")
|
||||
("path.o" "path")
|
||||
("vol.o" "vol")
|
||||
("nav-mesh.o" "nav-mesh")
|
||||
("nav-control.o" "nav-control")
|
||||
("aligner.o" "aligner")
|
||||
("water.o" "water")
|
||||
("collectables.o" "collectables")
|
||||
("task-control.o" "task-control")
|
||||
("scene.o" "scene")
|
||||
("pov-camera.o" "pov-camera")
|
||||
("powerups.o" "powerups")
|
||||
("crates.o" "crates")
|
||||
("hud.o" "hud")
|
||||
("hud-classes.o" "hud-classes")
|
||||
("progress-static.o" "progress-static")
|
||||
("progress.o" "progress")
|
||||
("progress-draw.o" "progress-draw")
|
||||
("ocean.o" "ocean")
|
||||
("ocean-vu0.o" "ocean-vu0")
|
||||
("ocean-texture.o" "ocean-texture")
|
||||
("ocean-mid.o" "ocean-mid")
|
||||
("ocean-transition.o" "ocean-transition")
|
||||
("ocean-near.o" "ocean-near")
|
||||
("minimap.o" "minimap")
|
||||
("bigmap-data.o" "bigmap-data")
|
||||
("bigmap.o" "bigmap")
|
||||
("eye.o" "eye")
|
||||
("glist-h.o" "glist-h")
|
||||
("glist.o" "glist")
|
||||
("anim-tester.o" "anim-tester")
|
||||
("viewer.o" "viewer")
|
||||
("part-tester.o" "part-tester")
|
||||
("editable-h.o" "editable-h")
|
||||
("editable.o" "editable")
|
||||
("editable-player.o" "editable-player")
|
||||
("mysql-nav-graph.o" "mysql-nav-graph")
|
||||
("nav-graph-editor.o" "nav-graph-editor")
|
||||
("sampler.o" "sampler")
|
||||
("default-menu.o" "default-menu")
|
||||
("dir-tpages.go" "dir-tpages")
|
||||
("tpage-11.go" "tpage-11")
|
||||
("tpage-31.go" "tpage-31")
|
||||
("tpage-1804.go" "tpage-1804")
|
||||
("texture-upload.o" "texture-upload")
|
||||
("tpage-12.go" "tpage-12")
|
||||
("tpage-917.go" "tpage-917")
|
||||
("tpage-918.go" "tpage-918")
|
||||
("tpage-1106.go" "tpage-1106")
|
||||
("tpage-1141.go" "tpage-1141")
|
||||
("tpage-1658.go" "tpage-1658")
|
||||
("tpage-2841.go" "tpage-2841")
|
||||
("tpage-2932.go" "tpage-2932")
|
||||
("tpage-3076.go" "tpage-3076")
|
||||
("texture-finish.o" "texture-finish")
|
||||
("collectables-ag.go" "collectables")
|
||||
("ctywide-arrow-ag.go" "ctywide-arrow")
|
||||
("crate-ag.go" "crate")
|
||||
("talk-box-ag.go" "talk-box")
|
||||
("scenecamera-ag.go" "scenecamera")
|
||||
("eco-canister-ag.go" "eco-canister")
|
||||
("hud-ring-ag.go" "hud-ring")
|
||||
("jakb-ag.go" "jakb")
|
||||
("daxter-ag.go" "daxter")
|
||||
("board-ag.go" "board")
|
||||
("gun-ag.go" "gun")
|
||||
("jak-gun+0-ag.go" "jak-gun+0")
|
||||
("jak-board+0-ag.go" "jak-board+0")
|
||||
("jak-dark+0-ag.go" "jak-dark+0")
|
||||
("jak-swim+0-ag.go" "jak-swim+0")
|
||||
("blocking-plane-ag.go" "blocking-plane")
|
||||
("los-control-h.o" "los-control-h")
|
||||
("airlock.o" "airlock")
|
||||
("water-anim.o" "water-anim")
|
||||
("blocking-plane.o" "blocking-plane")
|
||||
("idle-control.o" "idle-control")
|
||||
("dark-eco-pool.o" "dark-eco-pool")
|
||||
("enemy-h.o" "enemy-h")
|
||||
("nav-enemy-h.o" "nav-enemy-h")
|
||||
("rigid-body-h.o" "rigid-body-h")
|
||||
("enemy.o" "enemy")
|
||||
("nav-enemy.o" "nav-enemy")
|
||||
("base-plat.o" "base-plat")
|
||||
("plat.o" "plat")
|
||||
("basebutton.o" "basebutton")
|
||||
("bouncer.o" "bouncer")
|
||||
("conveyor.o" "conveyor")
|
||||
("elevator.o" "elevator")
|
||||
("rigid-body.o" "rigid-body")
|
||||
("rigid-body-queue.o" "rigid-body-queue")
|
||||
("rigid-body-plat.o" "rigid-body-plat")
|
||||
("joint-exploder.o" "joint-exploder")
|
||||
("simple-focus.o" "simple-focus")
|
||||
("simple-nav-sphere.o" "simple-nav-sphere")
|
||||
("process-taskable.o" "process-taskable")
|
||||
("scene-actor.o" "scene-actor")
|
||||
("scene-looper.o" "scene-looper")
|
||||
("warp-gate.o" "warp-gate")
|
||||
("guard-projectile.o" "guard-projectile")
|
||||
("metalhead-projectile.o" "metalhead-projectile")
|
||||
("los-control.o" "los-control")
|
||||
("grunt.o" "grunt")
|
||||
("flitter.o" "flitter")
|
||||
("battle.o" "battle")
|
||||
("elec-gate.o" "elec-gate")
|
||||
("cty-guard-turret-button.o" "cty-guard-turret-button")
|
||||
)
|
||||
@@ -19,25 +19,18 @@
|
||||
(defun cam-start ((arg0 symbol))
|
||||
(cam-stop)
|
||||
(set! *camera-combiner*
|
||||
(the-as camera-combiner (ppointer->process (process-spawn
|
||||
camera-combiner
|
||||
:init cam-combiner-init
|
||||
:name (symbol->string (-> camera-combiner symbol))
|
||||
:from *camera-dead-pool*
|
||||
:to *camera-pool*
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as camera-combiner
|
||||
(ppointer->process
|
||||
(process-spawn camera-combiner :init cam-combiner-init :from *camera-dead-pool* :to *camera-pool*)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! *camera* (the-as camera-master (ppointer->process (process-spawn
|
||||
camera-master
|
||||
:init cam-master-init
|
||||
:name (symbol->string (-> camera-master symbol))
|
||||
:from *camera-master-dead-pool*
|
||||
:to *camera-pool*
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! *camera*
|
||||
(the-as camera-master
|
||||
(ppointer->process
|
||||
(process-spawn camera-master :init cam-master-init :from *camera-master-dead-pool* :to *camera-pool*)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if arg0
|
||||
(reset-cameras)
|
||||
@@ -46,7 +39,10 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
(cam-start #f)
|
||||
;; removed because it doesn't work yet.
|
||||
(format #t "skipping cam-start~%")
|
||||
(format 0 "skipping cam-start~%")
|
||||
; (cam-start #f)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -116,9 +116,9 @@
|
||||
(:methods
|
||||
(new (symbol type) _type_ 0)
|
||||
(touching-list-method-9 () none 9)
|
||||
(touching-list-method-10 () none 10)
|
||||
(free-nodes (_type_) none 10)
|
||||
(touching-list-method-11 () none 11)
|
||||
(touching-list-method-12 () none 12)
|
||||
(send-events-for-touching-shapes (_type_) none 12)
|
||||
(touching-list-method-13 () none 13)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -59,9 +59,9 @@
|
||||
:size-assert #x710
|
||||
:flag-assert #xc00000710
|
||||
(:methods
|
||||
(memory-usage-block-method-9 () none 9)
|
||||
(reset! (_type_) _type_ 9)
|
||||
(memory-usage-block-method-10 () none 10)
|
||||
(memory-usage-block-method-11 () none 11)
|
||||
(print-mem-usage (_type_ level object) none 11)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
;; name in dgo: drawable-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(declare-type region-prim-list structure)
|
||||
;; NOTE - for sparticle-launcher
|
||||
(define-extern sphere-in-view-frustum? (function sphere symbol))
|
||||
|
||||
@@ -22,10 +23,10 @@
|
||||
(draw (_type_ _type_ display-frame) none 10)
|
||||
(drawable-method-11 () none 11)
|
||||
(drawable-method-12 () none 12)
|
||||
(drawable-method-13 () none 13)
|
||||
(collect-stats (_type_) none 13)
|
||||
(debug-draw (_type_ drawable display-frame) none 14)
|
||||
(unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 15)
|
||||
(drawable-method-16 () none 16)
|
||||
(collect-regions (_type_ sphere int region-prim-list) none 16)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -7,3 +7,841 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; sphere-cull
|
||||
;; guard-band-cull
|
||||
;; sphere-in-view-frustum?
|
||||
;; line-in-view-frustum?
|
||||
;; vis-cull
|
||||
;; error-sphere
|
||||
|
||||
;; drawable methods
|
||||
|
||||
(defun real-main-draw-hook ()
|
||||
(local-vars (a0-96 int) (a0-98 int))
|
||||
(with-pp
|
||||
(when *slow-frame-rate*
|
||||
(dotimes (v1-2 #xc35000)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
)
|
||||
)
|
||||
"Function to be executed to set up for engine dma"
|
||||
|
||||
;; update render/texture upload masks
|
||||
(set! (-> *display* vu1-enable-user) (-> *display* vu1-enable-user-menu))
|
||||
;(set! (-> *texture-pool* texture-enable-user) (-> *texture-pool* texture-enable-user-menu))
|
||||
|
||||
;; display memory stats
|
||||
; (when *debug-segment*
|
||||
; (when (and *stats-memory* (!= *master-mode* 'menu))
|
||||
; (cond
|
||||
; (*stats-memory-short*
|
||||
; (dotimes (gp-0 (-> *level* length))
|
||||
; (let ((s5-0 (-> *level* level gp-0)))
|
||||
; (if (= (-> s5-0 status) 'active)
|
||||
; (print-mem-usage (compute-memory-usage s5-0 #f) s5-0 *stdcon*)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; (else
|
||||
; (let ((gp-1 (-> *level* level *stats-memory-level-index*)))
|
||||
; (if (and gp-1 (= (-> gp-1 status) 'active))
|
||||
; (print-mem-usage (compute-memory-usage gp-1 #f) gp-1 *stdcon*)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; (reset! *dma-mem-usage*)
|
||||
; )
|
||||
|
||||
;; set up foreground buckets
|
||||
; (foreground-initialize-engines)
|
||||
|
||||
;; update time of day and wind effects.
|
||||
; (let ((gp-2 (-> pp clock)))
|
||||
; (if (= (-> *time-of-day-context* mode) (time-of-day-palette-id unk3))
|
||||
; (set! (-> pp clock) (-> *display* bg-clock))
|
||||
; (set! (-> pp clock) (-> *display* real-clock))
|
||||
; )
|
||||
; (if (not (paused?))
|
||||
; (update-wind *wind-work* *wind-scales*)
|
||||
; )
|
||||
; (update-time-of-day *time-of-day-context*)
|
||||
; (set! (-> pp clock) gp-2)
|
||||
; )
|
||||
|
||||
|
||||
;; draw the sky
|
||||
(with-profiler 'sky *profile-sky-color*
|
||||
; (if (-> *sky-work* draw-vortex)
|
||||
; (draw-vortex)
|
||||
; (draw *sky-work*)
|
||||
; )
|
||||
(flush-cache 0)
|
||||
)
|
||||
|
||||
;; draw the ocean
|
||||
; (let ((gp-5 (-> pp clock)))
|
||||
; (if (= (-> *time-of-day-context* mode) (time-of-day-palette-id unk3))
|
||||
; (set! (-> pp clock) (-> *display* bg-clock))
|
||||
; (set! (-> pp clock) (-> *display* real-clock))
|
||||
; )
|
||||
; (with-profiler 'ocean *profile-ocean-color*
|
||||
; (draw! *ocean*)
|
||||
; (if *ocean-map*
|
||||
; (update-map *ocean*)
|
||||
; )
|
||||
; )
|
||||
; (set! (-> pp clock) gp-5)
|
||||
; )
|
||||
|
||||
;; run the foreground system
|
||||
; (foreground-engine-execute *foreground-draw-engine* (-> *display* frames (-> *display* on-screen)))
|
||||
; (let ((gp-6 (-> pp clock)))
|
||||
; (if (= (-> *time-of-day-context* mode) (time-of-day-palette-id unk3))
|
||||
; (set! (-> pp clock) (-> *display* bg-clock))
|
||||
; (set! (-> pp clock) (-> *display* real-clock))
|
||||
; )
|
||||
; (foreground-execute-cpu-vu0-engines)
|
||||
; (set! (-> pp clock) gp-6)
|
||||
; )
|
||||
|
||||
;; ??
|
||||
; (when *add-sphere*
|
||||
; )
|
||||
|
||||
;; run the sprite/particle system.
|
||||
; (if (not (paused?))
|
||||
; (execute-part-engine)
|
||||
; )
|
||||
; (if (logtest? (vu1-renderer-mask rn29) (-> *display* vu1-enable-user))
|
||||
; (sprite-draw *display*)
|
||||
; )
|
||||
|
||||
;; debug draw collision stuff before processing it.
|
||||
(when *debug-segment*
|
||||
; (debug-draw-actors *level* *display-actor-marks*)
|
||||
; (collide-shape-draw-debug-marks)
|
||||
)
|
||||
|
||||
;; after debug drawing, send events to actors
|
||||
; (send-events-for-touching-shapes *touching-list*)
|
||||
; (free-nodes *touching-list*)
|
||||
; (prepare *collide-rider-pool*)
|
||||
; (send-all! *event-queue*)
|
||||
|
||||
;; spawn/update actors
|
||||
(with-profiler 'update-actors *profile-update-actors-color*
|
||||
;(actors-update *level*)
|
||||
)
|
||||
|
||||
;; ??
|
||||
(with-profiler 'nav *profile-nav-color*
|
||||
;; ((method-of-object *level* level-group-method-18))
|
||||
)
|
||||
|
||||
#|
|
||||
(when *debug-segment*
|
||||
(let ((gp-11 (-> *display* frames (-> *display* on-screen) profile-array data 0))
|
||||
(v1-255 'background)
|
||||
(s5-9 *profile-background-color*)
|
||||
)
|
||||
(when (and *dproc* *debug-segment*)
|
||||
(let ((s4-8 (-> gp-11 data (-> gp-11 count))))
|
||||
(let ((s3-5 (-> gp-11 base-time)))
|
||||
(set! (-> s4-8 name) v1-255)
|
||||
(set! (-> s4-8 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-5))))
|
||||
)
|
||||
(set! (-> s4-8 depth) (the-as uint (-> gp-11 depth)))
|
||||
(set! (-> s4-8 color) s5-9)
|
||||
(set! (-> gp-11 segment (-> gp-11 depth)) s4-8)
|
||||
)
|
||||
(+! (-> gp-11 count) 1)
|
||||
(+! (-> gp-11 depth) 1)
|
||||
(set! (-> gp-11 max-depth) (max (-> gp-11 max-depth) (-> gp-11 depth)))
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
(init-background)
|
||||
(execute-connections *background-draw-engine* (-> *display* frames (-> *display* on-screen)))
|
||||
(let* ((v1-275 (&-> *perf-stats* data 32 accum0))
|
||||
(a0-94 (-> v1-275 7))
|
||||
)
|
||||
(+! (-> v1-275 1) 1)
|
||||
(b! (zero? a0-94) cfg-116 :delay (nop!))
|
||||
(.mtc0 Perf r0)
|
||||
(.sync.l)
|
||||
(.sync.p)
|
||||
(.mtpc pcr0 r0)
|
||||
(.mtpc pcr1 r0)
|
||||
(.sync.l)
|
||||
(.sync.p)
|
||||
(.mtc0 Perf a0-94)
|
||||
)
|
||||
(.sync.l)
|
||||
(.sync.p)
|
||||
(label cfg-116)
|
||||
0
|
||||
(finish-background)
|
||||
(let ((v1-278 (&-> *perf-stats* data 32 accum0)))
|
||||
(b! (zero? (-> v1-278 7)) cfg-118 :delay (nop!))
|
||||
(.mtc0 Perf r0)
|
||||
(.sync.l)
|
||||
(.sync.p)
|
||||
(.mfpc a0-96 pcr0)
|
||||
(+! (-> v1-278 8) a0-96)
|
||||
(.mfpc a0-98 pcr1)
|
||||
(+! (-> v1-278 9) a0-98)
|
||||
)
|
||||
(label cfg-118)
|
||||
0
|
||||
((method-of-type perf-stat update-wait-stats)
|
||||
(the-as perf-stat (&-> *perf-stats* data 32 accum0))
|
||||
(-> *background-work* wait-to-vu0)
|
||||
(the-as uint 0)
|
||||
(the-as uint 0)
|
||||
)
|
||||
(b! (not *debug-segment*) cfg-126 :delay (empty-form))
|
||||
(let ((gp-12 (-> *display* frames (-> *display* on-screen) profile-array data 0)))
|
||||
(when (and *dproc* *debug-segment*)
|
||||
(let* ((v1-295 (+ (-> gp-12 depth) -1))
|
||||
(s5-10 (-> gp-12 segment v1-295))
|
||||
(s4-9 (-> gp-12 base-time))
|
||||
)
|
||||
(when (>= v1-295 0)
|
||||
(set! (-> s5-10 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-9))))
|
||||
(+! (-> gp-12 depth) -1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(label cfg-126)
|
||||
(end-perf-stat-collection)
|
||||
(when (and (!= *master-mode* 'menu) *stats-poly*)
|
||||
(dotimes (gp-13 (-> *level* length))
|
||||
(let ((v1-307 (-> *level* level gp-13)))
|
||||
(if (= (-> v1-307 status) 'active)
|
||||
(collect-stats (-> v1-307 bsp))
|
||||
)
|
||||
)
|
||||
)
|
||||
(print-terrain-stats)
|
||||
)
|
||||
(when (not (paused?))
|
||||
(if (and (!= *master-mode* 'menu) *stats-perf*)
|
||||
(print-perf-stats)
|
||||
)
|
||||
(if (and (!= *master-mode* 'menu) *stats-collide*)
|
||||
(print-collide-stats)
|
||||
)
|
||||
)
|
||||
(start-perf-stat-collection)
|
||||
|#
|
||||
0
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
(defun main-draw-hook ()
|
||||
(real-main-draw-hook)
|
||||
(none)
|
||||
)
|
||||
|
||||
(define *draw-hook* main-draw-hook)
|
||||
|
||||
(defun default-init-buffer ((arg0 bucket-id) (arg1 gs-zbuf) (arg2 gs-test))
|
||||
(let ((v1-6 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
|
||||
(when (!= v1-6 (-> v1-6 last))
|
||||
(let* ((a0-8 (-> *display* frames (-> *display* on-screen) global-buf))
|
||||
(a3-3 (-> a0-8 base))
|
||||
)
|
||||
(let* ((t0-0 a0-8)
|
||||
(t1-0 (the-as dma-packet (-> t0-0 base)))
|
||||
)
|
||||
(set! (-> t1-0 dma) (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt)))
|
||||
(set! (-> t1-0 vif0) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
|
||||
(set! (-> t1-0 vif1) (new 'static 'vif-tag :imm #xa :cmd (vif-cmd direct) :msk #x1))
|
||||
(set! (-> t0-0 base) (the-as pointer (&+ t1-0 16)))
|
||||
)
|
||||
(let* ((t0-1 a0-8)
|
||||
(t1-2 (the-as object (-> t0-1 base)))
|
||||
)
|
||||
(set! (-> (the-as gs-gif-tag t1-2) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x9))
|
||||
(set! (-> (the-as gs-gif-tag t1-2) regs) (new 'static 'gif-tag-regs
|
||||
:regs0 (gif-reg-id a+d)
|
||||
:regs1 (gif-reg-id a+d)
|
||||
:regs2 (gif-reg-id a+d)
|
||||
:regs3 (gif-reg-id a+d)
|
||||
:regs4 (gif-reg-id a+d)
|
||||
:regs5 (gif-reg-id a+d)
|
||||
:regs6 (gif-reg-id a+d)
|
||||
:regs7 (gif-reg-id a+d)
|
||||
:regs8 (gif-reg-id a+d)
|
||||
:regs9 (gif-reg-id a+d)
|
||||
:regs10 (gif-reg-id a+d)
|
||||
:regs11 (gif-reg-id a+d)
|
||||
:regs12 (gif-reg-id a+d)
|
||||
:regs13 (gif-reg-id a+d)
|
||||
:regs14 (gif-reg-id a+d)
|
||||
:regs15 (gif-reg-id a+d)
|
||||
)
|
||||
)
|
||||
(set! (-> t0-1 base) (&+ (the-as pointer t1-2) 16))
|
||||
)
|
||||
(let* ((t0-2 a0-8)
|
||||
(t1-4 (-> t0-2 base))
|
||||
)
|
||||
(set! (-> (the-as (pointer gs-zbuf) t1-4) 0) arg1)
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 1) (gs-reg64 zbuf-1))
|
||||
(set! (-> (the-as (pointer gs-test) t1-4) 2) arg2)
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 3) (gs-reg64 test-1))
|
||||
(set! (-> (the-as (pointer gs-alpha) t1-4) 4) (new 'static 'gs-alpha :b #x1 :d #x1))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 5) (gs-reg64 alpha-1))
|
||||
(set! (-> (the-as (pointer uint64) t1-4) 6) (the-as uint 0))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 7) (gs-reg64 pabe))
|
||||
(set! (-> (the-as (pointer gs-clamp) t1-4) 8)
|
||||
(new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp))
|
||||
)
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 9) (gs-reg64 clamp-1))
|
||||
(set! (-> (the-as (pointer gs-tex0) t1-4) 10) (new 'static 'gs-tex0 :tbp0 #x60))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 11) (gs-reg64 tex1-1))
|
||||
(set! (-> (the-as (pointer gs-texa) t1-4) 12) (new 'static 'gs-texa :ta1 #x80))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 13) (gs-reg64 texa))
|
||||
(set! (-> (the-as (pointer gs-texclut) t1-4) 14) (new 'static 'gs-texclut :cbw #x4))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 15) (gs-reg64 texclut))
|
||||
(set! (-> (the-as (pointer uint64) t1-4) 16) (the-as uint *fog-color*))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 17) (gs-reg64 fogcol))
|
||||
(set! (-> t0-2 base) (&+ t1-4 144))
|
||||
)
|
||||
(let ((a1-18 (the-as object (-> a0-8 base))))
|
||||
(set! (-> (the-as dma-packet a1-18) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> v1-6 next)))
|
||||
(set! (-> (the-as dma-packet a1-18) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet a1-18) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> a0-8 base) (&+ (the-as pointer a1-18) 16))
|
||||
)
|
||||
(set! (-> v1-6 next) (the-as uint a3-3))
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun default-end-buffer ((arg0 bucket-id) (arg1 gs-zbuf) (arg2 gs-test))
|
||||
(let ((v1-6 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
|
||||
(when (!= v1-6 (-> v1-6 last))
|
||||
(let* ((a3-2 (-> *display* frames (-> *display* on-screen) global-buf))
|
||||
(a0-8 (-> a3-2 base))
|
||||
)
|
||||
(let* ((t0-1 a3-2)
|
||||
(t1-0 (the-as dma-packet (-> t0-1 base)))
|
||||
)
|
||||
(set! (-> t1-0 dma) (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt)))
|
||||
(set! (-> t1-0 vif0) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
|
||||
(set! (-> t1-0 vif1) (new 'static 'vif-tag :imm #xa :cmd (vif-cmd direct) :msk #x1))
|
||||
(set! (-> t0-1 base) (the-as pointer (&+ t1-0 16)))
|
||||
)
|
||||
(let* ((t0-2 a3-2)
|
||||
(t1-2 (the-as object (-> t0-2 base)))
|
||||
)
|
||||
(set! (-> (the-as gs-gif-tag t1-2) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x9))
|
||||
(set! (-> (the-as gs-gif-tag t1-2) regs) (new 'static 'gif-tag-regs
|
||||
:regs0 (gif-reg-id a+d)
|
||||
:regs1 (gif-reg-id a+d)
|
||||
:regs2 (gif-reg-id a+d)
|
||||
:regs3 (gif-reg-id a+d)
|
||||
:regs4 (gif-reg-id a+d)
|
||||
:regs5 (gif-reg-id a+d)
|
||||
:regs6 (gif-reg-id a+d)
|
||||
:regs7 (gif-reg-id a+d)
|
||||
:regs8 (gif-reg-id a+d)
|
||||
:regs9 (gif-reg-id a+d)
|
||||
:regs10 (gif-reg-id a+d)
|
||||
:regs11 (gif-reg-id a+d)
|
||||
:regs12 (gif-reg-id a+d)
|
||||
:regs13 (gif-reg-id a+d)
|
||||
:regs14 (gif-reg-id a+d)
|
||||
:regs15 (gif-reg-id a+d)
|
||||
)
|
||||
)
|
||||
(set! (-> t0-2 base) (&+ (the-as pointer t1-2) 16))
|
||||
)
|
||||
(let* ((t0-3 a3-2)
|
||||
(t1-4 (-> t0-3 base))
|
||||
)
|
||||
(set! (-> (the-as (pointer gs-zbuf) t1-4) 0) arg1)
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 1) (gs-reg64 zbuf-1))
|
||||
(set! (-> (the-as (pointer gs-test) t1-4) 2) arg2)
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 3) (gs-reg64 test-1))
|
||||
(set! (-> (the-as (pointer gs-alpha) t1-4) 4) (new 'static 'gs-alpha :b #x1 :d #x1))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 5) (gs-reg64 alpha-1))
|
||||
(set! (-> (the-as (pointer uint64) t1-4) 6) (the-as uint 0))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 7) (gs-reg64 pabe))
|
||||
(set! (-> (the-as (pointer gs-clamp) t1-4) 8)
|
||||
(new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp))
|
||||
)
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 9) (gs-reg64 clamp-1))
|
||||
(set! (-> (the-as (pointer gs-tex0) t1-4) 10) (new 'static 'gs-tex0 :tbp0 #x60))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 11) (gs-reg64 tex1-1))
|
||||
(set! (-> (the-as (pointer gs-texa) t1-4) 12) (new 'static 'gs-texa :ta1 #x80))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 13) (gs-reg64 texa))
|
||||
(set! (-> (the-as (pointer gs-texclut) t1-4) 14) (new 'static 'gs-texclut :cbw #x4))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 15) (gs-reg64 texclut))
|
||||
(set! (-> (the-as (pointer uint64) t1-4) 16) (the-as uint *fog-color*))
|
||||
(set! (-> (the-as (pointer gs-reg64) t1-4) 17) (gs-reg64 fogcol))
|
||||
(set! (-> t0-3 base) (&+ t1-4 144))
|
||||
)
|
||||
(let ((t0-4 (-> a3-2 base)))
|
||||
(let ((a1-18 (the-as object (-> a3-2 base))))
|
||||
(set! (-> (the-as dma-packet a1-18) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
|
||||
(set! (-> (the-as dma-packet a1-18) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet a1-18) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> a3-2 base) (&+ (the-as pointer a1-18) 16))
|
||||
)
|
||||
(set! (-> (the-as dma-bucket (-> v1-6 last)) next) (the-as uint a0-8))
|
||||
(set! (-> v1-6 last) (the-as (pointer dma-tag) t0-4))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
(defun display-frame-start ((arg0 display) (arg1 int) (arg2 float))
|
||||
"Advance clocks, poll pads/mouse, set up buckets."
|
||||
;; workaround for PS2 HW bug
|
||||
; (set! (-> (the-as vif-bank #x10003c00) err me0) 1)
|
||||
;; tick frame clocks
|
||||
(set-time-ratios *display* 1.0)
|
||||
(tick! (-> arg0 frame-clock))
|
||||
(tick! (-> arg0 real-frame-clock))
|
||||
|
||||
;; tick other clocks
|
||||
(set-time-ratios *display* arg2)
|
||||
(tick! (-> arg0 session-clock))
|
||||
(tick! (-> arg0 game-clock))
|
||||
(tick! (-> arg0 total-game-clock))
|
||||
(tick! (-> arg0 base-clock))
|
||||
(tick! (-> arg0 real-clock))
|
||||
(tick! (-> arg0 target-clock))
|
||||
(tick! (-> arg0 camera-clock))
|
||||
(tick! (-> arg0 entity-clock))
|
||||
(tick! (-> arg0 user0-clock))
|
||||
(tick! (-> arg0 bg-clock))
|
||||
(set! (-> arg0 bg-clock frame-counter) (the-as time-frame (mod (-> arg0 bg-clock frame-counter) #x69780)))
|
||||
(tick! (-> arg0 part-clock))
|
||||
|
||||
; (when (and (nonzero? *screen-shot-work*) (!= (-> *screen-shot-work* count) -1))
|
||||
; (let ((v1-43 (-> *screen-shot-work* size)))
|
||||
; (if (!= (-> *screen-shot-work* count) (* v1-43 v1-43))
|
||||
; (store-image *screen-shot-work*)
|
||||
; )
|
||||
; )
|
||||
; (+! (-> *screen-shot-work* count) -1)
|
||||
; (if (= (-> *screen-shot-work* count) -1)
|
||||
; (set! (-> *screen-shot-work* size) -1)
|
||||
; )
|
||||
; )
|
||||
|
||||
(let ((s5-1 (-> arg0 frames arg1)))
|
||||
(if *sync-dma*
|
||||
(sync-path 0 0)
|
||||
)
|
||||
|
||||
(let ((v1-57 (-> s5-1 global-buf)))
|
||||
(set! (-> v1-57 base) (-> v1-57 data))
|
||||
(set! (-> v1-57 end) (&-> v1-57 data-buffer (-> v1-57 allocated-length)))
|
||||
)
|
||||
(let ((v1-58 (-> s5-1 global-buf)))
|
||||
(&+! (-> v1-58 end) -65536)
|
||||
)
|
||||
(when *debug-segment*
|
||||
(let ((v1-61 (-> s5-1 debug-buf)))
|
||||
(set! (-> v1-61 base) (-> v1-61 data))
|
||||
(set! (-> v1-61 end) (&-> v1-61 data-buffer (-> v1-61 allocated-length)))
|
||||
)
|
||||
)
|
||||
(let ((v1-62 (-> s5-1 calc-buf)))
|
||||
(set! (-> v1-62 base) (-> v1-62 data))
|
||||
(set! (-> v1-62 end) (&-> v1-62 data-buffer (-> v1-62 allocated-length)))
|
||||
)
|
||||
(*pre-draw-hook* (-> s5-1 calc-buf))
|
||||
(when (not (paused?))
|
||||
(clear *stdcon1*)
|
||||
;(debug-reset-buffers)
|
||||
;(clear! *simple-sprite-system*)
|
||||
)
|
||||
(set! (-> s5-1 bucket-group) (dma-buffer-add-buckets (-> s5-1 calc-buf) 327))
|
||||
)
|
||||
|
||||
; (service-cpads)
|
||||
; (service-mouse)
|
||||
; (execute-connections *pad-engine* #f)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun pc-maybe-vsync ()
|
||||
"PC Port implementation of the block of code in display-sync that computes frame-time-ratio and maybe vsyncs."
|
||||
;; for now, it's very simple.
|
||||
|
||||
;; I think the right logic in the future is to always vsync here, but return a more accurate dog ratio.
|
||||
|
||||
(syncv 0) ;; sync always!
|
||||
;(set! *ticks-per-frame* 9765) ;; hack!
|
||||
1.0 ;; and report that we run at full speed.
|
||||
)
|
||||
|
||||
(defun display-sync ((arg0 display))
|
||||
"Determine frame timing, possibly vsync, and kick off next DMA.
|
||||
This also calls sync-path, but this appears redundant because the display loop did this already."
|
||||
|
||||
;; The "rendered" frame is the one that has had its DMA processed and is completed and in VRAM.
|
||||
;; The "drawn" frame is the one that has DMA ready, but not sent.
|
||||
;; The "vblank period" is how long in between actual frames on the TV. This is 16.67 ms for NTSC.
|
||||
|
||||
;; This function will kick off the drawn frame's DMA, possibly vsync, and update timing stuff.
|
||||
;; Currently, I believe the _start_ of the drawn frame's DMA will do the "blit" to move
|
||||
;; the "rendered" frame's image from the drawing buffer to the frame buffer, but it's possible I have this backward.
|
||||
|
||||
;; apparently useless sync
|
||||
;; everything in here happens after DMA is done.
|
||||
(sync-path 0 0)
|
||||
|
||||
(let* ((just-rendered-frame (-> arg0 last-screen))
|
||||
(current-time (shl (timer1-time) 48))
|
||||
(just-rendered-frame-start-time (shl (-> arg0 frames just-rendered-frame start-time) 48))
|
||||
(prev-vblank-time-1 (shl (-> arg0 vblank-start-time 0) 48))
|
||||
(prev-vblank-time-2 (shl (-> arg0 vblank-start-time 1) 48))
|
||||
)
|
||||
|
||||
;; measure the actual *ticks-per-frame* by comparing the timings of the last two vblanks.
|
||||
;; I think this should be constant for PAL/NTSC, the vblank interrupt happens no matter what and is based
|
||||
;; on the TV timing stuff.
|
||||
;(set! *ticks-per-frame* (sar (- prev-vblank-time-2 prev-vblank-time-1) 48))
|
||||
(set! *ticks-per-frame* 9765) ;; HACK
|
||||
|
||||
(let* ((ticks-per-frame-f (the float *ticks-per-frame*))
|
||||
;; how long we spent on this frame (measured from the dma-send until now)
|
||||
(frame-duration (the float (sar (- current-time (the-as uint just-rendered-frame-start-time)) 48)))
|
||||
;; how long we spent on this frame, as a fraction of the time between vblanks (the actual TV framerate)
|
||||
(frame-time-ratio (/ frame-duration ticks-per-frame-f))
|
||||
)
|
||||
(/ (the float (sar (- current-time (the-as uint prev-vblank-time-2)) 48)) ticks-per-frame-f)
|
||||
|
||||
;; how close we are to the next vblank (should be between 0 and 1)
|
||||
(let ((vysnc-progress (/ (the float (sar (- current-time (the-as uint prev-vblank-time-2)) 48)) ticks-per-frame-f))
|
||||
;; the "lag ratio" of the frame that was just drawn.
|
||||
(last-dog (fmax 1.0 (fmin 4.0 (-> *display* dog-ratio))))
|
||||
)
|
||||
(set! (-> arg0 frames just-rendered-frame run-time) (the-as time-frame (the int frame-duration)))
|
||||
|
||||
;; next, we'll compute this "lag" ratio (will become dog-ratio of the next frame).
|
||||
;; higher numbers = game running slower = bigger timesteps
|
||||
#|
|
||||
(set! frame-time-ratio
|
||||
(cond
|
||||
((-> arg0 run-half-speed)
|
||||
;; running at half speed flag is likely used for debugging? It forces 1 vsync here always.
|
||||
(syncv 0)
|
||||
|
||||
;; do a vysnc if we are both:
|
||||
;; - took less than 2 vblank periods to do the last frame (we finished early)
|
||||
;; - we have more than 10% of the frame left.
|
||||
;; see the comments in the next section for a better explanation of why they do this.
|
||||
(if (and (< (/ (the float (sar (- (shl (timer1-time) 48) (the-as uint just-rendered-frame-start-time)) 48))
|
||||
ticks-per-frame-f
|
||||
)
|
||||
2.0
|
||||
)
|
||||
(< vysnc-progress 0.9)
|
||||
)
|
||||
(syncv 0)
|
||||
)
|
||||
|
||||
;; report a dog-ratio of exactly 2 always, for this debug mode
|
||||
2.0
|
||||
)
|
||||
(else
|
||||
;; not using the half-speed debug option.
|
||||
|
||||
(cond
|
||||
;; case where we're lagging and don't want to vsync usually.
|
||||
((< 1.0 frame-time-ratio)
|
||||
;; we're lagging! In this case, we usually don't bother with vsync, and there would be tearing.
|
||||
|
||||
;; not sure about this check, but I guess we never vysnc here if we're on the first 2 frames of the game?
|
||||
(when (not (or (zero? prev-vblank-time-1) (zero? prev-vblank-time-2)))
|
||||
;; if the force sync counter is set, do a vsync and decrease the counter.
|
||||
(when (> (-> arg0 force-sync) 0)
|
||||
(syncv 0)
|
||||
(+! (-> arg0 force-sync) -1)
|
||||
|
||||
;; update the frame-time-ratio because we just made this frame longer by vsyncing.
|
||||
(let ((v1-23 (shl (timer1-time) 48)))
|
||||
(the float (sar (- v1-23 (the-as uint just-rendered-frame-start-time)) 48))
|
||||
(set! frame-time-ratio
|
||||
(/ (the float (sar (- v1-23 (the-as uint just-rendered-frame-start-time)) 48)) ticks-per-frame-f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; this "dog-count" thing can be set to 1.0 if the game thinks that its running fast enough for full framerate
|
||||
;; but the frame start time is misaligned with the actual TV's vblank.
|
||||
;; we are lagging here, so we don't want this, and dog-count should be set to 0
|
||||
(set! (-> arg0 dog-count) 0.0)
|
||||
)
|
||||
|
||||
;; case where we're vsyncing.
|
||||
;; this should happen if the last-dog is 1.0 (was fast enough), or if the dog-count is set
|
||||
;; the dog-count will be set if the frames are fast enough, but not currently aligned.
|
||||
((or (= last-dog 1.0) (!= (-> arg0 dog-count) 0.0))
|
||||
;; still, only do the sync if we have a lot of time. I guess that vsyncing in other cases is not
|
||||
;; needed, and just wastes time. Might as well start on the next frame early!
|
||||
(if (< vysnc-progress 0.9)
|
||||
(syncv 0)
|
||||
)
|
||||
;; force no lag
|
||||
(set! frame-time-ratio 1.0)
|
||||
;; clear dog-count, go back to normal lag/no-lag decisions.
|
||||
(set! (-> arg0 dog-count) 0.0)
|
||||
)
|
||||
(else
|
||||
;; weird case: last frame was lag (last-dog != 1.0), but this frame wasn't (frame-time-ratio < 1).
|
||||
;; so we're transition from lag to no lag. In this case, we want to get back aligned with vsyncs.
|
||||
;; interestingly, we don't vsync immediately, but instead set a flag to vsync on the next frame, if
|
||||
;; that frame's time is also non-lag. As a result, we only syncrhonize with vsync if we have 2 non-lag frames
|
||||
;; in a row (both of them misaligned.), and we spread the syncrhonization delays between 2 frames
|
||||
|
||||
|
||||
(when (not (or (zero? prev-vblank-time-1) (zero? prev-vblank-time-2))) ;; only if we've done at least 2 syncs..
|
||||
|
||||
;; here we wait, recomputing frame-time-ratio/vsync-progress until either:
|
||||
;; - we're in the first or last third of the frame
|
||||
;; - we've waited longer than the previous frame lagged.
|
||||
(while (or (< frame-time-ratio last-dog) (and (< 0.333 vysnc-progress) (< vysnc-progress 0.667)))
|
||||
(let ((v1-34 (shl (timer1-time) 48)))
|
||||
(set! frame-time-ratio
|
||||
(/ (the float (sar (- v1-34 (the-as uint just-rendered-frame-start-time)) 48)) ticks-per-frame-f)
|
||||
)
|
||||
(if (< frame-time-ratio 0.0) ;; ?? timer wraparound issues?
|
||||
(set! frame-time-ratio last-dog)
|
||||
)
|
||||
(set! vysnc-progress
|
||||
(/ (the float (sar (- v1-34 (the-as uint (shl (-> arg0 vblank-start-time 1) 48))) 48)) ticks-per-frame-f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; force next frame to vsync if it didn't lag, then we will be back on framerate!
|
||||
(set! (-> arg0 dog-count) 1.0)
|
||||
)
|
||||
)
|
||||
frame-time-ratio
|
||||
)
|
||||
)
|
||||
)
|
||||
|#
|
||||
|
||||
;; PC port added: just skip this for now.
|
||||
(set! frame-time-ratio (pc-maybe-vsync))
|
||||
|
||||
(if (< frame-time-ratio 0.0)
|
||||
(set! frame-time-ratio last-dog)
|
||||
)
|
||||
)
|
||||
|
||||
;; never allow faster than full-speed frames (the logic above will prevent running faster than TV framerate)
|
||||
(let ((next-dog (fmax 1.0 frame-time-ratio))
|
||||
(frame-to-render (-> arg0 on-screen))
|
||||
)
|
||||
|
||||
;; measure time again, after waiting/vsyncing.
|
||||
(let ((time-after-vsync (timer1-time)))
|
||||
(+! (-> arg0 total-run-time)
|
||||
(the-as time-frame (sar (- (shl time-after-vsync 48) (the-as uint just-rendered-frame-start-time)) 48))
|
||||
)
|
||||
;; and use this as the start time for the frame we're about to render.
|
||||
(set! (-> arg0 frames frame-to-render start-time) (the-as time-frame time-after-vsync))
|
||||
)
|
||||
;; while nothing is drawing, update GS/video/magic stuff.
|
||||
;; (set-graphics-mode)
|
||||
|
||||
;; start DMA
|
||||
(let ((next-dma-buf (-> arg0 frames frame-to-render calc-buf)))
|
||||
(when (nonzero? (dma-buffer-length next-dma-buf))
|
||||
(+! frame-to-render 1)
|
||||
(if (< 1 frame-to-render)
|
||||
(set! frame-to-render 0)
|
||||
)
|
||||
;; swap DMA buffers
|
||||
(set! (-> arg0 last-screen) (-> arg0 on-screen))
|
||||
(set! (-> arg0 on-screen) frame-to-render)
|
||||
;; reset VU profiler for upcoming chain
|
||||
(when *debug-segment*
|
||||
(set! *profile-interrupt-segment* (-> *display* frames (-> *display* last-screen) profile-array data 1))
|
||||
(set! (-> *profile-interrupt-segment* depth) 0)
|
||||
(set! (-> *profile-interrupt-segment* max-depth) 1)
|
||||
)
|
||||
;; send the chain!
|
||||
(__send-gfx-dma-chain (the-as dma-bank-source #x10009000) (-> next-dma-buf data-buffer))
|
||||
)
|
||||
)
|
||||
|
||||
;; screenshot/pause stuff.
|
||||
; (determine-pause-mode)
|
||||
; (when (and (nonzero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1) (!= (-> *screen-shot-work* size) -1))
|
||||
; (let ((v1-77 (-> *screen-shot-work* size)))
|
||||
; (set! (-> *screen-shot-work* count) (* v1-77 v1-77))
|
||||
; )
|
||||
; (set-master-mode 'pause)
|
||||
; )
|
||||
|
||||
;; prepare engine for the next frame
|
||||
(display-frame-start arg0 frame-to-render next-dog)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun display-frame-finish ((arg0 display))
|
||||
"Do final DMA setup after drawing.
|
||||
Note that this runs _after_ rendering, while VU1/GS are not doing anything.
|
||||
so it's best to keep this code as simple as possible."
|
||||
(with-pp
|
||||
(let* ((s4-0 (-> arg0 frames (-> arg0 on-screen)))
|
||||
(s5-0 (-> s4-0 calc-buf))
|
||||
)
|
||||
;(-> s4-0 global-buf)
|
||||
|
||||
;; post-draw buffer setup
|
||||
; (tfrag-vu1-init-buffers)
|
||||
; (tie-vu1-init-buffers)
|
||||
; (merc-vu1-init-buffers)
|
||||
; (emerc-vu1-init-buffers)
|
||||
; (generic-vu1-init-buffers)
|
||||
|
||||
;; sprite texture remaps
|
||||
; (when (-> *texture-pool* update-sprites-flag)
|
||||
; (update-sprites *texture-pool*)
|
||||
; (particle-adgif-cache-flush)
|
||||
; (remap-all-particles)
|
||||
; )
|
||||
|
||||
;; texture uploads while GS is not doing anything.
|
||||
; (with-profiler 'texture *profile-texture-color*
|
||||
; (let ((s3-1 (-> pp clock)))
|
||||
; (if (= (-> *time-of-day-context* mode) (time-of-day-palette-id unk3))
|
||||
; (set! (-> pp clock) (-> *display* bg-clock))
|
||||
; (set! (-> pp clock) (-> *display* real-clock))
|
||||
; )
|
||||
; (upload-textures *texture-pool*)
|
||||
; (set! (-> pp clock) s3-1)
|
||||
; )
|
||||
; )
|
||||
|
||||
;; more texture mapping.
|
||||
; (if (-> *texture-pool* update-flag)
|
||||
; (update-warp-and-hud *texture-pool*)
|
||||
; )
|
||||
|
||||
;; unclear why eyes are here... maybe they rely on textures that were just remapped.
|
||||
; (-> *display* frames (-> *display* on-screen) global-buf)
|
||||
; (update-eyes)
|
||||
|
||||
|
||||
;; end each normal bucket with the standard GS state reset
|
||||
(let ((s3-3 6)
|
||||
(s2-2 324)
|
||||
)
|
||||
(while (>= s2-2 s3-3)
|
||||
(default-end-buffer
|
||||
(the-as bucket-id s3-3)
|
||||
(new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))
|
||||
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))
|
||||
)
|
||||
(+! s3-3 1)
|
||||
)
|
||||
)
|
||||
|
||||
;; initialize buckets with weird custom settings (disable z buffer)
|
||||
(default-init-buffer
|
||||
(bucket-id bucket-318)
|
||||
(new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)
|
||||
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))
|
||||
)
|
||||
(default-init-buffer
|
||||
(bucket-id debug-no-zbuf)
|
||||
(new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)
|
||||
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))
|
||||
)
|
||||
(default-init-buffer
|
||||
(bucket-id bucket-321)
|
||||
(new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)
|
||||
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))
|
||||
)
|
||||
(*post-draw-hook* (-> arg0 frames (-> arg0 on-screen) calc-buf))
|
||||
|
||||
;; final flushe
|
||||
(let* ((v1-70 s5-0)
|
||||
(a0-25 (the-as object (-> v1-70 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-25) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-25) vif0) (new 'static 'vif-tag :imm #x148 :cmd (vif-cmd mark)))
|
||||
(set! (-> (the-as dma-packet a0-25) vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :irq #x1 :msk #x1))
|
||||
(set! (-> v1-70 base) (the-as pointer (&+ (the-as dma-packet a0-25) 16)))
|
||||
)
|
||||
|
||||
;; link all buckets to build the final massive dma list.
|
||||
(dma-buffer-patch-buckets (-> s4-0 bucket-group) 327)
|
||||
|
||||
;; append the final END
|
||||
(let* ((v1-71 s5-0)
|
||||
(a0-28 (the-as object (-> v1-71 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-28) dma) (new 'static 'dma-tag :id (dma-tag-id end)))
|
||||
(set! (-> (the-as (pointer int64) a0-28) 1) 0)
|
||||
(set! (-> v1-71 base) (&+ (the-as pointer a0-28) 16))
|
||||
)
|
||||
|
||||
;; make sure nothing is in cache
|
||||
(flush-cache 0)
|
||||
|
||||
;; list final dma sizes
|
||||
(when (not (paused?))
|
||||
(when *stats-buffer*
|
||||
(let* ((a0-31 (-> s4-0 global-buf))
|
||||
(v1-75 (-> s5-0 base))
|
||||
(a2-4 (-> s5-0 data))
|
||||
(s4-1 (-> a0-31 base))
|
||||
(s5-1 (-> a0-31 data))
|
||||
(s3-4 (-> a0-31 end))
|
||||
)
|
||||
(format *stdcon* "~0kvu1 buf = ~d~%" (&- v1-75 (the-as uint a2-4)))
|
||||
(format *stdcon* "~0kglobal buf = ~d~%" (&- s4-1 (the-as uint s5-1)))
|
||||
(format *stdcon* "~0kbase = #x~x~%" s4-1)
|
||||
(format *stdcon* "~0kend = #x~x~%" s3-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; now the DMA is ready to send!
|
||||
)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
(defun swap-display ((arg0 display))
|
||||
(display-frame-finish arg0)
|
||||
(display-sync arg0)
|
||||
(none)
|
||||
)
|
||||
|
||||
@@ -311,4 +311,5 @@
|
||||
)
|
||||
|
||||
(define-extern movie? (function symbol))
|
||||
(define-extern paused? (function symbol))
|
||||
|
||||
(define-extern on (function symbol process))
|
||||
|
||||
@@ -7,3 +7,506 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defun paused? ()
|
||||
(or (= *master-mode* 'pause) (= *master-mode* 'progress) (= *master-mode* 'menu) (= *master-mode* 'freeze))
|
||||
)
|
||||
|
||||
|
||||
;; Rough loop outline:
|
||||
;; (while *run*
|
||||
;; - suspend ;; runs actors
|
||||
;; - display-loop-main ;; runs the drawing/per frame updates
|
||||
;; - per-frame updates for level, global effets
|
||||
;; - draw-hook ;; generates DMA data
|
||||
;; - sync-path ;; waits for previous frame to finish render
|
||||
;; - end-display
|
||||
;; - swap-display
|
||||
;; - display-frame-finish
|
||||
;; - display-sync
|
||||
;; - display-frame-start
|
||||
;; )
|
||||
|
||||
(defun end-display ((arg0 display))
|
||||
"Update debug drawing:
|
||||
- debug draws (triangles, spheres, etc)
|
||||
- profile bars
|
||||
- file info
|
||||
- console
|
||||
- other info (iop, memcard, pause)
|
||||
|
||||
This function runs after DMA sync.
|
||||
It's not clear why they did this - in the Jak 1 PC port, it is fine to move this to before sync.
|
||||
Possibly they wanted to leave the bus alone for graphics DMA."
|
||||
|
||||
;; DMA buffer for memory usage counting.
|
||||
(let ((s5-0 (-> (if *debug-segment*
|
||||
(-> arg0 frames (-> arg0 on-screen) debug-buf)
|
||||
(-> arg0 frames (-> arg0 on-screen) global-buf)
|
||||
)
|
||||
base
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; debug draw, profile bars, deci count, file info
|
||||
(when *debug-segment*
|
||||
;; do all debug drawing.
|
||||
; (debug-draw-buffers)
|
||||
(with-dma-buffer-add-bucket ((s3-0 (-> arg0 frames (-> arg0 on-screen) debug-buf)) (bucket-id debug-no-zbuf))
|
||||
(when (or *display-profile* *stats-profile-bars*)
|
||||
(setup-categories! (-> arg0 frames (-> arg0 on-screen) profile-array))
|
||||
(let ((a2-0 7))
|
||||
(if *display-profile*
|
||||
(draw-bars! *profile-array* s3-0 a2-0)
|
||||
)
|
||||
)
|
||||
; (if (and (!= *master-mode* 'menu) *stats-profile-bars*)
|
||||
; (draw-text! *profile-array*)
|
||||
; )
|
||||
)
|
||||
; (when *display-deci-count*
|
||||
; (let ((s2-0 draw-string-xy))
|
||||
; (format (clear *temp-string*) "~D" *deci-count*)
|
||||
; (s2-0 *temp-string* s3-0 448 210 (font-color default) (font-flags shadow))
|
||||
; )
|
||||
; )
|
||||
; (display-file-info)
|
||||
)
|
||||
)
|
||||
|
||||
;; draw console buffer
|
||||
; (let ((buf (if *debug-segment*
|
||||
; (-> arg0 frames (-> arg0 on-screen) debug-buf)
|
||||
; (-> arg0 frames (-> arg0 on-screen) global-buf)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; (with-dma-buffer-add-bucket ((s3-0 buf) (bucket-id debug-no-zbuf))
|
||||
; (if (and (= *master-mode* 'pause)
|
||||
; (and (!= *cheat-mode* 'camera) (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1)))
|
||||
; )
|
||||
; (draw-string-xy
|
||||
; (lookup-text! *common-text* (game-text-id pause) #f)
|
||||
; s3-1
|
||||
; 256
|
||||
; (if (< (-> *display* base-clock frame-counter) (-> *game-info* letterbox-time))
|
||||
; 352
|
||||
; 320
|
||||
; )
|
||||
; (font-color orange-red)
|
||||
; (font-flags shadow kerning middle large)
|
||||
; )
|
||||
; )
|
||||
; (let ((s2-2 (the int (-> *font-context* origin y))))
|
||||
; (cond
|
||||
; ((or (movie?) (< (-> *display* base-clock frame-counter) (-> *game-info* letterbox-time)))
|
||||
; (+! s2-2 56)
|
||||
; )
|
||||
; (*display-profile*
|
||||
; (+! s2-2 48)
|
||||
; )
|
||||
; )
|
||||
; (when (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
|
||||
; (let* ((v1-82
|
||||
; (draw-string-xy
|
||||
; *stdcon0*
|
||||
; s3-1
|
||||
; (the int (-> *font-context* origin x))
|
||||
; s2-2
|
||||
; (font-color default)
|
||||
; (font-flags shadow)
|
||||
; )
|
||||
; )
|
||||
; (a3-6 (+ s2-2 (the int (* 2.0 (the-as float (gpr->fpr (sar (the-as int v1-82) 32)))))))
|
||||
; )
|
||||
; (draw-string-xy
|
||||
; *stdcon1*
|
||||
; s3-1
|
||||
; (the int (-> *font-context* origin x))
|
||||
; a3-6
|
||||
; (font-color default)
|
||||
; (font-flags shadow)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; (if *display-iop-info*
|
||||
; (show-iop-info s3-1)
|
||||
; )
|
||||
; (if *display-memcard-info*
|
||||
; (show-mc-info s3-1)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; (let ((v1-101 *dma-mem-usage*))
|
||||
; (when (nonzero? v1-101)
|
||||
; (set! (-> v1-101 length) (max 88 (-> v1-101 length)))
|
||||
; (set! (-> v1-101 data 87 name) "debug")
|
||||
; (+! (-> v1-101 data 87 count) 1)
|
||||
; (+! (-> v1-101 data 87 used) (&-
|
||||
; (-> (if *debug-segment*
|
||||
; (-> arg0 frames (-> arg0 on-screen) debug-buf)
|
||||
; (-> arg0 frames (-> arg0 on-screen) global-buf)
|
||||
; )
|
||||
; base
|
||||
; )
|
||||
; (the-as uint s5-0)
|
||||
; )
|
||||
; )
|
||||
; (set! (-> v1-101 data 87 total) (-> v1-101 data 87 used))
|
||||
; )
|
||||
; )
|
||||
)
|
||||
(set! *stdcon* (clear *stdcon0*))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun display-loop-main ((arg0 display))
|
||||
"Run the engine.
|
||||
This function is called after actors update."
|
||||
(local-vars (a0-94 int) (a0-96 int))
|
||||
(with-pp
|
||||
|
||||
; ;; LOAD LEVEL
|
||||
; (if (-> *level* loading-level)
|
||||
; (load-continue (-> *level* loading-level))
|
||||
; )
|
||||
|
||||
; ;; Run blerc to modify foreground models
|
||||
; (with-profiler 'merc *profile-merc-color*
|
||||
; (blerc-execute)
|
||||
; (blerc-init)
|
||||
; )
|
||||
|
||||
; ;; Run other merc effects that modify vertices
|
||||
; (texscroll-execute)
|
||||
; (ripple-execute)
|
||||
; (region-execute)
|
||||
|
||||
;; final call to update joints before drawing.
|
||||
; (with-profiler 'joints *profile-joints-color*
|
||||
; (execute-math-engine)
|
||||
; )
|
||||
|
||||
;; execute the debug hook before doing the big updates
|
||||
; (with-profiler 'debug *profile-debug-color*
|
||||
; (let* ((s5-5 *debug-hook*)
|
||||
; (t9-12 (car s5-5)))
|
||||
; (while (not (null? s5-5))
|
||||
; ((the-as (function none) t9-12))
|
||||
; (set! s5-5 (cdr s5-5))
|
||||
; (set! t9-12 (car s5-5))
|
||||
; )
|
||||
; )
|
||||
; (main-cheats)
|
||||
; )
|
||||
|
||||
;; using the position of the in-game camera, update visiblity and matrices for rendering.
|
||||
; (with-profiler 'camera *profile-camera-color*
|
||||
; (update-camera)
|
||||
; )
|
||||
|
||||
;; map texture stuff
|
||||
; (update *bigmap*)
|
||||
|
||||
;; continue loading level
|
||||
; (if (-> *level* loading-level)
|
||||
; (load-continue (-> *level* loading-level))
|
||||
; )
|
||||
|
||||
;; drawing - this runs foreground/background drawing.
|
||||
(with-profiler 'draw-hook *profile-draw-hook-color*
|
||||
(*draw-hook*)
|
||||
)
|
||||
|
||||
;; another level load
|
||||
; (if (-> *level* loading-level)
|
||||
; (load-continue (-> *level* loading-level))
|
||||
; )
|
||||
|
||||
; (if *display-color-bars*
|
||||
; (draw-color-bars)
|
||||
; )
|
||||
|
||||
;; draw and update menus
|
||||
; (with-profiler 'menu-hook *profile-menu-hook-color*
|
||||
; (*menu-hook*)
|
||||
; )
|
||||
|
||||
;; load text files as needed from the menu update
|
||||
; (load-level-text-files -1)
|
||||
|
||||
;; post-processing filter drawing
|
||||
; (if (-> *screen-filter* draw?)
|
||||
; (draw *screen-filter*)
|
||||
; )
|
||||
|
||||
;; letterbox drawing
|
||||
; (when (or (movie?) (< (-> *display* base-clock frame-counter) (-> *game-info* letterbox-time)))
|
||||
; (if (< (-> *game-info* letterbox-time) (-> *display* base-clock frame-counter))
|
||||
; (set! (-> *game-info* letterbox-time) (-> *display* base-clock frame-counter))
|
||||
; )
|
||||
; (if (and (= (-> *setting-control* user-current aspect-ratio) 'aspect4x3)
|
||||
; (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
|
||||
; )
|
||||
; (letterbox)
|
||||
; )
|
||||
; )
|
||||
|
||||
;; blackout drawing
|
||||
; (when (-> *setting-control* user-current render)
|
||||
; (if (< (-> *display* base-clock frame-counter) (-> *game-info* blackout-time))
|
||||
; (set! (-> *setting-control* user-default bg-a-force) 1.0)
|
||||
; (set! (-> *setting-control* user-default bg-a-force) 0.0)
|
||||
; )
|
||||
; )
|
||||
|
||||
;; generate DMA data for doing the main blit
|
||||
; (blit-displays)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; END of normal frame
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; and we're done with the main frame! end profiling/stat collection
|
||||
(when *debug-segment*
|
||||
(let ((s5-13 (-> arg0 frames (-> arg0 on-screen) profile-array data 0)))
|
||||
(when (and *dproc* *debug-segment*)
|
||||
(let* ((v1-294 (+ (-> s5-13 depth) -1))
|
||||
(s4-12 (-> s5-13 segment v1-294))
|
||||
(s3-12 (-> s5-13 base-time))
|
||||
)
|
||||
(when (>= v1-294 0)
|
||||
(set! (-> s4-12 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-12))))
|
||||
(+! (-> s5-13 depth) -1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
;(read! (-> *perf-stats* data (perf-stat-bucket all-code)))
|
||||
)
|
||||
|
||||
;; now wait for the previous frame to finish rendering...
|
||||
(when (nonzero? (sync-path 0 0))
|
||||
(*dma-timeout-hook*)
|
||||
(reset-vif1-path)
|
||||
)
|
||||
|
||||
;; debug drawing
|
||||
(end-display arg0)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; display the frame, and start a new one!
|
||||
;; this will kick off the next dma transfer
|
||||
(swap-display arg0)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;; start profiling for the new frame
|
||||
(when *debug-segment*
|
||||
(start-frame! (-> arg0 frames (-> arg0 on-screen) profile-array data 0))
|
||||
;(reset! (-> *perf-stats* data (perf-stat-bucket all-code)))
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; START of next frame
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; a few things before the actor updates...
|
||||
|
||||
; (set! (-> *time-of-day-context* title-updated) #f)
|
||||
|
||||
;; update teleport counter
|
||||
; (set! *teleport* #f)
|
||||
; (when (nonzero? *teleport-count*)
|
||||
; (set! *teleport* #t)
|
||||
; (set! *teleport-count* (+ *teleport-count* -1))
|
||||
; )
|
||||
|
||||
;; update particles (we're racing the DMA transfer again, do this asap)
|
||||
; (let ((gp-1 (-> pp clock)))
|
||||
; (set! (-> pp clock) (-> *display* part-clock))
|
||||
; (process-particles)
|
||||
; (set! (-> pp clock) gp-1)
|
||||
; )
|
||||
|
||||
;; set up VU0's VIF for collision code run by actors
|
||||
; (dma-send
|
||||
; (the-as dma-bank #x10008000)
|
||||
; (the-as uint (-> *collide-vif0-init* data))
|
||||
; (the-as uint (/ (-> *collide-vif0-init* length) 4))
|
||||
; )
|
||||
|
||||
;; send sound commands to IOP
|
||||
; (swap-sound-buffers (ear-trans 0) (ear-trans 1) (camera-pos) (camera-angle))
|
||||
|
||||
;; advance streaming animation
|
||||
; (str-play-kick)
|
||||
|
||||
;; handle spawning/despawning as needed.
|
||||
; (level-update *level*)
|
||||
|
||||
;; do some memory card operations, check auto-save
|
||||
; (mc-run)
|
||||
; (auto-save-check)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
(defbehavior display-loop process ()
|
||||
(stack-size-set! (-> self main-thread) 512)
|
||||
|
||||
;; spawn the matrix process. This is responsible for doing the first pass through joints
|
||||
; (process-spawn-function
|
||||
; process
|
||||
; (lambda :behavior process
|
||||
; ()
|
||||
; (logclear! (-> self mask) (process-mask freeze pause menu progress entity))
|
||||
; (until #f
|
||||
; (when *debug-segment*
|
||||
; (let ((gp-0 (-> *display* frames (-> *display* on-screen) profile-array data 0))
|
||||
; (v1-9 'joints)
|
||||
; (s5-0 *profile-joints-color*)
|
||||
; )
|
||||
; (when (and *dproc* *debug-segment*)
|
||||
; (let ((s4-0 (-> gp-0 data (-> gp-0 count))))
|
||||
; (let ((s3-0 (-> gp-0 base-time)))
|
||||
; (set! (-> s4-0 name) v1-9)
|
||||
; (set! (-> s4-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-0))))
|
||||
; )
|
||||
; (set! (-> s4-0 depth) (the-as uint (-> gp-0 depth)))
|
||||
; (set! (-> s4-0 color) s5-0)
|
||||
; (set! (-> gp-0 segment (-> gp-0 depth)) s4-0)
|
||||
; )
|
||||
; (+! (-> gp-0 count) 1)
|
||||
; (+! (-> gp-0 depth) 1)
|
||||
; (set! (-> gp-0 max-depth) (max (-> gp-0 max-depth) (-> gp-0 depth)))
|
||||
; )
|
||||
; )
|
||||
; 0
|
||||
; )
|
||||
; (execute-math-engine)
|
||||
; (when *debug-segment*
|
||||
; (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0)))
|
||||
; (when (and *dproc* *debug-segment*)
|
||||
; (let* ((v1-33 (+ (-> gp-1 depth) -1))
|
||||
; (s5-1 (-> gp-1 segment v1-33))
|
||||
; (s4-1 (-> gp-1 base-time))
|
||||
; )
|
||||
; (when (>= v1-33 0)
|
||||
; (set! (-> s5-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-1))))
|
||||
; (+! (-> gp-1 depth) -1)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; 0
|
||||
; )
|
||||
; (suspend)
|
||||
; )
|
||||
; #f
|
||||
; (none)
|
||||
; )
|
||||
; :name "matrix"
|
||||
; :from *4k-dead-pool*
|
||||
; :to *mid-pool*
|
||||
; )
|
||||
(let ((gp-1 *display*))
|
||||
(set! *teleport* #t)
|
||||
; (update *setting-control*)
|
||||
; (init-time-of-day-context *time-of-day-context*)
|
||||
(format 0 "about to display-sync~%")
|
||||
(display-sync gp-1)
|
||||
(format 0 "about to swap-display~%")
|
||||
(swap-display gp-1)
|
||||
(format 0 "about to install-handler~%")
|
||||
(install-handler 3 vblank-handler) ;; TODO: this never gets called.
|
||||
; *touching-list*
|
||||
; ((method-of-type touching-list touching-list-method-10))
|
||||
; (prepare *collide-rider-pool*)
|
||||
; (update-actor-hash)
|
||||
; (blerc-init)
|
||||
; (dma-send
|
||||
; (the-as dma-bank #x10008000)
|
||||
; (the-as uint (-> *collide-vif0-init* data))
|
||||
; (the-as uint (/ (-> *collide-vif0-init* length) 4))
|
||||
; )
|
||||
(suspend)
|
||||
; (set! (-> *setting-control* user-default bg-a) 0.0)
|
||||
; (set! (-> gp-1 frames 0 start-time) (the-as time-frame (timer-count (the-as timer-bank #x10000800))))
|
||||
; (set! (-> gp-1 frames 1 start-time) (the-as time-frame (timer-count (the-as timer-bank #x10000800))))
|
||||
; (set! (-> gp-1 dog-ratio) 1.0)
|
||||
(while *run*
|
||||
(display-loop-main gp-1)
|
||||
(with-profiler 'actors *profile-actors-color*
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! *dproc* #f)
|
||||
(format 0 "display is off #<#x~X>.~%" self)
|
||||
0
|
||||
)
|
||||
|
||||
(defun on ((arg0 symbol))
|
||||
"Start the display loop."
|
||||
(when (not *dproc*)
|
||||
(when (not arg0)
|
||||
(if (= (-> *level* level0 status) 'inactive)
|
||||
(bg 'halfpipe)
|
||||
)
|
||||
)
|
||||
(set! *run* #t)
|
||||
(set! *dproc* (ppointer->process (process-spawn-function
|
||||
process
|
||||
display-loop
|
||||
:name "display"
|
||||
:from *4k-dead-pool*
|
||||
:to *display-pool*
|
||||
:stack *kernel-dram-stack*
|
||||
)
|
||||
)
|
||||
)
|
||||
(format 0 "SKIP: level activation in on~%")
|
||||
; (cond
|
||||
; ((or (level-get-with-status *level* 'loaded)
|
||||
; (level-get-with-status *level* 'alive)
|
||||
; (level-get-with-status *level* 'active)
|
||||
; )
|
||||
; (activate-levels! *level*)
|
||||
; (when (not arg0)
|
||||
; (let ((gp-1 (entity-by-type camera-start)))
|
||||
; (when (and gp-1 (type? gp-1 entity-actor))
|
||||
; (while (not (camera-teleport-to-entity gp-1))
|
||||
; (suspend)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; (if (and (= *kernel-boot-message* 'art-group) *kernel-boot-art-group*)
|
||||
; (anim-tester-add-object *kernel-boot-art-group*)
|
||||
; )
|
||||
; )
|
||||
; (else
|
||||
; (kill-by-name "display" *active-pool*)
|
||||
; (set! *dproc* #f)
|
||||
; )
|
||||
; )
|
||||
)
|
||||
*dproc*
|
||||
)
|
||||
|
||||
(defun off ()
|
||||
(stop 'debug)
|
||||
(dotimes (gp-0 (-> *level* length))
|
||||
(let ((a0-2 (-> *level* level gp-0)))
|
||||
(if (= (-> a0-2 status) 'active)
|
||||
(deactivate a0-2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! *run* #f)
|
||||
0
|
||||
)
|
||||
|
||||
@@ -29,7 +29,13 @@
|
||||
(pc-hack 6)
|
||||
)
|
||||
|
||||
(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags float))
|
||||
;; added type
|
||||
(deftype draw-string-result (uint64)
|
||||
((length float :offset 0)
|
||||
(b float :offset 32))
|
||||
)
|
||||
|
||||
(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags draw-string-result))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
|
||||
@@ -7,3 +7,170 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
|
||||
;; definition for function gen-font-12
|
||||
;; INFO: Return type mismatch object vs none.
|
||||
(defun gen-font-12 ((arg0 string))
|
||||
(format #t "(define ~s~%" arg0)
|
||||
(format #t " (new 'static 'inline-array 'vector 0~%")
|
||||
(dotimes (gp-0 250)
|
||||
(let ((f0-1 (+ 0.0009765625 (* 0.03125 (the float (/ (mod gp-0 250) 10)))))
|
||||
(f1-3 (+ 0.00390625 (* 0.09375 (the float (mod gp-0 10)))))
|
||||
(v1-10 (if (< gp-0 250)
|
||||
gp-0
|
||||
(+ gp-0 6)
|
||||
)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((zero? v1-10)
|
||||
(format
|
||||
#t
|
||||
"~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x 'upside down ~c'~%"
|
||||
f1-3
|
||||
f0-1
|
||||
(+ v1-10 6)
|
||||
94
|
||||
)
|
||||
)
|
||||
((= v1-10 1)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '`'~%" f1-3 f0-1 (+ v1-10 6))
|
||||
)
|
||||
((= v1-10 2)
|
||||
(let ((t9-4 format)
|
||||
(a0-8 #t)
|
||||
(a1-4 "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x ''~%")
|
||||
(a2-3 f1-3)
|
||||
(a3-2 f0-1)
|
||||
(t0-2 (+ v1-10 6))
|
||||
)
|
||||
180
|
||||
(t9-4 a0-8 a1-4 a2-3 a3-2 t0-2)
|
||||
)
|
||||
)
|
||||
((= v1-10 3)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 94)
|
||||
)
|
||||
((= v1-10 4)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 126)
|
||||
)
|
||||
((= v1-10 5)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 168)
|
||||
)
|
||||
((= v1-10 6)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 176)
|
||||
)
|
||||
((= v1-10 7)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 161)
|
||||
)
|
||||
((= v1-10 8)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 191)
|
||||
)
|
||||
((= v1-10 9)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 186)
|
||||
)
|
||||
((= v1-10 10)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 174)
|
||||
)
|
||||
((= v1-10 11)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 198)
|
||||
)
|
||||
((= v1-10 12)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 230)
|
||||
)
|
||||
((= v1-10 13)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 199)
|
||||
)
|
||||
((= v1-10 14)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 231)
|
||||
)
|
||||
((= v1-10 15)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%" f1-3 f0-1 (+ v1-10 6) 223)
|
||||
)
|
||||
((and (< 15 v1-10) (< v1-10 78))
|
||||
(format
|
||||
#t
|
||||
"~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%"
|
||||
f1-3
|
||||
f0-1
|
||||
(+ v1-10 6)
|
||||
(+ v1-10 16)
|
||||
)
|
||||
)
|
||||
((= v1-10 78)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x 'oe'~%" f1-3 f0-1 (+ v1-10 6))
|
||||
)
|
||||
((and (< 78 v1-10) (< v1-10 108))
|
||||
(format
|
||||
#t
|
||||
"~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%"
|
||||
f1-3
|
||||
f0-1
|
||||
(+ v1-10 6)
|
||||
(+ v1-10 16)
|
||||
)
|
||||
)
|
||||
((= v1-10 108)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x 'OE'~%" f1-3 f0-1 (+ v1-10 6))
|
||||
)
|
||||
((and (< 108 v1-10) (< v1-10 111))
|
||||
(format
|
||||
#t
|
||||
"~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x '~c'~%"
|
||||
f1-3
|
||||
f0-1
|
||||
(+ v1-10 6)
|
||||
(+ v1-10 16)
|
||||
)
|
||||
)
|
||||
((= v1-10 111)
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x 'TM'~%" f1-3 f0-1 (+ v1-10 6))
|
||||
)
|
||||
(else
|
||||
(format #t "~t (new 'static 'vector :x ~f :y ~f :z 1.0 :w 16.0) ; $~2x~%" f1-3 f0-1 (+ v1-10 6))
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (= (mod gp-0 10) 9)
|
||||
(if (!= gp-0 419)
|
||||
(format #t "~%")
|
||||
)
|
||||
)
|
||||
)
|
||||
(format #t "~t)~%")
|
||||
(format #t " )~%")
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function draw-string-asm
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition for function draw-string
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition for function get-string-length
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
(def-mips2c draw-string-asm (function string dma-buffer font-context uint))
|
||||
(def-mips2c draw-string (function string dma-buffer font-context draw-string-result))
|
||||
(def-mips2c get-string-length (function string font-context float))
|
||||
|
||||
;; definition for function draw-string-xy
|
||||
(defun draw-string-xy ((arg0 string) (arg1 dma-buffer) (arg2 int) (arg3 int) (arg4 font-color) (arg5 font-flags))
|
||||
(let ((a2-2 (new 'stack 'font-context *font-default-matrix* arg2 arg3 0.0 arg4 arg5)))
|
||||
(draw-string arg0 arg1 a2-2)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function draw-string-adv
|
||||
;; INFO: Return type mismatch float vs none.
|
||||
(defun draw-string-adv ((arg0 string) (arg1 dma-buffer) (arg2 font-context))
|
||||
(let ((v1-0 (draw-string arg0 arg1 arg2)))
|
||||
(+! (-> arg2 origin x) (-> v1-0 length))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -123,3 +123,7 @@
|
||||
|
||||
|
||||
(define-extern *display* display)
|
||||
|
||||
(defmacro current-frame ()
|
||||
`(-> *display* frames (-> *display* on-screen))
|
||||
)
|
||||
@@ -282,7 +282,7 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun vif1-handler-debug ()
|
||||
(defun vif1-handler-debug ((mark-in int))
|
||||
"Handle the VIF1 interrupt.
|
||||
The mark register of VIF will be set to the bucket that is now starting."
|
||||
; B0:
|
||||
@@ -304,7 +304,7 @@
|
||||
; lui a0, 4096
|
||||
; ori a0, a0, 15360
|
||||
; lwu a0, 48(a0)
|
||||
(mark 0) ;; (-> VIF1_BANK mark) (TODO actually set mark somehow)
|
||||
(mark mark-in) ;; (-> VIF1_BANK mark) (TODO actually set mark somehow)
|
||||
; lw a1, *profile-work*(s7)
|
||||
; lw a2, 64(a1)
|
||||
(last-index (-> *profile-work* last-index))
|
||||
|
||||
@@ -86,6 +86,11 @@
|
||||
:copy-entries gs-reg
|
||||
)
|
||||
|
||||
(defenum gs-reg32
|
||||
:type uint32
|
||||
:copy-entries gs-reg
|
||||
)
|
||||
|
||||
(defenum gs-prim-type
|
||||
:type uint8
|
||||
(point 0)
|
||||
|
||||
@@ -7,3 +7,6 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defun get-video-mode ()
|
||||
(-> *setting-control* user-current video-mode)
|
||||
)
|
||||
|
||||
@@ -178,6 +178,7 @@
|
||||
(deftype mood-context (mood-context-core3)
|
||||
((itimes vector4w 4 :inline :offset-assert 1776)
|
||||
(state uint32 32 :offset-assert 1840)
|
||||
(clear uint128 123 :offset 0) ;; added
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x7b0
|
||||
|
||||
@@ -7,3 +7,14 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defun clear-mood-context ((arg0 mood-context))
|
||||
(let ((v1-0 arg0))
|
||||
(dotimes (a1-0 123)
|
||||
(set! (-> v1-0 clear a1-0) (the-as uint128 0))
|
||||
)
|
||||
)
|
||||
(dotimes (v1-3 8)
|
||||
(set-vector! (-> arg0 times v1-3) 1.0 1.0 1.0 0.0)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user