cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

config.h (4176B)


      1/*
      2 * Gearboy - Nintendo Game Boy Emulator
      3 * Copyright (C) 2012  Ignacio Sanchez
      4
      5 * This program is free software: you can redistribute it and/or modify
      6 * it under the terms of the GNU General Public License as published by
      7 * the Free Software Foundation, either version 3 of the License, or
      8 * any later version.
      9
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     13 * GNU General Public License for more details.
     14
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program.  If not, see http://www.gnu.org/licenses/
     17 *
     18 */
     19
     20#ifndef CONFIG_H
     21#define	CONFIG_H
     22
     23#include <SDL.h>
     24#include "../../src/gearboy.h"
     25#define MINI_CASE_SENSITIVE
     26#include "mINI/ini.h"
     27#include "imgui/imgui.h"
     28
     29#ifdef CONFIG_IMPORT
     30    #define EXTERN
     31#else
     32    #define EXTERN extern
     33#endif
     34
     35static const int config_max_recent_roms = 10;
     36static const int config_max_custom_palettes = 5;
     37
     38struct config_Emulator
     39{
     40    bool paused = false;
     41    int save_slot = 0;
     42    bool start_paused = false;
     43    bool force_dmg = false;
     44    bool force_gba = false;
     45    bool ffwd = false;
     46    int ffwd_speed = 1;
     47    bool show_info = false;
     48    int mbc = 0;
     49    std::string recent_roms[config_max_recent_roms];
     50    bool dmg_bootrom;
     51    std::string dmg_bootrom_path;
     52    bool gbc_bootrom;
     53    std::string gbc_bootrom_path;
     54    int savefiles_dir_option = 0;
     55    std::string savefiles_path;
     56    int savestates_dir_option = 0;
     57    std::string savestates_path;
     58};
     59
     60struct config_Video
     61{
     62    int scale = 0;
     63    int ratio = 0;
     64    bool fps = false;
     65    bool bilinear = false;
     66    bool mix_frames = true;
     67    float mix_frames_intensity = 0.50f;
     68    bool matrix = true;
     69    float matrix_intensity = 0.30f;
     70    int palette = 0;
     71    GB_Color color[config_max_custom_palettes][4] = {
     72        {{0xC4, 0xF0, 0xC2}, {0x5A, 0xB9, 0xA8}, {0x1E, 0x60, 0x6E}, {0x2D, 0x1B, 0x00}},
     73        {{0xF8, 0xE3, 0xC4}, {0xCC, 0x34, 0x95}, {0x6B, 0x1F, 0xB1}, {0x0B, 0x06, 0x30}},
     74        {{0xEF, 0xF9, 0xD6}, {0xBA, 0x50, 0x44}, {0x7A, 0x1C, 0x4B}, {0x1B, 0x03, 0x26}},
     75        {{0xFF, 0xE4, 0xC2}, {0xDC, 0xA4, 0x56}, {0xA9, 0x60, 0x4C}, {0x42, 0x29, 0x36}},
     76        {{0xCE, 0xCE, 0xCE}, {0x6F, 0x9E, 0xDF}, {0x42, 0x67, 0x8E}, {0x10, 0x25, 0x33}}
     77    };
     78    bool sync = true;
     79    bool color_correction = true;
     80};
     81
     82struct config_Audio
     83{
     84    bool enable = true;
     85    bool sync = true;
     86};
     87
     88struct config_Input
     89{
     90    SDL_Scancode key_left = SDL_SCANCODE_LEFT;
     91    SDL_Scancode key_right = SDL_SCANCODE_RIGHT;
     92    SDL_Scancode key_up = SDL_SCANCODE_UP;
     93    SDL_Scancode key_down = SDL_SCANCODE_DOWN;
     94    SDL_Scancode key_a = SDL_SCANCODE_S;
     95    SDL_Scancode key_b = SDL_SCANCODE_A;
     96    SDL_Scancode key_start = SDL_SCANCODE_RETURN;
     97    SDL_Scancode key_select = SDL_SCANCODE_SPACE;
     98
     99    bool gamepad = true;
    100    int gamepad_directional = 0;
    101    bool gamepad_invert_x_axis = false;
    102    bool gamepad_invert_y_axis = false;
    103    int gamepad_a = SDL_CONTROLLER_BUTTON_B;
    104    int gamepad_b = SDL_CONTROLLER_BUTTON_A;
    105    int gamepad_start = SDL_CONTROLLER_BUTTON_START;
    106    int gamepad_select = SDL_CONTROLLER_BUTTON_BACK;
    107    int gamepad_x_axis = SDL_CONTROLLER_AXIS_LEFTX;
    108    int gamepad_y_axis = SDL_CONTROLLER_AXIS_LEFTY;
    109};
    110
    111struct config_Debug
    112{
    113    bool debug = false;
    114    bool show_gameboy = true;
    115    bool show_disassembler = true;
    116    bool show_processor = true;
    117    bool show_memory = true;
    118    bool show_iomap = false;
    119    bool show_audio = false;
    120    bool show_video = false;
    121    int font_size = 0;
    122};
    123
    124EXTERN mINI::INIFile* config_ini_file;
    125EXTERN mINI::INIStructure config_ini_data;
    126EXTERN char* config_root_path;
    127EXTERN char config_emu_file_path[260];
    128EXTERN char config_imgui_file_path[260];
    129EXTERN config_Emulator config_emulator;
    130EXTERN config_Video config_video;
    131EXTERN config_Audio config_audio;
    132EXTERN config_Input config_input;
    133EXTERN config_Debug config_debug;
    134
    135EXTERN void config_init(void);
    136EXTERN void config_destroy(void);
    137EXTERN void config_read(void);
    138EXTERN void config_write(void);
    139
    140#undef CONFIG_IMPORT
    141#undef EXTERN
    142#endif	/* CONFIG_H */