Files
isaac-port/generated-src/music.cpp
T
shweetandClaude Opus 5.5 3ce74c6e2d Reconstruction layout: generated-src/ (generated) and src/ (curated), CMake, the first takeover: RNG
The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function
defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body.
src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read
from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT,
from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra).
structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:10:23 -05:00

1841 lines
78 KiB
C++

#include "classes.h"
// 007df690
void Music::SetPitchAll(float pitch)
{
char isLoaded;
Music *layerTrack;
int layersLeft;
if (*this != (Music)0x0) {
isLoaded = (**(code **)(*GHIDRA_CAST<int *>(*this) + 0x28))();
if (isLoaded != '\0') {
this[5] = (Music)pitch;
if (*this != (Music)0x0) {
(**(code **)(*GHIDRA_CAST<int *>(*this) + 0x58))(pitch);
}
}
}
layersLeft = 6;
do {
layerTrack = this + 0xd;
if (*layerTrack != (Music)0x0) {
isLoaded = (**(code **)(*GHIDRA_CAST<int *>(*layerTrack) + 0x28))();
if (isLoaded != '\0') {
this[0x12] = (Music)pitch;
if (*layerTrack != (Music)0x0) {
(**(code **)(*GHIDRA_CAST<int *>(*layerTrack) + 0x58))(pitch);
}
}
}
layersLeft = layersLeft + -1;
this = layerTrack;
} while (layersLeft != 0);
return;
}
// 007dfaf0
void Music::LoadConfig(byte *xmlpath, byte ismod)
{
Music MVar1;
byte ch;
undefined1 layerMode;
uint uVar2;
Music MVar3;
int iVar4;
void *pvVar5;
void *pvVar6;
byte *******extraout_EAX;
byte *******extraout_EAX_00;
void **extraout_EAX_01;
byte *******strBuffer;
void **extraout_EAX_02;
int *******loopChars;
int *extraout_EAX_03;
int *extraout_EAX_04;
undefined4 *layerAlloc;
uint *srcChars;
uint uVar7;
byte *strCursor;
byte *literalCursor;
byte *pbVar8;
std_string *valueLength;
byte ******freeSize;
Music *pMVar9;
uint *puVar10;
code *atoiFn;
char *pcVar11;
int *piVar12;
undefined4 *layerArray;
uint *layerDst;
bool isLess;
double dVar13;
uint uVar14;
Music layersBegin;
Music layersEnd;
Music layersCapacity;
Music *pMStack_1022c;
Music MStack_10228;
float fStack_10224;
Music MStack_10220;
uint tempStringFlags;
Music MStack_10218;
byte *pbStack_10214;
int trackId;
byte *******trackName [4];
uint trackNameSize;
uint trackNameCapacity;
byte *******introPath;
byte ******ppppppbStack_101f0;
byte ******ppppppbStack_101ec;
byte ******ppppppbStack_101e8;
byte ******introPathSize;
byte ******introPathCapacity;
byte *******trackPath;
byte ******ppppppbStack_101d8;
byte ******ppppppbStack_101d4;
byte ******ppppppbStack_101d0;
byte ******trackPathSize;
byte ******trackPathCapacity;
undefined2 loopAndLayerMode;
float volumeMul;
float fadeSpeed;
undefined4 *layers;
byte *layerCount;
undefined1 xmlDoc [48];
undefined1 xmlPool [65564];
std_string redirectedNewLayerPath;
std_string redirectedNewLayerIntro;
void *redirectedLayerPath [4];
uint redirectedLayerPathSize;
uint redirectedLayerPathCapacity;
void *redirectedLayerIntro [4];
uint redirectedLayerIntroSize;
uint redirectedLayerIntroCapacity;
void *redirectedPath [4];
uint redirectedPathSize;
uint redirectedPathCapacity;
void *redirectedIntro [4];
uint redirectedIntroSize;
uint redirectedIntroCapacity;
void *newLayerIntro [4];
undefined4 newLayerIntroSize;
uint newLayerIntroCapacity;
void *newLayerPath;
undefined4 newLayerPathSize;
uint newLayerPathCapacity;
undefined4 newLayerMul;
void *trackLayerIntro;
void *pvStack_9c;
void *pvStack_98;
void *pvStack_94;
void *trackLayerIntroSize;
void *trackLayerIntroCapacity;
void *trackLayerPath;
void *pvStack_84;
void *pvStack_80;
void *pvStack_7c;
void *trackLayerPathSize;
void *trackLayerPathCapacity;
float trackLayerMul;
int *******loopText [4];
int loopTextSize;
uint loopTextCapacity;
std_string joinedPath;
byte *******rootPath [4];
uint rootSize;
uint rootCapacity;
uint stackCookie;
undefined1 *puStack_20;
void *savedExceptionList;
undefined1 *puStack_18;
byte ******ehState;
int bufWord2;
int bufWord3;
char *layerLiteralEnd;
Manager *manager;
puStack_20 = GHIDRA_CAST<undefined1 *>((rootPath + 0xe));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xff;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))) = 0xffffff;
puStack_18 = &LAB_00b00897;
savedExceptionList = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((rootPath + 0xb));
ExceptionList = &savedExceptionList;
uVar14 = 0;
pbStack_10214 = xmlpath;
tempStringFlags = 0;
stackCookie = uVar2;
MStack_10218 = (Music)(GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(xmlpath,GHIDRA_CAST<int *>(0x0));
if (MStack_10218 != (Music)0x0) {
if (ismod == 0) {
MVar3 = this[199];
pMVar9 = this + 199;
MStack_10220 = (Music)0x0;
iVar4 = GHIDRA_INT(this[200]) - GHIDRA_INT(MVar3) >> 0x1f;
pMStack_1022c = pMVar9;
if ((GHIDRA_INT(this[200]) - GHIDRA_INT(MVar3)) / 0x60 + iVar4 != iVar4) {
MStack_10228 = (Music)0x0;
do {
pvVar5 = *(void **)(GHIDRA_INT((GHIDRA_INT(MVar3) + 0x58)) + GHIDRA_INT(MStack_10228));
if (pvVar5 != (void *)0x0) {
xmlpath = GHIDRA_CAST<byte *>((GHIDRA_INT(pvVar5) + -4));
ehState = GHIDRA_CAST<byte ******>(0x0);
_eh_vector_destructor_iterator_(pvVar5,0x34,*GHIDRA_CAST<uint *>(xmlpath),FUN_007e1430);
uVar14 = *GHIDRA_CAST<uint *>(xmlpath) * 0x34 + 4;
operator_delete(xmlpath,uVar14);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xff;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))) = 0xffffff;
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(*pMStack_1022c) + 0x58 + GHIDRA_INT(MStack_10228))) = 0;
pMVar9 = pMStack_1022c;
}
MVar3 = *pMVar9;
MStack_10228 = (Music)(GHIDRA_INT(MStack_10228) + 0x60);
MStack_10220 = (Music)(GHIDRA_INT(MStack_10220) + 1);
} while (GHIDRA_UINT(MStack_10220) < GHIDRA_UINT(((GHIDRA_INT(pMVar9[1]) - GHIDRA_INT(MVar3)) / 0x60)));
}
if (&layersBegin != pMVar9) {
MStack_10220 = pMVar9[1];
MStack_10228 = pMVar9[2];
*pMVar9 = (Music)0x0;
pMVar9[1] = (Music)0x0;
pMVar9[2] = (Music)0x0;
if (MVar3 != (Music)0x0) {
if (MVar3 != MStack_10220) {
puVar10 = GHIDRA_CAST<uint *>((GHIDRA_INT(MVar3) + 0x48));
do {
uVar14 = *puVar10;
if (0xf < uVar14) {
pvVar5 = (void *)puVar10[-5];
uVar7 = uVar14 + 1;
pvVar6 = pvVar5;
if (0xfff < uVar7) {
pvVar6 = *(void **)(GHIDRA_INT(pvVar5) - 4);
uVar7 = uVar14 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar5) + (-4 - GHIDRA_INT(pvVar6))))) goto LAB_007e13a8;
}
operator_delete(pvVar6,uVar7);
}
puVar10[-1] = 0;
*puVar10 = 0xf;
*GHIDRA_CAST<undefined1 *>((puVar10 + -5)) = 0;
uVar14 = puVar10[-6];
if (0xf < uVar14) {
pvVar5 = (void *)puVar10[-0xb];
uVar7 = uVar14 + 1;
pvVar6 = pvVar5;
if (0xfff < uVar7) {
pvVar6 = *(void **)(GHIDRA_INT(pvVar5) - 4);
uVar7 = uVar14 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar5) + (-4 - GHIDRA_INT(pvVar6))))) goto LAB_007e13a8;
}
operator_delete(pvVar6,uVar7);
}
puVar10[-7] = 0;
puVar10[-6] = 0xf;
*GHIDRA_CAST<undefined1 *>((puVar10 + -0xb)) = 0;
uVar14 = puVar10[-0xc];
if (0xf < uVar14) {
pvVar5 = (void *)puVar10[-0x11];
uVar7 = uVar14 + 1;
pvVar6 = pvVar5;
if (0xfff < uVar7) {
pvVar6 = *(void **)(GHIDRA_INT(pvVar5) - 4);
uVar7 = uVar14 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar5) + (-4 - GHIDRA_INT(pvVar6))))) goto LAB_007e13a8;
}
operator_delete(pvVar6,uVar7);
}
puVar10[-0xd] = 0;
puVar10[-0xc] = 0xf;
*GHIDRA_CAST<undefined1 *>((puVar10 + -0x11)) = 0;
MVar1 = (Music)(puVar10 + 6);
puVar10 = puVar10 + 0x18;
} while (MVar1 != MStack_10220);
pMVar9 = pMStack_1022c;
}
uVar14 = ((GHIDRA_INT(MStack_10228) - GHIDRA_INT(MVar3)) / 0x60) * 0x60;
xmlpath = GHIDRA_CAST<byte *>(MVar3);
if (0xfff < uVar14) {
xmlpath = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MVar3) + -4));
uVar14 = uVar14 + 0x23;
if (0x1f < (GHIDRA_INT(MVar3) - GHIDRA_INT(xmlpath)) - 4U) goto LAB_007e13a8;
}
operator_delete(xmlpath,uVar14);
}
}
MStack_10220 = pMVar9[1];
uVar7 = (GHIDRA_INT(MStack_10220) - GHIDRA_INT(*pMVar9)) / 0x60;
if (uVar7 < 0x79) {
if (uVar7 < 0x78) {
if (GHIDRA_UINT(((GHIDRA_INT(pMVar9[2]) - GHIDRA_INT(*pMVar9)) / 0x60)) < 0x78) {
FUN_007e2fa0(xmlpath,uVar14);
}
else {
MVar3 = (Music)FUN_007e2f60(pMVar9[1],0x78 - uVar7,fStack_10224);
pMVar9[1] = MVar3;
}
}
}
else {
MVar3 = *pMVar9;
FUN_007e2e00(GHIDRA_INT(MStack_10220) - GHIDRA_INT(*pMVar9),uVar2);
this[200] = (Music)(GHIDRA_INT(MVar3) + 0x2d00);
}
}
MVar3 = MStack_10218;
iVar4 = (**(code **)(*GHIDRA_CAST<int *>(MStack_10218) + 4))();
pMStack_1022c = operator_new_tracked(iVar4 + 1);
(**(code **)(*GHIDRA_CAST<int *>(MVar3) + 0x14))(pMStack_1022c,1,iVar4);
*GHIDRA_CAST<undefined1 *>((GHIDRA_INT(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pMStack_1022c)) + 0x0)))) + iVar4)) = 0;
(*(code *)**GHIDRA_CAST<undefined4 **>(MVar3))(1);
FUN_00413b90();
ehState = GHIDRA_CAST<byte ******>(0x1);
uVar2 = 0x7dfea5;
pMVar9 = pMStack_1022c;
(GHIDRA_CAST<rapidxml::xml_document *>((xmlDoc)))->rapidxml::xml_document::parse(GHIDRA_CAST<byte *>(pMStack_1022c));
ch = (byte)pMVar9;
pvVar5 = (GHIDRA_CAST<xml_node *>((xmlDoc)))->xml_node::first_node(GHIDRA_CAST<byte *>("music"),uVar2,ch);
pvVar6 = (GHIDRA_CAST<xml_node *>((pvVar5)))->xml_node::first_attribute(&DAT_00b66f40,uVar2,ch);
rootSize = 0;
rootCapacity = 0xf;
rootPath[0] = GHIDRA_CAST<byte *******>(0x0);
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(pvVar6) + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(pvVar6) + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(rootPath))))->std::string::assign(pbVar8,GHIDRA_INT(strCursor) - GHIDRA_INT((pbVar8 + 1)));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 2;
if (pvVar5 == (void *)0x0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Could not find root node \'music\' in %s\n"));
}
for (MStack_10220 = *GHIDRA_CAST<Music *>((GHIDRA_CAST<char *>(pvVar5) + 0x18)); MStack_10220 != (Music)0x0;
MStack_10220 = *GHIDRA_CAST<Music *>((GHIDRA_CAST<char *>(MStack_10220) + 0x2c))) {
trackId = 0;
trackNameSize = 0;
trackNameCapacity = 0xf;
trackName[0] = GHIDRA_CAST<byte *******>(0x0);
introPathSize = GHIDRA_CAST<byte ******>(0x0);
introPathCapacity = GHIDRA_CAST<byte ******>(0xf);
introPath = GHIDRA_CAST<byte *******>(0x0);
trackPathSize = GHIDRA_CAST<byte ******>(0x0);
trackPathCapacity = GHIDRA_CAST<byte ******>(0xf);
trackPath = GHIDRA_CAST<byte *******>(0x0);
loopAndLayerMode = 0x100;
volumeMul = 1.0;
fadeSpeed = 0.02;
layers = GHIDRA_CAST<undefined4 *>(0x0);
layerCount = GHIDRA_CAST<byte *>(0x0);
MStack_10218 = (Music)0x0;
layersBegin = (Music)0x0;
layersEnd = (Music)0x0;
MStack_10228 = (Music)0x0;
layersCapacity = (Music)0x0;
trackLayerIntroSize = (void *)0x0;
trackLayerIntroCapacity = (void *)0xf;
trackLayerIntro = (void *)0x0;
trackLayerPathSize = (void *)0x0;
trackLayerPathCapacity = (void *)0xf;
trackLayerPath = (void *)0x0;
trackLayerMul = 1.0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
pbStack_10214 = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MStack_10220) + 0x20));
atoiFn = atoi_exref;
if (pbStack_10214 != GHIDRA_CAST<byte *>(0x0)) {
do {
manager = g_manager;
pbVar8 = *GHIDRA_CAST<byte **>(pbStack_10214);
literalCursor = s_id;
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < *literalCursor;
if (ch != *literalCursor) {
LAB_007e0078:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e007d;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < literalCursor[1];
if (ch != literalCursor[1]) goto LAB_007e0078;
strCursor = strCursor + 2;
literalCursor = literalCursor + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e007d:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
trackId = (*atoiFn)(pbVar8);
}
else {
literalCursor = s_name;
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < *literalCursor;
if (ch != *literalCursor) {
LAB_007e00d4:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e00d9;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < literalCursor[1];
if (ch != literalCursor[1]) goto LAB_007e00d4;
strCursor = strCursor + 2;
literalCursor = literalCursor + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e00d9:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(trackName))))->std::string::assign(pbVar8,GHIDRA_INT(strCursor) - GHIDRA_INT((pbVar8 + 1)));
}
else {
pcVar11 = "intro";
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < (byte)*pcVar11;
if (ch != *pcVar11) {
LAB_007e0140:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0145;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < (byte)pcVar11[1];
if (ch != pcVar11[1]) goto LAB_007e0140;
strCursor = strCursor + 2;
pcVar11 = pcVar11 + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0145:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
valueLength = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((pbVar8 + 1))));
if (GHIDRA_CAST<std_string *>((0x7fffffff - rootSize)) < valueLength) goto LAB_007e1407;
strBuffer = GHIDRA_CAST<byte *******>(rootPath);
if (0xf < rootCapacity) {
strBuffer = rootPath[0];
}
(GHIDRA_CAST<std::string *>((joinedPath._buf)))->std::string::concat(GHIDRA_INT(fStack_10224),valueLength,GHIDRA_CAST<byte *>(strBuffer),
rootSize,pbVar8,GHIDRA_UINT(valueLength));
tempStringFlags = tempStringFlags | 1;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 6;
ModManager::TryRedirectPath
(&manager->_modManager,GHIDRA_CAST<std_string *>(redirectedIntro),&joinedPath);
if (&introPath != GHIDRA_CAST<byte ********>(extraout_EAX)) {
if (GHIDRA_CAST<byte ******>(0xf) < introPathCapacity) {
freeSize = GHIDRA_CAST<byte ******>((GHIDRA_INT(introPathCapacity) + 1));
strBuffer = introPath;
if (GHIDRA_CAST<byte ******>(0xfff) < freeSize) {
strBuffer = GHIDRA_CAST<byte *******>(introPath[-1]);
freeSize = introPathCapacity + 9;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(introPath) + (-4 - GHIDRA_INT(strBuffer)))))
goto LAB_007e13a8;
}
operator_delete(strBuffer,GHIDRA_UINT(freeSize));
}
introPath = GHIDRA_CAST<byte *******>(*extraout_EAX);
ppppppbStack_101f0 = extraout_EAX[1];
ppppppbStack_101ec = extraout_EAX[2];
ppppppbStack_101e8 = extraout_EAX[3];
introPathSize = extraout_EAX[4];
introPathCapacity = extraout_EAX[5];
extraout_EAX[4] = GHIDRA_CAST<byte ******>(0x0);
extraout_EAX[5] = GHIDRA_CAST<byte ******>(0xf);
*GHIDRA_CAST<undefined1 *>(extraout_EAX) = 0;
}
if (0xf < redirectedIntroCapacity) {
uVar2 = redirectedIntroCapacity + 1;
pvVar5 = redirectedIntro[0];
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_INT(redirectedIntro[0]) + -4);
uVar2 = redirectedIntroCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedIntro[0]) + (-4 - GHIDRA_INT(pvVar5)))))
goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
redirectedIntroSize = 0;
redirectedIntroCapacity = 0xf;
redirectedIntro[0] = (void *)(GHIDRA_UINT(redirectedIntro[0]) & 0xffffff00);
LAB_007e028f:
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
if (0xf < joinedPath._capacity) {
uVar2 = joinedPath._capacity + 1;
pvVar5 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)joinedPath._buf)) + 0x0)));
if (0xfff < uVar2) {
pvVar5 = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(joinedPath._buf)) + 0x0))) + -4);
uVar2 = joinedPath._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(joinedPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar5)))))
goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
}
else {
literalCursor = &DAT_00b66e0c;
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < *literalCursor;
if (ch != *literalCursor) {
LAB_007e0385:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e038a;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < literalCursor[1];
if (ch != literalCursor[1]) goto LAB_007e0385;
strCursor = strCursor + 2;
literalCursor = literalCursor + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e038a:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
valueLength = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((pbVar8 + 1))));
if (GHIDRA_CAST<std_string *>((0x7fffffff - rootSize)) < valueLength) goto LAB_007e1407;
strBuffer = GHIDRA_CAST<byte *******>(rootPath);
if (0xf < rootCapacity) {
strBuffer = rootPath[0];
}
(GHIDRA_CAST<std::string *>((joinedPath._buf)))->std::string::concat(GHIDRA_INT(fStack_10224),valueLength,
GHIDRA_CAST<byte *>(strBuffer),rootSize,pbVar8,GHIDRA_UINT(valueLength));
tempStringFlags = tempStringFlags | 2;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 7;
ModManager::TryRedirectPath
(&manager->_modManager,GHIDRA_CAST<std_string *>(redirectedPath),&joinedPath);
if (&trackPath != GHIDRA_CAST<byte ********>(extraout_EAX_00)) {
if (GHIDRA_CAST<byte ******>(0xf) < trackPathCapacity) {
freeSize = GHIDRA_CAST<byte ******>((GHIDRA_INT(trackPathCapacity) + 1));
strBuffer = trackPath;
if (GHIDRA_CAST<byte ******>(0xfff) < freeSize) {
strBuffer = GHIDRA_CAST<byte *******>(trackPath[-1]);
freeSize = trackPathCapacity + 9;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(trackPath) + (-4 - GHIDRA_INT(strBuffer)))))
goto LAB_007e13a8;
}
operator_delete(strBuffer,GHIDRA_UINT(freeSize));
}
trackPath = GHIDRA_CAST<byte *******>(*extraout_EAX_00);
ppppppbStack_101d8 = extraout_EAX_00[1];
ppppppbStack_101d4 = extraout_EAX_00[2];
ppppppbStack_101d0 = extraout_EAX_00[3];
trackPathSize = extraout_EAX_00[4];
trackPathCapacity = extraout_EAX_00[5];
extraout_EAX_00[4] = GHIDRA_CAST<byte ******>(0x0);
extraout_EAX_00[5] = GHIDRA_CAST<byte ******>(0xf);
*GHIDRA_CAST<undefined1 *>(extraout_EAX_00) = 0;
}
if (0xf < redirectedPathCapacity) {
uVar2 = redirectedPathCapacity + 1;
pvVar5 = redirectedPath[0];
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_INT(redirectedPath[0]) + -4);
uVar2 = redirectedPathCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedPath[0]) + (-4 - GHIDRA_INT(pvVar5)))))
goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
redirectedPathSize = 0;
redirectedPathCapacity = 0xf;
redirectedPath[0] = (void *)(GHIDRA_UINT(redirectedPath[0]) & 0xffffff00);
goto LAB_007e028f;
}
pcVar11 = "layerintro";
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < (byte)*pcVar11;
if (ch != *pcVar11) {
LAB_007e0503:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0508;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < (byte)pcVar11[1];
if (ch != pcVar11[1]) goto LAB_007e0503;
strCursor = strCursor + 2;
pcVar11 = pcVar11 + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0508:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
valueLength = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((pbVar8 + 1))));
if (GHIDRA_CAST<std_string *>((0x7fffffff - rootSize)) < valueLength) goto LAB_007e1407;
strBuffer = GHIDRA_CAST<byte *******>(rootPath);
if (0xf < rootCapacity) {
strBuffer = rootPath[0];
}
(GHIDRA_CAST<std::string *>((joinedPath._buf)))->std::string::concat(GHIDRA_INT(fStack_10224),valueLength,
GHIDRA_CAST<byte *>(strBuffer),rootSize,pbVar8,GHIDRA_UINT(valueLength));
tempStringFlags = tempStringFlags | 4;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 8;
ModManager::TryRedirectPath
(&manager->_modManager,GHIDRA_CAST<std_string *>(redirectedLayerIntro),&joinedPath);
if (&trackLayerIntro != extraout_EAX_01) {
if ((void *)0xf < trackLayerIntroCapacity) {
uVar2 = GHIDRA_INT(trackLayerIntroCapacity) + 1;
pvVar5 = trackLayerIntro;
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(trackLayerIntro) + -4);
uVar2 = GHIDRA_INT(trackLayerIntroCapacity) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(trackLayerIntro) + (-4 - GHIDRA_INT(pvVar5)))))
goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
trackLayerIntro = *extraout_EAX_01;
pvStack_9c = extraout_EAX_01[1];
pvStack_98 = extraout_EAX_01[2];
pvStack_94 = extraout_EAX_01[3];
trackLayerIntroSize = extraout_EAX_01[4];
trackLayerIntroCapacity = extraout_EAX_01[5];
extraout_EAX_01[4] = (void *)0x0;
extraout_EAX_01[5] = (void *)0xf;
*GHIDRA_CAST<undefined1 *>(extraout_EAX_01) = 0;
}
if (0xf < redirectedLayerIntroCapacity) {
uVar2 = redirectedLayerIntroCapacity + 1;
pvVar5 = redirectedLayerIntro[0];
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_INT(redirectedLayerIntro[0]) + -4);
uVar2 = redirectedLayerIntroCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedLayerIntro[0]) + (-4 - GHIDRA_INT(pvVar5)))))
goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
redirectedLayerIntroSize = 0;
redirectedLayerIntroCapacity = 0xf;
redirectedLayerIntro[0] = (void *)(GHIDRA_UINT(redirectedLayerIntro[0]) & 0xffffff00);
goto LAB_007e028f;
}
pcVar11 = "layer";
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < (byte)*pcVar11;
if (ch != *pcVar11) {
LAB_007e0680:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0685;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < (byte)pcVar11[1];
if (ch != pcVar11[1]) goto LAB_007e0680;
strCursor = strCursor + 2;
pcVar11 = pcVar11 + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0685:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
valueLength = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((pbVar8 + 1))));
if (GHIDRA_CAST<std_string *>((0x7fffffff - rootSize)) < valueLength) {
LAB_007e1407:
/* WARNING: Subroutine does not return */
std::string::_Xlen();
}
strBuffer = GHIDRA_CAST<byte *******>(rootPath);
if (0xf < rootCapacity) {
strBuffer = rootPath[0];
}
(GHIDRA_CAST<std::string *>((joinedPath._buf)))->std::string::concat(GHIDRA_INT(fStack_10224),valueLength,
GHIDRA_CAST<byte *>(strBuffer),rootSize,pbVar8,GHIDRA_UINT(valueLength));
tempStringFlags = tempStringFlags | 8;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 9;
ModManager::TryRedirectPath
(&manager->_modManager,GHIDRA_CAST<std_string *>(redirectedLayerPath),&joinedPath);
if (&trackLayerPath != extraout_EAX_02) {
if ((void *)0xf < trackLayerPathCapacity) {
uVar2 = GHIDRA_INT(trackLayerPathCapacity) + 1;
pvVar5 = trackLayerPath;
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(trackLayerPath) + -4);
uVar2 = GHIDRA_INT(trackLayerPathCapacity) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(trackLayerPath) + (-4 - GHIDRA_INT(pvVar5)))))
goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
trackLayerPath = *extraout_EAX_02;
pvStack_84 = extraout_EAX_02[1];
pvStack_80 = extraout_EAX_02[2];
pvStack_7c = extraout_EAX_02[3];
trackLayerPathSize = extraout_EAX_02[4];
trackLayerPathCapacity = extraout_EAX_02[5];
extraout_EAX_02[4] = (void *)0x0;
extraout_EAX_02[5] = (void *)0xf;
*GHIDRA_CAST<undefined1 *>(extraout_EAX_02) = 0;
}
if (0xf < redirectedLayerPathCapacity) {
uVar2 = redirectedLayerPathCapacity + 1;
pvVar5 = redirectedLayerPath[0];
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_INT(redirectedLayerPath[0]) + -4);
uVar2 = redirectedLayerPathCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedLayerPath[0]) + (-4 - GHIDRA_INT(pvVar5)))))
goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
redirectedLayerPathSize = 0;
redirectedLayerPathCapacity = 0xf;
redirectedLayerPath[0] = (void *)(GHIDRA_UINT(redirectedLayerPath[0]) & 0xffffff00);
goto LAB_007e028f;
}
literalCursor = &DAT_00b6be9c;
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < *literalCursor;
if (ch != *literalCursor) {
LAB_007e07f4:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e07f9;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < literalCursor[1];
if (ch != literalCursor[1]) goto LAB_007e07f4;
strCursor = strCursor + 2;
literalCursor = literalCursor + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e07f9:
if (uVar2 != 0) {
pcVar11 = "layermode";
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < (byte)*pcVar11;
if (ch != *pcVar11) {
LAB_007e0984:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0989;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < (byte)pcVar11[1];
if (ch != pcVar11[1]) goto LAB_007e0984;
strCursor = strCursor + 2;
pcVar11 = pcVar11 + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0989:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
layerMode = (*atoiFn)(pbVar8);
loopAndLayerMode = CONCAT11(layerMode,(undefined1)loopAndLayerMode);
}
else {
literalCursor = &DAT_00b6be40;
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < *literalCursor;
if (ch != *literalCursor) {
LAB_007e09e0:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e09e5;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < literalCursor[1];
if (ch != literalCursor[1]) goto LAB_007e09e0;
strCursor = strCursor + 2;
literalCursor = literalCursor + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e09e5:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
dVar13 = atof(GHIDRA_CAST<char *>(pbVar8));
volumeMul = (float)dVar13;
}
else {
pcVar11 = "layermul";
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < (byte)*pcVar11;
if (ch != *pcVar11) {
LAB_007e0a40:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0a45;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < (byte)pcVar11[1];
if (ch != pcVar11[1]) goto LAB_007e0a40;
strCursor = strCursor + 2;
pcVar11 = pcVar11 + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0a45:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
dVar13 = atof(GHIDRA_CAST<char *>(pbVar8));
trackLayerMul = (float)dVar13;
}
else {
pcVar11 = "layerfadespeed";
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < (byte)*pcVar11;
if (ch != *pcVar11) {
LAB_007e0aa0:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0aa5;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < (byte)pcVar11[1];
if (ch != pcVar11[1]) goto LAB_007e0aa0;
strCursor = strCursor + 2;
pcVar11 = pcVar11 + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0aa5:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
dVar13 = atof(GHIDRA_CAST<char *>(pbVar8));
fadeSpeed = (float)dVar13;
}
}
}
}
goto LAB_007e02cd;
}
loopText[0] = GHIDRA_CAST<int *******>(0x0);
loopTextSize = 0;
loopTextCapacity = 0xf;
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((pbStack_10214 + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((pbStack_10214 + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(loopText))))->std::string::assign(pbVar8,GHIDRA_INT(strCursor) - GHIDRA_INT((pbVar8 + 1)));
if (loopTextSize == 0) {
LAB_007e0901:
loopAndLayerMode = loopAndLayerMode & 0xff00;
}
else {
loopChars = GHIDRA_CAST<int *******>(loopText);
if (0xf < loopTextCapacity) {
loopChars = loopText[0];
}
if (loopTextSize == 4) {
if ((*loopChars == GHIDRA_CAST<int ******>(0x65757274)) ||
((((ch = (byte)*loopChars, isLess = ch < 0x74, ch == 0x74 &&
(isLess = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 1)) < 0x72,
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 1)) == 0x72)) &&
(isLess = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 2)) < 0x75,
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 2)) == 0x75)) &&
(isLess = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 3)) < 0x65,
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 3)) == 0x65)))) {
uVar2 = 0;
}
else {
uVar2 = -GHIDRA_UINT(isLess) | 1;
}
if (uVar2 != 0) goto LAB_007e0899;
}
else {
LAB_007e0899:
loopChars = GHIDRA_CAST<int *******>(loopText);
if (0xf < loopTextCapacity) {
loopChars = loopText[0];
}
if (loopTextSize == 4) {
if ((*loopChars == GHIDRA_CAST<int ******>(0x65757254)) ||
(((ch = (byte)*loopChars, isLess = ch < 0x54, ch == 0x54 &&
(isLess = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 1)) < 0x72,
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 1)) == 0x72)) &&
((isLess = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 2)) < 0x75,
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 2)) == 0x75 &&
(isLess = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 3)) < 0x65,
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(loopChars) + 3)) == 0x65)))))) {
uVar2 = 0;
}
else {
uVar2 = -GHIDRA_UINT(isLess) | 1;
}
if (uVar2 == 0) goto LAB_007e08f8;
}
loopChars = GHIDRA_CAST<int *******>(loopText);
if (0xf < loopTextCapacity) {
loopChars = loopText[0];
}
iVar4 = atoi(GHIDRA_CAST<char *>(loopChars));
if (iVar4 == 0) goto LAB_007e0901;
}
LAB_007e08f8:
loopAndLayerMode = CONCAT11((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(loopAndLayerMode)) + 0x1))),1);
}
if (0xf < loopTextCapacity) {
uVar2 = loopTextCapacity + 1;
loopChars = loopText[0];
if (0xfff < uVar2) {
loopChars = GHIDRA_CAST<int *******>(loopText[0][-1]);
uVar2 = loopTextCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(loopText[0]) + (-4 - GHIDRA_INT(loopChars))))) goto LAB_007e13a8;
}
operator_delete(loopChars,uVar2);
}
loopTextSize = 0;
loopTextCapacity = 0xf;
loopText[0] = GHIDRA_CAST<int *******>((GHIDRA_UINT(loopText[0]) & 0xffffff00));
}
atoiFn = atoi_exref;
}
}
LAB_007e02cd:
} while ((*GHIDRA_CAST<int *>((pbStack_10214 + 0x10)) != 0) &&
(pbStack_10214 = *GHIDRA_CAST<byte **>((pbStack_10214 + 0x18)), pbStack_10214 != GHIDRA_CAST<byte *>(0x0)));
if (trackLayerPathSize != (void *)0x0) {
std::vector<52byte>::_Emplace_reallocate(0,&trackLayerIntro);
MStack_10228 = layersCapacity;
MStack_10218 = layersBegin;
}
}
pcVar11 = "layer";
do {
layerLiteralEnd = pcVar11;
pcVar11 = layerLiteralEnd + 1;
} while (*pcVar11 != '\0');
for (pbStack_10214 = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MStack_10220) + 0x18)); pbStack_10214 != GHIDRA_CAST<byte *>(0x0);
pbStack_10214 = *GHIDRA_CAST<byte **>((pbStack_10214 + 0x2c))) {
pbVar8 = *GHIDRA_CAST<byte **>(pbStack_10214);
if (pbVar8 == GHIDRA_CAST<byte *>(0x0)) {
pcVar11 = GHIDRA_CAST<char *>(0x0);
pbVar8 = &g_xmlNullStr;
}
else {
pcVar11 = *GHIDRA_CAST<char **>((pbStack_10214 + 8));
}
if (pcVar11 == layerLiteralEnd + -0xb69bd7) {
strCursor = GHIDRA_CAST<byte *>((pcVar11 + GHIDRA_INT(pbVar8)));
if (strCursor <= pbVar8) goto LAB_007e0b23;
iVar4 = GHIDRA_INT("layer") - GHIDRA_INT(pbVar8);
while (*pbVar8 == pbVar8[iVar4]) {
pbVar8 = pbVar8 + 1;
if (strCursor <= pbVar8) goto LAB_007e0b23;
}
}
}
pbStack_10214 = GHIDRA_CAST<byte *>(0x0);
LAB_007e0b23:
if (pbStack_10214 != GHIDRA_CAST<byte *>(0x0)) {
do {
MVar3 = layersEnd;
newLayerIntroSize = 0;
newLayerIntroCapacity = 0xf;
newLayerIntro[0] = (void *)0x0;
newLayerPathSize = 0;
newLayerPathCapacity = 0xf;
newLayerPath = (void *)0x0;
newLayerMul = 0x3f800000;
ehState = GHIDRA_CAST<byte ******>(CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),0xb));
if (layersEnd == MStack_10228) {
FUN_007e28f0(layersEnd,newLayerIntro);
MStack_10228 = layersCapacity;
}
else {
FUN_007e2870();
layersEnd = (Music)(GHIDRA_INT(MVar3) + 0x34);
}
MVar3 = layersEnd;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
if (0xf < newLayerPathCapacity) {
uVar2 = newLayerPathCapacity + 1;
pvVar5 = newLayerPath;
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(newLayerPath) + -4);
uVar2 = newLayerPathCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(newLayerPath) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
if (0xf < newLayerIntroCapacity) {
uVar2 = newLayerIntroCapacity + 1;
pvVar5 = newLayerIntro[0];
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_INT(newLayerIntro[0]) + -4);
uVar2 = newLayerIntroCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(newLayerIntro[0]) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
MStack_10218 = *GHIDRA_CAST<Music *>((pbStack_10214 + 0x20));
if (MStack_10218 != (Music)0x0) {
do {
manager = g_manager;
pbVar8 = *GHIDRA_CAST<byte **>(MStack_10218);
pcVar11 = "intro";
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < (byte)*pcVar11;
if (ch != *pcVar11) {
LAB_007e0c98:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0c9d;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < (byte)pcVar11[1];
if (ch != pcVar11[1]) goto LAB_007e0c98;
strCursor = strCursor + 2;
pcVar11 = pcVar11 + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0c9d:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MStack_10218) + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MStack_10218) + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
valueLength = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((pbVar8 + 1))));
if (GHIDRA_CAST<std_string *>((0x7fffffff - rootSize)) < valueLength) goto LAB_007e1407;
strBuffer = GHIDRA_CAST<byte *******>(rootPath);
if (0xf < rootCapacity) {
strBuffer = rootPath[0];
}
(GHIDRA_CAST<std::string *>((joinedPath._buf)))->std::string::concat(GHIDRA_INT(fStack_10224),valueLength,GHIDRA_CAST<byte *>(strBuffer),
rootSize,pbVar8,GHIDRA_UINT(valueLength));
tempStringFlags = tempStringFlags | 0x10;
ehState = GHIDRA_CAST<byte ******>(CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),0xc));
ModManager::TryRedirectPath
(&manager->_modManager,&redirectedNewLayerIntro,&joinedPath);
MVar3 = layersEnd;
piVar12 = GHIDRA_CAST<int *>((GHIDRA_INT(layersEnd) + -0x34));
if (piVar12 != extraout_EAX_03) {
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(piVar12))))->std::string::_Tidy_deallocate();
iVar4 = extraout_EAX_03[1];
bufWord2 = extraout_EAX_03[2];
bufWord3 = extraout_EAX_03[3];
*piVar12 = *extraout_EAX_03;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0x30)) = iVar4;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0x2c)) = bufWord2;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0x28)) = bufWord3;
iVar4 = extraout_EAX_03[5];
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0x24)) = extraout_EAX_03[4];
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0x20)) = iVar4;
extraout_EAX_03[4] = 0;
extraout_EAX_03[5] = 0xf;
*GHIDRA_CAST<undefined1 *>(extraout_EAX_03) = 0;
}
valueLength = &redirectedNewLayerIntro;
LAB_007e0e57:
(GHIDRA_CAST<std::string *>((valueLength->_buf)))->std::string::_Tidy_deallocate();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
(GHIDRA_CAST<std::string *>((joinedPath._buf)))->std::string::_Tidy_deallocate();
}
else {
literalCursor = &DAT_00b66e0c;
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < *literalCursor;
if (ch != *literalCursor) {
LAB_007e0d90:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0d95;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < literalCursor[1];
if (ch != literalCursor[1]) goto LAB_007e0d90;
strCursor = strCursor + 2;
literalCursor = literalCursor + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0d95:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MStack_10218) + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MStack_10218) + 4));
}
strCursor = pbVar8;
do {
ch = *strCursor;
strCursor = strCursor + 1;
} while (ch != 0);
valueLength = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((pbVar8 + 1))));
if (valueLength <= GHIDRA_CAST<std_string *>((0x7fffffff - rootSize))) {
strBuffer = GHIDRA_CAST<byte *******>(rootPath);
if (0xf < rootCapacity) {
strBuffer = rootPath[0];
}
(GHIDRA_CAST<std::string *>((joinedPath._buf)))->std::string::concat(GHIDRA_INT(fStack_10224),valueLength,
GHIDRA_CAST<byte *>(strBuffer),rootSize,pbVar8,GHIDRA_UINT(valueLength));
tempStringFlags = tempStringFlags | 0x20;
ehState = GHIDRA_CAST<byte ******>(CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),0xd));
ModManager::TryRedirectPath
(&manager->_modManager,&redirectedNewLayerPath,&joinedPath);
MVar3 = layersEnd;
piVar12 = GHIDRA_CAST<int *>((GHIDRA_INT(layersEnd) + -0x1c));
if (piVar12 != extraout_EAX_04) {
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(piVar12))))->std::string::_Tidy_deallocate();
iVar4 = extraout_EAX_04[1];
bufWord2 = extraout_EAX_04[2];
bufWord3 = extraout_EAX_04[3];
*piVar12 = *extraout_EAX_04;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0x18)) = iVar4;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0x14)) = bufWord2;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0x10)) = bufWord3;
iVar4 = extraout_EAX_04[5];
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -0xc)) = extraout_EAX_04[4];
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MVar3) + -8)) = iVar4;
extraout_EAX_04[4] = 0;
extraout_EAX_04[5] = 0xf;
*GHIDRA_CAST<undefined1 *>(extraout_EAX_04) = 0;
}
valueLength = &redirectedNewLayerPath;
goto LAB_007e0e57;
}
goto LAB_007e1407;
}
literalCursor = &DAT_00b6be40;
strCursor = &g_xmlNullStr;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
strCursor = pbVar8;
}
do {
ch = *strCursor;
isLess = ch < *literalCursor;
if (ch != *literalCursor) {
LAB_007e0ea0:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_007e0ea5;
}
if (ch == 0) break;
ch = strCursor[1];
isLess = ch < literalCursor[1];
if (ch != literalCursor[1]) goto LAB_007e0ea0;
strCursor = strCursor + 2;
literalCursor = literalCursor + 2;
} while (ch != 0);
uVar2 = 0;
LAB_007e0ea5:
if (uVar2 == 0) {
pbVar8 = &g_xmlNullStr;
if (*GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MStack_10218) + 4)) != GHIDRA_CAST<byte *>(0x0)) {
pbVar8 = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(MStack_10218) + 4));
}
dVar13 = atof(GHIDRA_CAST<char *>(pbVar8));
fStack_10224 = (float)dVar13;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(MVar3) + -4)) = fStack_10224;
}
}
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(MStack_10218) + 0x10)) == 0) ||
(MStack_10218 = *GHIDRA_CAST<Music *>((GHIDRA_CAST<char *>(MStack_10218) + 0x18)), MStack_10218 == (Music)0x0))
break;
MVar3 = layersEnd;
} while( true );
}
pbStack_10214 = *GHIDRA_CAST<byte **>((pbStack_10214 + 0x2c));
} while (pbStack_10214 != GHIDRA_CAST<byte *>(0x0));
MStack_10218 = layersBegin;
}
if (MStack_10218 != layersEnd) {
pbVar8 = GHIDRA_CAST<byte *>(((GHIDRA_INT(layersEnd) - GHIDRA_INT(MStack_10218)) / 0x34));
fStack_10224 = 0.0;
uVar2 = -GHIDRA_UINT((GHIDRA_INT((ZEXT48(pbVar8) * 0x34 >> 0x20)) != 0)) | GHIDRA_UINT((ZEXT48(pbVar8) * 0x34));
pbStack_10214 = pbVar8;
layerCount = pbVar8;
layerAlloc = operator_new_tracked(-GHIDRA_UINT((0xfffffffb < uVar2)) | uVar2 + 4);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xe;
if (layerAlloc == GHIDRA_CAST<undefined4 *>(0x0)) {
layerArray = GHIDRA_CAST<undefined4 *>(0x0);
}
else {
layerArray = layerAlloc + 1;
*layerAlloc = pbVar8;
_eh_vector_constructor_iterator_
(layerArray,0x34,GHIDRA_UINT(pbVar8),GHIDRA_CAST<_func_void_void_ptr *>(&LAB_007df270),FUN_007e1430)
;
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
layers = layerArray;
if (pbVar8 != GHIDRA_CAST<byte *>(0x0)) {
layerDst = layerArray + 6;
puVar10 = GHIDRA_CAST<uint *>((GHIDRA_INT(MStack_10218) + 0x2c));
do {
if (layerDst != puVar10 + -5) {
srcChars = puVar10 + -0xb;
if (0xf < puVar10[-6]) {
srcChars = GHIDRA_CAST<uint *>(*srcChars);
}
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((layerDst + -6)))))->std::string::assign(GHIDRA_CAST<byte *>(srcChars),puVar10[-7]);
srcChars = puVar10 + -5;
if (0xf < *puVar10) {
srcChars = GHIDRA_CAST<uint *>(*srcChars);
}
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(layerDst))))->std::string::assign(GHIDRA_CAST<byte *>(srcChars),puVar10[-1]);
}
srcChars = puVar10 + 1;
puVar10 = puVar10 + 0xd;
layerDst[6] = *srcChars;
layerDst = layerDst + 0xd;
pbStack_10214 = pbStack_10214 + -1;
} while (pbStack_10214 != GHIDRA_CAST<byte *>(0x0));
}
}
if (ismod == 0) {
if (trackId - 1U < 0x77) {
iVar4 = trackId * 0x60;
pvVar5 = *(void **)(GHIDRA_INT(this[199]) + 0x58 + iVar4);
if (pvVar5 != (void *)0x0) {
puVar10 = GHIDRA_CAST<uint *>((GHIDRA_INT(pvVar5) + -4));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xf;
_eh_vector_destructor_iterator_(pvVar5,0x34,*puVar10,FUN_007e1430);
operator_delete(puVar10,*puVar10 * 0x34 + 4);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this[199]) + 0x58 + iVar4)) = 0;
}
piVar12 = GHIDRA_CAST<int *>((GHIDRA_INT(this[199]) + iVar4));
*piVar12 = trackId;
if (GHIDRA_CAST<byte ********>((piVar12 + 1)) != trackName) {
strBuffer = GHIDRA_CAST<byte *******>(trackName);
if (0xf < trackNameCapacity) {
strBuffer = trackName[0];
}
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((piVar12 + 1)))))->std::string::assign(GHIDRA_CAST<byte *>(strBuffer),trackNameSize);
}
if (GHIDRA_CAST<byte ********>((piVar12 + 7)) != &introPath) {
strBuffer = GHIDRA_CAST<byte *******>(&introPath);
if (GHIDRA_CAST<byte ******>(0xf) < introPathCapacity) {
strBuffer = introPath;
}
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((piVar12 + 7)))))->std::string::assign(GHIDRA_CAST<byte *>(strBuffer),GHIDRA_UINT(introPathSize));
}
if (GHIDRA_CAST<byte ********>((piVar12 + 0xd)) != &trackPath) {
strBuffer = GHIDRA_CAST<byte *******>(&trackPath);
if (GHIDRA_CAST<byte ******>(0xf) < trackPathCapacity) {
strBuffer = trackPath;
}
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((piVar12 + 0xd)))))->std::string::assign(GHIDRA_CAST<byte *>(strBuffer),GHIDRA_UINT(trackPathSize));
}
*GHIDRA_CAST<undefined1 *>((piVar12 + 0x13)) = (undefined1)loopAndLayerMode;
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(piVar12) + 0x4d)) = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(loopAndLayerMode)) + 0x1)));
piVar12[0x14] = GHIDRA_INT(volumeMul);
piVar12[0x16] = GHIDRA_INT(layers);
piVar12[0x15] = GHIDRA_INT(fadeSpeed);
piVar12[0x17] = GHIDRA_INT(layerCount);
}
}
else {
MVar3 = this[200];
trackId = (GHIDRA_INT(MVar3) - GHIDRA_INT(this[199])) / 0x60;
if (MVar3 == this[0xc9]) {
FUN_007e2c90(MVar3,&trackId);
}
else {
FUN_007e2bf0();
this[200] = (Music)(GHIDRA_INT(this[200]) + 0x60);
}
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 4;
if ((void *)0xf < trackLayerPathCapacity) {
uVar2 = GHIDRA_INT(trackLayerPathCapacity) + 1;
pvVar5 = trackLayerPath;
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(trackLayerPath) + -4);
uVar2 = GHIDRA_INT(trackLayerPathCapacity) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(trackLayerPath) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
if ((void *)0xf < trackLayerIntroCapacity) {
uVar2 = GHIDRA_INT(trackLayerIntroCapacity) + 1;
pvVar5 = trackLayerIntro;
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(trackLayerIntro) + -4);
uVar2 = GHIDRA_INT(trackLayerIntroCapacity) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(trackLayerIntro) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_007e13a8;
}
operator_delete(pvVar5,uVar2);
}
MVar1 = layersEnd;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 3;
MVar3 = MStack_10218;
if (MStack_10218 != (Music)0x0) {
for (; MVar3 != MVar1; MVar3 = (Music)(GHIDRA_INT(MVar3) + 0x34)) {
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(MVar3) + 0x18)))))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(MVar3))))->std::string::_Tidy_deallocate();
}
uVar2 = ((GHIDRA_INT(MStack_10228) - GHIDRA_INT(MStack_10218)) / 0x34) * 0x34;
MVar3 = MStack_10218;
if (0xfff < uVar2) {
MVar3 = *GHIDRA_CAST<Music *>((GHIDRA_CAST<char *>(MStack_10218) + -4));
uVar2 = uVar2 + 0x23;
if (0x1f < (GHIDRA_INT(MStack_10218) - GHIDRA_INT(MVar3)) - 4U) goto LAB_007e13a8;
}
operator_delete((void *)MVar3,uVar2);
layersBegin = (Music)0x0;
layersEnd = (Music)0x0;
layersCapacity = (Music)0x0;
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 2;
if (GHIDRA_CAST<byte ******>(0xf) < trackPathCapacity) {
freeSize = GHIDRA_CAST<byte ******>((GHIDRA_INT(trackPathCapacity) + 1));
strBuffer = trackPath;
if (GHIDRA_CAST<byte ******>(0xfff) < freeSize) {
strBuffer = GHIDRA_CAST<byte *******>(trackPath[-1]);
freeSize = trackPathCapacity + 9;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(trackPath) + (-4 - GHIDRA_INT(strBuffer))))) goto LAB_007e13a8;
}
operator_delete(strBuffer,GHIDRA_UINT(freeSize));
}
if (GHIDRA_CAST<byte ******>(0xf) < introPathCapacity) {
freeSize = GHIDRA_CAST<byte ******>((GHIDRA_INT(introPathCapacity) + 1));
strBuffer = introPath;
if (GHIDRA_CAST<byte ******>(0xfff) < freeSize) {
strBuffer = GHIDRA_CAST<byte *******>(introPath[-1]);
freeSize = introPathCapacity + 9;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(introPath) + (-4 - GHIDRA_INT(strBuffer))))) goto LAB_007e13a8;
}
operator_delete(strBuffer,GHIDRA_UINT(freeSize));
}
if (0xf < trackNameCapacity) {
uVar2 = trackNameCapacity + 1;
strBuffer = trackName[0];
if (0xfff < uVar2) {
strBuffer = GHIDRA_CAST<byte *******>(trackName[0][-1]);
uVar2 = trackNameCapacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(trackName[0]) + (-4 - GHIDRA_INT(strBuffer))))) goto LAB_007e13a8;
}
operator_delete(strBuffer,uVar2);
}
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
if (0xf < rootCapacity) {
uVar2 = rootCapacity + 1;
strBuffer = rootPath[0];
if (0xfff < uVar2) {
strBuffer = GHIDRA_CAST<byte *******>(rootPath[0][-1]);
uVar2 = rootCapacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(rootPath[0]) + (-4 - GHIDRA_INT(strBuffer))))) {
LAB_007e13a8:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(strBuffer,uVar2);
}
ehState = GHIDRA_CAST<byte ******>(0x10);
(GHIDRA_CAST<xml_memory_pool *>((xmlPool)))->xml_memory_pool::clear();
ehState = GHIDRA_CAST<byte ******>(0x11);
tracked_alloc(1,pMStack_1022c,0);
}
ExceptionList = savedExceptionList;
return;
}
// 007e17b0
void Music::Update()
{
Music *channel = this;
byte isInTimedSet;
Game *game;
char isPitchChanged;
Music *channel;
Manager *manager;
double dVar1;
Music MVar2;
float fVar3;
undefined1 local_3c [8];
void *seedEffectNode;
double local_30;
void **local_28;
Music musicVolume;
MusicChannel *local_1c;
void **local_18;
char local_11;
DAT_00c7167c = (g_manager->_optionsConfig)._sfxVolume;
FUN_007e15a0(1);
fVar3 = 1.0;
if ((*GHIDRA_CAST<char *>((channel + 0xd5)) == '\0') || (GHIDRA_INT(channel[0xd9]) < 1)) {
MVar2 = channel[0xd8];
if (channel[0xd9] == (Music)0xffffff9c) {
MVar2 = (Music)((1.0 - (float)MVar2) * 0.04 + (float)MVar2);
}
else if (0.033333335 < ABS((float)MVar2 - 1.0)) {
if (1.0 <= (float)MVar2) {
MVar2 = (Music)((float)MVar2 - 0.033333335);
}
else {
MVar2 = (Music)((float)MVar2 + 0.033333335);
}
}
else {
MVar2 = (Music)0x3f800000;
}
}
else {
channel[0xd9] = (Music)(GHIDRA_INT(channel[0xd9]) + -1);
MVar2 = (Music)((0.1 - (float)channel[0xd8]) * 0.08 + (float)channel[0xd8]);
}
channel[0xd8] = MVar2;
musicVolume = (Music)0x0;
if ((*GHIDRA_CAST<char *>((channel + 0xca)) == '\0') && (g_manager->_state != 3)) {
fVar3 = 0.0;
}
DAT_00c7167c = fVar3 * (float)MVar2;
local_1c = GHIDRA_CAST<MusicChannel *>((channel + 1));
MVar2 = (Music)0x0;
do {
(GHIDRA_CAST<MusicChannel *>((local_1c)))->MusicChannel::update_volume(MVar2 != *channel);
manager = g_manager;
MVar2 = (Music)(GHIDRA_INT(MVar2) + 1);
local_1c = local_1c + 1;
} while (GHIDRA_UINT(MVar2) < 2);
isPitchChanged = '\0';
local_11 = '\0';
if (g_game != GHIDRA_CAST<Game *>(0x0)) {
local_1c = GHIDRA_CAST<MusicChannel *>(&DAT_0000002a);
local_18 = &(g_game->_seedEffects)._seedEffects;
std::set<int>::find_node(&local_30,&local_1c);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(local_28) + 0xd)) == '\0') && (GHIDRA_INT(local_28[4]) < 0x2b)) &&
(local_28 != *local_18)) {
channel[0xc5] = (Music)0x3e19999a;
isPitchChanged = '\x01';
}
else {
local_28 = &(g_game->_seedEffects)._seedEffects;
local_1c = GHIDRA_CAST<MusicChannel *>(0x29);
std::set<int>::find_node(local_3c,&local_1c);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(seedEffectNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(seedEffectNode) + 0x10)) < 0x2a)) && (seedEffectNode != *local_18)) {
channel[0xc5] = (Music)0x3f400000;
isPitchChanged = '\x01';
}
else {
local_1c = GHIDRA_CAST<MusicChannel *>(&DAT_0000002b);
std::set<int>::find_node(local_3c,&local_1c);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(seedEffectNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(seedEffectNode) + 0x10)) < 0x2c)) && (seedEffectNode != *local_18)) {
channel[0xc5] = (Music)0x3fa00000;
isPitchChanged = '\x01';
}
else {
isInTimedSet = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x2c);
if (isInTimedSet == 0) {
isPitchChanged = local_11;
}
else {
channel[0xc5] = (Music)0x40200000;
isPitchChanged = '\x01';
}
}
}
}
if (manager->_state == 2) {
if (g_game->_dizzyIntensity <= 0.0) {
MVar2 = channel[0xc5];
game = g_game;
}
else {
local_30 = (double)manager->_framecount * 0.05000000074505806;
local_1c = GHIDRA_CAST<MusicChannel *>(log_precise((float)channel[0xc5]));
fVar3 = log_precise(2.0);
local_1c = GHIDRA_CAST<MusicChannel *>(((float)local_1c / fVar3));
dVar1 = local_30 * 0.8;
libm_sse2_sin_precise();
local_18 = (void **)((float)dVar1 * 0.4);
dVar1 = local_30;
libm_sse2_sin_precise();
local_18 = (void **)((float)local_18 + (float)dVar1 * 0.2);
dVar1 = local_30 * 0.37;
libm_sse2_sin_precise();
MVar2 = (Music)pow(2.0,((float)local_18 + (float)dVar1 * 0.4) *
g_game->_dizzyIntensity * 0.05 + (float)local_1c);
game = g_game;
channel[0xc5] = MVar2;
isPitchChanged = '\x01';
}
if ((*GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(game->_room) + 4)) + 0x44)) >> 10 & 1) != 0) {
local_30 = (double)manager->_framecount * 0.009999999776482582;
local_18 = (void **)log_precise((float)MVar2);
fVar3 = log_precise(2.0);
local_18 = (void **)((float)local_18 / fVar3);
dVar1 = local_30 * 0.8;
libm_sse2_sin_precise();
local_1c = GHIDRA_CAST<MusicChannel *>(((float)dVar1 * 0.4));
dVar1 = local_30;
libm_sse2_sin_precise();
local_1c = GHIDRA_CAST<MusicChannel *>(((float)local_1c + (float)dVar1 * 0.2));
dVar1 = local_30 * 0.37;
libm_sse2_sin_precise();
MVar2 = (Music)pow(2.0,(float)local_18 + ((float)local_1c + (float)dVar1 * 0.4) * 0.002);
channel[0xc5] = MVar2;
isPitchChanged = '\x01';
}
}
}
fVar3 = (float)channel[0xc6] - (float)channel[0xc5];
if (ABS(fVar3) <= 0.001) {
if (isPitchChanged == '\0') goto LAB_007e1c86;
}
else {
channel[0xc5] = (Music)(fVar3 * 0.1 + (float)channel[0xc5]);
}
local_1c = GHIDRA_CAST<MusicChannel *>(0x2);
channel = channel + 1;
do {
SetPitchAll(channel,(float)channel[0xc5]);
channel = channel + 0x61;
local_1c = GHIDRA_CAST<MusicChannel *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_1c[-1])) + 0x183))));
} while (local_1c != GHIDRA_CAST<MusicChannel *>(0x0));
channel[0xd0] = channel[0xc5];
if (channel[0xcb] != (Music)0x0) {
(**(code **)(*GHIDRA_CAST<int *>(channel[0xcb]) + 0x58))(channel[0xc5]);
}
manager = g_manager;
LAB_007e1c86:
if ((*GHIDRA_CAST<char *>((channel + (GHIDRA_INT(*channel) + 1) * 0x61)) == '\0') && (channel[0xc4] != (Music)0x0)) {
if ((manager->_musicManager)._isEnabled != 0) {
musicVolume = (Music)(manager->_optionsConfig)._musicVolume;
}
if (-1 < GHIDRA_INT(channel[0xc4])) {
if (GHIDRA_INT(channel[0xc4]) < (GHIDRA_INT(channel[200]) - GHIDRA_INT(channel[199])) / 0x60) {
Play(channel,GHIDRA_INT(channel[0xc4]),0.0);
channel[GHIDRA_INT(*channel) * 0x61 + 0x5e] = (Music)0x0;
channel[GHIDRA_INT(*channel) * 0x61 + 0x5f] = musicVolume;
channel[GHIDRA_INT(*channel) * 0x61 + 0x60] = (Music)0x3da3d70a;
}
}
channel[0xc4] = (Music)0x0;
}
return;
}
// 007e1d50
void Music::Play(int musicid, float volume)
{
int track;
int channelsLeft;
Music channel;
if ((((-1 < musicid) && (musicid < (GHIDRA_INT(this[200]) - GHIDRA_INT(this[199])) / 0x60)) ||
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Music ID %d out of bounds.\n")), -1 < musicid)) &&
(musicid < (GHIDRA_INT(this[200]) - GHIDRA_INT(this[199])) / 0x60)) {
track = musicid * 0x60 + GHIDRA_INT(this[199]);
if (*GHIDRA_CAST<int *>((track + 0x44)) == 0) {
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[warn] no music for ID %d (%s).\n"));
return;
}
channelsLeft = 2;
do {
FUN_007df600();
channelsLeft = channelsLeft + -1;
} while (channelsLeft != 0);
channel = *this;
this[0xc3] = (Music)musicid;
this[0xc4] = (Music)0x0;
this[GHIDRA_INT(channel) * 0x61 + 0x5f] = (Music)volume;
this[GHIDRA_INT(channel) * 0x61 + 0x5e] = (Music)volume;
MusicChannel::play_track(track);
FUN_007df5b0();
}
return;
}
// 007e2080
void Music::Fadein(uint Id, float Volume, float FadeRate)
{
if ((-1 < GHIDRA_INT(Id)) && (GHIDRA_INT(Id) < (GHIDRA_INT(this[200]) - GHIDRA_INT(this[199])) / 0x60)) {
Play(this,Id,0.0);
this[GHIDRA_INT(*this) * 0x61 + 0x5e] = (Music)0x0;
this[GHIDRA_INT(*this) * 0x61 + 0x5f] = (Music)Volume;
this[GHIDRA_INT(*this) * 0x61 + 0x60] = (Music)FadeRate;
}
return;
}
// 007e2100
void Music::Fadeout(float FadeRate)
{
this[GHIDRA_INT(*this) * 0x61 + 0x5f] = (Music)0x0;
this[GHIDRA_INT(*this) * 0x61 + 0x60] = (Music)FadeRate;
this[0xc4] = (Music)0x0;
return;
}
// 007e2140
void Music::Pause()
{
char cVar1;
int layersLeft;
Music *layerTrack;
int currentSlot;
currentSlot = *GHIDRA_CAST<int *>(this);
if (this[currentSlot * 0x61 + 1] != (Music)0x0) {
cVar1 = (**(code **)(*GHIDRA_CAST<int *>(this[currentSlot * 0x61 + 1]) + 0x28))();
if (cVar1 != '\0') {
if (this[currentSlot * 0x61 + 1] != (Music)0x0) {
cVar1 = (**(code **)(*GHIDRA_CAST<int *>(this[currentSlot * 0x61 + 1]) + 0x38))();
if ((cVar1 != '\0') || ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[currentSlot * 0x61 + 3])) + 0x1))) != '\0')) {
(**(code **)(*GHIDRA_CAST<int *>(this[currentSlot * 0x61 + 1]) + 0x30))();
*GHIDRA_CAST<undefined2 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[currentSlot * 0x61 + 3])) + 0x1)))) = 0x100;
}
}
*GHIDRA_CAST<undefined1 *>((this + currentSlot * 0x61 + 0xb)) = 0;
this[currentSlot * 0x61 + 0xc] = (Music)0x0;
}
}
layerTrack = this + currentSlot * 0x61 + 0xe;
layersLeft = 6;
do {
if (*layerTrack != (Music)0x0) {
cVar1 = (**(code **)(*GHIDRA_CAST<int *>(*layerTrack) + 0x28))();
if (cVar1 != '\0') {
if (*layerTrack != (Music)0x0) {
cVar1 = (**(code **)(*GHIDRA_CAST<int *>(*layerTrack) + 0x38))();
if ((cVar1 != '\0') || ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(layerTrack[2])) + 0x1))) != '\0')) {
(**(code **)(*GHIDRA_CAST<int *>(*layerTrack) + 0x30))();
*GHIDRA_CAST<undefined2 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(layerTrack[2])) + 0x1)))) = 0x100;
}
}
*GHIDRA_CAST<undefined1 *>((layerTrack + 10)) = 0;
layerTrack[0xb] = (Music)0x0;
}
}
layerTrack = layerTrack + 0xd;
layersLeft = layersLeft + -1;
} while (layersLeft != 0);
*GHIDRA_CAST<undefined1 *>((this + currentSlot * 0x61 + 0x61)) =
*GHIDRA_CAST<undefined1 *>((this + currentSlot * 0x61 + 0xb));
return;
}
// 007e21f0
void Music::Resume()
{
char isPaused;
Music *layer;
int layersLeft;
Music channel;
channel = *this;
if (this[GHIDRA_INT(channel) * 0x61 + 1] != (Music)0x0) {
isPaused = (**(code **)(*GHIDRA_CAST<int *>(this[GHIDRA_INT(channel) * 0x61 + 1]) + 0x28))();
if (isPaused != '\0') {
if ((this[GHIDRA_INT(channel) * 0x61 + 1] != (Music)0x0) &&
((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[GHIDRA_INT(channel) * 0x61 + 3])) + 0x2))) != '\0')) {
(**(code **)(*GHIDRA_CAST<int *>(this[GHIDRA_INT(channel) * 0x61 + 1]) + 0x34))();
*GHIDRA_CAST<undefined2 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[GHIDRA_INT(channel) * 0x61 + 3])) + 0x1)))) = 1;
}
*GHIDRA_CAST<undefined1 *>((this + GHIDRA_INT(channel) * 0x61 + 0xb)) = 1;
}
}
layer = this + GHIDRA_INT(channel) * 0x61 + 0xe;
layersLeft = 6;
do {
if (*layer != (Music)0x0) {
isPaused = (**(code **)(*GHIDRA_CAST<int *>(*layer) + 0x28))();
if (isPaused != '\0') {
if ((*layer != (Music)0x0) && ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(layer[2])) + 0x2))) != '\0')) {
(**(code **)(*GHIDRA_CAST<int *>(*layer) + 0x34))();
*GHIDRA_CAST<undefined2 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(layer[2])) + 0x1)))) = 1;
}
*GHIDRA_CAST<undefined1 *>((layer + 10)) = 1;
}
}
layer = layer + 0xd;
layersLeft = layersLeft + -1;
} while (layersLeft != 0);
*GHIDRA_CAST<undefined1 *>((this + GHIDRA_INT(channel) * 0x61 + 0x61)) =
*GHIDRA_CAST<undefined1 *>((this + GHIDRA_INT(channel) * 0x61 + 0xb));
return;
}
// 007e2410
void Music::DisableLayer(int id)
{
if (GHIDRA_UINT(id) < 6) {
this[(GHIDRA_UINT(id) >> 5) + GHIDRA_INT(*this) * 0x61 + 0x5c] =
(Music)(GHIDRA_UINT(this[(GHIDRA_UINT(id) >> 5) + GHIDRA_INT(*this) * 0x61 + 0x5c]) & ~(1 << ((byte)id & 0x1f)))
;
}
return;
}
// 007e2440
byte Music::IsLayerEnabled(uint id)
{
if (id < 6) {
return (GHIDRA_UINT(this[(id >> 5) + GHIDRA_INT(*this) * 0x61 + 0x5c]) & 1 << ((byte)id & 0x1f)) != 0;
}
return 0;
}
// 007e24e0
void Music::ResetPitch()
{
this[0xc5] = (Music)0x3f800000;
this[0xc6] = (Music)0x3f800000;
SetPitchAll(this + GHIDRA_INT(*this) * 0x61 + 1,1.0);
return;
}
// 007e2510
void Music::VolumeSlide(float TargetVolume, float FadeRate)
{
this[GHIDRA_INT(*this) * 0x61 + 0x5f] = (Music)(TargetVolume * (g_manager->_optionsConfig)._musicVolume);
this[GHIDRA_INT(*this) * 0x61 + 0x60] = (Music)FadeRate;
return;
}
// 007e2550
void Music::UpdateVolume()
{
Manager *manager;
manager = g_manager;
this[GHIDRA_INT(*this) * 0x61 + 0x5e] = (Music)(g_manager->_optionsConfig)._musicVolume;
this[GHIDRA_INT(*this) * 0x61 + 0x5f] = (Music)(manager->_optionsConfig)._musicVolume;
return;
}
// 007e2580
void Music::PlayJingle(int musicid, int unusedInt, byte unusedBool)
{
int track;
undefined4 extraout_ECX;
if ((-1 < musicid) && (musicid < (GHIDRA_INT(this[200]) - GHIDRA_INT(this[199])) / 0x60)) {
track = musicid * 0x60 + GHIDRA_INT(this[199]);
if ((this[0xc3] != (Music)0x34) &&
((this[0xc3] != (Music)0x76 && (*GHIDRA_CAST<int *>((track + 0x44)) != 0)))) {
MusicStream::play(track + 0x34,*GHIDRA_CAST<undefined1 *>((track + 0x4c)),this[0xc5]);
FUN_00a2ac00(extraout_ECX);
this[0xd9] = (Music)0x8c;
}
}
return;
}