; Dehya

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

[TextureOverrideDehyaPosition]
hash = 9aeecbcb
vb0 = ResourceDehyaPosition

[TextureOverrideDehyaBlend]
hash = 31ea99dd
vb1 = ResourceDehyaBlend
handling = skip
draw = 48143,0 

[TextureOverrideDehyaTexcoord]
hash = 3feafd9a
vb1 = ResourceDehyaTexcoord

[TextureOverrideDehyaVertexLimitRaise]
hash = 1f2a9e86

[TextureOverrideDehyaIB]
hash = 5b378f51
handling = skip
drawindexed = auto

[TextureOverrideDehyaHead]
hash = 5b378f51
match_first_index = 0
ib = ResourceDehyaHeadIB
ps-t0 = ResourceDehyaHeadDiffuse
ps-t1 = ResourceDehyaHeadLightMap
ps-t2 = ResourceDehyaHeadShadow
ps-t3 = ResourceDehyaHeadMetalMap

$CharacterIB = 1
ResourceRefHeadDiffuse = reference ps-t1
ResourceRefHeadLightMap = reference ps-t2

[TextureOverrideDehyaBody]
hash = 5b378f51
match_first_index = 25566
ib = ResourceDehyaBodyIB
ps-t0 = ResourceDehyaBodyDiffuse
ps-t1 = ResourceDehyaBodyLightMap
ps-t2 = ResourceDehyaBodyShadow
ps-t3 = ResourceDehyaBodyMetalMap

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

$CharacterIB = 2
ResourceRefBodyDiffuse = reference ps-t1
ResourceRefBodyLightMap = reference ps-t2

[ResourceDehyaPosition]
type = Buffer
stride = 40
filename = DehyaPosition.buf

[ResourceDehyaBlend]
type = Buffer
stride = 32
filename = DehyaBlend.buf

[ResourceDehyaTexcoord]
type = Buffer
stride = 12
filename = DehyaTexcoord.buf

[ResourceDehyaHeadIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = DehyaHead.ib

[ResourceDehyaBodyIB]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = DehyaBody.ib

[ResourceDehyaHeadDiffuse]
filename = DehyaHeadDiffuse.dds

[ResourceDehyaHeadLightMap]
filename = DehyaHeadLightMap.dds

[ResourceDehyaHeadShadow]
filename = DehyaHeadShadow.dds

[ResourceDehyaHeadMetalMap]
filename = DehyaHeadMetalMap.dds

[ResourceDehyaBodyDiffuse]
filename = DehyaBodyDiffuse.dds

[ResourceDehyaBodyLightMap]
filename = DehyaBodyLightMap.dds

[ResourceDehyaBodyShadow]
filename = DehyaBodyShadow.dds

[ResourceDehyaBodyMetalMap]
filename = DehyaBodyMetalMap.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+\)

; 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


; 4.1 Character Fix 
[TextureOverride41FixVertexLimitRaise0]
hash = 96cfb1a1
match_priority = 1