; WWMI BETA-2 INI

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

[Constants]
global $required_wwmi_version = 1.00
global $object_guid = 276291
global $mesh_vertex_count = 53711
global $shapekey_vertex_count = 106748
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 = CommandListInitializeBlendRemaps
        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
run = CommandListRemapMergedSkeleton

[ResourceMergedSkeletonRemap]
[ResourceExtraMergedSkeletonRemap]

[ResourceBlendBufferOverride]
[ResourceExtraMergedSkeletonOverride]
[ResourceMergedSkeletonOverride]

[ResourceRemappedBlendBufferRW]
[ResourceRemappedSkeletonRW]
[ResourceExtraRemappedSkeletonRW]

[ResourceRemappedBlendBufferComponent4]
[ResourceRemappedSkeletonComponent4]
[ResourceExtraRemappedSkeletonComponent4]

[ResourceRemappedBlendBufferComponent5]
[ResourceRemappedSkeletonComponent5]
[ResourceExtraRemappedSkeletonComponent5]

[CommandListInitializeBlendRemaps]
local $blend_remaps_initialized
if !$blend_remaps_initialized
    ResourceRemappedSkeletonRW = copy ResourceMergedSkeletonRW
    ResourceExtraRemappedSkeletonRW = copy ResourceExtraMergedSkeletonRW

    $\WWMIv1\custom_vertex_count = $mesh_vertex_count
    $\WWMIv1\weights_per_vertex_count = 8
    cs-t34 = ref ResourceBlendRemapReverseBuffer
    cs-t35 = ref ResourceBlendRemapVertexVGBuffer

    $\WWMIv1\blend_remap_id = 0
    ResourceRemappedBlendBufferRW = copy ResourceBlendBufferNoStride
    cs-u4 = ref ResourceRemappedBlendBufferRW
    run = CustomShader\WWMIv1\BlendRemapper
    ResourceRemappedBlendBufferComponent4 = copy ResourceRemappedBlendBufferRW
    ResourceRemappedBlendBufferComponent4 = copy_desc ResourceBlendBuffer

    $\WWMIv1\blend_remap_id = 1
    ResourceRemappedBlendBufferRW = copy ResourceBlendBufferNoStride
    cs-u4 = ref ResourceRemappedBlendBufferRW
    run = CustomShader\WWMIv1\BlendRemapper
    ResourceRemappedBlendBufferComponent5 = copy ResourceRemappedBlendBufferRW
    ResourceRemappedBlendBufferComponent5 = copy_desc ResourceBlendBuffer

    $blend_remaps_initialized = 1
endif

[CommandListRemapMergedSkeleton]
ResourceMergedSkeletonRemap = copy ResourceMergedSkeletonRW
ResourceExtraMergedSkeletonRemap = copy ResourceExtraMergedSkeletonRW

cs-t37 = ResourceBlendRemapForwardBuffer

$\WWMIv1\blend_remap_id = 0
$\WWMIv1\vg_count = 46
cs-t38 = ResourceMergedSkeletonRemap
cs-u5 = ResourceRemappedSkeletonRW
run = CustomShader\WWMIv1\SkeletonRemapper
ResourceRemappedSkeletonComponent4 = copy ResourceRemappedSkeletonRW
cs-t38 = ResourceExtraMergedSkeletonRemap
cs-u5 = ResourceExtraRemappedSkeletonRW
run = CustomShader\WWMIv1\SkeletonRemapper
ResourceExtraRemappedSkeletonComponent4 = copy ResourceExtraRemappedSkeletonRW

$\WWMIv1\blend_remap_id = 1
$\WWMIv1\vg_count = 46
cs-t38 = ResourceMergedSkeletonRemap
cs-u5 = ResourceRemappedSkeletonRW
run = CustomShader\WWMIv1\SkeletonRemapper
ResourceRemappedSkeletonComponent5 = copy ResourceRemappedSkeletonRW
cs-t38 = ResourceExtraMergedSkeletonRemap
cs-u5 = ResourceExtraRemappedSkeletonRW
run = CustomShader\WWMIv1\SkeletonRemapper
ResourceExtraRemappedSkeletonComponent5 = copy ResourceExtraRemappedSkeletonRW

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

[ResourceModName]
type = Buffer
data = "Ultrasized_Suisui"

[ResourceModAuthor]
type = Buffer
data = "WaterWeightMate"

[ResourceModDesc]
type = Buffer
data = "A gargantuan, Ultrasized Suisui!"

[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
if ResourceBlendBufferOverride === null
    vb4 = ResourceBlendBuffer
    if vs-cb3 == 3381.7777
        vs-cb3 = ref ResourceExtraMergedSkeleton
    endif
    if vs-cb4 == 3381.7777
        vs-cb4 = ref ResourceMergedSkeleton
    endif
else
    vb4 = ref ResourceBlendBufferOverride
    if vs-cb3 == 3381.7777
        vs-cb3 = ref ResourceExtraMergedSkeletonOverride
    endif
    if vs-cb4 == 3381.7777
        vs-cb4 = ref ResourceMergedSkeletonOverride
    endif
endif

[CommandListCleanupSharedResources]
vb0 = ref ResourceBypassVB0
if ResourceBlendBufferOverride !== null
    ResourceBlendBufferOverride = null
    ResourceMergedSkeletonOverride = null
    ResourceExtraMergedSkeletonOverride = null
endif

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

[TextureOverrideComponent1]
hash = 46159a16
match_first_index = 28833
match_index_count = 46194
$object_detected = 1
if $mod_enabled
    local $state_id_1
    if $state_id_1 != $state_id
        $state_id_1 = $state_id
        $\WWMIv1\vg_offset = 34
        $\WWMIv1\vg_count = 39
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 1
        drawindexed = 46194, 28833, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent2]
hash = 46159a16
match_first_index = 75027
match_index_count = 14256
$object_detected = 1
if $mod_enabled
    local $state_id_2
    if $state_id_2 != $state_id
        $state_id_2 = $state_id
        $\WWMIv1\vg_offset = 73
        $\WWMIv1\vg_count = 21
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 2
        drawindexed = 14256, 75027, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent3]
hash = 46159a16
match_first_index = 89283
match_index_count = 105696
$object_detected = 1
if $mod_enabled
    local $state_id_3
    if $state_id_3 != $state_id
        $state_id_3 = $state_id
        $\WWMIv1\vg_offset = 94
        $\WWMIv1\vg_count = 112
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 3
        drawindexed = 49998, 89283, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent4]
hash = 46159a16
match_first_index = 194979
match_index_count = 52128
$object_detected = 1
if $mod_enabled
    local $state_id_4
    if $state_id_4 != $state_id
        $state_id_4 = $state_id
        $\WWMIv1\vg_offset = 206
        $\WWMIv1\vg_count = 68
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        ResourceBlendBufferOverride = ref ResourceRemappedBlendBufferComponent4
        ResourceMergedSkeletonOverride = ref ResourceRemappedSkeletonComponent4
        ResourceExtraMergedSkeletonOverride = ref ResourceExtraRemappedSkeletonComponent4
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 4
        drawindexed = 40578, 139281, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent5]
hash = 46159a16
match_first_index = 247107
match_index_count = 27642
$object_detected = 1
if $mod_enabled
    local $state_id_5
    if $state_id_5 != $state_id
        $state_id_5 = $state_id
        $\WWMIv1\vg_offset = 274
        $\WWMIv1\vg_count = 48
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        ResourceBlendBufferOverride = ref ResourceRemappedBlendBufferComponent5
        ResourceMergedSkeletonOverride = ref ResourceRemappedSkeletonComponent5
        ResourceExtraMergedSkeletonOverride = ref ResourceExtraRemappedSkeletonComponent5
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 5
        drawindexed = 77235, 179859, 0
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent6]
hash = 46159a16
match_first_index = 274749
match_index_count = 1542
$object_detected = 1
if $mod_enabled
    local $state_id_6
    if $state_id_6 != $state_id
        $state_id_6 = $state_id
        $\WWMIv1\vg_offset = 322
        $\WWMIv1\vg_count = 1
        run = CommandListMergeSkeleton
    endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 6
        drawindexed = 1542, 257094, 0
        run = CommandListCleanupSharedResources
    endif
endif

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

[ResourceTexture0]
filename = Textures/Components-0 t=2af7486b.dds

[TextureOverrideTexture0]
hash = 2af7486b
match_priority = 0
if $object_detected
    this = ResourceTexture0
endif

[ResourceTexture1]
filename = Textures/Components-0-1-2-3-4-5 t=164df2d5.dds

[TextureOverrideTexture1]
hash = 164df2d5
match_priority = 0
if $object_detected
    this = ResourceTexture1
endif

[ResourceTexture2]
filename = Textures/Components-0-1-2-3-4-5 t=239cabd0.dds

[TextureOverrideTexture2]
hash = 239cabd0
match_priority = 0
if $object_detected
    this = ResourceTexture2
endif

[ResourceTexture3]
filename = Textures/Components-0-1-2-3-4-5 t=59276c52.dds

[TextureOverrideTexture3]
hash = 59276c52
match_priority = 0
if $object_detected
    this = ResourceTexture3
endif

[ResourceTexture4]
filename = Textures/Components-0-1-2-3-4-5 t=70503aed.dds

[TextureOverrideTexture4]
hash = 70503aed
match_priority = 0
if $object_detected
    this = ResourceTexture4
endif

[ResourceTexture5]
filename = Textures/Components-0-1-2-3-4-5 t=8a276ed0.dds

[TextureOverrideTexture5]
hash = 8a276ed0
match_priority = 0
if $object_detected
    this = ResourceTexture5
endif

[ResourceTexture6]
filename = Textures/Components-0-1-2-3-4-5 t=9934ca23.dds

[TextureOverrideTexture6]
hash = 9934ca23
match_priority = 0
if $object_detected
    this = ResourceTexture6
endif

[ResourceTexture7]
filename = Textures/Components-0-1-2-3-4-5-6 t=27c24157.dds

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

[ResourceTexture8]
filename = Textures/Components-0-2-4-6 t=be8cfec5.dds

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

[ResourceTexture9]
filename = Textures/Components-0-2-4-6 t=ce89633a.dds

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

[ResourceTexture10]
filename = Textures/Components-0-2-6 t=a506a70d.dds

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

[ResourceTexture11]
filename = Textures/Components-1 t=beffc90b.dds

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

[ResourceTexture12]
filename = Textures/Components-1 t=d6875a80.dds

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

[ResourceTexture13]
filename = Textures/Components-1 t=ebddc549.dds

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

[ResourceTexture14]
filename = Textures/Components-2 t=491e2b90.dds

[TextureOverrideTexture14]
hash = 491e2b90
match_priority = 0
if $object_detected
    this = ResourceTexture14
endif

[ResourceTexture15]
filename = Textures/Components-2 t=742c5c7b.dds

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

[ResourceTexture16]
filename = Textures/Components-2 t=a274d627.dds

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

[ResourceTexture17]
filename = Textures/Components-4 t=2bcbbc13.dds

[TextureOverrideTexture17]
hash = 2bcbbc13
match_priority = 0
if $object_detected
    this = ResourceTexture17
endif

[ResourceTexture18]
filename = Textures/Components-4 t=7ead6dd3.dds

[TextureOverrideTexture18]
hash = 7ead6dd3
match_priority = 0
if $object_detected
    this = ResourceTexture18
endif

[ResourceTexture19]
filename = Textures/Components-5 t=8fcd5788.dds

[TextureOverrideTexture19]
hash = 8fcd5788
match_priority = 0
if $object_detected
    this = ResourceTexture19
endif

[ResourceTexture20]
filename = Textures/Components-5 t=b22bec61.dds

[TextureOverrideTexture20]
hash = b22bec61
match_priority = 0
if $object_detected
    this = ResourceTexture20
endif

[ResourceTexture21]
filename = Textures/Components-5 t=b46d93eb.dds

[TextureOverrideTexture21]
hash = b46d93eb
match_priority = 0
if $object_detected
    this = ResourceTexture21
endif

[ResourceTexture22]
filename = Textures/Components-5-6 t=050ed77f.dds

[TextureOverrideTexture22]
hash = 050ed77f
match_priority = 0
if $object_detected
    this = ResourceTexture22
endif

[ResourceTexture23]
filename = Textures/Components-6 t=37975225.dds

[TextureOverrideTexture23]
hash = 37975225
match_priority = 0
if $object_detected
    this = ResourceTexture23
endif

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

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

[TextureOverrideShapeKeyScale]
hash = 143b36e8
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 = 7de8c459
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 = 7de8c459
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 = 1536

[ResourceExtraMergedSkeleton]

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

; 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

[ResourceBlendBufferNoStride]
type = Buffer
format = DXGI_FORMAT_R8_UINT
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

[ResourceBlendRemapVertexVGBuffer]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = Meshes/BlendRemapVertexVG.buf

[ResourceBlendRemapForwardBuffer]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = Meshes/BlendRemapForward.buf

[ResourceBlendRemapReverseBuffer]
type = Buffer
format = DXGI_FORMAT_R16_UINT
filename = Meshes/BlendRemapReverse.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.7.3 and requires WWMI v1.0.0+ 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: cd30986576a944932251981a8a70343c6fea719b7b908b92b14ee782165a72de
