mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
add a way for Lua mods to detect what OS coop is running on (#338)
* patch for beta 32 * bump version * fix lakitu cam duplication hopefully * add a way for Lua mods to see what OS its running on
This commit is contained in:
parent
2f4008f9c9
commit
f7a3e5f0a6
6 changed files with 58 additions and 0 deletions
|
@ -8350,6 +8350,11 @@ function get_network_area_timer()
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @return string
|
||||
function get_os_name()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return integer
|
||||
function get_skybox()
|
||||
-- ...
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -110,4 +110,6 @@ u32 get_time(void);
|
|||
u16 get_envfx(void);
|
||||
void set_override_envfx(s32 envfx);
|
||||
|
||||
char* get_os_name(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue