; WWMI BETA-1 INI

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

[Constants]
global $required_wwmi_version = 0.77
global $object_guid = 120099
global $mesh_vertex_count = 40564
global $shapekey_vertex_count = 24918
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 = "slap_Mod"

[ResourceModAuthor]
type = Buffer
data = "slap"

[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 = ResourceShapeKeyedPosition
vb1 = ResourceVectorBuffer
vb2 = ResourceTexcoordBuffer
vb3 = ResourceColorBuffer
vb4 = ResourceBlendBuffer
vb6 = null
if vs-cb3 == 3381.7777
    vs-cb3 = ResourceExtraMergedSkeleton
endif
if vs-cb4 == 3381.7777
    vs-cb4 = ResourceMergedSkeleton
endif

[CommandListCleanupSharedResources]
vb0 = ref ResourceBypassVB0

[TextureOverrideComponent0]
hash = bb5dfeaf
match_first_index = 0
match_index_count = 9546
$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 = 13
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 0
        drawindexed = 9546, 0, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent1]
hash = bb5dfeaf
match_first_index = 9546
match_index_count = 17544
if $mod_enabled
    local $state_id_1
    if $state_id_1 != $state_id
        $state_id_1 = $state_id
        $\WWMIv1\vg_offset = 13
        $\WWMIv1\vg_count = 19
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 1
        drawindexed = 17544, 9546, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent2]
hash = bb5dfeaf
match_first_index = 27090
match_index_count = 11328
if $mod_enabled
    local $state_id_2
    if $state_id_2 != $state_id
        $state_id_2 = $state_id
        $\WWMIv1\vg_offset = 32
        $\WWMIv1\vg_count = 1
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 2
        drawindexed = 11328, 27090, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent3]
hash = bb5dfeaf
match_first_index = 38418
match_index_count = 14595
if $mod_enabled
    local $state_id_3
    if $state_id_3 != $state_id
        $state_id_3 = $state_id
        $\WWMIv1\vg_offset = 33
        $\WWMIv1\vg_count = 46
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 3.身体
        drawindexed = 127464, 38418, 0
        ; Draw Component 3.颈部
        drawindexed = 492, 165882, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent4]
hash = bb5dfeaf
match_first_index = 53013
match_index_count = 35373
if $mod_enabled
    local $state_id_4
    if $state_id_4 != $state_id
        $state_id_4 = $state_id
        $\WWMIv1\vg_offset = 79
        $\WWMIv1\vg_count = 61
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 4.丝袜
        drawindexed = 15174, 166374, 0
        ; Draw Component 4.颈部
        drawindexed = 1752, 181548, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent5]
hash = bb5dfeaf
match_first_index = 88386
match_index_count = 29547
if $mod_enabled
    local $state_id_5
    if $state_id_5 != $state_id
        $state_id_5 = $state_id
        $\WWMIv1\vg_offset = 140
        $\WWMIv1\vg_count = 42
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 5.帽子
        drawindexed = 14799, 183300, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent6]
hash = bb5dfeaf
match_first_index = 117933
match_index_count = 2088
if $mod_enabled
    local $state_id_6
    if $state_id_6 != $state_id
        $state_id_6 = $state_id
        $\WWMIv1\vg_offset = 182
        $\WWMIv1\vg_count = 1
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 6
        drawindexed = 2088, 198099, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent7]
hash = bb5dfeaf
match_first_index = 120021
match_index_count = 78
if $mod_enabled
    local $state_id_7
    if $state_id_7 != $state_id
        $state_id_7 = $state_id
        $\WWMIv1\vg_offset = 183
        $\WWMIv1\vg_count = 1
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 7
        drawindexed = 78, 200187, 0
        run = CommandListCleanupSharedResources
    endif
endif

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


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

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

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

[CommandListSetupShapeKeys]
$\WWMIv1\shapekey_checksum = 1338
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 = b43ab901
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

[CommandListApplyShapeKeys]
cs-t6 = ResourcePositionBuffer
cs-u6 = ResourcePositionRW
run = CustomShader\WWMIv1\ShapeKeyApplier
ResourceShapeKeyedPosition = copy ResourcePositionRW

[TextureOverrideShapeKeyMultiplierCallback]
hash = b43ab901
match_priority = 0
if $mod_enabled
    if cs == 3381.4444 && ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListMultiplyShapeKeys
        run = CommandListApplyShapeKeys
    endif
endif

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

[ResourceShapeKeyedPosition]

[ResourcePositionRW]
type = RWBuffer
format = R32_FLOAT
stride = 12
array = 299016

[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.1.2 and requires WWMI v0.7.7+ to function
; WWMI GameBanana: https://gamebanana.com/tools/17252
; WWMI Tools GameBanana: https://gamebanana.com/tools/17289
; WWMI GitHub: https://github.com/SpectrumQT/WWMI
; WWMI Tools GitHub: https://github.com/SpectrumQT/WWMI_Tools
; AGMG Modding Community Discord: https://discord.com/invite/agmg
; SHA256 CHECKSUM: 4e6e69a316e0b5a1d0eb24c8e3337e6b5399bcf0528d65e5a6a5f8ecb2d33d6f
