diff --git a/build-windows-visual-studio/sm64ex.vcxproj b/build-windows-visual-studio/sm64ex.vcxproj
index de6cdfbc..bf0a6773 100644
--- a/build-windows-visual-studio/sm64ex.vcxproj
+++ b/build-windows-visual-studio/sm64ex.vcxproj
@@ -3965,7 +3965,7 @@
-
+
@@ -4410,7 +4410,7 @@
-
+
diff --git a/build-windows-visual-studio/sm64ex.vcxproj.filters b/build-windows-visual-studio/sm64ex.vcxproj.filters
index a9bc71dd..f8398e6b 100644
--- a/build-windows-visual-studio/sm64ex.vcxproj.filters
+++ b/build-windows-visual-studio/sm64ex.vcxproj.filters
@@ -15183,9 +15183,6 @@
Source Files\src\pc\djui\panel
-
- Source Files\src\pc\djui\panel
-
Source Files\src\pc\utils
@@ -15258,6 +15255,9 @@
Source Files\src\pc\djui\panel
+
+ Source Files\src\pc\djui\panel
+
@@ -16261,9 +16261,6 @@
Source Files\src\pc\djui\panel
-
- Source Files\src\pc\djui\panel
-
Source Files\src\pc\utils
@@ -16336,5 +16333,8 @@
Source Files\src\pc\djui\panel
+
+ Source Files\src\pc\djui\panel
+
\ No newline at end of file
diff --git a/src/pc/djui/djui.h b/src/pc/djui/djui.h
index bd277344..01a62541 100644
--- a/src/pc/djui/djui.h
+++ b/src/pc/djui/djui.h
@@ -43,7 +43,7 @@
#include "djui_panel_controls.h"
#include "djui_panel_display.h"
#include "djui_panel_sound.h"
-#include "djui_panel_quit.h"
+#include "djui_panel_confirm.h"
extern struct DjuiRoot* gDjuiRoot;
diff --git a/src/pc/djui/djui_panel_quit.c b/src/pc/djui/djui_panel_confirm.c
similarity index 78%
rename from src/pc/djui/djui_panel_quit.c
rename to src/pc/djui/djui_panel_confirm.c
index f554abf9..26107856 100644
--- a/src/pc/djui/djui_panel_quit.c
+++ b/src/pc/djui/djui_panel_confirm.c
@@ -1,22 +1,14 @@
#include "djui.h"
#include "src/pc/utils/misc.h"
-static void djui_panel_quit_yes(struct DjuiBase* base) {
- exit(0);
-}
-
-static void djui_panel_quit_no(struct DjuiBase* base) {
- djui_panel_back();
-}
-
-void djui_panel_quit_create(struct DjuiBase* caller) {
+void djui_panel_confirm_create(struct DjuiBase* caller, char* title, char* message, void (*on_yes_click)(struct DjuiBase*)) {
f32 bodyHeight = 64 * 2 + 16 * 1;
struct DjuiBase* defaultBase = NULL;
- struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\Q\\#1be700\\U\\#00b3ff\\I\\#ffef00\\T");
+ struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, title);
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
{
- struct DjuiText* text = djui_text_create(&body->base, "Are you sure you want to quit?");
+ struct DjuiText* text = djui_text_create(&body->base, message);
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&text->base, 1.0f, 64);
djui_base_set_color(&text->base, 200, 200, 200, 255);
@@ -31,14 +23,14 @@ void djui_panel_quit_create(struct DjuiBase* caller) {
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button1->base, 0.485f, 64);
djui_base_set_alignment(&button1->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
- djui_interactable_hook_click(&button1->base, djui_panel_quit_no);
+ djui_interactable_hook_click(&button1->base, djui_panel_menu_back);
defaultBase = &button1->base;
struct DjuiButton* button2 = djui_button_create(&rect1->base, "Yes");
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button2->base, 0.485f, 64);
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
- djui_interactable_hook_click(&button2->base, djui_panel_quit_yes);
+ djui_interactable_hook_click(&button2->base, on_yes_click);
}
}
diff --git a/src/pc/djui/djui_panel_confirm.h b/src/pc/djui/djui_panel_confirm.h
new file mode 100644
index 00000000..42d85870
--- /dev/null
+++ b/src/pc/djui/djui_panel_confirm.h
@@ -0,0 +1,5 @@
+#pragma once
+#include "djui.h"
+
+void djui_panel_confirm_create(struct DjuiBase* caller, char* title, char* message, void (*on_yes_click)(struct DjuiBase*));
+
diff --git a/src/pc/djui/djui_panel_host_save.c b/src/pc/djui/djui_panel_host_save.c
index b5fdfb37..5706d94e 100644
--- a/src/pc/djui/djui_panel_host_save.c
+++ b/src/pc/djui/djui_panel_host_save.c
@@ -18,9 +18,17 @@ static void djui_panel_host_save_button_click(struct DjuiBase* caller) {
djui_panel_menu_back(caller);
}
-static void djui_panel_host_save_erase_button_click(struct DjuiBase* caller) {
+static void djui_panel_host_save_erase_yes(struct DjuiBase* caller) {
save_file_erase(caller->tag);
djui_panel_host_save_update_button(sSaveButtons[caller->tag], caller->tag);
+ djui_panel_menu_back(caller);
+}
+
+static void djui_panel_host_save_erase(struct DjuiBase* caller) {
+ djui_panel_confirm_create(caller,
+ "\\#ff0800\\E\\#1be700\\R\\#00b3ff\\A\\#ffef00\\S\\#ff0800\\E",
+ "Are you sure you want to erase this save slot?",
+ djui_panel_host_save_erase_yes);
}
void djui_panel_host_save_create(struct DjuiBase* caller) {
@@ -50,7 +58,7 @@ void djui_panel_host_save_create(struct DjuiBase* caller) {
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button2->base, 0.24f, 32);
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
- djui_interactable_hook_click(&button2->base, djui_panel_host_save_erase_button_click);
+ djui_interactable_hook_click(&button2->base, djui_panel_host_save_erase);
}
}
}
diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c
index 5c262218..cfcd9496 100644
--- a/src/pc/djui/djui_panel_main.c
+++ b/src/pc/djui/djui_panel_main.c
@@ -3,6 +3,17 @@
bool gDjuiPanelMainCreated = false;
+static void djui_panel_main_quit_yes(struct DjuiBase* caller) {
+ exit(0);
+}
+
+static void djui_panel_main_quit(struct DjuiBase* caller) {
+ djui_panel_confirm_create(caller,
+ "\\#ff0800\\Q\\#1be700\\U\\#00b3ff\\I\\#ffef00\\T",
+ "Are you sure you want to quit?",
+ djui_panel_main_quit_yes);
+}
+
void djui_panel_main_create(struct DjuiBase* caller) {
f32 bodyHeight = 64 * 4 + 16 * 3;
@@ -32,7 +43,7 @@ void djui_panel_main_create(struct DjuiBase* caller) {
djui_base_set_size_type(&button4->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button4->base, 1.0f, 64);
djui_button_set_style(button4, 1);
- djui_interactable_hook_click(&button4->base, djui_panel_quit_create);
+ djui_interactable_hook_click(&button4->base, djui_panel_main_quit);
}
char* version = get_version();
diff --git a/src/pc/djui/djui_panel_quit.h b/src/pc/djui/djui_panel_quit.h
deleted file mode 100644
index 84323210..00000000
--- a/src/pc/djui/djui_panel_quit.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-#include "djui.h"
-
-void djui_panel_quit_create(struct DjuiBase* caller);
-