; WWMI BETA-8 INI

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

[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 $required_wwmi_version = 1.00
global $object_guid = 81912
global $mesh_vertex_count = 21964
global $shapekey_vertex_count = 4597
global $shapekey_vertex_offset_batch0 = 0
global $shapekey_vertex_count_batch0 = 4597
global $mod_id = -1000
global $mod_enabled = 0
global $object_detected = 0
; Swap vars aka toggles defaults
global persist $swapvar_cloth = -1
global persist $tattoo = 0
; Per-object state vars
global $draw_component_0_bra = 1
global $draw_component_0_jacket = 1
global $draw_component_0_torso = 1
global $draw_component_1_001 = 1

[Present]
if $object_detected
    if $mod_enabled
        post $object_detected = 0
        run = CommandListProcessToggles
    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_0_torso = ($swapvar_cloth == -1) || ($swapvar_cloth == 0) || ($swapvar_cloth == 1) || ($swapvar_cloth == 2)
$draw_component_0_bra = ($swapvar_cloth == 0) || ($swapvar_cloth == 1)
$draw_component_0_jacket = ($swapvar_cloth == 1) || ($swapvar_cloth == 2)

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

[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

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

[CommandListCleanupSharedResources]
vb0 = ref ResourceBypassVB0

[TextureOverrideComponent0]
hash = 99ec9b61
match_first_index = 0
match_index_count = 63114
$object_detected = 1
if $mod_enabled
    handling = skip
    ps-t0 = ResourceTexture2
    ps-t1 = ResourceTexture1
    ps-t2 = ResourceTexture0
if $tattoo == 0
    ps-t3 = ResourceTexture3
elif $tattoo == 1
    ps-t3 = ResourceTexture3t
endif 
 
    run = CommandListTriggerResourceOverrides
    run = CommandListOverrideSharedResources
	; Draw Component 0.Bra
	if $draw_component_0_bra
		drawindexed = 2646, 0, 0
	endif
	; Draw Component 0.Jacket
	if $draw_component_0_jacket
		drawindexed = 51936, 2646, 0
	endif
	; Draw Component 0.Torso
	if $draw_component_0_torso
		drawindexed = 37488, 54582, 0
	endif
    run = CommandListCleanupSharedResources
endif

[TextureOverrideComponent1]
hash = 99ec9b61
match_first_index = 63114
match_index_count = 18798
$object_detected = 1
if $mod_enabled
    handling = skip
    run = CommandListTriggerResourceOverrides
    run = CommandListOverrideSharedResources
	; Draw Component 1.001
	if $draw_component_1_001
		drawindexed = 18798, 92070, 0
	endif
    run = CommandListCleanupSharedResources
endif

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

[ResourceTexture0]
filename = Textures/Components-0 t=3a0ebb30.dds

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

[ResourceTexture1]
filename = Textures/Components-0 t=42feca9f.dds

[TextureOverrideTexture1]
hash = 42feca9f
match_priority = 0
if $object_detected
    this = ResourceTexture1
endif

[ResourceTexture2]
filename = Textures/Components-0 t=47f5f4ba.dds

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

[ResourceTexture3]
filename = Textures/Components-0 t=768f8f35.dds
[ResourceTexture3t]
filename = Textures/Components-0 t=768f8f35T.dds
[TextureOverrideTexture3]
hash = 768f8f35
match_priority = 0
if $object_detected
if $tattoo == 0
    this = ResourceTexture3
elif $tattoo == 1
    this = ResourceTexture3t
endif 
endif

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

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

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

[CommandListSetupShapeKeysBatch]
$\WWMIv1\shapekey_checksum_batch0 = 3210
$\WWMIv1\shapekey_vertex_offset_original_batch0 = 0
$\WWMIv1\shapekey_vertex_offset_custom_batch0 = $shapekey_vertex_offset_batch0
cs-t33 = ResourceShapeKeyOffsetBuffer
cs-u5 = ResourceCustomShapeKeyValuesRW
cs-u6 = ResourceShapeKeyCBRW
run = CustomShader\WWMIv1\ShapeKeyBatchOverrider

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

[TextureOverrideShapeKeyLoaderCallback]
hash = e15ec5c2
match_priority = 0
if $mod_enabled
    if cs == 3381.3333
        handling = skip
        run = CommandListSetupShapeKeysBatch
        run = CommandListLoadShapeKeysBatch
    endif
endif

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

[TextureOverrideShapeKeyMultiplierCallback]
hash = e15ec5c2
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 -------------------------

; 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: 6caa30b3aeb9cc12ddfb238e6be59f7e74d38a9d2f0816e8a70145444c7902c9
