Normalization of function names according to C standards

This commit is contained in:
Dimitris Panokostas 2020-06-16 22:21:05 +02:00
parent 9babcb518d
commit c0efbd9ccc
19 changed files with 221 additions and 219 deletions

View file

@ -435,7 +435,7 @@ TCHAR *cfgfile_option_get(const TCHAR *s, const TCHAR *option)
return cfgfile_option_find_it(s, option, true);
}
static void trimwsa(char* s)
static void trim_wsa(char* s)
{
/* Delete trailing whitespace. */
int len = strlen(s);
@ -626,7 +626,7 @@ static TCHAR *cfgfile_get_multipath2 (struct multipath *mp, const TCHAR *path, c
if (!s) {
TCHAR np[MAX_DPATH];
_tcscpy (np, mp->path[i]);
fixtrailing (np);
fix_trailing (np);
_tcscat (np, file);
//fullpath (np, sizeof np / sizeof (TCHAR));
s = my_strdup (np);
@ -971,7 +971,7 @@ static void cfgfile_adjust_path(TCHAR *path, int maxsz, struct multipath *mp)
if (mp->path[i][0] && _tcscmp(mp->path[i], _T(".\\")) != 0 && _tcscmp(mp->path[i], _T("./")) != 0 && (path[0] != '/' && path[0] != '\\' && !_tcschr(path, ':'))) {
TCHAR np[MAX_DPATH];
_tcscpy(np, mp->path[i]);
fixtrailing(np);
fix_trailing(np);
_tcscat(np, s);
//fullpath(np, sizeof np / sizeof(TCHAR));
if (zfile_exists(np)) {
@ -2620,7 +2620,7 @@ static int cfgfile_multipath (const TCHAR *option, const TCHAR *value, const TCH
TCHAR *s = target_expand_environment (tmploc, NULL, 0);
_tcsncpy (mp->path[i], s, MAX_DPATH - 1);
mp->path[i][MAX_DPATH - 1] = 0;
fixtrailing (mp->path[i]);
fix_trailing (mp->path[i]);
xfree (s);
//target_multipath_modified(p);
return 1;
@ -5127,7 +5127,7 @@ static int cfgfile_load_2(struct uae_prefs* p, const TCHAR* filename, bool real,
while (cfg_fgets(linea, sizeof (linea), fh) != nullptr)
{
trimwsa(linea);
trim_wsa(linea);
if (strlen(linea) > 0)
{
if (linea[0] == '#' || linea[0] == ';')

View file

@ -923,7 +923,7 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci, bool custo
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
if (nr == i || !mountinfo.ui[i].open || mountinfo.ui[i].rootdir == NULL || is_hardfile (i) == FILESYS_CD)
continue;
if (_tcslen(c.rootdir) > 0 && samepath(mountinfo.ui[i].rootdir, c.rootdir)) {
if (_tcslen(c.rootdir) > 0 && same_path(mountinfo.ui[i].rootdir, c.rootdir)) {
error_log (_T("directory/hardfile '%s' already added."), c.rootdir);
return -1;
}

View file

@ -38,13 +38,13 @@ extern void target_startup_msg(const TCHAR *title, const TCHAR *msg);
extern void target_cpu_speed(void);
extern int target_sleep_nanos(int);
extern bool get_plugin_path (TCHAR *out, int size, const TCHAR *path);
extern void stripslashes (TCHAR *p);
extern void fixtrailing (TCHAR *p);
extern void strip_slashes (TCHAR *p);
extern void fix_trailing (TCHAR *p);
extern void fullpath(TCHAR *path, int size);
extern void fullpath(TCHAR *path, int size, bool userelative);
extern void getpathpart (TCHAR *outpath, int size, const TCHAR *inpath);
extern void getfilepart (TCHAR *out, int size, const TCHAR *path);
extern bool samepath(const TCHAR *p1, const TCHAR *p2);
extern void get_path_part (TCHAR *outpath, int size, const TCHAR *inpath);
extern void get_file_part (TCHAR *out, int size, const TCHAR *path);
extern bool same_path(const TCHAR *p1, const TCHAR *p2);
extern bool target_isrelativemode(void);
extern uae_u32 getlocaltime (void);
extern bool isguiactive(void);

View file

@ -193,7 +193,7 @@ void logging_init(void)
{
static int started;
static int first;
char debugfilename[MAX_DPATH];
char debug_filename[MAX_DPATH];
if (first > 1)
{
@ -207,9 +207,9 @@ void logging_init(void)
debugfile = nullptr;
}
sprintf(debugfilename, "%s", logfile_path);
sprintf(debug_filename, "%s", logfile_path);
if (!debugfile)
debugfile = fopen(debugfilename, "wt");
debugfile = fopen(debug_filename, "wt");
first++;
write_log("AMIBERRY Logfile\n\n");
@ -224,13 +224,13 @@ void logging_cleanup(void)
}
void stripslashes(TCHAR* p)
void strip_slashes(TCHAR* p)
{
while (_tcslen(p) > 0 && (p[_tcslen(p) - 1] == '\\' || p[_tcslen(p) - 1] == '/'))
p[_tcslen(p) - 1] = 0;
}
void fixtrailing(TCHAR* p)
void fix_trailing(TCHAR* p)
{
if (_tcslen(p) == 0)
return;
@ -239,23 +239,23 @@ void fixtrailing(TCHAR* p)
_tcscat(p, "/");
}
bool samepath(const TCHAR* p1, const TCHAR* p2)
bool same_path(const TCHAR* p1, const TCHAR* p2)
{
if (!_tcsicmp(p1, p2))
return true;
return false;
}
void getpathpart(TCHAR* outpath, int size, const TCHAR* inpath)
void get_path_part(TCHAR* outpath, int size, const TCHAR* inpath)
{
_tcscpy(outpath, inpath);
auto* const p = _tcsrchr(outpath, '/');
if (p)
p[0] = 0;
fixtrailing(outpath);
fix_trailing(outpath);
}
void getfilepart(TCHAR* out, int size, const TCHAR* path)
void get_file_part(TCHAR* out, int size, const TCHAR* path)
{
out[0] = 0;
const auto* const p = _tcsrchr(path, '/');
@ -630,7 +630,7 @@ void get_saveimage_path(char* out, int size, int dir)
void get_configuration_path(char* out, int size)
{
fixtrailing(config_path);
fix_trailing(config_path);
strncpy(out, config_path, size - 1);
}
@ -641,7 +641,7 @@ void set_configuration_path(char* newpath)
void get_controllers_path(char* out, int size)
{
fixtrailing(controllers_path);
fix_trailing(controllers_path);
strncpy(out, controllers_path, size - 1);
}
@ -682,7 +682,7 @@ void set_logfile_path(char* newpath)
void get_rom_path(char* out, int size)
{
fixtrailing(rom_path);
fix_trailing(rom_path);
strncpy(out, rom_path, size - 1);
}
@ -693,7 +693,7 @@ void set_rom_path(char* newpath)
void get_rp9_path(char* out, int size)
{
fixtrailing(rp9_path);
fix_trailing(rp9_path);
strncpy(out, rp9_path, size - 1);
}
@ -724,7 +724,7 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int
// Load rp9 config
result = rp9_parse_file(p, filename);
if (result)
extractFileName(filename, last_loaded_config);
extract_filename(filename, last_loaded_config);
}
else
{
@ -735,7 +735,7 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int
result = cfgfile_load(p, filename, &config_type, 0, 1);
}
if (result)
extractFileName(filename, last_loaded_config);
extract_filename(filename, last_loaded_config);
}
if (result)
@ -785,7 +785,7 @@ int check_configfile(char* file)
return 0;
}
void extractFileName(const char* str, char* buffer)
void extract_filename(const char* str, char* buffer)
{
const auto* p = str + strlen(str) - 1;
while (*p != '/' && p >= str)
@ -794,7 +794,7 @@ void extractFileName(const char* str, char* buffer)
strncpy(buffer, p, MAX_DPATH - 1);
}
void extractPath(char* str, char* buffer)
void extract_path(char* str, char* buffer)
{
strncpy(buffer, str, MAX_DPATH - 1);
auto* p = buffer + strlen(buffer) - 1;
@ -803,7 +803,7 @@ void extractPath(char* str, char* buffer)
p[1] = '\0';
}
void removeFileExtension(char* filename)
void remove_file_extension(char* filename)
{
auto* p = filename + strlen(filename) - 1;
while (p >= filename && *p != '.')
@ -814,7 +814,7 @@ void removeFileExtension(char* filename)
*p = '\0';
}
void ReadDirectory(const char* path, std::vector<std::string>* dirs, std::vector<std::string>* files)
void read_directory(const char* path, std::vector<std::string>* dirs, std::vector<std::string>* files)
{
struct dirent* dent;
@ -1092,7 +1092,7 @@ void get_string(FILE* f, char* dst, int size)
strncpy(dst, buffer, size);
}
static void trimwsa(char* s)
static void trim_wsa(char* s)
{
/* Delete trailing whitespace. */
int len = strlen(s);
@ -1139,7 +1139,7 @@ void load_amiberry_settings(void)
while (zfile_fgetsa(linea, sizeof linea, fh) != nullptr)
{
trimwsa(linea);
trim_wsa(linea);
if (strlen(linea) > 0)
{
if (!cfgfile_separate_linea(path, linea, option, value))

View file

@ -275,7 +275,7 @@ void RescanROMs()
get_rom_path(path, MAX_DPATH);
load_keyring(&changed_prefs, path);
ReadDirectory(path, nullptr, &files);
read_directory(path, nullptr, &files);
for (auto & file : files)
{
char tmppath[MAX_DPATH];
@ -320,7 +320,7 @@ void ReadConfigFileList(void)
// Read rp9 files
get_rp9_path(path, MAX_DPATH);
ReadDirectory(path, nullptr, &files);
read_directory(path, nullptr, &files);
FilterFiles(&files, filter_rp9);
for (auto & file : files)
{
@ -328,14 +328,14 @@ void ReadConfigFileList(void)
strncpy(tmp->FullPath, path, MAX_DPATH - 1);
strncat(tmp->FullPath, file.c_str(), MAX_DPATH - 1);
strncpy(tmp->Name, file.c_str(), MAX_DPATH - 1);
removeFileExtension(tmp->Name);
remove_file_extension(tmp->Name);
strncpy(tmp->Description, _T("rp9"), MAX_DPATH - 1);
ConfigFilesList.emplace_back(tmp);
}
// Read standard config files
get_configuration_path(path, MAX_DPATH);
ReadDirectory(path, nullptr, &files);
read_directory(path, nullptr, &files);
FilterFiles(&files, filter_uae);
for (auto & file : files)
{
@ -343,7 +343,7 @@ void ReadConfigFileList(void)
strncpy(tmp->FullPath, path, MAX_DPATH - 1);
strncat(tmp->FullPath, file.c_str(), MAX_DPATH - 1);
strncpy(tmp->Name, file.c_str(), MAX_DPATH - 1);
removeFileExtension(tmp->Name);
remove_file_extension(tmp->Name);
// If the user has many (thousands) of configs, this will take a long time
if (amiberry_options.read_config_descriptions)
{
@ -469,14 +469,14 @@ int gui_update()
get_screenshot_path(screenshot_filename, MAX_DPATH - 1);
if (strlen(currprefs.floppyslots[0].df) > 0)
extractFileName(currprefs.floppyslots[0].df, tmp);
extract_filename(currprefs.floppyslots[0].df, tmp);
else
strncpy(tmp, last_loaded_config, MAX_DPATH - 1);
strncat(savestate_fname, tmp, MAX_DPATH - 1);
strncat(screenshot_filename, tmp, MAX_DPATH - 1);
removeFileExtension(savestate_fname);
removeFileExtension(screenshot_filename);
remove_file_extension(savestate_fname);
remove_file_extension(screenshot_filename);
switch(currentStateNum)
{

View file

@ -993,7 +993,7 @@ static void unacquire_joystick(int num)
static const TCHAR* get_joystick_friendlyname(const int joy)
{
const auto tmp1 = new char[255];
auto* const tmp1 = new char[255];
for (auto n = 0; n < num_keys_as_joys; ++n)
{
if (joy == n)
@ -1119,93 +1119,95 @@ static int get_joystick_flags(int num)
static void read_joystick()
{
for (auto joyid = 0; joyid < MAX_JPORTS; joyid++)
for (auto joy_id = 0; joy_id < MAX_JPORTS; joy_id++)
{
// First handle retroarch (or default) keys as Joystick...
if (currprefs.jports[joyid].id >= JSEM_JOYS && currprefs.jports[joyid].id < JSEM_JOYS + num_keys_as_joys)
if (currprefs.jports[joy_id].id >= JSEM_JOYS && currprefs.jports[joy_id].id < JSEM_JOYS + num_keys_as_joys)
{
//
const auto hostkeyid = currprefs.jports[joyid].id - JSEM_JOYS;
auto keystate = SDL_GetKeyboardState(nullptr);
auto kb = hostkeyid;
const auto host_key_id = currprefs.jports[joy_id].id - JSEM_JOYS;
const auto* key_state = SDL_GetKeyboardState(nullptr);
const auto kb = host_key_id;
// cd32 red, blue, green, yellow
setjoybuttonstate(kb, 0, keystate[host_keyboard_buttons[kb].south_button] & 1); // b
setjoybuttonstate(kb, 1, keystate[host_keyboard_buttons[kb].east_button] & 1); // a
setjoybuttonstate(kb, 2, keystate[host_keyboard_buttons[kb].north_button] & 1); //y
setjoybuttonstate(kb, 3, keystate[host_keyboard_buttons[kb].west_button] & 1); // x
setjoybuttonstate(kb, 0, key_state[host_keyboard_buttons[kb].south_button] & 1); // b
setjoybuttonstate(kb, 1, key_state[host_keyboard_buttons[kb].east_button] & 1); // a
setjoybuttonstate(kb, 2, key_state[host_keyboard_buttons[kb].north_button] & 1); //y
setjoybuttonstate(kb, 3, key_state[host_keyboard_buttons[kb].west_button] & 1); // x
setjoybuttonstate(kb, 4, keystate[host_keyboard_buttons[kb].left_shoulder] & 1); // z
setjoybuttonstate(kb, 5, keystate[host_keyboard_buttons[kb].right_shoulder] & 1); // x
setjoybuttonstate(kb, 6, keystate[host_keyboard_buttons[kb].start_button] & 1); //num1
setjoybuttonstate(kb, 4, key_state[host_keyboard_buttons[kb].left_shoulder] & 1); // z
setjoybuttonstate(kb, 5, key_state[host_keyboard_buttons[kb].right_shoulder] & 1); // x
setjoybuttonstate(kb, 6, key_state[host_keyboard_buttons[kb].start_button] & 1); //num1
// up down left right
setjoybuttonstate(kb, 7, keystate[host_keyboard_buttons[kb].dpad_up] & 1);
setjoybuttonstate(kb, 8, keystate[host_keyboard_buttons[kb].dpad_down] & 1);
setjoybuttonstate(kb, 9, keystate[host_keyboard_buttons[kb].dpad_left] & 1);
setjoybuttonstate(kb, 10, keystate[host_keyboard_buttons[kb].dpad_right] & 1);
setjoybuttonstate(kb, 7, key_state[host_keyboard_buttons[kb].dpad_up] & 1);
setjoybuttonstate(kb, 8, key_state[host_keyboard_buttons[kb].dpad_down] & 1);
setjoybuttonstate(kb, 9, key_state[host_keyboard_buttons[kb].dpad_left] & 1);
setjoybuttonstate(kb, 10, key_state[host_keyboard_buttons[kb].dpad_right] & 1);
// stick left/right
setjoybuttonstate(kb, 11, keystate[host_keyboard_buttons[kb].lstick_button] & 1);
setjoybuttonstate(kb, 12, keystate[host_keyboard_buttons[kb].rstick_button] & 1);
setjoybuttonstate(kb, 13, keystate[host_keyboard_buttons[kb].select_button] & 1); // num2
setjoybuttonstate(kb, 11, key_state[host_keyboard_buttons[kb].lstick_button] & 1);
setjoybuttonstate(kb, 12, key_state[host_keyboard_buttons[kb].rstick_button] & 1);
setjoybuttonstate(kb, 13, key_state[host_keyboard_buttons[kb].select_button] & 1); // num2
// hotkey?
if (host_keyboard_buttons[kb].hotkey_button != -1 && keystate[host_keyboard_buttons[kb].hotkey_button] & 1)
if (host_keyboard_buttons[kb].hotkey_button != -1 && key_state[host_keyboard_buttons[kb].hotkey_button] & 1)
{
//held_offset = REMAP_BUTTONS;
// menu button
if (host_keyboard_buttons[kb].menu_button != -1)
setjoybuttonstate(kb, 14, keystate[host_keyboard_buttons[kb].menu_button] & 1);
setjoybuttonstate(kb, 14, key_state[host_keyboard_buttons[kb].menu_button] & 1);
// quit button
if (host_keyboard_buttons[kb].quit_button != -1)
setjoybuttonstate(kb, 15, keystate[host_keyboard_buttons[kb].quit_button] & 1);
setjoybuttonstate(kb, 15, key_state[host_keyboard_buttons[kb].quit_button] & 1);
// reset button
//setjoybuttonstate(kb, 30,keystate[host_keyboard_buttons[kb].reset_button] & 1) ;
}
}
// this is what we actually use on the Pi (for joysticks :)
else if (jsem_isjoy(joyid, &currprefs) != -1)
// this is what we actually use on the Pi (for joysticks :)
else if (jsem_isjoy(joy_id, &currprefs) != -1)
{
// Now we handle real SDL joystick...
const auto hostjoyid = currprefs.jports[joyid].id - JSEM_JOYS - num_keys_as_joys;
const auto host_joy_id = currprefs.jports[joy_id].id - JSEM_JOYS - num_keys_as_joys;
static struct host_input_button current_controller_map;
current_controller_map = host_input_buttons[hostjoyid];
current_controller_map = host_input_buttons[host_joy_id];
const auto joy_offset = num_keys_as_joys;
if (current_controller_map.east_button == current_controller_map.hotkey_button)
current_controller_map.east_button = -1;
if (current_controller_map.south_button == current_controller_map.hotkey_button)
current_controller_map.south_button = -1;
if (current_controller_map.north_button == current_controller_map.hotkey_button)
current_controller_map.north_button = -1;
if (current_controller_map.west_button == current_controller_map.hotkey_button)
current_controller_map.west_button = -1;
if (current_controller_map.dpad_left == current_controller_map.hotkey_button)
current_controller_map.dpad_left = -1;
if (current_controller_map.dpad_right == current_controller_map.hotkey_button)
current_controller_map.dpad_right = -1;
if (current_controller_map.dpad_up == current_controller_map.hotkey_button)
current_controller_map.dpad_up = -1;
if (current_controller_map.dpad_down == current_controller_map.hotkey_button)
current_controller_map.dpad_down = -1;
if (current_controller_map.select_button == current_controller_map.hotkey_button)
current_controller_map.select_button = -1;
if (current_controller_map.start_button == current_controller_map.hotkey_button)
current_controller_map.start_button = -1;
if (current_controller_map.left_trigger == current_controller_map.hotkey_button)
current_controller_map.left_trigger = -1;
if (current_controller_map.right_trigger == current_controller_map.hotkey_button)
current_controller_map.right_trigger = -1;
if (current_controller_map.lstick_button == current_controller_map.hotkey_button)
current_controller_map.lstick_button = -1;
if (current_controller_map.rstick_button == current_controller_map.hotkey_button)
current_controller_map.rstick_button = -1;
if (current_controller_map.left_shoulder == current_controller_map.hotkey_button)
current_controller_map.left_shoulder = -1;
if (current_controller_map.right_shoulder == current_controller_map.hotkey_button)
current_controller_map.right_shoulder = -1;
if (current_controller_map.hotkey_button != -1)
{
if (current_controller_map.east_button == current_controller_map.hotkey_button)
current_controller_map.east_button = -1;
if (current_controller_map.south_button == current_controller_map.hotkey_button)
current_controller_map.south_button = -1;
if (current_controller_map.north_button == current_controller_map.hotkey_button)
current_controller_map.north_button = -1;
if (current_controller_map.west_button == current_controller_map.hotkey_button)
current_controller_map.west_button = -1;
if (current_controller_map.dpad_left == current_controller_map.hotkey_button)
current_controller_map.dpad_left = -1;
if (current_controller_map.dpad_right == current_controller_map.hotkey_button)
current_controller_map.dpad_right = -1;
if (current_controller_map.dpad_up == current_controller_map.hotkey_button)
current_controller_map.dpad_up = -1;
if (current_controller_map.dpad_down == current_controller_map.hotkey_button)
current_controller_map.dpad_down = -1;
if (current_controller_map.select_button == current_controller_map.hotkey_button)
current_controller_map.select_button = -1;
if (current_controller_map.start_button == current_controller_map.hotkey_button)
current_controller_map.start_button = -1;
if (current_controller_map.left_trigger == current_controller_map.hotkey_button)
current_controller_map.left_trigger = -1;
if (current_controller_map.right_trigger == current_controller_map.hotkey_button)
current_controller_map.right_trigger = -1;
if (current_controller_map.lstick_button == current_controller_map.hotkey_button)
current_controller_map.lstick_button = -1;
if (current_controller_map.rstick_button == current_controller_map.hotkey_button)
current_controller_map.rstick_button = -1;
if (current_controller_map.left_shoulder == current_controller_map.hotkey_button)
current_controller_map.left_shoulder = -1;
if (current_controller_map.right_shoulder == current_controller_map.hotkey_button)
current_controller_map.right_shoulder = -1;
}
auto held_offset = 0;
@ -1214,54 +1216,54 @@ static void read_joystick()
{
if (current_controller_map.menu_button != -1)
{
setjoybuttonstate(hostjoyid + joy_offset, 14,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 14,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.menu_button) & 1);
}
if (current_controller_map.quit_button != -1)
{
setjoybuttonstate(hostjoyid + joy_offset, 15,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 15,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.quit_button) & 1);
}
if (current_controller_map.reset_button != -1)
{
setjoybuttonstate(hostjoyid + joy_offset, 30,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 30,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.reset_button) & 1);
}
}
// temporary solution for retroarch buttons inc. HOTKEY
else if (SDL_JoystickGetButton(joysticktable[hostjoyid], current_controller_map.hotkey_button) & 1)
// temporary solution for retroarch buttons inc. HOTKEY
else if (SDL_JoystickGetButton(joysticktable[host_joy_id], current_controller_map.hotkey_button) & 1)
{
held_offset = REMAP_BUTTONS;
setjoybuttonstate(hostjoyid + joy_offset, 14,
SDL_JoystickGetButton(joysticktable[hostjoyid], current_controller_map.menu_button) &
setjoybuttonstate(host_joy_id + joy_offset, 14,
SDL_JoystickGetButton(joysticktable[host_joy_id], current_controller_map.menu_button) &
1);
// menu button
setjoybuttonstate(hostjoyid + joy_offset, 15,
SDL_JoystickGetButton(joysticktable[hostjoyid], current_controller_map.quit_button) &
setjoybuttonstate(host_joy_id + joy_offset, 15,
SDL_JoystickGetButton(joysticktable[host_joy_id], current_controller_map.quit_button) &
1);
// quit button
setjoybuttonstate(hostjoyid + joy_offset, 30,
SDL_JoystickGetButton(joysticktable[hostjoyid], current_controller_map.reset_button) &
setjoybuttonstate(host_joy_id + joy_offset, 30,
SDL_JoystickGetButton(joysticktable[host_joy_id], current_controller_map.reset_button) &
1);
// reset button
}
// this *should* allow us to handle function buttons (l2/r2/select) <<< except there were issues this work, picking a fixed number!!
// these two cannot be used whilst we are limited to 32 buttons, since 'REMAP_BUTTONS' = 14
// else if (SDL_JoystickGetButton(joysticktable[hostjoyid], host_input_buttons[hostjoyid].left_trigger) & 1)
// held_offset = REMAP_BUTTONS * 2;
// else if (SDL_JoystickGetButton(joysticktable[hostjoyid], host_input_buttons[hostjoyid].right_trigger) & 1)
// held_offset = REMAP_BUTTONS * 3;
// this *should* allow us to handle function buttons (l2/r2/select) <<< except there were issues this work, picking a fixed number!!
// these two cannot be used whilst we are limited to 32 buttons, since 'REMAP_BUTTONS' = 14
// else if (SDL_JoystickGetButton(joysticktable[hostjoyid], host_input_buttons[hostjoyid].left_trigger) & 1)
// held_offset = REMAP_BUTTONS * 2;
// else if (SDL_JoystickGetButton(joysticktable[hostjoyid], host_input_buttons[hostjoyid].right_trigger) & 1)
// held_offset = REMAP_BUTTONS * 3;
else
{
held_offset = 0;
}
if (SDL_JoystickNumAxes(joysticktable[hostjoyid]) > 0)
if (SDL_JoystickNumAxes(joysticktable[host_joy_id]) > 0)
{
int val;
@ -1275,21 +1277,21 @@ static void read_joystick()
// handle the X axis (left stick)
if (current_controller_map.lstick_axis_x != -1)
{
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.lstick_axis_x);
val = SDL_JoystickGetAxis(joysticktable[host_joy_id], current_controller_map.lstick_axis_x);
if (current_controller_map.lstick_axis_x_invert != 0)
val = val * -1;
setjoystickstate(hostjoyid + joy_offset, 0, val, upper_bound);
setjoystickstate(host_joy_id + joy_offset, 0, val, upper_bound);
}
// handle the Y axis
if (current_controller_map.lstick_axis_y != -1)
{
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.lstick_axis_y);
val = SDL_JoystickGetAxis(joysticktable[host_joy_id], current_controller_map.lstick_axis_y);
if (current_controller_map.lstick_axis_y_invert != 0)
val = val * -1;
setjoystickstate(hostjoyid + joy_offset, 1, val, upper_bound);
setjoystickstate(host_joy_id + joy_offset, 1, val, upper_bound);
}
}
else
@ -1298,14 +1300,14 @@ static void read_joystick()
// handle the Y axis (left stick)
if (current_controller_map.lstick_axis_y != -1)
{
setjoybuttonstate(hostjoyid + joy_offset, 7 + held_offset,
SDL_JoystickGetAxis(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 7 + held_offset,
SDL_JoystickGetAxis(joysticktable[host_joy_id],
current_controller_map.lstick_axis_y) <=
lower_bound
? 1
: 0);
setjoybuttonstate(hostjoyid + joy_offset, 8 + held_offset,
SDL_JoystickGetAxis(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 8 + held_offset,
SDL_JoystickGetAxis(joysticktable[host_joy_id],
current_controller_map.lstick_axis_y) >=
upper_bound
? 1
@ -1314,14 +1316,14 @@ static void read_joystick()
// handle the X axis
if (current_controller_map.lstick_axis_x != -1)
{
setjoybuttonstate(hostjoyid + joy_offset, 9 + held_offset,
SDL_JoystickGetAxis(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 9 + held_offset,
SDL_JoystickGetAxis(joysticktable[host_joy_id],
current_controller_map.lstick_axis_x) <=
lower_bound
? 1
: 0);
setjoybuttonstate(hostjoyid + joy_offset, 10 + held_offset,
SDL_JoystickGetAxis(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 10 + held_offset,
SDL_JoystickGetAxis(joysticktable[host_joy_id],
current_controller_map.lstick_axis_x) >=
upper_bound
? 1
@ -1332,87 +1334,87 @@ static void read_joystick()
// right stick
if (current_controller_map.rstick_axis_x != -1)
{
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.rstick_axis_x);
val = SDL_JoystickGetAxis(joysticktable[host_joy_id], current_controller_map.rstick_axis_x);
if (current_controller_map.rstick_axis_x_invert != 0)
val = val * -1;
setjoystickstate(hostjoyid + joy_offset, 2, val, upper_bound);
setjoystickstate(host_joy_id + joy_offset, 2, val, upper_bound);
}
if (current_controller_map.rstick_axis_y != -1)
{
val = SDL_JoystickGetAxis(joysticktable[hostjoyid], current_controller_map.rstick_axis_y);
val = SDL_JoystickGetAxis(joysticktable[host_joy_id], current_controller_map.rstick_axis_y);
if (current_controller_map.rstick_axis_y_invert != 0)
val = val * -1;
setjoystickstate(hostjoyid + joy_offset, 3, val, upper_bound);
setjoystickstate(host_joy_id + joy_offset, 3, val, upper_bound);
}
}
// cd32 red, blue, green, yellow
// south
if (current_controller_map.south_button != -1)
setjoybuttonstate(hostjoyid + joy_offset, 0 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 0 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.south_button) & 1);
// east
if (current_controller_map.east_button != -1)
setjoybuttonstate(hostjoyid + joy_offset, 1 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 1 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.east_button) & 1);
// west
if (current_controller_map.west_button != -1)
setjoybuttonstate(hostjoyid + joy_offset, 2 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 2 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.west_button) & 1);
// north
if (current_controller_map.north_button != -1)
setjoybuttonstate(hostjoyid + joy_offset, 3 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 3 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.north_button) & 1);
// cd32 rwd, ffw, start
// left shoulder
if (current_controller_map.left_shoulder != -1)
setjoybuttonstate(hostjoyid + joy_offset, 4 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 4 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.left_shoulder) & 1);
// right shoulder
if (current_controller_map.right_shoulder != -1)
setjoybuttonstate(hostjoyid + joy_offset, 5 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 5 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.right_shoulder) &
1);
// start
if (current_controller_map.start_button != -1)
setjoybuttonstate(hostjoyid + joy_offset, 6 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 6 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.start_button) & 1);
// up down left right
// HAT Handling *or* D-PAD buttons
const int hat = SDL_JoystickGetHat(joysticktable[hostjoyid], 0);
const int hat = SDL_JoystickGetHat(joysticktable[host_joy_id], 0);
setjoybuttonstate(hostjoyid + joy_offset, 7 + held_offset, current_controller_map.dpad_up + 1
setjoybuttonstate(host_joy_id + joy_offset, 7 + held_offset, current_controller_map.dpad_up + 1
? SDL_JoystickGetButton(
joysticktable[hostjoyid],
joysticktable[host_joy_id],
current_controller_map.dpad_up) &
1
: hat & SDL_HAT_UP);
setjoybuttonstate(hostjoyid + joy_offset, 8 + held_offset, current_controller_map.dpad_down + 1
setjoybuttonstate(host_joy_id + joy_offset, 8 + held_offset, current_controller_map.dpad_down + 1
? SDL_JoystickGetButton(
joysticktable[hostjoyid],
joysticktable[host_joy_id],
current_controller_map.dpad_down)
& 1
: hat & SDL_HAT_DOWN);
setjoybuttonstate(hostjoyid + joy_offset, 9 + held_offset, current_controller_map.dpad_left + 1
setjoybuttonstate(host_joy_id + joy_offset, 9 + held_offset, current_controller_map.dpad_left + 1
? SDL_JoystickGetButton(
joysticktable[hostjoyid],
joysticktable[host_joy_id],
current_controller_map.dpad_left)
& 1
: hat & SDL_HAT_LEFT);
setjoybuttonstate(hostjoyid + joy_offset, 10 + held_offset, current_controller_map.dpad_right + 1
setjoybuttonstate(host_joy_id + joy_offset, 10 + held_offset, current_controller_map.dpad_right + 1
? SDL_JoystickGetButton(
joysticktable[hostjoyid],
joysticktable[host_joy_id],
current_controller_map.
dpad_right) & 1
: hat & SDL_HAT_RIGHT);
@ -1420,19 +1422,19 @@ static void read_joystick()
// stick left/right/select
// left stick
if (current_controller_map.lstick_button != -1)
setjoybuttonstate(hostjoyid + joy_offset, 11 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 11 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.lstick_button) & 1);
// right stick
if (current_controller_map.rstick_button != -1)
setjoybuttonstate(hostjoyid + joy_offset, 12 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + joy_offset, 12 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.rstick_button) & 1);
// select button
if (current_controller_map.select_button != -1)
setjoybuttonstate(hostjoyid + 1, 13 + held_offset,
SDL_JoystickGetButton(joysticktable[hostjoyid],
setjoybuttonstate(host_joy_id + 1, 13 + held_offset,
SDL_JoystickGetButton(joysticktable[host_joy_id],
current_controller_map.select_button) & 1);
}
}
@ -1756,14 +1758,14 @@ bool key_used_by_retroarch_joy(int scancode)
if (amiberry_options.input_keyboard_as_joystick_stop_keypresses)
{
//currprefs.jports[port]
for (auto joyid = 0; joyid < MAX_JPORTS && !key_used; joyid++)
for (auto joy_id = 0; joy_id < MAX_JPORTS && !key_used; joy_id++)
{
// First handle retroarch (or default) keys as Joystick...
if (currprefs.jports[joyid].id >= JSEM_JOYS && currprefs.jports[joyid].id < JSEM_JOYS +
if (currprefs.jports[joy_id].id >= JSEM_JOYS && currprefs.jports[joy_id].id < JSEM_JOYS +
num_keys_as_joys)
{
const auto hostkeyid = currprefs.jports[joyid].id - JSEM_JOYS;
auto kb = hostkeyid;
const auto host_key_id = currprefs.jports[joy_id].id - JSEM_JOYS;
const auto kb = host_key_id;
key_used = host_keyboard_buttons[kb].south_button == scancode
|| host_keyboard_buttons[kb].east_button == scancode
|| host_keyboard_buttons[kb].north_button == scancode

View file

@ -295,9 +295,9 @@ void cd_auto_prefs(struct uae_prefs* prefs, char* filepath)
// *** GAME DETECTION ***
write_log("\nCD Autoload: %s \n\n", filepath);
extractFileName(filepath, last_loaded_config);
extractFileName(filepath, game_name);
removeFileExtension(game_name);
extract_filename(filepath, last_loaded_config);
extract_filename(filepath, game_name);
remove_file_extension(game_name);
// LOAD GAME SPECIFICS FOR EXISTING .UAE - USE SHA1 IF AVAILABLE
// CONFIG LOAD IF .UAE IS IN CONFIG PATH
@ -456,9 +456,9 @@ void whdload_auto_prefs(struct uae_prefs* prefs, char* filepath)
// REMOVE THE FILE PATH AND EXTENSION
const auto* const filename = my_getfilepart(filepath);
// 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);
extract_filename(filepath, last_loaded_config);
extract_filename(filepath, game_name);
remove_file_extension(game_name);
// LOAD GAME SPECIFICS FOR EXISTING .UAE - USE SHA1 IF AVAILABLE
// CONFIG LOAD IF .UAE IS IN CONFIG PATH

View file

@ -621,7 +621,7 @@ bool EditFilesysHardfile(const int unit_no)
{
};
const auto bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
extractPath(const_cast<char *>(txtPath->getText().c_str()), currentDir);
extract_path(const_cast<char *>(txtPath->getText().c_str()), currentDir);
uci_set_defaults(&ci, false);
strncpy(ci.devname, const_cast<char *>(txtDevice->getText().c_str()), MAX_DPATH);

View file

@ -434,7 +434,7 @@ bool EditFilesysVirtual(const int unit_no)
{
struct uaedev_config_info ci{};
const auto bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
extractPath(const_cast<char *>(txtPath->getText().c_str()), currentDir);
extract_path(const_cast<char *>(txtPath->getText().c_str()), currentDir);
uci_set_defaults(&ci, true);
strncpy(ci.devname, const_cast<char *>(txtDevice->getText().c_str()), MAX_DPATH);

View file

@ -51,8 +51,8 @@ bool LoadConfigByName(const char* name)
void SetLastActiveConfig(const char* filename)
{
extractFileName(filename, last_active_config);
removeFileExtension(last_active_config);
extract_filename(filename, last_active_config);
remove_file_extension(last_active_config);
}
class ConfigsListModel : public gcn::ListModel
@ -288,7 +288,7 @@ void InitPanelConfig(const struct _ConfigCategory& category)
else
{
strcpy(last_active_config, last_loaded_config);
removeFileExtension(last_active_config);
remove_file_extension(last_active_config);
}
}
txtName->setText(last_active_config);

View file

@ -199,13 +199,13 @@ public:
strncpy(changed_prefs.floppyslots[i].df, tmp, MAX_DPATH);
disk_insert(i, tmp);
AddFileToDiskList(tmp, 1);
extractPath(tmp, currentDir);
extract_path(tmp, currentDir);
if (i == 0 && chkLoadConfig->isSelected())
{
// Search for config of disk
extractFileName(changed_prefs.floppyslots[i].df, tmp);
removeFileExtension(tmp);
extract_filename(changed_prefs.floppyslots[i].df, tmp);
remove_file_extension(tmp);
LoadConfigByName(tmp);
}
AdjustDropDownControls();
@ -261,8 +261,8 @@ public:
// Search for config of disk
char tmp[MAX_DPATH];
extractFileName(changed_prefs.floppyslots[i].df, tmp);
removeFileExtension(tmp);
extract_filename(changed_prefs.floppyslots[i].df, tmp);
remove_file_extension(tmp);
LoadConfigByName(tmp);
}
}
@ -304,8 +304,8 @@ public:
char filename[MAX_DPATH];
char diskname[MAX_DPATH];
extractFileName(changed_prefs.floppyslots[0].df, diskname);
removeFileExtension(diskname);
extract_filename(changed_prefs.floppyslots[0].df, diskname);
remove_file_extension(diskname);
get_configuration_path(filename, MAX_DPATH);
strncat(filename, diskname, MAX_DPATH - 1);
@ -334,12 +334,12 @@ public:
strncpy(tmp, currentDir, MAX_DPATH);
if (SelectFile("Create 3.5'' DD disk file", tmp, diskfile_filter, true))
{
extractFileName(tmp, diskname);
removeFileExtension(diskname);
extract_filename(tmp, diskname);
remove_file_extension(diskname);
diskname[31] = '\0';
disk_creatediskfile(&changed_prefs, tmp, 0, DRV_35_DD, -1, diskname, false, false, nullptr);
AddFileToDiskList(tmp, 1);
extractPath(tmp, currentDir);
extract_path(tmp, currentDir);
}
cmdCreateDDDisk->requestFocus();
}
@ -351,12 +351,12 @@ public:
strcpy(tmp, currentDir);
if (SelectFile("Create 3.5'' HD disk file", tmp, diskfile_filter, true))
{
extractFileName(tmp, diskname);
removeFileExtension(diskname);
extract_filename(tmp, diskname);
remove_file_extension(diskname);
diskname[31] = '\0';
disk_creatediskfile(&changed_prefs, tmp, 0, DRV_35_HD, -1, diskname, false, false, nullptr);
AddFileToDiskList(tmp, 1);
extractPath(tmp, currentDir);
extract_path(tmp, currentDir);
}
cmdCreateHDDisk->requestFocus();
}

View file

@ -259,7 +259,7 @@ public:
changed_prefs.cdslots[0].inuse = true;
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
AddFileToCDList(tmp, 1);
extractPath(tmp, currentDir);
extract_path(tmp, currentDir);
AdjustDropDownControls();
}

View file

@ -384,7 +384,7 @@ public:
changed_prefs.cdslots[0].inuse = true;
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
AddFileToCDList(tmp, 1);
extractPath(tmp, currentDir);
extract_path(tmp, currentDir);
AdjustDropDownControls();
}
@ -669,7 +669,7 @@ public:
strncpy(changed_prefs.floppyslots[i].df, tmp, MAX_DPATH);
disk_insert(i, tmp);
AddFileToDiskList(tmp, 1);
extractPath(tmp, currentDir);
extract_path(tmp, currentDir);
AdjustDropDownControls();
}

View file

@ -167,8 +167,8 @@ public:
if (SelectFile("Select System ROM", tmp, filter))
{
const auto newrom = new AvailableROM();
extractFileName(tmp, newrom->Name);
removeFileExtension(newrom->Name);
extract_filename(tmp, newrom->Name);
remove_file_extension(newrom->Name);
strncpy(newrom->Path, tmp, MAX_DPATH - 1);
newrom->ROMType = ROMTYPE_KICK;
lstAvailableROMs.push_back(newrom);
@ -183,8 +183,8 @@ public:
if (SelectFile("Select Extended ROM", tmp, filter))
{
const auto newrom = new AvailableROM();
extractFileName(tmp, newrom->Name);
removeFileExtension(newrom->Name);
extract_filename(tmp, newrom->Name);
remove_file_extension(newrom->Name);
strncpy(newrom->Path, tmp, MAX_DPATH - 1);
newrom->ROMType = ROMTYPE_EXTCDTV;
lstAvailableROMs.push_back(newrom);
@ -199,8 +199,8 @@ public:
if (SelectFile("Select Cartridge ROM", tmp, filter))
{
const auto newrom = new AvailableROM();
extractFileName(tmp, newrom->Name);
removeFileExtension(newrom->Name);
extract_filename(tmp, newrom->Name);
remove_file_extension(newrom->Name);
strncpy(newrom->Path, tmp, MAX_DPATH - 1);
newrom->ROMType = ROMTYPE_CD32CART;
lstAvailableROMs.push_back(newrom);
@ -347,8 +347,8 @@ void RefreshPanelROM()
{
// ROM file not in the list of known ROMs -- let's add it
auto newrom = new AvailableROM();
extractFileName(changed_prefs.romfile, newrom->Name);
removeFileExtension(newrom->Name);
extract_filename(changed_prefs.romfile, newrom->Name);
remove_file_extension(newrom->Name);
strncpy(newrom->Path, changed_prefs.romfile, MAX_DPATH - 1);
newrom->ROMType = ROMTYPE_KICK;
lstAvailableROMs.push_back(newrom);
@ -364,8 +364,8 @@ void RefreshPanelROM()
{
// ROM file not in the list of known ROMs
auto newrom = new AvailableROM();
extractFileName(changed_prefs.romextfile, newrom->Name);
removeFileExtension(newrom->Name);
extract_filename(changed_prefs.romextfile, newrom->Name);
remove_file_extension(newrom->Name);
strncpy(newrom->Path, changed_prefs.romextfile, MAX_DPATH - 1);
newrom->ROMType = ROMTYPE_EXTCDTV;
lstAvailableROMs.push_back(newrom);

View file

@ -72,7 +72,7 @@ public:
void changeDir(const char* path)
{
ReadDirectory(path, &dirs, &files);
read_directory(path, &dirs, &files);
if (dirs.empty())
dirs.emplace_back("..");
FilterFiles(&files, filefilter);
@ -146,7 +146,7 @@ static void checkfoldername(char* current)
static void checkfilename(char* current)
{
char actfile[MAX_DPATH];
extractFileName(current, actfile);
extract_filename(current, actfile);
for (auto i = 0; i < fileList->getNumberOfElements(); ++i)
{
if (!fileList->isDir(i) && !stricmp(fileList->getElementAt(i).c_str(), actfile))
@ -498,7 +498,7 @@ bool SelectFile(const char* title, char* value, const char* filter[], const bool
InitSelectFile(title);
extractPath(value, workingDir);
extract_path(value, workingDir);
checkfoldername(workingDir);
checkfilename(value);

View file

@ -80,7 +80,7 @@ public:
void changeDir(const char* path)
{
ReadDirectory(path, &dirs, nullptr);
read_directory(path, &dirs, nullptr);
if (dirs.empty())
dirs.emplace_back("..");
}

View file

@ -161,7 +161,7 @@ void ShowHelp(const char* title, const std::vector<std::string>& text);
bool LoadConfigByName(const char* name);
ConfigFileInfo* SearchConfigInList(const char* name);
extern void ReadDirectory(const char* path, vector<string>* dirs, vector<string>* files);
extern void read_directory(const char* path, vector<string>* dirs, vector<string>* files);
extern void FilterFiles(vector<string>* files, const char* filter[]);
enum

View file

@ -81,9 +81,9 @@ extern void get_rp9_path(char* out, int size);
extern void get_savestate_path(char* out, int size);
extern void get_screenshot_path(char* out, int size);
extern void extractFileName(const char* str, char* buffer);
extern void extractPath(char* str, char* buffer);
extern void removeFileExtension(char* filename);
extern void extract_filename(const char* str, char* buffer);
extern void extract_path(char* str, char* buffer);
extern void remove_file_extension(char* filename);
extern void ReadConfigFileList(void);
extern void RescanROMs(void);
extern void SymlinkROMs(void);

View file

@ -222,9 +222,9 @@ static TCHAR *state_resolve_path(TCHAR *s, int type, bool newmode)
xfree(s);
return my_strdup(tmp);
}
getfilepart(tmp, sizeof tmp / sizeof(TCHAR), s);
get_file_part(tmp, sizeof tmp / sizeof(TCHAR), s);
} else {
getfilepart (tmp, sizeof tmp / sizeof (TCHAR), s);
get_file_part (tmp, sizeof tmp / sizeof (TCHAR), s);
if (state_path_exists(tmp, type)) {
xfree (s);
return my_strdup (tmp);
@ -241,14 +241,14 @@ static TCHAR *state_resolve_path(TCHAR *s, int type, bool newmode)
if (newpath == NULL || newpath[0] == 0)
break;
_tcscpy (tmp2, newpath);
fixtrailing (tmp2);
fix_trailing (tmp2);
_tcscat (tmp2, tmp);
if (state_path_exists(tmp2, type)) {
xfree (s);
return my_strdup (tmp2);
}
}
getpathpart (tmp2, sizeof tmp2 / sizeof (TCHAR), savestate_fname);
get_path_part (tmp2, sizeof tmp2 / sizeof (TCHAR), savestate_fname);
_tcscat (tmp2, tmp);
if (state_path_exists(tmp2, type)) {
xfree (s);