Fix bugs and make mod import go to AppData

This commit is contained in:
Agent X 2023-12-18 16:22:42 -05:00
parent 170ee24e50
commit 8f28eb2e0d
5 changed files with 29 additions and 12 deletions

View file

@ -627,6 +627,9 @@ _ := $(shell rm -rf ./$(BUILD_DIR)/$(LANG_DIR))
MOD_DIR := mods MOD_DIR := mods
# Remove old mod dir
_ := $(PYTHON) $(TOOLS_DIR)/remove_built_in_mods.py
# Automatic dependency files # Automatic dependency files
DEP_FILES := $(O_FILES:.o=.d) $(ULTRA_O_FILES:.o=.d) $(GODDARD_O_FILES:.o=.d) $(BUILD_DIR)/$(LD_SCRIPT).d DEP_FILES := $(O_FILES:.o=.d) $(ULTRA_O_FILES:.o=.d) $(GODDARD_O_FILES:.o=.d) $(BUILD_DIR)/$(LD_SCRIPT).d
@ -1170,9 +1173,7 @@ $(BUILD_DIR)/$(LANG_DIR):
@$(CP) -f -r $(LANG_DIR) $(BUILD_DIR) @$(CP) -f -r $(LANG_DIR) $(BUILD_DIR)
$(BUILD_DIR)/$(MOD_DIR): $(BUILD_DIR)/$(MOD_DIR):
@if [ ! -d "$(BUILD_DIR)/$(MOD_DIR)" ]; then \ $(CP) -f -r $(MOD_DIR) $(BUILD_DIR)
$(CP) -f -r $(MOD_DIR) $(BUILD_DIR); \
fi
# Extra object file dependencies # Extra object file dependencies

View file

@ -1,16 +1,16 @@
-- name: [CS] Vl and Cjes Luigi -- name: [CS] VL-Tone & Cjes Luigi
-- description: A character swap mod using the Character Select's API. -- description: A character swap mod using the Character Select's API.
local E_MODEL_VL = smlua_model_util_get_id("vl_geo") local E_MODEL_VL = smlua_model_util_get_id("vl_geo")
local E_MODEL_CJES = smlua_model_util_get_id("cjes_geo") local E_MODEL_CJES = smlua_model_util_get_id("cjes_geo")
local TEXT_MOD_NAME = "Vl and Cjes Luigi" local TEXT_MOD_NAME = "VL-Tone & Cjes Luigi"
local TEX_LUIGI = get_texture_info("luigi-icon") local TEX_LUIGI = get_texture_info("luigi-icon")
if _G.charSelectExists then if _G.charSelectExists then
_G.charSelect.character_add("VL Luigi", {" A fanmade model of Luigi.", "The model was created for the", "program Toad's Tool 64, a romhack editor.", "This model is a nostalgic throwback to", "many players in the SM64 Community!"}, "VL Tone", {r = 0, g = 152, b = 0}, E_MODEL_VL, CT_LUIGI, TEX_LUIGI) _G.charSelect.character_add("VL-Tone Luigi", {" A fanmade model of Luigi.", "The model was created for the", "program Toad's Tool 64, a romhack editor.", "This model is a nostalgic throwback to", "many players in the SM64 Community!"}, "VL-Tone", {r = 0, g = 152, b = 0}, E_MODEL_VL, CT_LUIGI, TEX_LUIGI)
_G.charSelect.character_add("Cjes Luigi", {"Another fanmade Luigi model.", "The model originates from Super", "Luigi 64 in 2015.", "This model originally was the", "main Luigi model for ex-Coop before", "the giga leak occured in 2020 and", "eventually replaced it." }, "Cjes", {r = 0, g = 152, b = 0}, E_MODEL_CJES, CT_LUIGI, TEX_LUIGI) _G.charSelect.character_add("Cjes Luigi", {"Another fanmade Luigi model.", "The model originates from Super", "Luigi 64 in 2015.", "This model originally was the", "main Luigi model for ex-Coop before", "the giga leak occured in 2020 and", "eventually replaced it." }, "Cjes", {r = 0, g = 152, b = 0}, E_MODEL_CJES, CT_LUIGI, TEX_LUIGI)
else else
djui_popup_create("\\#ffffdc\\\n"..TEXT_MOD_NAME.."\nRequires the Character Select Mod\nto use as a Library!\n\nPlease turn on the Character Select Mod\nand Restart the Room!", 6) djui_popup_create("\\#ffffdc\\\n"..TEXT_MOD_NAME.."\nRequires the Character Select Mod\nto use as a Library!\n\nPlease turn on the Character Select Mod\nand Restart the Room!", 6)
end end

View file

@ -247,8 +247,9 @@ u16 level_control_timer(s32 timerOp) {
u32 pressed_pause(void) { u32 pressed_pause(void) {
u32 dialogActive = get_dialog_id() >= 0; u32 dialogActive = get_dialog_id() >= 0;
u32 intangible = (gMarioState->action & ACT_FLAG_INTANGIBLE) != 0; u32 intangible = (gMarioState->action & ACT_FLAG_INTANGIBLE) != 0;
u32 firstPerson = gMarioState->action == ACT_FIRST_PERSON;
if (!intangible && !dialogActive && !gWarpTransition.isActive && sDelayedWarpOp == WARP_OP_NONE if (!intangible && !dialogActive && !firstPerson && !gWarpTransition.isActive && sDelayedWarpOp == WARP_OP_NONE
&& (gPlayer1Controller->buttonPressed & START_BUTTON)) { && (gPlayer1Controller->buttonPressed & START_BUTTON)) {
return TRUE; return TRUE;
} }

View file

@ -11,7 +11,7 @@
static bool mod_import_lua(char* src) { static bool mod_import_lua(char* src) {
char dst[SYS_MAX_PATH] = { 0 }; char dst[SYS_MAX_PATH] = { 0 };
if (!concat_path(dst, (char*)MOD_DIRECTORY, path_basename(src))) { if (!concat_path(dst, (char*)fs_get_write_path(MOD_DIRECTORY), path_basename(src))) {
LOG_ERROR("Failed to concat path for lua mod import"); LOG_ERROR("Failed to concat path for lua mod import");
return false; return false;
} }
@ -93,13 +93,13 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) {
char dstDirectory[SYS_MAX_PATH] = { 0 }; char dstDirectory[SYS_MAX_PATH] = { 0 };
char dst[SYS_MAX_PATH] = { 0 }; char dst[SYS_MAX_PATH] = { 0 };
if (*isLua) { if (*isLua) {
snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)MOD_DIRECTORY); snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(MOD_DIRECTORY));
} else if (*isDynos) { } else if (*isDynos) {
char* dynosPath = (char*)DYNOS_RES_FOLDER; char* dynosPath = (char*)fs_get_write_path(DYNOS_RES_FOLDER);
if (!fs_sys_dir_exists(dynosPath)) { if (!fs_sys_dir_exists(dynosPath)) {
fs_sys_mkdir(dynosPath); fs_sys_mkdir(dynosPath);
} }
snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)DYNOS_PACKS_FOLDER); snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(DYNOS_PACKS_FOLDER));
} else { } else {
LOG_ERROR("Could not figure out what type of mod this is"); LOG_ERROR("Could not figure out what type of mod this is");
mz_zip_reader_end(&zip_archive); mz_zip_reader_end(&zip_archive);

View file

@ -0,0 +1,15 @@
import os
import sys
if not os.path.exists("build/us_pc/mods"):
sys.exit(0)
built_in_mods = []
for mod in os.listdir("mods"):
if os.path.isdir(mod) or (os.path.isfile(mod) and mod.endswith(".lua")):
built_in_mods.append(mod)
for mod in os.listdir("build/us_pc/mods"):
if mod in built_in_mods:
os.remove(mod)