; WWMI ALPHA-2 INI

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

[Constants]
global $required_wwmi_version = 0.70
global $object_guid = 120393
global $mesh_vertex_count = 47873
global $shapekey_vertex_count = 56011
global $mod_id = -1000
global $state_id = 0
global $mod_enabled = 0
global $object_detected = 0

global persist $wings = 0
global persist $dress = 0
global persist $collar = 0
global persist $arm = 0
global persist $shoes = 0
global persist $gloves = 0
global persist $thighstrap = 0
global persist $leg = 0
global persist $halo = 0
global persist $crown = 0

[KeyHalo]
condition = $object_detected
key = no_modifiers up
type = cycle
$halo = 0,1

[KeyCrown]
condition = $object_detected
key = alt up
type = cycle
$crown = 0,1

[KeyCollar]
condition = $object_detected
key = ctrl up
type = cycle
$collar = 0,1



[KeyDress]
condition = $object_detected
key = no_modifiers left
type = cycle
$dress = 0,1,2

[KeyWings]
condition = $object_detected
key = alt left
type = cycle
$wings = 0,1


[KeyArm]
condition = $object_detected
key = no_modifiers right
type = cycle
$arm = 0,1

[KeyGloves]
condition = $object_detected
key = alt right
type = cycle
$gloves = 0,1


[KeyThighstrap]
condition = $object_detected
key = no_modifiers down
type = cycle
$thighstrap = 0,1

[KeyLeg]
condition = $object_detected
key = alt down
type = cycle
$leg = 0,1

[KeyShoes]
condition = $object_detected
key = ctrl down
type = cycle
$shoes = 0,1

[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 = "InaDanjin"

[ResourceModAuthor]
type = Buffer
data = "LatanH2"

[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]
$\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 = 6aefd9b3
match_first_index = 0
match_index_count = 8835
$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 = 41
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
	endif
endif

[TextureOverrideComponent1]
hash = 6aefd9b3
match_first_index = 8835
match_index_count = 16128
if $mod_enabled
	local $state_id_1
	if $state_id_1 != $state_id
		$state_id_1 = $state_id
		$\WWMIv1\vg_offset = 41
		$\WWMIv1\vg_count = 6
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		Resource\RabbitFX\Diffuse = ref ResourceTexture11
		Resource\RabbitFX\Lightmap = ref ResourceTexture9
		run = Commandlist\RabbitFX\SetTextures
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 1.001
		drawindexed = 1428, 0, 0
		; Draw Component 1.002
		drawindexed = 6600, 1428, 0
		; Draw Component 1.003
		drawindexed = 3144, 8028, 0
		; Draw Component 1.004
		drawindexed = 4464, 11172, 0
if $crown == 0
		drawindexed = 1728, 15636, 0
endif
if $halo == 0
		drawindexed = 1104, 17364, 0
endif
		; Draw Component 1.006
		drawindexed = 32148, 18468, 0
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent2]
hash = 6aefd9b3
match_first_index = 24963
match_index_count = 10575
if $mod_enabled
	local $state_id_2
	if $state_id_2 != $state_id
		$state_id_2 = $state_id
		$\WWMIv1\vg_offset = 47
		$\WWMIv1\vg_count = 1
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		Resource\RabbitFX\Diffuse = ref ResourceTexture7
		run = Commandlist\RabbitFX\SetTextures
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 2.001
		;drawindexed = 31734, 50616, 0
		$_1 = 31734
		$_2 = 50616
		run = CustomShaderCullNone
		run = CommandListCleanupSharedResources
	endif
endif

; Fix backface culling ------------------------------------

[Constants]
global $_1 = 0
global $_2 = 0

[CustomShaderCullNone]
cull = none
drawindexed= $_1, $_2, 0
$_1 = 0
$_2 = 0

[TextureOverrideComponent3]
hash = 6aefd9b3
match_first_index = 35538
match_index_count = 50568
if $mod_enabled
	local $state_id_3
	if $state_id_3 != $state_id
		$state_id_3 = $state_id
		$\WWMIv1\vg_offset = 48
		$\WWMIv1\vg_count = 90
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
	endif
endif

[TextureOverrideComponent4]
hash = 6aefd9b3
match_first_index = 86106
match_index_count = 33063
if $mod_enabled
	local $state_id_4
	if $state_id_4 != $state_id
		$state_id_4 = $state_id
		$\WWMIv1\vg_offset = 138
		$\WWMIv1\vg_count = 43
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		Resource\RabbitFX\Normalmap = ref ResourceTexture20
		Resource\RabbitFX\Diffuse = ref ResourceTexture19
		Resource\RabbitFX\Lightmap = ref ResourceTexture21
		run = Commandlist\RabbitFX\SetTextures
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
			; Body
		drawindexed = 65226, 82380, 0
if $shoes == 0
			; Shoes
		drawindexed = 30, 82350, 0
		drawindexed = 306, 147606, 0
		drawindexed = 594, 162978, 0
		drawindexed = 600, 170238, 0
endif
if $collar == 0
			; Collar
		drawindexed = 1596, 147912, 0
		drawindexed = 1800, 163572, 0
endif
if $gloves == 0
			; Gloves
		drawindexed = 13470, 149508, 0
endif
if $thighstrap == 0
		drawindexed = 432, 165372, 0
		drawindexed = 4122, 175488, 0
endif
if $leg == 0
			; Leg
		drawindexed = 2859, 167190, 0
		drawindexed = 1425, 179706, 0
endif
if $dress < 2
	if $dress == 0
			; Dress
		drawindexed = 192, 165804, 0
		drawindexed = 189, 170049, 0
		drawindexed = 576, 170838, 0
		drawindexed = 204, 210393, 0
	endif
		drawindexed = 9882, 183183, 0
		drawindexed = 96, 175392, 0
		drawindexed = 96, 179610, 0
endif
if $arm == 0
			; Arm
		drawindexed = 1194, 165996, 0
		drawindexed = 3978, 171414, 0
		drawindexed = 2052, 181131, 0
endif
if $wings == 0
			; Wings
		drawindexed = 17328, 193065, 0
endif
		run = CommandListCleanupSharedResources
	endif
endif

[TextureOverrideComponent5]
hash = 6aefd9b3
match_first_index = 119169
match_index_count = 1224
if $mod_enabled
	local $state_id_5
	if $state_id_5 != $state_id
		$state_id_5 = $state_id
		$\WWMIv1\vg_offset = 181
		$\WWMIv1\vg_count = 1
		run = CommandListMergeSkeleton
	endif
	if ResourceMergedSkeleton !== null
		handling = skip
		Resource\RabbitFX\Diffuse = ref ResourceTexture22
		run = Commandlist\RabbitFX\SetTextures
		run = CommandListTriggerResourceOverrides
		run = CommandListOverrideSharedResources
		; Draw Component 5.001
		drawindexed = 204, 210597, 0
		run = CommandListCleanupSharedResources
	endif
endif

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

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

[TextureOverrideTexture0]
hash = b66ac42f
match_priority = 0
this = ResourceTexture0

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

[TextureOverrideTexture1]
hash = 698b7c01
match_priority = 0
this = ResourceTexture1

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

[TextureOverrideTexture2]
hash = 387fd9fd
match_priority = 0
this = ResourceTexture2

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

[TextureOverrideTexture3]
hash = 9f6eaf2e
match_priority = 0
this = ResourceTexture3

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

[TextureOverrideTexture4]
hash = ab012b35
match_priority = 0
this = ResourceTexture4

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

[TextureOverrideTexture5]
hash = 5019e88f
match_priority = 0
this = ResourceTexture5

[ResourceTexture6]
filename = Textures/Components-0-1-2-5 t=aeb47e33.dds

[TextureOverrideTexture6]
hash = aeb47e33
match_priority = 0
this = ResourceTexture6

[ResourceTexture7]
filename = Textures/Components-0-2 t=500d4413.dds

[TextureOverrideTexture7]
hash = 681bd034
match_priority = 0
this = ResourceTexture7

[ResourceTexture8]
filename = Textures/Components-0-2 t=d2db5a56.dds

[TextureOverrideTexture8]
hash = 2368e5e0
match_priority = 0
this = ResourceTexture8

[ResourceTexture9]
filename = Textures/Components-1 t=da15e0f7.dds

[TextureOverrideTexture9]
hash = 5572b370
match_priority = 0
this = ResourceTexture9

[ResourceTexture10]
filename = Textures/Components-1 t=f56dbcb4.dds

[TextureOverrideTexture10]
hash = b25de1d7
match_priority = 0
this = ResourceTexture10

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

[TextureOverrideTexture11]
hash = 75ca69a3
match_priority = 0
this = ResourceTexture11

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

[TextureOverrideTexture12]
hash = 8383cbbf
match_priority = 0
this = ResourceTexture12

[ResourceTexture13]
filename = Textures/Components-3 t=0709c3c2.dds

[TextureOverrideTexture13]
hash = 3529e545
match_priority = 0
this = ResourceTexture13

[ResourceTexture14]
filename = Textures/Components-3 t=2e599849.dds

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

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

[TextureOverrideTexture15]
hash = 3cd03f60
match_priority = 0
this = ResourceTexture15

[ResourceTexture16]
filename = Textures/Components-3 t=b4618a2b.dds

[TextureOverrideTexture16]
hash = 7766a196
match_priority = 0
this = ResourceTexture16

[ResourceTexture17]
filename = Textures/Components-3 t=e2321307.dds

[TextureOverrideTexture17]
hash = 76241d48
match_priority = 0
this = ResourceTexture17

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

[TextureOverrideTexture18]
hash = 2311b835
match_priority = 0
this = ResourceTexture18

[ResourceTexture19]
filename = Textures/Components-4 t=b7758489.dds

[TextureOverrideTexture19]
hash = 47ce2cf2
match_priority = 0
this = ResourceTexture19

[ResourceTexture20]
filename = Textures/Components-4 t=c1f7edcc.dds

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

[ResourceTexture21]
filename = Textures/Components-4 t=ec8f6254.dds

[TextureOverrideTexture21]
hash = 4cb3388f
match_priority = 0
this = ResourceTexture21

[ResourceTexture22]
filename = Textures/Components-5 t=63fbfe72.dds

[TextureOverrideTexture22]
hash = 99179105
match_priority = 0
this = ResourceTexture22

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

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

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

[CommandListSetupShapeKeys]
$\WWMIv1\shapekey_checksum = 2420
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 = 9f182348
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 = 9f182348
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: b7e722223e1d28d3e916a0e10944623a4cf19ba2f8f320366e95e703f30e9091
