[GTK3] Implement ROM loading from open file dialog

This commit is contained in:
Maximilian Mader 2020-04-11 18:55:21 +02:00
parent 9b360ef292
commit e42d16290d
Signed by: Max
GPG Key ID: F71D56A3151C4FB3
1 changed files with 6 additions and 3 deletions

View File

@ -1096,8 +1096,10 @@ static void activate_open(GSimpleAction *action, GVariant *parameter, gpointer a
gint res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
if (res == GTK_RESPONSE_ACCEPT) {
// TODO: Emit an event for our emulation loop
g_message("%s", gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(native)));
const char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(native));
gui_data.file = g_file_new_for_path(path);
activate_reset(action, parameter, app);
}
g_object_unref(native);
@ -2090,6 +2092,8 @@ static void run(GuiData *gui_data) {
static gpointer run_thread(gpointer gui_data_gptr) {
GuiData *gui_data = gui_data_gptr;
if (!gui_data->file) return NULL;
if (gui_data->stopped) {
start(gui_data);
}
@ -2101,7 +2105,6 @@ static gpointer run_thread(gpointer gui_data_gptr) {
return NULL;
}
static void init(GuiData *gui_data) {
if (GB_is_inited(&gb)) return;