mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 21:45:12 +00:00
Fix commandline params for client/server
This commit is contained in:
parent
ec2f07f20d
commit
4fb951c0bf
12 changed files with 35 additions and 12 deletions
|
@ -1,19 +1,30 @@
|
|||
#include "djui.h"
|
||||
#include "../debuglog.h"
|
||||
#include "pc/cliopts.h"
|
||||
|
||||
static Gfx* sSavedDisplayListHead = NULL;
|
||||
|
||||
struct DjuiRoot* gDjuiRoot = NULL;
|
||||
struct DjuiFlowLayout* buttonContainer;
|
||||
|
||||
static void djui_init(void) {
|
||||
void djui_init(void) {
|
||||
gDjuiRoot = djui_root_create();
|
||||
|
||||
djui_panel_main_create(NULL);
|
||||
//djui_panel_debug_create();
|
||||
if (gCLIOpts.Network != NT_SERVER) {
|
||||
djui_panel_main_create(NULL);
|
||||
//djui_panel_debug_create();
|
||||
}
|
||||
|
||||
djui_cursor_create();
|
||||
}
|
||||
|
||||
void djui_connect_menu_open(void) {
|
||||
djui_panel_shutdown();
|
||||
djui_panel_main_create(NULL);
|
||||
djui_panel_join_create(NULL);
|
||||
djui_panel_join_message_create(NULL);
|
||||
}
|
||||
|
||||
void djui_render_patch(void) {
|
||||
// reset the head and re-render DJUI
|
||||
if (sSavedDisplayListHead == NULL) { return; }
|
||||
|
@ -24,7 +35,6 @@ void djui_render_patch(void) {
|
|||
}
|
||||
|
||||
void djui_render(void) {
|
||||
if (gDjuiRoot == NULL) { djui_init(); }
|
||||
sSavedDisplayListHead = gDisplayListHead;
|
||||
create_dl_ortho_matrix();
|
||||
|
||||
|
|
|
@ -45,5 +45,7 @@
|
|||
|
||||
extern struct DjuiRoot* gDjuiRoot;
|
||||
|
||||
void djui_init(void);
|
||||
void djui_connect_menu_open(void);
|
||||
void djui_render_patch(void);
|
||||
void djui_render(void);
|
||||
|
|
|
@ -99,6 +99,8 @@ void djui_cursor_move(s8 xDir, s8 yDir) {
|
|||
void djui_cursor_update(void) {
|
||||
#if defined(CAPI_SDL2) || defined(CAPI_SDL1)
|
||||
if (djui_interactable_is_binding()) { return; }
|
||||
if (sMouseCursor == NULL) { return; }
|
||||
if (!djui_panel_is_active()) { return; }
|
||||
|
||||
controller_sdl_read_mouse_window();
|
||||
|
||||
|
|
|
@ -13,6 +13,10 @@ static struct DjuiPanel* sPanelList = NULL;
|
|||
static struct DjuiPanel* sPanelRemoving = NULL;
|
||||
static f32 sMoveAmount = 0;
|
||||
|
||||
bool djui_panel_is_active(void) {
|
||||
return (sPanelList != NULL);
|
||||
}
|
||||
|
||||
void djui_panel_add(struct DjuiBase* caller, struct DjuiBase* panelBase, struct DjuiBase* defaultElementBase) {
|
||||
bool firstPanel = (sPanelList == NULL);
|
||||
gDjuiPanelJoinMessageVisible = false;
|
||||
|
@ -22,6 +26,11 @@ void djui_panel_add(struct DjuiBase* caller, struct DjuiBase* panelBase, struct
|
|||
sPanelList->defaultElementBase = caller;
|
||||
}
|
||||
|
||||
// hide second from the top immediately
|
||||
if (sPanelList != NULL && sPanelList->parent != NULL) {
|
||||
djui_base_set_visible(sPanelList->parent->base, false);
|
||||
}
|
||||
|
||||
// allocate panel
|
||||
struct DjuiPanel* panel = malloc(sizeof(struct DjuiPanel));
|
||||
panel->parent = sPanelList;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#define DJUI_DEFAULT_PANEL_WIDTH (400.0f + (16 * 2.0f))
|
||||
#define DJUI_PANEL_HEADER_OFFSET (-8)
|
||||
|
||||
bool djui_panel_is_active(void);
|
||||
void djui_panel_add(struct DjuiBase* caller, struct DjuiBase* panelBase, struct DjuiBase* defaultElementBase);
|
||||
void djui_panel_back(void);
|
||||
void djui_panel_update(void);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "discord_network.h"
|
||||
#include "pc/debuglog.h"
|
||||
#include "pc/network/version.h"
|
||||
#include "pc/djui/djui.h"
|
||||
|
||||
#define HASH_LENGTH 8
|
||||
struct DiscordActivity gCurActivity = { 0 };
|
||||
|
|
|
@ -283,8 +283,3 @@ void chat_add_message(char* message) {
|
|||
void djui_show_popup(char* message) {
|
||||
LOG_INFO("popup: %s", message);
|
||||
}
|
||||
|
||||
// TODO: replace
|
||||
void djui_connect_menu_open(void) {
|
||||
LOG_INFO("djui: connecting");
|
||||
}
|
||||
|
|
|
@ -104,5 +104,4 @@ void network_shutdown(bool sendLeaving);
|
|||
// TODO: replace
|
||||
void chat_add_message(char* message);
|
||||
void djui_show_popup(char* message);
|
||||
void djui_connect_menu_open(void);
|
||||
#endif
|
||||
|
|
|
@ -93,7 +93,7 @@ static u16 get_spawn_info_index_of_object(struct Object* o) {
|
|||
////
|
||||
|
||||
void network_send_level_respawn_info(struct Object* o, u8 respawnInfoBits) {
|
||||
if (gNetworkType == NT_NONE) { return; }
|
||||
if (gNetworkType == NT_NONE || gNetworkPlayerLocal == NULL) { return; }
|
||||
|
||||
// make sure our area is valid
|
||||
if (!gNetworkPlayerLocal->currAreaSyncValid) {
|
||||
|
|
|
@ -383,7 +383,7 @@ static void packet_read_object_only_death(struct Packet* p, struct Object* o) {
|
|||
// ----- main send/receive ----- //
|
||||
|
||||
void network_send_object(struct Object* o) {
|
||||
if (gNetworkType == NT_NONE) { return; }
|
||||
if (gNetworkType == NT_NONE || gNetworkPlayerLocal == NULL) { return; }
|
||||
|
||||
// sanity check SyncObject
|
||||
if (!network_sync_object_initialized(o)) { return; }
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "socket.h"
|
||||
#include "pc/configfile.h"
|
||||
#include "pc/debuglog.h"
|
||||
#include "pc/djui/djui.h"
|
||||
|
||||
static SOCKET curSocket = INVALID_SOCKET;
|
||||
static struct sockaddr_in addr[MAX_PLAYERS] = { 0 };
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "pc/discord/discordrpc.h"
|
||||
#endif
|
||||
#include "pc/network/version.h"
|
||||
#include "pc/djui/djui.h"
|
||||
|
||||
OSMesg D_80339BEC;
|
||||
OSMesgQueue gSIEventMesgQueue;
|
||||
|
@ -266,6 +267,8 @@ void main_func(void) {
|
|||
audio_api = &audio_null;
|
||||
}
|
||||
|
||||
djui_init();
|
||||
|
||||
if (gCLIOpts.Network == NT_CLIENT) {
|
||||
network_set_system(NS_SOCKET);
|
||||
strncpy(configJoinIp, gCLIOpts.JoinIp, IP_MAX_LEN);
|
||||
|
|
Loading…
Reference in a new issue