diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index b29c3063..0fdb1c45 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -8524,6 +8524,11 @@ function deref_s32_pointer(pointer)
-- ...
end
+--- @return boolean
+function djui_is_popup_disabled()
+ -- ...
+end
+
--- @param message string
--- @param lines integer
--- @return nil
@@ -8531,6 +8536,17 @@ function djui_popup_create_global(message, lines)
-- ...
end
+--- @return nil
+function djui_reset_popup_disabled_override()
+ -- ...
+end
+
+--- @param value boolean
+--- @return nil
+function djui_set_popup_disabled_override(value)
+ -- ...
+end
+
--- @return integer
function get_current_save_file_num()
-- ...
diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md
index c1af7501..bcb5f24d 100644
--- a/docs/lua/functions-5.md
+++ b/docs/lua/functions-5.md
@@ -606,6 +606,24 @@
+## [djui_is_popup_disabled](#djui_is_popup_disabled)
+
+### Lua Example
+`local booleanValue = djui_is_popup_disabled()`
+
+### Parameters
+- None
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool djui_is_popup_disabled(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [djui_popup_create_global](#djui_popup_create_global)
### Lua Example
@@ -627,6 +645,44 @@
+## [djui_reset_popup_disabled_override](#djui_reset_popup_disabled_override)
+
+### Lua Example
+`djui_reset_popup_disabled_override()`
+
+### Parameters
+- None
+
+### Returns
+- None
+
+### C Prototype
+`void djui_reset_popup_disabled_override(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [djui_set_popup_disabled_override](#djui_set_popup_disabled_override)
+
+### Lua Example
+`djui_set_popup_disabled_override(value)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| value | `boolean` |
+
+### Returns
+- None
+
+### C Prototype
+`void djui_set_popup_disabled_override(bool value);`
+
+[:arrow_up_small:](#)
+
+
+
## [get_current_save_file_num](#get_current_save_file_num)
### Lua Example
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 9fc15ad1..ee11ad99 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -1590,7 +1590,10 @@
- [camera_unfreeze](functions-5.md#camera_unfreeze)
- [course_is_main_course](functions-5.md#course_is_main_course)
- [deref_s32_pointer](functions-5.md#deref_s32_pointer)
+ - [djui_is_popup_disabled](functions-5.md#djui_is_popup_disabled)
- [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_current_save_file_num](functions-5.md#get_current_save_file_num)
- [get_dialog_box_state](functions-5.md#get_dialog_box_state)
- [get_dialog_id](functions-5.md#get_dialog_id)
diff --git a/src/pc/djui/djui_popup.c b/src/pc/djui/djui_popup.c
index f0a68b14..4d0225a4 100644
--- a/src/pc/djui/djui_popup.c
+++ b/src/pc/djui/djui_popup.c
@@ -3,6 +3,8 @@
#include "audio/external.h"
#include "pc/network/network.h"
#include "pc/utils/misc.h"
+#include "pc/configfile.h"
+#include "pc/lua/utils/smlua_misc_utils.h"
#define DJUI_POPUP_LIFETIME 6.0f
@@ -34,6 +36,7 @@ static void djui_popup_destroy(struct DjuiBase* base) {
}
void djui_popup_create(const char* message, int lines) {
+ if (djui_is_popup_disabled()) { return; }
struct DjuiPopup* popup = calloc(1, sizeof(struct DjuiPopup));
struct DjuiBase* base = &popup->base;
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index aa388fe3..197bdd2e 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -28248,6 +28248,21 @@ int smlua_func_deref_s32_pointer(lua_State* L) {
return 1;
}
+int smlua_func_djui_is_popup_disabled(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", "djui_is_popup_disabled", 0, top);
+ return 0;
+ }
+
+
+ lua_pushboolean(L, djui_is_popup_disabled());
+
+ return 1;
+}
+
int smlua_func_djui_popup_create_global(lua_State* L) {
if (L == NULL) { return 0; }
@@ -28267,6 +28282,38 @@ int smlua_func_djui_popup_create_global(lua_State* L) {
return 1;
}
+int smlua_func_djui_reset_popup_disabled_override(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", "djui_reset_popup_disabled_override", 0, top);
+ return 0;
+ }
+
+
+ djui_reset_popup_disabled_override();
+
+ return 1;
+}
+
+int smlua_func_djui_set_popup_disabled_override(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", "djui_set_popup_disabled_override", 1, top);
+ return 0;
+ }
+
+ bool value = smlua_to_boolean(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_set_popup_disabled_override"); return 0; }
+
+ djui_set_popup_disabled_override(value);
+
+ return 1;
+}
+
int smlua_func_get_current_save_file_num(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@@ -32133,7 +32180,10 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "camera_unfreeze", smlua_func_camera_unfreeze);
smlua_bind_function(L, "course_is_main_course", smlua_func_course_is_main_course);
smlua_bind_function(L, "deref_s32_pointer", smlua_func_deref_s32_pointer);
+ smlua_bind_function(L, "djui_is_popup_disabled", smlua_func_djui_is_popup_disabled);
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_current_save_file_num", smlua_func_get_current_save_file_num);
smlua_bind_function(L, "get_dialog_box_state", smlua_func_get_dialog_box_state);
smlua_bind_function(L, "get_dialog_id", smlua_func_get_dialog_id);
diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c
index 9bb2bb00..0433b316 100644
--- a/src/pc/lua/utils/smlua_misc_utils.c
+++ b/src/pc/lua/utils/smlua_misc_utils.c
@@ -49,6 +49,30 @@ void djui_popup_create_global(const char* message, int lines) {
network_send_global_popup(message, lines);
}
+struct AllowDjuiPopupOverride {
+ bool value;
+ bool override;
+};
+
+struct AllowDjuiPopupOverride sAllowDjuiPopupOverride;
+
+bool djui_is_popup_disabled(void) {
+ // return override if there is one, otherwise return the value in the config.
+ return sAllowDjuiPopupOverride.override ? sAllowDjuiPopupOverride.value : configDisablePopups;
+}
+
+void djui_set_popup_disabled_override(bool value) {
+ // enable override
+ sAllowDjuiPopupOverride.override = true;
+ // set override to value specified in lua mod
+ sAllowDjuiPopupOverride.value = value;
+}
+
+void djui_reset_popup_disabled_override(void) {
+ // disable override
+ sAllowDjuiPopupOverride.override = false;
+}
+
///
void hud_hide(void) {
diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h
index d59d0d16..90aa7312 100644
--- a/src/pc/lua/utils/smlua_misc_utils.h
+++ b/src/pc/lua/utils/smlua_misc_utils.h
@@ -34,6 +34,9 @@ enum HudDisplayFlags {
};
void djui_popup_create_global(const char* message, int lines);
+bool djui_is_popup_disabled(void);
+void djui_set_popup_disabled_override(bool value);
+void djui_reset_popup_disabled_override(void);
void hud_hide(void);
void hud_show(void);
bool hud_is_hidden(void);
diff --git a/src/pc/network/network.c b/src/pc/network/network.c
index 751b7f2d..e1d9689a 100644
--- a/src/pc/network/network.c
+++ b/src/pc/network/network.c
@@ -695,4 +695,6 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
discord_activity_update();
#endif
packet_ordered_clear_all();
+
+ djui_reset_popup_disabled_override();
}