[GTK3] Add main.h and re-order main.c
This commit is contained in:
parent
b9fb1c2a43
commit
3d41673356
1179
gtk3/main.c
1179
gtk3/main.c
File diff suppressed because it is too large
Load Diff
115
gtk3/main.h
Normal file
115
gtk3/main.h
Normal file
@ -0,0 +1,115 @@
|
||||
#ifndef main_h
|
||||
#define main_h
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <epoxy/gl.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <Core/gb.h>
|
||||
|
||||
#include "macros.h"
|
||||
#include "settings.h"
|
||||
#include "shader.h"
|
||||
|
||||
typedef struct UserData {
|
||||
bool fullscreen;
|
||||
GFile *file;
|
||||
gchar *boot_rom_path;
|
||||
gchar *config_path;
|
||||
GB_model_t model;
|
||||
} UserData;
|
||||
|
||||
typedef struct{
|
||||
int16_t x, y;
|
||||
uint16_t w, h;
|
||||
} Rect;
|
||||
|
||||
#define BUTTON_MASK_A 0x01
|
||||
#define BUTTON_MASK_B 0x02
|
||||
#define BUTTON_MASK_START 0x04
|
||||
#define BUTTON_MASK_SELECT 0x08
|
||||
#define BUTTON_MASK_UP 0x10
|
||||
#define BUTTON_MASK_DOWN 0x20
|
||||
#define BUTTON_MASK_LEFT 0x40
|
||||
#define BUTTON_MASK_RIGHT 0x80
|
||||
|
||||
int main(int argc, char *argv[]);
|
||||
|
||||
static gint handle_local_options(GApplication *app, GVariantDict *options, gpointer user_data_gptr);
|
||||
|
||||
// GtkGlArea crash workaround
|
||||
void gl_check_realize(GtkWidget *w, gpointer user_data_gptr);
|
||||
gboolean test_gl_support(void);
|
||||
|
||||
static GMenuModel *get_menu_model(GApplication *app, const char *id);
|
||||
static void create_fallback_canvas(void);
|
||||
static void setup_menu(GApplication *app);
|
||||
static void set_combo_box_row_separator_func(GtkContainer *container);
|
||||
static gboolean is_separator(GtkTreeModel *model, GtkTreeIter *iter, gpointer data);
|
||||
|
||||
// Rendering support functions
|
||||
static unsigned char number_of_buffers(void);
|
||||
static uint32_t *get_pixels(void);
|
||||
static uint32_t *get_current_buffer(void);
|
||||
static uint32_t *get_previous_buffer(void);
|
||||
static void flip(void);
|
||||
|
||||
// GApplication signals
|
||||
static void startup(GApplication *app, gpointer user_data_gptr);
|
||||
static void activate(GApplication *app, gpointer user_data_gptr);
|
||||
static void shutdown(GApplication *app, GFile **files, gint n_files, const gchar *hint, gpointer user_data_gptr);
|
||||
static void open(GApplication *app, GFile **files, gint n_files, const gchar *hint, gpointer user_data_gptr);
|
||||
static void quit(GApplication *app);
|
||||
static gboolean on_key_press(GtkWidget *w, GdkEventKey *event, gpointer data);
|
||||
|
||||
// App actions
|
||||
static void activate_about(GSimpleAction *action, GVariant *parameter, gpointer app);
|
||||
static void activate_open_gtk_debugger(GSimpleAction *action, GVariant *parameter, gpointer app);
|
||||
static void activate_open_memory_viewer(GSimpleAction *action, GVariant *parameter, gpointer app);
|
||||
static void activate_open_vram_viewer(GSimpleAction *action, GVariant *parameter, gpointer app);
|
||||
static void activate_open(GSimpleAction *action, GVariant *parameter, gpointer app);
|
||||
static void activate_preferences(GSimpleAction *action, GVariant *parameter, gpointer app);
|
||||
static void activate_quit(GSimpleAction *action, GVariant *parameter, gpointer app);
|
||||
|
||||
// Signal callback
|
||||
static void on_quit(GtkWidget *w, gpointer app);
|
||||
|
||||
// Renderer area bindings
|
||||
static void gl_init(GtkWidget *w);
|
||||
static void gl_draw();
|
||||
static void gl_finish();
|
||||
static gboolean on_draw_fallback(GtkWidget *widget, cairo_t *cr, gpointer data);
|
||||
static void resize();
|
||||
|
||||
// VRAM viewer bindings
|
||||
static void on_vram_viewer_realize();
|
||||
static void on_vram_viewer_unrealize();
|
||||
static gboolean on_draw_vram_viewer_tilemap(GtkWidget *widget, cairo_t *cr, gpointer data);
|
||||
static gboolean on_draw_vram_viewer_tileset(GtkWidget *widget, cairo_t *cr, gpointer data);
|
||||
|
||||
// Option bindings
|
||||
G_MODULE_EXPORT void on_boot_rom_location_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_cgb_model_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_color_correction_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_color_menubar_override_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_dmg_model_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_graphic_filter_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_highpass_filter_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_keep_aspect_ratio_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_rewind_duration_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_sgb_model_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
G_MODULE_EXPORT void on_use_integer_scaling_changed(GtkWidget *w, gpointer user_data_gptr);
|
||||
|
||||
static uint32_t rgb_encode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b);
|
||||
static uint32_t rgb_encode_fallback(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b);
|
||||
static void render_texture(void *pixels, void *previous);
|
||||
static void update_viewport(void);
|
||||
static void update_window_geometry();
|
||||
|
||||
static void handle_events(GB_gameboy_t *gb);
|
||||
static void vblank(GB_gameboy_t *gb);
|
||||
static void run(GApplication *app, UserData *user_data);
|
||||
|
||||
#endif /* main_h */
|
@ -648,8 +648,9 @@ Maximilian Mader https://github.com/max-m</property>
|
||||
<property name="can_focus">False</property>
|
||||
<items>
|
||||
<item id="auto" translatable="yes">Automatic</item>
|
||||
<item id="show" translatable="yes">Force Menubar</item>
|
||||
<item id="hide" translatable="yes">Force Hamburger Menu</item>
|
||||
<item id="show_in_shell" translatable="yes">Force Menubar In Desktop Shell</item>
|
||||
<item id="show_in_window" translatable="yes">Force Menubar In Window</item>
|
||||
<item id="show_hamburger" translatable="yes">Force Hamburger Menu</item>
|
||||
</items>
|
||||
<signal name="changed" handler="on_color_menubar_override_changed" swapped="no"/>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user