[jak2] GOAL side texture animation stuff (#2766)

It turns out we didn't decompile any of this stuff yet.
This commit is contained in:
water111
2023-06-24 10:11:47 -04:00
committed by GitHub
parent 97fd6a6e8d
commit 2fc943977f
45 changed files with 4197 additions and 391 deletions
+2
View File
@@ -1422,6 +1422,7 @@ class LetElement : public FormElement {
void collect_vars(RegAccessSet& vars, bool recursive) const override;
void get_modified_regs(RegSet& regs) const override;
Form* body() { return m_body; }
const Form* body() const { return m_body; }
void set_body(Form* new_body);
bool allow_in_if() const override { return false; }
@@ -1430,6 +1431,7 @@ class LetElement : public FormElement {
Form* src = nullptr;
};
std::vector<Entry>& entries() { return m_entries; }
const std::vector<Entry>& entries() const { return m_entries; }
void add_entry(const Entry& e);
bool is_star() const { return m_star; }
+3
View File
@@ -51,6 +51,9 @@ const std::map<InstructionKind, OpenGOALAsm::Function> MIPS_ASM_TO_OPEN_GOAL_FUN
{InstructionKind::PCPYLD, {".pcpyld", {}}},
{InstructionKind::PCPYUD, {".pcpyud", {}}},
// MMI Add
{InstructionKind::PADDB, {".paddb", {}}},
// NOTE - depending on how this is used, this may case issues! Be Warned!
// lots of implicit logic in OpenGOAL depending on argument types!
{InstructionKind::MFC1, {".mov", {}}},
@@ -346,6 +346,7 @@ std::unique_ptr<AtomicOp> make_asm_op(const Instruction& i0, int idx) {
case InstructionKind::PPACB:
case InstructionKind::PADDW:
case InstructionKind::PADDH:
case InstructionKind::PADDB:
case InstructionKind::PMAXW:
case InstructionKind::PPACW:
case InstructionKind::PCEQW:
+1
View File
@@ -2583,6 +2583,7 @@ FormElement* rewrite_dma_buffer_add_gs_set(const std::vector<LetElement*>& in,
{"dthe", "gs-dthe"},
{"colclamp", "gs-color-clamp"},
{"xyzf3", "gs-xyzf"},
{"xyz2", "gs-xyz"},
{"xyz3", "gs-xyz"},
{"bitbltbuf", "gs-bitbltbuf"},
{"trxpos", "gs-trxpos"},
+59 -47
View File
@@ -5149,8 +5149,13 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deftype texture-anim-layer (structure)
((extra vector :inline :offset 240)
(func (function texture-anim-layer int) :offset 256)
((interpolated-color vector :inline) ;; added
(interpolated-scale-offset vector :inline)
(interpolated-st-scale-offset vector :inline)
(interpolated-qs vector :inline)
(interpolated-rot vector :inline)
(extra vector :inline :offset 240)
(func (function dma-buffer uint int int texture-anim-layer float int) :offset 256)
(func-id symbol :offset 256)
(init-func (function texture-anim-layer int) :offset 260)
(init-func-id symbol :offset 260)
@@ -5161,6 +5166,9 @@
(test gs-test :offset 280)
(alpha gs-alpha :offset 288)
(clamp gs-clamp :offset 296)
(start-vectors vector 5 :inline :offset 80 :score -10) ;; added
(start-color vector :inline :offset 80)
(start-scale vector2 :inline :offset 96)
(start-offset vector2 :inline :offset 104)
@@ -5169,9 +5177,13 @@
(start-qs vector :inline :offset 128)
(start-rot degrees :offset 144)
(start-st-rot degrees :offset 148)
(end-vectors vector 5 :inline :offset 160 :score -10) ;; added
(end-color vector :inline :offset 160)
(end-scale vector2 :inline :offset 176)
(end-offset vector2 :inline :offset 184)
(end-scale-offset vector :inline :offset 176)
(end-st-scale vector2 :inline :offset 192)
(end-st-offset vector2 :inline :offset 200)
(end-qs vector :inline :offset 208)
@@ -5182,14 +5194,14 @@
:size-assert #x130
:flag-assert #xb00000130
(:methods
(texture-anim-layer-method-9 (_type_) _type_ 9)
(texture-anim-layer-method-10 (_type_) _type_ 10)
(initialize-texture! (_type_) _type_ 9)
(clear-texture! (_type_) _type_ 10)
)
)
(deftype texture-anim (structure)
((num-layers uint32 :offset-assert 0)
(func (function texture-anim int) :offset-assert 4)
(func (function dma-buffer texture-anim int) :offset-assert 4)
(func-id symbol :offset 4)
(init-func (function texture-anim int) :offset-assert 8)
(init-func-id symbol :offset 8)
@@ -5209,8 +5221,8 @@
:size-assert #x58
:flag-assert #xb00000058
(:methods
(texture-anim-method-9 (_type_) _type_ 9)
(texture-anim-method-10 (_type_) _type_ 10)
(init-textures! (_type_) _type_ 9)
(clear-textures! (_type_) _type_ 10)
)
)
@@ -5221,8 +5233,8 @@
:size-assert #x10
:flag-assert #xb00000010
(:methods
(texture-anim-array-method-9 (_type_) _type_ 9)
(texture-anim-array-method-10 (_type_) _type_ 10)
(init! (_type_) _type_ 9)
(clear! (_type_) _type_ 10)
)
)
@@ -5321,7 +5333,7 @@
:flag-assert #x90000008c
)
(define-extern *clut-translate* (pointer uint32))
(define-extern *clut-translate* (pointer uint8))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; lights-h ;;
@@ -24883,49 +24895,49 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-extern *texture-anim-work* texture-anim-work)
;; (define-extern texture-anim-layer-interp function)
;; (define-extern texture-anim-layer-add-shader function)
;; (define-extern texture-anim-layer-add-clut-shader function)
;; (define-extern texture-anim-layer-draw function)
;; (define-extern default-texture-anim-layer-func function)
;; (define-extern blend-clut-texture-anim-layer-func function)
;; (define-extern move-rg-to-ba-texture-anim-layer-func function)
;; (define-extern fill-rgb-texture-anim-layer-func function)
(define-extern update-texture-anim (function bucket-id none))
;; (define-extern no-alpha-texture-anim-layer-func function)
;; (define-extern copy-alpha-texture-anim-layer-func function)
;; (define-extern copy-clut-alpha-texture-anim-layer-func function)
;; (define-extern set-alpha-texture-anim-layer-func function)
;; (define-extern set-clut-alpha-texture-anim-layer-func function)
;; (define-extern dest-texture-init function)
;; (define-extern src-texture-init function)
;; (define-extern src-texture-init-mt8 function)
;; (define-extern make-noise-texture function)
;; (define-extern make-cloud-clut function)
;; (define-extern texture-anim-cloud-clut-upload function)
;; (define-extern texture-anim-cloud-clut-init function)
;; (define-extern make-slime-clut function)
;; (define-extern texture-anim-slime-clut-upload function)
;; (define-extern texture-anim-slime-clut-init function)
;; (define-extern make-ramp-clut function)
;; (define-extern make-alpha-ramp-clut function)
;; (define-extern noise-texture-init function)
;; (define-extern texture-anim-alpha-ramp-clut-upload function)
;; (define-extern texture-anim-alpha-ramp-clut-init function)
;; (define-extern texture-anim-overide-size-init function)
;; (define-extern texture-anim-change-mt8h-init function)
(define-extern texture-anim-layer-interp (function texture-anim-layer float none))
(define-extern texture-anim-layer-add-shader (function dma-buffer texture-anim-layer int none))
(define-extern texture-anim-layer-add-clut-shader (function dma-buffer texture-anim-layer int none))
(define-extern texture-anim-layer-draw (function dma-buffer int int texture-anim-layer none))
(define-extern default-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern blend-clut-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern move-rg-to-ba-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern fill-rgb-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern update-texture-anim (function bucket-id texture-anim-array none))
(define-extern no-alpha-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern copy-alpha-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern copy-clut-alpha-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern set-alpha-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern set-clut-alpha-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern dest-texture-init (function texture-anim none))
(define-extern src-texture-init (function texture-anim-layer none))
(define-extern src-texture-init-mt8 (function texture-anim-layer none))
(define-extern make-noise-texture (function pointer int int int none))
(define-extern make-cloud-clut (function (pointer uint32) float float none))
(define-extern texture-anim-cloud-clut-upload (function dma-buffer texture-anim none))
(define-extern texture-anim-cloud-clut-init (function texture-anim none))
(define-extern make-slime-clut (function (pointer uint32) none))
(define-extern texture-anim-slime-clut-upload (function dma-buffer texture-anim none))
(define-extern texture-anim-slime-clut-init (function texture-anim none))
(define-extern make-ramp-clut (function (pointer uint32) pointer object none))
(define-extern make-alpha-ramp-clut (function (pointer uint32) none))
(define-extern noise-texture-init (function texture-anim-layer none))
(define-extern texture-anim-alpha-ramp-clut-upload (function dma-buffer texture-anim none))
(define-extern texture-anim-alpha-ramp-clut-init (function texture-anim none))
(define-extern texture-anim-overide-size-init (function texture-anim none))
(define-extern texture-anim-change-mt8h-init (function texture-anim none))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; texture-anim-funcs ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (define-extern noise-texture-anim-layer-func function)
;; (define-extern cloud-texture-anim-layer-func function)
;; (define-extern cloud-texture-anim-func function)
;; (define-extern fog-texture-anim-init function)
(define-extern noise-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern cloud-texture-anim-layer-func (function dma-buffer uint int int texture-anim-layer float int))
(define-extern cloud-texture-anim-func (function dma-buffer texture-anim int))
(define-extern fog-texture-anim-init (function texture-anim int))
(define-extern *fog-texture-work* fog-texture-work)
;; (define-extern real-fog-texture-anim-func function)
;; (define-extern fog-texture-anim-func function)
(define-extern real-fog-texture-anim-func (function dma-buffer texture-anim int))
(define-extern fog-texture-anim-func (function dma-buffer texture-anim int))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; texture-anim-tables ;;
@@ -19,7 +19,7 @@
["L6", "texture-base"],
["L5", "texture-base"]
],
"texture-anim-h": [["L1", "(pointer uint32)", 64]],
"texture-anim-h": [["L1", "(pointer uint8)", 256]],
"main-h": [["L3", "frame-stats"]],
"font-h": [
["L20", "matrix"],
@@ -2232,5 +2232,6 @@
[16, "event-message-block"],
[112, ["array", "collide-shape", 32]]
],
"(code impact gun-dark-shot)": [[160, ["array", "collide-shape", 16]]]
"(code impact gun-dark-shot)": [[160, ["array", "collide-shape", 16]]],
"texture-anim-layer-draw": [[16, "matrix"], [80, "matrix"], [144, "matrix"], [208, "matrix"]]
}
@@ -10383,5 +10383,114 @@
"(method 9 texture-anim-layer)": [
[5, "v1", "symbol"],
[11, "v1", "symbol"]
],
"make-noise-texture": [
[32, "t6", "(pointer uint128)"],
[34, "t7", "(pointer uint128)"],
[36, "t4", "(pointer uint128)"],
[42, "t3", "(pointer uint128)"],
[44, "t2", "(pointer uint128)"]
],
"texture-anim-layer-draw": [
[[4, 162], "s4", "(pointer uint128)"]
],
"move-rg-to-ba-texture-anim-layer-func": [
[[305, 313], "a0", "dma-packet"],
[[315, 322], "a0", "gs-gif-tag"],
[325, "v1", "(pointer gs-xy-offset)"],
[327, "v1", "(pointer gs-reg64)"],
[335, "v1", "(pointer gs-frame)"],
[337, "v1", "(pointer gs-reg64)"]
],
"fill-rgb-texture-anim-layer-func": [
[59, "v1", "(pointer uint128)"],
[66, "v1", "(pointer uint128)"],
[[67, 75], "t0", "vector4w"],
[[75, 81], "v1", "vector4w"],
[[85, 93], "a0", "dma-packet"],
[[95, 102], "a0", "gs-gif-tag"],
[109, "v1", "(pointer gs-frame)"],
[111, "v1", "(pointer gs-reg64)"],
[112, "v1", "(pointer uint64)"],
[114, "v1", "(pointer gs-reg64)"]
],
"update-texture-anim": [
[135, "a1", "(pointer uint128)"],
[[137, 152], "t0", "vector4w"],
[[152, 160], "t0", "vector4w"],
[[161, 168], "a1", "vector4w"]
],
"copy-alpha-texture-anim-layer-func": [
[72, "v1", "(pointer uint128)"],
[[73, 86], "t0", "vector4w"],
[[86, 96], "t0", "vector"],
[[96, 102], "t0", "vector4w"],
[[102, 113], "t0", "vector"],
[[113, 119], "t0", "vector4w"],
[[119, 130], "a3", "vector"],
[[130, 136], "a3", "vector4w"],
[[136, 148], "a2", "vector"],
[[149, 155], "v1", "vector4w"],
[[158, 165], "a0", "dma-packet"],
[[167, 173], "a0", "gs-gif-tag"],
[181, "v1", "(pointer gs-frame)"],
[183, "v1", "(pointer gs-reg64)"]
],
"copy-clut-alpha-texture-anim-layer-func": [
[67, "a1", "(pointer uint128)"],
[[68, 81], "t0", "vector4w"],
[[81, 91], "t0", "vector"],
[[91, 97], "t0", "vector4w"],
[[97, 108], "t0", "vector"],
[[108, 114], "t0", "vector4w"],
[[114, 125], "a3", "vector"],
[[125, 131], "a3", "vector4w"],
[[131, 143], "a2", "vector"],
[[144, 149], "a1", "vector4w"],
[[153, 161], "a0", "dma-packet"],
[[162, 168], "a0", "gs-gif-tag"],
[176, "v1", "(pointer gs-frame)"],
[178, "v1", "(pointer gs-reg64)"]
],
"set-alpha-texture-anim-layer-func": [
[49, "t0", "(pointer uint128)"],
[[50, 56], "t4", "vector4w"],
[[56, 64], "t3", "vector4w"],
[[65, 73], "t0", "vector4w"],
[[76, 82], "a3", "dma-packet"],
[[85, 91], "a3", "gs-gif-tag"],
[99, "a2", "(pointer gs-frame)"],
[101, "a2", "(pointer gs-reg64)"]
],
"set-clut-alpha-texture-anim-layer-func": [
[48, "t0", "(pointer uint128)"],
[[48, 55], "t4", "vector4w"],
[[55, 63], "t3", "vector4w"],
[[64, 72], "t0", "vector4w"],
[[75, 81], "a3", "dma-packet"],
[[84, 90], "a3", "gs-gif-tag"],
[98, "a2", "(pointer gs-frame)"],
[100, "a2", "(pointer gs-reg64)"]
],
"noise-texture-anim-layer-func": [
[[104, 110], "a0", "dma-packet"],
[[113, 119], "a0", "gs-gif-tag"],
[127, "v1", "(pointer gs-frame)"],
[129, "v1", "(pointer gs-reg64)"]
],
"real-fog-texture-anim-func": [
[[0, 256], "s2", "(pointer uint32)"],
[[239, 245], "a0", "dma-packet"],
[[248, 254], "a0", "gs-gif-tag"],
[259, "v1", "(pointer gs-reg64)"]
]
}
@@ -4248,5 +4248,65 @@
"vars": {
"v1-7": ["enm-options", "enemy-option"]
}
},
"texture-anim-layer-draw": {
"args": ["dma-buf", "width", "height", "layer"]
},
"default-texture-anim-layer-func": {
"args": ["dma-buf", "arg1", "width", "height", "layer", "time"]
},
"blend-clut-texture-anim-layer-func": {
"args": ["dma-buf", "arg1", "width", "height", "layer", "time"]
},
"move-rg-to-ba-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"],
"vars": {
"s2-0": "tw",
"v1-1": "th",
"a1-1": "tbp",
"a0-6": "tbw",
"a2-1": "fbmask"
}
},
"fill-rgb-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"]
},
"update-texture-anim": {
"args": ["bucket", "anim-array"],
"vars": {"s3-0": "dma-buf", "s2-0": "anim-idx", "s1-0": "anim", "v1-11": "dest-tex", "s0-0": "tex-width", "sv-16": "tex-height",
"sv-32": "fbp-for-tex", "sv-48": "layer-idx", "t0-6": "layer"}
},
"no-alpha-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"]
},
"dest-texture-init": {
"args": ["tex-anim"],
"vars": {"v1-1":"dest-tex", "a0-2": "size", "a1-1": "dest"}
},
"src-texture-init": {
"args": ["layer"],
"vars": {"v1-1": "tex", "a0-2":"size", "a1-1":"addr"}
},
"copy-alpha-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"]
},
"copy-clut-alpha-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"]
},
"set-alpha-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"]
},
"set-clut-alpha-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"]
},
"src-texture-init-mt8": {
"args": ["layer"],
"vars" : {"v1-1": "tex", "a0-2": "width", "a1-1": "height", "a2-0": "dest", "a3-0":"clutdest"}
},
"noise-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"]
},
"cloud-texture-anim-layer-func": {
"args": ["dma-buf", "fbp-to-draw", "width", "height", "layer", "time"]
}
}
+1
View File
@@ -58,6 +58,7 @@ set(RUNTIME_SOURCE
graphics/opengl_renderer/sprite/Sprite3_Distort.cpp
graphics/opengl_renderer/sprite/Sprite3_Glow.cpp
graphics/opengl_renderer/sprite/Sprite3.cpp
graphics/opengl_renderer/TextureAnimator.cpp
graphics/opengl_renderer/TextureUploadHandler.cpp
graphics/opengl_renderer/VisDataHandler.cpp
graphics/opengl_renderer/Warp.cpp
@@ -7,6 +7,7 @@
#include "game/graphics/opengl_renderer/Profiler.h"
#include "game/graphics/opengl_renderer/Shader.h"
#include "game/graphics/opengl_renderer/TextureAnimator.h"
#include "game/graphics/opengl_renderer/buckets.h"
#include "game/graphics/opengl_renderer/loader/Loader.h"
#include "game/graphics/texture/TexturePool.h"
@@ -31,6 +32,7 @@ struct SharedRenderState {
ShaderLibrary shaders;
std::shared_ptr<TexturePool> texture_pool;
std::shared_ptr<Loader> loader;
std::shared_ptr<TextureAnimator> texture_animator;
u32 buckets_base = 0; // address of buckets array.
u32 next_bucket = 0; // address of next bucket that we haven't started rendering in buckets
@@ -92,6 +92,7 @@ OpenGLRenderer::OpenGLRenderer(std::shared_ptr<TexturePool> texture_pool,
init_bucket_renderers_jak1();
break;
case GameVersion::Jak2:
m_render_state.texture_animator = std::make_shared<TextureAnimator>();
init_bucket_renderers_jak2();
break;
default:
@@ -1181,6 +1182,8 @@ void OpenGLRenderer::finish_screenshot(const std::string& output_name,
// copy to clipboard (windows only)
copy_texture_to_clipboard(width, height, buffer);
}
#else
(void)quick_screenshot;
#endif
// flip upside down in place
@@ -0,0 +1,10 @@
#include "TextureAnimator.h"
void TextureAnimator::handle_texture_anim_data(DmaFollower& dma) {
auto vif0 = dma.current_tag_vifcode0();
while (vif0.kind != VifCode::Kind::PC_PORT || vif0.immediate != 13) {
dma.read_and_advance();
vif0 = dma.current_tag_vifcode0();
}
dma.read_and_advance();
}
@@ -0,0 +1,8 @@
#pragma once
#include "common/dma/dma_chain_read.h"
class TextureAnimator {
public:
void handle_texture_anim_data(DmaFollower& dma);
};
@@ -22,6 +22,11 @@ void TextureUploadHandler::render(DmaFollower& dma,
while (dma.current_tag_offset() != render_state->next_bucket) {
auto dma_tag = dma.current_tag();
auto vif0 = dma.current_tag_vifcode0();
if (vif0.kind == VifCode::Kind::PC_PORT && vif0.immediate == 12) {
dma.read_and_advance();
render_state->texture_animator->handle_texture_anim_data(dma);
}
// does it look like data to do eye rendering?
if (dma_tag.qwc == (128 / 16)) {
// note: these uploads may have texture that we need for eye rendering.
+1 -1
View File
@@ -8,7 +8,7 @@ void Warp::draw_debug_window() {
}
void Warp::render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) {
m_fb_copier.copy_now(render_state->render_fb_w, render_state->render_fb_h, 0, 0,
m_fb_copier.copy_now(render_state->render_fb_w, render_state->render_fb_h,
render_state->render_fb);
render_state->texture_pool->move_existing_to_vram(m_warp_src_tex, m_tbp);
m_generic->render_in_mode(dma, render_state, prof, Generic2::Mode::WARP);
@@ -177,11 +177,7 @@ FramebufferCopier::~FramebufferCopier() {
glDeleteFramebuffers(1, &m_fbo);
}
void FramebufferCopier::copy_now(int render_fb_w,
int render_fb_h,
int render_fb_x,
int render_fb_y,
GLuint render_fb) {
void FramebufferCopier::copy_now(int render_fb_w, int render_fb_h, GLuint render_fb) {
if (m_fbo_width != render_fb_w || m_fbo_height != render_fb_h) {
m_fbo_width = render_fb_w;
m_fbo_height = render_fb_h;
+1 -5
View File
@@ -64,11 +64,7 @@ class FramebufferCopier {
~FramebufferCopier();
FramebufferCopier(const FramebufferCopier&) = delete;
FramebufferCopier& operator=(const FramebufferCopier&) = delete;
void copy_now(int render_fb_w,
int render_fb_h,
int render_fb_x,
int render_fb_y,
GLuint render_fb);
void copy_now(int render_fb_w, int render_fb_h, GLuint render_fb);
u64 texture() const { return m_fbo_texture; }
private:
-1
View File
@@ -525,7 +525,6 @@ void update_discord_rpc(u32 discord_info) {
// Get the data from GOAL
int orbs = (int)info->orb_count;
int gems = (int)info->gem_count;
u32 deaths = info->death_count;
// convert encodings
std::string status = get_font_bank(GameTextVersion::JAK2)
->convert_game_to_utf8(Ptr<String>(info->status).c()->data());
@@ -93,10 +93,10 @@ void simplified1(BlercContext* context, u8* ee_buffer) {
}
}
} // namespace
void blerc_c(void* a, void* b) {
simplified1((BlercContext*)a, (u8*)b);
}
} // namespace
// clang-format off
+2 -2
View File
@@ -173,7 +173,7 @@ void DisplayManager::set_window_size(int width, int height) {
void DisplayManager::enqueue_set_window_display_mode(WindowDisplayMode mode) {
const std::lock_guard<std::mutex> lock(event_queue_mtx);
ee_event_queue.push({EEDisplayEventType::SET_WINDOW_DISPLAY_MODE, mode});
ee_event_queue.push({EEDisplayEventType::SET_WINDOW_DISPLAY_MODE, mode, {}});
}
void DisplayManager::set_window_display_mode(WindowDisplayMode mode) {
@@ -235,7 +235,7 @@ void DisplayManager::set_window_display_mode(WindowDisplayMode mode) {
void DisplayManager::enqueue_set_fullscreen_display_id(int display_id) {
const std::lock_guard<std::mutex> lock(event_queue_mtx);
ee_event_queue.push({EEDisplayEventType::SET_FULLSCREEN_DISPLAY_ID, display_id});
ee_event_queue.push({EEDisplayEventType::SET_FULLSCREEN_DISPLAY_ID, display_id, {}});
}
void DisplayManager::set_fullscreen_display_id(int display_id) {
+4 -4
View File
@@ -111,7 +111,7 @@ void InputManager::refresh_device_list() {
void InputManager::enqueue_ignore_background_controller_events(const bool ignore) {
const std::lock_guard<std::mutex> lock(m_event_queue_mtx);
ee_event_queue.push({EEInputEventType::IGNORE_BACKGROUND_CONTROLLER_EVENTS, ignore});
ee_event_queue.push({EEInputEventType::IGNORE_BACKGROUND_CONTROLLER_EVENTS, ignore, {}, {}, {}});
}
void InputManager::ignore_background_controller_events(const bool ignore) {
@@ -347,7 +347,7 @@ void InputManager::enqueue_update_rumble(const int port,
const u8 low_intensity,
const u8 high_intensity) {
const std::lock_guard<std::mutex> lock(m_event_queue_mtx);
ee_event_queue.push({EEInputEventType::UPDATE_RUMBLE, port, low_intensity, high_intensity});
ee_event_queue.push({EEInputEventType::UPDATE_RUMBLE, port, low_intensity, high_intensity, {}});
}
int InputManager::update_rumble(int port, u8 low_intensity, u8 high_intensity) {
@@ -371,7 +371,7 @@ void InputManager::enqueue_update_mouse_options(const bool enabled,
const bool control_movement) {
const std::lock_guard<std::mutex> lock(m_event_queue_mtx);
ee_event_queue.push(
{EEInputEventType::UPDATE_MOUSE_OPTIONS, enabled, control_camera, control_movement});
{EEInputEventType::UPDATE_MOUSE_OPTIONS, enabled, control_camera, control_movement, {}});
}
void InputManager::update_mouse_options(const bool enabled,
@@ -436,7 +436,7 @@ void InputManager::reset_input_bindings_to_defaults(const int port,
void InputManager::enqueue_set_auto_hide_mouse(const bool auto_hide_mouse) {
const std::lock_guard<std::mutex> lock(m_event_queue_mtx);
ee_event_queue.push({EEInputEventType::SET_AUTO_HIDE_MOUSE, auto_hide_mouse});
ee_event_queue.push({EEInputEventType::SET_AUTO_HIDE_MOUSE, auto_hide_mouse, {}, {}, {}});
}
void InputManager::set_auto_hide_mouse(const bool auto_hide_mouse) {
@@ -282,7 +282,7 @@
(defmethod ocean-method-80 ocean ((obj ocean) (arg0 (pointer rgba)))
(dotimes (v1-0 256)
(let ((a0-3 (-> (the-as (pointer uint8) (&+ *clut-translate* v1-0)))))
(let ((a0-3 (-> *clut-translate* v1-0)))
(set! (-> arg0 a0-3 r) v1-0)
(set! (-> arg0 a0-3 g) v1-0)
(set! (-> arg0 a0-3 b) v1-0)
@@ -434,9 +434,9 @@
(dotimes (a3-9 (/ s5-1 16))
(dma-buffer-add-gs-set arg0
(uv (new 'static 'gs-uv :v #x8 :u (+ (* a3-9 256) 8)))
(xyz2 (shr (shl (+ (* a3-9 256) 128) 48) 48))
(xyz2 (new 'static 'gs-xyz :x (+ (* a3-9 256) 128)))
(uv (new 'static 'gs-uv :u (+ (* a3-9 256) 136) :v (+ (* a2-6 16) 8)))
(xyz2 (logior (shr (shl (+ (* a3-9 256) 256) 48) 48) (shr (shl (* a2-6 16) 48) 32)))
(xyz2 (new 'static 'gs-xyz :y (* a2-6 16) :x (+ (* a3-9 256) 256)))
)
)
)
@@ -453,9 +453,9 @@
(dotimes (v1-73 (/ s5-1 16))
(dma-buffer-add-gs-set arg0
(uv (new 'static 'gs-uv :v #x8 :u (+ (* v1-73 256) 8)))
(xyz2 (shr (shl (+ (* v1-73 256) 128) 48) 48))
(xyz2 (new 'static 'gs-xyz :x (+ (* v1-73 256) 128)))
(uv (new 'static 'gs-uv :u (+ (* v1-73 256) 136) :v (+ (* s4-3 16) 8)))
(xyz2 (logior (shr (shl (+ (* v1-73 256) 256) 48) 48) (shr (shl (* s4-3 16) 48) 32)))
(xyz2 (new 'static 'gs-xyz :y (* s4-3 16) :x (+ (* v1-73 256) 256)))
)
)
)
@@ -5,8 +5,239 @@
;; name in dgo: texture-anim-funcs
;; dgos: ENGINE, GAME
;; temp
(define *fog-texture-work* (new 'static 'fog-texture-work :const (new 'static 'vector :x 0.00390625)))
;; DECOMP BEGINS
(defun noise-texture-anim-layer-func ((dma-buf dma-buffer) (fbp-to-draw uint) (width int) (height int) (layer texture-anim-layer) (time float))
(when (and (>= time (-> layer start-time)) (< time (-> layer end-time)))
(texture-anim-layer-interp layer time)
(when (!= (-> layer interpolated-color w) 0.0)
(upload-vram-data dma-buf (the-as int (-> layer tex dest 0)) (the-as pointer (-> layer tex pad 0)) 32 32)
(dma-buffer-add-gs-set dma-buf (texflush 0))
(texture-anim-layer-add-shader dma-buf layer 1)
(let ((s1-0 (/ (+ width 63) 64)))
(dma-buffer-add-gs-set dma-buf (frame-1 (new 'static 'gs-frame :fbmsk #xffffff :fbw s1-0 :fbp fbp-to-draw)))
(texture-anim-layer-draw dma-buf width height layer)
(let* ((v1-13 dma-buf)
(a0-17 (the-as object (-> v1-13 base)))
)
(set! (-> (the-as dma-packet a0-17) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
(set! (-> (the-as dma-packet a0-17) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet a0-17) vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1))
(set! (-> v1-13 base) (&+ (the-as pointer a0-17) 16))
)
(let* ((v1-14 dma-buf)
(a0-19 (the-as object (-> v1-14 base)))
)
(set! (-> (the-as gs-gif-tag a0-19) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
(set! (-> (the-as gs-gif-tag a0-19) regs) GIF_REGS_ALL_AD)
(set! (-> v1-14 base) (&+ (the-as pointer a0-19) 16))
)
(let ((v1-15 (-> dma-buf base)))
(set! (-> (the-as (pointer gs-frame) v1-15) 0) (new 'static 'gs-frame :fbw s1-0 :fbp fbp-to-draw))
(set! (-> (the-as (pointer gs-reg64) v1-15) 1) (gs-reg64 frame-1))
(set! (-> dma-buf base) (&+ v1-15 16))
)
)
)
)
0
)
(defun cloud-texture-anim-layer-func ((dma-buf dma-buffer) (fbp-to-draw uint) (width int) (height int) (layer texture-anim-layer) (time float))
(when (and (>= time (-> layer start-time)) (< time (-> layer end-time)))
(texture-anim-layer-interp layer time)
(when (!= (-> layer interpolated-color w) 0.0)
(let* ((v1-4 (-> layer tex))
(t0-1 (/ (-> v1-4 w) 2))
(a3-1 (/ (-> v1-4 h) 2))
)
(upload-vram-data dma-buf (the-as int (-> v1-4 dest 0)) (the-as pointer (-> v1-4 pad 0)) a3-1 t0-1)
)
(dma-buffer-add-gs-set dma-buf (texflush 0))
(texture-anim-layer-add-shader dma-buf layer 1)
(texture-anim-layer-draw dma-buf width height layer)
)
)
0
)
(defun cloud-texture-anim-func ((arg0 dma-buffer) (arg1 texture-anim))
(with-pp
(when (>= (+ (-> arg1 frame-time) (* (-> arg1 frame-delta) (-> pp clock seconds-per-frame))) (-> arg1 frame-mod))
(let ((s5-0 (-> arg1 data 0 tex))
(s4-0 (-> arg1 data 1 tex))
(s3-0 (-> arg1 data 0 tex w))
)
(when (not (paused?))
(set! (-> arg1 data 0 tex) s4-0)
(set! (-> arg1 data 1 tex) s5-0)
(make-noise-texture (the-as pointer (-> s5-0 pad 0)) s3-0 s3-0 s3-0)
)
)
)
0
)
)
(defun fog-texture-anim-init ((arg0 texture-anim))
(let ((gp-0 (new 'loading-level 'fog8x256))
(s4-0 (new 'loading-level 'clut16x16))
)
(when (and gp-0 s4-0)
(let ((v1-5 (new 'loading-level 'texture)))
(let ((a0-4 (the int (-> arg0 extra x)))
(a1-3 (the int (-> arg0 extra y)))
)
(set! (-> arg0 tex) v1-5)
(set! (-> v1-5 pad 0) (the-as uint gp-0))
(set! (-> v1-5 pad 1) (the-as uint s4-0))
(set! (-> v1-5 w) 256)
(set! (-> v1-5 h) 1)
(set! (-> v1-5 num-mips) (the-as uint 1))
(set! (-> v1-5 psm) (gs-psm mt8))
(set! (-> v1-5 clutpsm) (the-as uint 0))
(set! (-> v1-5 dest 0) (the-as uint (* a0-4 32)))
(set! (-> v1-5 clutdest) (the-as uint (* a1-3 32)))
)
(set! (-> v1-5 width 0) (the-as uint 4))
(set! (-> v1-5 masks data 0 mask quad) (the-as uint128 0))
(set! (-> v1-5 masks data 1 mask quad) (the-as uint128 0))
(set! (-> v1-5 masks data 2 mask quad) (the-as uint128 0))
)
0
(dotimes (v1-7 256)
(nop!)
(nop!)
(nop!)
(nop!)
(set! (-> gp-0 image v1-7) (the-as uint v1-7))
)
)
)
0
)
(define *fog-texture-work* (new 'static 'fog-texture-work :const (new 'static 'vector :x 0.00390625)))
;; WARN: Return type mismatch symbol vs int.
(defun real-fog-texture-anim-func ((arg0 dma-buffer) (arg1 texture-anim))
(local-vars (sv-48 int))
(let ((s4-0 (new 'stack-no-clear 'vector))
(s3-0 (new 'stack-no-clear 'vector))
(s1-0 *fog-texture-work*)
(s2-0 (the-as (pointer uint32) (-> arg1 tex pad 1)))
)
(let ((v1-1 (-> s1-0 color)))
(dotimes (a0-1 256)
(set! (-> s2-0 a0-1) v1-1)
)
)
(set! sv-48 0)
(let ((s0-0 0))
(let ((f0-0 40955904.0)
(f1-0 -40955904.0)
)
(dotimes (v1-7 4)
(let ((f2-0 (-> *fog-texture-work* corner v1-7 y)))
(when (< f2-0 f0-0)
(set! f0-0 f2-0)
(set! sv-48 v1-7)
sv-48
)
(when (< f1-0 f2-0)
(set! f1-0 f2-0)
(set! s0-0 v1-7)
)
)
)
)
(set! (-> s4-0 quad) (-> *fog-texture-work* corner sv-48 quad))
(vector-! s3-0 (-> *fog-texture-work* corner s0-0) (-> *fog-texture-work* corner sv-48))
(vector-float/! s3-0 s3-0 256.0)
(set! (-> *fog-texture-work* min-corner quad) (-> *fog-texture-work* corner sv-48 quad))
(set! (-> *fog-texture-work* max-corner quad) (-> *fog-texture-work* corner s0-0 quad))
)
0.0
0.0
(let ((f0-4 (fmax 4096.0 (-> *math-camera* trans y)))
(f1-2 (-> arg1 extra z))
(f2-1 (-> s1-0 alpha-near))
(f3-0 (-> s1-0 alpha-far))
(f4-0 (-> s1-0 alpha-delta))
(f5-0 (-> s1-0 fog-near))
(f6-0 (-> s1-0 fog-far))
(f7-0 (-> s1-0 fog-delta))
)
(dotimes (v1-19 256)
(let* ((f8-0 (-> s4-0 y))
(f8-1 (cond
((= f8-0 0.0)
f3-0
)
((< f8-0 0.0)
(let ((f9-4 (fmin f6-0 (/ (* f0-4 (vector-length s4-0)) (- f8-0)))))
(+ f2-1 (* f4-0 (/ (fmax 0.0 (- f9-4 f5-0)) f7-0)))
)
)
(else
(let ((f9-8 (fmin f6-0 (/ (* f1-2 (vector-length s4-0)) f8-0))))
(+ f2-1 (* f4-0 (/ (fmax 0.0 (- f9-8 f5-0)) f7-0)))
)
)
)
)
)
(set! (-> s2-0 (-> *clut-translate* v1-19))
(logior (logand (-> s2-0 (-> *clut-translate* v1-19)) (the-as uint #xffffffff00ffffff))
(shr (shl (the int (* 128.0 f8-1)) 56) 32)
)
)
)
(vector+! s4-0 s4-0 s3-0)
)
)
)
(let ((s5-1 (-> arg1 tex)))
(dma-buffer-add-gs-set arg0
(bitbltbuf
(new 'static 'gs-bitbltbuf :dpsm (the-as int (-> s5-1 psm)) :dbp (-> s5-1 dest 0) :dbw (-> s5-1 width 0))
)
(trxpos (new 'static 'gs-trxpos))
(trxreg (new 'static 'gs-trxreg :rrw (-> s5-1 w) :rrh (-> s5-1 h)))
(trxdir (new 'static 'gs-trxdir))
)
(dma-buffer-add-ref-texture arg0 (the-as pointer (-> s5-1 pad 0)) (-> s5-1 w) (-> s5-1 h) (-> s5-1 psm))
(upload-vram-data arg0 (the-as int (-> s5-1 clutdest)) (the-as pointer (-> s5-1 pad 1)) 16 16)
(set! (-> *texture-pool* ids (shr (-> s5-1 clutdest) 6)) (the-as uint 0))
(let* ((v1-29 arg0)
(a0-51 (the-as object (-> v1-29 base)))
)
(set! (-> (the-as dma-packet a0-51) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
(set! (-> (the-as dma-packet a0-51) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet a0-51) vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1))
(set! (-> v1-29 base) (&+ (the-as pointer a0-51) 16))
)
(let* ((v1-30 arg0)
(a0-53 (the-as object (-> v1-30 base)))
)
(set! (-> (the-as gs-gif-tag a0-53) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
(set! (-> (the-as gs-gif-tag a0-53) regs) GIF_REGS_ALL_AD)
(set! (-> v1-30 base) (&+ (the-as pointer a0-53) 16))
)
(let ((v1-31 (-> arg0 base)))
(set! (-> (the-as (pointer int64) v1-31)) 0)
(set! (-> (the-as (pointer gs-reg64) v1-31) 1) (gs-reg64 texflush))
(set! (-> arg0 base) (&+ v1-31 16))
)
(let ((v1-34 (shr (-> s5-1 dest 0) 6)))
(dotimes (a0-56 3)
(set! (-> *texture-pool* ids (+ v1-34 a0-56)) (the-as uint 0))
)
)
)
(the-as int #f)
)
(defun fog-texture-anim-func ((arg0 dma-buffer) (arg1 texture-anim))
(real-fog-texture-anim-func arg0 arg1)
)
+305 -101
View File
@@ -5,7 +5,7 @@
;; name in dgo: texture-anim-h
;; dgos: ENGINE, GAME
(define-extern update-texture-anim (function bucket-id none))
(define-extern update-texture-anim (function bucket-id texture-anim-array none))
;; NOTE - for intro-scenes
(define-extern set-jakb-prison-texture-morph! (function float none))
@@ -13,48 +13,60 @@
;; DECOMP BEGINS
(deftype texture-anim-layer (structure)
((extra vector :inline :offset 240)
(func (function texture-anim-layer int) :offset 256)
(func-id symbol :offset 256)
(init-func (function texture-anim-layer int) :offset 260)
(init-func-id symbol :offset 260)
(tex texture :offset 264)
(start-time float :offset 268)
(end-time float :offset 272)
(tex-name string :offset 276)
(test gs-test :offset 280)
(alpha gs-alpha :offset 288)
(clamp gs-clamp :offset 296)
(start-color vector :inline :offset 80)
(start-scale vector2 :inline :offset 96)
(start-offset vector2 :inline :offset 104)
(start-st-scale vector2 :inline :offset 112)
(start-st-offset vector2 :inline :offset 120)
(start-qs vector :inline :offset 128)
(start-rot degrees :offset 144)
(start-st-rot degrees :offset 148)
(end-color vector :inline :offset 160)
(end-scale vector2 :inline :offset 176)
(end-offset vector2 :inline :offset 184)
(end-st-scale vector2 :inline :offset 192)
(end-st-offset vector2 :inline :offset 200)
(end-qs vector :inline :offset 208)
(end-rot degrees :offset 224)
(end-st-rot degrees :offset 228)
((interpolated-color vector :inline) ;; added
(interpolated-scale-offset vector :inline)
(interpolated-st-scale-offset vector :inline)
(interpolated-qs vector :inline)
(interpolated-rot vector :inline)
(extra vector :inline :offset 240)
(func (function dma-buffer uint int int texture-anim-layer float int) :offset 256)
(func-id symbol :offset 256)
(init-func (function texture-anim-layer int) :offset 260)
(init-func-id symbol :offset 260)
(tex texture :offset 264)
(start-time float :offset 268)
(end-time float :offset 272)
(tex-name string :offset 276)
(test gs-test :offset 280)
(alpha gs-alpha :offset 288)
(clamp gs-clamp :offset 296)
(start-vectors vector 5 :inline :offset 80) ;; added
(start-color vector :inline :offset 80)
(start-scale vector2 :inline :offset 96)
(start-offset vector2 :inline :offset 104)
(start-st-scale vector2 :inline :offset 112)
(start-st-offset vector2 :inline :offset 120)
(start-qs vector :inline :offset 128)
(start-rot degrees :offset 144)
(start-st-rot degrees :offset 148)
(end-vectors vector 5 :inline :offset 160) ;; added
(end-color vector :inline :offset 160)
(end-scale vector2 :inline :offset 176)
(end-offset vector2 :inline :offset 184)
(end-scale-offset vector :inline :offset 176)
(end-st-scale vector2 :inline :offset 192)
(end-st-offset vector2 :inline :offset 200)
(end-qs vector :inline :offset 208)
(end-rot degrees :offset 224)
(end-st-rot degrees :offset 228)
)
:method-count-assert 11
:size-assert #x130
:flag-assert #xb00000130
(:methods
(texture-anim-layer-method-9 (_type_) _type_ 9)
(texture-anim-layer-method-10 (_type_) _type_ 10)
(initialize-texture! (_type_) _type_ 9)
(clear-texture! (_type_) _type_ 10)
)
)
(deftype texture-anim (structure)
((num-layers uint32 :offset-assert 0)
(func (function texture-anim int) :offset-assert 4)
(func (function dma-buffer texture-anim int) :offset-assert 4)
(func-id symbol :offset 4)
(init-func (function texture-anim int) :offset-assert 8)
(init-func-id symbol :offset 8)
@@ -74,8 +86,8 @@
:size-assert #x58
:flag-assert #xb00000058
(:methods
(texture-anim-method-9 (_type_) _type_ 9)
(texture-anim-method-10 (_type_) _type_ 10)
(init-textures! (_type_) _type_ 9)
(clear-textures! (_type_) _type_ 10)
)
)
@@ -87,8 +99,8 @@
:size-assert #x10
:flag-assert #xb00000010
(:methods
(texture-anim-array-method-9 (_type_) _type_ 9)
(texture-anim-array-method-10 (_type_) _type_ 10)
(init! (_type_) _type_ 9)
(clear! (_type_) _type_ 10)
)
)
@@ -195,70 +207,262 @@
)
(define *clut-translate* (new 'static 'array uint32 64
#x3020100
#x7060504
#x13121110
#x17161514
#xb0a0908
#xf0e0d0c
#x1b1a1918
#x1f1e1d1c
#x23222120
#x27262524
#x33323130
#x37363534
#x2b2a2928
#x2f2e2d2c
#x3b3a3938
#x3f3e3d3c
#x43424140
#x47464544
#x53525150
#x57565554
#x4b4a4948
#x4f4e4d4c
#x5b5a5958
#x5f5e5d5c
#x63626160
#x67666564
#x73727170
#x77767574
#x6b6a6968
#x6f6e6d6c
#x7b7a7978
#x7f7e7d7c
#x83828180
#x87868584
#x93929190
#x97969594
#x8b8a8988
#x8f8e8d8c
#x9b9a9998
#x9f9e9d9c
#xa3a2a1a0
#xa7a6a5a4
#xb3b2b1b0
#xb7b6b5b4
#xabaaa9a8
#xafaeadac
#xbbbab9b8
#xbfbebdbc
#xc3c2c1c0
#xc7c6c5c4
#xd3d2d1d0
#xd7d6d5d4
#xcbcac9c8
#xcfcecdcc
#xdbdad9d8
#xdfdedddc
#xe3e2e1e0
#xe7e6e5e4
#xf3f2f1f0
#xf7f6f5f4
#xebeae9e8
#xefeeedec
#xfbfaf9f8
#xfffefdfc
(define *clut-translate* (new 'static 'array uint8 256
#x0
#x1
#x2
#x3
#x4
#x5
#x6
#x7
#x10
#x11
#x12
#x13
#x14
#x15
#x16
#x17
#x8
#x9
#xa
#xb
#xc
#xd
#xe
#xf
#x18
#x19
#x1a
#x1b
#x1c
#x1d
#x1e
#x1f
#x20
#x21
#x22
#x23
#x24
#x25
#x26
#x27
#x30
#x31
#x32
#x33
#x34
#x35
#x36
#x37
#x28
#x29
#x2a
#x2b
#x2c
#x2d
#x2e
#x2f
#x38
#x39
#x3a
#x3b
#x3c
#x3d
#x3e
#x3f
#x40
#x41
#x42
#x43
#x44
#x45
#x46
#x47
#x50
#x51
#x52
#x53
#x54
#x55
#x56
#x57
#x48
#x49
#x4a
#x4b
#x4c
#x4d
#x4e
#x4f
#x58
#x59
#x5a
#x5b
#x5c
#x5d
#x5e
#x5f
#x60
#x61
#x62
#x63
#x64
#x65
#x66
#x67
#x70
#x71
#x72
#x73
#x74
#x75
#x76
#x77
#x68
#x69
#x6a
#x6b
#x6c
#x6d
#x6e
#x6f
#x78
#x79
#x7a
#x7b
#x7c
#x7d
#x7e
#x7f
#x80
#x81
#x82
#x83
#x84
#x85
#x86
#x87
#x90
#x91
#x92
#x93
#x94
#x95
#x96
#x97
#x88
#x89
#x8a
#x8b
#x8c
#x8d
#x8e
#x8f
#x98
#x99
#x9a
#x9b
#x9c
#x9d
#x9e
#x9f
#xa0
#xa1
#xa2
#xa3
#xa4
#xa5
#xa6
#xa7
#xb0
#xb1
#xb2
#xb3
#xb4
#xb5
#xb6
#xb7
#xa8
#xa9
#xaa
#xab
#xac
#xad
#xae
#xaf
#xb8
#xb9
#xba
#xbb
#xbc
#xbd
#xbe
#xbf
#xc0
#xc1
#xc2
#xc3
#xc4
#xc5
#xc6
#xc7
#xd0
#xd1
#xd2
#xd3
#xd4
#xd5
#xd6
#xd7
#xc8
#xc9
#xca
#xcb
#xcc
#xcd
#xce
#xcf
#xd8
#xd9
#xda
#xdb
#xdc
#xdd
#xde
#xdf
#xe0
#xe1
#xe2
#xe3
#xe4
#xe5
#xe6
#xe7
#xf0
#xf1
#xf2
#xf3
#xf4
#xf5
#xf6
#xf7
#xe8
#xe9
#xea
#xeb
#xec
#xed
#xee
#xef
#xf8
#xf9
#xfa
#xfb
#xfc
#xfd
#xfe
#xff
)
)
File diff suppressed because it is too large Load Diff
@@ -11,20 +11,24 @@
(setup-font-texture *texture-pool*)
;; (let ((v1-2 (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #x70c))))
;; (when v1-2
;; (set! (-> v1-2 w) 32)
;; (set! (-> v1-2 h) 32)
;; (set! (-> v1-2 dest 0) (-> *skull-gem-texture-base* vram-block))
;; )
;; )
(let ((v1-2 (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #x70c))))
(when v1-2
(set! (-> v1-2 w) 32)
(set! (-> v1-2 h) 32)
(set! (-> v1-2 dest 0) (-> *skull-gem-texture-base* vram-block))
)
)
;; (texture-anim-array-method-9 *sky-texture-anim-array*)
;; failed to figure out what this is:
(init! *sky-texture-anim-array*)
;; (texture-anim-array-method-9 *darkjak-texture-anim-array*)
;; failed to figure out what this is:
(init! *darkjak-texture-anim-array*)
;; (texture-anim-array-method-9 *skull-gem-texture-anim-array*)
;; failed to figure out what this is:
(init! *skull-gem-texture-anim-array*)
;; (texture-anim-array-method-9 *bomb-texture-anim-array*)
;; failed to figure out what this is:
(init! *bomb-texture-anim-array*)
(kmemclose)
+8 -6
View File
@@ -1672,9 +1672,11 @@ additionally, some texture pages have a chunk system that allows more specific c
(dotimes (s2-1 LEVEL_TOTAL)
(let ((v1-54 (-> *level* level s2-1)))
(when (or (= (-> v1-54 status) 'active) (= (-> v1-54 status) 'reserved))
(if (-> v1-54 texture-anim-array 5)
(update-texture-anim bucket)
)
(let ((a1-26 (-> v1-54 texture-anim-array 5)))
(if a1-26
(update-texture-anim bucket a1-26)
)
)
)
)
)
@@ -1687,14 +1689,14 @@ additionally, some texture pages have a chunk system that allows more specific c
(let ((f30-0 (-> pp clock seconds-per-frame)))
(set! (-> pp clock seconds-per-frame) (* 10.0 (-> pp clock seconds-per-frame)))
(if s2-0
(update-texture-anim bucket)
(update-texture-anim bucket s2-0)
)
(set! (-> pp clock seconds-per-frame) f30-0)
)
)
(else
(if s2-0
(update-texture-anim bucket)
(update-texture-anim bucket s2-0)
)
)
)
@@ -1702,7 +1704,7 @@ additionally, some texture pages have a chunk system that allows more specific c
(else
;; otherwise, just update if there's any anims.
(if s2-0
(update-texture-anim bucket)
(update-texture-anim bucket s2-0)
)
)
)
+4 -4
View File
@@ -1075,9 +1075,9 @@ into 7 sections, which might explain the weird sizes in the center.
(let ((a0-8 (-> obj info texture-anim s4-0)))
(when a0-8
(set! (-> obj info texture-anim s4-0) #f)
#|(set! (-> obj texture-anim-array s4-0)
(texture-anim-array-method-9 (the-as texture-anim-array (-> a0-8 value)))
)|#
(set! (-> obj texture-anim-array s4-0)
(init! (the-as texture-anim-array (-> a0-8 value)))
)
)
)
)
@@ -1636,7 +1636,7 @@ into 7 sections, which might explain the weird sizes in the center.
(let ((a0-37 (-> obj info texture-anim s5-3)))
(if a0-37
(set! (-> obj texture-anim-array s5-3)
(texture-anim-array-method-10 (the-as texture-anim-array (-> a0-37 value)))
(clear! (the-as texture-anim-array (-> a0-37 value)))
)
)
)
+2
View File
@@ -575,6 +575,8 @@ class Compiler {
Val* compile_asm_pextlh(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_pextlw(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_paddb(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_pcpyud(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_pcpyld(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_ppach(const goos::Object& form, const goos::Object& rest, Env* env);
+6
View File
@@ -1608,6 +1608,9 @@ std::string IR_Int128Math3Asm::print() {
case Kind::PACKUSWB:
function = ".packuswb";
break;
case Kind::PADDB:
function = ".paddb";
break;
default:
ASSERT(false);
}
@@ -1698,6 +1701,9 @@ void IR_Int128Math3Asm::do_codegen(emitter::ObjectGenerator* gen,
case Kind::PACKUSWB:
gen->add_instr(IGen::vpackuswb(dst, src1, src2), irec);
break;
case Kind::PADDB:
gen->add_instr(IGen::parallel_add_byte(dst, src1, src2), irec);
break;
default:
ASSERT(false);
}
+2 -1
View File
@@ -584,7 +584,8 @@ class IR_Int128Math3Asm : public IR_Asm {
POR,
PXOR,
PAND,
PACKUSWB
PACKUSWB,
PADDB,
};
IR_Int128Math3Asm(bool use_color,
const RegVal* dst,
+4
View File
@@ -748,6 +748,10 @@ Val* Compiler::compile_asm_psubw(const goos::Object& form, const goos::Object& r
return compile_asm_int128_math3(form, rest, IR_Int128Math3Asm::Kind::PSUBW, env);
}
Val* Compiler::compile_asm_paddb(const goos::Object& form, const goos::Object& rest, Env* env) {
return compile_asm_int128_math3(form, rest, IR_Int128Math3Asm::Kind::PADDB, env);
}
Val* Compiler::compile_asm_ppach(const goos::Object& form, const goos::Object& rest, Env* env) {
auto args = get_va(form, rest);
va_check(form, args, {{}, {}, {}}, {});
+1
View File
@@ -129,6 +129,7 @@ const std::unordered_map<
{".ppach", {"", &Compiler::compile_asm_ppach}},
{".ppacb", {"", &Compiler::compile_asm_ppacb}},
{".psubw", {"", &Compiler::compile_asm_psubw}},
{".paddb", {"", &Compiler::compile_asm_paddb}},
// BLOCK FORMS
{"top-level", {"", &Compiler::compile_top_level}},
+12
View File
@@ -2456,6 +2456,18 @@ class IGen {
return instr;
}
static Instruction parallel_add_byte(Register dst, Register src0, Register src1) {
ASSERT(dst.is_xmm());
ASSERT(src0.is_xmm());
ASSERT(src1.is_xmm());
// VEX.128.66.0F.WIG FC /r VPADDB xmm1, xmm2, xmm3/m128
// reg, vex, r/m
Instruction instr(0xFC);
instr.set_vex_modrm_and_rex(dst.hw_id(), src1.hw_id(), VEX3::LeadingBytes::P_0F, src0.hw_id(),
false, VexPrefix::P_66);
return instr;
}
static Instruction parallel_bitwise_or(Register dst, Register src0, Register src1) {
ASSERT(dst.is_xmm());
ASSERT(src0.is_xmm());
+5 -17
View File
@@ -162,7 +162,6 @@
;; definition for method 78 of type ocean
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-3 8) 0) at op 21
(defmethod draw-ocean-texture ocean ((obj ocean) (arg0 dma-buffer) (arg1 int))
(set-display-gs-state arg0 21 128 128 0 0)
(ocean-texture-add-envmap obj arg0)
@@ -204,7 +203,6 @@
;; definition for method 79 of type ocean
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-2 8) 0) at op 14
(defmethod ocean-method-79 ocean ((obj ocean) (arg0 dma-buffer))
(set-display-gs-state arg0 53 64 64 0 0)
(dma-buffer-add-gs-set arg0
@@ -303,7 +301,7 @@
;; WARN: Return type mismatch int vs none.
(defmethod ocean-method-80 ocean ((obj ocean) (arg0 (pointer rgba)))
(dotimes (v1-0 256)
(let ((a0-3 (-> (the-as (pointer uint8) (&+ *clut-translate* v1-0)))))
(let ((a0-3 (-> *clut-translate* v1-0)))
(set! (-> arg0 a0-3 r) v1-0)
(set! (-> arg0 a0-3 g) v1-0)
(set! (-> arg0 a0-3 b) v1-0)
@@ -339,7 +337,6 @@
;; definition for method 81 of type ocean
;; INFO: Used lq/sq
;; ERROR: Failed store: (s.w! (+ a0-2 8) 0) at op 14
(defmethod ocean-method-81 ocean ((obj ocean) (arg0 dma-buffer))
(set-display-gs-state arg0 53 128 128 0 0)
(dma-buffer-add-gs-set arg0
@@ -460,9 +457,9 @@
(dotimes (a3-9 (/ s5-1 16))
(dma-buffer-add-gs-set arg0
(uv (new 'static 'gs-uv :v #x8 :u (+ (* a3-9 256) 8)))
(xyz2 (shr (shl (+ (* a3-9 256) 128) 48) 48))
(xyz2 (new 'static 'gs-xyz :x (+ (* a3-9 256) 128)))
(uv (new 'static 'gs-uv :u (+ (* a3-9 256) 136) :v (+ (* a2-6 16) 8)))
(xyz2 (logior (shr (shl (+ (* a3-9 256) 256) 48) 48) (shr (shl (* a2-6 16) 48) 32)))
(xyz2 (new 'static 'gs-xyz :y (* a2-6 16) :x (+ (* a3-9 256) 256)))
)
)
)
@@ -479,9 +476,9 @@
(dotimes (v1-73 (/ s5-1 16))
(dma-buffer-add-gs-set arg0
(uv (new 'static 'gs-uv :v #x8 :u (+ (* v1-73 256) 8)))
(xyz2 (shr (shl (+ (* v1-73 256) 128) 48) 48))
(xyz2 (new 'static 'gs-xyz :x (+ (* v1-73 256) 128)))
(uv (new 'static 'gs-uv :u (+ (* v1-73 256) 136) :v (+ (* s4-3 16) 8)))
(xyz2 (logior (shr (shl (+ (* v1-73 256) 256) 48) 48) (shr (shl (* s4-3 16) 48) 32)))
(xyz2 (new 'static 'gs-xyz :y (* s4-3 16) :x (+ (* v1-73 256) 256)))
)
)
)
@@ -491,7 +488,6 @@
;; definition for method 82 of type ocean
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-2 8) 0) at op 11
(defmethod draw-envmap-debug ocean ((obj ocean) (arg0 dma-buffer))
(format *stdcon* "draw-envmap-debug~%")
(-> arg0 base)
@@ -547,7 +543,6 @@
;; definition for method 83 of type ocean
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-1 8) 0) at op 14
(defmethod ocean-method-83 ocean ((obj ocean) (arg0 dma-buffer) (arg1 float))
(let* ((s4-0 64)
(s3-0 0)
@@ -640,7 +635,6 @@
;; definition for method 85 of type ocean
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-1 8) 0) at op 6
(defmethod ocean-method-85 ocean ((obj ocean) (arg0 dma-buffer))
(local-vars (sv-48 vector4w) (sv-64 vector4w))
(dma-buffer-add-gs-set arg0 (alpha-1 (new 'static 'gs-alpha :b #x2 :d #x1)))
@@ -794,7 +788,6 @@
;; definition for method 88 of type ocean
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-1 8) 0) at op 6
(defmethod ocean-method-88 ocean ((obj ocean) (arg0 dma-buffer))
(local-vars (sv-48 vector) (sv-64 uint) (sv-80 vector) (sv-96 vector) (sv-112 vector))
(dma-buffer-add-gs-set arg0
@@ -930,7 +923,6 @@
;; definition for method 89 of type ocean
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-4 8) 0) at op 40
(defmethod ocean-method-89 ocean ((obj ocean) (arg0 dma-buffer))
(set-display-gs-state arg0 (the-as int (+ (-> *ocean-texture-base* vram-page) 8)) 64 64 0 0)
(vector-float*! (-> obj sky-color) (-> *time-of-day-context* current-sky-color) 0.25)
@@ -1381,7 +1373,3 @@
v0-0
)
)
@@ -0,0 +1,250 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function noise-texture-anim-layer-func
(defun noise-texture-anim-layer-func ((dma-buf dma-buffer) (fbp-to-draw uint) (width int) (height int) (layer texture-anim-layer) (time float))
(when (and (>= time (-> layer start-time)) (< time (-> layer end-time)))
(texture-anim-layer-interp layer time)
(when (!= (-> layer interpolated-color w) 0.0)
(upload-vram-data dma-buf (the-as int (-> layer tex dest 0)) (the-as pointer (-> layer tex pad 0)) 32 32)
(dma-buffer-add-gs-set dma-buf (texflush 0))
(texture-anim-layer-add-shader dma-buf layer 1)
(let ((s1-0 (/ (+ width 63) 64)))
(dma-buffer-add-gs-set dma-buf (frame-1 (new 'static 'gs-frame :fbmsk #xffffff :fbw s1-0 :fbp fbp-to-draw)))
(texture-anim-layer-draw dma-buf width height layer)
(let* ((v1-13 dma-buf)
(a0-17 (the-as object (-> v1-13 base)))
)
(set! (-> (the-as dma-packet a0-17) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
(set! (-> (the-as dma-packet a0-17) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet a0-17) vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1))
(set! (-> v1-13 base) (&+ (the-as pointer a0-17) 16))
)
(let* ((v1-14 dma-buf)
(a0-19 (the-as object (-> v1-14 base)))
)
(set! (-> (the-as gs-gif-tag a0-19) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
(set! (-> (the-as gs-gif-tag a0-19) regs) GIF_REGS_ALL_AD)
(set! (-> v1-14 base) (&+ (the-as pointer a0-19) 16))
)
(let ((v1-15 (-> dma-buf base)))
(set! (-> (the-as (pointer gs-frame) v1-15) 0) (new 'static 'gs-frame :fbw s1-0 :fbp fbp-to-draw))
(set! (-> (the-as (pointer gs-reg64) v1-15) 1) (gs-reg64 frame-1))
(set! (-> dma-buf base) (&+ v1-15 16))
)
)
)
)
0
)
;; definition for function cloud-texture-anim-layer-func
(defun cloud-texture-anim-layer-func ((dma-buf dma-buffer) (fbp-to-draw uint) (width int) (height int) (layer texture-anim-layer) (time float))
(when (and (>= time (-> layer start-time)) (< time (-> layer end-time)))
(texture-anim-layer-interp layer time)
(when (!= (-> layer interpolated-color w) 0.0)
(let* ((v1-4 (-> layer tex))
(t0-1 (/ (-> v1-4 w) 2))
(a3-1 (/ (-> v1-4 h) 2))
)
(upload-vram-data dma-buf (the-as int (-> v1-4 dest 0)) (the-as pointer (-> v1-4 pad 0)) a3-1 t0-1)
)
(dma-buffer-add-gs-set dma-buf (texflush 0))
(texture-anim-layer-add-shader dma-buf layer 1)
(texture-anim-layer-draw dma-buf width height layer)
)
)
0
)
;; definition for function cloud-texture-anim-func
(defun cloud-texture-anim-func ((arg0 dma-buffer) (arg1 texture-anim))
(with-pp
(when (>= (+ (-> arg1 frame-time) (* (-> arg1 frame-delta) (-> pp clock seconds-per-frame))) (-> arg1 frame-mod))
(let ((s5-0 (-> arg1 data 0 tex))
(s4-0 (-> arg1 data 1 tex))
(s3-0 (-> arg1 data 0 tex w))
)
(when (not (paused?))
(set! (-> arg1 data 0 tex) s4-0)
(set! (-> arg1 data 1 tex) s5-0)
(make-noise-texture (the-as pointer (-> s5-0 pad 0)) s3-0 s3-0 s3-0)
)
)
)
0
)
)
;; definition for function fog-texture-anim-init
;; INFO: Used lq/sq
(defun fog-texture-anim-init ((arg0 texture-anim))
(let ((gp-0 (new 'loading-level 'fog8x256))
(s4-0 (new 'loading-level 'clut16x16))
)
(when (and gp-0 s4-0)
(let ((v1-5 (new 'loading-level 'texture)))
(let ((a0-4 (the int (-> arg0 extra x)))
(a1-3 (the int (-> arg0 extra y)))
)
(set! (-> arg0 tex) v1-5)
(set! (-> v1-5 pad 0) (the-as uint gp-0))
(set! (-> v1-5 pad 1) (the-as uint s4-0))
(set! (-> v1-5 w) 256)
(set! (-> v1-5 h) 1)
(set! (-> v1-5 num-mips) (the-as uint 1))
(set! (-> v1-5 psm) (gs-psm mt8))
(set! (-> v1-5 clutpsm) (the-as uint 0))
(set! (-> v1-5 dest 0) (the-as uint (* a0-4 32)))
(set! (-> v1-5 clutdest) (the-as uint (* a1-3 32)))
)
(set! (-> v1-5 width 0) (the-as uint 4))
(set! (-> v1-5 masks data 0 mask quad) (the-as uint128 0))
(set! (-> v1-5 masks data 1 mask quad) (the-as uint128 0))
(set! (-> v1-5 masks data 2 mask quad) (the-as uint128 0))
)
0
(dotimes (v1-7 256)
(nop!)
(nop!)
(nop!)
(nop!)
(set! (-> gp-0 image v1-7) (the-as uint v1-7))
)
)
)
0
)
;; definition for symbol *fog-texture-work*, type fog-texture-work
(define *fog-texture-work* (new 'static 'fog-texture-work :const (new 'static 'vector :x 0.00390625)))
;; definition for function real-fog-texture-anim-func
;; INFO: Used lq/sq
;; WARN: Return type mismatch symbol vs int.
(defun real-fog-texture-anim-func ((arg0 dma-buffer) (arg1 texture-anim))
(local-vars (sv-48 int))
(let ((s4-0 (new 'stack-no-clear 'vector))
(s3-0 (new 'stack-no-clear 'vector))
(s1-0 *fog-texture-work*)
(s2-0 (the-as (pointer uint32) (-> arg1 tex pad 1)))
)
(let ((v1-1 (-> s1-0 color)))
(dotimes (a0-1 256)
(set! (-> s2-0 a0-1) v1-1)
)
)
(set! sv-48 0)
(let ((s0-0 0))
(let ((f0-0 40955904.0)
(f1-0 -40955904.0)
)
(dotimes (v1-7 4)
(let ((f2-0 (-> *fog-texture-work* corner v1-7 y)))
(when (< f2-0 f0-0)
(set! f0-0 f2-0)
(set! sv-48 v1-7)
sv-48
)
(when (< f1-0 f2-0)
(set! f1-0 f2-0)
(set! s0-0 v1-7)
)
)
)
)
(set! (-> s4-0 quad) (-> *fog-texture-work* corner sv-48 quad))
(vector-! s3-0 (-> *fog-texture-work* corner s0-0) (-> *fog-texture-work* corner sv-48))
(vector-float/! s3-0 s3-0 256.0)
(set! (-> *fog-texture-work* min-corner quad) (-> *fog-texture-work* corner sv-48 quad))
(set! (-> *fog-texture-work* max-corner quad) (-> *fog-texture-work* corner s0-0 quad))
)
0.0
0.0
(let ((f0-4 (fmax 4096.0 (-> *math-camera* trans y)))
(f1-2 (-> arg1 extra z))
(f2-1 (-> s1-0 alpha-near))
(f3-0 (-> s1-0 alpha-far))
(f4-0 (-> s1-0 alpha-delta))
(f5-0 (-> s1-0 fog-near))
(f6-0 (-> s1-0 fog-far))
(f7-0 (-> s1-0 fog-delta))
)
(dotimes (v1-19 256)
(let* ((f8-0 (-> s4-0 y))
(f8-1 (cond
((= f8-0 0.0)
f3-0
)
((< f8-0 0.0)
(let ((f9-4 (fmin f6-0 (/ (* f0-4 (vector-length s4-0)) (- f8-0)))))
(+ f2-1 (* f4-0 (/ (fmax 0.0 (- f9-4 f5-0)) f7-0)))
)
)
(else
(let ((f9-8 (fmin f6-0 (/ (* f1-2 (vector-length s4-0)) f8-0))))
(+ f2-1 (* f4-0 (/ (fmax 0.0 (- f9-8 f5-0)) f7-0)))
)
)
)
)
)
(set! (-> s2-0 (-> *clut-translate* v1-19))
(logior (logand (-> s2-0 (-> *clut-translate* v1-19)) (the-as uint #xffffffff00ffffff))
(shr (shl (the int (* 128.0 f8-1)) 56) 32)
)
)
)
(vector+! s4-0 s4-0 s3-0)
)
)
)
(let ((s5-1 (-> arg1 tex)))
(dma-buffer-add-gs-set arg0
(bitbltbuf
(new 'static 'gs-bitbltbuf :dpsm (the-as int (-> s5-1 psm)) :dbp (-> s5-1 dest 0) :dbw (-> s5-1 width 0))
)
(trxpos (new 'static 'gs-trxpos))
(trxreg (new 'static 'gs-trxreg :rrw (-> s5-1 w) :rrh (-> s5-1 h)))
(trxdir (new 'static 'gs-trxdir))
)
(dma-buffer-add-ref-texture arg0 (the-as pointer (-> s5-1 pad 0)) (-> s5-1 w) (-> s5-1 h) (-> s5-1 psm))
(upload-vram-data arg0 (the-as int (-> s5-1 clutdest)) (the-as pointer (-> s5-1 pad 1)) 16 16)
(set! (-> *texture-pool* ids (shr (-> s5-1 clutdest) 6)) (the-as uint 0))
(let* ((v1-29 arg0)
(a0-51 (the-as object (-> v1-29 base)))
)
(set! (-> (the-as dma-packet a0-51) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
(set! (-> (the-as dma-packet a0-51) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet a0-51) vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1))
(set! (-> v1-29 base) (&+ (the-as pointer a0-51) 16))
)
(let* ((v1-30 arg0)
(a0-53 (the-as object (-> v1-30 base)))
)
(set! (-> (the-as gs-gif-tag a0-53) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
(set! (-> (the-as gs-gif-tag a0-53) regs) GIF_REGS_ALL_AD)
(set! (-> v1-30 base) (&+ (the-as pointer a0-53) 16))
)
(let ((v1-31 (-> arg0 base)))
(set! (-> (the-as (pointer int64) v1-31)) 0)
(set! (-> (the-as (pointer gs-reg64) v1-31) 1) (gs-reg64 texflush))
(set! (-> arg0 base) (&+ v1-31 16))
)
(let ((v1-34 (shr (-> s5-1 dest 0) 6)))
(dotimes (a0-56 3)
(set! (-> *texture-pool* ids (+ v1-34 a0-56)) (the-as uint 0))
)
)
)
(the-as int #f)
)
;; definition for function fog-texture-anim-func
(defun fog-texture-anim-func ((arg0 dma-buffer) (arg1 texture-anim))
(real-fog-texture-anim-func arg0 arg1)
)
+316 -120
View File
@@ -3,41 +3,49 @@
;; definition of type texture-anim-layer
(deftype texture-anim-layer (structure)
((extra vector :inline :offset 240)
(func (function texture-anim-layer int) :offset 256)
(func-id symbol :offset 256)
(init-func (function texture-anim-layer int) :offset 260)
(init-func-id symbol :offset 260)
(tex texture :offset 264)
(start-time float :offset 268)
(end-time float :offset 272)
(tex-name string :offset 276)
(test gs-test :offset 280)
(alpha gs-alpha :offset 288)
(clamp gs-clamp :offset 296)
(start-color vector :inline :offset 80)
(start-scale vector2 :inline :offset 96)
(start-offset vector2 :inline :offset 104)
(start-st-scale vector2 :inline :offset 112)
(start-st-offset vector2 :inline :offset 120)
(start-qs vector :inline :offset 128)
(start-rot degrees :offset 144)
(start-st-rot degrees :offset 148)
(end-color vector :inline :offset 160)
(end-scale vector2 :inline :offset 176)
(end-offset vector2 :inline :offset 184)
(end-st-scale vector2 :inline :offset 192)
(end-st-offset vector2 :inline :offset 200)
(end-qs vector :inline :offset 208)
(end-rot degrees :offset 224)
(end-st-rot degrees :offset 228)
((interpolated-color vector :inline :offset-assert 0)
(interpolated-scale-offset vector :inline :offset-assert 16)
(interpolated-st-scale-offset vector :inline :offset-assert 32)
(interpolated-qs vector :inline :offset-assert 48)
(interpolated-rot vector :inline :offset-assert 64)
(extra vector :inline :offset 240)
(func (function dma-buffer uint int int texture-anim-layer float int) :offset 256)
(func-id symbol :offset 256)
(init-func (function texture-anim-layer int) :offset 260)
(init-func-id symbol :offset 260)
(tex texture :offset 264)
(start-time float :offset 268)
(end-time float :offset 272)
(tex-name string :offset 276)
(test gs-test :offset 280)
(alpha gs-alpha :offset 288)
(clamp gs-clamp :offset 296)
(start-vectors vector 5 :inline :offset 80)
(start-color vector :inline :offset 80)
(start-scale vector2 :inline :offset 96)
(start-offset vector2 :inline :offset 104)
(start-st-scale vector2 :inline :offset 112)
(start-st-offset vector2 :inline :offset 120)
(start-qs vector :inline :offset 128)
(start-rot degrees :offset 144)
(start-st-rot degrees :offset 148)
(end-vectors vector 5 :inline :offset 160)
(end-color vector :inline :offset 160)
(end-scale vector2 :inline :offset 176)
(end-offset vector2 :inline :offset 184)
(end-scale-offset vector :inline :offset 176)
(end-st-scale vector2 :inline :offset 192)
(end-st-offset vector2 :inline :offset 200)
(end-qs vector :inline :offset 208)
(end-rot degrees :offset 224)
(end-st-rot degrees :offset 228)
)
:method-count-assert 11
:size-assert #x130
:flag-assert #xb00000130
(:methods
(texture-anim-layer-method-9 (_type_) _type_ 9)
(texture-anim-layer-method-10 (_type_) _type_ 10)
(initialize-texture! (_type_) _type_ 9)
(clear-texture! (_type_) _type_ 10)
)
)
@@ -82,29 +90,29 @@
;; definition of type texture-anim
(deftype texture-anim (structure)
((num-layers uint32 :offset-assert 0)
(func (function texture-anim int) :offset-assert 4)
(func-id symbol :offset 4)
(init-func (function texture-anim int) :offset-assert 8)
(init-func-id symbol :offset 8)
(tex texture :offset-assert 12)
(tex-name string :offset-assert 16)
(extra vector :inline :offset-assert 32)
(color rgba :offset-assert 48)
(frame-time float :offset-assert 52)
(frame-delta float :offset-assert 56)
(frame-mod float :offset-assert 60)
(test gs-test :offset-assert 64)
(alpha gs-alpha :offset-assert 72)
(clamp gs-clamp :offset-assert 80)
(data texture-anim-layer :dynamic :offset-assert 88)
((num-layers uint32 :offset-assert 0)
(func (function dma-buffer texture-anim int) :offset-assert 4)
(func-id symbol :offset 4)
(init-func (function texture-anim int) :offset-assert 8)
(init-func-id symbol :offset 8)
(tex texture :offset-assert 12)
(tex-name string :offset-assert 16)
(extra vector :inline :offset-assert 32)
(color rgba :offset-assert 48)
(frame-time float :offset-assert 52)
(frame-delta float :offset-assert 56)
(frame-mod float :offset-assert 60)
(test gs-test :offset-assert 64)
(alpha gs-alpha :offset-assert 72)
(clamp gs-clamp :offset-assert 80)
(data texture-anim-layer :dynamic :offset-assert 88)
)
:method-count-assert 11
:size-assert #x58
:flag-assert #xb00000058
(:methods
(texture-anim-method-9 (_type_) _type_ 9)
(texture-anim-method-10 (_type_) _type_ 10)
(init-textures! (_type_) _type_ 9)
(clear-textures! (_type_) _type_ 10)
)
)
@@ -143,8 +151,8 @@
:size-assert #x10
:flag-assert #xb00000010
(:methods
(texture-anim-array-method-9 (_type_) _type_ 9)
(texture-anim-array-method-10 (_type_) _type_ 10)
(init! (_type_) _type_ 9)
(clear! (_type_) _type_ 10)
)
)
@@ -394,78 +402,266 @@
obj
)
;; definition for symbol *clut-translate*, type (pointer uint32)
(define *clut-translate* (new 'static 'array uint32 64
#x3020100
#x7060504
#x13121110
#x17161514
#xb0a0908
#xf0e0d0c
#x1b1a1918
#x1f1e1d1c
#x23222120
#x27262524
#x33323130
#x37363534
#x2b2a2928
#x2f2e2d2c
#x3b3a3938
#x3f3e3d3c
#x43424140
#x47464544
#x53525150
#x57565554
#x4b4a4948
#x4f4e4d4c
#x5b5a5958
#x5f5e5d5c
#x63626160
#x67666564
#x73727170
#x77767574
#x6b6a6968
#x6f6e6d6c
#x7b7a7978
#x7f7e7d7c
#x83828180
#x87868584
#x93929190
#x97969594
#x8b8a8988
#x8f8e8d8c
#x9b9a9998
#x9f9e9d9c
#xa3a2a1a0
#xa7a6a5a4
#xb3b2b1b0
#xb7b6b5b4
#xabaaa9a8
#xafaeadac
#xbbbab9b8
#xbfbebdbc
#xc3c2c1c0
#xc7c6c5c4
#xd3d2d1d0
#xd7d6d5d4
#xcbcac9c8
#xcfcecdcc
#xdbdad9d8
#xdfdedddc
#xe3e2e1e0
#xe7e6e5e4
#xf3f2f1f0
#xf7f6f5f4
#xebeae9e8
#xefeeedec
#xfbfaf9f8
#xfffefdfc
;; definition for symbol *clut-translate*, type (pointer uint8)
(define *clut-translate* (new 'static 'array uint8 256
#x0
#x1
#x2
#x3
#x4
#x5
#x6
#x7
#x10
#x11
#x12
#x13
#x14
#x15
#x16
#x17
#x8
#x9
#xa
#xb
#xc
#xd
#xe
#xf
#x18
#x19
#x1a
#x1b
#x1c
#x1d
#x1e
#x1f
#x20
#x21
#x22
#x23
#x24
#x25
#x26
#x27
#x30
#x31
#x32
#x33
#x34
#x35
#x36
#x37
#x28
#x29
#x2a
#x2b
#x2c
#x2d
#x2e
#x2f
#x38
#x39
#x3a
#x3b
#x3c
#x3d
#x3e
#x3f
#x40
#x41
#x42
#x43
#x44
#x45
#x46
#x47
#x50
#x51
#x52
#x53
#x54
#x55
#x56
#x57
#x48
#x49
#x4a
#x4b
#x4c
#x4d
#x4e
#x4f
#x58
#x59
#x5a
#x5b
#x5c
#x5d
#x5e
#x5f
#x60
#x61
#x62
#x63
#x64
#x65
#x66
#x67
#x70
#x71
#x72
#x73
#x74
#x75
#x76
#x77
#x68
#x69
#x6a
#x6b
#x6c
#x6d
#x6e
#x6f
#x78
#x79
#x7a
#x7b
#x7c
#x7d
#x7e
#x7f
#x80
#x81
#x82
#x83
#x84
#x85
#x86
#x87
#x90
#x91
#x92
#x93
#x94
#x95
#x96
#x97
#x88
#x89
#x8a
#x8b
#x8c
#x8d
#x8e
#x8f
#x98
#x99
#x9a
#x9b
#x9c
#x9d
#x9e
#x9f
#xa0
#xa1
#xa2
#xa3
#xa4
#xa5
#xa6
#xa7
#xb0
#xb1
#xb2
#xb3
#xb4
#xb5
#xb6
#xb7
#xa8
#xa9
#xaa
#xab
#xac
#xad
#xae
#xaf
#xb8
#xb9
#xba
#xbb
#xbc
#xbd
#xbe
#xbf
#xc0
#xc1
#xc2
#xc3
#xc4
#xc5
#xc6
#xc7
#xd0
#xd1
#xd2
#xd3
#xd4
#xd5
#xd6
#xd7
#xc8
#xc9
#xca
#xcb
#xcc
#xcd
#xce
#xcf
#xd8
#xd9
#xda
#xdb
#xdc
#xdd
#xde
#xdf
#xe0
#xe1
#xe2
#xe3
#xe4
#xe5
#xe6
#xe7
#xf0
#xf1
#xf2
#xf3
#xf4
#xf5
#xf6
#xf7
#xe8
#xe9
#xea
#xeb
#xec
#xed
#xee
#xef
#xf8
#xf9
#xfa
#xfb
#xfc
#xfd
#xfe
#xff
)
)
;; failed to figure out what this is:
0
File diff suppressed because it is too large Load Diff
+12 -4
View File
@@ -1,7 +1,10 @@
;;-*-Lisp-*-
(in-package goal)
;; failed to figure out what this is:
(setup-font-texture *texture-pool*)
;; failed to figure out what this is:
(let ((v1-2 (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #x70c))))
(when v1-2
(set! (-> v1-2 w) 32)
@@ -10,12 +13,17 @@
)
)
(texture-anim-array-method-9 *sky-texture-anim-array*)
;; failed to figure out what this is:
(init! *sky-texture-anim-array*)
(texture-anim-array-method-9 *darkjak-texture-anim-array*)
;; failed to figure out what this is:
(init! *darkjak-texture-anim-array*)
(texture-anim-array-method-9 *skull-gem-texture-anim-array*)
;; failed to figure out what this is:
(init! *skull-gem-texture-anim-array*)
(texture-anim-array-method-9 *bomb-texture-anim-array*)
;; failed to figure out what this is:
(init! *bomb-texture-anim-array*)
;; failed to figure out what this is:
(kmemclose)
+8 -16
View File
@@ -682,7 +682,6 @@
;; definition for function upload-vram-data
;; WARN: Return type mismatch symbol vs none.
;; ERROR: Failed store: (s.w! (+ a0-1 8) 0) at op 13
(defun upload-vram-data ((buf dma-buffer) (dest int) (data pointer) (height int) (width int))
(while (> height 0)
(let ((height-this-time (min 2048 height)))
@@ -702,7 +701,6 @@
)
;; definition for function upload-vram-pages
;; ERROR: Failed store: (s.w! (+ a0-24 8) 0) at op 143
(defun upload-vram-pages ((pool texture-pool)
(dest-seg texture-pool-segment)
(tpage texture-page)
@@ -848,7 +846,6 @@
)
;; definition for function upload-vram-pages-pris
;; ERROR: Failed store: (s.w! (+ a0-27 8) 0) at op 137
(defun upload-vram-pages-pris ((pool texture-pool)
(dest-seg texture-pool-segment)
(tpage texture-page)
@@ -1251,9 +1248,11 @@
(dotimes (s2-1 7)
(let ((v1-54 (-> *level* level s2-1)))
(when (or (= (-> v1-54 status) 'active) (= (-> v1-54 status) 'reserved))
(if (-> v1-54 texture-anim-array 5)
(update-texture-anim bucket)
)
(let ((a1-26 (-> v1-54 texture-anim-array 5)))
(if a1-26
(update-texture-anim bucket a1-26)
)
)
)
)
)
@@ -1265,21 +1264,21 @@
(let ((f30-0 (-> pp clock seconds-per-frame)))
(set! (-> pp clock seconds-per-frame) (* 10.0 (-> pp clock seconds-per-frame)))
(if s2-0
(update-texture-anim bucket)
(update-texture-anim bucket s2-0)
)
(set! (-> pp clock seconds-per-frame) f30-0)
)
)
(else
(if s2-0
(update-texture-anim bucket)
(update-texture-anim bucket s2-0)
)
)
)
)
(else
(if s2-0
(update-texture-anim bucket)
(update-texture-anim bucket s2-0)
)
)
)
@@ -1409,7 +1408,6 @@
;; definition for method 13 of type texture-page
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-1 8) 0) at op 19
(defmethod upload-now! texture-page ((obj texture-page) (arg0 tex-upload-mode))
(let ((gp-0 *txt-dma-list*))
(let ((v1-0 gp-0))
@@ -1462,7 +1460,6 @@
)
;; definition for function texture-relocate
;; ERROR: Failed store: (s.w! (+ t4-0 8) 0) at op 18
(defun texture-relocate ((dma-buff dma-buffer) (tex texture) (dest-loc int) (dest-fmt gs-psm) (clut-dst int))
(dotimes (v1-0 (the-as int (-> tex num-mips)))
(let ((t1-1 (ash (-> tex w) (- v1-0)))
@@ -1551,7 +1548,6 @@
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ a0-26 8) 0) at op 192
(defmethod setup-font-texture texture-pool ((obj texture-pool))
(local-vars (sv-16 int) (sv-20 int))
(let ((s3-0 (-> obj font-palette)))
@@ -2270,7 +2266,3 @@
;; definition for symbol *texture-pool*, type texture-pool
(define *texture-pool* (new 'global 'texture-pool))
+2 -6
View File
@@ -792,9 +792,7 @@
(dotimes (s4-0 10)
(let ((a0-8 (-> obj info texture-anim s4-0)))
(if a0-8
(set! (-> obj texture-anim-array s4-0)
(texture-anim-array-method-9 (the-as texture-anim-array (-> a0-8 value)))
)
(set! (-> obj texture-anim-array s4-0) (init! (the-as texture-anim-array (-> a0-8 value))))
)
)
)
@@ -1278,9 +1276,7 @@
(dotimes (s5-3 10)
(let ((a0-37 (-> obj info texture-anim s5-3)))
(if a0-37
(set! (-> obj texture-anim-array s5-3)
(texture-anim-array-method-10 (the-as texture-anim-array (-> a0-37 value)))
)
(set! (-> obj texture-anim-array s5-3) (clear! (the-as texture-anim-array (-> a0-37 value))))
)
)
)
@@ -74,3 +74,21 @@
)
)
)
(let ((s1 (new 'static 'array uint8 16
1 2 3 4 0 0 0 0 8 8 8 8 240 240 241 243 9 8 7 6))
(s2 (new 'static 'array uint8 16
7 8 3 4 1 2 3 4 9 8 7 6 240 240 241 243 9 8 1 2))
(s3 (new 'static 'array uint8 16)))
(let ((v1 (-> (the (pointer uint128) s1)))
(v2 (-> (the (pointer uint128) s2)))
(v3 (the uint128 0)))
(.paddb v3 v2 v1)
(set! (-> (the (pointer uint128) s3)) v3)
(dotimes (i 16)
(format #t "~X + ~X = ~X (~X)~%" (-> s1 i) (-> s2 i) (-> s3 i) (logand #xff (+ (-> s1 i) (-> s2 i))))
)
0
)
)
+14 -10
View File
@@ -648,16 +648,20 @@ TEST_F(WithGameTests, I128Simple) {
// TODO - add tests
TEST_F(WithGameTests, Pextlw) {
shared_compiler->runner.run_static_test(testCategory, "test-pextlw.gc",
{"#x07060504171615140302010013121110\n"
"#x0f0e0d0c1f1e1d1c0b0a09081b1a1918\n"
"#x07060504030201001716151413121110\n"
"#x1f1e1d1c1b1a19180f0e0d0c0b0a0908\n"
"#x0d0c0908050401001d1c191815141110\n"
"#x0e0c0a08060402001e1c1a1816141210\n"
"#xffffffff00000000ffffffff00000000\n"
"#x00090000000000fefffffffe000002ff\n"
"0\n"});
shared_compiler->runner.run_static_test(
testCategory, "test-pextlw.gc",
{"#x07060504171615140302010013121110\n"
"#x0f0e0d0c1f1e1d1c0b0a09081b1a1918\n"
"#x07060504030201001716151413121110\n"
"#x1f1e1d1c1b1a19180f0e0d0c0b0a0908\n"
"#x0d0c0908050401001d1c191815141110\n"
"#x0e0c0a08060402001e1c1a1816141210\n"
"#xffffffff00000000ffffffff00000000\n"
"#x00090000000000fefffffffe000002ff\n"
"1 + 7 = 8 (8)\n2 + 8 = a (a)\n3 + 3 = 6 (6)\n4 + 4 = 8 (8)\n0 + 1 = 1 (1)\n0 + 2 = 2 "
"(2)\n0 + 3 = 3 (3)\n0 + 4 = 4 (4)\n8 + 9 = 11 (11)\n8 + 8 = 10 (10)\n8 + 7 = f (f)\n8 + 6 "
"= e (e)\nf0 + f0 = e0 (e0)\nf0 + f0 = e0 (e0)\nf1 + f1 = e2 (e2)\nf3 + f3 = e6 (e6)\n"
"0\n"});
}
TEST_F(WithGameTests, Matrix) {
+15
View File
@@ -673,6 +673,21 @@ TEST(EmitterAVX, VPOR) {
"C5E1EBDBC4C161EBDDC591EBDBC4C111EBDDC561EBEBC44161EBEDC511EBEBC44111EBED");
}
TEST(EmitterAVX, VPADDB) {
CodeTester tester;
tester.init_code_buffer(1024);
tester.emit(IGen::parallel_add_byte(XMM0 + 3, XMM0 + 3, XMM0 + 3));
tester.emit(IGen::parallel_add_byte(XMM0 + 3, XMM0 + 3, XMM0 + 13));
tester.emit(IGen::parallel_add_byte(XMM0 + 3, XMM0 + 13, XMM0 + 3));
tester.emit(IGen::parallel_add_byte(XMM0 + 3, XMM0 + 13, XMM0 + 13));
tester.emit(IGen::parallel_add_byte(XMM0 + 13, XMM0 + 3, XMM0 + 3));
tester.emit(IGen::parallel_add_byte(XMM0 + 13, XMM0 + 3, XMM0 + 13));
tester.emit(IGen::parallel_add_byte(XMM0 + 13, XMM0 + 13, XMM0 + 3));
tester.emit(IGen::parallel_add_byte(XMM0 + 13, XMM0 + 13, XMM0 + 13));
EXPECT_EQ(tester.dump_to_hex_string(true),
"C5E1FCDBC4C161FCDDC591FCDBC4C111FCDDC561FCEBC44161FCEDC511FCEBC44111FCED");
}
TEST(EmitterAVX, VPXOR) {
CodeTester tester;
tester.init_code_buffer(1024);