diff --git a/.gitignore b/.gitignore index c795b05..ab1a14e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,9 @@ -build \ No newline at end of file +build + +# intermediate source files generated at build time +gtk3/sameboy-gtk3-resources.c +gtk3/resources/gtk3/ + +# temporary backup file +*.*~ + diff --git a/Makefile b/Makefile index 79b5e14..01fafa1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Make hacks -.INTERMEDIATE: +.INTERMEDIATE: gtk3/sameboy-gtk3-resources.c # Set target, configuration, version and destination folders @@ -83,12 +83,16 @@ endif CFLAGS += -Werror -Wall -Wno-unused-result -Wno-strict-aliasing -Wno-unknown-warning -Wno-unknown-warning-option -Wno-multichar -Wno-int-in-bool-context -std=gnu11 -D_GNU_SOURCE -DVERSION="$(VERSION)" -I. -D_USE_MATH_DEFINES SDL_LDFLAGS := -lSDL2 -lGL +GTK3_CFLAGS := `pkg-config --cflags gtk+-3.0` -DGTK_DISABLE_DEPRECATED=1 -DG_DISABLE_DEPRECATED=1 +GTK3_LDFLAGS := `pkg-config --libs gtk+-3.0` + ifeq ($(PLATFORM),windows32) CFLAGS += -IWindows -Drandom=rand LDFLAGS += -lmsvcrt -lcomdlg32 -lSDL2main -Wl,/MANIFESTFILE:NUL SDL_LDFLAGS := -lSDL2 -lopengl32 else LDFLAGS += -lc -lm -ldl +GTK3_LDFLAGS += -Wl -rdynamic endif ifeq ($(PLATFORM),Darwin) @@ -129,6 +133,7 @@ endif cocoa: $(BIN)/SameBoy.app quicklook: $(BIN)/SameBoy.qlgenerator sdl: $(SDL_TARGET) $(BIN)/SDL/dmg_boot.bin $(BIN)/SDL/cgb_boot.bin $(BIN)/SDL/agb_boot.bin $(BIN)/SDL/sgb_boot.bin $(BIN)/SDL/sgb2_boot.bin $(BIN)/SDL/LICENSE $(BIN)/SDL/registers.sym $(BIN)/SDL/background.bmp $(BIN)/SDL/Shaders +gtk3: $(BIN)/gtk3/sameboy bootroms: $(BIN)/BootROMs/agb_boot.bin $(BIN)/BootROMs/cgb_boot.bin $(BIN)/BootROMs/dmg_boot.bin $(BIN)/BootROMs/sgb_boot.bin $(BIN)/BootROMs/sgb2_boot.bin tester: $(TESTER_TARGET) $(BIN)/tester/dmg_boot.bin $(BIN)/tester/cgb_boot.bin $(BIN)/tester/agb_boot.bin $(BIN)/tester/sgb_boot.bin $(BIN)/tester/sgb2_boot.bin all: cocoa sdl tester libretro @@ -137,6 +142,7 @@ all: cocoa sdl tester libretro CORE_SOURCES := $(shell ls Core/*.c) SDL_SOURCES := $(shell ls SDL/*.c) $(OPEN_DIALOG) +GTK3_SOURCES := $(shell ls gtk3/*.c) gtk3/sameboy-gtk3-resources.c TESTER_SOURCES := $(shell ls Tester/*.c) ifeq ($(PLATFORM),Darwin) @@ -152,6 +158,7 @@ CORE_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(CORE_SOURCES)) COCOA_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(COCOA_SOURCES)) QUICKLOOK_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(QUICKLOOK_SOURCES)) SDL_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(SDL_SOURCES)) +GTK3_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(GTK3_SOURCES)) TESTER_OBJECTS := $(patsubst %,$(OBJ)/%.o,$(TESTER_SOURCES)) # Automatic dependency generation @@ -161,6 +168,9 @@ ifneq ($(filter-out clean bootroms libretro %.bin, $(MAKECMDGOALS)),) ifneq ($(filter $(MAKECMDGOALS),sdl),) -include $(SDL_OBJECTS:.o=.dep) endif +ifneq ($(filter $(MAKECMDGOALS),gtk3),) +-include $(GTK3_OBJECTS:.o=.gtk3dep) +endif ifneq ($(filter $(MAKECMDGOALS),tester),) -include $(TESTER_OBJECTS:.o=.dep) endif @@ -169,6 +179,16 @@ ifneq ($(filter $(MAKECMDGOALS),cocoa),) endif endif +gtk3/sameboy-gtk3-resources.c: gtk3/sameboy.gresource.xml $(shell glib-compile-resources --sourcedir=gtk3/resources --generate-dependencies gtk3/sameboy.gresource.xml) + glib-compile-resources --sourcedir=gtk3/resources --target=$@ --generate-source $< + # Resource hack cleanup + rm -rf gtk3/resources/gtk3 + +# GTK3 requires special CFLAGS +$(OBJ)/gtk3/%.gtk3dep: % + -@$(MKDIR) -p $(dir $@) + $(CC) $(CFLAGS) $(GTK3_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@ + $(OBJ)/%.dep: % -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@ @@ -179,15 +199,20 @@ $(OBJ)/Core/%.c.o: Core/%.c -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) -DGB_INTERNAL -c $< -o $@ +# GTK3 requires special CFLAGS +$(OBJ)/gtk3/%.c.o: gtk3/%.c + -@$(MKDIR) -p $(dir $@) + $(CC) $(CFLAGS) $(GTK3_CFLAGS) -c $< -o $@ + $(OBJ)/%.c.o: %.c -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) -c $< -o $@ - + # HexFiend requires more flags $(OBJ)/HexFiend/%.m.o: HexFiend/%.m -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(OCFLAGS) -c $< -o $@ -fno-objc-arc -include HexFiend/HexFiend_2_Framework_Prefix.pch - + $(OBJ)/%.m.o: %.m -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(OCFLAGS) -c $< -o $@ @@ -225,7 +250,7 @@ endif $(BIN)/SameBoy.app/Contents/Resources/Base.lproj/%.nib: Cocoa/%.xib ibtool --compile $@ $^ - + # Quick Look generator $(BIN)/SameBoy.qlgenerator: $(BIN)/SameBoy.qlgenerator/Contents/MacOS/SameBoyQL \ @@ -250,7 +275,7 @@ endif $(BIN)/SameBoy.qlgenerator/Contents/Resources/cgb_boot_fast.bin: $(BIN)/BootROMs/cgb_boot_fast.bin -@$(MKDIR) -p $(dir $@) cp -f $^ $@ - + # SDL Port # Unix versions build only one binary @@ -261,7 +286,7 @@ ifeq ($(CONF), release) strip $@ endif -# Windows version builds two, one with a conole and one without it +# Windows version builds two, one with a console and one without it $(BIN)/SDL/sameboy.exe: $(CORE_OBJECTS) $(SDL_OBJECTS) $(OBJ)/Windows/resources.o -@$(MKDIR) -p $(dir $@) $(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS) -Wl,/subsystem:windows @@ -277,7 +302,7 @@ $(OBJ)/%.o: %.rc else $(OBJ)/%.res: %.rc -@$(MKDIR) -p $(dir $@) - rc /fo $@ /dVERSION=\"$(VERSION)\" $^ + rc /fo $@ /dVERSION=\"$(VERSION)\" $^ %.o: %.res cvtres /OUT:"$@" $^ @@ -288,6 +313,15 @@ $(BIN)/SDL/SDL2.dll: @$(eval MATCH := $(shell where $$LIB:SDL2.dll)) cp "$(MATCH)" $@ +# GTK3 + +$(BIN)/gtk3/sameboy: $(CORE_OBJECTS) $(GTK3_OBJECTS) + -@$(MKDIR) -p $(dir $@) + $(CC) $^ -o $@ $(LDFLAGS) $(GTK3_LDFLAGS) +ifeq ($(CONF), release) + strip $@ +endif + # Tester $(BIN)/tester/sameboy_tester: $(CORE_OBJECTS) $(TESTER_OBJECTS) @@ -325,6 +359,15 @@ $(BIN)/SDL/Shaders: Shaders -@$(MKDIR) -p $@ cp -rf Shaders/*.fsh $@ +# Fugly resource hack +gtk3/resources/bootroms/%.bin: $(BOOTROMS_DIR)/%.bin + -@$(MKDIR) -p gtk3/resources/gtk3/resources/bootroms/ + cp -f $< gtk3/resources/$@ + +gtk3/resources/Shaders/%.fsh: Shaders/%.fsh + -@$(MKDIR) -p gtk3/resources/gtk3/resources/Shaders/ + cp -rf $< gtk3/resources/$@ + # Boot ROMs $(OBJ)/%.1bpp: %.png diff --git a/gtk3/main.c b/gtk3/main.c new file mode 100644 index 0000000..ddfa699 --- /dev/null +++ b/gtk3/main.c @@ -0,0 +1,264 @@ +#include +#include +#include +#include +#include +#include + +#define str(x) #x +#define xstr(x) str(x) + +#define RESOURCE_PREFIX "/io/github/sameboy/" +#define APP_ID "io.github.sameboy" + +GtkBuilder *builder; +GtkWindow *main_window; +GtkGLArea *gl_area; + +GB_gameboy_t gb; + +typedef struct UserData { + bool fullscreen; + GFile *file; +} UserData; + +// Determines if a ComboBox entry should be converted into a separator. +// Each element with a text value of `` will be converted into a separator element. +static gboolean is_separator(GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { + gchar *text = NULL; + + gtk_tree_model_get(model, iter, 0, &text, -1); + gboolean result = g_strcmp0("", text) == 0; + + return result; +} + +// Recursively goes through all children of the given container and sets +// our `is_separator` function to all children of type`GtkComboBox` +static void set_combo_box_row_separator_func(GtkContainer *container) { + GList *list = gtk_container_get_children(container); + + while (list) { + if (GTK_IS_COMBO_BOX(list->data)) { + gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(list->data), is_separator, NULL, NULL); + } + + if (GTK_IS_CONTAINER(list->data)) { + set_combo_box_row_separator_func(GTK_CONTAINER(list->data)); + } + + list = list->next; + } + + g_list_free_full(list, NULL); +} + +// Returns true if the application should show a menubar +static gboolean show_menubar(void) { + GtkSettings *settings = gtk_settings_get_default(); + gboolean result; + + g_object_get(settings, "gtk-shell-shows-menubar", &result, NULL); + + return result; +} + +// Returns a GObject by ID from our GtkBuilder instance +static GObject *get_object(gchararray id) { + return gtk_builder_get_object(builder, id); +} + +// Returns a `GApplication`s `GMenuModel` by ID +// GApplication menus are loaded from `gtk/menus.ui`, `gtk/menus-traditional.ui` and `gtk/menus-common.ui`. +static GMenuModel *get_menu_model(GApplication *app, const char *id) { + GMenu *menu; + + menu = gtk_application_get_menu_by_id(GTK_APPLICATION(app), id); + + return menu ? G_MENU_MODEL(g_object_ref_sink(menu)) : NULL; +} + +// app.quit GAction +// Exits the application +static void activate_quit(GSimpleAction *action, GVariant *parameter, gpointer user_data) { + g_application_quit(G_APPLICATION(user_data)); +} + +// app.about GAction +// Opens the about dialog +static void activate_about(GSimpleAction *action, GVariant *parameter, gpointer user_data) { + GObject *dialog = get_object("about_dialog"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_hide(GTK_WIDGET(dialog)); +} + +// List of GActions for the `app` prefix +static GActionEntry app_entries[] = { + { "quit", activate_quit, NULL, NULL, NULL }, + { "about", activate_about, NULL, NULL, NULL }, +}; + +G_MODULE_EXPORT void on_show_window(GtkWidget *w, gpointer window) { + gtk_widget_show_all(GTK_WIDGET(window)); +} + +G_MODULE_EXPORT void on_boot_rom_location_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + + g_print("Active: %s", gtk_combo_box_get_active_id(box)); +} + +// This functions gets called immediately after registration of the GApplication +static void startup(GApplication *app, gpointer user_data_gptr) { + // UserData *user_data = user_data_gptr; + + builder = gtk_builder_new_from_resource(RESOURCE_PREFIX "ui/window.ui"); + gtk_builder_connect_signals(builder, NULL); + + g_action_map_add_action_entries(G_ACTION_MAP(app), app_entries, G_N_ELEMENTS(app_entries), app); + + GtkWindow *preferences = GTK_WINDOW(get_object("preferences")); + set_combo_box_row_separator_func(GTK_CONTAINER(preferences)); + + GtkWindow *vram_viewer = GTK_WINDOW(get_object("vram_viewer")); + set_combo_box_row_separator_func(GTK_CONTAINER(vram_viewer)); + + // Handle the whole menubar situation … + if (show_menubar()) { + // Use a standard window as main window + main_window = GTK_WINDOW(get_object("main_no_titlebar")); + gtk_widget_destroy(GTK_WIDGET(get_object("main_with_titlebar"))); + + // Hide hamburger button + GtkMenuButton *hamburger_button = GTK_MENU_BUTTON(get_object("hamburger_button")); + gtk_widget_hide(GTK_WIDGET(hamburger_button)); + gtk_widget_set_no_show_all(GTK_WIDGET(hamburger_button), TRUE); + + GMenuModel *menubar = get_menu_model(app, "menubar"); + gtk_application_set_menubar(GTK_APPLICATION(app), menubar); + } + else { + // Use a window with a custom title bar + main_window = GTK_WINDOW(get_object("main_with_titlebar")); + gtk_widget_destroy(GTK_WIDGET(get_object("main_no_titlebar"))); + + // Disable menubar + gtk_application_set_menubar(GTK_APPLICATION(app), NULL); + + // Hook menubar up to the hamburger button + GtkMenuButton *hamburger_button = GTK_MENU_BUTTON(get_object("hamburger_button")); + GMenuModel *hamburger_menu = get_menu_model(app, "menubar"); + gtk_menu_button_set_menu_model(hamburger_button, hamburger_menu); + } + + gtk_window_set_title(main_window, "SameBoy v" xstr(VERSION)); + + // Define a set of window icons + GList *icon_list = NULL; + static char* icons[] = { + RESOURCE_PREFIX "logo_256.png", + RESOURCE_PREFIX "logo_128.png", + RESOURCE_PREFIX "logo_64.png", + RESOURCE_PREFIX "logo_48.png", + RESOURCE_PREFIX "logo_32.png", + RESOURCE_PREFIX "logo_16.png" + }; + + // Create list of GdkPixbufs + for (int i = 0; i < (sizeof(icons) / sizeof(const char*)); ++i) { + GdkPixbuf *icon = gdk_pixbuf_new_from_resource(icons[i], NULL); + if (!icon) continue; + + icon_list = g_list_prepend(icon_list, icon); + } + + // Let GTK choose the proper icon + gtk_window_set_icon_list(main_window, icon_list); + + // Add missing information to the about dialog + GtkAboutDialog *about_dialog = GTK_ABOUT_DIALOG(get_object("about_dialog")); + gtk_about_dialog_set_logo(about_dialog, g_list_nth_data(icon_list, 3)); // reuse the 64x64 icon + gtk_about_dialog_set_version(about_dialog, "v" xstr(VERSION)); + g_list_free(icon_list); + + GList *children = gtk_container_get_children(GTK_CONTAINER(main_window)); + gl_area = GTK_GL_AREA(g_list_first(children)); + g_list_free(children); +} + +// This function gets called when the GApplication gets activated, i.e. it is ready to show widgets. +static void activate(GApplication *app, gpointer user_data_gptr) { + UserData *user_data = user_data_gptr; + + if (user_data->fullscreen) { + gtk_window_fullscreen(main_window); + } + + g_signal_connect(main_window, "destroy", G_CALLBACK(gtk_main_quit), NULL); + gtk_application_add_window(GTK_APPLICATION(app), main_window); + gtk_widget_show_all(GTK_WIDGET(main_window)); +} + +// This function gets called when there are files to open. +// Note: When `open` gets called `activate` won’t fire unless we call it ourselves. +static void open(GApplication *app, GFile **files, gint n_files, const gchar *hint, gpointer user_data_gptr) { + UserData *user_data = user_data_gptr; + + if (n_files > 1) { + g_printerr("More than one file specified\n"); + g_application_quit(app); + return; + } + + user_data->file = files[0]; + + // We have handled the files, now activate the application + activate(app, user_data_gptr); +} + +// This function gets called after the parsing of the commandline options has occurred. +static gint handle_local_options(GApplication *app, GVariantDict *options, gpointer user_data_gptr) { + UserData *user_data = user_data_gptr; + guint32 count; + + if (g_variant_dict_lookup(options, "version", "b", &count)) { + g_print("SameBoy v" xstr(VERSION) "\n"); + return EXIT_SUCCESS; + } + + if (g_variant_dict_lookup(options, "fullscreen", "b", &count)) { + user_data->fullscreen = true; + } + + return -1; +} + +int main (int argc, char *argv[]) { + // Create our GApplication and tell GTK that we are able to handle files + GtkApplication *app = gtk_application_new(APP_ID, G_APPLICATION_HANDLES_OPEN); + + UserData user_data = { NULL }; + + // Define our command line parameters + GOptionEntry entries[] = { + { "version", 'v', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, NULL, "Show the application version", NULL }, + { "fullscreen", 'f', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, NULL, "Start in fullscreen mode", NULL }, + { NULL } + }; + // Setup our command line information + g_application_add_main_option_entries(G_APPLICATION(app), entries); + g_application_set_option_context_parameter_string(G_APPLICATION(app), "[FILE…]"); + g_application_set_option_context_summary(G_APPLICATION(app), "SameBoy is an open source Game Boy (DMG) and Game Boy Color (CGB) emulator."); + + // Add signal handlers + g_signal_connect(app, "handle-local-options", G_CALLBACK(handle_local_options), &user_data); + g_signal_connect(app, "startup", G_CALLBACK(startup), &user_data); + g_signal_connect(app, "activate", G_CALLBACK(activate), &user_data); + g_signal_connect(app, "open", G_CALLBACK(open), &user_data); + + // Start our GApplication main loop + int status = g_application_run(G_APPLICATION(app), argc, argv); + g_object_unref(app); + + return status; +} diff --git a/gtk3/resources/gtk/menus-common.ui b/gtk3/resources/gtk/menus-common.ui new file mode 100644 index 0000000..07c5b3b --- /dev/null +++ b/gtk3/resources/gtk/menus-common.ui @@ -0,0 +1,422 @@ + + + + + + +
+ + _SameBoy +
+ sameboy-section-0 + + About SameBoy + app.about + + + Preferences + app.preferences + +
+ +
+ sameboy-section-1 + + Hide SameBoy + app.hide_app + + + Hide Others + app.hide_others + + + Show All + app.show_all + + + Quit SameBoy + app.quit + +
+
+ + + _File +
+ file-section-0 + + _Open + win.open + + + Open _Recent +
+ recent-files-section +
+
+
+ +
+ file-section-1 + + Close + win.close + +
+
+ + + _Edit +
+ edit-section-0 + + Undo + win.undo + + + Redo + win.redo + +
+ +
+ edit-section-1 + + Cut + win.cut + + + Copy + win.copy + + + Paste + win.paste + + + Delete + win.delete + + + Select All + win.select_all + +
+ +
+ + Find +
+ find-section-0 + + Find… + win.find + + + Find Next + win.find_next + + + Find Previous + win.find_previous + + + Use Selection for Find + win.find_selection + + + Jump to Selection + win.jump_selection + +
+
+
+
+ + + E_mulation +
+ emulation-section-0 + + Reset + win.reset + + + Pause + win.pause + +
+ +
+ emulation-section-1 + + Save State + + Slot 1 + 0 + win.save_state + + + Slot 2 + 1 + win.save_state + + + Slot 3 + 2 + win.save_state + + + Slot 4 + 3 + win.save_state + + + Slot 5 + 4 + win.save_state + + + Slot 6 + 5 + win.save_state + + + Slot 7 + 6 + win.save_state + + + Slot 8 + 7 + win.save_state + + + Slot 9 + 8 + win.save_state + + + Slot 10 + 9 + win.save_state + + + + + Save State + + Slot 1 + 0 + win.load_state + + + Slot 2 + 1 + win.load_state + + + Slot 3 + 2 + win.load_state + + + Slot 4 + 3 + win.load_state + + + Slot 5 + 4 + win.load_state + + + Slot 6 + 5 + win.load_state + + + Slot 7 + 6 + win.load_state + + + Slot 8 + 7 + win.load_state + + + Slot 9 + 8 + win.load_state + + + Slot 10 + 9 + win.load_state + + +
+ +
+ emulation-section-2 + + Game Boy + win.change_model + DMG + + + Super Game Boy + win.change_model + SGB + + + Game Boy Color + win.change_model + CGB + + + Game Boy Advance + win.change_model + AGB + +
+ +
+ emulation-section-3 + + Mute Sound + win.toggle_mute + +
+ +
+ emulation-section-4 + + Blend Frames + win.toggle_blend_frames + +
+
+ + + _Connectivity +
+ connectivity-section-0 + + None + win.change_serial_device + none + + + Game Boy Printer + win.change_serial_device + gb_printer + +
+
+ + + _Developer +
+ developer-section-0 + + Developer Mode + win.toggle_developer_mode + +
+ +
+ developer-section-1 + + Show Console + win.show_console + + + Clear Console + win.clear_console + +
+ +
+ developer-section-2 + + Break Debugger + win.break_debugger + +
+ +
+ developer-section-3 + + Show Memory Viewer + win.open_memory_viewer + + + Show VRAM Viewer + win.open_vram_viewer + +
+
+ + + _Window +
+ window-section-0 + + Minimize + win.minimize + + + Zoom + win.zoom + +
+ +
+ window-section-1 + + Bring All to Front + win.bring_to_front + +
+
+ + + _Help +
+ help-section-0 + + SameBoy Help + win.help + +
+
+
+
+
diff --git a/gtk3/resources/gtk/menus-traditional.ui b/gtk3/resources/gtk/menus-traditional.ui new file mode 100644 index 0000000..aa51dd7 --- /dev/null +++ b/gtk3/resources/gtk/menus-traditional.ui @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/gtk3/resources/gtk/menus.ui b/gtk3/resources/gtk/menus.ui new file mode 100644 index 0000000..aa51dd7 --- /dev/null +++ b/gtk3/resources/gtk/menus.ui @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/gtk3/resources/pixmaps/CPU.png b/gtk3/resources/pixmaps/CPU.png new file mode 100644 index 0000000..7f13621 Binary files /dev/null and b/gtk3/resources/pixmaps/CPU.png differ diff --git a/gtk3/resources/pixmaps/Display.png b/gtk3/resources/pixmaps/Display.png new file mode 100644 index 0000000..5753f55 Binary files /dev/null and b/gtk3/resources/pixmaps/Display.png differ diff --git a/gtk3/resources/pixmaps/Joypad.png b/gtk3/resources/pixmaps/Joypad.png new file mode 100644 index 0000000..f30d8f9 Binary files /dev/null and b/gtk3/resources/pixmaps/Joypad.png differ diff --git a/gtk3/resources/pixmaps/Speaker.png b/gtk3/resources/pixmaps/Speaker.png new file mode 100644 index 0000000..1f6b556 Binary files /dev/null and b/gtk3/resources/pixmaps/Speaker.png differ diff --git a/gtk3/resources/pixmaps/logo/logo_128.png b/gtk3/resources/pixmaps/logo/logo_128.png new file mode 100644 index 0000000..182efdb Binary files /dev/null and b/gtk3/resources/pixmaps/logo/logo_128.png differ diff --git a/gtk3/resources/pixmaps/logo/logo_16.png b/gtk3/resources/pixmaps/logo/logo_16.png new file mode 100644 index 0000000..29abb75 Binary files /dev/null and b/gtk3/resources/pixmaps/logo/logo_16.png differ diff --git a/gtk3/resources/pixmaps/logo/logo_256.png b/gtk3/resources/pixmaps/logo/logo_256.png new file mode 100644 index 0000000..9fd67ab Binary files /dev/null and b/gtk3/resources/pixmaps/logo/logo_256.png differ diff --git a/gtk3/resources/pixmaps/logo/logo_32.png b/gtk3/resources/pixmaps/logo/logo_32.png new file mode 100644 index 0000000..7982193 Binary files /dev/null and b/gtk3/resources/pixmaps/logo/logo_32.png differ diff --git a/gtk3/resources/pixmaps/logo/logo_48.png b/gtk3/resources/pixmaps/logo/logo_48.png new file mode 100644 index 0000000..3d19b2d Binary files /dev/null and b/gtk3/resources/pixmaps/logo/logo_48.png differ diff --git a/gtk3/resources/pixmaps/logo/logo_64.png b/gtk3/resources/pixmaps/logo/logo_64.png new file mode 100644 index 0000000..e0c5685 Binary files /dev/null and b/gtk3/resources/pixmaps/logo/logo_64.png differ diff --git a/gtk3/resources/ui/window.ui b/gtk3/resources/ui/window.ui new file mode 100644 index 0000000..4dc41ae --- /dev/null +++ b/gtk3/resources/ui/window.ui @@ -0,0 +1,1610 @@ + + + + + + + + + + + False + normal + SameBoy + Copyright © 2015-2019 Lior Halphon + https://sameboy.github.io + sameboy.github.io + Lior Halphon https://github.com/LIJI32 + +GTK3 frontend by +Maximilian Mader https://github.com/max-m + + mit-x11 + + + + + + False + vertical + 2 + + + False + end + + + False + False + 0 + + + + + + + + + + + + + + + + + + + + CPU_CGB_0 + CPU-CGB 0 + False + + + CPU_CGB_A + CPU-CGB A + False + + + CPU_CGB_B + CPU-CGB B + False + + + CPU_CGB_C + CPU-CGB C (Experimental) + True + + + CPU_CGB_D + CPU-CGB D + False + + + CPU_CGB_E + CPU-CGB E + True + + + + + False + 920 + 400 + + + + + + True + False + vertical + + + True + False + + + True + True + in + 600 + 376 + 600 + 376 + + + True + False + + + True + False + Placeholder + + + + + + + False + True + 0 + + + + + 320 + True + False + vertical + True + + + True + True + in + + + True + False + + + True + False + Placeholder + + + + + + + False + True + 0 + + + + + True + True + in + + + True + False + + + True + False + Placeholder + + + + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + True + 0 + + + + + True + True + 3 + 3 + 3 + 3 + Console input + + + False + True + 1 + + + + + + + + + + + + + + + + + DMG_CPU_0 + DMG-CPU 0 + False + + + DMG_CPU_A + DMG-CPU A + False + + + DMG_CPU_B + DMG-CPU B + False + + + DMG_CPU_C + DMG-CPU C + True + + + + + False + Preferences + False + + + + + + True + True + + + True + False + 16 + 16 + 16 + 16 + vertical + + + True + False + Boot ROMs location: + + + False + True + 0 + + + + + True + False + 5 + 10 + 0 + auto + + Use Built-in Boot ROMs + <separator> + Other + + + + + False + True + 1 + + + + + True + False + Rewinding Duration: + + + False + True + 2 + + + + + True + False + 5 + 10 + 0 + 10 + + 10 Seconds + 30 Seconds + 1 Minute + 2 Minutes + 5 Minutes + 10 Minutes + + + + + False + True + 3 + + + + + True + False + 5 + + + False + True + 4 + + + + + True + False + Game Boy Revision: + + + False + True + 5 + + + + + True + False + 5 + 10 + dmg_models + 3 + 0 + + + + + 2 + 2 + 1 + + + + + False + True + 6 + + + + + True + False + Super Game Boy Model: + + + False + True + 7 + + + + + True + False + 5 + 10 + 0 + SGB1_NTSC + + Super Game Boy (NTSC) + Super Game Boy (PAL) + Super Game Boy 2 + + + + + False + True + 8 + + + + + True + False + Game Boy Color Revision: + + + False + True + 9 + + + + + True + False + 5 + 10 + cgb_models + 5 + 0 + + + + + 2 + 2 + 1 + + + + + False + True + 10 + + + + + + + True + False + vertical + + + True + False + 2 + /io/github/sameboy/CPU.png + 3 + + + False + True + 0 + + + + + True + False + Emulation + + + False + True + 1 + + + + + False + + + + + True + False + 16 + 16 + 16 + 16 + vertical + + + True + False + Graphics Filter: + + + False + True + 0 + + + + + True + False + 5 + 10 + 0 + nearest_neighbour + + Nearest Neighbor (Pixelated) + Bilinear (Blurry) + Smooth Bilinear (Less blurry) + LCD Display + CRT Display + Scale2x + Scale4x + Anti-aliased Scale2x + Anti-aliased Scale4x + HQ2x + OmniScale (Any factor) + OmniScale Legacy + Anti-aliased OmniScale Legacy + + + + + False + True + 1 + + + + + True + False + Color Correction: + + + False + True + 2 + + + + + True + False + 5 + 10 + 2 + emulate_hardware + + Disabled + Correct Color Curves + Emulate Hardware + Preserve Brightness + + + + + False + True + 3 + + + + + Keep Aspect Ratio + True + True + False + 5 + 10 + True + True + + + + False + True + 4 + + + + + 1 + + + + + True + False + vertical + + + True + False + 2 + /io/github/sameboy/Display.png + 3 + + + False + True + 0 + + + + + True + False + Video + + + False + True + 1 + + + + + 1 + False + + + + + True + False + 14 + 16 + 16 + 16 + vertical + + + True + False + High-pass Filter: + + + False + True + 0 + + + + + True + False + 5 + 10 + 0 + + Disabled (Keep DC Offset) + Accurate (Emulate Hardware) + Preserve Waveform + + + + + False + True + 1 + + + + + 2 + + + + + True + False + vertical + + + True + False + 2 + /io/github/sameboy/Speaker.png + 3 + + + False + True + 0 + + + + + True + False + Audio + + + False + True + 1 + + + + + 2 + False + + + + + True + False + 16 + 16 + 16 + 16 + vertical + + + True + False + 10 + + + True + False + Control settings for + + + False + True + 0 + + + + + True + False + 5 + 5 + 0 + 0 + + Player 1 + Player 2 + Player 3 + Player 4 + + + + + False + True + 1 + + + + + True + False + : + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 90 + 90 + True + + + False + True + 1 + + + + + True + False + Joypad for multiplayer games: + + + False + True + 2 + + + + + True + False + 5 + 10 + 0 + none + + None + + + + + False + True + 3 + + + + + True + False + 5 + + + False + True + 4 + + + + + True + False + + + Configure Joypad + True + True + True + + + + False + True + 0 + + + + + Skip + True + False + True + True + + + + False + True + end + 1 + + + + + False + True + 5 + + + + + 3 + + + + + True + False + vertical + + + True + False + 2 + /io/github/sameboy/Joypad.png + 3 + + + False + True + 0 + + + + + True + False + Controls + + + False + True + 1 + + + + + 3 + False + + + + + + + True + False + SameBoy + 320 + 288 + + + + + + True + True + False + + + + + True + True + True + True + SameBoy + 320 + 288 + + + True + False + False + True + + + True + True + True + none + + + + + + end + + + + + + + True + True + False + + + + + False + Memory Viewer + + + + + + True + False + vertical + True + + + True + False + Placeholder + + + False + True + 0 + + + + + True + False + Placeholder + + + False + True + 1 + + + + + True + False + Placeholder + + + False + True + 2 + + + + + + + False + False + 320 + 432 + + + True + False + Printer + False + True + + + gtk-save + True + True + True + True + + + end + + + + + gtk-delete + True + True + True + True + + + end + 1 + + + + + + + True + True + in + + + + + + + + + + + + + + + + + + + + + + + + 148 + 2 + $7f + $87f0 + $fe20 + ---01 + + + + + False + VRAM Viewer + 512 + 384 + + + + + + True + False + 3 + 3 + 3 + vertical + 6 + + + True + False + center + vram_viewer_stack + + + False + True + 0 + + + + + True + False + False + False + slide-left-right + True + + + True + False + vertical + + + True + False + 6 + 6 + 3 + + + True + False + 0 + fgngfn + bg0 + + Background Palette 0 + Background Palette 1 + Background Palette 2 + Background Palette 3 + Background Palette 4 + Background Palette 5 + Background Palette 6 + Background Palette 7 + <separator> + Object Palette 0 + Object Palette 1 + Object Palette 2 + Object Palette 3 + Object Palette 4 + Object Palette 5 + Object Palette 6 + Object Palette 7 + + + + False + True + 0 + + + + + Grid + 70 + True + True + True + + + False + True + end + 2 + + + + + False + True + 0 + + + + + True + True + False + + + True + True + 1 + + + + + vram_viewer_tileset + Tileset + + + + + True + False + vertical + + + True + True + False + + + False + True + 0 + + + + + True + False + 6 + 6 + 3 + + + True + False + 0 + auto + + Effective Palettes + <separator> + Background Palette 0 + Background Palette 1 + Background Palette 2 + Background Palette 3 + Background Palette 4 + Background Palette 5 + Background Palette 6 + Background Palette 7 + <separator> + Object Palette 0 + Object Palette 1 + Object Palette 2 + Object Palette 3 + Object Palette 4 + Object Palette 5 + Object Palette 6 + Object Palette 7 + + + + False + True + 0 + + + + + True + False + 0 + auto + + Effective Tilemap + <separator> + Tilemap at $9800 + Tilemap at $9C00 + + + + False + True + 1 + + + + + Grid + True + True + True + 2 + + + False + True + end + 2 + + + + + Scrolling + True + True + True + 2 + 2 + + + False + True + end + 3 + + + + + True + False + 0 + auto + + Effective Tileset + <separator> + Tileset at $8800 + Tileset at $8000 + + + + False + True + 4 + + + + + False + True + 1 + + + + + vram_viewer_tilemap + Tilemap + 1 + + + + + True + True + sprite_list_store + False + True + False + horizontal + + + + + + 32 + + + + + + + + X + + + + 1 + + + + + + + Y + + + + 2 + + + + + + + Tile + + + + 3 + + + + + + + Tile Addr. + + + + 4 + + + + + + + OAM Addr. + + + + 4 + + + + + + + Attributes + + + + 5 + + + + + + + vram_viewer_sprites + Sprites + 2 + + + + + True + True + False + True + False + False + both + + + + + + Type + + + + 0 + + + + + + + Color 0 + + + + 1 + + + + + + + Color 1 + + + + 2 + + + + + + + Color 2 + + + + 3 + + + + + + + Color 3 + + + + 4 + + + + + + + vram_viewer_palettes + Palettes + 3 + + + + + True + True + 1 + + + + + True + False + 10 + 10 + 10 + 10 + 6 + 6 + vertical + 2 + + + False + True + 2 + + + + + + diff --git a/gtk3/sameboy.gresource.xml b/gtk3/sameboy.gresource.xml new file mode 100644 index 0000000..3afb84f --- /dev/null +++ b/gtk3/sameboy.gresource.xml @@ -0,0 +1,46 @@ + + + + ui/window.ui + gtk/menus.ui + gtk/menus-common.ui + gtk/menus-traditional.ui + + pixmaps/logo/logo_256.png + pixmaps/logo/logo_128.png + pixmaps/logo/logo_64.png + pixmaps/logo/logo_48.png + pixmaps/logo/logo_32.png + pixmaps/logo/logo_16.png + + + + gtk3/resources/bootroms/dmg_boot.bin + gtk3/resources/bootroms/cgb_boot.bin + gtk3/resources/bootroms/agb_boot.bin + gtk3/resources/bootroms/sgb_boot.bin + gtk3/resources/bootroms/sgb2_boot.bin + + + + gtk3/resources/Shaders/AAOmniScaleLegacy.fsh + gtk3/resources/Shaders/AAScale2x.fsh + gtk3/resources/Shaders/AAScale4x.fsh + gtk3/resources/Shaders/Bilinear.fsh + gtk3/resources/Shaders/CRT.fsh + gtk3/resources/Shaders/HQ2x.fsh + gtk3/resources/Shaders/LCD.fsh + gtk3/resources/Shaders/MasterShader.fsh + gtk3/resources/Shaders/NearestNeighbor.fsh + gtk3/resources/Shaders/OmniScale.fsh + gtk3/resources/Shaders/OmniScaleLegacy.fsh + gtk3/resources/Shaders/Scale2x.fsh + gtk3/resources/Shaders/Scale4x.fsh + gtk3/resources/Shaders/SmoothBilinear.fsh + + pixmaps/CPU.png + pixmaps/Display.png + pixmaps/Joypad.png + pixmaps/Speaker.png + + \ No newline at end of file