mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +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
51
Makefile
51
Makefile
|
@ -48,8 +48,10 @@ EXT_OPTIONS_MENU ?= 1
|
|||
TEXTSAVES ?= 0
|
||||
# Load resources from external files
|
||||
EXTERNAL_DATA ?= 0
|
||||
# Enable Discord Rich Presence
|
||||
# Enable Discord Rich Presence (outdated, no longer supported)
|
||||
DISCORDRPC ?= 0
|
||||
# Enable Discord Game SDK (used for Discord server hosting)
|
||||
DISCORD_SDK ?= 1
|
||||
# Enable docker build workarounds
|
||||
DOCKERBUILD ?= 0
|
||||
|
||||
|
@ -289,13 +291,17 @@ LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
|
|||
|
||||
# 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/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 :=
|
||||
|
||||
#ifeq ($(DISCORDRPC),1)
|
||||
# SRC_DIRS += src/pc/discord
|
||||
#endif
|
||||
|
||||
ifeq ($(DISCORD_SDK),1)
|
||||
SRC_DIRS += src/pc/network/discord
|
||||
endif
|
||||
|
||||
BIN_DIRS := bin bin/$(VERSION)
|
||||
|
||||
ULTRA_SRC_DIRS := lib/src lib/src/math
|
||||
|
@ -425,13 +431,15 @@ RPC_LIBS :=
|
|||
#endif
|
||||
|
||||
DISCORD_SDK_LIBS :=
|
||||
ifeq ($(WINDOWS_BUILD),1)
|
||||
ifeq ($(DISCORD_SDK), 1)
|
||||
ifeq ($(WINDOWS_BUILD),1)
|
||||
DISCORD_SDK_LIBS := lib/discordsdk/discord_game_sdk.dll
|
||||
else ifeq ($(OSX_BUILD),1)
|
||||
else ifeq ($(OSX_BUILD),1)
|
||||
# needs testing
|
||||
DISCORD_SDK_LIBS := lib/discordsdk/discord_game_sdk.dylib
|
||||
else
|
||||
else
|
||||
DISCORD_SDK_LIBS := lib/discordsdk/libdiscord_game_sdk.so
|
||||
endif
|
||||
endif
|
||||
|
||||
# Automatic dependency files
|
||||
|
@ -460,19 +468,18 @@ else
|
|||
CXX := emcc
|
||||
endif
|
||||
|
||||
LD := $(CXX)
|
||||
|
||||
#ifeq ($(DISCORDRPC),1)
|
||||
# LD := $(CXX)
|
||||
#else ifeq ($(WINDOWS_BUILD),1)
|
||||
# ifeq ($(CROSS),i686-w64-mingw32.static-) # fixes compilation in MXE on Linux and WSL
|
||||
# LD := $(CC)
|
||||
# else ifeq ($(CROSS),x86_64-w64-mingw32.static-)
|
||||
# LD := $(CC)
|
||||
# else
|
||||
# LD := $(CXX)
|
||||
# endif
|
||||
#endif
|
||||
ifeq ($(DISCORD_SDK),1)
|
||||
LD := $(CXX)
|
||||
else ifeq ($(WINDOWS_BUILD),1)
|
||||
ifeq ($(CROSS),i686-w64-mingw32.static-) # fixes compilation in MXE on Linux and WSL
|
||||
LD := $(CC)
|
||||
else ifeq ($(CROSS),x86_64-w64-mingw32.static-)
|
||||
LD := $(CC)
|
||||
else
|
||||
LD := $(CXX)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(WINDOWS_BUILD),1) # fixes compilation in MXE on Linux and WSL
|
||||
CPP := cpp -P
|
||||
|
@ -621,6 +628,12 @@ endif
|
|||
# CFLAGS += -DDISCORDRPC
|
||||
#endif
|
||||
|
||||
# Check for Discord SDK option
|
||||
ifeq ($(DISCORD_SDK),1)
|
||||
CC_CHECK += -DDISCORD_SDK
|
||||
CFLAGS += -DDISCORD_SDK
|
||||
endif
|
||||
|
||||
# Check for texture fix option
|
||||
ifeq ($(TEXTURE_FIX),1)
|
||||
CC_CHECK += -DTEXTURE_FIX
|
||||
|
@ -692,9 +705,13 @@ endif
|
|||
|
||||
ifeq ($(WINDOWS_BUILD),1)
|
||||
LDFLAGS += -L"ws2_32" -lwsock32
|
||||
ifeq ($(DISCORD_SDK),1)
|
||||
LDFLAGS += -Wl,-Bdynamic -ldiscord_game_sdk -Wl,-Bstatic
|
||||
endif
|
||||
else
|
||||
ifeq ($(DISCORD_SDK),1)
|
||||
LDFLAGS += -ldiscord_game_sdk -Wl,-rpath . -Wl,-rpath lib/discordsdk
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
@ -72,17 +72,23 @@ static void host_menu_draw_strings(void) {
|
|||
}
|
||||
|
||||
static void host_menu_do_host(void) {
|
||||
#ifndef DISCORD_SDK
|
||||
configNetworkSystem = 1;
|
||||
#endif
|
||||
if (configNetworkSystem == 0) {
|
||||
network_set_system(NS_DISCORD);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
network_set_system(NS_SOCKET);
|
||||
}
|
||||
custom_menu_close_system();
|
||||
}
|
||||
|
||||
static void host_menu_setting_network_system(void) {
|
||||
#ifdef DISCORD_SDK
|
||||
configNetworkSystem = (configNetworkSystem == 0) ? 1 : 0;
|
||||
#else
|
||||
configNetworkSystem = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void host_menu_setting_interaction(void) {
|
||||
|
|
|
@ -321,6 +321,10 @@ void configfile_load(const char *filename) {
|
|||
}
|
||||
|
||||
fs_close(file);
|
||||
|
||||
#ifndef DISCORD_SDK
|
||||
configNetworkSystem = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Writes the config file to 'filename'
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
#include "object_fields.h"
|
||||
#include "object_constants.h"
|
||||
#include "socket/socket.h"
|
||||
#ifdef DISCORD_SDK
|
||||
#include "discord/discord.h"
|
||||
#endif
|
||||
#include "pc/configfile.h"
|
||||
#include "pc/debuglog.h"
|
||||
|
||||
|
@ -11,7 +13,11 @@
|
|||
extern s16 sCurrPlayMode;
|
||||
|
||||
enum NetworkType gNetworkType = NT_NONE;
|
||||
#ifdef DISCORD_SDK
|
||||
struct NetworkSystem* gNetworkSystem = &gNetworkSystemDiscord;
|
||||
#else
|
||||
struct NetworkSystem* gNetworkSystem = &gNetworkSystemSocket;
|
||||
#endif
|
||||
|
||||
#define LOADING_LEVEL_THRESHOLD 10
|
||||
u8 networkLoadingLevel = 0;
|
||||
|
@ -27,7 +33,9 @@ struct ServerSettings gServerSettings = {
|
|||
void network_set_system(enum NetworkSystemType nsType) {
|
||||
switch (nsType) {
|
||||
case NS_SOCKET: gNetworkSystem = &gNetworkSystemSocket; break;
|
||||
#ifdef DISCORD_SDK
|
||||
case NS_DISCORD: gNetworkSystem = &gNetworkSystemDiscord; break;
|
||||
#endif
|
||||
default: LOG_ERROR("Unknown network system: %d", nsType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#define NETWORK_PLAYER_TIMEOUT 10
|
||||
|
||||
enum NetworkPlayerType {
|
||||
NPT_UNKNOWN,
|
||||
NPT_LOCAL,
|
||||
NPT_SERVER,
|
||||
NPT_CLIENT,
|
||||
|
|
Loading…
Reference in a new issue