Skip to content

Commit

Permalink
decomp3: add background data to pc renderers, get mood and time of da…
Browse files Browse the repository at this point in the history
…y stuff running (#3450)
  • Loading branch information
Hat-Kid committed Apr 6, 2024
1 parent c5357f7 commit 23aeda1
Show file tree
Hide file tree
Showing 35 changed files with 8,143 additions and 315 deletions.
204 changes: 92 additions & 112 deletions decompiler/config/jak3/all-types.gc

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions decompiler/config/jak3/ntsc_v1/hacks.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
"(method 33 rub-tower)",
"(method 261 crimson-guard)",
"(anon-function 25 volcanox-obs)",
"foreground-draw-hud",
"memcpy"
],

Expand Down Expand Up @@ -385,7 +384,8 @@
],
"(method 16 sparticle-launch-control)": [25, 35, 36, 48, 62, 65, 100, 102],
"(anon-function 17 target-ladder)": [0, 1],
"command-get-process": [46]
"command-get-process": [46],
"foreground-draw-hud": [0, 7, 8, 9, 16, 22]
},

// Sometimes the game might use format strings that are fetched dynamically,
Expand Down
24 changes: 24 additions & 0 deletions decompiler/config/jak3/ntsc_v1/label_types.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -560,5 +560,29 @@
["L2329", "attack-info"],
["L2328", "attack-info"],
["L2578", "vector"]
],
"mood": [
["L267", "vector"],
["L265", "vector"],
["L263", "vector"],
["L261", "vector"],
["L259", "vector"],
["L257", "vector"]
],
"sky-data": [
["L26", "(inline-array sky-vertex)", 12],
["L25", "(inline-array sky-vertex)", 12],
["L23", "(inline-array sky-vertex)", 648],
["L21", "(inline-array sky-vertex)", 144]
],
"mood-funcs": [
["L198", "uint64", true],
["L197", "uint64", true],
["L202", "uint64", true],
["L199", "uint64", true],
["L196", "uint64", true],
["L200", "uint64", true],
["L203", "uint64", true],
["L201", "uint64", true]
]
}
4 changes: 3 additions & 1 deletion decompiler/config/jak3/ntsc_v1/stack_structures.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -716,5 +716,7 @@
"(anon-function 49 script)": [
[128, "part-tracker-subsampler-init-params"],
[176, "part-tracker-init-params"]
]
],
"(method 9 mood-control)": [[16, "mood-control-work"]],
"check-drop-level-rain": [[16, "vector"]]
}
61 changes: 60 additions & 1 deletion decompiler/config/jak3/ntsc_v1/type_casts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3485,7 +3485,10 @@
[44, "s5", "process-focusable"],
[51, "s5", "process-focusable"]
],
"(event time-of-day-tick)": [[9, "v1", "float"]],
"(event time-of-day-tick)": [
[9, "v1", "float"],
[203, "v1", "float"]
],
"load-game-text-info": [
[34, "v1", "game-text-info"],
[41, "v1", "game-text-info"]
Expand Down Expand Up @@ -4629,5 +4632,61 @@
[[47, 88], "v1", "connection"],
[[120, 124], "a0", "basic"],
[[127, 130], "a0", "basic"]
],
"(method 9 mood-control)": [[695, "v0", "sound-rpc-set-param"]],
"update-mood-pulse": [[[5, 45], "gp", "pulse-state"]],
"update-mood-electricity": [[[3, 19], "gp", "electricity-state"]],
"update-mood-florescent": [[[1, 48], "gp", "florescent-state"]],
"update-mood-flicker": [[[1, 58], "gp", "flicker-state"]],
"update-mood-light": [[[7, 175], "gp", "light-state"]],
"update-mood-flames": [[[5, 102], "gp", "flames-state"]],
"(method 23 mood-control)": [
[121, "a1", "vector"],
[125, "a1", "vector"],
[129, "a1", "vector"],
[133, "a1", "vector"],
[137, "v1", "vector"],
[122, "a0", "vector"],
[126, "a0", "vector"],
[130, "a0", "vector"],
[134, "a0", "vector"],
[138, "a0", "vector"]
],
"copy-mood-exterior": [
[[16, 20], "a1", "mood-context"],
[30, "a0", "(inline-array vector)"],
[33, "a0", "(inline-array vector)"],
[31, "v1", "(inline-array vector)"],
[32, "v1", "(inline-array vector)"],
[[17, 19], "v1", "(inline-array vector)"]
],
"copy-mood-exterior-ambi": [
[[12, 17], "a2", "mood-context"],
[[13, 16], "v1", "mood-context"]
],
"overide-mood-color": [
[40, "a2", "(inline-array vector)"],
[44, "a0", "(inline-array vector)"],
[107, "a0", "mood-context"],
[[91, 107], "s3", "mood-context"]
],
"(method 11 sky-work)": [[[7, 63], "s3", "mood-context"]],
"sky-make-sun-data": [[[7, 58], "s3", "sky-sun-data"]],
"update-mood-ctysluma": [[[23, 72], "s5", "ctysluma-states"]],
"sparticle-track-sun": [[148, "s4", "vector"]],
"foreground-draw-hud": [
[26, "t2", "foreground-work"],
[36, "a1", "foreground-work"],
[79, "t2", "foreground-work"],
[[85, 102], "t2", "(pointer uint128)"],
[166, "a1", "int"],
[172, "a0", "foreground-work"],
[12, "t0", "foreground-work"],
[31, "t1", "foreground-work"],
[103, "t1", "vu-lights"],
[164, "a0", "(pointer uint128)"],
[90, "t1", "vu-lights"],
[[93, 99], "t1", "(pointer uint128)"],
[101, "t1", "(pointer uint128)"]
]
}
9 changes: 7 additions & 2 deletions game/graphics/opengl_renderer/OpenGLRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ void OpenGLRenderer::init_bucket_renderers_jak3() {

m_blit_displays =
init_bucket_renderer<BlitDisplays>("blit", BucketCategory::OTHER, BucketId::BLIT_START);
init_bucket_renderer<VisDataHandler>("vis", BucketCategory::OTHER, BucketId::BUCKET_2);

// 4
init_bucket_renderer<TextureUploadHandler>("tex-lcom-sky-pre", BucketCategory::TEX,
Expand Down Expand Up @@ -286,8 +287,12 @@ void OpenGLRenderer::init_bucket_renderers_jak3() {
init_bucket_renderer<TextureUploadHandler>("tex-hud-hud-alpha", BucketCategory::TEX,
BucketId::TEX_HUD_HUD_ALPHA, texture_animator);

// init_bucket_renderer<TextureUploadHandler>("tex-hud-hud-alpha", BucketCategory::TEX,
// BucketId::TEX_HUD_HUD_ALPHA, texture_animator);
init_bucket_renderer<TextureUploadHandler>("tex-hud-hud-alpha", BucketCategory::TEX,
BucketId::TEX_HUD_HUD_ALPHA, texture_animator);
init_bucket_renderer<TextureUploadHandler>("tex-hud-pris2", BucketCategory::TEX,
BucketId::TEX_HUD_PRIS2, texture_animator);
init_bucket_renderer<ProgressRenderer>("hud-draw-hud-alpha", BucketCategory::OTHER,
BucketId::HUD_DRAW_HUD_ALPHA, 0x1000);

// 583
init_bucket_renderer<DirectRenderer>("debug", BucketCategory::OTHER, BucketId::DEBUG, 0x8000);
Expand Down
2 changes: 1 addition & 1 deletion game/graphics/opengl_renderer/background/Shrub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void Shrub::render(DmaFollower& dma, SharedRenderState* render_state, ScopedProf
memcpy(&m_pc_port_data, pc_port_data.data, sizeof(TfragPcPortData));
m_pc_port_data.level_name[11] = '\0';

if (render_state->version == GameVersion::Jak2) {
if (render_state->version >= GameVersion::Jak2) {
// jak 2 proto visibility
auto proto_mask_data = dma.read_and_advance();
m_proto_vis_data = proto_mask_data.data;
Expand Down
16 changes: 8 additions & 8 deletions game/mips2c/jak3_functions/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ u64 execute(void* ctxt) {
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1
c->vftoi4_sat(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1
// nop // sll r0, r0, 0
c->vmulq(DEST::xyz, vf2, vf2); // vmulq.xyz vf2, vf2, Q
// nop // sll r0, r0, 0
Expand All @@ -1383,7 +1383,7 @@ u64 execute(void* ctxt) {
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->vftoi4(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2
c->vftoi4_sat(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2
// nop // sll r0, r0, 0
c->vmulq(DEST::xyz, vf3, vf3); // vmulq.xyz vf3, vf3, Q
// nop // sll r0, r0, 0
Expand All @@ -1405,7 +1405,7 @@ u64 execute(void* ctxt) {
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->vftoi4(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3
c->vftoi4_sat(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3
// nop // sll r0, r0, 0
c->vmulq(DEST::xyz, vf4, vf4); // vmulq.xyz vf4, vf4, Q
// nop // sll r0, r0, 0
Expand Down Expand Up @@ -1435,7 +1435,7 @@ u64 execute(void* ctxt) {
c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf14); // vaddw.x vf23, vf23, vf14

block_153:
c->vftoi4(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4
c->vftoi4_sat(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
Expand Down Expand Up @@ -2187,7 +2187,7 @@ u64 execute(void* ctxt) {
// nop // sll r0, r0, 0
c->lqc2(vf11, 704, v1); // lqc2 vf11, 704(v1)
// nop // sll r0, r0, 0
c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1
c->vftoi4_sat(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1
// nop // sll r0, r0, 0
c->vmulq(DEST::xyz, vf2, vf2); // vmulq.xyz vf2, vf2, Q
// nop // sll r0, r0, 0
Expand All @@ -2209,7 +2209,7 @@ u64 execute(void* ctxt) {
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->vftoi4(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2
c->vftoi4_sat(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2
// nop // sll r0, r0, 0
c->vmulq(DEST::xyz, vf3, vf3); // vmulq.xyz vf3, vf3, Q
// nop // sll r0, r0, 0
Expand All @@ -2231,7 +2231,7 @@ u64 execute(void* ctxt) {
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->vftoi4(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3
c->vftoi4_sat(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3
// nop // sll r0, r0, 0
c->vmulq(DEST::xyz, vf4, vf4); // vmulq.xyz vf4, vf4, Q
// nop // sll r0, r0, 0
Expand Down Expand Up @@ -2261,7 +2261,7 @@ u64 execute(void* ctxt) {
c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf14); // vaddw.x vf23, vf23, vf14

block_231:
c->vftoi4(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4
c->vftoi4_sat(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
Expand Down
22 changes: 11 additions & 11 deletions goal_src/jak3/engine/draw/drawable.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1501,17 +1501,17 @@
(reset! *prim-work*)

; ;; update wind/time of day prior to drawing.
; (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)
; )
(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 sky
; (with-profiler 'sky *profile-sky-color*
Expand Down
4 changes: 2 additions & 2 deletions goal_src/jak3/engine/game/main.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@
)

; ;; cloth simulation update
; (execute-cloth-engine)
(execute-cloth-engine)

(with-profiler 'debug *profile-debug-color*
;; run debug callbacks
Expand Down Expand Up @@ -1633,7 +1633,7 @@
;; initial setup
(set! *teleport* #t)
(update *setting-control*) ;; dies on camera stuff, which looks for entities.
;; (init-time-of-day-context *time-of-day-context*)
(init-time-of-day-context *time-of-day-context*)
(display-sync gp-1)
(display-frame-finish gp-1)
(display-sync gp-1)
Expand Down

0 comments on commit 23aeda1

Please sign in to comment.