From a92a76fdc4180eb5366983cdbaaea620ea8cc89e Mon Sep 17 00:00:00 2001 From: M&M Date: Mon, 1 Feb 2021 16:50:15 -0800 Subject: [PATCH] [Sonic Lost World] Several pack changes - Optimize UW shaders - Add missing tonemapping shader - Patch No Music differently - Add No Voices pack --- Mods/SonicLostWorld_NoMusic/patches.txt | 3 +- Mods/SonicLostWorld_NoMusic/rules.txt | 2 +- Mods/SonicLostWorld_NoVoices/patches.txt | 3 + Mods/SonicLostWorld_NoVoices/rules.txt | 6 + .../2fc311c50a4dc0cc_0000000000000000_vs.txt | 4 +- .../384f98693cb9e56d_0000000000000000_vs.txt | 4 +- .../384f98696d1a276d_0000000000000000_vs.txt | 4 +- .../3952c3a52c87c267_0000000000000000_vs.txt | 4 +- .../419dbf0ca38aa719_0000000000000000_vs.txt | 4 +- .../91f43f263091c56d_0000000000079249_ps.txt | 209 ++++++++++++++++++ .../rules.txt | 2 +- 11 files changed, 226 insertions(+), 19 deletions(-) create mode 100644 Mods/SonicLostWorld_NoVoices/patches.txt create mode 100644 Mods/SonicLostWorld_NoVoices/rules.txt create mode 100644 Workarounds/SonicLostWorld_DisableTonemapping/91f43f263091c56d_0000000000079249_ps.txt diff --git a/Mods/SonicLostWorld_NoMusic/patches.txt b/Mods/SonicLostWorld_NoMusic/patches.txt index 889a22b9..56b9d577 100644 --- a/Mods/SonicLostWorld_NoMusic/patches.txt +++ b/Mods/SonicLostWorld_NoMusic/patches.txt @@ -1,4 +1,3 @@ [sonic2013] moduleMatches = 0xC5691A40 - -0x021B82FC = nop +0x021B7FB8 = blr diff --git a/Mods/SonicLostWorld_NoMusic/rules.txt b/Mods/SonicLostWorld_NoMusic/rules.txt index 6e5d2151..55c6cfb3 100644 --- a/Mods/SonicLostWorld_NoMusic/rules.txt +++ b/Mods/SonicLostWorld_NoMusic/rules.txt @@ -2,5 +2,5 @@ titleIds = 0005000010135700,000500001012B100,0005000010128F00 name = No Music path = "Sonic Lost World/Mods/No Music" -description = Disables music playback. Made by M&&M. +description = Disables the game's music playback.|Made by M&&M. version = 4 diff --git a/Mods/SonicLostWorld_NoVoices/patches.txt b/Mods/SonicLostWorld_NoVoices/patches.txt new file mode 100644 index 00000000..fa20473a --- /dev/null +++ b/Mods/SonicLostWorld_NoVoices/patches.txt @@ -0,0 +1,3 @@ +[sonic2013] +moduleMatches = 0xC5691A40 +0x021B8068 = blr diff --git a/Mods/SonicLostWorld_NoVoices/rules.txt b/Mods/SonicLostWorld_NoVoices/rules.txt new file mode 100644 index 00000000..16e2a3ca --- /dev/null +++ b/Mods/SonicLostWorld_NoVoices/rules.txt @@ -0,0 +1,6 @@ +[Definition] +titleIds = 0005000010135700,000500001012B100,0005000010128F00 +name = No Voices +path = "Sonic Lost World/Mods/No Voices" +description = Disables the game's voice playback, which are mainly used by the Deadly Six.|Made by M&&M. +version = 4 diff --git a/Resolutions/SonicLostWorld_Resolution/2fc311c50a4dc0cc_0000000000000000_vs.txt b/Resolutions/SonicLostWorld_Resolution/2fc311c50a4dc0cc_0000000000000000_vs.txt index 529e3379..20e7d3df 100644 --- a/Resolutions/SonicLostWorld_Resolution/2fc311c50a4dc0cc_0000000000000000_vs.txt +++ b/Resolutions/SonicLostWorld_Resolution/2fc311c50a4dc0cc_0000000000000000_vs.txt @@ -2,9 +2,7 @@ #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : enable // shader 2fc311c50a4dc0cc -const float origRatio = float($gameWidth)/float($gameHeight); -const float newRatio = float($width)/float($height); -const float arScale = origRatio/newRatio; +const float arScale = (((float($gameHeight)/float($height))*float($width))/float($gameWidth)); // start of shader inputs/outputs, predetermined by Cemu. Do not touch #ifdef VULKAN #define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) diff --git a/Resolutions/SonicLostWorld_Resolution/384f98693cb9e56d_0000000000000000_vs.txt b/Resolutions/SonicLostWorld_Resolution/384f98693cb9e56d_0000000000000000_vs.txt index 9ac323e4..911742f7 100644 --- a/Resolutions/SonicLostWorld_Resolution/384f98693cb9e56d_0000000000000000_vs.txt +++ b/Resolutions/SonicLostWorld_Resolution/384f98693cb9e56d_0000000000000000_vs.txt @@ -2,9 +2,7 @@ #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : enable // shader 384f98693cb9e56d -const float origRatio = float($gameWidth)/float($gameHeight); -const float newRatio = float($width)/float($height); -const float arScale = origRatio/newRatio; +const float arScale = (((float($gameHeight)/float($height))*float($width))/float($gameWidth)); // start of shader inputs/outputs, predetermined by Cemu. Do not touch #ifdef VULKAN #define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) diff --git a/Resolutions/SonicLostWorld_Resolution/384f98696d1a276d_0000000000000000_vs.txt b/Resolutions/SonicLostWorld_Resolution/384f98696d1a276d_0000000000000000_vs.txt index 2a1d68b9..ad584d76 100644 --- a/Resolutions/SonicLostWorld_Resolution/384f98696d1a276d_0000000000000000_vs.txt +++ b/Resolutions/SonicLostWorld_Resolution/384f98696d1a276d_0000000000000000_vs.txt @@ -2,9 +2,7 @@ #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : enable // shader 384f98696d1a276d -const float origRatio = float($gameWidth)/float($gameHeight); -const float newRatio = float($width)/float($height); -const float arScale = origRatio/newRatio; +const float arScale = (((float($gameHeight)/float($height))*float($width))/float($gameWidth)); // start of shader inputs/outputs, predetermined by Cemu. Do not touch #ifdef VULKAN #define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) diff --git a/Resolutions/SonicLostWorld_Resolution/3952c3a52c87c267_0000000000000000_vs.txt b/Resolutions/SonicLostWorld_Resolution/3952c3a52c87c267_0000000000000000_vs.txt index f7333991..ce1d0b9a 100644 --- a/Resolutions/SonicLostWorld_Resolution/3952c3a52c87c267_0000000000000000_vs.txt +++ b/Resolutions/SonicLostWorld_Resolution/3952c3a52c87c267_0000000000000000_vs.txt @@ -2,9 +2,7 @@ #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : enable // shader 3952c3a52c87c267 -const float origRatio = float($gameWidth)/float($gameHeight); -const float newRatio = float($width)/float($height); -const float arScale = origRatio/newRatio; +const float arScale = (((float($gameHeight)/float($height))*float($width))/float($gameWidth)); // start of shader inputs/outputs, predetermined by Cemu. Do not touch #ifdef VULKAN #define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) diff --git a/Resolutions/SonicLostWorld_Resolution/419dbf0ca38aa719_0000000000000000_vs.txt b/Resolutions/SonicLostWorld_Resolution/419dbf0ca38aa719_0000000000000000_vs.txt index 6f78e223..2dec81e0 100644 --- a/Resolutions/SonicLostWorld_Resolution/419dbf0ca38aa719_0000000000000000_vs.txt +++ b/Resolutions/SonicLostWorld_Resolution/419dbf0ca38aa719_0000000000000000_vs.txt @@ -2,9 +2,7 @@ #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : enable // shader 419dbf0ca38aa719 -const float origRatio = float($gameWidth)/float($gameHeight); -const float newRatio = float($width)/float($height); -const float arScale = origRatio/newRatio; +const float arScale = (((float($gameHeight)/float($height))*float($width))/float($gameWidth)); // start of shader inputs/outputs, predetermined by Cemu. Do not touch #ifdef VULKAN #define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) diff --git a/Workarounds/SonicLostWorld_DisableTonemapping/91f43f263091c56d_0000000000079249_ps.txt b/Workarounds/SonicLostWorld_DisableTonemapping/91f43f263091c56d_0000000000079249_ps.txt new file mode 100644 index 00000000..e1768e9c --- /dev/null +++ b/Workarounds/SonicLostWorld_DisableTonemapping/91f43f263091c56d_0000000000079249_ps.txt @@ -0,0 +1,209 @@ +#version 430 +#extension GL_ARB_texture_gather : enable +#extension GL_ARB_separate_shader_objects : enable +// shader 91f43f263091c56d +// start of shader inputs/outputs, predetermined by Cemu. Do not touch +#ifdef VULKAN +#define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) +#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation, std140) +#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation) +#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw) +#else +#define ATTR_LAYOUT(__vkSet, __location) layout(location = __location) +#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation, std140) +#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation) +#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw) +#endif +#ifdef VULKAN +layout(set = 1, binding = 5) uniform ufBlock +{ +uniform ivec4 uf_remappedPS[5]; +uniform vec4 uf_fragCoordScale; +}; +#else +uniform ivec4 uf_remappedPS[5]; +uniform vec2 uf_fragCoordScale; +#endif +TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0; +TEXTURE_LAYOUT(1, 1, 1) uniform sampler2D textureUnitPS1; +TEXTURE_LAYOUT(2, 1, 2) uniform sampler2D textureUnitPS2; +TEXTURE_LAYOUT(3, 1, 3) uniform sampler2D textureUnitPS3; +TEXTURE_LAYOUT(6, 1, 4) uniform sampler2D textureUnitPS6; +layout(location = 0) in vec4 passParameterSem136; +layout(location = 0) out vec4 passPixelColor0; +// end of shader inputs/outputs +int clampFI32(int v) +{ +if( v == 0x7FFFFFFF ) + return floatBitsToInt(1.0); +else if( v == 0xFFFFFFFF ) + return floatBitsToInt(0.0); +return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0)); +} +float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; } +void main() +{ +vec4 R0f = vec4(0.0); +vec4 R1f = vec4(0.0); +vec4 R2f = vec4(0.0); +vec4 R3f = vec4(0.0); +vec4 R4f = vec4(0.0); +vec4 R5f = vec4(0.0); +vec4 R6f = vec4(0.0); +vec4 R7f = vec4(0.0); +vec4 R123f = vec4(0.0); +vec4 R125f = vec4(0.0); +vec4 R126f = vec4(0.0); +vec4 R127f = vec4(0.0); +float backupReg0f, backupReg1f, backupReg2f, backupReg3f, backupReg4f; +vec4 PV0f = vec4(0.0), PV1f = vec4(0.0); +float PS0f = 0.0, PS1f = 0.0; +vec4 tempf = vec4(0.0); +float tempResultf; +int tempResulti; +ivec4 ARi = ivec4(0); +bool predResult = true; +vec3 cubeMapSTM; +int cubeMapFaceId; +R0f = passParameterSem136; +R6f.xyz = (texture(textureUnitPS3, R0f.xy).xyz); +R4f.xyzw = (texture(textureUnitPS2, R0f.xy).xyzw); +// 0 +backupReg0f = R0f.y; +R125f.x = -(R0f.x) + intBitsToFloat(uf_remappedPS[0].x); +PV0f.y = -(backupReg0f) + intBitsToFloat(uf_remappedPS[0].y); +R127f.z = 0.0; +R7f.w = 1.0; +PS0f = 1.0 / intBitsToFloat(uf_remappedPS[1].z); +// 1 +PV1f.x = mul_nonIEEE(R6f.z, R6f.z); +R127f.y = PV0f.y * PS0f; +PV1f.y = R127f.y; +R126f.x = 1.0 / intBitsToFloat(uf_remappedPS[2].x); +PS1f = R126f.x; +// 2 +tempf.x = dot(vec4(R125f.x,PV1f.y,R127f.z,-0.0),vec4(R125f.x,PV1f.y,R127f.z,0.0)); +PV0f.x = tempf.x; +PV0f.y = tempf.x; +PV0f.z = tempf.x; +PV0f.w = tempf.x; +R127f.x = (mul_nonIEEE(R6f.y,R6f.y) + PV1f.x); +PS0f = R127f.x; +// 3 +tempf.x = dot(vec4(R125f.x,R127f.y,R127f.z,-0.0),vec4(R125f.x,R127f.y,R127f.z,0.0)); +PV1f.x = tempf.x; +PV1f.y = tempf.x; +PV1f.z = tempf.x; +PV1f.w = tempf.x; +PS1f = sqrt(PV0f.x); +// 4 +PV0f.y = PS1f + -(intBitsToFloat(uf_remappedPS[0].w)); +R123f.w = (mul_nonIEEE(R6f.x,R6f.x) + R127f.x); +PV0f.w = R123f.w; +tempResultf = 1.0 / sqrt(PV1f.x); +PS0f = tempResultf; +// 5 +backupReg0f = R126f.x; +R126f.x = mul_nonIEEE(R127f.y, PS0f); +R127f.y = mul_nonIEEE(R125f.x, PS0f); +PV1f.w = PV0f.y * backupReg0f; +PS1f = sqrt(PV0f.w); +// 6 +PV0f.y = PS1f + -(1.0); +PV0f.z = max(PV1f.w, -(1.0)); +// 7 +R2f.x = (mul_nonIEEE(PV0f.y,intBitsToFloat(uf_remappedPS[3].y)) + 1.0); +PV1f.x = R2f.x; +PV1f.y = min(PV0f.z, 1.0); +PV1f.y /= 2.0; +// 8 +PV0f.x = PV1f.y * intBitsToFloat(0x40490fdb); +R0f.z = mul_nonIEEE(PV1f.x, intBitsToFloat(uf_remappedPS[3].z)); +// 9 +R123f.w = (PV0f.x * intBitsToFloat(0x3e22f983) + 0.5); +PV1f.w = R123f.w; +// 10 +PV0f.z = fract(PV1f.w); +// 11 +R123f.y = (PV0f.z * intBitsToFloat(0x40c90fdb) + -(intBitsToFloat(0x40490fdb))); +PV1f.y = R123f.y; +// 12 +PV0f.x = PV1f.y * intBitsToFloat(0x3e22f983); +// 13 +PS1f = cos((PV0f.x)/0.1591549367); +// 14 +R5f.x = (mul_nonIEEE(PS1f,intBitsToFloat(uf_remappedPS[2].w)) + 1.0); +PV0f.y = mul_nonIEEE(PS1f, R126f.x); +PV0f.z = mul_nonIEEE(PS1f, R127f.y); +// 15 +R1f.x = (mul_nonIEEE(PV0f.z,intBitsToFloat(uf_remappedPS[2].y)) + R0f.x); +PV1f.x = R1f.x; +R1f.w = (mul_nonIEEE(PV0f.y,intBitsToFloat(uf_remappedPS[2].y)) + R0f.y); +PV1f.w = R1f.w; +// 16 +R0f.x = (mul_nonIEEE(PV1f.x,intBitsToFloat(uf_remappedPS[3].w)) + intBitsToFloat(uf_remappedPS[4].x)); +R0f.y = (mul_nonIEEE(PV1f.w,intBitsToFloat(uf_remappedPS[3].w)) + intBitsToFloat(uf_remappedPS[4].x)); +R0f.yw = (texture(textureUnitPS6, R0f.xy).yw); +// 0 +PV0f.z = R0f.w + -(0.5); +PV0f.w = R0f.y + -(0.5); +// 1 +backupReg0f = R1f.x; +R1f.x = (mul_nonIEEE(R0f.z,PV0f.w) + backupReg0f); +R1f.y = (mul_nonIEEE(R0f.z,PV0f.z) + R1f.w); +R3f.xyzw = (texture(textureUnitPS0, R1f.xy).xyzw); +// 0 +PV0f.x = R3f.w + -(1.0); +// 1 +R123f.x = (mul_nonIEEE(PV0f.x,intBitsToFloat(uf_remappedPS[4].w)) + 1.0); +PV1f.x = R123f.x; +R123f.w = (mul_nonIEEE(PV0f.x,intBitsToFloat(uf_remappedPS[3].x)) + 1.0); +PV1f.w = R123f.w; +// 2 +PV0f.y = mul_nonIEEE(R2f.x, PV1f.w); +PV0f.z = mul_nonIEEE(R1f.y, PV1f.x); +PV0f.w = mul_nonIEEE(R1f.x, PV1f.x); +// 3 +R2f.x = (mul_nonIEEE(PV0f.w,intBitsToFloat(uf_remappedPS[4].y)) + intBitsToFloat(uf_remappedPS[4].x)); +R2f.y = (mul_nonIEEE(PV0f.z,intBitsToFloat(uf_remappedPS[4].y)) + intBitsToFloat(uf_remappedPS[4].x)); +R0f.z = mul_nonIEEE(PV0f.y, intBitsToFloat(uf_remappedPS[4].z)); +R2f.yw = (texture(textureUnitPS6, R2f.xy).yw); +// 0 +PV0f.z = R2f.w + -(0.5); +PV0f.w = R2f.y + -(0.5); +// 1 +backupReg0f = R1f.x; +backupReg1f = R1f.y; +R1f.x = (mul_nonIEEE(R0f.z,PV0f.w) + backupReg0f); +R1f.y = (mul_nonIEEE(R0f.z,PV0f.z) + backupReg1f); +R1f.xyzw = (texture(textureUnitPS1, R1f.xy).xyzw); +// 0 +PV0f.x = -(R3f.x) + R1f.x; +PV0f.y = mul_nonIEEE(R1f.w, intBitsToFloat(uf_remappedPS[2].z)); +PV0f.z = -(R3f.z) + R1f.z; +PV0f.w = -(R3f.y) + R1f.y; +// 1 +R126f.x = (mul_nonIEEE(PV0f.w,PV0f.y) + R3f.y); +PV1f.x = R126f.x; +R127f.y = (mul_nonIEEE(PV0f.x,PV0f.y) + R3f.x); +PV1f.y = R127f.y; +R127f.w = (mul_nonIEEE(PV0f.z,PV0f.y) + R3f.z); +PV1f.w = R127f.w; +// 2 +PV0f.x = -(PV1f.w) + R4f.z; +PV0f.y = -(PV1f.x) + R4f.y; +PV0f.z = -(PV1f.y) + R4f.x; +// 3 +R123f.y = (mul_nonIEEE(PV0f.x,R4f.w) + R127f.w); +PV1f.y = R123f.y; +R123f.z = (mul_nonIEEE(PV0f.y,R4f.w) + R126f.x); +PV1f.z = R123f.z; +R123f.w = (mul_nonIEEE(PV0f.z,R4f.w) + R127f.y); +PV1f.w = R123f.w; +// 4 +R7f.x = (mul_nonIEEE(PV1f.w,R5f.x) + R6f.x); +R7f.y = (mul_nonIEEE(PV1f.z,R5f.x) + R6f.y); +R7f.z = (mul_nonIEEE(PV1f.y,R5f.x) + R6f.z); +// export +//passPixelColor0 = vec4(R7f.x, R7f.y, R7f.z, R7f.w); +} diff --git a/Workarounds/SonicLostWorld_DisableTonemapping/rules.txt b/Workarounds/SonicLostWorld_DisableTonemapping/rules.txt index 3644d4ba..6d66fa35 100644 --- a/Workarounds/SonicLostWorld_DisableTonemapping/rules.txt +++ b/Workarounds/SonicLostWorld_DisableTonemapping/rules.txt @@ -2,5 +2,5 @@ titleIds = 0005000010135700,000500001012B100,0005000010128F00 name = Disable Tonemapping path = "Sonic Lost World/Workarounds/Disable Tonemapping" -description = Disables the game's tonemapping, making it not appear so dark. Some stages will apppear too bright.|Made by M&&M. +description = Disables the game's tonemapping, making it overall appear not so dark. Some stages will either appear either brighter or darker than they should.|Made by M&&M. version = 4