; Xilonen

; Constants -------------------------

; Overrides -------------------------

[TextureOverrideXilonenPosition]
hash = a4571ede
vb0 = ResourceXilonenPosition

[TextureOverrideXilonenBlend]
hash = d2562637
vb1 = ResourceXilonenBlend
handling = skip
draw = 23170,0 

[TextureOverrideXilonenTexcoord]
hash = 5401abf4
vb1 = ResourceXilonenTexcoord

[TextureOverrideXilonenVertexLimitRaise]
hash = 5d75c166

[TextureOverrideXilonenCoatPosition]
hash = 696ed18b
vb0 = ResourceXilonenCoatPosition

[TextureOverrideXilonenCoatBlend]
hash = 2135ad79
vb1 = ResourceXilonenCoatBlend
handling = skip
draw = 4470,0 

[TextureOverrideXilonenCoatTexcoord]
hash = 5c84dba7
vb1 = ResourceXilonenCoatTexcoord

[TextureOverrideXilonenCoatVertexLimitRaise]
hash = 83f0f082

[TextureOverrideXilonenIB]
hash = 4c2fa96d
handling = skip
drawindexed = auto

[TextureOverrideXilonenHead]
hash = 4c2fa96d
match_first_index = 0
ib = ResourceXilonenHeadIB
ps-t0 = ResourceXilonenHeadNormalMap
ps-t1 = ResourceXilonenHeadLightMap
ps-t2 = ResourceXilonenHeadDiffuse

$CharacterIB = 1
ResourceRefHeadDiffuse = reference ps-t1

[TextureOverrideXilonenBody]
hash = 4c2fa96d
match_first_index = 28959
ib = ResourceXilonenBodyIB
ps-t0 = ResourceXilonenBodyNormalMap
ps-t1 = ResourceXilonenBodyDiffuse
ps-t2 = ResourceXilonenBodyLightMap

$CharacterIB = 2
ResourceRefBodyDiffuse = reference ps-t1

[TextureOverrideXilonenCoatIB]
hash = 24afd7b2
handling = skip
drawindexed = auto

[TextureOverrideXilonenCoatHead]
hash = 24afd7b2
match_first_index = 0
ib = ResourceXilonenCoatHeadIB
ps-t0 = ResourceXilonenCoatHeadNormalMap
ps-t1 = ResourceXilonenCoatHeadDiffuse
ps-t2 = ResourceXilonenCoatHeadLightMap

[TextureOverrideXilonenCoatBody]
hash = 24afd7b2
match_first_index = 8697
ib = ResourceXilonenCoatBodyIB
ps-t0 = ResourceXilonenCoatBodyNormalMap
ps-t1 = ResourceXilonenCoatBodyDiffuse
ps-t2 = ResourceXilonenCoatBodyLightMap

[TextureOverrideXilonenFaceHeadDiffuse]
hash = b2b73dba
ps-t0 = ResourceXilonenFaceHeadDiffuse


; CommandList -----------------------

; Resources -------------------------

[ResourceXilonenPosition]
type = Buffer
stride = 40
filename = XilonenPosition.buf

[ResourceXilonenBlend]
type = Buffer
stride = 32
filename = XilonenBlend.buf

[ResourceXilonenTexcoord]
type = Buffer
stride = 12
filename = XilonenTexcoord.buf

[ResourceXilonenCoatPosition]
type = Buffer
stride = 40
filename = XilonenCoatPosition.buf

[ResourceXilonenCoatBlend]
type = Buffer
stride = 32
filename = XilonenCoatBlend.buf

[ResourceXilonenCoatTexcoord]
type = Buffer
stride = 12
filename = XilonenCoatTexcoord.buf

[ResourceXilonenHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = XilonenHead.ib

[ResourceXilonenBodyIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = XilonenBody.ib

[ResourceXilonenCoatHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = XilonenCoatHead.ib

[ResourceXilonenCoatBodyIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = XilonenCoatBody.ib

[ResourceXilonenHeadNormalMap]
filename = XilonenHeadNormalMap.dds

[ResourceXilonenHeadLightMap]
filename = XilonenHeadLightMap.dds

[ResourceXilonenHeadDiffuse]
filename = XilonenHeadDiffuse.dds

[ResourceXilonenBodyNormalMap]
filename = XilonenBodyNormalMap.dds

[ResourceXilonenBodyDiffuse]
filename = XilonenBodyDiffuse.dds

[ResourceXilonenBodyLightMap]
filename = XilonenBodyLightMap.dds

[ResourceXilonenCoatHeadNormalMap]
filename = XilonenCoatHeadNormalMap.dds

[ResourceXilonenCoatHeadDiffuse]
filename = XilonenCoatHeadDiffuse.dds

[ResourceXilonenCoatHeadLightMap]
filename = XilonenCoatHeadLightMap.dds

[ResourceXilonenCoatBodyNormalMap]
filename = XilonenCoatBodyNormalMap.dds

[ResourceXilonenCoatBodyDiffuse]
filename = XilonenCoatBodyDiffuse.dds

[ResourceXilonenCoatBodyLightMap]
filename = XilonenCoatBodyLightMap.dds

[ResourceXilonenFaceHeadDiffuse]
filename = XilonenFaceHeadDiffuse.dds


; .ini generated by GIMI (Genshin-Impact-Model-Importer)
; If you have any issues or find any bugs, please open a ticket at https://github.com/SilentNightSound/GI-Model-Importer/issues or contact SilentNightSound#7430 on discord

; Version 1.0.0 AGMG Tool Developer Version 3 Shader Fixer


; Generated shader fix for 3.0+ GIMI importer characters. Please contact the tool developers at https://discord.gg/agmg if you have any questions.

; Variables -----------------------

[Constants]
global $CharacterIB
;0=none, 1=head, 2=body, 3=dress, 4=extra, etc.

[Present]
post $CharacterIB = 0

[ResourceRefHeadDiffuse]
;[ResourceRefHeadLightMap]
[ResourceRefBodyDiffuse]
;[ResourceRefBodyLightMap]
[ResourceRefDressDiffuse]
;[ResourceRefDressLightMap]
[ResourceRefExtraDiffuse]
;[ResourceRefExtraLightMap]

; ShaderOverride ---------------------------

[ShaderRegexCharReflection]
shader_model = ps_5_0
run = CommandListReflectionTexture
[ShaderRegexCharReflection.pattern]
mul r\d+\.\w+, r\d+\.\w+,[^.]*\.\w+\n
mad o\d+\.\w+, r\d+\.\w+, cb\d+\[\d+\]\.\w+, r\d+\.\w+\n
mov o\d+\.\w+, l\(\d+\.\d+\)\n

;[ShaderRegexCharOutline]
;shader_model = ps_5_0
;run = CommandListOutline
;[ShaderRegexCharOutline.pattern]
;mov o\d+\.\w+, l\(\d+\)\n
;mov o\d+\.\w+, r\d+\.\w+\n
;mov o\d+\.\w+, l\(\d+\.\d+\)
;broken as of version 4.0

; OPTIONAL: If regex match breaks, use a [ShaderOverride] command matching shader hash for reflection then use "run = CommandListOutline" under the command

; CommandList -------------------------

[CommandListReflectionTexture]
if $CharacterIB != 0
    if $CharacterIB == 1
        ps-t0 = copy ResourceRefHeadDiffuse
    else if $CharacterIB == 2
        ps-t0 = copy ResourceRefBodyDiffuse
    else if $CharacterIB == 3
        ps-t0 = copy ResourceRefDressDiffuse
    else if $CharacterIB == 4
        ps-t0 = copy ResourceRefExtraDiffuse    
    endif
drawindexed=auto
$CharacterIB = 0
endif

;[CommandListOutline]
;if $CharacterIB != 0
;    if $CharacterIB == 1
;        ps-t1 = copy ResourceRefHeadLightMap
;    else if $CharacterIB == 2
;        ps-t1 = copy ResourceRefBodyLightMap
;    else if $CharacterIB == 3
;        ps-t1 = copy ResourceRefDressLightMap
;    else if $CharacterIB == 4
;        ps-t1 = copy ResourceRefExtraLightMap
;    endif
;drawindexed=auto
;$CharacterIB = 0
;endif
