; ";-;" are errored conditional lines.
; ";+;" are disabled keys.
; Errored conditional blocks (if/else/elif/endif) are handled correctly (newer syntax may require further testing), including namespaced variables.
; If certain syntax is only available in newer XXMI versions, make sure to use the latest XXMI.
; WWMI ALPHA-2 INI

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

[Constants]
global $managed_slot_id = 10
global $required_wwmi_version = 0.70
global $object_guid = 44169
global $mesh_vertex_count = 14199
global $shapekey_vertex_count = 0
global $mod_id = -1000
global $state_id = 0
global $mod_enabled = 0
global $object_detected = 0

[Present]
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    if $object_detected
        if $mod_enabled
            post $object_detected = 0
            run = CommandListUpdateMergedSkeleton
        else
            if $mod_id == -1000
                run = CommandListRegisterMod
            endif
        endif
    endif
endif

[CommandListRegisterMod]
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    $\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
endif

[CommandListUpdateMergedSkeleton]
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    if $state_id
        $state_id = 0
    else
        $state_id = 1
    endif
    ResourceMergedSkeleton = copy ResourceMergedSkeletonRW
    ResourceExtraMergedSkeleton = copy ResourceExtraMergedSkeletonRW
endif

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

[ResourceModName]
type = Buffer
data = "Carlotta | Infiltrator Suit"

[ResourceModAuthor]
type = Buffer
data = "Levi"

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

[ResourceModLink]
type = Buffer
data = "patreon.com/LeviMods"

[ResourceModLogo]
; filename = Textures/Logo.dds

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

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

[CommandListMergeSkeleton]
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    $\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
endif

[CommandListTriggerResourceOverrides]
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    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
endif

[CommandListOverrideSharedResources]
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    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
endif

[CommandListCleanupSharedResources]
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    vb0 = ref ResourceBypassVB0
endif

[TextureOverrideComponent0]
hash = 873457db
match_first_index = 0
match_index_count = 20952
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    $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
            run = CommandListTriggerResourceOverrides
            run = CommandListOverrideSharedResources
            ; Draw Component 0.008
            drawindexed = 20952, 0, 0
            run = CommandListCleanupSharedResources
        endif
    endif
endif

[TextureOverrideComponent1]
hash = 873457db
match_first_index = 20952
match_index_count = 23217
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    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 = 18
            run = CommandListMergeSkeleton
        endif
        if ResourceMergedSkeleton !== null
            handling = skip
            run = CommandListTriggerResourceOverrides
            run = CommandListOverrideSharedResources
            ; Draw Component 1.012
            drawindexed = 23217, 20952, 0
            run = CommandListCleanupSharedResources
        endif
    endif
endif

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

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

[TextureOverrideTexture0]
hash = c7042488
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture0
endif

[ResourceTexture1]
filename = Textures/Components-0 t=24d244c6.dds

[TextureOverrideTexture1]
hash = 2c08bef8
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture1
endif

[ResourceTexture2]
filename = Textures/Components-0 t=3886b266.dds

[TextureOverrideTexture2]
hash = cae39d06
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture2
endif

[ResourceTexture3]
filename = Textures/Components-0-1 t=1dc3d14a.dds

[TextureOverrideTexture3]
hash = 1dc3d14a
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture3
endif

[ResourceTexture4]
filename = Textures/Components-0-1 t=4b8a6357.dds

[TextureOverrideTexture4]
hash = 137c6faa
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture4
endif

[ResourceTexture5]
filename = Textures/Components-0-1 t=7f0aa102.dds

[TextureOverrideTexture5]
hash = cae6d5b6
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture5
endif

[ResourceTexture6]
filename = Textures/Components-0-1 t=9d0b65e1.dds

[TextureOverrideTexture6]
hash = 1842bc28
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture6
endif

[ResourceTexture7]
filename = Textures/Components-0-1 t=a28bad55.dds

[TextureOverrideTexture7]
hash = a28bad55
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture7
endif

[ResourceTexture8]
filename = Textures/Components-0-1 t=a8a2d3b8.dds

[TextureOverrideTexture8]
hash = 52f88bd2
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture8
endif

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

[TextureOverrideTexture9]
hash = 9ec0b80f
match_priority = 0
if $managed_slot_id == $\modmanageragl\group_4\active_slot
    this = ResourceTexture9
endif

; 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

; 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: 2cf80fc53a8467196b1b648084ffbc6cf1ef071635bcac1c262bcc92760c341a
