diff --git a/autogen/autogen.sh b/autogen/autogen.sh
index 2fc103edb..4d46dec0b 100755
--- a/autogen/autogen.sh
+++ b/autogen/autogen.sh
@@ -1,4 +1,4 @@
#!/usr/bin/bash
python3 ./autogen/convert_structs.py $1
python3 ./autogen/convert_functions.py $1
-python3 ./autogen/convert_constants.py $1
\ No newline at end of file
+python3 ./autogen/convert_constants.py $1
diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index d841e9c84..8931448ce 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -8400,6 +8400,13 @@ function deref_s32_pointer(pointer)
-- ...
end
+--- @param message string
+--- @param lines integer
+--- @return nil
+function djui_popup_create_global(message, lines)
+ -- ...
+end
+
--- @return integer
function get_current_save_file_num()
-- ...
diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md
index cb720bc10..d0d28c133 100644
--- a/docs/lua/functions-5.md
+++ b/docs/lua/functions-5.md
@@ -546,6 +546,27 @@
+## [djui_popup_create_global](#djui_popup_create_global)
+
+### Lua Example
+`djui_popup_create_global(message, lines)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| message | `string` |
+| lines | `integer` |
+
+### Returns
+- None
+
+### C Prototype
+`void djui_popup_create_global(const char* message, int lines);`
+
+[: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 c66c5e9a1..64d72d4de 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -1567,6 +1567,7 @@
- [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_popup_create_global](functions-5.md#djui_popup_create_global)
- [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/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 26755c040..ace55d83e 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -27903,6 +27903,25 @@ int smlua_func_deref_s32_pointer(lua_State* L) {
return 1;
}
+int smlua_func_djui_popup_create_global(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_popup_create_global", 2, top);
+ return 0;
+ }
+
+ const char* message = smlua_to_string(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_popup_create_global"); return 0; }
+ int lines = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_popup_create_global"); return 0; }
+
+ djui_popup_create_global(message, lines);
+
+ return 1;
+}
+
int smlua_func_get_current_save_file_num(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@@ -31554,6 +31573,7 @@ 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_popup_create_global", smlua_func_djui_popup_create_global);
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 8176096b2..05bde2a5a 100644
--- a/src/pc/lua/utils/smlua_misc_utils.c
+++ b/src/pc/lua/utils/smlua_misc_utils.c
@@ -44,6 +44,11 @@ s32 deref_s32_pointer(s32* pointer) {
///
+void djui_popup_create_global(const char* message, int lines) {
+ djui_popup_create(message, lines);
+ network_send_global_popup(message, lines);
+}
+
void hud_hide(void) {
gOverrideHideHud = 1;
}
diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h
index 55a7a2287..fa69bf0db 100644
--- a/src/pc/lua/utils/smlua_misc_utils.h
+++ b/src/pc/lua/utils/smlua_misc_utils.h
@@ -32,6 +32,7 @@ enum HudDisplayFlags {
HUD_DISPLAY_FLAGS_EMPHASIZE_POWER = 0x8000,
};
+void djui_popup_create_global(const char* message, int lines);
void hud_hide(void);
void hud_show(void);
bool hud_is_hidden(void);
diff --git a/src/pc/network/packets/packet.c b/src/pc/network/packets/packet.c
index dcf8e4039..eb321820f 100644
--- a/src/pc/network/packets/packet.c
+++ b/src/pc/network/packets/packet.c
@@ -85,7 +85,7 @@ void packet_process(struct Packet* p) {
case PACKET_COLLECT_STAR: network_receive_collect_star(p); break;
case PACKET_COLLECT_COIN: network_receive_collect_coin(p); break;
case PACKET_COLLECT_ITEM: network_receive_collect_item(p); break;
- case PACKET_UNUSED1: break;
+ case PACKET_GLOBAL_POPUP: network_receive_global_popup(p); break;
case PACKET_DEBUG_SYNC: network_receive_debug_sync(p); break;
case PACKET_JOIN_REQUEST: network_receive_join_request(p); break;
case PACKET_JOIN: network_receive_join(p); break;
diff --git a/src/pc/network/packets/packet.h b/src/pc/network/packets/packet.h
index 859ac620f..d7b9cd91f 100644
--- a/src/pc/network/packets/packet.h
+++ b/src/pc/network/packets/packet.h
@@ -23,7 +23,7 @@ enum PacketType {
PACKET_COLLECT_STAR,
PACKET_COLLECT_COIN,
PACKET_COLLECT_ITEM,
- PACKET_UNUSED1,
+ PACKET_GLOBAL_POPUP,
PACKET_DEBUG_SYNC,
PACKET_JOIN_REQUEST,
PACKET_JOIN,
@@ -352,6 +352,10 @@ void network_receive_download_request(struct Packet* p);
void network_send_download(u64 offset);
void network_receive_download(struct Packet* p);
+// packet_global_popup.c
+void network_send_global_popup(const char* message, int lines);
+void network_receive_global_popup(struct Packet* p);
+
// packet_lua_sync_table.c
void network_send_lua_sync_table_request(void);
void network_receive_lua_sync_table_request(struct Packet* p);
diff --git a/src/pc/network/packets/packet_global_popup.c b/src/pc/network/packets/packet_global_popup.c
new file mode 100644
index 000000000..76960b6c2
--- /dev/null
+++ b/src/pc/network/packets/packet_global_popup.c
@@ -0,0 +1,38 @@
+#include
+#include "../network.h"
+#include "pc/debuglog.h"
+#include "pc/djui/djui.h"
+
+void network_send_global_popup(const char* message, int lines) {
+ // get message length
+ u16 messageLength = strlen(message);
+
+ // make message mutable
+ char mutableMessage[messageLength];
+ strcpy(mutableMessage, message);
+
+ // configure packet
+ struct Packet p = { 0 };
+ packet_init(&p, PACKET_GLOBAL_POPUP, true, PLMT_NONE);
+ packet_write(&p, &lines, sizeof(int));
+ packet_write(&p, &messageLength, sizeof(u16));
+ packet_write(&p, mutableMessage, messageLength * sizeof(u8));
+
+ // send the packet
+ network_send(&p);
+}
+
+void network_receive_global_popup(struct Packet* p) {
+
+ u16 messageLength = 0;
+ char message[256] = { 0 };
+ int lines;
+
+ // read data
+ packet_read(p, &lines, sizeof(int));
+ packet_read(p, &messageLength, sizeof(u16));
+ if (messageLength >= 255) { messageLength = 255; }
+ packet_read(p, &message, messageLength * sizeof(u8));
+ // show popup
+ djui_popup_create(&message, lines);
+}
\ No newline at end of file