[jak3] A few bug fixes (#3606)

A few minor fixes:

- Fix crash in overlord3 during final boss
https://github.com/open-goal/jak-project/issues/3605
- Update goal_src for `scene-actor.gc`, which was not updated after a
bug fix for decompiling skelgroups, making some cutscene actors
invisible due to using the wrong joint for culling checks.
- Stop using `-1` as an invalid value for texture id's in Merc.cpp. This
could sometimes cause Merc2.cpp to accidentally skip updating the OpenGL
texture. This fixes the bug where skull gems sometimes didn't have the
animated textures.
This commit is contained in:
water111 2024-07-26 13:48:43 -04:00 committed by GitHub
parent 9d80ada016
commit f0b46ff2e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 506 additions and 592 deletions

View file

@ -119,3 +119,7 @@ void TextureUploadHandler::draw_debug_window() {
m_direct->draw_debug_window();
}
}
bool TextureUploadHandler::empty() const {
return m_upload_count == 0;
}

View file

@ -18,6 +18,7 @@ class TextureUploadHandler : public BucketRenderer {
bool add_direct = false);
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
void draw_debug_window() override;
bool empty() const override;
private:
struct TextureUpload {

View file

@ -75,6 +75,8 @@ void Generic2::render_in_mode(DmaFollower& dma,
}
}
m_empty = m_next_free_vert == 0;
{
// the next pass is to look at all of that data, and figure out the best order to draw it
// using OpenGL

View file

@ -19,6 +19,7 @@ class Generic2 {
Mode mode);
void draw_debug_window();
bool empty() { return m_empty; }
struct Vertex {
math::Vector<float, 3> xyz;
@ -202,4 +203,6 @@ class Generic2 {
GLuint gfx_hack_no_tex;
GLuint warp_sample_mode;
} m_ogl;
bool m_empty = false;
};

View file

@ -22,4 +22,9 @@ void Generic2BucketRenderer::render(DmaFollower& dma,
return;
}
m_generic->render_in_mode(dma, render_state, prof, m_mode);
m_empty = m_generic->empty();
}
bool Generic2BucketRenderer::empty() const {
return m_empty;
}

View file

@ -11,8 +11,10 @@ class Generic2BucketRenderer : public BucketRenderer {
Generic2::Mode mode);
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
void draw_debug_window() override;
bool empty() const override;
private:
std::shared_ptr<Generic2> m_generic;
Generic2::Mode m_mode;
bool m_empty = false;
};

View file

@ -768,8 +768,12 @@ void Merc2::switch_to_emerc(SharedRenderState* render_state) {
void Merc2::render(DmaFollower& dma,
SharedRenderState* render_state,
ScopedProfilerNode& prof,
MercDebugStats* stats) {
MercDebugStats* stats,
bool debug) {
m_debug = true;
bool hack = stats->collect_debug_model_list;
*stats = {};
stats->collect_debug_model_list = hack;
if (stats->collect_debug_model_list) {
stats->model_list.clear();
}
@ -1216,7 +1220,7 @@ void Merc2::do_draws(const Draw* draw_array,
bool set_fade,
SharedRenderState* render_state) {
glBindVertexArray(m_vao);
int last_tex = -1;
s32 last_tex = INT32_MIN;
int last_light = -1;
bool normal_vtx_buffer_bound = true;

View file

@ -46,7 +46,8 @@ class Merc2 {
void render(DmaFollower& dma,
SharedRenderState* render_state,
ScopedProfilerNode& prof,
MercDebugStats* stats);
MercDebugStats* stats,
bool debug);
static constexpr int kMaxBlerc = 40;
private:
@ -138,6 +139,7 @@ class Merc2 {
};
Uniforms m_merc_uniforms, m_emerc_uniforms;
bool m_debug = false;
void init_shader_common(Shader& shader, Uniforms* uniforms, bool include_lights);
void handle_setup_dma(DmaFollower& dma, SharedRenderState* render_state);

View file

@ -16,9 +16,15 @@ void Merc2BucketRenderer::render(DmaFollower& dma,
return;
}
m_renderer->render(dma, render_state, prof, &m_debug_stats);
m_renderer->render(dma, render_state, prof, &m_debug_stats, m_my_id == 362);
m_empty = m_debug_stats.num_predicted_draws == 0;
}
void Merc2BucketRenderer::draw_debug_window() {
m_renderer->draw_debug_window(&m_debug_stats);
}
bool Merc2BucketRenderer::empty() const {
return m_empty;
}

View file

@ -8,8 +8,10 @@ class Merc2BucketRenderer : public BucketRenderer {
Merc2BucketRenderer(const std::string& name, int my_id, std::shared_ptr<Merc2> merc);
void draw_debug_window() override;
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
bool empty() const override;
private:
bool m_empty = false;
std::shared_ptr<Merc2> m_renderer;
MercDebugStats m_debug_stats;
};

View file

@ -305,8 +305,9 @@ s32 CDvdDriver::ValidateBlockParams(jak3::BlockParams* params, int num_params) {
lg::die("Invalid BlockParams: {} had nullptr dest", i);
return 0;
}
int kMaxFileSize = 1024 * 1024 * 1024;
if (p.sector_num > kMaxFileSize / 0x800) {
int kMaxSector = 1000000;
if (p.sector_num > kMaxSector) {
// this is just a sanity check - if we ever have larger files this is okay to increase.
lg::die("Invalid BlockParams: {} had sector num {}", i, p.sector_num);
return 0;
}

File diff suppressed because it is too large Load diff