From 58cc073ab663fb054d77022cf2f329aeb4c7def0 Mon Sep 17 00:00:00 2001 From: korenkonder Date: Thu, 6 Jun 2024 12:22:41 +0300 Subject: [PATCH] Fixed item col not working correctly --- src/DivaGL/auth_3d.cpp | 4 ++-- src/DivaGL/mdl/disp_manager.cpp | 5 ++--- src/DivaGL/mdl/disp_manager.hpp | 6 +++--- src/DivaGL/mdl/draw_object.cpp | 6 +++--- src/DivaGL/texture.cpp | 8 +++++++- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/DivaGL/auth_3d.cpp b/src/DivaGL/auth_3d.cpp index 8a3b2c0..7e1af4f 100644 --- a/src/DivaGL/auth_3d.cpp +++ b/src/DivaGL/auth_3d.cpp @@ -1170,8 +1170,8 @@ HOOK(void, FASTCALL, auth_3d_object_disp, 0x00000001401D0970, auth_3d_object* o, sprintf_s(buf, sizeof(buf), "%.*s%03d", (int32_t)(i.name.size() - 3), i.name.c_str(), (int32_t)prj::roundf(i.pattern.value)); - tex_pat[tex_pat_count].src = i.texture_id; - tex_pat[tex_pat_count].dst = texture_info_get_id(buf); + tex_pat[tex_pat_count].src = texture_id(0x00, i.texture_id); + tex_pat[tex_pat_count].dst = texture_id(0x00, texture_info_get_id(buf)); tex_pat_count++; } diff --git a/src/DivaGL/mdl/disp_manager.cpp b/src/DivaGL/mdl/disp_manager.cpp index b878e0f..bbb1dec 100644 --- a/src/DivaGL/mdl/disp_manager.cpp +++ b/src/DivaGL/mdl/disp_manager.cpp @@ -54,11 +54,10 @@ material_list_struct::material_list_struct(uint64_t hash, vec4& blend_color, } texture_pattern_struct::texture_pattern_struct() { - src = (uint32_t)-1; - dst = (uint32_t)-1; + } -texture_pattern_struct::texture_pattern_struct(uint32_t src, uint32_t dst) : src(src), dst(dst) { +texture_pattern_struct::texture_pattern_struct(texture_id src, texture_id dst) : src(src), dst(dst) { } diff --git a/src/DivaGL/mdl/disp_manager.hpp b/src/DivaGL/mdl/disp_manager.hpp index ad06c8e..eca1c04 100644 --- a/src/DivaGL/mdl/disp_manager.hpp +++ b/src/DivaGL/mdl/disp_manager.hpp @@ -138,11 +138,11 @@ struct morph_struct { static_assert(sizeof(morph_struct) == 0x08, "\"morph_struct\" struct should have a size of 0x08"); struct texture_pattern_struct { - uint32_t src; - uint32_t dst; + texture_id src; + texture_id dst; texture_pattern_struct(); - texture_pattern_struct(uint32_t src, uint32_t dst); + texture_pattern_struct(texture_id src, texture_id dst); }; static_assert(sizeof(texture_pattern_struct) == 0x08, "\"texture_pattern_struct\" struct should have a size of 0x08"); diff --git a/src/DivaGL/mdl/draw_object.cpp b/src/DivaGL/mdl/draw_object.cpp index e7fdb6b..6cfc281 100644 --- a/src/DivaGL/mdl/draw_object.cpp +++ b/src/DivaGL/mdl/draw_object.cpp @@ -453,7 +453,7 @@ namespace mdl { if (texture_id != -1) { texture_id &= 0xFFFFF; for (int32_t j = 0; j < args->texture_pattern_count; j++) - if (args->texture_pattern_array[j].src == tex_index) { + if (args->texture_pattern_array[j].src == ::texture_id(0x00, tex_index)) { texture* tex = texture_manager_get_texture(args->texture_pattern_array[j].dst); if (tex) tex_id = tex->glid; @@ -678,7 +678,7 @@ static void draw_object_material_set_default(const mdl::ObjSubMeshArgs* args, bo GLuint tex_id = -1; uint32_t texture_id = texdata->tex_index & 0xFFFFF; for (int32_t j = 0; j < args->texture_pattern_count; j++) - if (args->texture_pattern_array[j].src == texture_id) { + if (args->texture_pattern_array[j].src == ::texture_id(0x00, texture_id)) { texture* tex = texture_manager_get_texture(args->texture_pattern_array[j].dst); if (tex) tex_id = tex->glid; @@ -911,7 +911,7 @@ static void draw_object_material_set_reflect(const mdl::ObjSubMeshArgs* args) { GLuint tex_id = -1; for (int32_t j = 0; j < args->texture_pattern_count; j++) - if (args->texture_pattern_array[j].src == texture_id) { + if (args->texture_pattern_array[j].src == ::texture_id(0x00, texture_id)) { texture* tex = texture_manager_get_texture(args->texture_pattern_array[j].dst); if (tex) tex_id = tex->glid; diff --git a/src/DivaGL/texture.cpp b/src/DivaGL/texture.cpp index 1dad260..b6ce55a 100644 --- a/src/DivaGL/texture.cpp +++ b/src/DivaGL/texture.cpp @@ -407,7 +407,7 @@ bool texture_txp_set_load(txp_set* t, texture*** texs, uint32_t* ids) { *texs = force_malloc(count + 1); texture** tex = *texs; for (size_t i = 0; i < count; i++) - tex[i] = texture_txp_load(&t->textures[i], texture_id(0, ids[i])); + tex[i] = texture_txp_load(&t->textures[i], texture_id(0x00, ids[i])); tex[count] = 0; return true; } @@ -444,6 +444,11 @@ HOOK(void, FASTCALL, texture_apply_color_tone, 0x00000001403B5DF0, texture_apply_color_tone(chg_tex, org_tex, col_tone); } +HOOK(texture*, FASTCALL, texture_copy, 0x000000014069B550, + texture_id id, texture* org_tex) { + return texture_copy(id, org_tex); +} + HOOK(texture*, FASTCALL, texture_load_tex_cube_map, 0x000000014069B860, texture_id id, GLenum internal_format, int32_t width, int32_t height, int32_t max_mipmap_level, void** data_ptr) { @@ -468,6 +473,7 @@ HOOK(void, FASTCALL, texture_release, 0x000000014069DA70, texture* tex) { void texture_patch() { INSTALL_HOOK(texture_apply_color_tone); + INSTALL_HOOK(texture_copy); INSTALL_HOOK(texture_load_tex_cube_map); INSTALL_HOOK(texture_load_tex_2d); INSTALL_HOOK(texture_manager_get_texture);