Code cleanup and default prefs improvements

This commit is contained in:
Dimitris Panokostas 2017-02-02 23:59:31 +01:00
parent 54e28e4bf5
commit fdc1c07eaf
3 changed files with 23 additions and 40 deletions

View file

@ -17,7 +17,7 @@
#include "custom.h"
#include "inputdevice.h"
#include "savestate.h"
#include "memory.h"
#include "include/memory.h"
#include "rommgr.h"
#include "gui.h"
#include "newcpu.h"
@ -4057,8 +4057,9 @@ void default_prefs(struct uae_prefs* p, int type)
int roms[] = {6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1};
TCHAR zero = 0;
struct zfile* f;
reset_inputdevice_config(p);
memset(p, 0, sizeof(struct uae_prefs));
memset(p, 0, sizeof(*p));
_tcscpy(p->description, _T("UAE default configuration"));
p->start_gui = true;
@ -4103,28 +4104,20 @@ void default_prefs(struct uae_prefs* p, int type)
p->optcount[4] = 0;
p->optcount[5] = 0;
p->gfx_framerate = 0;
p->gfx_framerate = 1;
p->gfx_size_fs.width = 640;
p->gfx_size_fs.height = 480;
p->gfx_size_win.width = 320;
p->gfx_size_win.height = 240;
p->gfx_size_win.width = 720;
p->gfx_size_win.height = 568;
#ifdef RASPBERRY
p->gfx_size.width = 640;
p->gfx_size.height = 262;
#else
p->gfx_size.width = 320;
p->gfx_size.height = 240;
#endif
p->gfx_size.height = 256;
p->gfx_resolution = RES_LORES;
p->gfx_resolution = RES_HIRES;
#ifdef RASPBERRY
// p->gfx_correct_aspect = 1;
// p->gfx_fullscreen_ratio = 100;
p->kbd_led_num = -1; // No status on numlock
p->kbd_led_scr = -1; // No status on scrollock
// p->kbd_led_cap = -1; // No status on capslock
#endif
p->immediate_blits = 0;

View file

@ -695,7 +695,6 @@ static int real_main2 (int argc, TCHAR **argv)
inputdevice_init();
changed_prefs = currprefs;
no_gui = !currprefs.start_gui;
if (restart_program == 2)
no_gui = true;

View file

@ -30,6 +30,7 @@
int emulating = 0;
extern int screen_is_picasso;
struct uae_prefs workprefs;
struct gui_msg
{
@ -56,10 +57,10 @@ struct gui_msg gui_msglist[] = {
{-1, ""}
};
std::vector<ConfigFileInfo*> ConfigFilesList;
std::vector<AvailableROM*> lstAvailableROMs;
std::vector<std::string> lstMRUDiskList;
std::vector<std::string> lstMRUCDList;
vector<ConfigFileInfo*> ConfigFilesList;
vector<AvailableROM*> lstAvailableROMs;
vector<string> lstMRUDiskList;
vector<string> lstMRUCDList;
void AddFileToDiskList(const char* file, int moveToTop)
@ -268,7 +269,7 @@ static void scan_rom(char* path)
void RescanROMs()
{
std::vector<std::string> files;
vector<string> files;
char path[MAX_DPATH];
romlist_clear();
@ -416,11 +417,12 @@ ConfigFileInfo* SearchConfigInList(const char* name)
}
static void prefs_to_gui()
static void prefs_to_gui(struct uae_prefs *p)
{
workprefs = *p;
/* filesys hack */
changed_prefs.mountitems = currprefs.mountitems;
memcpy(&changed_prefs.mountconfig, &currprefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof(struct uaedev_config_info));
workprefs.mountitems = currprefs.mountitems;
memcpy(&workprefs.mountconfig, &currprefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof(struct uaedev_config_info));
}
@ -429,6 +431,7 @@ static void gui_to_prefs()
/* filesys hack */
currprefs.mountitems = changed_prefs.mountitems;
memcpy(&currprefs.mountconfig, &changed_prefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof(struct uaedev_config_info));
fixup_prefs(&changed_prefs);
}
@ -457,14 +460,13 @@ static void after_leave_gui()
int gui_init()
{
int ret = 0;
emulating = 0;
int ret = 0;
if (lstAvailableROMs.size() == 0)
RescanROMs();
prefs_to_gui();
prefs_to_gui(&changed_prefs);
run_gui();
gui_to_prefs();
if (quit_program < 0)
@ -475,7 +477,6 @@ int gui_init()
update_display(&changed_prefs);
after_leave_gui();
emulating = 1;
return ret;
}
@ -550,13 +551,14 @@ void gui_display(int shortcut)
if (quit_program != 0)
return;
emulating = 1;
pause_sound();
blkdev_entergui();
if (lstAvailableROMs.size() == 0)
RescanROMs();
prefs_to_gui();
prefs_to_gui(&changed_prefs);
run_gui();
gui_to_prefs();
@ -575,15 +577,6 @@ void gui_display(int shortcut)
}
void moveVertical(int value)
{
changed_prefs.pandora_vertical_offset += value;
if (changed_prefs.pandora_vertical_offset < -16)
changed_prefs.pandora_vertical_offset = -16;
else if (changed_prefs.pandora_vertical_offset > 16)
changed_prefs.pandora_vertical_offset = 16;
}
void gui_disk_image_change(int unitnum, const char* name, bool writeprotected)
{
}
@ -634,9 +627,7 @@ void gui_led(int led, int on)
void gui_flicker_led(int led, int status)
{
#ifdef RASPBERRY
gui_led(led, status);
#endif
}