--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>
130 lines
3.8 KiB
C++
130 lines
3.8 KiB
C++
#include "classes.h"
|
|
|
|
// 00a7d2a0
|
|
uint8_t KAGE::Sound::ManagerOpenAL::FUN_00a649b0()
|
|
{
|
|
char cVar1;
|
|
int iVar2;
|
|
void *sources;
|
|
HMODULE hModule;
|
|
int *in_ECX;
|
|
uint32_t *sourceEntry;
|
|
uint32_t sourceOffset;
|
|
WCHAR *lpFilename;
|
|
char *format;
|
|
DWORD nSize;
|
|
uint32_t listenerOrientation;
|
|
uint32_t uStack_24c;
|
|
uint8_t *puStack_248;
|
|
uint32_t uStack_244;
|
|
uint32_t local_240;
|
|
uint32_t local_23c;
|
|
uint32_t contextAttribs;
|
|
uint32_t uStack_234;
|
|
uint32_t uStack_230;
|
|
uint32_t uStack_22c;
|
|
uint32_t local_228;
|
|
uint32_t local_224;
|
|
uint32_t local_220;
|
|
WCHAR dllPath [260];
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b1456a;
|
|
local_10 = ExceptionList;
|
|
local_14 = __security_cookie ^ GHIDRA_UINT((dllPath + 0x10c));
|
|
ExceptionList = &local_10;
|
|
iVar2 = alcOpenDevice(0,local_14);
|
|
in_ECX[0xe] = iVar2;
|
|
if (iVar2 == 0) {
|
|
format = "Failed to open OpenAL device\n";
|
|
}
|
|
else {
|
|
contextAttribs = 0x1991;
|
|
uStack_234 = 0x1402;
|
|
uStack_230 = 0x1990;
|
|
uStack_22c = 0x1501;
|
|
local_228 = 0x19ac;
|
|
local_224 = 0x19ae;
|
|
local_220 = 0;
|
|
iVar2 = alcCreateContext(iVar2,&contextAttribs);
|
|
in_ECX[0xd] = iVar2;
|
|
if (iVar2 == 0) {
|
|
format = "Failed to create OpenAL context\n";
|
|
}
|
|
else {
|
|
cVar1 = alcMakeContextCurrent(iVar2);
|
|
if (cVar1 == '\0') {
|
|
format = "Failed to make current OpenAL context\n";
|
|
}
|
|
else {
|
|
alcProcessContext(in_ECX[0xd]);
|
|
sources = operator_new_tracked(0x300);
|
|
if (sources == (void *)0x0) {
|
|
sources = (void *)0x0;
|
|
}
|
|
else {
|
|
iVar2 = 0x40;
|
|
sourceEntry = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(sources) + 8));
|
|
do {
|
|
sourceEntry[-2] = 0;
|
|
sourceEntry[-1] = 0;
|
|
*sourceEntry = 0;
|
|
iVar2 = iVar2 + -1;
|
|
sourceEntry = sourceEntry + 3;
|
|
} while (iVar2 != 0);
|
|
}
|
|
local_8 = 0xffffffff;
|
|
sourceOffset = 0;
|
|
in_ECX[0xf] = GHIDRA_INT(sources);
|
|
do {
|
|
cVar1 = (**(code **)(*in_ECX + 0x30))
|
|
(in_ECX[0xf] + sourceOffset,in_ECX[0xf] + sourceOffset + 4,1);
|
|
if (cVar1 == '\0') {
|
|
ExceptionList = local_10;
|
|
return 0;
|
|
}
|
|
sourceOffset = sourceOffset + 0xc;
|
|
} while (sourceOffset < 0x300);
|
|
alListener3f(0x1004,0,0,0);
|
|
listenerOrientation = 0;
|
|
uStack_24c = 0;
|
|
puStack_248 = &DAT_bf800000;
|
|
uStack_244 = 0;
|
|
local_240 = 0x3f800000;
|
|
local_23c = 0;
|
|
alListenerfv(0x100f,&listenerOrientation);
|
|
cVar1 = (**(code **)(in_ECX[0x10] + 8))(FUN_00a7da80,3,0x1000);
|
|
if (cVar1 != '\0') {
|
|
nSize = 0x104;
|
|
lpFilename = dllPath;
|
|
hModule = GetModuleHandleW(L"OpenAL32.dll");
|
|
GetModuleFileNameW(hModule,lpFilename,nSize);
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("OpenAL DLL loaded from: %ls\n"));
|
|
alcGetString(in_ECX[0xe],0x1006);
|
|
alGetString(0xb001);
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("OpenAL AL_VENDOR : %s\n"));
|
|
alGetString(0xb003);
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("OpenAL AL_RENDERER : %s\n"));
|
|
alGetString(0xb002);
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("OpenAL AL_VERSION : %s\n"));
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("OpenAL ALC_EXTENSIONS : %s\n"));
|
|
(**(code **)(in_ECX[4] + 4))();
|
|
(**(code **)(in_ECX[10] + 4))();
|
|
in_ECX[1] = in_ECX[1] | 1;
|
|
g_soundReleaseFn = FUN_00a2bb10;
|
|
ExceptionList = local_10;
|
|
return 1;
|
|
}
|
|
format = "Failed to start up OpenAL processing thread\n";
|
|
}
|
|
}
|
|
}
|
|
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>(format));
|
|
ExceptionList = local_10;
|
|
return 0;
|
|
}
|