This commit is contained in:
water
2021-10-24 12:35:07 -04:00
parent f6841009c6
commit 3b35e60222
12 changed files with 183 additions and 32 deletions
+11 -9
View File
@@ -6153,7 +6153,7 @@
(collide-y-probe (_type_ int collide-list) none 12)
(collide-ray (_type_ int collide-list) none 13)
(dummy-14 (_type_) none 14)
(debug-draw (_type_ drawable object) none 15)
(debug-draw (_type_ drawable display-frame) none 15)
(dummy-16 (_type_ object object) object 16)
(collect-ambients (_type_ sphere int ambient-list) none 17)
)
@@ -12701,12 +12701,12 @@
(debug-data tfragment-debug-data :offset 8)
(color-indices uint32 :offset 12)
(colors uint32 :offset 12)
(dma-chain uint32 3 :offset-assert 32)
(dma-common uint32 :offset 32)
(dma-level-0 uint32 :offset 32)
(dma-base uint32 :offset 36)
(dma-level-1 uint32 :offset 40)
(dma-qwc uint32 4 :offset 44)
(dma-chain uint32 3 :offset-assert 32) ;; 0
(dma-common uint32 :offset 32) ;; 0
(dma-level-0 uint32 :offset 32) ;; 0
(dma-base uint32 :offset 36) ;; 1
(dma-level-1 uint32 :offset 40) ;; 2
(dma-qwc uint8 4 :offset 44) ;; 3
(shader (inline-array adgif-shader) :offset 48)
(num-shaders uint8 :offset 52)
(num-base-colors uint8 :offset 53)
@@ -12717,6 +12717,8 @@
(pad0 uint8 :offset 58)
(pad1 uint8 :offset 59)
(generic generic-tfragment :offset-assert 60)
(hack uint32 :offset 44)
)
:method-count-assert 18
:size-assert #x40
@@ -16458,8 +16460,8 @@
;; - Functions
(define-extern tfrag-details function)
(define-extern clip-restore function)
(define-extern tfrag-details (function tfragment none))
(define-extern clip-restore (function none))
;; - Unknowns
@@ -1150,6 +1150,10 @@
["L32", "uint64", true]
],
"tfrag-near": [
["L1", "vu-function"]
],
// please do not add things after this entry! git is dumb.
"object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": []
@@ -2747,5 +2747,10 @@
[16, "event-message-block"]
],
"clip-restore":[
[16, "vector"],
[32, "matrix"]
],
"placeholder-do-not-add-below!": []
}
+4
View File
@@ -356,4 +356,8 @@ std::string GsTex0::print() const {
std::string GsPrim::print() const {
return fmt::format("0x{:x}, kind {}\n", data, kind());
}
std::string GsZbuf::print() const {
return fmt::format("msk: {}\n", zmsk());
}
+2
View File
@@ -146,6 +146,8 @@ struct GsZbuf {
bool zmsk() const { return data & (1ull << 32); }
std::string print() const;
u64 data;
};
+7 -1
View File
@@ -27,7 +27,13 @@ class AdgifHelper {
result +=
fmt::format("[1] {}\n {}\n", register_address_name(m_data.tex1_addr), m_tex1.print());
result += fmt::format("[2] {}\n", register_address_name(m_data.mip_addr));
result += fmt::format("[3] {}\n", register_address_name(m_data.clamp_addr));
if (m_data.clamp_addr == (int)GsRegisterAddress::ZBUF_1) {
result += fmt::format("[3] {}\n {}\n", register_address_name(m_data.clamp_addr),
GsZbuf(m_data.clamp_data).print());
} else {
result += fmt::format("[3] {}\n", register_address_name(m_data.clamp_addr));
}
result +=
fmt::format("[4] {}\n {}\n", register_address_name(m_data.alpha_addr), m_alpha.print());
return result;
@@ -204,7 +204,10 @@ void DirectRenderer::flush_pending(SharedRenderState* render_state, ScopedProfil
render_state->shaders[ShaderId::SPRITE_CPU_AFAIL].activate();
glDepthMask(GL_FALSE);
glDrawArrays(GL_TRIANGLES, 0, m_prim_buffer.vert_count);
glDepthMask(GL_TRUE);
if (m_test_state.depth_writes) {
glDepthMask(GL_TRUE);
}
m_prim_gl_state_needs_gl_update = true;
m_blend_state_needs_gl_update = true;
draw_count++;
@@ -735,7 +738,7 @@ void DirectRenderer::handle_zbuf1(u64 val,
assert(x.psm() == TextureFormat::PSMZ24);
assert(x.zbp() == 448);
bool write = x.zmsk();
bool write = !x.zmsk();
// assert(write);
if (write != m_test_state.depth_writes) {
@@ -1,6 +1,7 @@
#include "third-party/fmt/core.h"
#include "third-party/imgui/imgui.h"
#include "SpriteRenderer.h"
#include "game/graphics/opengl_renderer/AdgifHandler.h"
namespace {
/*!
@@ -1155,6 +1156,8 @@ void SpriteRenderer::do_2d_group0_block_cpu(u32 count,
if (m_extra_debug) {
imgui_vec(vf12_rotated, "vf12", 2);
imgui_vec(vf13_rotated_trans, "vf13", 2);
AdgifHelper adgif_debug((const u8*)&packet.user_adgif);
ImGui::Text("%s", adgif_debug.print().c_str());
ImGui::Separator();
}
+21
View File
@@ -83,6 +83,27 @@
;; - there is an issue with blending. check the "always" box as a temporary workaround
;; - the visibilty check also doesn't work. comment it out in defmethod spawn.
(let ((gp-1 (-> *part-group-id-table* 105)))
;; cool particles
;; 42, blue eco
;; 44, blue vent
;; 48, red
;; 50, red vent
;; 52, yellow vent
;; 56, yellow
;; 58 green
;; 59, small green
;; 1 hit, 2
;; 8
;; 575
;; 10
;; 708
;; 104, 103, 102
;; after finalboss
;; 636, 637
;; 682, 702
;; after particles reload
;; 696
(let ((s5-1 (-> self root trans)))
(when (!= gp-1 (-> self old-group))
+25 -20
View File
@@ -32,27 +32,32 @@
:flag-assert #x900000004
)
(deftype tfragment (drawable)
((color-index uint16 :offset 6)
(debug-data tfragment-debug-data :offset 8)
(color-indices uint32 :offset 12)
(colors uint32 :offset 12)
(dma-chain uint32 3 :offset-assert 32)
(dma-common uint32 :offset 32)
(dma-level-0 uint32 :offset 32)
(dma-base uint32 :offset 36)
(dma-level-1 uint32 :offset 40)
(dma-qwc uint32 4 :offset-assert 44)
(shader (inline-array adgif-shader) :offset 48)
(num-shaders uint8 :offset 52)
(num-base-colors uint8 :offset 53)
(num-level0-colors uint8 :offset 54)
(num-level1-colors uint8 :offset 55)
(color-offset uint8 :offset 56)
(color-count uint8 :offset 57)
(pad0 uint8 :offset 58)
(pad1 uint8 :offset 59)
(generic generic-tfragment :offset-assert 60)
(
(color-index uint16 :offset 6)
(debug-data tfragment-debug-data :offset 8)
(color-indices uint32 :offset 12)
(colors uint32 :offset 12)
(dma-chain uint32 3 :offset-assert 32) ;; 0
(dma-common uint32 :offset 32) ;; 0
(dma-level-0 uint32 :offset 32) ;; 0
(dma-base uint32 :offset 36) ;; 1
(dma-level-1 uint32 :offset 40) ;; 2
(dma-qwc uint8 4 :offset 44) ;; 3
(shader (inline-array adgif-shader) :offset 48)
(num-shaders uint8 :offset 52)
(num-base-colors uint8 :offset 53)
(num-level0-colors uint8 :offset 54)
(num-level1-colors uint8 :offset 55)
(color-offset uint8 :offset 56)
(color-count uint8 :offset 57)
(pad0 uint8 :offset 58)
(pad1 uint8 :offset 59)
(generic generic-tfragment :offset-assert 60)
;; likely ran off of the dma-chain array by accident in a debug function:
(hack uint32 :offset 44)
)
:method-count-assert 18
:size-assert #x40
+93
View File
@@ -5,3 +5,96 @@
;; name in dgo: tfrag-near
;; dgos: GAME, ENGINE
(define tnear-vu1-block (new 'static 'vu-function))
;; definition (debug) for function tfrag-details
;; INFO: Return type mismatch symbol vs none.
(defun-debug tfrag-details ((arg0 tfragment))
(format 0 "id = ~d~%" (-> arg0 id))
(format 0 "common:~%")
(let ((s5-0 (-> arg0 dma-qwc 0))
(s4-0 (-> arg0 dma-common))
)
(format 0 "qwc = ~d, ref = ~x~%" s5-0 s4-0)
(disasm-vif-tag
(the-as (pointer vif-tag) s4-0)
(the-as int (* s5-0 4))
(the-as symbol 0)
#t
)
)
(format 0 "base:~%")
(let ((s5-1 (-> arg0 dma-qwc 1))
(s4-1 (-> arg0 dma-base))
)
(format 0 "qwc = ~d, ref = ~x~%" s5-1 s4-1)
(disasm-vif-tag
(the-as (pointer vif-tag) s4-1)
(the-as int (* s5-1 4))
(the-as symbol 0)
#t
)
)
(format 0 "level-0 (broken):~%")
; (let ((s5-2 (-> arg0 dma-qwc 3))
; (s4-2 (-> arg0 hack))
; )
; (format 0 "qwc = ~d, ref = ~x~%" s5-2 s4-2)
; (disasm-vif-tag
; (the-as (pointer vif-tag) s4-2)
; (the-as int (* s5-2 4))
; (the-as symbol 0)
; #t
; )
; )
(format 0 "level-1:~%")
(let ((s5-3 (-> arg0 dma-qwc 2))
(gp-1 (-> arg0 dma-level-1))
)
(format 0 "qwc = ~d, ref = ~x~%" s5-3 gp-1)
(disasm-vif-tag
(the-as (pointer vif-tag) gp-1)
(the-as int (* s5-3 4))
(the-as symbol 0)
#t
)
)
(none)
)
;; definition (debug) for function clip-restore
;; INFO: Return type mismatch vector vs none.
;; Used lq/sq
(defun-debug clip-restore ()
(let ((a0-0 (new-stack-vector0))
(a1-0 (new-stack-matrix0))
)
(set! (-> a0-0 x) 92648.22)
(set! (-> a0-0 y) 238025.03)
(set! (-> a0-0 z) 199836.31)
(set! (-> a0-0 w) 1.0)
(set! (-> a1-0 vector 0 x) -0.9283)
(set! (-> a1-0 vector 0 y) 0.0)
(set! (-> a1-0 vector 0 z) 0.3716)
(set! (-> a1-0 vector 0 w) 0.0)
(set! (-> a1-0 vector 1 x) -0.2257)
(set! (-> a1-0 vector 1 y) 0.7945)
(set! (-> a1-0 vector 1 z) -0.5637)
(set! (-> a1-0 vector 1 w) 0.0)
(set! (-> a1-0 vector 2 x) -0.2952)
(set! (-> a1-0 vector 2 y) -0.6072)
(set! (-> a1-0 vector 2 z) -0.7375)
(set! (-> a1-0 vector 2 w) 0.0)
(set! (-> a1-0 vector 3 x) 0.0)
(set! (-> a1-0 vector 3 y) 0.0)
(set! (-> a1-0 vector 3 z) 0.0)
(set! (-> a1-0 vector 3 w) 1.0)
(debug-set-camera-pos-rot! a0-0 a1-0)
)
(none)
)
+3
View File
@@ -9,6 +9,9 @@
(dotimes (s5-0 (the-as int (-> obj num-shaders)))
(adgif-shader-login-no-remap (-> obj shader s5-0))
)
; (format #t "login tfrag: ~A: ~A~%" obj (-> obj debug-data debug-lines))
; (tfrag-details obj)
; (inspect obj)
obj
)