mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 02:22:15 +02:00
modularise nxlink code
This commit is contained in:
parent
a1c07b7e47
commit
821d503ef3
6
nx/external/bsd/include/netinet/in.h
vendored
6
nx/external/bsd/include/netinet/in.h
vendored
@ -678,12 +678,6 @@ struct sockaddr_in6 {
|
|||||||
extern const struct in6_addr in6addr_any;
|
extern const struct in6_addr in6addr_any;
|
||||||
extern const struct in6_addr in6addr_loopback;
|
extern const struct in6_addr in6addr_loopback;
|
||||||
|
|
||||||
extern struct in_addr __nxlink_host;
|
|
||||||
|
|
||||||
#define NETLOADER_SERVER_PORT 28280
|
|
||||||
#define NETLOADER_CLIENT_PORT 28771
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* !_NETINET_IN_H_*/
|
#endif /* !_NETINET_IN_H_*/
|
||||||
|
@ -57,6 +57,7 @@ extern "C" {
|
|||||||
#include "switch/gfx/nvgfx.h"
|
#include "switch/gfx/nvgfx.h"
|
||||||
|
|
||||||
#include "switch/runtime/env.h"
|
#include "switch/runtime/env.h"
|
||||||
|
#include "switch/runtime/nxlink.h"
|
||||||
|
|
||||||
#include "switch/runtime/util/utf.h"
|
#include "switch/runtime/util/utf.h"
|
||||||
|
|
||||||
|
8
nx/include/switch/runtime/nxlink.h
Normal file
8
nx/include/switch/runtime/nxlink.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct in_addr;
|
||||||
|
|
||||||
|
extern struct in_addr __nxlink_host;
|
||||||
|
|
||||||
|
#define NXLINK_SERVER_PORT 28280
|
||||||
|
#define NXLINK_CLIENT_PORT 28771
|
@ -19,6 +19,8 @@ extern u32 __argdata__;
|
|||||||
|
|
||||||
static char* g_argv_empty = NULL;
|
static char* g_argv_empty = NULL;
|
||||||
|
|
||||||
|
void nxlinkSetup(void);
|
||||||
|
|
||||||
void argvSetup(void)
|
void argvSetup(void)
|
||||||
{
|
{
|
||||||
Result rc=0;
|
Result rc=0;
|
||||||
@ -140,14 +142,12 @@ void argvSetup(void)
|
|||||||
__system_argc++;
|
__system_argc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( __system_argc > 1 &&
|
|
||||||
strlen(__system_argv[__system_argc - 1]) == 16 &&
|
// Check for nxlink parameters
|
||||||
strncmp(&__system_argv[__system_argc - 1][8], "_NXLINK_", 8) == 0 )
|
nxlinkSetup();
|
||||||
{
|
|
||||||
__system_argc--;
|
|
||||||
__nxlink_host.s_addr = strtoul(__system_argv[__system_argc], NULL, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
__system_argv[__system_argc] = NULL;
|
__system_argv[__system_argc] = NULL;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
23
nx/source/runtime/nxlink.c
Normal file
23
nx/source/runtime/nxlink.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
|
||||||
|
// System globals we define here
|
||||||
|
extern int __system_argc;
|
||||||
|
extern char** __system_argv;
|
||||||
|
|
||||||
|
struct in_addr __nxlink_host;
|
||||||
|
|
||||||
|
|
||||||
|
void nxlinkSetup(void)
|
||||||
|
{
|
||||||
|
if ( __system_argc > 1 &&
|
||||||
|
strlen(__system_argv[__system_argc - 1]) == 16 &&
|
||||||
|
strncmp(&__system_argv[__system_argc - 1][8], "_NXLINK_", 8) == 0 )
|
||||||
|
{
|
||||||
|
__system_argc--;
|
||||||
|
__nxlink_host.s_addr = strtoul(__system_argv[__system_argc], NULL, 16);
|
||||||
|
}
|
||||||
|
__system_argv[__system_argc] = NULL;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user