; WWMI ALPHA-1 INI

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

[Constants]
global $required_wwmi_version = 0.6
global $object_guid = 144249
global $mesh_vertex_count = 21449
global $shapekey_vertex_count = 23664
global $mod_id = -1000
global $state_id = 0
global $draw_counter = 0
global $mod_enabled = 0

[Present]
if $mod_enabled
	run = CommandListLoadMergedSkeleton
endif

[CommandListLoadMergedSkeleton]
local $last_draw_count
local $delay_load
if $draw_counter > 0
	if $state_id
		$state_id = 0
	else
		$state_id = 1
	endif
	if $last_draw_count == 0 && $\WWMIv1\in_character_menu
		$delay_load = time + 0.5
	endif
	if $draw_counter > $\WWMIv1\component_draw_calls_count
		$delay_load = time + 0.5
	endif
	if $delay_load == 0
		ResourceMergedSkeleton = copy ResourceMergedSkeletonRW
	else
		if time > $delay_load
			$delay_load = 0
		endif
		ResourceMergedSkeleton = null
	endif
	$last_draw_count = $draw_counter
	$draw_counter = 0
elif $last_draw_count != 0
	if ResourceMergedSkeleton !== null
		ResourceMergedSkeleton = null
	endif
	$last_draw_count = 0
endif

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

[ResourceModName]
type = Buffer
data = "sanhua"

[ResourceModAuthor]
type = Buffer
data = "Actice"

[ResourceModDesc]
; type = Buffer
; data = "Empty Mod Description"

[ResourceModLink]
; type = Buffer
; data = "Empty Mod Link"

[ResourceModLogo]
; filename = Textures/Logo.dds

; Shading: Draw Call Stacks Processing -------------------------

[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

[TextureOverrideMarkBoneDataCB]
hash = f02baf77
match_priority = 0
filter_index = 3381.7777

[CommandListMergeSkeleton]
cs-cb8 = ref vs-cb4
cs-u6 = ResourceMergedSkeletonRW
$\WWMIv1\custom_mesh_scale = 1.0
run = CustomShader\WWMIv1\SkeletonMerger

[CommandListOverrideSharedResources]
ib = ResourceIndexBuffer
vb0 = ResourcePositionBuffer
vb1 = ResourceVectorBuffer
vb2 = ResourceTexcoordBuffer
vb3 = ResourceColorBuffer
vb4 = ResourceBlendBuffer
if vs-cb3 == 3381.7777
	vs-cb3 = ResourceMergedSkeleton
endif
if vs-cb4 == 3381.7777
	vs-cb4 = ResourceMergedSkeleton
endif

[CommandListOverrideTextures]
checktextureoverride = ps-t0
checktextureoverride = ps-t1
checktextureoverride = ps-t2
checktextureoverride = ps-t3
checktextureoverride = ps-t4
checktextureoverride = ps-t5
checktextureoverride = ps-t6
checktextureoverride = ps-t7

[TextureOverrideComponent0]
hash = f02baf77
match_first_index = 0
match_index_count = 8199
if $mod_id == -1000
	run = CommandListRegisterMod
endif
if $mod_enabled
	local $state_id_0
	$draw_counter = $draw_counter + 1
	if $state_id_0 != $state_id
		$state_id_0 = $state_id
		$\WWMIv1\vg_offset = 0
		$\WWMIv1\vg_count = 19
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListOverrideSharedResources
		run = CommandListOverrideTextures
		; Draw Component 0.002
		drawindexed = 3, 0, 0
	endif
endif

[TextureOverrideComponent1]
hash = f02baf77
match_first_index = 8199
match_index_count = 7158
if $mod_enabled
	local $state_id_1
	if $state_id_1 != $state_id
		$state_id_1 = $state_id
		$\WWMIv1\vg_offset = 19
		$\WWMIv1\vg_count = 4
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListOverrideSharedResources
		run = CommandListOverrideTextures
		; Draw Component 1.002
		drawindexed = 3, 3, 0
	endif
endif

[TextureOverrideComponent2]
hash = f02baf77
match_first_index = 15357
match_index_count = 9684
if $mod_enabled
	local $state_id_2
	if $state_id_2 != $state_id
		$state_id_2 = $state_id
		$\WWMIv1\vg_offset = 23
		$\WWMIv1\vg_count = 1
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListOverrideSharedResources
		run = CommandListOverrideTextures
		; Draw Component 2.002
		drawindexed = 9684, 6, 0
	endif
endif

[TextureOverrideComponent3]
hash = f02baf77
match_first_index = 25041
match_index_count = 11328
if $mod_enabled
	local $state_id_3
	if $state_id_3 != $state_id
		$state_id_3 = $state_id
		$\WWMIv1\vg_offset = 24
		$\WWMIv1\vg_count = 27
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListOverrideSharedResources
		run = CommandListOverrideTextures
		; Draw Component 3.002
		drawindexed = 3, 9690, 0
	endif
endif

[TextureOverrideComponent4]
hash = f02baf77
match_first_index = 36369
match_index_count = 60678
if $mod_enabled
	local $state_id_4
	if $state_id_4 != $state_id
		$state_id_4 = $state_id
		$\WWMIv1\vg_offset = 51
		$\WWMIv1\vg_count = 72
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListOverrideSharedResources
		run = CommandListOverrideTextures
		; Draw Component 4.002
		drawindexed = 79494, 9693, 0
	endif
endif

[TextureOverrideComponent5]
hash = f02baf77
match_first_index = 97047
match_index_count = 45822
if $mod_enabled
	local $state_id_5
	if $state_id_5 != $state_id
		$state_id_5 = $state_id
		$\WWMIv1\vg_offset = 123
		$\WWMIv1\vg_count = 85
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListOverrideSharedResources
		run = CommandListOverrideTextures
		; Draw Component 5.002
		drawindexed = 18, 89187, 0
	endif
endif

[TextureOverrideComponent6]
hash = f02baf77
match_first_index = 142869
match_index_count = 1380
if $mod_enabled
	local $state_id_6
	if $state_id_6 != $state_id
		$state_id_6 = $state_id
		$\WWMIv1\vg_offset = 208
		$\WWMIv1\vg_count = 1
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListOverrideSharedResources
		run = CommandListOverrideTextures
		; Draw Component 6.002
		drawindexed = 1380, 89205, 0
	endif
endif

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

[ResourceTexture0]
filename = Textures/Components-0-1-2-3 t=48616ac9.dds

[TextureOverrideTexture0]
hash = 48616ac9
match_priority = 0
this = ResourceTexture0

[ResourceTexture1]
filename = Textures/Components-0-1-2-3-4-5-6 t=28708ab8.dds

[TextureOverrideTexture1]
hash = 28708ab8
match_priority = 0
this = ResourceTexture1

[ResourceTexture2]
filename = Textures/Components-0-1-2-3-4-5-6 t=345368c9.dds

[TextureOverrideTexture2]
hash = 345368c9
match_priority = 0
this = ResourceTexture2

[ResourceTexture3]
filename = Textures/Components-0-1-2-3-4-5-6 t=5019e88f.dds

[TextureOverrideTexture3]
hash = 5019e88f
match_priority = 0
this = ResourceTexture3

[ResourceTexture4]
filename = Textures/Components-0-1-2-3-4-5-6 t=9f6eaf2e.dds

[TextureOverrideTexture4]
hash = 9f6eaf2e
match_priority = 0
this = ResourceTexture4

[ResourceTexture5]
filename = Textures/Components-0-3 t=03d9850b.dds

[TextureOverrideTexture5]
hash = 03d9850b
match_priority = 0
this = ResourceTexture5

[ResourceTexture6]
filename = Textures/Components-0-3 t=4b6d52b9.dds

[TextureOverrideTexture6]
hash = 4b6d52b9
match_priority = 0
this = ResourceTexture6

[ResourceTexture7]
filename = Textures/Components-1 t=2584190a.dds

[TextureOverrideTexture7]
hash = 2584190a
match_priority = 0
this = ResourceTexture7

[ResourceTexture8]
filename = Textures/Components-1 t=98b9635b.dds

[TextureOverrideTexture8]
hash = 98b9635b
match_priority = 0
this = ResourceTexture8

[ResourceTexture9]
filename = Textures/Components-2 t=46177147.dds

[TextureOverrideTexture9]
hash = 46177147
match_priority = 0
this = ResourceTexture9

[ResourceTexture10]
filename = Textures/Components-2 t=8383cbbf.dds

[TextureOverrideTexture10]
hash = 8383cbbf
match_priority = 0
this = ResourceTexture10

[ResourceTexture11]
filename = Textures/Components-2 t=aa70ef15.dds

[TextureOverrideTexture11]
hash = aa70ef15
match_priority = 0
this = ResourceTexture11

[ResourceTexture12]
filename = Textures/Components-2-6 t=1bdd0987.dds

[TextureOverrideTexture12]
hash = 1bdd0987
match_priority = 0
this = ResourceTexture12

[ResourceTexture13]
filename = Textures/Components-4 t=0521977a.dds

[TextureOverrideTexture13]
hash = 0521977a
match_priority = 0
this = ResourceTexture13

[ResourceTexture14]
filename = Textures/Components-4 t=bf702e2d.dds

[TextureOverrideTexture14]
hash = bf702e2d
match_priority = 0
this = ResourceTexture14

[ResourceTexture15]
filename = Textures/Components-4 t=ebeeda8c.dds

[TextureOverrideTexture15]
hash = ebeeda8c
match_priority = 0
this = ResourceTexture15

[ResourceTexture16]
filename = Textures/Components-5 t=16695017.dds

[TextureOverrideTexture16]
hash = 16695017
match_priority = 0
this = ResourceTexture16

[ResourceTexture17]
filename = Textures/Components-5 t=2c0c2728.dds

[TextureOverrideTexture17]
hash = 2c0c2728
match_priority = 0
this = ResourceTexture17

[ResourceTexture18]
filename = Textures/Components-5 t=693b1360.dds

[TextureOverrideTexture18]
hash = 693b1360
match_priority = 0
this = ResourceTexture18

[ResourceTexture19]
filename = Textures/Components-6 t=3cd03f60.dds

[TextureOverrideTexture19]
hash = 3cd03f60
match_priority = 0
this = ResourceTexture19

[ResourceTexture20]
filename = Textures/Components-6 t=c88cc1fc.dds

[TextureOverrideTexture20]
hash = c88cc1fc
match_priority = 0
this = ResourceTexture20

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

[TextureOverrideVertexLimitRaiseShapeKeyOffsets]
hash = a80e0e2b
match_priority = 0

[TextureOverrideVertexLimitRaiseShapeKeyScale]
hash = bf231a78
match_priority = 0

[CommandListSetupShapeKeys]
$\WWMIv1\shapekey_checksum = 3175
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 = a80e0e2b
match_priority = 0
if $mod_enabled
	if cs == 3381.3333 && ResourceMergedSkeleton !== null
		handling = skip
		run = CommandListSetupShapeKeys
		run = CommandListLoadShapeKeys
	endif
endif

[CommandListMultiplyShapeKeys]
$\WWMIv1\shapekey_vertex_count = $shapekey_vertex_count
run = CustomShader\WWMIv1\ShapeKeyMultiplier

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

; Resources: Buffers -------------------------

[ResourceIndexBuffer]
type = Buffer
format = DXGI_FORMAT_R32_UINT
stride = 12
filename = Meshes/Index.buf

[ResourcePositionBuffer]
type = Buffer
format = DXGI_FORMAT_R32_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 = 12
filename = Meshes/ShapeKeyVertexOffset.buf

; 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

; Autogenerated -------------------------

; This mod.ini was automatically generated by WWMI Tools Blender addon v0.8.1 and requires WWMI v0.6.0+ to function
; WWMI Link: https://gamebanana.com/mods/xxxxxx
; WWMI GitHub: https://github.com/SpectrumQT/WWMI
; WWMI Tools Link: https://gamebanana.com/mods/xxxxxx
; WWMI Tools GitHub: https://github.com/SpectrumQT/WWMI_Tools
; AGMG Modding Community Discord: https://discord.com/invite/agmg

; SHA256 CHECKSUM: 95a83116a5d56aceffaa1bd6f4c6f312352770a623538df6924247c4df5a2b3a
