1313#include <capstone/capstone.h>
1414#endif
1515
16- #include <stdatomic.h>
17- #include <GL/glew.h>
1816#include <SDL3/SDL.h>
17+ #include <SDL3/SDL_dialog.h>
18+ #include <GL/glew.h>
1919#include <cimgui.h>
20+ #include <stdatomic.h>
2021#include "gba/gba.h"
2122
2223#define GLSL (src ) "#version 330 core\n" #src
@@ -142,13 +143,26 @@ enum bind_actions {
142143
143144extern char const * const binds_pretty_name [];
144145extern char const * const binds_slug [];
146+ extern SDL_DialogFileFilter const sdl_nfd_bios_filters [];
147+ extern SDL_DialogFileFilter const sdl_nfd_rom_filters [];
148+ extern SDL_DialogFileFilter const sdl_nfd_save_filters [];
145149
146150enum app_notification_kind {
147151 UI_NOTIFICATION_INFO ,
148152 UI_NOTIFICATION_SUCCESS ,
149153 UI_NOTIFICATION_ERROR ,
150154};
151155
156+ enum nfd_event_kind {
157+ NFD_BIOS_PATH ,
158+ NFD_ROM_PATH ,
159+ NFD_EXPORT_SAVE ,
160+ NFD_IMPORT_SAVE ,
161+ NFD_SAVE_DIR ,
162+ NFD_QUICKSAVE_DIR ,
163+ NFD_SCREENSHOT_DIR ,
164+ };
165+
152166enum menu_kind {
153167 MENU_GENERAL ,
154168 MENU_EMULATION ,
@@ -167,6 +181,14 @@ struct app_notification {
167181 struct app_notification * next ;
168182};
169183
184+ struct nfd_event {
185+ enum nfd_event_kind kind ;
186+ struct app * app ;
187+ char * path ;
188+
189+ struct nfd_event * next ;
190+ };
191+
170192struct keyboard_binding {
171193 SDL_Keycode key ;
172194
@@ -400,6 +422,12 @@ struct app {
400422 bool left ;
401423 } joystick ;
402424 } gamepad ;
425+
426+ struct {
427+ pthread_mutex_t lock ;
428+
429+ struct nfd_event * head ;
430+ } nfd ;
403431 } sdl ;
404432
405433 struct {
@@ -652,6 +680,9 @@ void app_emulator_set_watchpoints_list(struct app *app, struct watchpoint *watch
652680/* event.c */
653681void app_sdl_handle_events (struct app * app , SDL_Event * event );
654682void app_sdl_set_rumble (struct app const * app , bool enable );
683+ void app_nfd_process_events (struct app * app );
684+ void app_nfd_update_path (void * raw_event , const char * const * filelist , int filter );
685+ struct nfd_event * app_nfd_create_event (struct app * app , enum nfd_event_kind kind );
655686
656687/* path.c */
657688void app_paths_update (struct app * app );
0 commit comments