From a1fcd184fbf9a1d450abd7908a814e11e0117fd4 Mon Sep 17 00:00:00 2001 From: Rajko Stojadinovic Date: Thu, 12 Oct 2017 22:53:47 +0200 Subject: [PATCH] Add sample "Source code" and build script for Super Mario 3D World --- .../4102408f48cb6b94_0000000000000079_ps.txt | 28 +++++ .../46575655811a12b7_0000000000000079_ps.txt | 28 +++++ .../74b3539704b05bfd_0000000000000079_ps.txt | 28 +++++ .../f5190dd4ae552353_0000000000000079_ps.txt | 27 +++++ Source/SuperMario3DWorld/patches.txt | 45 ++++++++ Source/SuperMario3DWorld/rules.txt | 101 ++++++++++++++++++ build.sh | 44 ++++++++ 7 files changed, 301 insertions(+) create mode 100644 Source/SuperMario3DWorld/4102408f48cb6b94_0000000000000079_ps.txt create mode 100644 Source/SuperMario3DWorld/46575655811a12b7_0000000000000079_ps.txt create mode 100644 Source/SuperMario3DWorld/74b3539704b05bfd_0000000000000079_ps.txt create mode 100644 Source/SuperMario3DWorld/f5190dd4ae552353_0000000000000079_ps.txt create mode 100644 Source/SuperMario3DWorld/patches.txt create mode 100644 Source/SuperMario3DWorld/rules.txt create mode 100644 build.sh diff --git a/Source/SuperMario3DWorld/4102408f48cb6b94_0000000000000079_ps.txt b/Source/SuperMario3DWorld/4102408f48cb6b94_0000000000000079_ps.txt new file mode 100644 index 00000000..3a08ba7e --- /dev/null +++ b/Source/SuperMario3DWorld/4102408f48cb6b94_0000000000000079_ps.txt @@ -0,0 +1,28 @@ +#version 420 +#extension GL_ARB_texture_gather : enable +// shader 4102408f48cb6b94 +// Used for: Vertical Blur 1 +const float blurFactor = 1.0; //Higher is less blur + +// Implementation of http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ +layout(binding = 0) uniform sampler2D textureUnitPS0; +layout(location = 0) in vec4 passParameterSem0; +layout(location = 0) out vec4 passPixelColor0; + +// Calculated with BlurNinja with as parameters: --expand 4 --reduce 4 17 --linear +uniform float weight[] = float[](0.16122494, 0.26575540, 0.12180456, 0.02865990, 0.00316767); +uniform float offset[] = float[](0.00000000, 1.44000000, 3.36000000, 5.28000000, 7.20000000); + +ivec2 inputRes = textureSize(textureUnitPS0, 0); +vec2 outputRes = vec2(float(inputRes.x), float(inputRes.y)); +vec2 scale = outputRes * blurFactor; +void main() +{ + vec2 R0f = vec2(passParameterSem0.x, passParameterSem0.w); + vec4 R1f = texture(textureUnitPS0, R0f) * weight[0]; + for (int i = 1; i<4; i++) { + R1f += texture(textureUnitPS0, R0f + (vec2(0.0, offset[i]) / scale)) * weight[i]; + R1f += texture(textureUnitPS0, R0f - (vec2(0.0, offset[i]) / scale)) * weight[i]; + } + passPixelColor0 = R1f; +} \ No newline at end of file diff --git a/Source/SuperMario3DWorld/46575655811a12b7_0000000000000079_ps.txt b/Source/SuperMario3DWorld/46575655811a12b7_0000000000000079_ps.txt new file mode 100644 index 00000000..535e6fc5 --- /dev/null +++ b/Source/SuperMario3DWorld/46575655811a12b7_0000000000000079_ps.txt @@ -0,0 +1,28 @@ +#version 420 +#extension GL_ARB_texture_gather : enable +// shader 46575655811a12b7 +// Used for: Horizontal Blur +const float blurFactor = 1.0; //Higher is less blur + +// Implementation of http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ +layout(binding = 0) uniform sampler2D textureUnitPS0; +layout(location = 0) in vec4 passParameterSem0; +layout(location = 0) out vec4 passPixelColor0; + +// Weights and Offsets calculated with BlurNinja with these arguments: --expand 4 --reduce 4 17 --linear +uniform float weight[] = float[](0.16122494, 0.26575540, 0.12180456, 0.02865990, 0.00316767); +uniform float offset[] = float[](0.00000000, 1.44000000, 3.36000000, 5.28000000, 7.20000000); + +ivec2 inputRes = textureSize(textureUnitPS0, 0); +vec2 outputRes = vec2(float(inputRes.x), float(inputRes.y)); +vec2 scale = outputRes * blurFactor; +void main() +{ + vec2 R0f = vec2(passParameterSem0.w, passParameterSem0.x); + vec4 R1f = texture(textureUnitPS0, R0f) * weight[0]; + for (int i = 1; i<4; i++) { + R1f += texture(textureUnitPS0, R0f + (vec2(offset[i], 0.0) / scale)) * weight[i]; + R1f += texture(textureUnitPS0, R0f - (vec2(offset[i], 0.0) / scale)) * weight[i]; + } + passPixelColor0 = R1f; +} \ No newline at end of file diff --git a/Source/SuperMario3DWorld/74b3539704b05bfd_0000000000000079_ps.txt b/Source/SuperMario3DWorld/74b3539704b05bfd_0000000000000079_ps.txt new file mode 100644 index 00000000..63adcd52 --- /dev/null +++ b/Source/SuperMario3DWorld/74b3539704b05bfd_0000000000000079_ps.txt @@ -0,0 +1,28 @@ +#version 420 +#extension GL_ARB_texture_gather : enable +// shader 74b3539704b05bfd +// Used for: Horizontal Blur 1 +const float blurFactor = 1.0; //Higher is less blur + +// Implementation of http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ +layout(binding = 0) uniform sampler2D textureUnitPS0; +layout(location = 0) in vec4 passParameterSem0; +layout(location = 0) out vec4 passPixelColor0; + +// Calculated with BlurNinja with as parameters: --expand 3 --reduce 3 13 --linear +uniform float weight[] = float[](0.18571429, 0.28870130, 0.10363636, 0.01480519); +uniform float offset[] = float[](0.00000000, 1.42105263, 3.31578947, 5.21052632); + +ivec2 inputRes = textureSize(textureUnitPS0, 0); +vec2 outputRes = vec2(float(inputRes.x), float(inputRes.y)); +vec2 scale = outputRes * blurFactor; +void main() +{ + vec2 R0f = vec2(passParameterSem0.w, passParameterSem0.x); + vec4 R1f = texture(textureUnitPS0, R0f) * weight[0]; + for (int i = 1; i<4; i++) { + R1f += texture(textureUnitPS0, R0f + (vec2(offset[i], 0.0) / scale)) * weight[i]; + R1f += texture(textureUnitPS0, R0f - (vec2(offset[i], 0.0) / scale)) * weight[i]; + } + passPixelColor0 = R1f; +} \ No newline at end of file diff --git a/Source/SuperMario3DWorld/f5190dd4ae552353_0000000000000079_ps.txt b/Source/SuperMario3DWorld/f5190dd4ae552353_0000000000000079_ps.txt new file mode 100644 index 00000000..341223d9 --- /dev/null +++ b/Source/SuperMario3DWorld/f5190dd4ae552353_0000000000000079_ps.txt @@ -0,0 +1,27 @@ +#version 420 +#extension GL_ARB_texture_gather : enable +// shader f5190dd4ae552353 +// Used for: Vertical Blur 1 +const float blurFactor = 1.0; //Higher is less blur + +// Implementation of http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ +layout(binding = 0) uniform sampler2D textureUnitPS0; +layout(location = 0) in vec4 passParameterSem0; +layout(location = 0) out vec4 passPixelColor0; + +uniform float weight[] = float[](0.18571429, 0.28870130, 0.10363636, 0.01480519); +uniform float offset[] = float[](0.00000000, 1.42105263, 3.31578947, 5.21052632); + +ivec2 inputRes = textureSize(textureUnitPS0, 0); +vec2 outputRes = vec2(float(inputRes.x), float(inputRes.y)); +vec2 scale = outputRes * blurFactor; +void main() +{ + vec2 R0f = vec2(passParameterSem0.x, passParameterSem0.w); + vec4 R1f = texture(textureUnitPS0, R0f) * weight[0]; + for (int i = 1; i<4; i++) { + R1f += texture(textureUnitPS0, R0f + (vec2(0.0, offset[i]) / scale)) * weight[i]; + R1f += texture(textureUnitPS0, R0f - (vec2(0.0, offset[i]) / scale)) * weight[i]; + } + passPixelColor0 = R1f; +} \ No newline at end of file diff --git a/Source/SuperMario3DWorld/patches.txt b/Source/SuperMario3DWorld/patches.txt new file mode 100644 index 00000000..70097da3 --- /dev/null +++ b/Source/SuperMario3DWorld/patches.txt @@ -0,0 +1,45 @@ + +[RedCarpetAspectUW] +moduleMatches = 0xBBAF1908, 0xD2308838, 0xEB70C731 +# rodata constants +0x10363ED4 = .float +0x1036A688 = .float +_aspectAddr = 0x10363ED4 + +# Aspect calculation +0x0241D9B4 = lis r8, _aspectAddr@ha +0x0241D9B8 = lfs f0, _aspectAddr@l(r8) + +[KinopioAspectUW] +moduleMatches = 0x43781F76, 0xC64B0A12, 0xD80AD9B4 +#rodata constants +0x100A0EE0 = .float +0x100BE2EC = .float +0x100D79B4 = .float +_aspectAddr = 0x100A0EE0 + +#Aspect Calculation +0x02368158 = lis r31, _aspectAddr@ha +0x0236815c = lfs f13, _aspectAddr@l(r31) + +[KinopioAspectUWv16] +moduleMatches = 0x9E0461E7, 0x1B377483, 0x0576A725 +#rodata constants +0x0100A2D38 = .float +0x0100C0164 = .float +0x0100D982C = .float +_aspectAddr = 0x0100A2D38 + +#Aspect Calculation +0x02373530 = lis r31, _aspectAddr@ha +0x02373534 = lfs f13, _aspectAddr@l(r31) diff --git a/Source/SuperMario3DWorld/rules.txt b/Source/SuperMario3DWorld/rules.txt new file mode 100644 index 00000000..d7c4624e --- /dev/null +++ b/Source/SuperMario3DWorld/rules.txt @@ -0,0 +1,101 @@ + +[Definition] +titleIds = 0005000010145d00,0005000010145c00,0005000010106100 +name = "Super Mario 3D World - " +version = 2 + +[TextureRedefine] # tv +width = 1280 +height = 720 +formatsExcluded = 0x008,0x41A,0x034,0x035 # exclude obvious textures +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # zoomed in +width = 1128 +height = 720 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # zoom transition +width = 1000 +height = 600 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # zoom transition 2 +width = 1000 +height = 720 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # half-res alpha +width = 640 +height = 360 +formatsExcluded = 0x41A # exclude obvious textures +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # half-res (zoomed in) +width = 564 +height = 360 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # half-res (zoom transition) +width = 500 +height = 300 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # half-res (zoom transition 2) +width = 500 +height = 360 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # quarter-res alpha +width = 320 +height = 180 +formatsExcluded = 0x41A # exclude obvious textures +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # q-res (zoomed in) +width = 282 +height = 180 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # q-res (zoom transition) +width = 250 +height = 150 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # q-res (zoom transition 2) +width = 250 +height = 180 +overwriteWidth = +overwriteHeight = + +[TextureRedefine] # gamepad + +width = 854 +height = 480 +#overwriteWidth = +#overwriteHeight = diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..6db1dea8 --- /dev/null +++ b/build.sh @@ -0,0 +1,44 @@ +#!/bin/bash +baseOutDir=$1 +if [ -n "$baseOutDir" ]; then + if [ ! -d "$baseOutDir" ]; then + echo "Making base output directory $baseOutDir" + mkdir "$baseOutDir" + fi +fi + +build_dir () { + srcDir=$1 + dstDir=$2 + if [ -n "$baseOutDir" ]; then + dstDir="$baseOutDir/$dstDir" + fi + + params=( "$@" ) + rest=( "${params[@]:2}" ) + + if [ ! -d "$dstDir" ]; then + echo "Making output directory $dstDir" + mkdir -p "$dstDir" + else + rm "$dstDir"/*.txt + fi + + for f in "$srcDir"/*.txt + do + filename=`basename $f` + outName="$dstDir/$filename" + echo "Building $f to $outName with params ${rest[@]}" + php5 "$f" ${rest[*]} > "$outName" + if [ $? -ne 0 ]; then + rm "$outName" + fi + done +} + +build_dir "Source/SuperMario3DWorld" "Quality/SuperMario3DWorld_1080p" 1920 1080 +build_dir "Source/SuperMario3DWorld" "Quality/SuperMario3DWorld_1080pUW" 2560 1080 +build_dir "Source/SuperMario3DWorld" "Quality/SuperMario3DWorld_1440p" 2560 1440 +build_dir "Source/SuperMario3DWorld" "Quality/SuperMario3DWorld_1800p" 3200 1800 +build_dir "Source/SuperMario3DWorld" "Quality/SuperMario3DWorld_2160p" 3840 2160 +