mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Add mod_file_exists
This commit is contained in:
parent
856a828229
commit
69241bd3d9
6 changed files with 60 additions and 0 deletions
|
|
@ -8563,6 +8563,12 @@ function is_transition_playing()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param filename string
|
||||||
|
--- @return boolean
|
||||||
|
function mod_file_exists(filename)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param name string
|
--- @param name string
|
||||||
--- @param level integer
|
--- @param level integer
|
||||||
--- @param area integer
|
--- @param area integer
|
||||||
|
|
|
||||||
|
|
@ -3042,6 +3042,26 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [mod_file_exists](#mod_file_exists)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local booleanValue = mod_file_exists(filename)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| filename | `string` |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `boolean`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`bool mod_file_exists(const char* filename);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [movtexqc_register](#movtexqc_register)
|
## [movtexqc_register](#movtexqc_register)
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
|
|
|
||||||
|
|
@ -1792,6 +1792,7 @@
|
||||||
- [hud_show](functions-5.md#hud_show)
|
- [hud_show](functions-5.md#hud_show)
|
||||||
- [is_game_paused](functions-5.md#is_game_paused)
|
- [is_game_paused](functions-5.md#is_game_paused)
|
||||||
- [is_transition_playing](functions-5.md#is_transition_playing)
|
- [is_transition_playing](functions-5.md#is_transition_playing)
|
||||||
|
- [mod_file_exists](functions-5.md#mod_file_exists)
|
||||||
- [movtexqc_register](functions-5.md#movtexqc_register)
|
- [movtexqc_register](functions-5.md#movtexqc_register)
|
||||||
- [play_transition](functions-5.md#play_transition)
|
- [play_transition](functions-5.md#play_transition)
|
||||||
- [reset_window_title](functions-5.md#reset_window_title)
|
- [reset_window_title](functions-5.md#reset_window_title)
|
||||||
|
|
|
||||||
|
|
@ -31295,6 +31295,23 @@ int smlua_func_is_transition_playing(UNUSED lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_mod_file_exists(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 1) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mod_file_exists", 1, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* filename = smlua_to_string(L, 1);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mod_file_exists"); return 0; }
|
||||||
|
|
||||||
|
lua_pushboolean(L, mod_file_exists(filename));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int smlua_func_movtexqc_register(lua_State* L) {
|
int smlua_func_movtexqc_register(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
|
@ -35149,6 +35166,7 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "hud_show", smlua_func_hud_show);
|
smlua_bind_function(L, "hud_show", smlua_func_hud_show);
|
||||||
smlua_bind_function(L, "is_game_paused", smlua_func_is_game_paused);
|
smlua_bind_function(L, "is_game_paused", smlua_func_is_game_paused);
|
||||||
smlua_bind_function(L, "is_transition_playing", smlua_func_is_transition_playing);
|
smlua_bind_function(L, "is_transition_playing", smlua_func_is_transition_playing);
|
||||||
|
smlua_bind_function(L, "mod_file_exists", smlua_func_mod_file_exists);
|
||||||
smlua_bind_function(L, "movtexqc_register", smlua_func_movtexqc_register);
|
smlua_bind_function(L, "movtexqc_register", smlua_func_movtexqc_register);
|
||||||
smlua_bind_function(L, "play_transition", smlua_func_play_transition);
|
smlua_bind_function(L, "play_transition", smlua_func_play_transition);
|
||||||
smlua_bind_function(L, "reset_window_title", smlua_func_reset_window_title);
|
smlua_bind_function(L, "reset_window_title", smlua_func_reset_window_title);
|
||||||
|
|
|
||||||
|
|
@ -508,6 +508,19 @@ void set_environment_region(u8 index, s32 value) {
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
||||||
|
bool mod_file_exists(const char* filename) {
|
||||||
|
if (gLuaActiveMod == NULL) { return false; }
|
||||||
|
|
||||||
|
for (s32 i = 0; i < gLuaActiveMod->fileCount; i++) {
|
||||||
|
struct ModFile* file = &gLuaActiveMod->files[i];
|
||||||
|
return !strcmp(file->relativePath, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
|
||||||
void set_window_title(const char* title) {
|
void set_window_title(const char* title) {
|
||||||
WAPI.set_window_title(title);
|
WAPI.set_window_title(title);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,8 @@ void set_volume_env(f32 volume);
|
||||||
f32 get_environment_region(u8 index);
|
f32 get_environment_region(u8 index);
|
||||||
void set_environment_region(u8 index, s32 value);
|
void set_environment_region(u8 index, s32 value);
|
||||||
|
|
||||||
|
bool mod_file_exists(const char* filename);
|
||||||
|
|
||||||
void set_window_title(const char* title);
|
void set_window_title(const char* title);
|
||||||
void reset_window_title(void);
|
void reset_window_title(void);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue