2019-06-07 11:35:17 +00:00
|
|
|
#ifndef main_h
|
|
|
|
#define main_h
|
|
|
|
|
2019-06-08 17:10:23 +00:00
|
|
|
#define str(x) #x
|
|
|
|
#define xstr(x) str(x)
|
|
|
|
|
2019-06-07 11:35:17 +00:00
|
|
|
#define VIDEO_WIDTH 160
|
|
|
|
#define VIDEO_HEIGHT 144
|
|
|
|
#define VIDEO_PIXELS (VIDEO_WIDTH * VIDEO_HEIGHT)
|
|
|
|
|
|
|
|
#define SGB_VIDEO_WIDTH 256
|
|
|
|
#define SGB_VIDEO_HEIGHT 224
|
|
|
|
#define SGB_VIDEO_PIXELS (SGB_VIDEO_WIDTH * SGB_VIDEO_HEIGHT)
|
|
|
|
|
2019-06-08 17:10:23 +00:00
|
|
|
#define GENERATE_ENUM(ENUM) ENUM,
|
|
|
|
#define GENERATE_STRING(STRING) #STRING,
|
|
|
|
|
|
|
|
#define MODELS(MODEL) \
|
|
|
|
MODEL(MODEL_DMG) \
|
|
|
|
MODEL(MODEL_CGB) \
|
|
|
|
MODEL(MODEL_AGB) \
|
|
|
|
MODEL(MODEL_SGB) \
|
|
|
|
MODEL(MODEL_MAX)
|
|
|
|
|
|
|
|
#define SGB_REVISIONS(REVISION) \
|
|
|
|
REVISION(SGB_NTSC) \
|
|
|
|
REVISION(SGB_PAL) \
|
|
|
|
REVISION(SGB_2) \
|
|
|
|
REVISION(SGB_MAX)
|
|
|
|
|
2019-06-07 11:35:17 +00:00
|
|
|
typedef enum {
|
|
|
|
JOYPAD_AXISES_X,
|
|
|
|
JOYPAD_AXISES_Y,
|
|
|
|
JOYPAD_AXISES_MAX
|
|
|
|
} joypad_axis_t;
|
|
|
|
|
2019-06-11 02:21:32 +00:00
|
|
|
enum scaling_mode {
|
|
|
|
GB_SDL_SCALING_ENTIRE_WINDOW,
|
|
|
|
GB_SDL_SCALING_KEEP_RATIO,
|
|
|
|
GB_SDL_SCALING_INTEGER_FACTOR,
|
|
|
|
GB_SDL_SCALING_MAX,
|
|
|
|
};
|
|
|
|
|
2019-06-07 11:35:17 +00:00
|
|
|
typedef struct {
|
|
|
|
SDL_Scancode keys[9];
|
|
|
|
GB_color_correction_mode_t color_correction_mode;
|
2019-06-11 02:21:32 +00:00
|
|
|
enum scaling_mode scaling_mode;
|
2019-06-07 11:35:17 +00:00
|
|
|
bool blend_frames;
|
|
|
|
|
|
|
|
GB_highpass_mode_t highpass_mode;
|
|
|
|
|
|
|
|
char filter[32];
|
|
|
|
enum {
|
2019-06-08 17:10:23 +00:00
|
|
|
MODELS(GENERATE_ENUM)
|
2019-06-07 11:35:17 +00:00
|
|
|
} model;
|
|
|
|
|
|
|
|
/* v0.11 */
|
|
|
|
uint32_t rewind_length;
|
|
|
|
SDL_Scancode keys_2[32]; /* Rewind and underclock, + padding for the future */
|
|
|
|
uint8_t joypad_configuration[32]; /* 12 Keys + padding for the future*/;
|
|
|
|
uint8_t joypad_axises[JOYPAD_AXISES_MAX];
|
|
|
|
|
|
|
|
/* v0.12 */
|
|
|
|
enum {
|
2019-06-08 17:10:23 +00:00
|
|
|
SGB_REVISIONS(GENERATE_ENUM)
|
2019-06-07 11:35:17 +00:00
|
|
|
} sgb_revision;
|
|
|
|
} configuration_t;
|
|
|
|
|
2019-06-08 17:10:23 +00:00
|
|
|
// TODO: There must be a better way to not duplicate this data on the JavaScript side
|
|
|
|
static const char *MODELS_STRING[] = {
|
|
|
|
MODELS(GENERATE_STRING)
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *SGB_REVISIONS_STRING[] = {
|
|
|
|
SGB_REVISIONS(GENERATE_STRING)
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char** EMSCRIPTEN_KEEPALIVE get_models_string_pointer() {
|
|
|
|
return MODELS_STRING;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const size_t EMSCRIPTEN_KEEPALIVE get_models_string_pointer_size() {
|
|
|
|
return sizeof(*MODELS_STRING);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const size_t EMSCRIPTEN_KEEPALIVE get_models_string_size() {
|
|
|
|
return sizeof(MODELS_STRING);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char** EMSCRIPTEN_KEEPALIVE get_sgb_revisions_string_pointer() {
|
|
|
|
return SGB_REVISIONS_STRING;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const size_t EMSCRIPTEN_KEEPALIVE get_sgb_revisions_string_pointer_size() {
|
|
|
|
return sizeof(*SGB_REVISIONS_STRING);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const size_t EMSCRIPTEN_KEEPALIVE get_sgb_revisions_string_size() {
|
|
|
|
return sizeof(SGB_REVISIONS_STRING);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-07 11:35:17 +00:00
|
|
|
#endif /* main_h */
|