Fixed broken MIC shutdown code. Use a tmp field for svcControlMemory when not allocating linearmem, in initSystem.c.
This commit is contained in:
parent
a8e08d4138
commit
58192c8683
@ -3,5 +3,3 @@ mic
|
|||||||
|
|
||||||
Example for using the microphone with ctrulib. Hold down the A button to record, the app will then play the recorded audio once the A button is released. Roughly 32 seconds of audio can be recorded with the default audiobuf size in this app.
|
Example for using the microphone with ctrulib. Hold down the A button to record, the app will then play the recorded audio once the A button is released. Roughly 32 seconds of audio can be recorded with the default audiobuf size in this app.
|
||||||
|
|
||||||
Do not use this example(and/or ctrulib MIC?), since MIC is broken currently.
|
|
||||||
|
|
||||||
|
@ -26,16 +26,18 @@ void __destroy_handle_list(void);
|
|||||||
|
|
||||||
void __attribute__((noreturn)) __ctru_exit(int rc)
|
void __attribute__((noreturn)) __ctru_exit(int rc)
|
||||||
{
|
{
|
||||||
|
u32 tmp=0;
|
||||||
|
|
||||||
// Run the global destructors
|
// Run the global destructors
|
||||||
__libc_fini_array();
|
__libc_fini_array();
|
||||||
|
|
||||||
// TODO: APT exit goes here
|
// TODO: APT exit goes here
|
||||||
|
|
||||||
// Unmap the linear heap
|
// Unmap the linear heap
|
||||||
svcControlMemory(&__linear_heap, __linear_heap, 0x0, __linear_heap_size, MEMOP_FREE, 0x0);
|
svcControlMemory(&tmp, __linear_heap, 0x0, __linear_heap_size, MEMOP_FREE, 0x0);
|
||||||
|
|
||||||
// Unmap the application heap
|
// Unmap the application heap
|
||||||
svcControlMemory(&heapBase, heapBase, 0x0, __heap_size, MEMOP_FREE, 0x0);
|
svcControlMemory(&tmp, heapBase, 0x0, __heap_size, MEMOP_FREE, 0x0);
|
||||||
|
|
||||||
// Close some handles
|
// Close some handles
|
||||||
__destroy_handle_list();
|
__destroy_handle_list();
|
||||||
@ -50,13 +52,15 @@ void __attribute__((noreturn)) __ctru_exit(int rc)
|
|||||||
|
|
||||||
void initSystem(void (*retAddr)(void))
|
void initSystem(void (*retAddr)(void))
|
||||||
{
|
{
|
||||||
|
u32 tmp=0;
|
||||||
|
|
||||||
// Register newlib exit() syscall
|
// Register newlib exit() syscall
|
||||||
__syscalls.exit = __ctru_exit;
|
__syscalls.exit = __ctru_exit;
|
||||||
__system_retAddr = __service_ptr ? retAddr : NULL;
|
__system_retAddr = __service_ptr ? retAddr : NULL;
|
||||||
|
|
||||||
// Allocate the application heap
|
// Allocate the application heap
|
||||||
heapBase = 0x08000000;
|
heapBase = 0x08000000;
|
||||||
svcControlMemory(&heapBase, heapBase, 0x0, __heap_size, MEMOP_ALLOC, 0x3);
|
svcControlMemory(&tmp, heapBase, 0x0, __heap_size, MEMOP_ALLOC, 0x3);
|
||||||
|
|
||||||
// Allocate the linear heap
|
// Allocate the linear heap
|
||||||
svcControlMemory(&__linear_heap, 0x0, 0x0, __linear_heap_size, MEMOP_ALLOC_LINEAR, 0x3);
|
svcControlMemory(&__linear_heap, 0x0, 0x0, __linear_heap_size, MEMOP_ALLOC_LINEAR, 0x3);
|
||||||
|
@ -63,9 +63,6 @@ Result MIC_Shutdown()
|
|||||||
|
|
||||||
MIC_cmd5();
|
MIC_cmd5();
|
||||||
|
|
||||||
ret = svcUnmapMemoryBlock(MIC_sharedmem_handle, (u32)MIC_sharedmem);
|
|
||||||
if(ret!=0)return ret;
|
|
||||||
|
|
||||||
ret = svcCloseHandle(MIC_sharedmem_handle);
|
ret = svcCloseHandle(MIC_sharedmem_handle);
|
||||||
if(ret!=0)return ret;
|
if(ret!=0)return ret;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user