Log global popup messages in console

This commit is contained in:
MysterD 2023-11-08 00:37:53 -08:00
parent dba41da8ed
commit bbe24864b2
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#include "../network.h" #include "../network.h"
#include "pc/debuglog.h" #include "pc/debuglog.h"
#include "pc/djui/djui.h" #include "pc/djui/djui.h"
#include "pc/debuglog.h"
void network_send_global_popup(const char* message, int lines) { void network_send_global_popup(const char* message, int lines) {
// get message length // get message length
@ -31,4 +32,12 @@ void network_receive_global_popup(struct Packet* p) {
packet_read(p, message, messageLength * sizeof(u8)); packet_read(p, message, messageLength * sizeof(u8));
// show popup // show popup
djui_popup_create(message, lines); djui_popup_create(message, lines);
struct NetworkPlayer* np = &gNetworkPlayers[p->localIndex];
if (gNetworkSystem && gNetworkSystem->get_id_str && np->connected && strlen(np->name) > 0) {
LOG_CONSOLE("[%s] %s: %s", gNetworkSystem->get_id_str(np->localIndex), np->name, message);
LOG_INFO("[%s] %s: %s", gNetworkSystem->get_id_str(np->localIndex), np->name, message);
} else {
LOG_INFO("rx popup: %s", message);
}
} }