Add get_coop_compatibility_enabled and undefine SM64COOPDX_VERSION if it's on

This commit is contained in:
Agent X 2024-01-01 12:27:23 -05:00
parent e26f25e163
commit 0345a873b7
8 changed files with 50 additions and 2 deletions

View File

@ -259,7 +259,7 @@ def build_to_c(built_files):
txt = 'char gSmluaConstants[] = ""\n'
for line in lines:
txt += '"%s\\n"\n' % line
txt += ';'
txt += '"if get_coop_compatibility_enabled() then SM64COOPDX_VERSION = nil end";'
return txt
############################################################################

View File

@ -8686,6 +8686,11 @@ function djui_set_popup_disabled_override(value)
-- ...
end
--- @return boolean
function get_coop_compatibility_enabled()
-- ...
end
--- @return integer
function get_current_save_file_num()
-- ...

View File

@ -703,6 +703,24 @@
<br />
## [get_coop_compatibility_enabled](#get_coop_compatibility_enabled)
### Lua Example
`local booleanValue = get_coop_compatibility_enabled()`
### Parameters
- None
### Returns
- `boolean`
### C Prototype
`bool get_coop_compatibility_enabled(void);`
[:arrow_up_small:](#)
<br />
## [get_current_save_file_num](#get_current_save_file_num)
### Lua Example

View File

@ -1631,6 +1631,7 @@
- [djui_popup_create_global](functions-5.md#djui_popup_create_global)
- [djui_reset_popup_disabled_override](functions-5.md#djui_reset_popup_disabled_override)
- [djui_set_popup_disabled_override](functions-5.md#djui_set_popup_disabled_override)
- [get_coop_compatibility_enabled](functions-5.md#get_coop_compatibility_enabled)
- [get_current_save_file_num](functions-5.md#get_current_save_file_num)
- [get_date_and_time](functions-5.md#get_date_and_time)
- [get_dialog_box_state](functions-5.md#get_dialog_box_state)

View File

@ -4393,4 +4393,4 @@ char gSmluaConstants[] = ""
"VERSION_REGION = 'US'\n"
"MAX_VERSION_LENGTH = 32\n"
"MAX_LOCAL_VERSION_LENGTH = 36\n"
;
"if get_coop_compatibility_enabled() then SM64COOPDX_VERSION = nil end";

View File

@ -28719,6 +28719,21 @@ int smlua_func_djui_set_popup_disabled_override(lua_State* L) {
return 1;
}
int smlua_func_get_coop_compatibility_enabled(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_coop_compatibility_enabled", 0, top);
return 0;
}
lua_pushboolean(L, get_coop_compatibility_enabled());
return 1;
}
int smlua_func_get_current_save_file_num(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@ -32853,6 +32868,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "djui_popup_create_global", smlua_func_djui_popup_create_global);
smlua_bind_function(L, "djui_reset_popup_disabled_override", smlua_func_djui_reset_popup_disabled_override);
smlua_bind_function(L, "djui_set_popup_disabled_override", smlua_func_djui_set_popup_disabled_override);
smlua_bind_function(L, "get_coop_compatibility_enabled", smlua_func_get_coop_compatibility_enabled);
smlua_bind_function(L, "get_current_save_file_num", smlua_func_get_current_save_file_num);
smlua_bind_function(L, "get_date_and_time", smlua_func_get_date_and_time);
smlua_bind_function(L, "get_dialog_box_state", smlua_func_get_dialog_box_state);

View File

@ -622,6 +622,12 @@ void set_override_envfx(s32 envfx) {
///
bool get_coop_compatibility_enabled(void) {
return configCoopCompatibility;
}
///
const char* get_os_name(void) {
#if defined(_WIN32) || defined(_WIN64)
return "Windows";

View File

@ -153,6 +153,8 @@ struct DateTime* get_date_and_time(void);
u16 get_envfx(void);
void set_override_envfx(s32 envfx);
bool get_coop_compatibility_enabled(void);
const char* get_os_name(void);
#endif