; WWMI BETA-2 INI

; Mod State -------------------------

[Constants]
global $required_wwmi_version = 0.91
global $object_guid = 343302
global $mesh_vertex_count = 400000
global $shapekey_vertex_count = 400000
global $mod_id = -1000
global $mod_enabled = 0
global $object_detected = 0
global persist $booba = 1
global persist $mask = 1
global persist $wings = 1
global $lod
[keyswap-booba]
condition = $lod == 1
key = alt 1
type = cycle
$booba = 0,1

[keyswap-mask]
condition = $lod == 1
key = alt 2
type = cycle
$mask = 0,1

[keyswap-wings]
condition = $lod == 1
key = alt 3
type = cycle
$wings = 0,1
[Present]
if $object_detected
    if $mod_enabled
        post $object_detected = 0
    else
        if $mod_id == -1000
            run = CommandListRegisterMod
        endif
    endif
endif
post $lod = 0

[TextureOverrideLoDsDetector]
hash = 62b64d68
$lod = 1

[TextureOverrideLoDsDetector1]
hash = ddc1947c
$lod = 1

[TextureOverrideLoDsDetector2]
hash = 8dea760b
$lod = 1

[CommandListRegisterMod]
$\WWMIv1\required_wwmi_version = $required_wwmi_version
$\WWMIv1\object_guid = $object_guid
Resource\WWMIv1\ModName = ref ResourceModName
Resource\WWMIv1\ModAuthor = ref ResourceModAuthor
Resource\WWMIv1\ModDesc = ref ResourceModDesc
Resource\WWMIv1\ModLink = ref ResourceModLink
Resource\WWMIv1\ModLogo = ref ResourceModLogo
run = CommandList\WWMIv1\RegisterMod
$mod_id = $\WWMIv1\mod_id
if $mod_id >= 0
    $mod_enabled = 1
endif

; Resources: Mod Info -------------------------

[ResourceModName]
type = Buffer
data = "FatAemeath"

[ResourceModAuthor]
type = Buffer
data = "Nahcyor"

[ResourceModDesc]
; type = Buffer
; data = "Empty Mod Description"

[ResourceModLink]
; type = Buffer
; data = "Empty Mod Link"

[ResourceModLogo]
; filename = Textures/Logo.dds

; Shading: Draw Call Stacks Processing -------------------------

[CommandListTriggerResourceOverrides]
CheckTextureOverride = ps-t0
CheckTextureOverride = ps-t1
CheckTextureOverride = ps-t2
CheckTextureOverride = ps-t3
CheckTextureOverride = ps-t4
CheckTextureOverride = ps-t5
CheckTextureOverride = ps-t6
CheckTextureOverride = ps-t7

[CommandListOverrideSharedResources]
ResourceBypassVB0 = ref vb0
ib = ResourceIndexBuffer
vb0 = ResourcePositionBuffer
vb1 = ResourceVectorBuffer
vb2 = ResourceTexcoordBuffer
vb3 = ResourceColorBuffer
vb4 = ResourceBlendBuffer

[CommandListCleanupSharedResources]
vb0 = ref ResourceBypassVB0

[TextureOverrideComponent0]
hash = ddc1947c
match_first_index = 0
match_index_count = 35064
$object_detected = 1
if $mod_enabled
    handling = skip
    run = CommandListOverrideSharedResources
	; Draw Component 0.Chamber
	drawindexed = 3864, 0, 0
	; Draw Component 0.Glasses
	if $mask == 1
	drawindexed = 2436, 16344, 0
	endif
	
	; Draw Component 0.HElHair
	if $mask == 0
	drawindexed = 3402, 18780, 0
	endif
	; Draw Component 0.Hair
	drawindexed = 20508, 22182, 0
	; Draw Component 0.Hair.Back
	drawindexed = 6360, 42690, 0
    run = CommandListCleanupSharedResources
	run = CommandListDrawComponent0F
	run = CommandListDrawComponent0I
endif
[CommandListDrawComponent0F]
hash = ddc1947c
match_first_index = 0
match_index_count = 35064
ps-t0 = null
ps-t1 = ResourceFace
ps-t2 = ResourceFace
ps-t3 = null
ps-t4 = null
ps-t5 = null
ps-t6 = null
ps-t7 = null
ps-t8 = null
    run = CommandListOverrideSharedResources
	; Draw Component 0.Face
	drawindexed = 12480, 3864, 0
    run = CommandListCleanupSharedResources

[CommandListDrawComponent0I]
hash = ddc1947c
match_first_index = 0
match_index_count = 35064
ps-t0 = null
ps-t1 = ResourceIris
ps-t2 = ResourceIris
ps-t3 = null
ps-t4 = null
ps-t5 = null
ps-t6 = null
ps-t7 = null
ps-t8 = null
    run = CommandListOverrideSharedResources
	; Draw Component 0.Iris
	drawindexed = 1476, 49050, 0
    run = CommandListCleanupSharedResources
	
[ResourceFace]
filename = Textures/Face.dds

[ResourceIris]
filename = Textures/Iris.dds
[TextureOverrideComponent1]
hash = ddc1947c
match_first_index = 35064
match_index_count = 33024
$object_detected = 1
if $mod_enabled
    handling = skip
    run = CommandListOverrideSharedResources
	; Draw Component 1.Helmet
	drawindexed = 32796, 50526, 0
    run = CommandListCleanupSharedResources
endif

[TextureOverrideComponent2]
hash = ddc1947c
match_first_index = 68088
match_index_count = 52890
$object_detected = 1
if $mod_enabled
    handling = skip
    run = CommandListOverrideSharedResources
	; Draw Component 2.BodyMain
	drawindexed = 196965, 83322, 0
	; Draw Component 2.ChestArmor
	if $booba == 1
	drawindexed = 6096, 280287, 0
	endif
	
	; Draw Component 2.CoreBody
	drawindexed = 390, 286383, 0
    run = CommandListCleanupSharedResources
	run = CommandListDrawComponent2
endif
[CommandListDrawComponent2]
hash = ddc1947c
match_first_index = 68088
match_index_count = 52890
$object_detected = 1
ps-t0 = ResourceBodyN
ps-t1 = ResourceBodyD
ps-t2 = null
ps-t3 = null
ps-t4 = null
ps-t5 = null
ps-t6 = null
ps-t7 = null
ps-t8 = null
    handling = skip
    run = CommandListOverrideSharedResources
	; Draw Component 2.MainBody
	if $booba == 1
	drawindexed = 97809, 286773, 0
	; Draw Component 2.MainBody.Expo
	else
	drawindexed = 97809, 384582, 0
	endif
	
	; Draw Component 2.ThighBody
	drawindexed = 78030, 482391, 0
	run = CommandListCleanupSharedResources
[ResourceBodyN]
filename = Textures/BodyN.dds

[ResourceBodyD]
filename = Textures/BodyD.dds

[TextureOverrideComponent3]
hash = ddc1947c
match_first_index = 120978
match_index_count = 3156
$object_detected = 1
if $mod_enabled
    handling = skip
    run = CommandListOverrideSharedResources
	; Draw Component 3.ChestCore
	drawindexed = 1560, 560421, 0
	; Draw Component 3.HeadCore
	drawindexed = 1596, 561981, 0
    run = CommandListCleanupSharedResources
endif

[TextureOverrideComponent4]
hash = ddc1947c
match_first_index = 124134
match_index_count = 97380
$object_detected = 1
if $mod_enabled
    handling = skip
    run = CommandListOverrideSharedResources
	; Draw Component 4.ArmsAA
	drawindexed = 74676, 563577, 0
	; Draw Component 4.ArmsAB
	drawindexed = 22704, 638253, 0
    run = CommandListCleanupSharedResources
endif

[TextureOverrideComponent5]
hash = ddc1947c
match_first_index = 221514
match_index_count = 51042
$object_detected = 1
if $mod_enabled
    handling = skip
    run = CommandListOverrideSharedResources
	; Draw Component 5.Legs
	drawindexed = 42576, 660957, 0
	; Draw Component 5.ThighArmor
	drawindexed = 4728, 703533, 0
    run = CommandListCleanupSharedResources
endif

[TextureOverrideComponent6]
hash = ddc1947c
match_first_index = 272556
match_index_count = 70746
$object_detected = 1
if $mod_enabled
    handling = skip
    run = CommandListOverrideSharedResources
	; Draw Component 6.Tails
	drawindexed = 882, 708261, 0
	; Draw Component 6.WingsArm
	drawindexed = 16458, 709143, 0
	; Draw Component 6.WingsBottom
	if $wings == 1
	drawindexed = 53406, 722199, 0
    endif
	run = CommandListCleanupSharedResources
endif

[TextureOverrideWingsL]
hash = fe7f35ff
if $wings == 0
handling = skip
endif
; Shading: Textures -------------------------


; Skinning: Shape Keys Override -------------------------

[TextureOverrideShapeKeyOffsets]
hash = 
match_priority = 0
override_byte_stride = 24
override_vertex_count = $mesh_vertex_count

[TextureOverrideShapeKeyScale]
hash = 
match_priority = 0
override_byte_stride = 4
override_vertex_count = $mesh_vertex_count

[CommandListSetupShapeKeys]
$\WWMIv1\shapekey_checksum = 0
cs-t33 = ResourceShapeKeyOffsetBuffer
cs-u5 = ResourceCustomShapeKeyValuesRW
cs-u6 = ResourceShapeKeyCBRW
run = CustomShader\WWMIv1\ShapeKeyOverrider

[CommandListLoadShapeKeys]
$\WWMIv1\shapekey_vertex_count = $shapekey_vertex_count
cs-t0 = ResourceShapeKeyVertexIdBuffer
cs-t1 = ResourceShapeKeyVertexOffsetBuffer
cs-u6 = ResourceShapeKeyCBRW
run = CustomShader\WWMIv1\ShapeKeyLoader

[TextureOverrideShapeKeyLoaderCallback]
hash = 
match_priority = 0
if $mod_enabled
    if cs == 3381.3333
        handling = skip
        run = CommandListSetupShapeKeys
        run = CommandListLoadShapeKeys
    endif
endif

[CommandListMultiplyShapeKeys]
$\WWMIv1\custom_vertex_count = $mesh_vertex_count
run = CustomShader\WWMIv1\ShapeKeyMultiplier

[TextureOverrideShapeKeyMultiplierCallback]
hash = 
match_priority = 0
if $mod_enabled
    if cs == 3381.4444
        handling = skip
        run = CommandListMultiplyShapeKeys
    endif
endif

; Resources: Shape Keys Override -------------------------

[ResourceShapeKeyCBRW]
type = RWBuffer
format = R32G32B32A32_UINT
array = 66

[ResourceCustomShapeKeyValuesRW]
type = RWBuffer
format = R32G32B32A32_FLOAT
array = 32

; Resources: Buffers -------------------------

[ResourceBypassVB0]

[ResourceIndexBuffer]
type = Buffer
format = DXGI_FORMAT_R32_UINT
stride = 12
filename = Meshes/Index.buf

[ResourcePositionBuffer]
type = Buffer
format = DXGI_FORMAT_R32G32B32_FLOAT
stride = 12
filename = Meshes/Position.buf

[ResourceBlendBuffer]
type = Buffer
format = DXGI_FORMAT_R8_UINT
stride = 16
filename = Meshes/Blend.buf

[ResourceVectorBuffer]
type = Buffer
format = DXGI_FORMAT_R8G8B8A8_SNORM
stride = 8
filename = Meshes/Vector.buf

[ResourceColorBuffer]
type = Buffer
format = DXGI_FORMAT_R8G8B8A8_UNORM
stride = 4
filename = Meshes/Color.buf

[ResourceTexCoordBuffer]
type = Buffer
format = DXGI_FORMAT_R16G16_FLOAT
stride = 16
filename = Meshes/TexCoord.buf

[ResourceShapeKeyOffsetBuffer]
type = Buffer
format = DXGI_FORMAT_R32G32B32A32_UINT
stride = 16
filename = Meshes/ShapeKeyOffset.buf

[ResourceShapeKeyVertexIdBuffer]
type = Buffer
format = DXGI_FORMAT_R32_UINT
stride = 4
filename = Meshes/ShapeKeyVertexId.buf

[ResourceShapeKeyVertexOffsetBuffer]
type = Buffer
format = DXGI_FORMAT_R16_FLOAT
stride = 2
filename = Meshes/ShapeKeyVertexOffset.buf

; Autogenerated -------------------------

; XXMI Launcher GameBanana: https://gamebanana.com/tools/17252
; XXMI Launcher GitHub: https://github.com/SpectrumQT/XXMI-Launcher
; WWMI Package GitHub: https://github.com/SpectrumQT/WWMI-Package
; WWMI Tools GameBanana: https://gamebanana.com/tools/17289
; WWMI Tools GitHub: https://github.com/SpectrumQT/WWMI_Tools
; AGMG Modding Community Discord: https://discord.com/invite/agmg
; SHA256 CHECKSUM: d1050effb4cfc3ebdd54955c831fc0f53a14fa9a81bf33bba5053b871d738dc6
