diff options
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/wii/osystem_events.cpp | 23 | ||||
-rw-r--r-- | backends/platform/wii/osystem_sfx.cpp | 24 |
2 files changed, 27 insertions, 20 deletions
diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp index 4646da8c93..7597bd65db 100644 --- a/backends/platform/wii/osystem_events.cpp +++ b/backends/platform/wii/osystem_events.cpp @@ -117,20 +117,22 @@ void OSystem_Wii::initEvents() { timer_thread_quit = false; timer_stack = (u8 *) memalign(32, TIMER_THREAD_STACKSIZE); - memset(timer_stack, 0, TIMER_THREAD_STACKSIZE); + if (timer_stack) { + memset(timer_stack, 0, TIMER_THREAD_STACKSIZE); - LWP_InitQueue(&timer_queue); + LWP_InitQueue(&timer_queue); - s32 res = LWP_CreateThread(&timer_thread, timer_thread_func, NULL, - timer_stack, TIMER_THREAD_STACKSIZE, - TIMER_THREAD_PRIO); + s32 res = LWP_CreateThread(&timer_thread, timer_thread_func, NULL, + timer_stack, TIMER_THREAD_STACKSIZE, + TIMER_THREAD_PRIO); - if (res) { - printf("ERROR creating timer thread: %d\n", res); - LWP_CloseQueue(timer_queue); - } + if (res) { + printf("ERROR creating timer thread: %d\n", res); + LWP_CloseQueue(timer_queue); + } - timer_thread_running = res == 0; + timer_thread_running = res == 0; + } #ifndef GAMECUBE WPAD_Init(); @@ -151,6 +153,7 @@ void OSystem_Wii::deinitEvents() { LWP_JoinThread(timer_thread, NULL); LWP_CloseQueue(timer_queue); + free(timer_stack); timer_thread_running = false; } diff --git a/backends/platform/wii/osystem_sfx.cpp b/backends/platform/wii/osystem_sfx.cpp index 0a225e80c7..6af6958c32 100644 --- a/backends/platform/wii/osystem_sfx.cpp +++ b/backends/platform/wii/osystem_sfx.cpp @@ -69,20 +69,23 @@ void OSystem_Wii::initSfx() { sfx_thread_quit = false; sfx_stack = (u8 *) memalign(32, SFX_THREAD_STACKSIZE); - memset(sfx_stack, 0, SFX_THREAD_STACKSIZE); - LWP_InitQueue(&sfx_queue); + if (sfx_stack) { + memset(sfx_stack, 0, SFX_THREAD_STACKSIZE); - s32 res = LWP_CreateThread(&sfx_thread, sfx_thread_func, _mixer, sfx_stack, - SFX_THREAD_STACKSIZE, SFX_THREAD_PRIO); + LWP_InitQueue(&sfx_queue); - if (res) { - printf("ERROR creating sfx thread: %d\n", res); - LWP_CloseQueue(sfx_queue); - return; - } + s32 res = LWP_CreateThread(&sfx_thread, sfx_thread_func, _mixer, sfx_stack, + SFX_THREAD_STACKSIZE, SFX_THREAD_PRIO); - sfx_thread_running = true; + if (res) { + printf("ERROR creating sfx thread: %d\n", res); + LWP_CloseQueue(sfx_queue); + return; + } + + sfx_thread_running = true; + } sound_buffer[0] = (u8 *) memalign(32, SFX_THREAD_FRAG_SIZE); sound_buffer[1] = (u8 *) memalign(32, SFX_THREAD_FRAG_SIZE); @@ -116,6 +119,7 @@ void OSystem_Wii::deinitSfx() { LWP_JoinThread(sfx_thread, NULL); LWP_CloseQueue(sfx_queue); + free(sfx_stack); sfx_thread_running = false; free(sound_buffer[0]); |