This commit is contained in:
microsoftv 2024-08-18 18:43:09 -04:00
parent cc1d44a836
commit 807ea7a7f6

View File

@ -12,7 +12,7 @@ using namespace Libraries::Kernel;
namespace Libraries::Ngs2 {
s32 Ngs2::ReportInvalid(u32 handle_type) const {
s32 Ngs2::ReportInvalid(u32 handle_type) const {
switch (handle_type) {
case 1:
LOG_ERROR(Lib_Ngs2, "Invalid system handle {}", this);
@ -30,18 +30,18 @@ namespace Libraries::Ngs2 {
LOG_ERROR(Lib_Ngs2, "Invalid handle {}", this);
return ORBIS_NGS2_ERROR_INVALID_HANDLE;
}
}
}
s32 Ngs2::HandleSetup(Ngs2Handle* handle, void* data, std::atomic<u32>* atomic, u32 type,
s32 Ngs2::HandleSetup(Ngs2Handle* handle, void* data, std::atomic<u32>* atomic, u32 type,
u32 flags) {
handle->dataPointer = data;
handle->atomicPtr = atomic;
handle->handleType = type;
handle->flags_unk = flags;
return ORBIS_OK;
}
}
s32 Ngs2::HandleCleanup(Ngs2Handle* handle, u32 hType, void* dataOut) {
s32 Ngs2::HandleCleanup(Ngs2Handle* handle, u32 hType, void* dataOut) {
if (handle && handle->selfPointer == handle) {
std::atomic<u32>* tmp_atomic = handle->atomicPtr;
if (tmp_atomic && handle->handleType == hType) {
@ -59,9 +59,9 @@ namespace Libraries::Ngs2 {
}
}
return HandleReportInvalid(handle, hType);
}
}
s32 Ngs2::HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut) {
s32 Ngs2::HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut) {
if (!handle) {
return HandleReportInvalid(handle, 0);
}
@ -86,9 +86,9 @@ namespace Libraries::Ngs2 {
*handleOut = handle;
}
return ORBIS_OK;
}
}
s32 Ngs2::HandleLeave(Ngs2Handle* handle) {
s32 Ngs2::HandleLeave(Ngs2Handle* handle) {
std::atomic<u32>* tmp_atomic;
u32 i;
do {
@ -96,9 +96,9 @@ namespace Libraries::Ngs2 {
i = tmp_atomic->load();
} while (!tmp_atomic->compare_exchange_strong(i, i - 1));
return ORBIS_OK;
}
}
s32 Ngs2::StackBufferOpen(StackBuffer* buf, void* base_addr, size_t size, void** stackTop,
s32 Ngs2::StackBufferOpen(StackBuffer* buf, void* base_addr, size_t size, void** stackTop,
bool verify) {
buf->top = stackTop;
buf->base = base_addr;
@ -113,17 +113,17 @@ namespace Libraries::Ngs2 {
}
return ORBIS_OK;
}
}
s32 Ngs2::StackBufferClose(StackBuffer* buf, size_t* usedSize) {
s32 Ngs2::StackBufferClose(StackBuffer* buf, size_t* usedSize) {
if (usedSize) {
*usedSize = buf->usedSize + buf->alignment;
}
return ORBIS_OK;
}
}
s32 Ngs2::SystemSetupCore(StackBuffer* buf, SystemOptions* options, Ngs2Handle** sysOut) {
s32 Ngs2::SystemSetupCore(StackBuffer* buf, SystemOptions* options, Ngs2Handle** sysOut) {
u32 maxGrainSamples = 512;
u32 numGrainSamples = 256;
u32 sampleRate = 48000;
@ -160,6 +160,6 @@ namespace Libraries::Ngs2 {
// TODO
return result; // Success
}
}
} // namespace Libraries::Ngs2