Implemented svc_getProcessInfo(), and added comment to CSND.h. Implemented OS_ConvertVaddr2Physaddr() which is now used by CSND.c, this includes support for the v8.0 LINEAR memory.
This commit is contained in:
parent
c4382042d6
commit
7a54bb623a
@ -3,6 +3,8 @@
|
||||
|
||||
#define CSND_SHAREDMEM_DEFAULT 0x10004000
|
||||
|
||||
//See here regarding CSND shared-mem commands, etc: http://3dbrew.org/wiki/CSND_Shared_Memory
|
||||
|
||||
Result CSND_initialize(u32* sharedMem);
|
||||
Result CSND_shutdown();
|
||||
|
||||
|
7
libctru/include/ctr/OS.h
Normal file
7
libctru/include/ctr/OS.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef OS_H
|
||||
#define OS_H
|
||||
|
||||
u32 OS_ConvertVaddr2Physaddr(u32 vaddr);
|
||||
|
||||
#endif
|
||||
|
@ -34,6 +34,7 @@ typedef enum{
|
||||
Result svc_closeHandle(Handle handle);
|
||||
u64 svc_getSystemTick();
|
||||
Result svc_getSystemInfo(s64* out, u32 type, s32 param);
|
||||
Result svc_getProcessInfo(s64* out, Handle process, u32 type);
|
||||
Result svc_connectToPort(volatile Handle* out, const char* portName);
|
||||
Result svc_sendSyncRequest(Handle session);
|
||||
Result svc_getProcessId(u32 *out, Handle handle);
|
||||
|
@ -3,10 +3,12 @@
|
||||
#include <string.h>
|
||||
#include <ctr/types.h>
|
||||
|
||||
#include <ctr/CSND.h>
|
||||
#include <ctr/OS.h>
|
||||
#include <ctr/svc.h>
|
||||
#include <ctr/srv.h>
|
||||
|
||||
#include <ctr/CSND.h>
|
||||
|
||||
//See here regarding CSND shared-mem commands, etc: http://3dbrew.org/wiki/CSND_Shared_Memory
|
||||
|
||||
Handle CSND_handle = 0;
|
||||
@ -285,8 +287,8 @@ Result CSND_playsound(u32 channel, u32 looping, u32 encoding, u32 samplerate, u3
|
||||
u32 physaddr0 = 0;
|
||||
u32 physaddr1 = 0;
|
||||
|
||||
if((u32)vaddr0 >= 0x14000000 && (u32)vaddr0<0x1c000000)physaddr0 = (u32)vaddr0 + 0x0c000000;
|
||||
if((u32)vaddr1 >= 0x14000000 && (u32)vaddr1<0x1c000000)physaddr1 = (u32)vaddr1 + 0x0c000000;
|
||||
physaddr0 = OS_ConvertVaddr2Physaddr((u32)vaddr0);
|
||||
physaddr1 = OS_ConvertVaddr2Physaddr((u32)vaddr1);
|
||||
|
||||
CSND_sharedmemtype0_cmde(channel, looping, encoding, samplerate, unk0, unk1, physaddr0, physaddr1, totalbytesize);
|
||||
CSND_sharedmemtype0_cmd8(channel, samplerate);
|
||||
|
16
libctru/source/OS.c
Normal file
16
libctru/source/OS.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctr/types.h>
|
||||
#include <ctr/svc.h>
|
||||
#include <ctr/OS.h>
|
||||
|
||||
u32 OS_ConvertVaddr2Physaddr(u32 vaddr)
|
||||
{
|
||||
if(vaddr >= 0x14000000 && vaddr<0x1c000000)return vaddr + 0x0c000000;//LINEAR memory
|
||||
if(vaddr >= 0x30000000 && vaddr<0x40000000)return vaddr - 0x10000000;//Only available under system-version v8.0 for certain processes, see here: http://3dbrew.org/wiki/SVC#enum_MemoryOperation
|
||||
if(vaddr >= 0x1F000000 && vaddr<0x1F600000)return vaddr - 0x07000000;//VRAM
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -152,6 +152,17 @@ svc_getSystemInfo:
|
||||
ldr r4, [sp], #4
|
||||
bx lr
|
||||
|
||||
.global svc_getProcessInfo
|
||||
.type svc_getProcessInfo, %function
|
||||
svc_getProcessInfo:
|
||||
stmfd sp!, {r0, r4}
|
||||
svc 0x2B
|
||||
ldr r4, [sp], #4
|
||||
str r1, [r4]
|
||||
str r2, [r4, #4]
|
||||
ldr r4, [sp], #4
|
||||
bx lr
|
||||
|
||||
.global svc_connectToPort
|
||||
.type svc_connectToPort, %function
|
||||
svc_connectToPort:
|
||||
|
Loading…
Reference in New Issue
Block a user