; WWMI BETA-8 INI

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

[KeySwapShoes]
condition = $object_detected == 1
key = NO_ALT NO_SHIFT VK_DOWN
type = cycle
$swapvar_shoes = -1, 0

[KeySwapThigh]
condition = $object_detected == 1
key = ALT NO_SHIFT VK_DOWN
type = cycle
$swapvar_thigh = -1, 0

[KeySwapCloth]
condition = $object_detected == 1
key = NO_ALT NO_SHIFT VK_LEFT
type = cycle
$swapvar_cloth = -1, 0, 1, 2
[KeySwapTattoo]
condition = $object_detected == 1
key = NO_ALT NO_SHIFT VK_RIGHT
type = cycle
$tattoo = 0,1
[Constants]
global persist $tattoo = 0
global $required_wwmi_version = 1.00
global $object_guid = 176382
global $mesh_vertex_count = 45927
global $shapekey_vertex_count = 106745
global $shapekey_vertex_offset_batch0 = 0
global $shapekey_vertex_count_batch0 = 77758
global $shapekey_vertex_offset_batch1 = 77758
global $shapekey_vertex_count_batch1 = 28987
global $mod_id = -1000
global $state_id = 0
global $mod_enabled = 0
global $object_detected = 0
global $merge_status_id = 0
global $merge_status_id_0 = 0
global $merge_status_id_1 = 0
global $merge_status_id_2 = 0
global $merge_status_id_3 = 0
global $merge_status_id_4 = 0
global $merge_status_id_5 = 0
global $merge_status_id_6 = 0
; Swap vars aka toggles defaults
global persist $swapvar_shoes = -1
global persist $swapvar_thigh = -1
global persist $swapvar_cloth = -1
; Per-object state vars
global $draw_component_0_001 = 1
global $draw_component_1_001 = 1
global $draw_component_2_001 = 1
global $draw_component_3_001 = 1
global $draw_component_3_bra = 1
global $draw_component_3_jacket = 1
global $draw_component_4_hairband = 1
global $draw_component_4_shoes = 1
global $draw_component_4_thigh = 1
global $draw_component_5_nd = 1
global $draw_component_6_001 = 1

[Present]
if $object_detected
    if $mod_enabled
        post $object_detected = 0
        run = CommandListInitializeBlendRemaps
        run = CommandListProcessToggles
        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

[CommandListProcessToggles]
; Set display of each object according to toggles logic
$draw_component_4_shoes = ($swapvar_shoes == 0)
$draw_component_4_thigh = ($swapvar_thigh == 0)
$draw_component_3_bra = ($swapvar_cloth == 0) || ($swapvar_cloth == 2)
$draw_component_3_jacket = ($swapvar_cloth == 1) || ($swapvar_cloth == 2)

[CommandListUpdateMergedSkeleton]
$merge_status_id_0 = 0
$merge_status_id_1 = 0
$merge_status_id_2 = 0
$merge_status_id_3 = 0
$merge_status_id_4 = 0
$merge_status_id_5 = 0
$merge_status_id_6 = 0
ResourceMergedSkeleton = copy ResourceMergedSkeletonRW
ResourceExtraMergedSkeleton = copy ResourceExtraMergedSkeletonRW
run = CommandListRemapMergedSkeleton

[ResourceMergedSkeletonRemap]
[ResourceExtraMergedSkeletonRemap]

[ResourceBlendBufferOverride]
[ResourceExtraMergedSkeletonOverride]
[ResourceMergedSkeletonOverride]

[ResourceRemappedBlendBufferRW]
[ResourceRemappedSkeletonRW]
[ResourceExtraRemappedSkeletonRW]

[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
    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 = 98
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 = "Unnamed Mod"

[ResourceModAuthor]
type = Buffer
data = "jelly"

[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]
if $merge_status_id == 0
	if vs-cb4 == 3381.7777
		cs-cb8 = ref vs-cb4
		cs-u6 = ResourceMergedSkeletonRW
		$\WWMIv1\custom_mesh_scale = 1.00
		run = CustomShader\WWMIv1\SkeletonMerger
		$merge_status_id = 1
	endif
endif
if $merge_status_id == 1
	if vs-cb4 == 3381.7777 && vs-cb3 == 3381.7777
		cs-cb8 = ref vs-cb3
		cs-u6 = ResourceExtraMergedSkeletonRW
		$\WWMIv1\custom_mesh_scale = 1.00
		run = CustomShader\WWMIv1\SkeletonMerger
		$merge_status_id = 2
	endif
endif

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

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

[TextureOverrideComponent0]
hash = aed00161
match_first_index = 0
match_index_count = 11133
$object_detected = 1
if $mod_enabled
    if $merge_status_id_0 != 2
        $\WWMIv1\vg_offset = 0
        $\WWMIv1\vg_count = 4
		$merge_status_id = $merge_status_id_0
		run = CommandListMergeSkeleton
		$merge_status_id_0 = $merge_status_id
	endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 0.001
        if $draw_component_0_001
			drawindexed = 11133, 0, 0
        endif
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent1]
hash = aed00161
match_first_index = 11133
match_index_count = 34119
$object_detected = 1
if $mod_enabled
    if $merge_status_id_1 != 2
        $\WWMIv1\vg_offset = 4
        $\WWMIv1\vg_count = 47
		$merge_status_id = $merge_status_id_1
		run = CommandListMergeSkeleton
		$merge_status_id_1 = $merge_status_id
	endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 1.001
        if $draw_component_1_001
			drawindexed = 34119, 11133, 0
        endif
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent2]
hash = aed00161
match_first_index = 45252
match_index_count = 16116
$object_detected = 1
if $mod_enabled
    if $merge_status_id_2 != 2
        $\WWMIv1\vg_offset = 51
        $\WWMIv1\vg_count = 21
		$merge_status_id = $merge_status_id_2
		run = CommandListMergeSkeleton
		$merge_status_id_2 = $merge_status_id
	endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 2.001
        if $draw_component_2_001
			drawindexed = 16116, 45252, 0
        endif
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent3]
hash = aed00161
match_first_index = 61368
match_index_count = 63114
$object_detected = 1
if $mod_enabled
    if $merge_status_id_3 != 2
        $\WWMIv1\vg_offset = 72
        $\WWMIv1\vg_count = 105
		$merge_status_id = $merge_status_id_3
		run = CommandListMergeSkeleton
		$merge_status_id_3 = $merge_status_id
	endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 3.001
        if $draw_component_3_001
			drawindexed = 0, 61368, 0
        endif
        ; Draw Component 3.Bra
        if $draw_component_3_bra
			drawindexed = 2646, 61368, 0
        endif
        ; Draw Component 3.Jacket
        if $draw_component_3_jacket
			drawindexed = 51936, 64014, 0
        endif
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent4]
hash = aed00161
match_first_index = 124482
match_index_count = 31812
$object_detected = 1
if $mod_enabled
    if $merge_status_id_4 != 2
        $\WWMIv1\vg_offset = 177
        $\WWMIv1\vg_count = 36
		$merge_status_id = $merge_status_id_4
		run = CommandListMergeSkeleton
		$merge_status_id_4 = $merge_status_id
	endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 4.Hairband
        if $draw_component_4_hairband
			drawindexed = 1068, 115950, 0
        endif
        ; Draw Component 4.Shoes
        if $draw_component_4_shoes
			drawindexed = 12540, 117018, 0
        endif
        ; Draw Component 4.Thigh
        if $draw_component_4_thigh
			drawindexed = 486, 129558, 0
        endif
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent5]
hash = aed00161
match_first_index = 156294
match_index_count = 18798
$object_detected = 1
if $mod_enabled
    if $merge_status_id_5 != 2
        $\WWMIv1\vg_offset = 213
        $\WWMIv1\vg_count = 48
		$merge_status_id = $merge_status_id_5
		run = CommandListMergeSkeleton
		$merge_status_id_5 = $merge_status_id
	endif
    if ResourceMergedSkeleton !== null
        handling = skip
    ps-t0 = ResourceTexture1
    ps-t1 = ResourceTexture0
    ps-t2 = ResourceTexture2
if $tattoo == 0
    ps-t3 = ResourceTexture3
elif $tattoo == 1
    ps-t3 = ResourceTexture3t
endif
    
        ResourceBlendBufferOverride = ref ResourceRemappedBlendBufferComponent5
        ResourceMergedSkeletonOverride = ref ResourceRemappedSkeletonComponent5
        ResourceExtraMergedSkeletonOverride = ref ResourceExtraRemappedSkeletonComponent5
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 5.ND
        if $draw_component_5_nd
			drawindexed = 90036, 130044, 0
        endif
        run = CommandListCleanupSharedResources
    endif
endif

[TextureOverrideComponent6]
hash = aed00161
match_first_index = 175092
match_index_count = 1290
$object_detected = 1
if $mod_enabled
    if $merge_status_id_6 != 2
        $\WWMIv1\vg_offset = 261
        $\WWMIv1\vg_count = 1
		$merge_status_id = $merge_status_id_6
		run = CommandListMergeSkeleton
		$merge_status_id_6 = $merge_status_id
	endif
    if ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListTriggerResourceOverrides
        run = CommandListOverrideSharedResources
        ; Draw Component 6.001
        if $draw_component_6_001
			drawindexed = 1290, 220080, 0
        endif
        run = CommandListCleanupSharedResources
    endif
endif

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

[ResourceTexture0]
filename = Textures/Components-5 t=31499105.dds

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

[ResourceTexture1]
filename = Textures/Components-5 t=3762703e.dds

[TextureOverrideTexture1]
hash = 3762703e
match_priority = 0
if $object_detected
    this = ResourceTexture1
endif

[ResourceTexture2]
filename = Textures/Components-5 t=e488ea8b.jpg

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

[ResourceTexture3]
filename = Textures/Components-5 t=e6c846f5.dds
[ResourceTexture3t]
filename = Textures/Components-5 t=e6c846f5t.dds
[TextureOverrideTexture3]
hash = e6c846f5
match_priority = 0
if $object_detected
if $tattoo == 0
    this = ResourceTexture3
elif $tattoo == 1
    this = ResourceTexture3t
endif
endif
; Skinning: Shape Keys Override -------------------------

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

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

[CommandListSetupShapeKeysBatch]
$\WWMIv1\shapekey_checksum_batch0 = 840
$\WWMIv1\shapekey_vertex_offset_original_batch0 = 0
$\WWMIv1\shapekey_vertex_offset_custom_batch0 = $shapekey_vertex_offset_batch0
$\WWMIv1\shapekey_checksum_batch1 = 3267
$\WWMIv1\shapekey_vertex_offset_original_batch1 = 77709
$\WWMIv1\shapekey_vertex_offset_custom_batch1 = $shapekey_vertex_offset_batch1
cs-t33 = ResourceShapeKeyOffsetBuffer
cs-u5 = ResourceCustomShapeKeyValuesRW
cs-u6 = ResourceShapeKeyCBRW
run = CustomShader\WWMIv1\ShapeKeyBatchOverrider

[CommandListLoadShapeKeysBatch]
$\WWMIv1\shapekey_dispatch_size_y_original_batch0 = 2429
$\WWMIv1\shapekey_vertex_count_batch0 = $shapekey_vertex_count_batch0
$\WWMIv1\shapekey_dispatch_size_y_original_batch1 = 962
$\WWMIv1\shapekey_vertex_count_batch1 = $shapekey_vertex_count_batch1
cs-t0 = ResourceShapeKeyVertexIdBuffer
cs-t1 = ResourceShapeKeyVertexOffsetBuffer
cs-u6 = ResourceShapeKeyCBRW
run = CommandList\WWMIv1\LoadShapeKeysBatch

[TextureOverrideShapeKeyLoaderCallback]
hash = 5ccf4725
match_priority = 0
if $mod_enabled
    if cs == 3381.3333 && ResourceMergedSkeleton !== null
        handling = skip
        run = CommandListSetupShapeKeysBatch
        run = CommandListLoadShapeKeysBatch
    endif
endif

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

[TextureOverrideShapeKeyMultiplierCallback]
hash = 5ccf4725
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 = 64

; 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 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: 29e2779c251991c99380d4eed31ae245be8467ff628a03483a302001491bbb6a
