2020-05-16 15:48:29 +00:00
|
|
|
#ifndef types_h
|
|
|
|
#define types_h
|
|
|
|
|
|
|
|
#include "SDL.h"
|
2021-01-07 13:36:46 +00:00
|
|
|
#include "widgets/console_window.h"
|
|
|
|
#include "widgets/main_window.h"
|
|
|
|
#include "widgets/preferences_window.h"
|
|
|
|
#include "widgets/printer_window.h"
|
|
|
|
#include "widgets/vram_viewer_window.h"
|
2020-05-16 15:48:29 +00:00
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
int16_t x, y;
|
2020-05-17 03:33:41 +00:00
|
|
|
uint16_t width, height;
|
2020-05-16 15:48:29 +00:00
|
|
|
} Rect;
|
|
|
|
|
|
|
|
typedef struct GuiData {
|
|
|
|
struct CliOptionData {
|
|
|
|
gchar *config_path;
|
|
|
|
gchar *boot_rom_path;
|
|
|
|
gboolean fullscreen;
|
|
|
|
GB_model_t model;
|
|
|
|
gboolean force_software_renderer;
|
|
|
|
} cli_options;
|
|
|
|
|
|
|
|
GFile *file;
|
|
|
|
gint sample_rate;
|
|
|
|
GDateTime *config_modification_date;
|
|
|
|
|
|
|
|
char *battery_save_path;
|
|
|
|
char *cheats_save_path;
|
|
|
|
|
|
|
|
GB_model_t prev_model;
|
|
|
|
|
|
|
|
const GThread *main_thread;
|
|
|
|
volatile bool running;
|
|
|
|
volatile bool stopping;
|
|
|
|
volatile bool stopped;
|
|
|
|
|
|
|
|
// GTK pointers
|
|
|
|
GtkApplication *main_application;
|
|
|
|
GtkBuilder *builder;
|
2021-01-06 23:47:14 +00:00
|
|
|
MainWindow *main_window;
|
2020-05-19 00:31:31 +00:00
|
|
|
|
2020-05-21 20:37:25 +00:00
|
|
|
ConsoleWindow *console;
|
2020-05-20 01:41:33 +00:00
|
|
|
PreferencesWindow *preferences;
|
2020-05-17 03:33:41 +00:00
|
|
|
VramViewerWindow *vram_viewer;
|
2021-01-03 18:07:48 +00:00
|
|
|
PrinterWindow *printer;
|
2020-05-20 01:41:33 +00:00
|
|
|
|
2020-05-16 15:48:29 +00:00
|
|
|
GtkWindow *memory_viewer;
|
|
|
|
|
|
|
|
// Audio and video
|
|
|
|
bool audio_initialized;
|
|
|
|
bool border_mode_changed;
|
|
|
|
bool is_fullscreen;
|
|
|
|
unsigned last_screen_width;
|
|
|
|
unsigned last_screen_height;
|
|
|
|
|
|
|
|
// Fast forward / slow motion
|
|
|
|
bool underclock_down;
|
|
|
|
bool rewind_down;
|
|
|
|
bool do_rewind;
|
|
|
|
bool rewind_paused;
|
|
|
|
bool turbo_down;
|
|
|
|
double clock_mutliplier;
|
|
|
|
double analog_clock_multiplier;
|
|
|
|
bool analog_clock_multiplier_valid;
|
|
|
|
|
|
|
|
// Input
|
|
|
|
uint8_t pressed_buttons;
|
|
|
|
struct Controller_t {
|
|
|
|
SDL_GameController *controller;
|
|
|
|
SDL_Haptic *haptic;
|
|
|
|
bool ignore_rumble;
|
|
|
|
} *controllers;
|
|
|
|
unsigned controller_count;
|
|
|
|
struct Controller_t *last_used_controller; // Used for rumble
|
|
|
|
} GuiData;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
INPUT_UP,
|
|
|
|
INPUT_DOWN,
|
|
|
|
INPUT_LEFT,
|
|
|
|
INPUT_RIGHT,
|
|
|
|
INPUT_A,
|
|
|
|
INPUT_B,
|
|
|
|
INPUT_START,
|
|
|
|
INPUT_SELECT,
|
|
|
|
|
|
|
|
INPUT_TURBO,
|
|
|
|
INPUT_REWIND,
|
|
|
|
INPUT_SLOWDOWN,
|
|
|
|
|
|
|
|
INPUT_FULLSCREEN,
|
|
|
|
} input_names_t;
|
|
|
|
|
|
|
|
static unsigned key_map[] = {
|
|
|
|
[INPUT_UP] = GDK_KEY_w,
|
|
|
|
[INPUT_LEFT] = GDK_KEY_a,
|
|
|
|
[INPUT_DOWN] = GDK_KEY_s,
|
|
|
|
[INPUT_RIGHT] = GDK_KEY_d,
|
|
|
|
|
|
|
|
[INPUT_A] = GDK_KEY_l,
|
|
|
|
[INPUT_B] = GDK_KEY_k,
|
|
|
|
|
|
|
|
[INPUT_START] = GDK_KEY_h,
|
|
|
|
[INPUT_SELECT] = GDK_KEY_g,
|
|
|
|
|
|
|
|
[INPUT_TURBO] = GDK_KEY_space,
|
|
|
|
[INPUT_REWIND] = GDK_KEY_Tab,
|
|
|
|
[INPUT_SLOWDOWN] = GDK_KEY_Shift_L,
|
|
|
|
|
|
|
|
[INPUT_FULLSCREEN] = GDK_KEY_F11,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|