diff --git a/src/CRE/object.cpp b/src/CRE/object.cpp index adef5ed2..4b690ee4 100644 --- a/src/CRE/object.cpp +++ b/src/CRE/object.cpp @@ -2155,15 +2155,15 @@ static void obj_set_handler_get_shader_index_texture_index(obj_set_handler* hand continue; obj_material_texture_data& texture = k; - uint32_t texture_id = texture.tex_index; + uint32_t tex_index = texture.tex_index; texture.tex_index = -1; texture.texture_index = 0; std::pair* tex_id_data = handler->tex_id_data.data(); uint32_t tex_id_num = (uint32_t)handler->tex_id_data.size(); for (uint32_t l = tex_id_num; l; l--, tex_id_data++) - if (tex_id_data->first == texture_id) { - texture.tex_index = texture_id; + if (tex_id_data->first == tex_index) { + texture.tex_index = tex_index; texture.texture_index = tex_id_data->second; break; } diff --git a/src/CRE/shader.cpp b/src/CRE/shader.cpp index 7fa1eaed..c1c3af2b 100644 --- a/src/CRE/shader.cpp +++ b/src/CRE/shader.cpp @@ -392,6 +392,12 @@ int32_t shader_set_data::get_index_by_name(const char* name) { return -1; } +const char* shader_set_data::get_name_by_index(int32_t index) { + if (index >= 0 && index < size) + return shaders[index].name; + return 0; +} + void shader_set_data::load(farc* f, bool ignore_cache, const char* name, const shader_table* shaders_table, const size_t size, const shader_bind_func* bind_func_table, const size_t bind_func_table_size, diff --git a/src/CRE/shader.hpp b/src/CRE/shader.hpp index 3bcf152d..996d4e63 100644 --- a/src/CRE/shader.hpp +++ b/src/CRE/shader.hpp @@ -104,6 +104,7 @@ struct shader_set_data { GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices); void enable_primitive_restart(); int32_t get_index_by_name(const char* name); + const char* get_name_by_index(int32_t index); void load(farc* f, bool ignore_cache, const char* name, const shader_table* shaders_table, const size_t size, const shader_bind_func* bind_func_table, const size_t bind_func_table_size,