; WWMI BETA-2 INI

; Mod State -------------------------
CustomShaderTransparencyCloth]
blend = ADD BLEND_FACTOR INV_BLEND_FACTOR
blend_factor[0] = 0.5
blend_factor[1] = 0.5
blend_factor[2] = 0.5
blend_factor[3] = 1
handling = skip
drawindexed = 4320, 115032, 0


[Constants]
global $required_wwmi_version = 0.96
global $object_guid = 241500
global $mesh_vertex_count = 118446
global $shapekey_vertex_count = 56903
global $mod_id = -1000
global $state_id = 0
global $mod_enabled = 0
global $object_detected = 0

[Present]
if $object_detected
    if $mod_enabled
        post $object_detected = 0
        run = CommandListUpdateMergedSkeleton
    else
        if $mod_id == -1000
            run = CommandListRegisterMod
        endif
    endif
endif

[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

[CommandListUpdateMergedSkeleton]
if $state_id
    $state_id = 0
else
    $state_id = 1
endif
ResourceMergedSkeleton = copy ResourceMergedSkeletonRW
ResourceExtraMergedSkeleton = copy ResourceExtraMergedSkeletonRW

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

[ResourceModName]
type = Buffer
data = "Unnamed Mod"

[ResourceModAuthor]
type = Buffer
data = "Unknown Author"

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

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

[ResourceModLogo]
; filename = Textures/Logo.dds

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

[TextureOverrideMarkBoneDataCB]
hash = f02baf77
match_priority = 0
filter_index = 3381.7777

[CommandListMergeSkeleton]
$\WWMIv1\custom_mesh_scale = 1.00
cs-cb8 = ref vs-cb4
cs-u6 = ResourceMergedSkeletonRW
run = CustomShader\WWMIv1\SkeletonMerger
cs-cb8 = ref vs-cb3
cs-u6 = ResourceExtraMergedSkeletonRW
run = CustomShader\WWMIv1\SkeletonMerger

[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
CheckTextureOverride = vs-cb3
CheckTextureOverride = vs-cb4

[CommandListOverrideSharedResources]
ResourceBypassVB0 = ref vb0
ib = ResourceIndexBuffer
vb0 = ResourcePositionBuffer
vb1 = ResourceVectorBuffer
vb2 = ResourceTexcoordBuffer
vb3 = ResourceColorBuffer
vb4 = ResourceBlendBuffer
if vs-cb3 == 3381.7777
    vs-cb3 = ResourceExtraMergedSkeleton
endif
if vs-cb4 == 3381.7777
    vs-cb4 = ResourceMergedSkeleton
endif

[CommandListCleanupSharedResources]
vb0 = ref ResourceBypassVB0

[TextureOverrideComponent0]
hash = 8a382bf1
match_first_index = 0
match_index_count = 7518
$object_detected = 1
if $mod_enabled
    local $state_id_0
    if $state_id_0 != $state_id
        $state_id_0 = $state_id
        $\WWMIv1\vg_offset = 0
        $\WWMIv1\vg_count = 11
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 0.002
        drawindexed = 7518, 0, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent1]
hash = 8a382bf1
match_first_index = 7518
match_index_count = 53454
$object_detected = 1
if $mod_enabled
    local $state_id_1
    if $state_id_1 != $state_id
        $state_id_1 = $state_id
        $\WWMIv1\vg_offset = 11
        $\WWMIv1\vg_count = 16
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 1.002
        drawindexed = 53454, 7518, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent2]
hash = 8a382bf1
match_first_index = 60972
match_index_count = 12090
$object_detected = 1
if $mod_enabled
    local $state_id_2
    if $state_id_2 != $state_id
        $state_id_2 = $state_id
        $\WWMIv1\vg_offset = 27
        $\WWMIv1\vg_count = 1
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 2.002
        drawindexed = 12090, 60972, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent3]
hash = 8a382bf1
match_first_index = 73062
match_index_count = 55536
$object_detected = 1
if $mod_enabled
    local $state_id_3
    if $state_id_3 != $state_id
        $state_id_3 = $state_id
        $\WWMIv1\vg_offset = 28
        $\WWMIv1\vg_count = 94
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 3.001
        drawindexed = 6720, 73062, 0
        ; Draw Component 3.002
        drawindexed = 6741, 79782, 0
        ; Draw Component 3.003
        drawindexed = 3864, 86523, 0
        ; Draw Component 3.004
        drawindexed = 5787, 90387, 0
        ; Draw Component 3.005
        drawindexed = 12078, 96174, 0
        ; Draw Component 3.006
        drawindexed = 20703, 108252, 0
        ; Draw Component 3.008
        drawindexed = 3870, 128955, 0
        ; Draw Component 3.009
        drawindexed = 4983, 132825, 0
        ; Draw Component 3.010
        drawindexed = 5790, 137808, 0
        ; Draw Component 3.011
        drawindexed = 23187, 143598, 0
        ; Draw Component 3.012
        drawindexed = 4980, 166785, 0
        ; Draw Component 3.013
        drawindexed = 12369, 171765, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent4]
hash = 8a382bf1
match_first_index = 128598
match_index_count = 93894
$object_detected = 1
if $mod_enabled
    local $state_id_4
    if $state_id_4 != $state_id
        $state_id_4 = $state_id
        $\WWMIv1\vg_offset = 122
        $\WWMIv1\vg_count = 138
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 4.10_6216_353199
        drawindexed = 6216, 184134, 0
        ; Draw Component 4.12_9066_359925
        drawindexed = 9066, 190350, 0
        ; Draw Component 4.13_38634_368991
        drawindexed = 38634, 199416, 0
        ; Draw Component 4.14_825_407625
        drawindexed = 825, 238050, 0
        ; Draw Component 4.15_27261_408450.002
        drawindexed = 546, 238875, 0
        ; Draw Component 4.19_5064_503997
        drawindexed = 5064, 239421, 0
        ; Draw Component 4.2_37392_179178
        drawindexed = 37392, 244485, 0
        ; Draw Component 4.5_16464_227373
        drawindexed = 16464, 281877, 0
        ; Draw Component 4.6_10446_243837
        drawindexed = 61953, 298341, 0
        ; Draw Component 4.6_10446_243837.001
        drawindexed = 60333, 360294, 0
        ; Draw Component 4.7_38634_254283
        drawindexed = 38634, 420627, 0
        ; Draw Component 4.8_42090_292917
        drawindexed = 42090, 459261, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent5]
hash = 8a382bf1
match_first_index = 222492
match_index_count = 1548
$object_detected = 1
if $mod_enabled
    local $state_id_5
    if $state_id_5 != $state_id
        $state_id_5 = $state_id
        $\WWMIv1\vg_offset = 260
        $\WWMIv1\vg_count = 1
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 5.002
        drawindexed = 1548, 501351, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent6]
hash = 8a382bf1
match_first_index = 224040
match_index_count = 228
$object_detected = 1
if $mod_enabled
    local $state_id_6
    if $state_id_6 != $state_id
        $state_id_6 = $state_id
        $\WWMIv1\vg_offset = 261
        $\WWMIv1\vg_count = 5
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        ; run = CommandListTriggerResourceOverrides
        ; run = CommandListOverrideSharedResources
        ; Draw skipped: No matching custom components found
        ; run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent7]
hash = 8a382bf1
match_first_index = 224268
match_index_count = 17232
$object_detected = 1
if $mod_enabled
    local $state_id_7
    if $state_id_7 != $state_id
        $state_id_7 = $state_id
        $\WWMIv1\vg_offset = 266
        $\WWMIv1\vg_count = 58
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        ; run = CommandListTriggerResourceOverrides
        ; run = CommandListOverrideSharedResources
        ; Draw skipped: No matching custom components found
        ; run = CommandListCleanupSharedResources
    endif
endif

; Shading: Textures -------------------------

[ResourceTexture0]
filename = Textures/Components-0 t=420bc474.dds

[TextureOverrideTexture0]
hash = 420bc474
match_priority = 0
if $object_detected
    this = ResourceTexture0
endif

[ResourceTexture1]
filename = Textures/Components-0 t=83b787db.dds

[TextureOverrideTexture1]
hash = 83b787db
match_priority = 0
if $object_detected
    this = ResourceTexture1
endif

[ResourceTexture2]
filename = Textures/Components-0-1-2-3-4 t=44a33623.dds

[TextureOverrideTexture2]
hash = 44a33623
match_priority = 0
if $object_detected
    this = ResourceTexture2
endif

[ResourceTexture3]
filename = Textures/Components-1 t=2eb74e79.dds

[TextureOverrideTexture3]
hash = 2eb74e79
match_priority = 0
if $object_detected
    this = ResourceTexture3
endif

[ResourceTexture4]
filename = Textures/Components-2 t=301efc44.dds

[TextureOverrideTexture4]
hash = 301efc44
match_priority = 0
if $object_detected
    this = ResourceTexture4
endif

[ResourceTexture5]
filename = Textures/Components-2 t=697a05d5.dds

[TextureOverrideTexture5]
hash = 697a05d5
match_priority = 0
if $object_detected
    this = ResourceTexture5
endif

[ResourceTexture6]
filename = Textures/Components-3 t=3973960b.dds

[TextureOverrideTexture6]
hash = 3973960b
match_priority = 0
if $object_detected
    this = ResourceTexture6
endif

[ResourceTexture7]
filename = Textures/Components-3 t=67787504.dds

[TextureOverrideTexture7]
hash = 67787504
match_priority = 0
if $object_detected
    this = ResourceTexture7
endif

[ResourceTexture8]
filename = Textures/Components-3-4-7 t=f47bc395.dds

[TextureOverrideTexture8]
hash = f47bc395
match_priority = 0
if $object_detected
    this = ResourceTexture8
endif

[ResourceTexture9]
filename = Textures/Components-4 t=11c042bc.dds

[TextureOverrideTexture9]
hash = 11c042bc
match_priority = 0
if $object_detected
    this = ResourceTexture9
endif

[ResourceTexture10]
filename = Textures/Components-4 t=3db825ca.dds

[TextureOverrideTexture10]
hash = 3db825ca
match_priority = 0
if $object_detected
    this = ResourceTexture10
endif

[ResourceTexture11]
filename = Textures/Components-4 t=94e015b4.dds

[TextureOverrideTexture11]
hash = 94e015b4
match_priority = 0
if $object_detected
    this = ResourceTexture11
endif

[ResourceTexture12]
filename = Textures/Components-5 t=8383cbbf.dds

[TextureOverrideTexture12]
hash = 8383cbbf
match_priority = 0
if $object_detected
    this = ResourceTexture12
endif

[ResourceTexture13]
filename = Textures/Components-5 t=ec8277c1.dds

[TextureOverrideTexture13]
hash = ec8277c1
match_priority = 0
if $object_detected
    this = ResourceTexture13
endif

[ResourceTexture14]
filename = Textures/Components-6 t=913631e7.dds

[TextureOverrideTexture14]
hash = 913631e7
match_priority = 0
if $object_detected
    this = ResourceTexture14
endif

[ResourceTexture15]
filename = Textures/Components-7 t=0cf861f8.dds

[TextureOverrideTexture15]
hash = 0cf861f8
match_priority = 0
if $object_detected
    this = ResourceTexture15
endif

[ResourceTexture16]
filename = Textures/Components-7 t=35fc907b.dds

[TextureOverrideTexture16]
hash = 35fc907b
match_priority = 0
if $object_detected
    this = ResourceTexture16
endif

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

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

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

[CommandListSetupShapeKeys]
$\WWMIv1\shapekey_checksum = 2010
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 = 5c9d8190
match_priority = 0
if $mod_enabled
    if cs == 3381.3333 && ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListSetupShapeKeys
        run = CommandListLoadShapeKeys
    endif
endif

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

[TextureOverrideShapeKeyMultiplierCallback]
hash = 5c9d8190
match_priority = 0
if $mod_enabled
    if cs == 3381.4444 && ResourceMergedSkeleton !== null
        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: Skeleton Override -------------------------

[ResourceMergedSkeleton]

[ResourceMergedSkeletonRW]
type = RWBuffer
format = R32G32B32A32_FLOAT
array = 768

[ResourceExtraMergedSkeleton]

[ResourceExtraMergedSkeletonRW]
type = RWBuffer
format = R32G32B32A32_FLOAT
array = 768

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

; This mod.ini was automatically generated by WWMI Tools Blender addon v1.4.1 and requires WWMI v0.9.6+ to function

; 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: d60f8dfc30bfa410e9154d52e1dae23edfa1cfb3dd5729a656650067408dad85
