Keep console messages around until the final djui_init()
This commit is contained in:
parent
0bb6fe8be9
commit
b0094f7ce4
|
@ -747,6 +747,7 @@ static void ParseGfxSymbol(GfxData* aGfxData, DataNode<Gfx>* aNode, Gfx*& aHead,
|
|||
gfx_symbol_5(gsDPLoadBlock);
|
||||
gfx_symbol_2(gsDPSetRenderMode, false);
|
||||
gfx_symbol_2(gsSPGeometryMode, false);
|
||||
gfx_symbol_2(gsSPGeometryModeSetFirst, false);
|
||||
gfx_symbol_6(gsDPSetPrimColor);
|
||||
gfx_symbol_4(gsDPSetEnvColor);
|
||||
gfx_symbol_4(gsDPSetFogColor);
|
||||
|
|
|
@ -11,6 +11,42 @@ struct DjuiConsole* gDjuiConsole = NULL;
|
|||
bool gDjuiConsoleFocus = false;
|
||||
char gDjuiConsoleTmpBuffer[CONSOLE_MAX_TMP_BUFFER] = "";
|
||||
u32 sDjuiConsoleMessages = 0;
|
||||
bool sDjuiConsoleQueueMessages = true;
|
||||
|
||||
struct ConsoleQueuedMessage {
|
||||
char* message;
|
||||
struct ConsoleQueuedMessage* next;
|
||||
};
|
||||
|
||||
struct ConsoleQueuedMessage* sConsoleQueuedMessages = NULL;
|
||||
|
||||
static void djui_console_message_queue(char* message) {
|
||||
struct ConsoleQueuedMessage* queued = malloc(sizeof(struct ConsoleQueuedMessage));
|
||||
queued->message = strdup(message);
|
||||
queued->next = NULL;
|
||||
if (sConsoleQueuedMessages == NULL) {
|
||||
sConsoleQueuedMessages = queued;
|
||||
return;
|
||||
}
|
||||
|
||||
struct ConsoleQueuedMessage* entry = sConsoleQueuedMessages;
|
||||
while (entry->next) { entry = entry->next; }
|
||||
entry->next = queued;
|
||||
}
|
||||
|
||||
void djui_console_message_dequeue(void) {
|
||||
if (!gDjuiConsole) { return; }
|
||||
sDjuiConsoleQueueMessages = false;
|
||||
struct ConsoleQueuedMessage* entry = sConsoleQueuedMessages;
|
||||
while (entry) {
|
||||
struct ConsoleQueuedMessage* next = entry->next;
|
||||
djui_console_message_create(entry->message);
|
||||
free(entry->message);
|
||||
free(entry);
|
||||
entry = next;
|
||||
}
|
||||
sConsoleQueuedMessages = NULL;
|
||||
}
|
||||
|
||||
void djui_console_toggle(void) {
|
||||
if (gDjuiConsole == NULL) { return; }
|
||||
|
@ -62,7 +98,10 @@ static bool djui_console_on_key_down(UNUSED struct DjuiBase* base, int scancode)
|
|||
}
|
||||
|
||||
void djui_console_message_create(char* message) {
|
||||
if (!gDjuiConsole) { return; }
|
||||
if (sDjuiConsoleQueueMessages || !gDjuiConsole) {
|
||||
djui_console_message_queue(message);
|
||||
return;
|
||||
}
|
||||
djui_base_compute_tree(&gDjuiConsole->panel->base);
|
||||
struct DjuiBase* cfBase = &gDjuiConsole->flow->base;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ extern struct DjuiConsole* gDjuiConsole;
|
|||
extern bool gDjuiConsoleFocus;
|
||||
extern char gDjuiConsoleTmpBuffer[];
|
||||
|
||||
void djui_console_message_dequeue(void);
|
||||
void djui_console_message_create(char* message);
|
||||
void djui_console_toggle(void);
|
||||
struct DjuiConsole* djui_console_create(void);
|
||||
|
|
|
@ -352,6 +352,7 @@ int main(int argc, char *argv[]) {
|
|||
djui_init();
|
||||
djui_unicode_init();
|
||||
djui_init_late();
|
||||
djui_console_message_dequeue();
|
||||
|
||||
// Init network
|
||||
if (gCLIOpts.Network == NT_CLIENT) {
|
||||
|
|
Loading…
Reference in New Issue