Solution for host controller settings implemented

This commit is contained in:
HoraceAndTheSpider 2018-03-01 20:43:21 +00:00
parent 2382db08fa
commit 10ad9ae3bd
2 changed files with 67 additions and 160 deletions

View file

@ -565,33 +565,6 @@ extern void cfgfile_compatibility_rtg(struct uae_prefs *p);
extern void whdload_auto_prefs (struct uae_prefs *p, char* filename);
struct whdload_host_options {
TCHAR controller_mouse1[256];
TCHAR controller_mouse2[256];
TCHAR controller_ply1[256];
TCHAR controller_ply2[256];
TCHAR controller_ply3[256];
TCHAR controller_ply4[256];
int controller_deadzone;
int controller_mouse_map;
TCHAR key_quit[256];
TCHAR key_menu[256];
bool retroarch_quit;
bool retroarch_menu;
bool retroarch_reset;
int sound_seperation;
bool sound_stereo;
bool sound_on;
bool gfx_fix_aspect;
bool gfx_frameskip;
bool gfx_vertical_offset;
};
extern void check_prefs_changed_custom (void);
extern void check_prefs_changed_cpu (void);

View file

@ -1319,10 +1319,6 @@ void RemoveChar(char* array, int len, int index)
array[len-1] = 0;
}
//extern struct whdload_host_options my_host;
int whdhost_parse_option(struct uae_prefs* p, const char* option, const char* value)
{
@ -1338,12 +1334,14 @@ void whdload_auto_prefs (struct uae_prefs* p, char* filepath)
TCHAR tmp[MAX_DPATH];
char BootPath[MAX_DPATH];
char KickPath[MAX_DPATH];
char GameTypePath[MAX_DPATH];
int rom_test;
int roms[2];
struct whdload_host_options my_host;
int *type;
//
// *** KICKSTARTS ***
//
// here we can do some checks for Kickstarts we might need to make symlinks for
strncpy(currentDir, start_path_data, MAX_DPATH);
snprintf(KickPath, MAX_DPATH, "%s/whdboot/boot-data/Devs/Kickstarts/kick33180.A500", start_path_data);
@ -1378,25 +1376,68 @@ void whdload_auto_prefs (struct uae_prefs* p, char* filepath)
const int a600_available = rom_test;
//
// *** GAME DETECTION ***
//
// find the SHA1 - this currently does not return the correct result!!
long filesize;
filesize = GetFileSize(filepath);
char WHDPath[MAX_DPATH];
snprintf(WHDPath, MAX_DPATH, "%s/whdboot/game-data/", start_path_data);
// EDIT THE FILE NAME TO USE HERE
char WHDConfig[255];
strcpy(WHDConfig, WHDPath);
strcat(WHDConfig,game_name);
strcat(WHDConfig,".whd");
printf("\nWHD file: %s \n",WHDConfig);
// LOAD GAME SPECIFICS - USE SHA1 IF AVAILABLE
// if (zfile_exists(WHDConfig))
// cfgfile_load(p, WHDConfig, type, 0, 1);
// const TCHAR* filesha = get_sha1_txt (input, filesize); <<< ??! FIX ME
// REMOVE THE FILE PATH AND EXTENSION
const TCHAR* filename = my_getfilepart(filepath);
_stprintf(tmp,_T("uaehf0=dir,rw,DH0:DH0::%s,10") , BootPath);
// SET UNIVERSAL DEFAULTS
p->start_gui = false;
// SOMEWHERE HERE WE NEED TO SET THE GAME 'NAME' FOR SAVESTATE ETC PURPOSES
extractFileName(filepath, last_loaded_config);
extractFileName(filepath, game_name);
removeFileExtension(game_name);
//
// *** EMULATED HARDWARE ***
//
// SET UNIVERSAL DEFAULTS
p->start_gui = false;
// APPLY SPECIAL CONFIG E.G. MOUSE OR ALT. JOYSTICK SETTINGS
// if joystick game
snprintf(GameTypePath, MAX_DPATH, "%s/whdboot/default_joystick.uae", start_path_data);
// if mouse game
// snprintf(GameTypePath, MAX_DPATH, "%s/whdboot/default_mouse.uae", start_path_data);
if (zfile_exists(GameTypePath))
{
for (auto i = 0; i < MAX_JPORTS; i++)
{
p->jports[i].id = JPORT_NONE;
p->jports[i].idc.configname[0] = 0;
p->jports[i].idc.name[0] = 0;
p->jports[i].idc.shortid[0] = 0;
}
cfgfile_load(p, GameTypePath, type, 0, 1);
}
// SET THE BASE AMIGA (Expanded A1200)
built_in_prefs(&currprefs, 3, 1, 0, 0);
@ -1417,10 +1458,8 @@ void whdload_auto_prefs (struct uae_prefs* p, char* filepath)
// A1200
else
_tcscpy(p->description, _T("WHDLoad AutoBoot Configuration [AGA]"));
//SET THE WHD BOOTER AND GAME DATA
strncpy(currentDir, start_path_data, MAX_DPATH);
snprintf(BootPath, MAX_DPATH, "%s/whdboot/boot-data/", start_path_data);
// set the first (whdboot) Drive
@ -1441,133 +1480,28 @@ void whdload_auto_prefs (struct uae_prefs* p, char* filepath)
txt2 = parsetextpath(_T(tmp));
cfgfile_parse_line(p, txt2, 0);
//GET THE HOST SETTINGS
//APPLY THE SETTINGS FOR MOUSE/JOYSTICK ETC
if (is_cd32 == true)
{ p->jports[0].mode = 7;
p->jports[1].mode = 7; }
// this structure needs to be filled from a config file, and not manually like this!!!
_stprintf(my_host.controller_mouse1,_T("mouse"));
_stprintf(my_host.controller_mouse2,_T("joy1"));
_stprintf(my_host.controller_ply1,_T("joy1"));
_stprintf(my_host.controller_ply2,_T("joy0"));
_stprintf(my_host.controller_ply3,_T("joy2"));
_stprintf(my_host.controller_ply4,_T("joy3"));
my_host.controller_deadzone = 33;
my_host.controller_mouse_map = 2;
_stprintf(my_host.key_quit,_T("Esc"));
_stprintf(my_host.key_menu,_T("F12"));
my_host.sound_seperation = 1;
my_host.sound_on = true;
// my_host.sound_stereo = SND_MONO;
my_host.retroarch_quit = true;
my_host.retroarch_menu = true;
my_host.retroarch_reset = true;
my_host.gfx_fix_aspect = true;
my_host.gfx_frameskip = false;
// bool gfx_vertical_offset = 4;
// SET THE GAME SETTINGS
char WHDPath[MAX_DPATH];
strncpy(currentDir, start_path_data, MAX_DPATH);
snprintf(WHDPath, MAX_DPATH, "%s/whdboot/game-data/", start_path_data);
// EDIT THE FILE NAME TO USE HERE
char WHDConfig[255];
strcpy(WHDConfig, WHDPath);
strcat(WHDConfig,game_name);
strcat(WHDConfig,".whd");
printf("\nWHD file: %s \n",WHDConfig);
int *type;
// LOAD GAME SPECIFICS - USE SHA1 IF AVAILABLE
if (zfile_exists(WHDConfig))
cfgfile_load(p, WHDConfig, type, 0, 1);
// APPLY SPECIAL OPTIONS E.G. MOUSE OR ALT. JOYSTICK SETTINGS <<< NEEDS HOST SETTINGS
// joystick games
// this worked
// p->jports[0].id = JSEM_JOYS ;
// _tcscpy(p->jports[0].idc.name, _T("JOY0"));
// _tcscpy(p->jports[0].idc.configname, _T("JOY0"));
// _stprintf(my_host.controller_mouse1,_T("mouse"));
// _stprintf(my_host.controller_mouse2,_T("joy1"));
// my_host.controller_mouse_map = 2;
// _stprintf(my_host.controller_ply1,_T("joy0"));
// _stprintf(my_host.controller_ply2,_T("joy1"));
// _stprintf(my_host.controller_ply3,_T("joy2"));
// _stprintf(my_host.controller_ply4,_T("joy3"));
p->input_joymouse_deadzone = my_host.controller_deadzone;
// _stprintf(my_host.key_quit,_T("Esc"));
// _stprintf(my_host.key_menu,_T("F12"));
p->sound_stereo_separation = my_host.sound_seperation;
// my_host.sound_on = true;
// my_host.sound_stereo = SND_MONO;
p->use_retroarch_quit = my_host.retroarch_quit;
p->use_retroarch_menu = my_host.retroarch_menu;
p->use_retroarch_reset = my_host.retroarch_reset;
p->gfx_correct_aspect = my_host.gfx_fix_aspect;
p->gfx_framerate = my_host.gfx_frameskip;
// p->vertical_offset = gfx_vertical_offset;
// for (auto i = 0; i < MAX_JPORTS; i++)
// {
// p->jports[i].id = JPORT_NONE;
// p->jports[i].idc.configname[0] = 0;
// p->jports[i].idc.name[0] = 0;
// p->jports[i].idc.shortid[0] = 0;
// }
// +++
// _stprintf(txt2,_T(my_host.controller_ply1));
// cfgfile_parse_option(&currprefs, _T("joyport0"), txt2, 0);
// p->jports[0].id = JSEM_JOYS + 1;
// _tcscpy(p->jports[0].idc.name, _T(my_host.controller_ply1));
// _tcscpy(p->jports[0].idc.configname, _T(my_host.controller_ply1));
// _stprintf(txt2,_T(my_host.controller_ply2));
// cfgfile_parse_option(&currprefs, _T("joyport1"), txt2, 0);
// p->jports[1].id = JSEM_JOYS;
// _tcscpy(p->jports[1].idc.name, _T(my_host.controller_ply2));
// _tcscpy(p->jports[1].idc.configname, _T(my_host.controller_ply2));
// *** GAME-SPECIFICS ***
// SET THE GAME COMPATIBILITY SETTINGS
//
// SCREEN HEIGHT, BLITTER, SPRITES, MEMORY, JIT, BIG CPU ETC
// CLEAN UP SETTINGS (MAYBE??)
// fixup_prefs(&currprefs, true);
// fixup_prefs(&currprefs, true);
// cfgfile_configuration_change(1);
// SECONDARY CONFIG LOAD IF .UAE IS IN CONFIG PATH
// SECONDARY CONFIG LOAD IF .UAE IS IN CONFIG PATH
strcpy(WHDConfig, config_path);
strcat(WHDConfig, game_name);
strcat(WHDConfig,".uae");