[jak2] Hopefully improve sky performance (#3130)

Switches the slime look up table to be a texture, since I guess intel
drivers are terrible and putting the array in the shader makes it
extremely slow.

Also, a few minor changes:
- removed art-groups from the test-zone levels since this causes the
compiler to re-decompile the game, and makes the launcher slower. (left
it in commented out)
- Switched `decompile_code` to false by default in jak 2, in case people
run the decompiler and don't want to wait forever
- Fixed build warnings
This commit is contained in:
water111 2023-11-04 06:33:16 -07:00 committed by GitHub
parent adada4751d
commit 85725401d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 174 additions and 298 deletions

View File

@ -86,7 +86,7 @@ void apply_formatting_config(
// circumstance, we do NOT do this sort of thing when formatting normal forms (cond/case pairs
// are another similar situation)
if (curr_node.formatting_config.has_constant_pairs) {
for (int i = 0; i < curr_node.refs.size(); i++) {
for (int i = 0; i < (int)curr_node.refs.size(); i++) {
auto& child_ref = curr_node.refs.at(i);
const auto type = child_ref.metadata.node_type;
if (constant_types.find(type) == constant_types.end() &&
@ -107,7 +107,7 @@ void apply_formatting_config(
curr_node.formatting_config.indentation_width = hang_indentation_width(curr_node);
}
// iterate through the refs
for (int i = 0; i < curr_node.refs.size(); i++) {
for (int i = 0; i < (int)curr_node.refs.size(); i++) {
auto& ref = curr_node.refs.at(i);
if (!ref.token) {
// If the child has a pre-defined configuration at that index, we pass it along
@ -211,7 +211,7 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
//
// This means we may combine elements onto the same line in this step.
std::vector<std::string> form_lines = {};
for (int i = 0; i < curr_node.refs.size(); i++) {
for (int i = 0; i < (int)curr_node.refs.size(); i++) {
const auto& ref = curr_node.refs.at(i);
// Add new line entry
if (ref.token) {
@ -227,7 +227,7 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
// If it's not a token, we have to recursively build up the form
// TODO - add the cursor_pos here
const auto& lines = apply_formatting(ref, {}, cursor_pos);
for (int i = 0; i < lines.size(); i++) {
for (int i = 0; i < (int)lines.size(); i++) {
const auto& line = lines.at(i);
form_lines.push_back(fmt::format(
"{}{}", str_util::repeat(ref.formatting_config.parent_mutable_extra_indent, " "),
@ -235,12 +235,12 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
}
}
// If we are hanging forms, combine the first two forms onto the same line
if (i == curr_node.refs.size() - 1 && form_lines.size() > 1 &&
if (i == (int)curr_node.refs.size() - 1 && form_lines.size() > 1 &&
(curr_node.formatting_config.hang_forms ||
curr_node.formatting_config.combine_first_two_lines)) {
form_lines.at(0) += fmt::format(" {}", form_lines.at(1));
form_lines.erase(form_lines.begin() + 1);
} else if ((i + 1) < curr_node.refs.size()) {
} else if ((i + 1) < (int)curr_node.refs.size()) {
const auto& next_ref = curr_node.refs.at(i + 1);
// combine the next inline comment or constant pair
if ((next_ref.metadata.node_type == "comment" && next_ref.metadata.is_inline) ||
@ -267,7 +267,7 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
// Consolidate any lines if the configuration requires it
if (curr_node.formatting_config.inline_until_index != -1) {
std::vector<std::string> new_form_lines = {};
for (int i = 0; i < form_lines.size(); i++) {
for (int i = 0; i < (int)form_lines.size(); i++) {
if (i < curr_node.formatting_config.inline_until_index) {
if (new_form_lines.empty()) {
new_form_lines.push_back(form_lines.at(i));
@ -296,7 +296,7 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
if (inline_form) {
form_lines = {fmt::format("{}", fmt::join(form_lines, " "))};
} else {
for (int i = 0; i < form_lines.size(); i++) {
for (int i = 0; i < (int)form_lines.size(); i++) {
if (i > 0) {
auto& line = form_lines.at(i);
line = fmt::format("{}{}",

View File

@ -39,7 +39,7 @@ bool should_insert_blank_line(const FormatterTreeNode& containing_node,
return false;
}
// If the next form is a comment and is inline, don't insert a comment
if ((index + 1) < containing_node.refs.size() &&
if ((index + 1) < (int)containing_node.refs.size() &&
containing_node.refs.at(index + 1).metadata.is_comment &&
containing_node.refs.at(index + 1).metadata.is_inline) {
return false;

View File

@ -22,13 +22,13 @@ FormFormattingConfig new_binding_rule() {
auto binding_list_config = std::make_shared<FormFormattingConfig>();
binding_list_config->hang_forms = false;
binding_list_config->indentation_width = 1;
binding_list_config->indentation_width_for_index = [](FormFormattingConfig cfg, int index) {
binding_list_config->indentation_width_for_index = [](FormFormattingConfig /*cfg*/, int index) {
if (index == 0) {
return 0;
}
return 4;
};
binding_list_config->should_prevent_inlining = [](FormFormattingConfig config, int num_refs) {
binding_list_config->should_prevent_inlining = [](FormFormattingConfig /*config*/, int num_refs) {
// Only prevent inlining a binding list, if there are more than 1 bindings
if (num_refs > 1) {
return true;

View File

@ -17,14 +17,14 @@ struct FormFormattingConfig {
2; // 2 for a flow // TODO - also remove this, prefer storing the first node's width in the
// metadata on the first pass, that's basically all this does
std::function<int(FormFormattingConfig, int)> indentation_width_for_index =
[](FormFormattingConfig config, int index) { return config.indentation_width; };
[](FormFormattingConfig config, int /*index*/) { return config.indentation_width; };
bool combine_first_two_lines =
false; // NOTE - basically hang, but will probably stick around after hang is gone
int inline_until_index = -1;
bool has_constant_pairs = false;
bool prevent_inlining = false;
std::function<bool(FormFormattingConfig, int num_refs)> should_prevent_inlining =
[](FormFormattingConfig config, int num_refs) { return config.prevent_inlining; };
[](FormFormattingConfig config, int /*num_refs*/) { return config.prevent_inlining; };
int parent_mutable_extra_indent = 0;
std::unordered_map<int, std::shared_ptr<FormFormattingConfig>> index_configs = {};
};

View File

@ -544,8 +544,15 @@ MethodInfo TypeSystem::override_method(Type* type,
throw_typesystem_error("Trying to override a method that has no parent declaration");
}
// use the existing ID.
return type->add_method({existing_info.id, existing_info.name, existing_info.type,
type->get_name(), existing_info.no_virtual, false, true, docstring});
return type->add_method({existing_info.id,
existing_info.name,
existing_info.type,
type->get_name(),
existing_info.no_virtual,
false,
true,
docstring,
{}});
}
MethodInfo TypeSystem::declare_method(const std::string& type_name,
@ -596,8 +603,15 @@ MethodInfo TypeSystem::declare_method(Type* type,
}
// use the existing ID.
return type->add_method(
{existing_info.id, method_name, ts, type->get_name(), no_virtual, true, false, docstring});
return type->add_method({existing_info.id,
method_name,
ts,
type->get_name(),
no_virtual,
true,
false,
docstring,
{}});
} else {
if (got_existing) {
// make sure we aren't changing anything.
@ -627,8 +641,15 @@ MethodInfo TypeSystem::declare_method(Type* type,
return existing_info;
} else {
// add a new method!
return type->add_method({get_next_method_id(type), method_name, ts, type->get_name(),
no_virtual, false, false, docstring});
return type->add_method({get_next_method_id(type),
method_name,
ts,
type->get_name(),
no_virtual,
false,
false,
docstring,
{}});
}
}
}
@ -736,7 +757,8 @@ MethodInfo TypeSystem::add_new_method(Type* type,
return existing;
} else {
return type->add_new_method({0, "new", ts, type->get_name(), false, false, false, docstring});
return type->add_new_method(
{0, "new", ts, type->get_name(), false, false, false, docstring, {}});
}
}
@ -2089,7 +2111,7 @@ std::optional<std::string> find_best_field_in_structure(const TypeSystem& ts,
if (end_field == -1) {
end_field = st->fields().size();
}
for (size_t i = start_field; i < end_field; ++i) {
for (size_t i = start_field; i < (size_t)end_field; ++i) {
const auto& field = st->fields().at(i);
auto type = ts.lookup_type(field.type());
if (field.is_dynamic() || field.offset() > offset || field.user_placed() != want_fixed) {

View File

@ -457,7 +457,7 @@ void declare_method(Type* type,
void declare_state_methods(Type* type,
TypeSystem* type_system,
const goos::Object& def,
StructureDefResult& struct_def) {
StructureDefResult& /*struct_def*/) {
for_each_in_list(def, [&](const goos::Object& _obj) {
auto obj = &_obj;
// either state-name or (state-name args...) or (state-name "docstring" args...)

View File

@ -36,7 +36,9 @@
// All art groups you want to use in your custom level. Will add their models and corresponding textures to the FR3 file.
// Note: You will still have to add them to your level's .gd file.
"art_groups": ["plat-ag"],
// Removed so that the release builds don't have to double-decompile the game
// "art_groups": ["plat-ag"],
"art_groups": [],
// Any textures you want to include in your custom level. This is mainly useful for things such as the zoomer HUD,
// which is not in the common level files and has no art group associated with it.
@ -103,16 +105,16 @@
"lump": {
"name": "test-eco"
}
},
{
"trans": [-7.41, 3.5, 28.42], // translation
"etype": "plat", // actor type
"game_task": 0, // associated game task (for powercells, etc)
"quat": [0, 0, 0, 1], // quaternion
"bsphere": [-7.41, 3.5, 28.42, 10], // bounding sphere
"lump": {
"name": "test-plat"
}
}
// {
// "trans": [-7.41, 3.5, 28.42], // translation
// "etype": "plat", // actor type
// "game_task": 0, // associated game task (for powercells, etc)
// "quat": [0, 0, 0, 1], // quaternion
// "bsphere": [-7.41, 3.5, 28.42, 10], // bounding sphere
// "lump": {
// "name": "test-plat"
// }
// }
]
}

View File

@ -35,7 +35,9 @@
"base_id": 100,
// All art groups you want to use in your custom level. Will add their models and corresponding textures to the FR3 file.
"art_groups": ["prsn-torture-ag"],
// Removed so that the release builds don't have to double-decompile the game
//"art_groups": ["prsn-torture-ag"],
"art_groups": [],
// Any textures you want to include in your custom level.
// This is mainly useful for textures which are not in the common level files and have no art group associated with them.

View File

@ -19,7 +19,7 @@
"disassemble_code": false,
// Run the decompiler
"decompile_code": true,
"decompile_code": false,
"find_functions": true,

View File

@ -5,6 +5,7 @@
#include "common/util/FileUtil.h"
#include "common/util/Timer.h"
#include "game/graphics/opengl_renderer/slime_lut.h"
#include "game/graphics/texture/TexturePool.h"
#include "third-party/imgui/imgui.h"
@ -428,6 +429,19 @@ TextureAnimator::TextureAnimator(ShaderLibrary& shaders, const tfrag3::Level* co
glGenerateMipmap(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
// create the slime LUT texture
glGenTextures(1, &m_slime_lut_texture);
glBindTexture(GL_TEXTURE_1D, m_slime_lut_texture);
std::vector<u8> slime_data;
for (auto x : kSlimeLutData) {
slime_data.push_back(x * 255);
}
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, 256, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV,
slime_data.data());
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0);
shader.activate();
// generate CLUT table.
@ -2751,6 +2765,10 @@ void TextureAnimator::run_slime(const SlimeInput& input) {
float uv[2 * 4] = {0, 0, 1, 0, 1, 1, 0, 1};
glUniform2fv(m_uniforms.uvs, 4, uv);
glActiveTexture(GL_TEXTURE10);
glBindTexture(GL_TEXTURE_1D, m_slime_lut_texture);
glActiveTexture(GL_TEXTURE0);
// Anim 1:
// noise (16x16)
// while (noise_layer_idx) {

View File

@ -348,6 +348,7 @@ class TextureAnimator {
GLuint m_shader_id;
GLuint m_dummy_texture;
GLuint m_slime_lut_texture;
u8 m_index_to_clut_addr[256];
OpenGLTexturePool m_opengl_texture_pool;

View File

@ -14,6 +14,7 @@ uniform float slime_scroll;
in vec2 uv;
uniform sampler2D tex_T0;
uniform sampler1D tex_T10;
float cloud_lookup(float v, float minimum, float maximum) {
maximum = max(minimum, maximum);
@ -29,265 +30,6 @@ float cloud_lookup(float v, float minimum, float maximum) {
return sin_alpha * sin_alpha;
}
vec4 slime_lut[256] = vec4[](
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3254, 0.3333, 0.0745, 0.5019),
vec4(0.3333, 0.3450, 0.0745, 0.5019),
vec4(0.3411, 0.3607, 0.0745, 0.5019),
vec4(0.3490, 0.3725, 0.0745, 0.5019),
vec4(0.3568, 0.3882, 0.0745, 0.5019),
vec4(0.3607, 0.4000, 0.0745, 0.5019),
vec4(0.3686, 0.4117, 0.0745, 0.5019),
vec4(0.3764, 0.4274, 0.0745, 0.5019),
vec4(0.3764, 0.4274, 0.0784, 0.5019),
vec4(0.3686, 0.4117, 0.0745, 0.5019),
vec4(0.3607, 0.4000, 0.0745, 0.5019),
vec4(0.3529, 0.3843, 0.0745, 0.5019),
vec4(0.3490, 0.3725, 0.0745, 0.5019),
vec4(0.3411, 0.3607, 0.0745, 0.5019),
vec4(0.3333, 0.3450, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3215, 0.0745, 0.5019),
vec4(0.3215, 0.3254, 0.0705, 0.5019),
vec4(0.3254, 0.3294, 0.0705, 0.5019),
vec4(0.3294, 0.3333, 0.0705, 0.5019),
vec4(0.3333, 0.3372, 0.0705, 0.5019),
vec4(0.3333, 0.3450, 0.0705, 0.5019),
vec4(0.3372, 0.3490, 0.0705, 0.5019),
vec4(0.3411, 0.3529, 0.0705, 0.5019),
vec4(0.3450, 0.3568, 0.0705, 0.5019),
vec4(0.3450, 0.3607, 0.0705, 0.5019),
vec4(0.3490, 0.3686, 0.0705, 0.5019),
vec4(0.3529, 0.3725, 0.0705, 0.5019),
vec4(0.3568, 0.3764, 0.0705, 0.5019),
vec4(0.3607, 0.3803, 0.0705, 0.5019),
vec4(0.3607, 0.3843, 0.0705, 0.5019),
vec4(0.3647, 0.3921, 0.0705, 0.5019),
vec4(0.3686, 0.3960, 0.0705, 0.5019),
vec4(0.3725, 0.4000, 0.0705, 0.5019),
vec4(0.3725, 0.4039, 0.0705, 0.5019),
vec4(0.3764, 0.4078, 0.0705, 0.5019),
vec4(0.3803, 0.4156, 0.0705, 0.5019),
vec4(0.3843, 0.4196, 0.0705, 0.5019),
vec4(0.3882, 0.4235, 0.0705, 0.5019),
vec4(0.3882, 0.4274, 0.0705, 0.5019),
vec4(0.3921, 0.4313, 0.0705, 0.5019),
vec4(0.3960, 0.4392, 0.0705, 0.5019),
vec4(0.4000, 0.4431, 0.0705, 0.5019),
vec4(0.4000, 0.4470, 0.0705, 0.5019),
vec4(0.4039, 0.4509, 0.0705, 0.5019),
vec4(0.4078, 0.4549, 0.0705, 0.5019),
vec4(0.4117, 0.4627, 0.0705, 0.5019),
vec4(0.4117, 0.4666, 0.0705, 0.5019),
vec4(0.4235, 0.4862, 0.0705, 0.5019),
vec4(0.4509, 0.5254, 0.0705, 0.5019),
vec4(0.4784, 0.5686, 0.0705, 0.5019),
vec4(0.5058, 0.6117, 0.0666, 0.5019),
vec4(0.5333, 0.6509, 0.0666, 0.5019),
vec4(0.5607, 0.6941, 0.0666, 0.5019),
vec4(0.5882, 0.7372, 0.0666, 0.5019),
vec4(0.6196, 0.7803, 0.0666, 0.5019),
vec4(0.6196, 0.7803, 0.0666, 0.5019),
vec4(0.6000, 0.7529, 0.0666, 0.5019),
vec4(0.5803, 0.7254, 0.0666, 0.5019),
vec4(0.5647, 0.6980, 0.0666, 0.5019),
vec4(0.5450, 0.6705, 0.0666, 0.5019),
vec4(0.5294, 0.6431, 0.0666, 0.5019),
vec4(0.5098, 0.6156, 0.0705, 0.5019),
vec4(0.4745, 0.5607, 0.0705, 0.5019),
vec4(0.4666, 0.5450, 0.0705, 0.5019),
vec4(0.4666, 0.5529, 0.0705, 0.5019),
vec4(0.4705, 0.5568, 0.0705, 0.5019),
vec4(0.4745, 0.5607, 0.0705, 0.5019),
vec4(0.4784, 0.5647, 0.0705, 0.5019),
vec4(0.4784, 0.5686, 0.0705, 0.5019),
vec4(0.4823, 0.5764, 0.0705, 0.5019),
vec4(0.4862, 0.5803, 0.0705, 0.5019),
vec4(0.4901, 0.5843, 0.0705, 0.5019),
vec4(0.4941, 0.5882, 0.0705, 0.5019),
vec4(0.4941, 0.5921, 0.0705, 0.5019),
vec4(0.4980, 0.6000, 0.0705, 0.5019),
vec4(0.5019, 0.6039, 0.0705, 0.5019),
vec4(0.5058, 0.6078, 0.0705, 0.5019),
vec4(0.5058, 0.6117, 0.0705, 0.5019),
vec4(0.5098, 0.6156, 0.0705, 0.5019),
vec4(0.5137, 0.6235, 0.0705, 0.5019),
vec4(0.5176, 0.6274, 0.0705, 0.5019),
vec4(0.5215, 0.6313, 0.0705, 0.5019),
vec4(0.5215, 0.6352, 0.0705, 0.5019),
vec4(0.5254, 0.6392, 0.0705, 0.5019),
vec4(0.5294, 0.6470, 0.0705, 0.5019),
vec4(0.5333, 0.6509, 0.0705, 0.5019),
vec4(0.5333, 0.6549, 0.0705, 0.5019),
vec4(0.5372, 0.6588, 0.0705, 0.5019),
vec4(0.5411, 0.6627, 0.0705, 0.5019),
vec4(0.5450, 0.6705, 0.0705, 0.5019),
vec4(0.5450, 0.6745, 0.0705, 0.5019),
vec4(0.5490, 0.6784, 0.0705, 0.5019),
vec4(0.5529, 0.6823, 0.0705, 0.5019),
vec4(0.5568, 0.6862, 0.0705, 0.5019),
vec4(0.5607, 0.6941, 0.0705, 0.5019),
vec4(0.5607, 0.6980, 0.0705, 0.5019),
vec4(0.5725, 0.7098, 0.0666, 0.5019),
vec4(0.5803, 0.7254, 0.0666, 0.5019),
vec4(0.5882, 0.7372, 0.0666, 0.5019),
vec4(0.6000, 0.7490, 0.0666, 0.5019),
vec4(0.6078, 0.7647, 0.0666, 0.5019),
vec4(0.6156, 0.7764, 0.0666, 0.5019),
vec4(0.6274, 0.7921, 0.0666, 0.5019),
vec4(0.6274, 0.7921, 0.0666, 0.5019),
vec4(0.6196, 0.7803, 0.0666, 0.5019),
vec4(0.6117, 0.7686, 0.0666, 0.5019),
vec4(0.6039, 0.7607, 0.0666, 0.5019),
vec4(0.5960, 0.7490, 0.0666, 0.5019),
vec4(0.5882, 0.7411, 0.0705, 0.5019),
vec4(0.5803, 0.7294, 0.0705, 0.5019),
vec4(0.5647, 0.7098, 0.0705, 0.5019),
vec4(0.5647, 0.7098, 0.0705, 0.5019),
vec4(0.5607, 0.7058, 0.0705, 0.5019),
vec4(0.5568, 0.7019, 0.0705, 0.5019),
vec4(0.5529, 0.6980, 0.0705, 0.5019),
vec4(0.5529, 0.6941, 0.0705, 0.5019),
vec4(0.5490, 0.6901, 0.0745, 0.5019),
vec4(0.5450, 0.6862, 0.0745, 0.5019),
vec4(0.5411, 0.6823, 0.0745, 0.5019),
vec4(0.5411, 0.6823, 0.0745, 0.5019),
vec4(0.5372, 0.6784, 0.0745, 0.5019),
vec4(0.5333, 0.6745, 0.0745, 0.5019),
vec4(0.5294, 0.6705, 0.0745, 0.5019),
vec4(0.5294, 0.6666, 0.0745, 0.5019),
vec4(0.5254, 0.6627, 0.0745, 0.5019),
vec4(0.5215, 0.6588, 0.0745, 0.5019),
vec4(0.5176, 0.6549, 0.0745, 0.5019),
vec4(0.5176, 0.6549, 0.0745, 0.5019),
vec4(0.5137, 0.6509, 0.0745, 0.5019),
vec4(0.5098, 0.6470, 0.0784, 0.5019),
vec4(0.5058, 0.6431, 0.0784, 0.5019),
vec4(0.5058, 0.6392, 0.0784, 0.5019),
vec4(0.5019, 0.6352, 0.0784, 0.5019),
vec4(0.4980, 0.6313, 0.0784, 0.5019),
vec4(0.4941, 0.6274, 0.0784, 0.5019),
vec4(0.4941, 0.6274, 0.0784, 0.5019),
vec4(0.4901, 0.6235, 0.0784, 0.5019),
vec4(0.4862, 0.6196, 0.0784, 0.5019),
vec4(0.4823, 0.6156, 0.0784, 0.5019),
vec4(0.4823, 0.6117, 0.0784, 0.5019),
vec4(0.4784, 0.6078, 0.0784, 0.5019),
vec4(0.4745, 0.6039, 0.0784, 0.5019),
vec4(0.4745, 0.6039, 0.0823, 0.5019),
vec4(0.4745, 0.6039, 0.0823, 0.5019),
vec4(0.4862, 0.6156, 0.0784, 0.5019),
vec4(0.4980, 0.6313, 0.0784, 0.5019),
vec4(0.5098, 0.6470, 0.0784, 0.5019),
vec4(0.5215, 0.6588, 0.0745, 0.5019),
vec4(0.5333, 0.6745, 0.0745, 0.5019),
vec4(0.5450, 0.6901, 0.0745, 0.5019),
vec4(0.5568, 0.7019, 0.0705, 0.5019),
vec4(0.5686, 0.7176, 0.0705, 0.5019),
vec4(0.5803, 0.7333, 0.0705, 0.5019),
vec4(0.5921, 0.7490, 0.0705, 0.5019),
vec4(0.6039, 0.7607, 0.0666, 0.5019),
vec4(0.6156, 0.7764, 0.0666, 0.5019),
vec4(0.6274, 0.7921, 0.0666, 0.5019),
vec4(0.6392, 0.8039, 0.0627, 0.5019),
vec4(0.6509, 0.8196, 0.0627, 0.5019),
vec4(0.6745, 0.8509, 0.0627, 0.5019),
vec4(0.6705, 0.8470, 0.0627, 0.5019),
vec4(0.6666, 0.8431, 0.0627, 0.5019),
vec4(0.6627, 0.8392, 0.0627, 0.5019),
vec4(0.6588, 0.8352, 0.0627, 0.5019),
vec4(0.6588, 0.8313, 0.0627, 0.5019),
vec4(0.6549, 0.8274, 0.0627, 0.5019),
vec4(0.6509, 0.8235, 0.0627, 0.5019),
vec4(0.6470, 0.8196, 0.0627, 0.5019),
vec4(0.6431, 0.8156, 0.0627, 0.5019),
vec4(0.6431, 0.8117, 0.0627, 0.5019),
vec4(0.6392, 0.8078, 0.0627, 0.5019),
vec4(0.6352, 0.8039, 0.0666, 0.5019),
vec4(0.6313, 0.8000, 0.0666, 0.5019),
vec4(0.6274, 0.7960, 0.0666, 0.5019),
vec4(0.6274, 0.7921, 0.0666, 0.5019),
vec4(0.6235, 0.7882, 0.0666, 0.5019),
vec4(0.6196, 0.7843, 0.0666, 0.5019),
vec4(0.6156, 0.7803, 0.0666, 0.5019),
vec4(0.6156, 0.7764, 0.0666, 0.5019),
vec4(0.6117, 0.7725, 0.0666, 0.5019),
vec4(0.6078, 0.7686, 0.0666, 0.5019),
vec4(0.6039, 0.7647, 0.0666, 0.5019),
vec4(0.6000, 0.7607, 0.0666, 0.5019),
vec4(0.6000, 0.7568, 0.0666, 0.5019),
vec4(0.5960, 0.7529, 0.0705, 0.5019),
vec4(0.5921, 0.7490, 0.0705, 0.5019),
vec4(0.5882, 0.7450, 0.0705, 0.5019),
vec4(0.5843, 0.7411, 0.0705, 0.5019),
vec4(0.5843, 0.7372, 0.0705, 0.5019),
vec4(0.5803, 0.7333, 0.0705, 0.5019),
vec4(0.5764, 0.7294, 0.0705, 0.5019),
vec4(0.5725, 0.7254, 0.0705, 0.5019),
vec4(0.5686, 0.7215, 0.0705, 0.5019),
vec4(0.5686, 0.7176, 0.0705, 0.5019),
vec4(0.5647, 0.7137, 0.0705, 0.5019),
vec4(0.5607, 0.7098, 0.0705, 0.5019),
vec4(0.5568, 0.7058, 0.0705, 0.5019),
vec4(0.5568, 0.7019, 0.0745, 0.5019),
vec4(0.5490, 0.6941, 0.0745, 0.5019),
vec4(0.5490, 0.6941, 0.0745, 0.5019),
vec4(0.5647, 0.7137, 0.0705, 0.5019),
vec4(0.5803, 0.7294, 0.0705, 0.5019),
vec4(0.5921, 0.7490, 0.0705, 0.5019),
vec4(0.6078, 0.7647, 0.0666, 0.5019),
vec4(0.6196, 0.7843, 0.0666, 0.5019),
vec4(0.6352, 0.8000, 0.0666, 0.5019),
vec4(0.6509, 0.8196, 0.0666, 0.5019),
vec4(0.6509, 0.8196, 0.0666, 0.5019),
vec4(0.6392, 0.8039, 0.0666, 0.5019),
vec4(0.6274, 0.7921, 0.0666, 0.5019),
vec4(0.6156, 0.7764, 0.0666, 0.5019),
vec4(0.6078, 0.7647, 0.0705, 0.5019),
vec4(0.5960, 0.7490, 0.0705, 0.5019),
vec4(0.5843, 0.7372, 0.0705, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019),
vec4(0.5647, 0.7098, 0.0745, 0.5019)
);
void main() {
if (enable_tex == 1) {
vec4 tex_color = texture(tex_T0, uv);
@ -311,7 +53,7 @@ void main() {
} else if (enable_tex == 3) {
// cloud version
vec4 tex_color = texture(tex_T0, uv + vec2(0, slime_scroll));
color = slime_lut[int(tex_color.r * 255.f)];
color = texelFetch(tex_T10, int(tex_color.r * 255.f), 0);
} else {
color = (rgba / 128.);
}

View File

@ -0,0 +1,89 @@
#pragma once
constexpr float kSlimeLutData[4 * 256] = {
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019, 0.3254, 0.3333, 0.0745, 0.5019,
0.3333, 0.3450, 0.0745, 0.5019, 0.3411, 0.3607, 0.0745, 0.5019, 0.3490, 0.3725, 0.0745, 0.5019,
0.3568, 0.3882, 0.0745, 0.5019, 0.3607, 0.4000, 0.0745, 0.5019, 0.3686, 0.4117, 0.0745, 0.5019,
0.3764, 0.4274, 0.0745, 0.5019, 0.3764, 0.4274, 0.0784, 0.5019, 0.3686, 0.4117, 0.0745, 0.5019,
0.3607, 0.4000, 0.0745, 0.5019, 0.3529, 0.3843, 0.0745, 0.5019, 0.3490, 0.3725, 0.0745, 0.5019,
0.3411, 0.3607, 0.0745, 0.5019, 0.3333, 0.3450, 0.0745, 0.5019, 0.3215, 0.3215, 0.0745, 0.5019,
0.3215, 0.3215, 0.0745, 0.5019, 0.3215, 0.3254, 0.0705, 0.5019, 0.3254, 0.3294, 0.0705, 0.5019,
0.3294, 0.3333, 0.0705, 0.5019, 0.3333, 0.3372, 0.0705, 0.5019, 0.3333, 0.3450, 0.0705, 0.5019,
0.3372, 0.3490, 0.0705, 0.5019, 0.3411, 0.3529, 0.0705, 0.5019, 0.3450, 0.3568, 0.0705, 0.5019,
0.3450, 0.3607, 0.0705, 0.5019, 0.3490, 0.3686, 0.0705, 0.5019, 0.3529, 0.3725, 0.0705, 0.5019,
0.3568, 0.3764, 0.0705, 0.5019, 0.3607, 0.3803, 0.0705, 0.5019, 0.3607, 0.3843, 0.0705, 0.5019,
0.3647, 0.3921, 0.0705, 0.5019, 0.3686, 0.3960, 0.0705, 0.5019, 0.3725, 0.4000, 0.0705, 0.5019,
0.3725, 0.4039, 0.0705, 0.5019, 0.3764, 0.4078, 0.0705, 0.5019, 0.3803, 0.4156, 0.0705, 0.5019,
0.3843, 0.4196, 0.0705, 0.5019, 0.3882, 0.4235, 0.0705, 0.5019, 0.3882, 0.4274, 0.0705, 0.5019,
0.3921, 0.4313, 0.0705, 0.5019, 0.3960, 0.4392, 0.0705, 0.5019, 0.4000, 0.4431, 0.0705, 0.5019,
0.4000, 0.4470, 0.0705, 0.5019, 0.4039, 0.4509, 0.0705, 0.5019, 0.4078, 0.4549, 0.0705, 0.5019,
0.4117, 0.4627, 0.0705, 0.5019, 0.4117, 0.4666, 0.0705, 0.5019, 0.4235, 0.4862, 0.0705, 0.5019,
0.4509, 0.5254, 0.0705, 0.5019, 0.4784, 0.5686, 0.0705, 0.5019, 0.5058, 0.6117, 0.0666, 0.5019,
0.5333, 0.6509, 0.0666, 0.5019, 0.5607, 0.6941, 0.0666, 0.5019, 0.5882, 0.7372, 0.0666, 0.5019,
0.6196, 0.7803, 0.0666, 0.5019, 0.6196, 0.7803, 0.0666, 0.5019, 0.6000, 0.7529, 0.0666, 0.5019,
0.5803, 0.7254, 0.0666, 0.5019, 0.5647, 0.6980, 0.0666, 0.5019, 0.5450, 0.6705, 0.0666, 0.5019,
0.5294, 0.6431, 0.0666, 0.5019, 0.5098, 0.6156, 0.0705, 0.5019, 0.4745, 0.5607, 0.0705, 0.5019,
0.4666, 0.5450, 0.0705, 0.5019, 0.4666, 0.5529, 0.0705, 0.5019, 0.4705, 0.5568, 0.0705, 0.5019,
0.4745, 0.5607, 0.0705, 0.5019, 0.4784, 0.5647, 0.0705, 0.5019, 0.4784, 0.5686, 0.0705, 0.5019,
0.4823, 0.5764, 0.0705, 0.5019, 0.4862, 0.5803, 0.0705, 0.5019, 0.4901, 0.5843, 0.0705, 0.5019,
0.4941, 0.5882, 0.0705, 0.5019, 0.4941, 0.5921, 0.0705, 0.5019, 0.4980, 0.6000, 0.0705, 0.5019,
0.5019, 0.6039, 0.0705, 0.5019, 0.5058, 0.6078, 0.0705, 0.5019, 0.5058, 0.6117, 0.0705, 0.5019,
0.5098, 0.6156, 0.0705, 0.5019, 0.5137, 0.6235, 0.0705, 0.5019, 0.5176, 0.6274, 0.0705, 0.5019,
0.5215, 0.6313, 0.0705, 0.5019, 0.5215, 0.6352, 0.0705, 0.5019, 0.5254, 0.6392, 0.0705, 0.5019,
0.5294, 0.6470, 0.0705, 0.5019, 0.5333, 0.6509, 0.0705, 0.5019, 0.5333, 0.6549, 0.0705, 0.5019,
0.5372, 0.6588, 0.0705, 0.5019, 0.5411, 0.6627, 0.0705, 0.5019, 0.5450, 0.6705, 0.0705, 0.5019,
0.5450, 0.6745, 0.0705, 0.5019, 0.5490, 0.6784, 0.0705, 0.5019, 0.5529, 0.6823, 0.0705, 0.5019,
0.5568, 0.6862, 0.0705, 0.5019, 0.5607, 0.6941, 0.0705, 0.5019, 0.5607, 0.6980, 0.0705, 0.5019,
0.5725, 0.7098, 0.0666, 0.5019, 0.5803, 0.7254, 0.0666, 0.5019, 0.5882, 0.7372, 0.0666, 0.5019,
0.6000, 0.7490, 0.0666, 0.5019, 0.6078, 0.7647, 0.0666, 0.5019, 0.6156, 0.7764, 0.0666, 0.5019,
0.6274, 0.7921, 0.0666, 0.5019, 0.6274, 0.7921, 0.0666, 0.5019, 0.6196, 0.7803, 0.0666, 0.5019,
0.6117, 0.7686, 0.0666, 0.5019, 0.6039, 0.7607, 0.0666, 0.5019, 0.5960, 0.7490, 0.0666, 0.5019,
0.5882, 0.7411, 0.0705, 0.5019, 0.5803, 0.7294, 0.0705, 0.5019, 0.5647, 0.7098, 0.0705, 0.5019,
0.5647, 0.7098, 0.0705, 0.5019, 0.5607, 0.7058, 0.0705, 0.5019, 0.5568, 0.7019, 0.0705, 0.5019,
0.5529, 0.6980, 0.0705, 0.5019, 0.5529, 0.6941, 0.0705, 0.5019, 0.5490, 0.6901, 0.0745, 0.5019,
0.5450, 0.6862, 0.0745, 0.5019, 0.5411, 0.6823, 0.0745, 0.5019, 0.5411, 0.6823, 0.0745, 0.5019,
0.5372, 0.6784, 0.0745, 0.5019, 0.5333, 0.6745, 0.0745, 0.5019, 0.5294, 0.6705, 0.0745, 0.5019,
0.5294, 0.6666, 0.0745, 0.5019, 0.5254, 0.6627, 0.0745, 0.5019, 0.5215, 0.6588, 0.0745, 0.5019,
0.5176, 0.6549, 0.0745, 0.5019, 0.5176, 0.6549, 0.0745, 0.5019, 0.5137, 0.6509, 0.0745, 0.5019,
0.5098, 0.6470, 0.0784, 0.5019, 0.5058, 0.6431, 0.0784, 0.5019, 0.5058, 0.6392, 0.0784, 0.5019,
0.5019, 0.6352, 0.0784, 0.5019, 0.4980, 0.6313, 0.0784, 0.5019, 0.4941, 0.6274, 0.0784, 0.5019,
0.4941, 0.6274, 0.0784, 0.5019, 0.4901, 0.6235, 0.0784, 0.5019, 0.4862, 0.6196, 0.0784, 0.5019,
0.4823, 0.6156, 0.0784, 0.5019, 0.4823, 0.6117, 0.0784, 0.5019, 0.4784, 0.6078, 0.0784, 0.5019,
0.4745, 0.6039, 0.0784, 0.5019, 0.4745, 0.6039, 0.0823, 0.5019, 0.4745, 0.6039, 0.0823, 0.5019,
0.4862, 0.6156, 0.0784, 0.5019, 0.4980, 0.6313, 0.0784, 0.5019, 0.5098, 0.6470, 0.0784, 0.5019,
0.5215, 0.6588, 0.0745, 0.5019, 0.5333, 0.6745, 0.0745, 0.5019, 0.5450, 0.6901, 0.0745, 0.5019,
0.5568, 0.7019, 0.0705, 0.5019, 0.5686, 0.7176, 0.0705, 0.5019, 0.5803, 0.7333, 0.0705, 0.5019,
0.5921, 0.7490, 0.0705, 0.5019, 0.6039, 0.7607, 0.0666, 0.5019, 0.6156, 0.7764, 0.0666, 0.5019,
0.6274, 0.7921, 0.0666, 0.5019, 0.6392, 0.8039, 0.0627, 0.5019, 0.6509, 0.8196, 0.0627, 0.5019,
0.6745, 0.8509, 0.0627, 0.5019, 0.6705, 0.8470, 0.0627, 0.5019, 0.6666, 0.8431, 0.0627, 0.5019,
0.6627, 0.8392, 0.0627, 0.5019, 0.6588, 0.8352, 0.0627, 0.5019, 0.6588, 0.8313, 0.0627, 0.5019,
0.6549, 0.8274, 0.0627, 0.5019, 0.6509, 0.8235, 0.0627, 0.5019, 0.6470, 0.8196, 0.0627, 0.5019,
0.6431, 0.8156, 0.0627, 0.5019, 0.6431, 0.8117, 0.0627, 0.5019, 0.6392, 0.8078, 0.0627, 0.5019,
0.6352, 0.8039, 0.0666, 0.5019, 0.6313, 0.8000, 0.0666, 0.5019, 0.6274, 0.7960, 0.0666, 0.5019,
0.6274, 0.7921, 0.0666, 0.5019, 0.6235, 0.7882, 0.0666, 0.5019, 0.6196, 0.7843, 0.0666, 0.5019,
0.6156, 0.7803, 0.0666, 0.5019, 0.6156, 0.7764, 0.0666, 0.5019, 0.6117, 0.7725, 0.0666, 0.5019,
0.6078, 0.7686, 0.0666, 0.5019, 0.6039, 0.7647, 0.0666, 0.5019, 0.6000, 0.7607, 0.0666, 0.5019,
0.6000, 0.7568, 0.0666, 0.5019, 0.5960, 0.7529, 0.0705, 0.5019, 0.5921, 0.7490, 0.0705, 0.5019,
0.5882, 0.7450, 0.0705, 0.5019, 0.5843, 0.7411, 0.0705, 0.5019, 0.5843, 0.7372, 0.0705, 0.5019,
0.5803, 0.7333, 0.0705, 0.5019, 0.5764, 0.7294, 0.0705, 0.5019, 0.5725, 0.7254, 0.0705, 0.5019,
0.5686, 0.7215, 0.0705, 0.5019, 0.5686, 0.7176, 0.0705, 0.5019, 0.5647, 0.7137, 0.0705, 0.5019,
0.5607, 0.7098, 0.0705, 0.5019, 0.5568, 0.7058, 0.0705, 0.5019, 0.5568, 0.7019, 0.0745, 0.5019,
0.5490, 0.6941, 0.0745, 0.5019, 0.5490, 0.6941, 0.0745, 0.5019, 0.5647, 0.7137, 0.0705, 0.5019,
0.5803, 0.7294, 0.0705, 0.5019, 0.5921, 0.7490, 0.0705, 0.5019, 0.6078, 0.7647, 0.0666, 0.5019,
0.6196, 0.7843, 0.0666, 0.5019, 0.6352, 0.8000, 0.0666, 0.5019, 0.6509, 0.8196, 0.0666, 0.5019,
0.6509, 0.8196, 0.0666, 0.5019, 0.6392, 0.8039, 0.0666, 0.5019, 0.6274, 0.7921, 0.0666, 0.5019,
0.6156, 0.7764, 0.0666, 0.5019, 0.6078, 0.7647, 0.0705, 0.5019, 0.5960, 0.7490, 0.0705, 0.5019,
0.5843, 0.7372, 0.0705, 0.5019, 0.5647, 0.7098, 0.0745, 0.5019, 0.5647, 0.7098, 0.0745, 0.5019,
0.5647, 0.7098, 0.0745, 0.5019, 0.5647, 0.7098, 0.0745, 0.5019, 0.5647, 0.7098, 0.0745, 0.5019,
0.5647, 0.7098, 0.0745, 0.5019, 0.5647, 0.7098, 0.0745, 0.5019, 0.5647, 0.7098, 0.0745, 0.5019,
0.5647, 0.7098, 0.0745, 0.5019};

View File

@ -972,7 +972,7 @@ void pc_get_external_speedrun_time(u32 speedrun_id_ptr,
auto speedrun_id = std::string(Ptr<String>(speedrun_id_ptr).c()->data());
if (external_speedrun_time_cache.find(speedrun_id) != external_speedrun_time_cache.end()) {
const auto& runs = external_speedrun_time_cache.at(speedrun_id);
if (index < runs.size()) {
if (index < (int)runs.size()) {
const auto& run_info = external_speedrun_time_cache.at(speedrun_id).at(index);
std::string converted =
get_font_bank(GameTextVersion::JAK2)->convert_utf8_to_game(run_info.first);
@ -991,7 +991,7 @@ void pc_get_external_race_time(u32 race_id_ptr, s32 index, u32 name_dest_ptr, u3
auto race_id = std::string(Ptr<String>(race_id_ptr).c()->data());
if (external_race_time_cache.find(race_id) != external_race_time_cache.end()) {
const auto& runs = external_race_time_cache.at(race_id);
if (index < runs.size()) {
if (index < (int)runs.size()) {
const auto& run_info = external_race_time_cache.at(race_id).at(index);
std::string converted =
get_font_bank(GameTextVersion::JAK2)->convert_utf8_to_game(run_info.first);
@ -1013,7 +1013,7 @@ void pc_get_external_highscore(u32 highscore_id_ptr,
auto highscore_id = std::string(Ptr<String>(highscore_id_ptr).c()->data());
if (external_highscores_cache.find(highscore_id) != external_highscores_cache.end()) {
const auto& runs = external_highscores_cache.at(highscore_id);
if (index < runs.size()) {
if (index < (int)runs.size()) {
const auto& run_info = external_highscores_cache.at(highscore_id).at(index);
std::string converted =
get_font_bank(GameTextVersion::JAK2)->convert_utf8_to_game(run_info.first);