mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 04:52:39 +02:00
C was developed in 1972
This commit is contained in:
parent
cac3f735af
commit
edcf789b6e
@ -35,8 +35,8 @@ void gfxConfigureAutoResolution(bool enable, s32 handheld_width, s32 handheld_he
|
|||||||
/// Wrapper for gfxConfigureAutoResolution(). handheld_resolution=720p, docked_resolution={all-zero for using current maximum resolution}.
|
/// Wrapper for gfxConfigureAutoResolution(). handheld_resolution=720p, docked_resolution={all-zero for using current maximum resolution}.
|
||||||
void gfxConfigureAutoResolutionDefault(bool enable);
|
void gfxConfigureAutoResolutionDefault(bool enable);
|
||||||
|
|
||||||
void gfxWaitForVsync();
|
void gfxWaitForVsync(void);
|
||||||
void gfxSwapBuffers();
|
void gfxSwapBuffers(void);
|
||||||
|
|
||||||
/// Get the current framebuffer address, with optional output ptrs for the display width/height. The display width/height is adjusted by gfxConfigureCrop()/gfxConfigureResolution().
|
/// Get the current framebuffer address, with optional output ptrs for the display width/height. The display width/height is adjusted by gfxConfigureCrop()/gfxConfigureResolution().
|
||||||
u8* gfxGetFramebuffer(u32* width, u32* height);
|
u8* gfxGetFramebuffer(u32* width, u32* height);
|
||||||
|
@ -31,10 +31,10 @@ Result svcSetHeapSize(void** out_addr, u64 size);
|
|||||||
Result svcMapMemory(void* dst_addr, void* src_addr, u64 size);
|
Result svcMapMemory(void* dst_addr, void* src_addr, u64 size);
|
||||||
Result svcUnmapMemory(void* dst_addr, void* src_addr, u64 size);
|
Result svcUnmapMemory(void* dst_addr, void* src_addr, u64 size);
|
||||||
Result svcQueryMemory(MemoryInfo* meminfo_ptr, u32 *pageinfo, u64 addr);
|
Result svcQueryMemory(MemoryInfo* meminfo_ptr, u32 *pageinfo, u64 addr);
|
||||||
void NORETURN svcExitProcess();
|
void NORETURN svcExitProcess(void);
|
||||||
Result svcCreateThread(Handle* out, void* entry, void* arg, void* stack_top, int prio, int cpuid);
|
Result svcCreateThread(Handle* out, void* entry, void* arg, void* stack_top, int prio, int cpuid);
|
||||||
Result svcStartThread(Handle handle);
|
Result svcStartThread(Handle handle);
|
||||||
void NORETURN svcExitThread();
|
void NORETURN svcExitThread(void);
|
||||||
Result svcSleepThread(u64 nano);
|
Result svcSleepThread(u64 nano);
|
||||||
Result svcClearEvent(Handle handle);
|
Result svcClearEvent(Handle handle);
|
||||||
Result svcCloseHandle(Handle handle);
|
Result svcCloseHandle(Handle handle);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 plutoo
|
// Copyright 2017 plutoo
|
||||||
bool kernelAbove200();
|
bool kernelAbove200(void);
|
||||||
bool kernelAbove300();
|
bool kernelAbove300(void);
|
||||||
bool kernelAbove400();
|
bool kernelAbove400(void);
|
||||||
|
@ -7,7 +7,7 @@ struct bsd_sockaddr_in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Result bsdInitialize(TransferMemory* tmem);
|
Result bsdInitialize(TransferMemory* tmem);
|
||||||
int bsdGetErrno();
|
int bsdGetErrno(void);
|
||||||
int bsdConnect(int sockfd, void* addr, u32 addrlen);
|
int bsdConnect(int sockfd, void* addr, u32 addrlen);
|
||||||
int bsdSocket(int domain, int type, int protocol);
|
int bsdSocket(int domain, int type, int protocol);
|
||||||
int bsdBind(int sockfd, void* addr, u32 addrlen);
|
int bsdBind(int sockfd, void* addr, u32 addrlen);
|
||||||
|
@ -77,7 +77,7 @@ typedef enum
|
|||||||
FS_CONTENTSTORAGEID_SdCard = 2,
|
FS_CONTENTSTORAGEID_SdCard = 2,
|
||||||
} FsContentStorageId;
|
} FsContentStorageId;
|
||||||
|
|
||||||
Result fsInitialize();
|
Result fsInitialize(void);
|
||||||
void fsExit(void);
|
void fsExit(void);
|
||||||
|
|
||||||
Handle fsGetServiceSession(void);
|
Handle fsGetServiceSession(void);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Copyright 2017 plutoo
|
// Copyright 2017 plutoo
|
||||||
Result pmdmntInitialize();
|
Result pmdmntInitialize(void);
|
||||||
Result pmdmntStartProcess(u64 pid);
|
Result pmdmntStartProcess(u64 pid);
|
||||||
Result pmdmntGetTitlePid(u64* pid_out, u64 title_id);
|
Result pmdmntGetTitlePid(u64* pid_out, u64 title_id);
|
||||||
Result pmdmntEnableDebugForTitleId(Handle* handle_out, u64 title_id);
|
Result pmdmntEnableDebugForTitleId(Handle* handle_out, u64 title_id);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
bool smHasInitialized();
|
Result smInitialize(void);
|
||||||
Result smInitialize();
|
|
||||||
void smExit(void);
|
void smExit(void);
|
||||||
Result smGetService(Handle* handle_out, const char* name);
|
Result smGetService(Handle* handle_out, const char* name);
|
||||||
Result smRegisterService(Handle* handle_out, const char* name, bool is_light, int max_sessions);
|
Result smRegisterService(Handle* handle_out, const char* name, bool is_light, int max_sessions);
|
||||||
Result smUnregisterService(const char* name);
|
Result smUnregisterService(const char* name);
|
||||||
|
bool smHasInitialized(void);
|
||||||
|
@ -28,13 +28,13 @@ typedef enum {
|
|||||||
} ViScalingMode;
|
} ViScalingMode;
|
||||||
|
|
||||||
Result viInitialize(ViServiceType servicetype);
|
Result viInitialize(ViServiceType servicetype);
|
||||||
void viExit();
|
void viExit(void);
|
||||||
Handle viGetSessionService();
|
Handle viGetSessionService(void);
|
||||||
Handle viGetSession_IApplicationDisplayService();
|
Handle viGetSession_IApplicationDisplayService(void);
|
||||||
Handle viGetSession_IHOSBinderDriverRelay();
|
Handle viGetSession_IHOSBinderDriverRelay(void);
|
||||||
Handle viGetSession_ISystemDisplayService();
|
Handle viGetSession_ISystemDisplayService(void);
|
||||||
Handle viGetSession_IManagerDisplayService();
|
Handle viGetSession_IManagerDisplayService(void);
|
||||||
Handle viGetSession_IHOSBinderDriverIndirect();
|
Handle viGetSession_IHOSBinderDriverIndirect(void);
|
||||||
|
|
||||||
Result viOpenDisplay(const char *DisplayName, ViDisplay *display);
|
Result viOpenDisplay(const char *DisplayName, ViDisplay *display);
|
||||||
Result viCloseDisplay(ViDisplay *display);
|
Result viCloseDisplay(ViDisplay *display);
|
||||||
|
@ -33,7 +33,7 @@ Result bufferProducerInitialize(Binder *session)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bufferProducerExit()
|
void bufferProducerExit(void)
|
||||||
{
|
{
|
||||||
g_bufferProducerBinderSession = NULL;
|
g_bufferProducerBinderSession = NULL;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ static Result _gfxInit(ViServiceType servicetype, const char *DisplayName, u32 L
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfxInitDefault()
|
void gfxInitDefault(void)
|
||||||
{
|
{
|
||||||
nvServiceType nv_servicetype;
|
nvServiceType nv_servicetype;
|
||||||
|
|
||||||
@ -317,7 +317,8 @@ void gfxInitDefault()
|
|||||||
if (R_FAILED(rc)) fatalSimple(rc);
|
if (R_FAILED(rc)) fatalSimple(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfxExit() {
|
void gfxExit(void)
|
||||||
|
{
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
if (!g_gfxInitialized)
|
if (!g_gfxInitialized)
|
||||||
return;
|
return;
|
||||||
@ -463,11 +464,11 @@ static void _waitevent(Handle *handle) {
|
|||||||
if (R_FAILED(rc2)) fatalSimple(rc2);
|
if (R_FAILED(rc2)) fatalSimple(rc2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfxWaitForVsync() {
|
void gfxWaitForVsync(void) {
|
||||||
_waitevent(&g_gfxDisplayVsyncEvent);
|
_waitevent(&g_gfxDisplayVsyncEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfxSwapBuffers() {
|
void gfxSwapBuffers(void) {
|
||||||
Result rc=0;
|
Result rc=0;
|
||||||
|
|
||||||
rc = _gfxQueueBuffer(g_gfxCurrentProducerBuffer);
|
rc = _gfxQueueBuffer(g_gfxCurrentProducerBuffer);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#define HAS_LISTENERS 0x40000000
|
#define HAS_LISTENERS 0x40000000
|
||||||
|
|
||||||
static u32 _GetTag() {
|
static u32 _GetTag(void) {
|
||||||
return getThreadVars()->handle;
|
return getThreadVars()->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ static bool g_IsAbove300;
|
|||||||
static bool g_IsAbove400;
|
static bool g_IsAbove400;
|
||||||
static bool g_HasCached = 0;
|
static bool g_HasCached = 0;
|
||||||
|
|
||||||
static void _CacheValues()
|
static void _CacheValues(void)
|
||||||
{
|
{
|
||||||
// This is actually thread safe, might cache twice but that's fine.
|
// This is actually thread safe, might cache twice but that's fine.
|
||||||
if (!g_HasCached)
|
if (!g_HasCached)
|
||||||
@ -19,17 +19,17 @@ static void _CacheValues()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool kernelAbove200() {
|
bool kernelAbove200(void) {
|
||||||
_CacheValues();
|
_CacheValues();
|
||||||
return g_IsAbove200;
|
return g_IsAbove200;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool kernelAbove300() {
|
bool kernelAbove300(void) {
|
||||||
_CacheValues();
|
_CacheValues();
|
||||||
return g_IsAbove300;
|
return g_IsAbove300;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool kernelAbove400() {
|
bool kernelAbove400(void) {
|
||||||
_CacheValues();
|
_CacheValues();
|
||||||
return g_IsAbove400;
|
return g_IsAbove400;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ static inline bool _InRegion(VirtualRegion* r, u64 addr) {
|
|||||||
return (addr >= r->start) && (addr < r->end);
|
return (addr >= r->start) && (addr < r->end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void virtmemSetup() {
|
void virtmemSetup(void) {
|
||||||
if (R_FAILED(_GetRegionFromInfo(&g_AddressSpace, 12, 13))) {
|
if (R_FAILED(_GetRegionFromInfo(&g_AddressSpace, 12, 13))) {
|
||||||
// Default values in case we're running on 1.0.0
|
// Default values in case we're running on 1.0.0
|
||||||
// Assumes 32-bit address space
|
// Assumes 32-bit address space
|
||||||
|
@ -600,7 +600,7 @@ void consoleSetFont(PrintConsole* console, ConsoleFont* font){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
static void newRow() {
|
static void newRow(void) {
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
void __nx_exit(int rc);
|
void __nx_exit(int rc);
|
||||||
|
|
||||||
void virtmemSetup();
|
void virtmemSetup(void);
|
||||||
void newlibSetup(Handle main_thread);
|
void newlibSetup(Handle main_thread);
|
||||||
|
|
||||||
void __system_initArgv(void);
|
void __system_initArgv(void);
|
||||||
@ -12,7 +12,7 @@ __attribute__((weak)) size_t __nx_inner_heap_size = INNER_HEAP_SIZE;
|
|||||||
__attribute__((weak)) char __nx_inner_heap[INNER_HEAP_SIZE];
|
__attribute__((weak)) char __nx_inner_heap[INNER_HEAP_SIZE];
|
||||||
__attribute__((weak)) size_t __nx_outer_heap_size = 0x2000000*16;//Must be a multiple of 0x2000000.
|
__attribute__((weak)) size_t __nx_outer_heap_size = 0x2000000*16;//Must be a multiple of 0x2000000.
|
||||||
|
|
||||||
void __attribute__((weak)) __libnx_initheap()
|
void __attribute__((weak)) __libnx_initheap(void)
|
||||||
{
|
{
|
||||||
u64 addr;
|
u64 addr;
|
||||||
Result rc = svcSetHeapSize((void**)&addr, __nx_outer_heap_size);
|
Result rc = svcSetHeapSize((void**)&addr, __nx_outer_heap_size);
|
||||||
|
@ -11,7 +11,7 @@ extern const u8 __tdata_lma[];
|
|||||||
extern const u8 __tdata_lma_end[];
|
extern const u8 __tdata_lma_end[];
|
||||||
extern u8 __tls_start[];
|
extern u8 __tls_start[];
|
||||||
|
|
||||||
static struct _reent* __libnx_get_reent() {
|
static struct _reent* __libnx_get_reent(void) {
|
||||||
ThreadVars* tv = getThreadVars();
|
ThreadVars* tv = getThreadVars();
|
||||||
if (tv->magic != THREADVARS_MAGIC)
|
if (tv->magic != THREADVARS_MAGIC)
|
||||||
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADREENT));
|
fatalSimple(MAKERESULT(MODULE_LIBNX, LIBNX_BADREENT));
|
||||||
|
@ -110,7 +110,7 @@ Result bsdInitialize(TransferMemory* tmem) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bsdGetErrno() {
|
int bsdGetErrno(void) {
|
||||||
return g_Errno;
|
return g_Errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
static Handle g_fsHandle = INVALID_HANDLE;
|
static Handle g_fsHandle = INVALID_HANDLE;
|
||||||
|
|
||||||
Result fsInitialize() {
|
Result fsInitialize(void) {
|
||||||
if (g_fsHandle != INVALID_HANDLE)
|
if (g_fsHandle != INVALID_HANDLE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
static Handle g_pmdmntHandle = INVALID_HANDLE;
|
static Handle g_pmdmntHandle = INVALID_HANDLE;
|
||||||
|
|
||||||
Result pmdmntInitialize() {
|
Result pmdmntInitialize(void) {
|
||||||
Result rc = smGetService(&g_pmdmntHandle, "pm:dmnt");
|
Result rc = smGetService(&g_pmdmntHandle, "pm:dmnt");
|
||||||
|
|
||||||
if (R_FAILED(rc)) {
|
if (R_FAILED(rc)) {
|
||||||
|
@ -3,12 +3,13 @@
|
|||||||
|
|
||||||
static Handle g_smHandle = -1;
|
static Handle g_smHandle = -1;
|
||||||
|
|
||||||
bool smHasInitialized() {
|
bool smHasInitialized(void) {
|
||||||
return g_smHandle != -1;
|
return g_smHandle != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result smInitialize() {
|
Result smInitialize(void) {
|
||||||
if(smHasInitialized())return 0;
|
if (smHasInitialized())
|
||||||
|
return 0;
|
||||||
|
|
||||||
Result rc = svcConnectToNamedPort(&g_smHandle, "sm:");
|
Result rc = svcConnectToNamedPort(&g_smHandle, "sm:");
|
||||||
Handle tmp;
|
Handle tmp;
|
||||||
@ -50,7 +51,7 @@ Result smInitialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void smExit(void) {
|
void smExit(void) {
|
||||||
if(smHasInitialized()) {
|
if (smHasInitialized()) {
|
||||||
svcCloseHandle(g_smHandle);
|
svcCloseHandle(g_smHandle);
|
||||||
g_smHandle = -1;
|
g_smHandle = -1;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ Result viInitialize(ViServiceType servicetype)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void viExit()
|
void viExit(void)
|
||||||
{
|
{
|
||||||
if(g_viServiceType == -1)
|
if(g_viServiceType == -1)
|
||||||
return;
|
return;
|
||||||
@ -102,32 +102,32 @@ void viExit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle viGetSessionService()
|
Handle viGetSessionService(void)
|
||||||
{
|
{
|
||||||
return g_viServiceSession;
|
return g_viServiceSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle viGetSession_IApplicationDisplayService()
|
Handle viGetSession_IApplicationDisplayService(void)
|
||||||
{
|
{
|
||||||
return g_viIApplicationDisplayService;
|
return g_viIApplicationDisplayService;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle viGetSession_IHOSBinderDriverRelay()
|
Handle viGetSession_IHOSBinderDriverRelay(void)
|
||||||
{
|
{
|
||||||
return g_viIHOSBinderDriverRelay;
|
return g_viIHOSBinderDriverRelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle viGetSession_ISystemDisplayService()
|
Handle viGetSession_ISystemDisplayService(void)
|
||||||
{
|
{
|
||||||
return g_viISystemDisplayService;
|
return g_viISystemDisplayService;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle viGetSession_IManagerDisplayService()
|
Handle viGetSession_IManagerDisplayService(void)
|
||||||
{
|
{
|
||||||
return g_viIManagerDisplayService;
|
return g_viIManagerDisplayService;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle viGetSession_IHOSBinderDriverIndirect()
|
Handle viGetSession_IHOSBinderDriverIndirect(void)
|
||||||
{
|
{
|
||||||
return g_viIHOSBinderDriverIndirect;
|
return g_viIHOSBinderDriverIndirect;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user