mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Added compile-time flag to disable Discord SDK
In order to support ARM/Mac, discord must be disabled. To disable compile with: make DISCORD_SDK=0 Fixes #62
This commit is contained in:
parent
a67a06c17c
commit
4a7b9736b4
5 changed files with 61 additions and 25 deletions
63
Makefile
63
Makefile
|
@ -48,8 +48,10 @@ EXT_OPTIONS_MENU ?= 1
|
||||||
TEXTSAVES ?= 0
|
TEXTSAVES ?= 0
|
||||||
# Load resources from external files
|
# Load resources from external files
|
||||||
EXTERNAL_DATA ?= 0
|
EXTERNAL_DATA ?= 0
|
||||||
# Enable Discord Rich Presence
|
# Enable Discord Rich Presence (outdated, no longer supported)
|
||||||
DISCORDRPC ?= 0
|
DISCORDRPC ?= 0
|
||||||
|
# Enable Discord Game SDK (used for Discord server hosting)
|
||||||
|
DISCORD_SDK ?= 1
|
||||||
# Enable docker build workarounds
|
# Enable docker build workarounds
|
||||||
DOCKERBUILD ?= 0
|
DOCKERBUILD ?= 0
|
||||||
|
|
||||||
|
@ -289,13 +291,17 @@ LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
|
||||||
|
|
||||||
# Hi, I'm a PC
|
# Hi, I'm a PC
|
||||||
SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes
|
SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes
|
||||||
SRC_DIRS += src/pc/network src/pc/network/packets src/pc/network/socket src/pc/network/discord
|
SRC_DIRS += src/pc/network src/pc/network/packets src/pc/network/socket
|
||||||
ASM_DIRS :=
|
ASM_DIRS :=
|
||||||
|
|
||||||
#ifeq ($(DISCORDRPC),1)
|
#ifeq ($(DISCORDRPC),1)
|
||||||
# SRC_DIRS += src/pc/discord
|
# SRC_DIRS += src/pc/discord
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ifeq ($(DISCORD_SDK),1)
|
||||||
|
SRC_DIRS += src/pc/network/discord
|
||||||
|
endif
|
||||||
|
|
||||||
BIN_DIRS := bin bin/$(VERSION)
|
BIN_DIRS := bin bin/$(VERSION)
|
||||||
|
|
||||||
ULTRA_SRC_DIRS := lib/src lib/src/math
|
ULTRA_SRC_DIRS := lib/src lib/src/math
|
||||||
|
@ -425,13 +431,15 @@ RPC_LIBS :=
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DISCORD_SDK_LIBS :=
|
DISCORD_SDK_LIBS :=
|
||||||
ifeq ($(WINDOWS_BUILD),1)
|
ifeq ($(DISCORD_SDK), 1)
|
||||||
DISCORD_SDK_LIBS := lib/discordsdk/discord_game_sdk.dll
|
ifeq ($(WINDOWS_BUILD),1)
|
||||||
else ifeq ($(OSX_BUILD),1)
|
DISCORD_SDK_LIBS := lib/discordsdk/discord_game_sdk.dll
|
||||||
# needs testing
|
else ifeq ($(OSX_BUILD),1)
|
||||||
DISCORD_SDK_LIBS := lib/discordsdk/discord_game_sdk.dylib
|
# needs testing
|
||||||
else
|
DISCORD_SDK_LIBS := lib/discordsdk/discord_game_sdk.dylib
|
||||||
DISCORD_SDK_LIBS := lib/discordsdk/libdiscord_game_sdk.so
|
else
|
||||||
|
DISCORD_SDK_LIBS := lib/discordsdk/libdiscord_game_sdk.so
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Automatic dependency files
|
# Automatic dependency files
|
||||||
|
@ -460,19 +468,18 @@ else
|
||||||
CXX := emcc
|
CXX := emcc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LD := $(CXX)
|
|
||||||
|
|
||||||
#ifeq ($(DISCORDRPC),1)
|
#ifeq ($(DISCORDRPC),1)
|
||||||
# LD := $(CXX)
|
ifeq ($(DISCORD_SDK),1)
|
||||||
#else ifeq ($(WINDOWS_BUILD),1)
|
LD := $(CXX)
|
||||||
# ifeq ($(CROSS),i686-w64-mingw32.static-) # fixes compilation in MXE on Linux and WSL
|
else ifeq ($(WINDOWS_BUILD),1)
|
||||||
# LD := $(CC)
|
ifeq ($(CROSS),i686-w64-mingw32.static-) # fixes compilation in MXE on Linux and WSL
|
||||||
# else ifeq ($(CROSS),x86_64-w64-mingw32.static-)
|
LD := $(CC)
|
||||||
# LD := $(CC)
|
else ifeq ($(CROSS),x86_64-w64-mingw32.static-)
|
||||||
# else
|
LD := $(CC)
|
||||||
# LD := $(CXX)
|
else
|
||||||
# endif
|
LD := $(CXX)
|
||||||
#endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(WINDOWS_BUILD),1) # fixes compilation in MXE on Linux and WSL
|
ifeq ($(WINDOWS_BUILD),1) # fixes compilation in MXE on Linux and WSL
|
||||||
CPP := cpp -P
|
CPP := cpp -P
|
||||||
|
@ -621,6 +628,12 @@ endif
|
||||||
# CFLAGS += -DDISCORDRPC
|
# CFLAGS += -DDISCORDRPC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
# Check for Discord SDK option
|
||||||
|
ifeq ($(DISCORD_SDK),1)
|
||||||
|
CC_CHECK += -DDISCORD_SDK
|
||||||
|
CFLAGS += -DDISCORD_SDK
|
||||||
|
endif
|
||||||
|
|
||||||
# Check for texture fix option
|
# Check for texture fix option
|
||||||
ifeq ($(TEXTURE_FIX),1)
|
ifeq ($(TEXTURE_FIX),1)
|
||||||
CC_CHECK += -DTEXTURE_FIX
|
CC_CHECK += -DTEXTURE_FIX
|
||||||
|
@ -692,9 +705,13 @@ endif
|
||||||
|
|
||||||
ifeq ($(WINDOWS_BUILD),1)
|
ifeq ($(WINDOWS_BUILD),1)
|
||||||
LDFLAGS += -L"ws2_32" -lwsock32
|
LDFLAGS += -L"ws2_32" -lwsock32
|
||||||
LDFLAGS += -Wl,-Bdynamic -ldiscord_game_sdk -Wl,-Bstatic
|
ifeq ($(DISCORD_SDK),1)
|
||||||
|
LDFLAGS += -Wl,-Bdynamic -ldiscord_game_sdk -Wl,-Bstatic
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
LDFLAGS += -ldiscord_game_sdk -Wl,-rpath . -Wl,-rpath lib/discordsdk
|
ifeq ($(DISCORD_SDK),1)
|
||||||
|
LDFLAGS += -ldiscord_game_sdk -Wl,-rpath . -Wl,-rpath lib/discordsdk
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -72,17 +72,23 @@ static void host_menu_draw_strings(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void host_menu_do_host(void) {
|
static void host_menu_do_host(void) {
|
||||||
|
#ifndef DISCORD_SDK
|
||||||
|
configNetworkSystem = 1;
|
||||||
|
#endif
|
||||||
if (configNetworkSystem == 0) {
|
if (configNetworkSystem == 0) {
|
||||||
network_set_system(NS_DISCORD);
|
network_set_system(NS_DISCORD);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
network_set_system(NS_SOCKET);
|
network_set_system(NS_SOCKET);
|
||||||
}
|
}
|
||||||
custom_menu_close_system();
|
custom_menu_close_system();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void host_menu_setting_network_system(void) {
|
static void host_menu_setting_network_system(void) {
|
||||||
|
#ifdef DISCORD_SDK
|
||||||
configNetworkSystem = (configNetworkSystem == 0) ? 1 : 0;
|
configNetworkSystem = (configNetworkSystem == 0) ? 1 : 0;
|
||||||
|
#else
|
||||||
|
configNetworkSystem = 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void host_menu_setting_interaction(void) {
|
static void host_menu_setting_interaction(void) {
|
||||||
|
|
|
@ -321,6 +321,10 @@ void configfile_load(const char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fs_close(file);
|
fs_close(file);
|
||||||
|
|
||||||
|
#ifndef DISCORD_SDK
|
||||||
|
configNetworkSystem = 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes the config file to 'filename'
|
// Writes the config file to 'filename'
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
#include "object_fields.h"
|
#include "object_fields.h"
|
||||||
#include "object_constants.h"
|
#include "object_constants.h"
|
||||||
#include "socket/socket.h"
|
#include "socket/socket.h"
|
||||||
|
#ifdef DISCORD_SDK
|
||||||
#include "discord/discord.h"
|
#include "discord/discord.h"
|
||||||
|
#endif
|
||||||
#include "pc/configfile.h"
|
#include "pc/configfile.h"
|
||||||
#include "pc/debuglog.h"
|
#include "pc/debuglog.h"
|
||||||
|
|
||||||
|
@ -11,7 +13,11 @@
|
||||||
extern s16 sCurrPlayMode;
|
extern s16 sCurrPlayMode;
|
||||||
|
|
||||||
enum NetworkType gNetworkType = NT_NONE;
|
enum NetworkType gNetworkType = NT_NONE;
|
||||||
|
#ifdef DISCORD_SDK
|
||||||
struct NetworkSystem* gNetworkSystem = &gNetworkSystemDiscord;
|
struct NetworkSystem* gNetworkSystem = &gNetworkSystemDiscord;
|
||||||
|
#else
|
||||||
|
struct NetworkSystem* gNetworkSystem = &gNetworkSystemSocket;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOADING_LEVEL_THRESHOLD 10
|
#define LOADING_LEVEL_THRESHOLD 10
|
||||||
u8 networkLoadingLevel = 0;
|
u8 networkLoadingLevel = 0;
|
||||||
|
@ -27,7 +33,9 @@ struct ServerSettings gServerSettings = {
|
||||||
void network_set_system(enum NetworkSystemType nsType) {
|
void network_set_system(enum NetworkSystemType nsType) {
|
||||||
switch (nsType) {
|
switch (nsType) {
|
||||||
case NS_SOCKET: gNetworkSystem = &gNetworkSystemSocket; break;
|
case NS_SOCKET: gNetworkSystem = &gNetworkSystemSocket; break;
|
||||||
|
#ifdef DISCORD_SDK
|
||||||
case NS_DISCORD: gNetworkSystem = &gNetworkSystemDiscord; break;
|
case NS_DISCORD: gNetworkSystem = &gNetworkSystemDiscord; break;
|
||||||
|
#endif
|
||||||
default: LOG_ERROR("Unknown network system: %d", nsType);
|
default: LOG_ERROR("Unknown network system: %d", nsType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#define NETWORK_PLAYER_TIMEOUT 10
|
#define NETWORK_PLAYER_TIMEOUT 10
|
||||||
|
|
||||||
enum NetworkPlayerType {
|
enum NetworkPlayerType {
|
||||||
|
NPT_UNKNOWN,
|
||||||
NPT_LOCAL,
|
NPT_LOCAL,
|
||||||
NPT_SERVER,
|
NPT_SERVER,
|
||||||
NPT_CLIENT,
|
NPT_CLIENT,
|
||||||
|
|
Loading…
Reference in a new issue