3DS: More error detection for audio

This commit is contained in:
Clownacy 2020-10-20 00:47:38 +01:00
parent 8a560eb873
commit ccd436bce7

View file

@ -94,21 +94,33 @@ static int AllocateChannel(AudioBackend_Sound *sound)
bool AudioBackend_Init(void) bool AudioBackend_Init(void)
{ {
ndspInit(); Result rc = ndspInit();
ndspSetOutputMode(NDSP_OUTPUT_STEREO); if (R_SUCCEEDED(rc))
{
ndspSetOutputMode(NDSP_OUTPUT_STEREO);
LightLock_Init(&organya_mutex); LightLock_Init(&organya_mutex);
s32 priority = 0x30; s32 priority = 0x30;
svcGetThreadPriority(&priority, CUR_THREAD_HANDLE); svcGetThreadPriority(&priority, CUR_THREAD_HANDLE);
priority = CLAMP(priority - 1, 0x18, 0x3F); priority = CLAMP(priority - 1, 0x18, 0x3F);
organya_thread_die = false; organya_thread_die = false;
organya_thread = threadCreate(OrganyaThread, NULL, 32 * 1024, priority, -1, false); organya_thread = threadCreate(OrganyaThread, NULL, 32 * 1024, priority, -1, false);
return true; return true;
}
else
{
if (R_SUMMARY(rc) == RS_NOTFOUND && R_MODULE(rc) == RM_DSP)
Backend_PrintError("Could not load DSP firmware - you might need to dump yours manually");
else
Backend_PrintError("ndspInit failed in AudioBackend_Init");
}
return false;
} }
void AudioBackend_Deinit(void) void AudioBackend_Deinit(void)