116 lines
2.2 KiB
C
116 lines
2.2 KiB
C
#ifndef types_h
|
|
#define types_h
|
|
|
|
#include "SDL.h"
|
|
#include "main_window.h"
|
|
#include "console_window.h"
|
|
#include "preferences_window.h"
|
|
#include "vram_viewer_window.h"
|
|
#include "printer_window.h"
|
|
|
|
typedef struct{
|
|
int16_t x, y;
|
|
uint16_t width, height;
|
|
} 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;
|
|
MainWindow *main_window;
|
|
|
|
ConsoleWindow *console;
|
|
PreferencesWindow *preferences;
|
|
VramViewerWindow *vram_viewer;
|
|
PrinterWindow *printer;
|
|
|
|
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
|