; WWMI ALPHA-2 INI

; Mod State -------------------------
[Keypanty]
condition = $mod_enabled == 1
key = no_modifiers 0
type = cycle
$panty = 0,1

[Keypasties]
condition = $mod_enabled == 1
key = no_modifiers 9
type = cycle
$pasties = 0,1

[KeyPubic_hair]
condition = $mod_enabled == 1
key = no_modifiers 8
type = cycle
$Pubic_hair = 0,1

[Keysilk_stocking]
condition = $mod_enabled == 1
key = no_modifiers 7
type = cycle
$silk_stocking = 0,1

[Constants]
global persist $pasties = 1
global persist $panty = 1
global persist $Pubic_hair = 1
global persist $silk_stocking = 0

[Constants]
global $required_wwmi_version = 0.70
global $object_guid = 285591
global $mesh_vertex_count = 57968
global $shapekey_vertex_count = 67979
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 = "Changli"

[ResourceModAuthor]
type = Buffer
data = "ZXIN"

[ResourceModDesc]
type = Buffer
data = "Simple Nude (Original body)"

[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.0
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 = 77975500
match_first_index = 0
match_index_count = 40269
$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 = 44
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 0.hair
		drawindexed = 40269, 0, 0
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent1]
hash = 77975500
match_first_index = 40269
match_index_count = 18657
if $mod_enabled
	local $state_id_1
	if $state_id_1 != $state_id
		$state_id_1 = $state_id
		$\WWMIv1\vg_offset = 44
		$\WWMIv1\vg_count = 14
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 1.hair2
		drawindexed = 18657, 40269, 0
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent2]
hash = 77975500
match_first_index = 58926
match_index_count = 11904
if $mod_enabled
	local $state_id_2
	if $state_id_2 != $state_id
		$state_id_2 = $state_id
		$\WWMIv1\vg_offset = 58
		$\WWMIv1\vg_count = 1
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 2.face
		drawindexed = 11904, 58926, 0
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent3]
hash = 77975500
match_first_index = 70830
match_index_count = 81513
if $mod_enabled
	local $state_id_3
	if $state_id_3 != $state_id
		$state_id_3 = $state_id
		$\WWMIv1\vg_offset = 59
		$\WWMIv1\vg_count = 101
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 3.cloth
		drawindexed = 432, 70830, 0
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent4]
hash = 77975500
match_first_index = 152343
match_index_count = 46512
if $mod_enabled
	local $state_id_4
	if $state_id_4 != $state_id
		$state_id_4 = $state_id
		$\WWMIv1\vg_offset = 160
		$\WWMIv1\vg_count = 69
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 4 basebody
		drawindexed = 97101, 71262, 0
		if $panty == 1
			; Draw Component 4 panty
			drawindexed = 4800, 168363, 0
		endif
		if $silk_stocking == 1
			; Draw Component 4 silk_stocking
			drawindexed = 79449, 173163, 0
		endif
		if $Pubic_hair == 1
			; Draw Component 4.Pubic_hair
			drawindexed = 132, 252612, 0
		endif
		if $pasties == 1
			; Draw Component 4.pasties
			drawindexed = 5019, 252744, 0
		endif
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent5]
hash = 77975500
match_first_index = 198855
match_index_count = 84606
if $mod_enabled
	local $state_id_5
	if $state_id_5 != $state_id
		$state_id_5 = $state_id
		$\WWMIv1\vg_offset = 229
		$\WWMIv1\vg_count = 48
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 5.cloth
		drawindexed = 3, 257763, 0
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent6]
hash = 77975500
match_first_index = 283461
match_index_count = 2028
if $mod_enabled
	local $state_id_6
	if $state_id_6 != $state_id
		$state_id_6 = $state_id
		$\WWMIv1\vg_offset = 277
		$\WWMIv1\vg_count = 1
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 6.eye
		drawindexed = 2028, 257766, 0
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent7]
hash = 77975500
match_first_index = 285489
match_index_count = 102
if $mod_enabled
	local $state_id_7
	if $state_id_7 != $state_id
		$state_id_7 = $state_id
		$\WWMIv1\vg_offset = 278
		$\WWMIv1\vg_count = 4
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 7.shenghen
		drawindexed = 102, 259794, 0
		run = CommandListCleanupSharedResources
	endif
endif

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

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

[TextureOverrideTexture17]
hash = a45bfe26
match_priority = 0
this = ResourceTexture17

[ResourceTexture22]
filename = Textures/Components-4 t=00e5703f.dds

[TextureOverrideTexture22]
hash = 00e5703f
match_priority = 0
this = ResourceTexture22

[ResourceTexture23]
filename = Textures/Components-4 t=998bc53c.dds

[TextureOverrideTexture23]
hash = 998bc53c
match_priority = 0
this = ResourceTexture23

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

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

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

[CommandListSetupShapeKeys]
$\WWMIv1\shapekey_checksum = 2156
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 = d8decbca
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 = d8decbca
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 v0.9.0 and requires WWMI v0.7.0+ 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: d7fe4f8315f25e0fa5ab115985d20dd755cf9cb2494bbea0bab271c0189ec177
