Skip to content

Instantly share code, notes, and snippets.

@infval
Last active April 18, 2020 05:48
Show Gist options
  • Save infval/8e44427fa1ef78cb2fb235e579a2255a to your computer and use it in GitHub Desktop.
Save infval/8e44427fa1ef78cb2fb235e579a2255a to your computer and use it in GitHub Desktop.
yuzu | Color fix for 'Blaster Master Zero 2' [Switch]
#!/usr/bin/env python3
"""
Dirty color fix for 'Blaster Master Zero 2' [Switch]
OpenGL ONLY!
Tested version: yuzu 228
"""
import sys
# \src\video_core\renderer_opengl\renderer_opengl.cpp
shader_text = b"void main() {\n color = vec4(texture(color_texture, frag_tex_coord).rgb, 1.0f);\n}"
new_shader = b"void main() {\n color = vec4(texture(color_texture, frag_tex_coord).bgr, 1.0f);\n}"
with open("yuzu.exe", "rb") as f:
b = bytearray(f.read())
start_ind = b.find(shader_text)
end_ind = start_ind + len(shader_text)
if start_ind == -1:
print("Shader not found")
input("Press any key...")
sys.exit(1)
b[start_ind:end_ind] = new_shader.ljust(end_ind - start_ind)
with open("yuzu_bgra.exe", "wb") as f:
f.write(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment