From fd08eaee22718cee1c37b9e0dcf9db334f62c7be Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Tue, 9 Jun 2020 15:19:49 +0200 Subject: [PATCH] Refactored amiberry options to a struct, changed scanlines_by_default option to default_line_mode --- src/include/inputdevice.h | 2 - src/include/options.h | 21 +++++ src/inputdevice.cpp | 2 +- src/osdep/amiberry.cpp | 132 +++++++++++++++--------------- src/osdep/amiberry_gfx.cpp | 12 +-- src/osdep/amiberry_gfx.h | 2 - src/osdep/amiberry_gui.cpp | 2 +- src/osdep/amiberry_input.cpp | 2 +- src/osdep/gui/InGameMessage.cpp | 2 +- src/osdep/gui/PanelQuickstart.cpp | 4 +- src/osdep/gui/gui_handling.h | 3 - src/osdep/gui/main_window.cpp | 12 +-- src/osdep/writelog.cpp | 4 +- 13 files changed, 109 insertions(+), 91 deletions(-) diff --git a/src/include/inputdevice.h b/src/include/inputdevice.h index ba2a29c7..f26fb39b 100644 --- a/src/include/inputdevice.h +++ b/src/include/inputdevice.h @@ -453,8 +453,6 @@ extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES]; extern int multipler_maps[MAX_JPORTS]; extern int find_in_array(const int arr[], int n, int key); extern int num_keys_as_joys; -extern int input_default_mouse_speed; -extern bool input_keyboard_as_joystick_stop_keypresses; extern bool key_used_by_retroarch_joy(int scancode); #endif diff --git a/src/include/options.h b/src/include/options.h index 09711ab9..24fc81f8 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -1095,6 +1095,27 @@ struct amiberry_customised_layout struct joypad_map_layout left_trigger; struct joypad_map_layout right_trigger; }; + +struct amiberry_options +{ + bool quickstart_start = true; + bool read_config_descriptions = true; + bool write_logfile = false; + bool swap_win_alt_keys = false; + bool gui_joystick_control = true; + bool use_sdl2_render_thread = false; + int default_line_mode = 0; + int input_default_mouse_speed = 100; + bool input_keyboard_as_joystick_stop_keypresses = false; + char default_open_gui_key[128]{}; + char default_quit_key[128]{}; + int rotation_angle = 0; + bool default_horizontal_centering = false; + bool default_vertical_centering = false; + int default_scaling_method = -1; + +}; +extern struct amiberry_options amiberry_options; #endif extern const int RemapEventList[]; diff --git a/src/inputdevice.cpp b/src/inputdevice.cpp index 3b91bb07..46b2b952 100644 --- a/src/inputdevice.cpp +++ b/src/inputdevice.cpp @@ -7036,7 +7036,7 @@ void inputdevice_default_prefs (struct uae_prefs *p) p->input_joymouse_speed = 10; p->input_analog_joystick_mult = 15; p->input_analog_joystick_offset = -1; - p->input_mouse_speed = input_default_mouse_speed; + p->input_mouse_speed = amiberry_options.input_default_mouse_speed; p->input_autofire_linecnt = 0; //8 * 312; // Disable Autofire by default p->input_keyboard_type = 0; p->input_autoswitch = true; diff --git a/src/osdep/amiberry.cpp b/src/osdep/amiberry.cpp index e553fa01..269dda30 100644 --- a/src/osdep/amiberry.cpp +++ b/src/osdep/amiberry.cpp @@ -41,28 +41,11 @@ extern FILE* debugfile; int pause_emulation; -int quickstart_start = 1; int quickstart_model = 0; int quickstart_conf = 0; bool host_poweroff = false; -bool read_config_descriptions = true; -bool write_logfile = false; -bool scanlines_by_default = false; -bool swap_win_alt_keys = false; -bool gui_joystick_control = true; -#ifdef USE_RENDER_THREAD -bool use_sdl2_render_thread = true; -#else -bool use_sdl2_render_thread = false; -#endif -int input_default_mouse_speed = 100; -bool input_keyboard_as_joystick_stop_keypresses = false; -static char default_open_gui_key[128]; -static char default_quit_key[128]; -int rotation_angle = 0; -bool default_horizontal_centering = false; -bool default_vertical_centering = false; -int default_scaling_method = -1; + +struct amiberry_options amiberry_options = {}; // Default Enter GUI key is F12 int enter_gui_key = 0; @@ -91,7 +74,7 @@ void set_key_configs(struct uae_prefs* p) else { // Otherwise we go for the default found in amiberry.conf - enter_gui_key = SDL_GetKeyFromName(default_open_gui_key); + enter_gui_key = SDL_GetKeyFromName(amiberry_options.default_open_gui_key); } // if nothing was found in amiberry.conf either, let's default back to F12 if (enter_gui_key == 0) @@ -104,7 +87,7 @@ void set_key_configs(struct uae_prefs* p) } else { - quit_key = SDL_GetKeyFromName(default_quit_key); + quit_key = SDL_GetKeyFromName(amiberry_options.default_quit_key); } if (strncmp(p->action_replay, "", 1) != 0) @@ -213,7 +196,7 @@ bool setpaused(int priority) void logging_init(void) { - if (write_logfile) + if (amiberry_options.write_logfile) { static int started; static int first; @@ -383,32 +366,46 @@ void target_default_options(struct uae_prefs* p, int type) p->gfx_auto_height = false; p->gfx_correct_aspect = 1; // Default is Enabled p->scaling_method = -1; //Default is Auto - if (scanlines_by_default) + if (amiberry_options.default_line_mode == 1) { + // Double line mode + p->gfx_vresolution = VRES_DOUBLE; + p->gfx_pscanlines = 0; + } + else if (amiberry_options.default_line_mode == 2) + { + // Scanlines line mode p->gfx_vresolution = VRES_DOUBLE; p->gfx_pscanlines = 1; } else { - p->gfx_vresolution = VRES_NONDOUBLE; // Disabled by default due to performance hit + // Single line mode (default) + p->gfx_vresolution = VRES_NONDOUBLE; p->gfx_pscanlines = 0; } - if (default_horizontal_centering) + if (amiberry_options.default_horizontal_centering) p->gfx_xcenter = 2; - if (default_vertical_centering) + if (amiberry_options.default_vertical_centering) p->gfx_ycenter = 2; - if (default_scaling_method != -1) + if (amiberry_options.default_scaling_method != -1) { // only valid values are -1 (Auto), 0 (Nearest) and 1 (Linear) - if (default_scaling_method == 0 || default_scaling_method == 1) - p->scaling_method = default_scaling_method; + if (amiberry_options.default_scaling_method == 0 || amiberry_options.default_scaling_method == 1) + p->scaling_method = amiberry_options.default_scaling_method; } + +#ifdef USE_RENDER_THREAD + amiberry_options.use_sdl2_render_thread = true; +#else + amiberry_options.use_sdl2_render_thread = false; +#endif - _tcscpy(p->open_gui, default_open_gui_key); - _tcscpy(p->quit_amiberry, default_quit_key); + _tcscpy(p->open_gui, amiberry_options.default_open_gui_key); + _tcscpy(p->quit_amiberry, amiberry_options.default_quit_key); _tcscpy(p->action_replay, "Pause"); _tcscpy(p->fullscreen_toggle, ""); @@ -649,12 +646,12 @@ void set_retroarch_file(char* newpath) bool get_logfile_enabled() { - return write_logfile; + return amiberry_options.write_logfile; } void set_logfile_enabled(bool enabled) { - write_logfile = enabled; + amiberry_options.write_logfile = enabled; } void get_logfile_path(char* out, int size) @@ -861,63 +858,70 @@ void save_amiberry_settings(void) char buffer[MAX_DPATH]; // Should the Quickstart Panel be the default when opening the GUI? - snprintf(buffer, MAX_DPATH, "Quickstart=%d\n", quickstart_start); + snprintf(buffer, MAX_DPATH, "Quickstart=%d\n", amiberry_options.quickstart_start); fputs(buffer, f); // Open each config file and read the Description field? // This will slow down scanning the config list if it's very large - snprintf(buffer, MAX_DPATH, "read_config_descriptions=%s\n", read_config_descriptions ? "yes" : "no"); + snprintf(buffer, MAX_DPATH, "read_config_descriptions=%s\n", amiberry_options.read_config_descriptions ? "yes" : "no"); fputs(buffer, f); // Write to logfile? // If enabled, a file named "amiberry_log.txt" will be generated in the startup folder - snprintf(buffer, MAX_DPATH, "write_logfile=%s\n", write_logfile ? "yes" : "no"); + snprintf(buffer, MAX_DPATH, "write_logfile=%s\n", amiberry_options.write_logfile ? "yes" : "no"); fputs(buffer, f); // Scanlines ON by default? // This will only be enabled if the vertical height is enough, as we need Line Doubling set to ON also // Beware this comes with a performance hit, as double the amount of lines need to be drawn on-screen - snprintf(buffer, MAX_DPATH, "scanlines_by_default=%s\n", scanlines_by_default ? "yes" : "no"); + snprintf(buffer, MAX_DPATH, "default_line_mode=%d\n", amiberry_options.default_line_mode); fputs(buffer, f); // Swap Win keys with Alt keys? // This helps with keyboards that may not have 2 Win keys and no Menu key either - snprintf(buffer, MAX_DPATH, "swap_win_alt_keys=%s\n", swap_win_alt_keys ? "yes" : "no"); + snprintf(buffer, MAX_DPATH, "swap_win_alt_keys=%s\n", amiberry_options.swap_win_alt_keys ? "yes" : "no"); fputs(buffer, f); // Disable controller in the GUI? // If you want to disable the default behavior for some reason - snprintf(buffer, MAX_DPATH, "gui_joystick_control=%s\n", gui_joystick_control ? "yes" : "no"); + snprintf(buffer, MAX_DPATH, "gui_joystick_control=%s\n", amiberry_options.gui_joystick_control ? "yes" : "no"); fputs(buffer, f); // Use a separate render thread under SDL2? // This might give a performance boost, but it's not supported on all SDL2 back-ends - snprintf(buffer, MAX_DPATH, "use_sdl2_render_thread=%s\n", use_sdl2_render_thread ? "yes" : "no"); + snprintf(buffer, MAX_DPATH, "use_sdl2_render_thread=%s\n", amiberry_options.use_sdl2_render_thread ? "yes" : "no"); fputs(buffer, f); + // Default mouse input speed + snprintf(buffer, MAX_DPATH, "input_default_mouse_speed=%d\n", amiberry_options.input_default_mouse_speed); + fputs(buffer, f); + + // When using Keyboard as Joystick, stop any double keypresses + snprintf(buffer, MAX_DPATH, "input_keyboard_as_joystick_stop_keypresses=%s\n", amiberry_options.input_keyboard_as_joystick_stop_keypresses ? "yes" : "no"); + // Default key for opening the GUI (e.g. "F12") - snprintf(buffer, MAX_DPATH, "default_open_gui_key=%s\n", default_open_gui_key); + snprintf(buffer, MAX_DPATH, "default_open_gui_key=%s\n", amiberry_options.default_open_gui_key); fputs(buffer, f); // Default key for Quitting the emulator - snprintf(buffer, MAX_DPATH, "default_quit_key=%s\n", default_quit_key); + snprintf(buffer, MAX_DPATH, "default_quit_key=%s\n", amiberry_options.default_quit_key); fputs(buffer, f); // Rotation angle of the output display (useful for screens with portrait orientation, like the Go Advance) - snprintf(buffer, MAX_DPATH, "rotation_angle=%d\n", rotation_angle); + snprintf(buffer, MAX_DPATH, "rotation_angle=%d\n", amiberry_options.rotation_angle); fputs(buffer, f); // Enable Horizontal Centering by default? - snprintf(buffer, MAX_DPATH, "default_horizontal_centering=%s\n", default_horizontal_centering ? "yes" : "no"); + snprintf(buffer, MAX_DPATH, "default_horizontal_centering=%s\n", amiberry_options.default_horizontal_centering ? "yes" : "no"); fputs(buffer, f); // Enable Vertical Centering by default? - snprintf(buffer, MAX_DPATH, "default_vertical_centering=%s\n", default_vertical_centering ? "yes" : "no"); + snprintf(buffer, MAX_DPATH, "default_vertical_centering=%s\n", amiberry_options.default_vertical_centering ? "yes" : "no"); fputs(buffer, f); // Scaling method to use by default? // Valid options are: -1 Auto, 0 Nearest Neighbor, 1 Linear - snprintf(buffer, MAX_DPATH, "default_scaling_method=%d\n", default_scaling_method); + snprintf(buffer, MAX_DPATH, "default_scaling_method=%d\n", amiberry_options.default_scaling_method); fputs(buffer, f); // Paths @@ -1103,21 +1107,21 @@ void load_amiberry_settings(void) cfgfile_intval(option, value, "ROMs", &numROMs, 1); cfgfile_intval(option, value, "MRUDiskList", &numDisks, 1); cfgfile_intval(option, value, "MRUCDList", &numCDs, 1); - cfgfile_intval(option, value, "Quickstart", &quickstart_start, 1); - cfgfile_yesno(option, value, "read_config_descriptions", &read_config_descriptions); - cfgfile_yesno(option, value, "write_logfile", &write_logfile); - cfgfile_yesno(option, value, "scanlines_by_default", &scanlines_by_default); - cfgfile_yesno(option, value, "swap_win_alt_keys", &swap_win_alt_keys); - cfgfile_yesno(option, value, "gui_joystick_control", &gui_joystick_control); - cfgfile_yesno(option, value, "use_sdl2_render_thread", &use_sdl2_render_thread); - cfgfile_intval(option, value, "input_default_mouse_speed", &input_default_mouse_speed, 1); - cfgfile_yesno(option, value, "input_keyboard_as_joystick_stop_keypresses", &input_keyboard_as_joystick_stop_keypresses); - cfgfile_string(option, value, "default_open_gui_key", default_open_gui_key, sizeof default_open_gui_key); - cfgfile_string(option, value, "default_quit_key", default_quit_key, sizeof default_quit_key); - cfgfile_intval(option, value, "rotation_angle", &rotation_angle, 1); - cfgfile_yesno(option, value, "default_horizontal_centering", &default_horizontal_centering); - cfgfile_yesno(option, value, "default_vertical_centering", &default_vertical_centering); - cfgfile_intval(option, value, "default_scaling_method", &default_scaling_method, 1); + cfgfile_yesno(option, value, "Quickstart", &amiberry_options.quickstart_start); + cfgfile_yesno(option, value, "read_config_descriptions", &amiberry_options.read_config_descriptions); + cfgfile_yesno(option, value, "write_logfile", &amiberry_options.write_logfile); + cfgfile_intval(option, value, "default_line_mode", &amiberry_options.default_line_mode, 1); + cfgfile_yesno(option, value, "swap_win_alt_keys", &amiberry_options.swap_win_alt_keys); + cfgfile_yesno(option, value, "gui_joystick_control", &amiberry_options.gui_joystick_control); + cfgfile_yesno(option, value, "use_sdl2_render_thread", &amiberry_options.use_sdl2_render_thread); + cfgfile_intval(option, value, "input_default_mouse_speed", &amiberry_options.input_default_mouse_speed, 1); + cfgfile_yesno(option, value, "input_keyboard_as_joystick_stop_keypresses", &amiberry_options.input_keyboard_as_joystick_stop_keypresses); + cfgfile_string(option, value, "default_open_gui_key", amiberry_options.default_open_gui_key, sizeof amiberry_options.default_open_gui_key); + cfgfile_string(option, value, "default_quit_key", amiberry_options.default_quit_key, sizeof amiberry_options.default_quit_key); + cfgfile_intval(option, value, "rotation_angle", &amiberry_options.rotation_angle, 1); + cfgfile_yesno(option, value, "default_horizontal_centering", &amiberry_options.default_horizontal_centering); + cfgfile_yesno(option, value, "default_vertical_centering", &amiberry_options.default_vertical_centering); + cfgfile_intval(option, value, "default_scaling_method", &amiberry_options.default_scaling_method, 1); } } } @@ -1349,7 +1353,7 @@ int handle_msgpump() } } // If the reset combination was pressed, handle it - if (swap_win_alt_keys) + if (amiberry_options.swap_win_alt_keys) { if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LALT] && (keystate[SDL_SCANCODE_RALT] || keystate[SDL_SCANCODE_APPLICATION])) { @@ -1390,7 +1394,7 @@ int handle_msgpump() } // Handle all other keys - if (swap_win_alt_keys) + if (amiberry_options.swap_win_alt_keys) { if (event.key.keysym.scancode == SDL_SCANCODE_LALT) event.key.keysym.scancode = SDL_SCANCODE_LGUI; @@ -1409,7 +1413,7 @@ int handle_msgpump() { if (event.key.repeat == 0) { - if (swap_win_alt_keys) + if (amiberry_options.swap_win_alt_keys) { if (event.key.keysym.scancode == SDL_SCANCODE_LALT) event.key.keysym.scancode = SDL_SCANCODE_LGUI; diff --git a/src/osdep/amiberry_gfx.cpp b/src/osdep/amiberry_gfx.cpp index d6fcc97a..0a8d4f26 100644 --- a/src/osdep/amiberry_gfx.cpp +++ b/src/osdep/amiberry_gfx.cpp @@ -374,7 +374,7 @@ int graphics_setup(void) if (sdl_window == nullptr) { - if (rotation_angle != 0 && rotation_angle != 180) + if (amiberry_options.rotation_angle != 0 && amiberry_options.rotation_angle != 180) { sdl_window = SDL_CreateWindow("Amiberry", SDL_WINDOWPOS_CENTERED, @@ -653,7 +653,7 @@ static void open_screen(struct uae_prefs* p) pixel_format = SDL_PIXELFORMAT_RGBA32; } - if (rotation_angle == 0 || rotation_angle == 180) + if (amiberry_options.rotation_angle == 0 || amiberry_options.rotation_angle == 180) { SDL_RenderSetLogicalSize(renderer, display_width, display_height); renderQuad = { 0, 0, display_width, display_height }; @@ -673,7 +673,7 @@ static void open_screen(struct uae_prefs* p) const auto width = display_width * 2 >> p->gfx_resolution; const auto height = display_height * 2 >> p->gfx_vresolution; - if (rotation_angle == 0 || rotation_angle == 180) + if (amiberry_options.rotation_angle == 0 || amiberry_options.rotation_angle == 180) { SDL_RenderSetLogicalSize(renderer, width, height); renderQuad = { 0, 0, width, height }; @@ -894,7 +894,7 @@ int sdl2_render_thread(void *ptr) { SDL_UpdateTexture(texture, nullptr, screen->pixels, screen->pitch); SDL_RenderClear(renderer); - SDL_RenderCopyEx(renderer, texture, nullptr, &renderQuad, rotation_angle, nullptr, SDL_FLIP_NONE); + SDL_RenderCopyEx(renderer, texture, nullptr, &renderQuad, amiberry_options.rotation_angle, nullptr, SDL_FLIP_NONE); return 0; } @@ -960,7 +960,7 @@ void show_screen(int mode) wait_for_display_thread(); write_comm_pipe_u32(display_pipe, DISPLAY_SIGNAL_SHOW, 1); #else - if (use_sdl2_render_thread) + if (amiberry_options.use_sdl2_render_thread) { // Wait for the last thread to finish before rendering it. SDL_WaitThread(renderthread, NULL); @@ -974,7 +974,7 @@ void show_screen(int mode) { SDL_UpdateTexture(texture, nullptr, screen->pixels, screen->pitch); SDL_RenderClear(renderer); - SDL_RenderCopyEx(renderer, texture, nullptr, &renderQuad, rotation_angle, nullptr, SDL_FLIP_NONE); + SDL_RenderCopyEx(renderer, texture, nullptr, &renderQuad, amiberry_options.rotation_angle, nullptr, SDL_FLIP_NONE); SDL_RenderPresent(renderer); } #endif diff --git a/src/osdep/amiberry_gfx.h b/src/osdep/amiberry_gfx.h index c9a9cfb0..597ba44e 100644 --- a/src/osdep/amiberry_gfx.h +++ b/src/osdep/amiberry_gfx.h @@ -28,9 +28,7 @@ extern SDL_Renderer* renderer; extern SDL_Window* sdl_window; extern SDL_Surface* gui_screen; extern SDL_Rect renderQuad; -extern int rotation_angle; extern bool can_have_linedouble; -extern bool use_sdl2_render_thread; extern void check_error_sdl(bool check, const char* message); extern void toggle_fullscreen(); diff --git a/src/osdep/amiberry_gui.cpp b/src/osdep/amiberry_gui.cpp index ad85359c..f9e380f9 100644 --- a/src/osdep/amiberry_gui.cpp +++ b/src/osdep/amiberry_gui.cpp @@ -345,7 +345,7 @@ void ReadConfigFileList(void) strncpy(tmp->Name, file.c_str(), MAX_DPATH - 1); removeFileExtension(tmp->Name); // If the user has many (thousands) of configs, this will take a long time - if (read_config_descriptions) + if (amiberry_options.read_config_descriptions) { struct uae_prefs *p = cfgfile_open(tmp->FullPath, NULL); if (p) { diff --git a/src/osdep/amiberry_input.cpp b/src/osdep/amiberry_input.cpp index 835bfe78..a3ac8c57 100644 --- a/src/osdep/amiberry_input.cpp +++ b/src/osdep/amiberry_input.cpp @@ -1744,7 +1744,7 @@ int input_get_default_joystick_analog(struct uae_input_device* uid, int i, int p bool key_used_by_retroarch_joy(int scancode) { auto key_used = false; - if (input_keyboard_as_joystick_stop_keypresses) + if (amiberry_options.input_keyboard_as_joystick_stop_keypresses) { //currprefs.jports[port] for (auto joyid = 0; joyid < MAX_JPORTS && !key_used; joyid++) diff --git a/src/osdep/gui/InGameMessage.cpp b/src/osdep/gui/InGameMessage.cpp index 62667e5f..eec0c59a 100644 --- a/src/osdep/gui/InGameMessage.cpp +++ b/src/osdep/gui/InGameMessage.cpp @@ -122,7 +122,7 @@ void message_UpdateScreen() vc_dispmanx_update_submit_sync(updateHandle); #else SDL_UpdateTexture(msg_texture, nullptr, msg_screen->pixels, msg_screen->pitch); - SDL_RenderCopyEx(renderer, msg_texture, nullptr, nullptr, rotation_angle, nullptr, SDL_FLIP_NONE); + SDL_RenderCopyEx(renderer, msg_texture, nullptr, nullptr, amiberry_options.rotation_angle, nullptr, SDL_FLIP_NONE); SDL_RenderPresent(renderer); #endif } diff --git a/src/osdep/gui/PanelQuickstart.cpp b/src/osdep/gui/PanelQuickstart.cpp index dd097b43..8e42674a 100644 --- a/src/osdep/gui/PanelQuickstart.cpp +++ b/src/osdep/gui/PanelQuickstart.cpp @@ -735,7 +735,7 @@ class QuickstartModeActionListener : public gcn::ActionListener public: void action(const gcn::ActionEvent& actionEvent) override { - quickstart_start = chkQuickstartMode->isSelected(); + amiberry_options.quickstart_start = chkQuickstartMode->isSelected(); } }; @@ -1065,7 +1065,7 @@ void RefreshPanelQuickstart(void) cmdCDSelect->setEnabled(changed_prefs.cdslots[0].inuse); cboCDFile->setEnabled(changed_prefs.cdslots[0].inuse); - chkQuickstartMode->setSelected(quickstart_start); + chkQuickstartMode->setSelected(amiberry_options.quickstart_start); } bool HelpPanelQuickstart(std::vector& helptext) diff --git a/src/osdep/gui/gui_handling.h b/src/osdep/gui/gui_handling.h index db1e3cd8..c5d0eb42 100644 --- a/src/osdep/gui/gui_handling.h +++ b/src/osdep/gui/gui_handling.h @@ -40,12 +40,10 @@ extern gcn::SDLInput* gui_input; extern SDL_Surface* gui_screen; extern SDL_Joystick* gui_joystick; extern gcn::SDLGraphics* gui_graphics; -extern bool gui_joystick_control; extern char currentDir[MAX_DPATH]; extern char last_loaded_config[MAX_DPATH]; -extern int quickstart_start; extern int quickstart_model; extern int quickstart_conf; @@ -58,7 +56,6 @@ typedef struct } ConfigFileInfo; extern vector ConfigFilesList; -extern bool read_config_descriptions; void InitPanelAbout(const struct _ConfigCategory& category); void ExitPanelAbout(); diff --git a/src/osdep/gui/main_window.cpp b/src/osdep/gui/main_window.cpp index 2941b7f6..f9450f71 100644 --- a/src/osdep/gui/main_window.cpp +++ b/src/osdep/gui/main_window.cpp @@ -269,12 +269,12 @@ void UpdateGuiScreen() vc_dispmanx_update_submit_sync(updateHandle); #else SDL_UpdateTexture(gui_texture, nullptr, gui_screen->pixels, gui_screen->pitch); - if (rotation_angle == 0 || rotation_angle == 180) + if (amiberry_options.rotation_angle == 0 || amiberry_options.rotation_angle == 180) renderQuad = { 0, 0, gui_screen->w, gui_screen->h }; else renderQuad = { -(GUI_WIDTH - GUI_HEIGHT) / 2, (GUI_WIDTH - GUI_HEIGHT) / 2, gui_screen->w, gui_screen->h }; - SDL_RenderCopyEx(renderer, gui_texture, nullptr, &renderQuad, rotation_angle, nullptr, SDL_FLIP_NONE); + SDL_RenderCopyEx(renderer, gui_texture, nullptr, &renderQuad, amiberry_options.rotation_angle, nullptr, SDL_FLIP_NONE); #ifdef SOFTWARE_CURSOR swcursor(true); #endif @@ -410,7 +410,7 @@ void amiberry_gui_init() if (sdl_window) { - if (rotation_angle != 0 && rotation_angle != 180) + if (amiberry_options.rotation_angle != 0 && amiberry_options.rotation_angle != 180) SDL_SetWindowSize(sdl_window, GUI_HEIGHT, GUI_WIDTH); else SDL_SetWindowSize(sdl_window, GUI_WIDTH, GUI_HEIGHT); @@ -424,7 +424,7 @@ void amiberry_gui_init() check_error_sdl(gui_texture == nullptr, "Unable to create GUI texture:"); #endif - if (rotation_angle == 0 || rotation_angle == 180) + if (amiberry_options.rotation_angle == 0 || amiberry_options.rotation_angle == 180) SDL_RenderSetLogicalSize(renderer, GUI_WIDTH, GUI_HEIGHT); else SDL_RenderSetLogicalSize(renderer, GUI_HEIGHT, GUI_WIDTH); @@ -837,7 +837,7 @@ void checkInput() void amiberry_gui_run() { - if (gui_joystick_control) + if (amiberry_options.gui_joystick_control) { const auto available_joysticks = SDL_NumJoysticks(); if (available_joysticks > 0) @@ -1142,7 +1142,7 @@ void gui_widgets_init() //-------------------------------------------------- // Activate last active panel //-------------------------------------------------- - if (!emulating && quickstart_start) + if (!emulating && amiberry_options.quickstart_start) last_active_panel = 2; categories[last_active_panel].selector->requestFocus(); cmdHelp->setVisible(categories[last_active_panel].HelpFunc != nullptr); diff --git a/src/osdep/writelog.cpp b/src/osdep/writelog.cpp index 5c0ceb2f..be8c6e06 100644 --- a/src/osdep/writelog.cpp +++ b/src/osdep/writelog.cpp @@ -11,10 +11,10 @@ #include "sysdeps.h" #include "uae.h" +#include "options.h" #define WRITE_LOG_BUF_SIZE 4096 FILE *debugfile = NULL; -extern bool write_logfile; void console_out (const TCHAR *format,...) { @@ -29,7 +29,7 @@ void console_out (const TCHAR *format,...) void write_log(const char* format, ...) { - if (write_logfile) + if (amiberry_options.write_logfile) { // Redirect logging to Android's logcat #ifdef ANDROID