#include "classes.h" // 00a2a990 SoundInstance::SoundInstance() { char cVar1; uint32_t uVar2; ReferenceCountBase *refCount; void *local_10; uint8_t *puStack_c; uint32_t local_8; puStack_c = &LAB_00b1203c; local_10 = ExceptionList; uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; ExceptionList = &local_10; *GHIDRA_CAST(this) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 4)) = 0; local_8 = 0; refCount = operator_new(0x18); (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; if (refCount == GHIDRA_CAST(0x0)) { refCount = GHIDRA_CAST(0x0); } else { (GHIDRA_CAST((refCount)))->ReferenceCountBase::ReferenceCountBase(); *GHIDRA_CAST(refCount) = ReferenceCount::vftable; *GHIDRA_CAST((refCount + 0x14)) = 0; } local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; if (*GHIDRA_CAST((GHIDRA_CAST(this) + 4)) != GHIDRA_CAST(0x0)) { cVar1 = (**(code **)(**GHIDRA_CAST((GHIDRA_CAST(this) + 4)) + 0xc))(uVar2); if ((cVar1 != '\0') && (g_soundReleaseFn != (void *)0x0)) { (*g_soundReleaseFn)(this); } } *GHIDRA_CAST((GHIDRA_CAST(this) + 4)) = refCount; *GHIDRA_CAST(this) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 8)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 10)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) = 0x3f800000; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = 0x3f800000; ExceptionList = local_10; return; } // 00a2ac90 void SoundInstance::operator_assign(void *other) { uint32_t uVar1; uint32_t uVar2; char isLastRef; uint32_t loopFlags; uint32_t *swappedSource; uint8_t oldSource [4]; int *oldSourceRefCount; uint8_t sourceCopy [4]; int *sourceCopyRefCount; uint32_t local_1c; uint32_t local_18; void *local_10; uint8_t *puStack_c; uint32_t local_8; uint16_t loopFlags; local_8 = 0xffffffff; puStack_c = &LAB_00b1206d; local_10 = ExceptionList; loopFlags = __security_cookie ^ GHIDRA_UINT((sourceCopy + 0x20)); ExceptionList = &local_10; FUN_008f2d20(other); local_8 = 0; uVar1 = *GHIDRA_CAST((GHIDRA_CAST(other) + 0xc)); loopFlags = *GHIDRA_CAST((GHIDRA_CAST(other) + 8)); local_18 = *GHIDRA_CAST((GHIDRA_CAST(other) + 0x10)); local_1c = *GHIDRA_CAST((GHIDRA_CAST(other) + 0x14)); KAGE::SmartPointer::reset(0); *GHIDRA_CAST((GHIDRA_CAST(this) + 8)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 10)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) = 0x3f800000; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = 0x3f800000; swappedSource = GHIDRA_CAST(FUN_008f2d20(sourceCopy)); uVar2 = swappedSource[1]; swappedSource[1] = *GHIDRA_CAST((GHIDRA_CAST(this) + 4)); *GHIDRA_CAST((GHIDRA_CAST(this) + 4)) = uVar2; uVar2 = *swappedSource; *swappedSource = *GHIDRA_CAST(this); *GHIDRA_CAST(this) = uVar2; local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); if (oldSourceRefCount != GHIDRA_CAST(0x0)) { isLastRef = (**(code **)(*oldSourceRefCount + 0xc))(loopFlags); if ((isLastRef != '\0') && (g_soundReleaseFn != (void *)0x0)) { (*g_soundReleaseFn)(oldSource); } } *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) = uVar1; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) = local_18; *GHIDRA_CAST((GHIDRA_CAST(this) + 8)) = (char)loopFlags; *GHIDRA_CAST((GHIDRA_CAST(this) + 9)) = (char)((uint16_t)loopFlags >> 8); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = local_1c; local_8 = 2; if (sourceCopyRefCount != GHIDRA_CAST(0x0)) { isLastRef = (**(code **)(*sourceCopyRefCount + 0xc))(); if ((isLastRef != '\0') && (g_soundReleaseFn != (void *)0x0)) { (*g_soundReleaseFn)(sourceCopy); } } ExceptionList = local_10; return; } // 00a2add0 void SoundInstance::assign(void *source) { KAGE::SmartPointer::reset(0); *GHIDRA_CAST((GHIDRA_CAST(this) + 8)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 10)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) = 0x3f800000; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = 0x3f800000; FUN_008f2c90(source); if (*GHIDRA_CAST(this) != GHIDRA_CAST(0x0)) { (**(code **)(**GHIDRA_CAST(this) + 0x40))(*GHIDRA_CAST((GHIDRA_CAST(this) + 8))); (**(code **)(**GHIDRA_CAST(this) + 0x48))(*GHIDRA_CAST((GHIDRA_CAST(this) + 0xc))); (**(code **)(**GHIDRA_CAST(this) + 0x50))(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x10))); (**(code **)(**GHIDRA_CAST(this) + 0x58))(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x14))); } return; }