mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Exposed djui_language_get() (#524)
* Removed unintentionally exposed function and disallowed it in autogen * Exposed djui_language_get to lua
This commit is contained in:
parent
96dc4da358
commit
59aada62d7
9 changed files with 78 additions and 24 deletions
|
|
@ -32,6 +32,7 @@ in_files = [
|
||||||
"src/pc/network/network_utils.h",
|
"src/pc/network/network_utils.h",
|
||||||
"src/pc/djui/djui_console.h",
|
"src/pc/djui/djui_console.h",
|
||||||
"src/pc/djui/djui_chat_message.h",
|
"src/pc/djui/djui_chat_message.h",
|
||||||
|
"src/pc/djui/djui_language.h",
|
||||||
"src/game/interaction.h",
|
"src/game/interaction.h",
|
||||||
"src/game/level_info.h",
|
"src/game/level_info.h",
|
||||||
"src/game/save_file.h",
|
"src/game/save_file.h",
|
||||||
|
|
@ -74,6 +75,7 @@ override_allowed_functions = {
|
||||||
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music", "sound_get_level_intensity" ],
|
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music", "sound_get_level_intensity" ],
|
||||||
"src/game/rumble_init.c": [ "queue_rumble_", "reset_rumble_timers" ],
|
"src/game/rumble_init.c": [ "queue_rumble_", "reset_rumble_timers" ],
|
||||||
"src/pc/djui/djui_popup.h" : [ "create" ],
|
"src/pc/djui/djui_popup.h" : [ "create" ],
|
||||||
|
"src/pc/djui/djui_language.h" : [ "djui_language_get" ],
|
||||||
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags", "save_file_erase" ],
|
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags", "save_file_erase" ],
|
||||||
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
|
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
|
||||||
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
|
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
|
||||||
|
|
@ -89,7 +91,7 @@ override_allowed_functions = {
|
||||||
override_disallowed_functions = {
|
override_disallowed_functions = {
|
||||||
"src/audio/external.h": [ " func_" ],
|
"src/audio/external.h": [ " func_" ],
|
||||||
"src/engine/math_util.h": [ "atan2f", "vec3s_sub" ],
|
"src/engine/math_util.h": [ "atan2f", "vec3s_sub" ],
|
||||||
"src/engine/surface_load.h": [ "alloc_surface_poools" ],
|
"src/engine/surface_load.h": [ "alloc_surface_poools", "surface_has_force" ],
|
||||||
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
|
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
|
||||||
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
|
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
|
||||||
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
|
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
|
||||||
|
|
|
||||||
|
|
@ -3230,6 +3230,13 @@ function get_current_fov()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param section string
|
||||||
|
--- @param key string
|
||||||
|
--- @return string
|
||||||
|
function djui_language_get(section, key)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param message string
|
--- @param message string
|
||||||
--- @param lines integer
|
--- @param lines integer
|
||||||
function djui_popup_create(message, lines)
|
function djui_popup_create(message, lines)
|
||||||
|
|
|
||||||
|
|
@ -1090,6 +1090,7 @@
|
||||||
|
|
||||||
--- @class Mod
|
--- @class Mod
|
||||||
--- @field public basePath string
|
--- @field public basePath string
|
||||||
|
--- @field public category string
|
||||||
--- @field public customBehaviorIndex integer
|
--- @field public customBehaviorIndex integer
|
||||||
--- @field public description string
|
--- @field public description string
|
||||||
--- @field public enabled boolean
|
--- @field public enabled boolean
|
||||||
|
|
|
||||||
|
|
@ -2694,6 +2694,33 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
---
|
||||||
|
# functions from djui_language.h
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
|
## [djui_language_get](#djui_language_get)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local stringValue = djui_language_get(section, key)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| section | `string` |
|
||||||
|
| key | `string` |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `string`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`char* djui_language_get(const char *section, const char *key);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
---
|
---
|
||||||
# functions from djui_popup.h
|
# functions from djui_popup.h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5186,26 +5186,6 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
## [surface_has_force](#surface_has_force)
|
|
||||||
|
|
||||||
### Lua Example
|
|
||||||
`local booleanValue = surface_has_force(surfaceType)`
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
| Field | Type |
|
|
||||||
| ----- | ---- |
|
|
||||||
| surfaceType | `integer` |
|
|
||||||
|
|
||||||
### Returns
|
|
||||||
- `boolean`
|
|
||||||
|
|
||||||
### C Prototype
|
|
||||||
`bool surface_has_force(s16 surfaceType);`
|
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5]
|
[< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5]
|
||||||
|
|
|
||||||
|
|
@ -777,6 +777,11 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
- djui_language.h
|
||||||
|
- [djui_language_get](functions-3.md#djui_language_get)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
- djui_popup.h
|
- djui_popup.h
|
||||||
- [djui_popup_create](functions-3.md#djui_popup_create)
|
- [djui_popup_create](functions-3.md#djui_popup_create)
|
||||||
|
|
||||||
|
|
@ -1918,7 +1923,6 @@
|
||||||
- [load_area_terrain](functions-5.md#load_area_terrain)
|
- [load_area_terrain](functions-5.md#load_area_terrain)
|
||||||
- [load_object_collision_model](functions-5.md#load_object_collision_model)
|
- [load_object_collision_model](functions-5.md#load_object_collision_model)
|
||||||
- [obj_get_surface_from_index](functions-5.md#obj_get_surface_from_index)
|
- [obj_get_surface_from_index](functions-5.md#obj_get_surface_from_index)
|
||||||
- [surface_has_force](functions-5.md#surface_has_force)
|
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -895,7 +895,11 @@
|
||||||
| ----- | ---- | ------ |
|
| ----- | ---- | ------ |
|
||||||
| borderColor | [DjuiColor](structs.md#DjuiColor) | read-only |
|
| borderColor | [DjuiColor](structs.md#DjuiColor) | read-only |
|
||||||
| rectColor | [DjuiColor](structs.md#DjuiColor) | read-only |
|
| rectColor | [DjuiColor](structs.md#DjuiColor) | read-only |
|
||||||
=======
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [ExclamationBoxContent](#ExclamationBoxContent)
|
## [ExclamationBoxContent](#ExclamationBoxContent)
|
||||||
|
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
|
|
@ -1502,6 +1506,7 @@
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
| ----- | ---- | ------ |
|
| ----- | ---- | ------ |
|
||||||
| basePath | `string` | read-only |
|
| basePath | `string` | read-only |
|
||||||
|
| category | `string` | read-only |
|
||||||
| customBehaviorIndex | `integer` | read-only |
|
| customBehaviorIndex | `integer` | read-only |
|
||||||
| description | `string` | read-only |
|
| description | `string` | read-only |
|
||||||
| enabled | `boolean` | read-only |
|
| enabled | `boolean` | read-only |
|
||||||
|
|
|
||||||
|
|
@ -1229,9 +1229,10 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = {
|
||||||
{ "waterLevel", LVT_S16, offsetof(struct MarioState, waterLevel), false, LOT_NONE },
|
{ "waterLevel", LVT_S16, offsetof(struct MarioState, waterLevel), false, LOT_NONE },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LUA_MOD_FIELD_COUNT 15
|
#define LUA_MOD_FIELD_COUNT 16
|
||||||
static struct LuaObjectField sModFields[LUA_MOD_FIELD_COUNT] = {
|
static struct LuaObjectField sModFields[LUA_MOD_FIELD_COUNT] = {
|
||||||
{ "basePath", LVT_STRING, offsetof(struct Mod, basePath), true, LOT_NONE },
|
{ "basePath", LVT_STRING, offsetof(struct Mod, basePath), true, LOT_NONE },
|
||||||
|
{ "category", LVT_STRING_P, offsetof(struct Mod, category), true, LOT_NONE },
|
||||||
{ "customBehaviorIndex", LVT_U8, offsetof(struct Mod, customBehaviorIndex), true, LOT_NONE },
|
{ "customBehaviorIndex", LVT_U8, offsetof(struct Mod, customBehaviorIndex), true, LOT_NONE },
|
||||||
{ "description", LVT_STRING_P, offsetof(struct Mod, description), true, LOT_NONE },
|
{ "description", LVT_STRING_P, offsetof(struct Mod, description), true, LOT_NONE },
|
||||||
{ "enabled", LVT_BOOL, offsetof(struct Mod, enabled), true, LOT_NONE },
|
{ "enabled", LVT_BOOL, offsetof(struct Mod, enabled), true, LOT_NONE },
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include "src/pc/network/network_utils.h"
|
#include "src/pc/network/network_utils.h"
|
||||||
#include "src/pc/djui/djui_console.h"
|
#include "src/pc/djui/djui_console.h"
|
||||||
#include "src/pc/djui/djui_chat_message.h"
|
#include "src/pc/djui/djui_chat_message.h"
|
||||||
|
#include "src/pc/djui/djui_language.h"
|
||||||
#include "src/game/interaction.h"
|
#include "src/game/interaction.h"
|
||||||
#include "src/game/level_info.h"
|
#include "src/game/level_info.h"
|
||||||
#include "src/game/save_file.h"
|
#include "src/game/save_file.h"
|
||||||
|
|
@ -12787,6 +12788,29 @@ int smlua_func_get_current_fov(UNUSED lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////
|
||||||
|
// djui_language.h //
|
||||||
|
/////////////////////
|
||||||
|
|
||||||
|
int smlua_func_djui_language_get(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 2) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_language_get", 2, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* section = smlua_to_string(L, 1);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_language_get"); return 0; }
|
||||||
|
const char* key = smlua_to_string(L, 2);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_language_get"); return 0; }
|
||||||
|
|
||||||
|
lua_pushstring(L, djui_language_get(section, key));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
// djui_popup.h //
|
// djui_popup.h //
|
||||||
//////////////////
|
//////////////////
|
||||||
|
|
@ -34099,6 +34123,9 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "djui_open_pause_menu", smlua_func_djui_open_pause_menu);
|
smlua_bind_function(L, "djui_open_pause_menu", smlua_func_djui_open_pause_menu);
|
||||||
smlua_bind_function(L, "get_current_fov", smlua_func_get_current_fov);
|
smlua_bind_function(L, "get_current_fov", smlua_func_get_current_fov);
|
||||||
|
|
||||||
|
// djui_language.h
|
||||||
|
smlua_bind_function(L, "djui_language_get", smlua_func_djui_language_get);
|
||||||
|
|
||||||
// djui_popup.h
|
// djui_popup.h
|
||||||
smlua_bind_function(L, "djui_popup_create", smlua_func_djui_popup_create);
|
smlua_bind_function(L, "djui_popup_create", smlua_func_djui_popup_create);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue