Fix djui_popup_create_global()

This commit is contained in:
MysterD 2023-05-31 21:07:41 -07:00
parent 3e52c4f5db
commit aaaf59e1e4
1 changed files with 3 additions and 7 deletions

View File

@ -7,16 +7,12 @@ 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));
packet_write(&p, (char*)message, messageLength * sizeof(u8));
// send the packet
network_send(&p);
@ -32,7 +28,7 @@ void network_receive_global_popup(struct Packet* p) {
packet_read(p, &lines, sizeof(int));
packet_read(p, &messageLength, sizeof(u16));
if (messageLength >= 255) { messageLength = 255; }
packet_read(p, &message, messageLength * sizeof(u8));
packet_read(p, message, messageLength * sizeof(u8));
// show popup
djui_popup_create(&message, lines);
djui_popup_create(message, lines);
}