[GTK3] Implement ROM loading from open file dialog

This commit is contained in:
Maximilian Mader 2020-04-11 18:55:21 +02:00
parent b67caec5cc
commit 6360389d08
Signed by: Max
GPG Key ID: F71D56A3151C4FB3

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;