<?php
include 'Source/functions.php';
$fullWidth = $argv[1];
$fullHeight = $argv[2];
$scaleFactorX = $fullWidth / 1280.0;
$scaleFactorY = $fullHeight / 720.0;

$title = get_title($fullWidth, $fullHeight);
?>
[Definition]
titleIds = 0005000010116100,00050000101C4C00,00050000101C4D00
name = "Xenoblade Chronicles X - <?=$title?>"
version = 2

[TextureRedefine] # increase colour depth, slower but less banding
formats  = 0x816
overwriteFormat =  0x820

[TextureRedefine] #
formats  = 0x810
overwriteFormat =  0x81e

[TextureRedefine] #
formats  = 0x806
overwriteFormat =  0x80e

[TextureRedefine] #
formats  = 0x007
overwriteFormat =  0x00f

formats = 0x19,0x1a
overwriteFormat = 0x1f
tileModesExcluded = 0x001

[TextureRedefine] #
width = 320
height = 180
formats = 0x19
overwriteFormat = 0x823

[TextureRedefine] #
width = 320
height = 180
formats = 0x1a
overwriteFormat = 0x823

#[TextureRedefine] #lod override, shimmer and possible sharper textures
#formats  = 0x31,0x32,0x33,0x34,0x35,0x431,0x432,0x433,0x434,0x435
#overwriteRelativeLodBias = -1 # don't reccomend more than -1

[TextureRedefine] #0x01a, super sampling
formats  = 0x005,0x01a
overwriteRelativeLodBias = -16 # 

[TextureRedefine] # tv
width = 1280
height = 720
formatsExcluded = 0x031 #NLA flyover XCX logo screen
tileModesExcluded = 0x001
overwriteWidth = <?=round($scaleFactorX*1280)?> 
overwriteHeight = <?=round($scaleFactorY*720)?> 

[TextureRedefine] #XCX shadow
width = 1024
height = 1024
formats = 0x005
overwriteWidth = <?=round($scaleFactorY)*1024?> 
overwriteHeight = <?=round($scaleFactorY)*1024?> 

[TextureRedefine] # Gear menu
width = 1024
height = 720
formatsExcluded = 0x001 #in game movies, stasis
overwriteWidth = <?=round($scaleFactorX*1024)?> 
overwriteHeight = <?=round($scaleFactorY*720)?> 

[TextureRedefine] # Do not remove, must be upscaled with same factor as TV or probe view breaks
width = 854
height = 480
overwriteWidth = <?=round($scaleFactorX*854)?> 
overwriteHeight = <?=round($scaleFactorY*480)?> 

[TextureRedefine] # half-res alpha
width = 640
height = 360
formatsExcluded = 0x41A,0x033,0x031 #dialog prompt fixes, XCX Logo NLA  exclude obvious textures
tileModesExcluded = 0x001
overwriteWidth = <?=round($scaleFactorX*640*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*360*(2/1.5))?> 

[TextureRedefine] #XCX Dynamic shadow scale both same for smoother transitions	
width = 512
height = 512
formats = 0x005	
overwriteWidth = <?=round($scaleFactorY)*1024?> 
overwriteHeight = <?=round($scaleFactorY)*1024?> 

[TextureRedefine] # Sun, Light Sources (plants, armor etc)
width =	512
height = 288
overwriteWidth = <?=round($scaleFactorX*512*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*288*(2/1.5))?> 

[TextureRedefine] # Fog
width =	426
height = 240
overwriteWidth = <?=round($scaleFactorX*640*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*360*(2/1.5))?> 

[TextureRedefine] # q-res alpha (Previously not added due to potential conflict, please remove rule when using Xeno GCN4 workaround)
width = 320
height = 180
overwriteWidth = <?=round($scaleFactorX*320*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*180*(2/1.5))?> 

[TextureRedefine]
width = 261
height = 223
#formatsExcluded = 
overwriteWidth = <?=round($scaleFactorX*261*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*223*(2/1.5))?> 
 
[TextureRedefine]
width = 256
height = 180
#formatsExcluded = 
overwriteWidth = <?=round($scaleFactorX*256*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*180*(2/1.5))?> 

[TextureRedefine] # "God rays" stencil res, lens reflections.
width = 256
height = 144
overwriteWidth = <?=round($scaleFactorX*256*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*144*(2/1.5))?> 

#[TextureRedefine] # lod switch dithering, don't scale
#width = 256
#height = 8
#formats = 0x01a # verify not to scale. 

#[TextureRedefine] # lod switch dithering, don't scale
#width = 256
#height = 4
#formats = 0x01a # verify not to scale. 


[TextureRedefine] #
width = 255
height = 255
formats = 0x810 # 0x01a, PR screen NLA
overwriteWidth = <?=round($scaleFactorX*255)?> 
overwriteHeight = <?=round($scaleFactorY*255)?> 

[TextureRedefine]# Probe glow. 
width = 160
height = 90
#formatsExcluded = 0x816  #fixed in shader
overwriteWidth = <?=round($scaleFactorX*160*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*90*(2/1.5))?> 

[TextureRedefine] 
width = 128
height = 128
formats = 0x806 
overwriteWidth = <?=round($scaleFactorX*128)?> 
overwriteHeight = <?=round($scaleFactorY*128)?> 

[TextureRedefine]
width = 128
height = 90
#formatsExcluded = 
overwriteWidth = <?=round($scaleFactorX*128*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*90*(2/1.5))?> 
	
[TextureRedefine]# should up-scale from 35 to keep aligment with other 16:9 buffers 
width = 80
height = 46
#formatsExcluded = 0x816  #fixed in shader
overwriteWidth = <?=round($scaleFactorX*80*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*45*(2/1.5))?> 

[TextureRedefine] #
width = 64
height = 64
formats = 0x816,0x820  #001a includes cube breaks if scaled
overwriteWidth = <?=round($scaleFactorX*64)?> 
overwriteHeight = <?=round($scaleFactorY*64)?> 

[TextureRedefine]
width = 64
height = 46
#formatsExcluded = 
overwriteWidth = <?=round($scaleFactorX*64*(2/1.5))?> 
overwriteHeight = <?=round($scaleFactorY*46*(2/1.5))?> 

[TextureRedefine] #
height = 32
height = 32
formats = 0x806 #001a includes cube breaks flashlight scene
overwriteWidth = <?=round($scaleFactorX*32)?> 
overwriteHeight = <?=round($scaleFactorY*32)?> 

#[TextureRedefine] #grading don't scale
#width = 16
#height = 16
#formatsExcluded = 
#overwriteWidth = 16
#overwriteHeight = 16

[TextureRedefine] #
width = 8
height = 8
formats = 0x806 
overwriteWidth = <?=round($scaleFactorX*8)?> 
overwriteHeight = <?=round($scaleFactorY*8)?> 
