mirror of
https://github.com/JesseTG/melonds-ds.git
synced 2024-11-23 14:40:04 +00:00
Fix the glib stub
This commit is contained in:
parent
0447e67801
commit
39c63f2ea8
@ -18,6 +18,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckTypeSize)
|
||||
include(FetchContent)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
|
||||
|
||||
|
@ -18,6 +18,13 @@ target_include_directories(slirp SYSTEM PUBLIC
|
||||
"${libretro-common_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY)
|
||||
if (SIZEOF_VOID_P)
|
||||
target_compile_definitions(slirp PRIVATE GLIB_SIZEOF_VOID_P=${SIZEOF_VOID_P})
|
||||
else()
|
||||
target_compile_definitions(slirp PRIVATE GLIB_SIZEOF_VOID_P=8)
|
||||
endif()
|
||||
|
||||
target_sources(slirp PRIVATE
|
||||
"${libslirp_SOURCE_DIR}/src/arp_table.c"
|
||||
"${libslirp_SOURCE_DIR}/src/bootp.c"
|
||||
@ -51,13 +58,10 @@ target_compile_definitions(slirp PRIVATE BUILDING_LIBSLIRP)
|
||||
|
||||
if (UNIX)
|
||||
target_compile_definitions(slirp PRIVATE UNIX)
|
||||
elseif(BSD)
|
||||
target_compile_definitions(slirp PRIVATE BSD)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
target_link_libraries(slirp PRIVATE resolv)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(slirp PRIVATE -fPIC)
|
||||
target_link_options(slirp PRIVATE -fPIC)
|
||||
endif ()
|
||||
endif()
|
@ -6,10 +6,6 @@
|
||||
#include <socket.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#ifdef UNIX
|
||||
#define G_OS_UNIX
|
||||
#endif
|
||||
|
||||
GRand *g_rand_new() {
|
||||
GRand *rand = (GRand *) malloc(sizeof(GRand));
|
||||
*rand = 32148920;
|
||||
@ -156,22 +152,30 @@ g_strstr_len (const gchar *haystack,
|
||||
struct gfwd_list *add_guestfwd(struct gfwd_list **ex_ptr, SlirpWriteCb write_cb,
|
||||
void *opaque, struct in_addr addr, int port)
|
||||
{
|
||||
g_critical("add_guestfwd unexpectedly required in stub\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Run the given command in the backaground, and send its output to the guest on
|
||||
* the given address and port */
|
||||
struct gfwd_list *add_exec(struct gfwd_list **ex_ptr, const char *cmdline,
|
||||
struct in_addr addr, int port)
|
||||
{
|
||||
g_critical("add_exec unexpectedly required in stub\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int remove_guestfwd(struct gfwd_list **ex_ptr, struct in_addr addr, int port)
|
||||
{
|
||||
g_critical("remove_guestfwd unexpectedly required in stub\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct gfwd_list *add_unix(struct gfwd_list **ex_ptr, const char *unixsock,
|
||||
struct in_addr addr, int port)
|
||||
{
|
||||
g_critical("add_unix unexpectedly required in stub\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int slirp_bind_outbound(struct socket *so, unsigned short af)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -233,6 +237,7 @@ int open_unix(struct socket *so, const char *unixpath)
|
||||
|
||||
int fork_exec(struct socket *so, const char *ex)
|
||||
{
|
||||
g_critical("fork_exec unexpectedly required in stub\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,20 @@
|
||||
#include <compat/strl.h>
|
||||
#include <libretro.h>
|
||||
#include <retro_common_api.h>
|
||||
#include <retro_endianness.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#define G_BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
#define G_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
|
||||
#define G_BYTE_ORDER __BYTE_ORDER__
|
||||
#ifdef _WIN32
|
||||
#define G_OS_WIN32 1
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
#define G_OS_UNIX 1
|
||||
#endif
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
#define G_STATIC_ASSERT(expr) static_assert(expr, #expr " failed")
|
||||
|
||||
|
@ -158,11 +158,11 @@ endif()
|
||||
|
||||
target_compile_definitions(libretro PUBLIC MELONDSDS_VERSION="${CMAKE_PROJECT_VERSION}")
|
||||
target_compile_definitions(libretro PUBLIC MELONDSDS_NAME="${CMAKE_PROJECT_NAME}")
|
||||
target_compile_definitions(libretro PUBLIC BUILDING_LIBSLIRP)
|
||||
|
||||
target_link_libraries(libretro PUBLIC libretro-common core libretro-assets glm::glm_static)
|
||||
|
||||
if (HAVE_NETWORKING)
|
||||
target_compile_definitions(libretro PUBLIC BUILDING_LIBSLIRP)
|
||||
target_link_libraries(libretro PUBLIC slirp)
|
||||
|
||||
if (WIN32)
|
||||
|
Loading…
Reference in New Issue
Block a user