; Nahida

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

[Constants]
global $active = 0
global $creditinfo = 0
global persist $wingtail = 0
global persist $headtex = 0
global persist $bodytex = 0
global persist $effects = 1

[KeyWingTail]
condition = $active == 1
key = ctrl no_shift no_alt VK_RIGHT
Back = ctrl no_shift no_alt VK_LEFT
type = cycle
$wingtail = 0,1

[KeyHeadTex]
condition = $active == 1
key = no_shift no_ctrl alt t
type = cycle
$headtex = 0,1

[KeyBodyTex]
condition = $active == 1
key = no_shift ctrl no_alt t
type = cycle
$bodytex = 0,1

[KeyEffects]
condition = $active == 1
key = no_ctrl no_shift no_alt t
type = cycle
$effects = 0,1

[Present]
post $active = 0
run = CommandListCreditInfo
if $effects == 1
    x160 = $Active
else
    x160 = 0
endif

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

[TextureOverrideNahidaPosition]
hash = 37ef15ec
vb0 = ResourceNahidaPosition
$active = 1

[TextureOverrideNahidaBlend]
hash = bb58c686
vb1 = ResourceNahidaBlend
handling = skip
draw = 27689,0 

[TextureOverrideNahidaTexcoord]
hash = f7b7ce48
vb1 = ResourceNahidaTexcoord

[TextureOverrideNahidaVertexLimitRaise]
hash = 67d2cdf0

[TextureOverrideNahidaIB]
hash = 8b268d05
handling = skip
drawindexed = auto

[TextureOverrideNahidaHead]
hash = 8b268d05
match_first_index = 0
ib = ResourceNahidaHeadIB
ps-t0 = ResourceNahidaHeadNormalMap
if $headtex == 0
    ps-t1 = ResourceNahidaHeadDiffuse
endif
ps-t2 = ResourceNahidaHeadLightMap
$CharacterIB = 1
ResourceRefHeadDiffuse = reference ps-t1
ResourceRefHeadLightMap = reference ps-t2

[TextureOverrideNahidaBody]
hash = 8b268d05
match_first_index = 31143
ib = ResourceNahidaBodyIB
ps-t0 = ResourceNahidaBodyNormalMap
if $bodytex == 0
    ps-t1 = ResourceNahidaBodyDiffuse
else if $bodytex == 1
    ps-t1 = ResourceNahidaBodyDiffuse2
endif
ps-t2 = ResourceNahidaBodyLightMap
$CharacterIB = 2
ResourceRefBodyDiffuse = reference ps-t1
ResourceRefBodyLightMap = reference ps-t2

[TextureOverrideNahidaDress]
hash = 8b268d05
match_first_index = 71187
ib = ResourceNahidaDressIB
ps-t0 = ResourceNahidaDressNormalMap
ps-t1 = ResourceNahidaDressDiffuse
ps-t2 = ResourceNahidaDressLightMap
$CharacterIB = 3
ResourceRefDressDiffuse = reference ps-t1
ResourceRefDressLightMap = reference ps-t2

[TextureOverrideNahidaExtra]
hash = 8b268d05
match_first_index = 76875
run = CommandListNahidaDress



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

[CommandListNahidaDress]
if $wingtail == 0
	ib = null
else
	ib = ResourceNahidaExtraIB
	ps-t0 = ResourceNahidaExtraNormalMap
	ps-t1 = ResourceNahidaExtraDiffuse
	ps-t2 = ResourceNahidaExtraLightMap
endif
$CharacterIB = 4
ResourceRefExtraDiffuse = reference ps-t1
ResourceRefExtraLightMap = reference ps-t2

[CommandListCreditInfo]
if $creditinfo == 0 && $active == 1
	pre Resource\ShaderFixes\help.ini\Notification = ResourceCreditInfo
	pre run = CustomShader\ShaderFixes\help.ini\FormatText
	pre $\ShaderFixes\help.ini\notification_timeout = time + 5.0
	$creditinfo = 1
endif

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

[ResourceNahidaPosition]
type = Buffer
stride = 40
filename = NahidaPosition.buf

[ResourceNahidaBlend]
type = Buffer
stride = 32
filename = NahidaBlend.buf

[ResourceNahidaTexcoord]
type = Buffer
stride = 20
filename = NahidaTexcoord.buf

[ResourceNahidaHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = NahidaHead.ib

[ResourceNahidaBodyIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = NahidaBody.ib

[ResourceNahidaDressIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = NahidaDress.ib

[ResourceNahidaExtraIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = NahidaExtra.ib

[ResourceNahidaHeadNormalMap]
filename = NahidaHeadNormalMap.dds

[ResourceNahidaHeadDiffuse]
filename = NahidaHeadDiffuse.dds

[ResourceNahidaHeadLightMap]
filename = NahidaHeadLightMap.dds

[ResourceNahidaBodyNormalMap]
filename = NahidaBodyNormalMap.dds

[ResourceNahidaBodyDiffuse]
filename = NahidaBodyDiffuse.dds

[ResourceNahidaBodyDiffuse2]
filename = NahidaBodyDiffuseMark1.dds

[ResourceNahidaBodyLightMap]
filename = NahidaBodyLightMap.dds

[ResourceNahidaDressNormalMap]
filename = NahidaBodyNormalMap.dds

[ResourceNahidaDressDiffuse]
filename = NahidaBodyDiffuse.dds

[ResourceNahidaDressLightMap]
filename = NahidaDressLightMap.dds

[ResourceNahidaExtraNormalMap]
filename = NahidaBodyNormalMap.dds

[ResourceNahidaExtraDiffuse]
filename = NahidaBodyDiffuse.dds

[ResourceNahidaExtraLightMap]
filename = NahidaExtraLightMap.dds

[ResourceNahidaFaceHeadDiffuse]
filename = NahidaFaceHeadDiffuse.dds

[ResourceCreditInfo]
type = Buffer
data = "Created by Snaccubus"


; .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]

; 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 = ee37e2d7