--check: 938/3256 method bodies compile for x86_64 (28.8%), 32-bit layout asserts hold; boot path 3/626 curated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
132 lines
5.4 KiB
C++
132 lines
5.4 KiB
C++
#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<uint32_t *>(this) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
|
|
local_8 = 0;
|
|
refCount = operator_new(0x18);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
|
|
if (refCount == GHIDRA_CAST<ReferenceCountBase *>(0x0)) {
|
|
refCount = GHIDRA_CAST<ReferenceCountBase *>(0x0);
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<ReferenceCountBase *>((refCount)))->ReferenceCountBase::ReferenceCountBase();
|
|
*GHIDRA_CAST<uint8_t ***>(refCount) = ReferenceCount<KAGE::Sound::SoundSourceBase>::vftable;
|
|
*GHIDRA_CAST<uint32_t *>((refCount + 0x14)) = 0;
|
|
}
|
|
local_8 = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_8))) + 0x1))) << 8;
|
|
if (*GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 4)) != GHIDRA_CAST<int *>(0x0)) {
|
|
cVar1 = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 4)) + 0xc))(uVar2);
|
|
if ((cVar1 != '\0') && (g_soundReleaseFn != (void *)0x0)) {
|
|
(*g_soundReleaseFn)(this);
|
|
}
|
|
}
|
|
*GHIDRA_CAST<ReferenceCountBase **>((GHIDRA_CAST<char *>(this) + 4)) = refCount;
|
|
*GHIDRA_CAST<uint32_t *>(this) = 0;
|
|
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 10)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0xc)) = 0x3f800000;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(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<uint32_t *>((GHIDRA_CAST<char *>(other) + 0xc));
|
|
loopFlags = *GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(other) + 8));
|
|
local_18 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(other) + 0x10));
|
|
local_1c = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(other) + 0x14));
|
|
KAGE::SmartPointer<SoundSourceBase>::reset(0);
|
|
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 10)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0xc)) = 0x3f800000;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x14)) = 0x3f800000;
|
|
swappedSource = GHIDRA_CAST<uint32_t *>(FUN_008f2d20(sourceCopy));
|
|
uVar2 = swappedSource[1];
|
|
swappedSource[1] = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 4));
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 4)) = uVar2;
|
|
uVar2 = *swappedSource;
|
|
*swappedSource = *GHIDRA_CAST<uint32_t *>(this);
|
|
*GHIDRA_CAST<uint32_t *>(this) = uVar2;
|
|
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
|
|
if (oldSourceRefCount != GHIDRA_CAST<int *>(0x0)) {
|
|
isLastRef = (**(code **)(*oldSourceRefCount + 0xc))(loopFlags);
|
|
if ((isLastRef != '\0') && (g_soundReleaseFn != (void *)0x0)) {
|
|
(*g_soundReleaseFn)(oldSource);
|
|
}
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0xc)) = uVar1;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x10)) = local_18;
|
|
*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 8)) = (char)loopFlags;
|
|
*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 9)) = (char)((uint16_t)loopFlags >> 8);
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x14)) = local_1c;
|
|
local_8 = 2;
|
|
if (sourceCopyRefCount != GHIDRA_CAST<int *>(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<SoundSourceBase>::reset(0);
|
|
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 10)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0xc)) = 0x3f800000;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x14)) = 0x3f800000;
|
|
FUN_008f2c90(source);
|
|
if (*GHIDRA_CAST<int **>(this) != GHIDRA_CAST<int *>(0x0)) {
|
|
(**(code **)(**GHIDRA_CAST<int **>(this) + 0x40))(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 8)));
|
|
(**(code **)(**GHIDRA_CAST<int **>(this) + 0x48))(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0xc)));
|
|
(**(code **)(**GHIDRA_CAST<int **>(this) + 0x50))(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x10)));
|
|
(**(code **)(**GHIDRA_CAST<int **>(this) + 0x58))(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x14)));
|
|
}
|
|
return;
|
|
}
|