Merge branch 'coop' into coopnet

This commit is contained in:
MysterD 2023-04-09 22:52:35 -07:00
commit 033035b887
14 changed files with 116 additions and 16 deletions

View File

@ -464,14 +464,6 @@ ifeq ($(filter clean distclean print-%,$(MAKECMDGOALS)),)
endif
ifeq ($(WINDOWS_AUTO_BUILDER),0)
# if the tools are out of date, clean them
TOOLS_VER_FILE := $(TOOLS_DIR)/tools-ver-1.ver
ifeq ($(wildcard $(TOOLS_VER_FILE)),)
$(info Cleaning tools...)
DUMMY != touch $(TOOLS_VER_FILE)
DUMMY != $(MAKE) -C $(TOOLS_DIR) clean >&2
endif
$(info Building tools...)
DUMMY != $(MAKE) -C $(TOOLS_DIR) >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
@ -947,6 +939,24 @@ ifeq ($(WINDOWS_BUILD),1)
endif
endif
# precomp custom sounds
# hacky stupid thing for windows builds (non-auto-builder)
# this way it won't fail to compile custom sounds anymore
ifeq ($(WINDOWS_BUILD),1)
ifeq ($(WINDOWS_AUTO_BUILDER),1)
else
ifeq ($(filter clean distclean,$(MAKECMDGOALS)),)
$(info Copying precomp samples...)
Command := mkdir -p "$(BUILD_DIR)/sound"
Resp := $(shell $(call Command))
Command := mkdir -p "$(BUILD_DIR)/sound/samples"
Resp := $(shell $(call Command))
Command := unzip -o "sound/precomp/samples.zip" -d "$(BUILD_DIR)/sound/"
Resp := $(shell $(call Command))
endif
endif
endif
# Coop specific libraries
# Zlib
@ -1146,6 +1156,7 @@ AIFF_EXTRACT_CODEBOOK := $(TOOLS_DIR)/aiff_extract_codebook
VADPCM_ENC := $(TOOLS_DIR)/vadpcm_enc
EXTRACT_DATA_FOR_MIO := $(TOOLS_DIR)/extract_data_for_mio
SKYCONV := $(TOOLS_DIR)/skyconv
# Use the system installed armips if available. Otherwise use the one provided with this repository.
ifneq (,$(call find-command,armips))
RSPASM := armips
@ -1398,7 +1409,7 @@ endif
$(BUILD_DIR)/%.table: %.aiff
$(call print,Extracting codebook:,$<,$@)
$(V)$(PYTHON) $(AIFF_EXTRACT_FAILSAFE) $(AIFF_EXTRACT_CODEBOOK) $< $@
$(V)$(AIFF_EXTRACT_CODEBOOK) $< >$@
$(call print,Piping:,$<,$@.inc.c)
$(V)hexdump -v -e '1/1 "0x%X,"' $< > $@.inc.c
$(V)echo >> $@.inc.c

View File

@ -8350,6 +8350,11 @@ function get_network_area_timer()
-- ...
end
--- @return string
function get_os_name()
-- ...
end
--- @return integer
function get_skybox()
-- ...

View File

@ -8353,6 +8353,24 @@
<br />
## [get_os_name](#get_os_name)
### Lua Example
`local stringValue = get_os_name()`
### Parameters
- None
### Returns
- `string`
### C Prototype
`char* get_os_name(void);`
[:arrow_up_small:](#)
<br />
## [get_skybox](#get_skybox)
### Lua Example

View File

@ -1554,6 +1554,7 @@
- [get_last_star_or_key](functions-4.md#get_last_star_or_key)
- [get_lighting_dir](functions-4.md#get_lighting_dir)
- [get_network_area_timer](functions-4.md#get_network_area_timer)
- [get_os_name](functions-4.md#get_os_name)
- [get_skybox](functions-4.md#get_skybox)
- [get_temp_s32_pointer](functions-4.md#get_temp_s32_pointer)
- [get_time](functions-4.md#get_time)

BIN
sound/precomp/samples.zip Normal file

Binary file not shown.

View File

@ -3,6 +3,7 @@
#include "djui_panel_main.h"
#include "djui_panel_pause.h"
#include "djui_panel_join_message.h"
#include "src/pc/debuglog.h"
#include "src/pc/utils/misc.h"
#include "sounds.h"
#include "audio/external.h"
@ -25,6 +26,10 @@ struct DjuiBase* djui_panel_find_first_interactable(struct DjuiBaseChild* child)
if (check) { return check; }
child = child->next;
}
// If we didn't find anything at all. Return NULL.
LOG_ERROR("Failed to find a interactable for child %p.", child);
return NULL;
}
struct DjuiPanel* djui_panel_add(struct DjuiBase* caller, struct DjuiThreePanel* threePanel, struct DjuiBase* defaultElementBase) {

View File

@ -10,6 +10,8 @@
#include "pc/mods/mods.h"
#include "pc/mods/mods_utils.h"
#define DJUI_MOD_PANEL_WIDTH (410.0f + (16 * 2.0f))
static struct DjuiFlowLayout* sModLayout = NULL;
static struct DjuiThreePanel* sDescriptionPanel = NULL;
static struct DjuiText* sTooltip = NULL;
@ -18,9 +20,10 @@ static void djui_panel_host_mods_description_create() {
f32 bodyHeight = 600;
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 64, bodyHeight, 0);
djui_base_set_alignment(&panel->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_CENTER);
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
djui_base_set_size(&panel->base, DJUI_DEFAULT_PANEL_WIDTH, 1.0f);
djui_base_set_size(&panel->base, DJUI_MOD_PANEL_WIDTH, 1.0f);
djui_base_set_color(&panel->base, 0, 0, 0, 240);
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
djui_base_set_border_width(&panel->base, 8);
@ -91,11 +94,13 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
bool isRomHacks = (caller->tag == 1);
mods_update_selectable();
djui_panel_host_mods_description_create();
struct DjuiThreePanel* panel = djui_panel_menu_create(isRomHacks
? DLANG(HOST_MODS, ROMHACKS)
: DLANG(HOST_MODS, MODS)
);
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
@ -121,5 +126,4 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
panel->base.destroy = djui_panel_host_mods_destroy;
djui_panel_add(caller, panel, NULL);
djui_panel_host_mods_description_create();
}

View File

@ -76,6 +76,10 @@ struct DjuiSelectionbox* djui_selectionbox_create(struct DjuiBase* parent, const
struct DjuiSelectionbox* selectionbox = calloc(1, sizeof(struct DjuiSelectionbox));
struct DjuiBase* base = &selectionbox->base;
if (*value >= choiceCount) {
*value = choiceCount - 1;
}
selectionbox->value = value;
selectionbox->choices = calloc(choiceCount, sizeof(char*));
for (int i = 0; i < choiceCount; i++) {

View File

@ -2017,6 +2017,10 @@ static void OPTIMIZE_O3 djui_gfx_dp_set_override(void* texture, uint32_t w, uint
}
static void OPTIMIZE_O3 djui_gfx_sp_simple_vertex(size_t n_vertices, size_t dest_index, const Vtx *vertices) {
gfx_sp_vertex(n_vertices, dest_index, vertices);
return;
/*
TODO: Figure out why the background of text goes black when mods print text
for (size_t i = 0; i < n_vertices; i++, dest_index++) {
const Vtx_t *v = &vertices[i].v;
struct LoadedVertex *d = &rsp.loaded_vertices[dest_index];
@ -2045,9 +2049,14 @@ static void OPTIMIZE_O3 djui_gfx_sp_simple_vertex(size_t n_vertices, size_t dest
d->color.a = v->cn[3];
}
*/
}
static void OPTIMIZE_O3 djui_gfx_sp_simple_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx) {
gfx_sp_tri1(vtx1_idx, vtx2_idx, vtx3_idx);
return;
/*
TODO: Figure out why the background of text goes black when mods print text
struct LoadedVertex *v1 = &rsp.loaded_vertices[vtx1_idx];
struct LoadedVertex *v2 = &rsp.loaded_vertices[vtx2_idx];
struct LoadedVertex *v3 = &rsp.loaded_vertices[vtx3_idx];
@ -2107,6 +2116,7 @@ static void OPTIMIZE_O3 djui_gfx_sp_simple_tri1(uint8_t vtx1_idx, uint8_t vtx2_i
if (++buf_vbo_num_tris == MAX_BUFFERED) {
gfx_flush();
}
*/
}
void OPTIMIZE_O3 djui_gfx_run_dl(Gfx* cmd) {

View File

@ -27230,6 +27230,21 @@ int smlua_func_get_network_area_timer(UNUSED lua_State* L) {
return 1;
}
int smlua_func_get_os_name(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_os_name", 0, top);
return 0;
}
lua_pushstring(L, get_os_name());
return 1;
}
int smlua_func_get_skybox(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@ -30616,6 +30631,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_last_star_or_key", smlua_func_get_last_star_or_key);
smlua_bind_function(L, "get_lighting_dir", smlua_func_get_lighting_dir);
smlua_bind_function(L, "get_network_area_timer", smlua_func_get_network_area_timer);
smlua_bind_function(L, "get_os_name", smlua_func_get_os_name);
smlua_bind_function(L, "get_skybox", smlua_func_get_skybox);
smlua_bind_function(L, "get_temp_s32_pointer", smlua_func_get_temp_s32_pointer);
smlua_bind_function(L, "get_time", smlua_func_get_time);

View File

@ -438,3 +438,19 @@ u16 get_envfx(void) {
void set_override_envfx(s32 envfx) {
gOverrideEnvFx = envfx;
}
char* get_os_name(void) {
#if defined(_WIN32) || defined(_WIN64)
return "Windows";
#elif __APPLE__ || __MACH__
return "Mac OSX";
#elif __linux__
return "Linux";
#elif __FreeBSD__
return "FreeBSD";
#elif __unix || __unix__
return "Unix";
#else
return "Unknown";
#endif
}

View File

@ -110,4 +110,6 @@ u32 get_time(void);
u16 get_envfx(void);
void set_override_envfx(s32 envfx);
char* get_os_name(void);
#endif

View File

@ -92,11 +92,18 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) {
if (*isLua) {
snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(MOD_DIRECTORY));
} else if (*isDynos) {
char* dynosPath = (char*)fs_get_write_path(DYNOS_RES_FOLDER);
if (!fs_sys_dir_exists(dynosPath)) {
fs_sys_mkdir(dynosPath);
}
snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(DYNOS_PACKS_FOLDER));
} else {
LOG_ERROR("Could not figure out what type of mod this is");
return false;
}
if (!fs_sys_dir_exists(dstDirectory)) {
fs_sys_mkdir(dstDirectory);
}
// Extract the archive
for (int i = 0; i < (int)mz_zip_reader_get_num_files(&zip_archive); i++) {

View File

@ -157,6 +157,12 @@ bool network_init(enum NetworkType inNetworkType) {
gChangeLevelTransition = gLevelValues.entryLevel;
}
#ifdef DISCORD_SDK
if (gNetworkSystem == &gNetworkSystemDiscord) {
discord_activity_update(true);
}
#endif
djui_chat_box_create();
}
@ -470,11 +476,6 @@ static void network_rehost_update(void) {
gDiscordReconnecting = true;
djui_panel_do_host();
#ifdef DISCORD_SDK
if (sNetworkReconnectType == NS_DISCORD) {
discord_activity_update(true);
}
#endif
gDiscordReconnecting = false;
}