Add sample "Source code" and build script for Super Mario 3D World

This commit is contained in:
Rajko Stojadinovic 2017-10-12 22:53:47 +02:00
parent 74da3e3dd6
commit a1fcd184fb
7 changed files with 301 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,45 @@
<?
$width = $argv[1];
$height = $argv[2];
$aspect = $width / (float)$height;
if (round($aspect*100.0) == 178)
exit(1);
$aspect = number_format((float)$aspect, 3, '.', '');
?>
[RedCarpetAspectUW]
moduleMatches = 0xBBAF1908, 0xD2308838, 0xEB70C731
# rodata constants
0x10363ED4 = .float <?=$aspect?>
0x1036A688 = .float <?=$aspect?>
_aspectAddr = 0x10363ED4
# Aspect calculation
0x0241D9B4 = lis r8, _aspectAddr@ha
0x0241D9B8 = lfs f0, _aspectAddr@l(r8)
[KinopioAspectUW]
moduleMatches = 0x43781F76, 0xC64B0A12, 0xD80AD9B4
#rodata constants
0x100A0EE0 = .float <?=$aspect?>
0x100BE2EC = .float <?=$aspect?>
0x100D79B4 = .float <?=$aspect?>
_aspectAddr = 0x100A0EE0
#Aspect Calculation
0x02368158 = lis r31, _aspectAddr@ha
0x0236815c = lfs f13, _aspectAddr@l(r31)
[KinopioAspectUWv16]
moduleMatches = 0x9E0461E7, 0x1B377483, 0x0576A725
#rodata constants
0x0100A2D38 = .float <?=$aspect?>
0x0100C0164 = .float <?=$aspect?>
0x0100D982C = .float <?=$aspect?>
_aspectAddr = 0x0100A2D38
#Aspect Calculation
0x02373530 = lis r31, _aspectAddr@ha
0x02373534 = lfs f13, _aspectAddr@l(r31)

View File

@ -0,0 +1,101 @@
<?
$fullWidth = $argv[1];
$fullHeight = $argv[2];
$halfWidth = $fullWidth / 2;
$halfHeight = $fullHeight / 2;
$quarterWidth = $fullWidth / 4;
$quarterHeight = $fullHeight / 4;
$title = $fullWidth . "x" . $fullHeight;
$aspect = $fullWidth / (float)$fullHeight;
if (round($aspect*10) == 23 || round($aspect*10) == 24)
$title = $title . " (21:9)";
?>
[Definition]
titleIds = 0005000010145d00,0005000010145c00,0005000010106100
name = "Super Mario 3D World - <?=$title?>"
version = 2
[TextureRedefine] # tv
width = 1280
height = 720
formatsExcluded = 0x008,0x41A,0x034,0x035 # exclude obvious textures
overwriteWidth = <?=$fullWidth?>
overwriteHeight = <?=$fullHeight?>
[TextureRedefine] # zoomed in
width = 1128
height = 720
overwriteWidth = <?=$fullWidth?>
overwriteHeight = <?=$fullHeight?>
[TextureRedefine] # zoom transition
width = 1000
height = 600
overwriteWidth = <?=$fullWidth?>
overwriteHeight = <?=$fullHeight?>
[TextureRedefine] # zoom transition 2
width = 1000
height = 720
overwriteWidth = <?=$fullWidth?>
overwriteHeight = <?=$fullHeight?>
[TextureRedefine] # half-res alpha
width = 640
height = 360
formatsExcluded = 0x41A # exclude obvious textures
overwriteWidth = <?=$halfWidth?>
overwriteHeight = <?=$halfHeight?>
[TextureRedefine] # half-res (zoomed in)
width = 564
height = 360
overwriteWidth = <?=$halfWidth?>
overwriteHeight = <?=$halfHeight?>
[TextureRedefine] # half-res (zoom transition)
width = 500
height = 300
overwriteWidth = <?=$halfWidth?>
overwriteHeight = <?=$halfHeight?>
[TextureRedefine] # half-res (zoom transition 2)
width = 500
height = 360
overwriteWidth = <?=$halfWidth?>
overwriteHeight = <?=$halfHeight?>
[TextureRedefine] # quarter-res alpha
width = 320
height = 180
formatsExcluded = 0x41A # exclude obvious textures
overwriteWidth = <?=$quarterWidth?>
overwriteHeight = <?=$quarterHeight?>
[TextureRedefine] # q-res (zoomed in)
width = 282
height = 180
overwriteWidth = <?=$quarterWidth?>
overwriteHeight = <?=$quarterHeight?>
[TextureRedefine] # q-res (zoom transition)
width = 250
height = 150
overwriteWidth = <?=$quarterWidth?>
overwriteHeight = <?=$quarterHeight?>
[TextureRedefine] # q-res (zoom transition 2)
width = 250
height = 180
overwriteWidth = <?=$quarterWidth?>
overwriteHeight = <?=$quarterHeight?>
[TextureRedefine] # gamepad
width = 854
height = 480
#overwriteWidth = <?=$fullWidth?>
#overwriteHeight = <?=$fullHeight?>

44
build.sh Normal file
View File

@ -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