From da1b263604e58a9f72a470ff90ed05c216f05203 Mon Sep 17 00:00:00 2001
From: nosklo <github.g.nosklo@0sg.net>
Date: Thu, 25 Jan 2018 19:26:25 -0200
Subject: [PATCH] Hyrule Warriors Ultrawide (#169)

* Add patches for ultrawide HyruleWarriors

Credits go to Xalphenos!!

* Extra space seems to be needed to build correctly

* add 21:9 HyruleWarriors to build.sh
---
 Source/HyruleWarriors/patches.txt | 20 ++++++++++++++++++++
 build.sh                          |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 Source/HyruleWarriors/patches.txt

diff --git a/Source/HyruleWarriors/patches.txt b/Source/HyruleWarriors/patches.txt
new file mode 100644
index 00000000..13bffd16
--- /dev/null
+++ b/Source/HyruleWarriors/patches.txt
@@ -0,0 +1,20 @@
+<?php
+$width = $argv[1];
+$height = $argv[2];
+
+$aspect = $width / (float)$height;
+
+if (round($aspect*100.0) == 178)
+	exit(1);
+
+$aspect = number_format((float)$aspect, 3, '.', '');
+?>
+[HyruleWarriors_219v208]
+moduleMatches = 0xE159AE91
+
+#rodata constant changes
+
+0x1009609C = .float <?=$aspect?> 
+0x10096124 = .float <?=$aspect?> 
+0x10096948 = .float <?=$aspect?> 
+0x10096974 = .float <?=$aspect?> 
diff --git a/build.sh b/build.sh
index 8c40ecdc..05f678b3 100644
--- a/build.sh
+++ b/build.sh
@@ -138,7 +138,7 @@ std_respack "GhostBladeHD" "${res16by9[@]/$just720p}"
 std_respack "GhostlyAdventures" "${res16by9[@]/$just720p}"
 std_respack "GhostlyAdventures2" "${res16by9[@]/$just720p}"
 std_respack "Guacamelee" "${res16by9[@]/$just720p}"
-std_respack "HyruleWarriors" "${res16by9[@]/$just720p}"
+std_respack "HyruleWarriors" "${res16by9[@]/$just720p}" "${res21by9[@]}" "${res48by9[@]}"
 std_respack "InfinityRunner" "${res16by9[@]/$just720p}"
 std_respack "KamenRider" "${res16by9[@]/$just720p}"
 std_respack "KickandFennick" "${res16by9[@]/$just720p}"