mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
Use limits.h and PATH_MAX.
This commit is contained in:
parent
d3af29fa1f
commit
c2ba0d474c
@ -27,17 +27,17 @@
|
|||||||
#include "../msvc/msvc_compat.h"
|
#include "../msvc/msvc_compat.h"
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__CELLOS_LV2__)
|
#if !defined(_WIN32) && !defined(__CELLOS_LV2__)
|
||||||
#include <sys/param.h> // MAXPATHLEN
|
#include <sys/param.h> // PATH_MAX
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAXPATHLEN
|
#ifndef PATH_MAX
|
||||||
#ifdef PATH_MAX
|
#ifdef PATH_MAX
|
||||||
#define MAXPATHLEN PATH_MAX
|
#define PATH_MAX PATH_MAX
|
||||||
#else
|
#else
|
||||||
#define MAXPATHLEN 512
|
#define PATH_MAX 512
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ static void add_sub_conf(config_file_t *conf, char *line)
|
|||||||
|
|
||||||
add_include_list(conf, path);
|
add_include_list(conf, path);
|
||||||
|
|
||||||
char real_path[MAXPATHLEN];
|
char real_path[PATH_MAX];
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Accomodate POSIX systems on Win32.
|
// Accomodate POSIX systems on Win32.
|
||||||
|
28
file.c
28
file.c
@ -376,9 +376,9 @@ static void dump_to_file_desperate(const void *data, size_t size, int type)
|
|||||||
if (!base)
|
if (!base)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
char path[MAXPATHLEN];
|
char path[PATH_MAX];
|
||||||
snprintf(path, sizeof(path), "%s/SSNES-recovery-", base);
|
snprintf(path, sizeof(path), "%s/SSNES-recovery-", base);
|
||||||
char timebuf[MAXPATHLEN];
|
char timebuf[PATH_MAX];
|
||||||
|
|
||||||
time_t time_;
|
time_t time_;
|
||||||
time(&time_);
|
time(&time_);
|
||||||
@ -838,8 +838,8 @@ char **dir_list_new(const char *dir, const char *ext)
|
|||||||
WIN32_FIND_DATAW ffd;
|
WIN32_FIND_DATAW ffd;
|
||||||
HANDLE hFind = INVALID_HANDLE_VALUE;
|
HANDLE hFind = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
wchar_t wchar_buf[MAXPATHLEN];
|
wchar_t wchar_buf[PATH_MAX];
|
||||||
char utf8_buf[MAXPATHLEN];
|
char utf8_buf[PATH_MAX];
|
||||||
|
|
||||||
if (strlcpy(utf8_buf, dir, sizeof(utf8_buf)) >= sizeof(utf8_buf))
|
if (strlcpy(utf8_buf, dir, sizeof(utf8_buf)) >= sizeof(utf8_buf))
|
||||||
goto error;
|
goto error;
|
||||||
@ -852,7 +852,7 @@ char **dir_list_new(const char *dir, const char *ext)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MultiByteToWideChar(CP_UTF8, 0, utf8_buf, -1, wchar_buf, MAXPATHLEN) == 0)
|
if (MultiByteToWideChar(CP_UTF8, 0, utf8_buf, -1, wchar_buf, PATH_MAX) == 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
hFind = FindFirstFileW(wchar_buf, &ffd);
|
hFind = FindFirstFileW(wchar_buf, &ffd);
|
||||||
@ -881,7 +881,7 @@ char **dir_list_new(const char *dir, const char *ext)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
continue;
|
continue;
|
||||||
if (WideCharToMultiByte(CP_UTF8, 0, ffd.cFileName, -1, utf8_buf, MAXPATHLEN, NULL, NULL) == 0)
|
if (WideCharToMultiByte(CP_UTF8, 0, ffd.cFileName, -1, utf8_buf, PATH_MAX, NULL, NULL) == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ext && !strstr(utf8_buf, ext))
|
if (ext && !strstr(utf8_buf, ext))
|
||||||
continue;
|
continue;
|
||||||
@ -890,16 +890,16 @@ char **dir_list_new(const char *dir, const char *ext)
|
|||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dir_list[cur_ptr] = (char*)malloc(MAXPATHLEN);
|
dir_list[cur_ptr] = (char*)malloc(PATH_MAX);
|
||||||
if (!dir_list[cur_ptr])
|
if (!dir_list[cur_ptr])
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
strlcpy(dir_list[cur_ptr], dir, MAXPATHLEN);
|
strlcpy(dir_list[cur_ptr], dir, PATH_MAX);
|
||||||
strlcat(dir_list[cur_ptr], "/", MAXPATHLEN);
|
strlcat(dir_list[cur_ptr], "/", PATH_MAX);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
strlcat(dir_list[cur_ptr], utf8_buf, MAXPATHLEN);
|
strlcat(dir_list[cur_ptr], utf8_buf, PATH_MAX);
|
||||||
#else
|
#else
|
||||||
strlcat(dir_list[cur_ptr], entry->d_name, MAXPATHLEN);
|
strlcat(dir_list[cur_ptr], entry->d_name, PATH_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
@ -952,8 +952,8 @@ void dir_list_free(char **dir_list)
|
|||||||
bool path_is_directory(const char *path)
|
bool path_is_directory(const char *path)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
wchar_t buf[MAXPATHLEN];
|
wchar_t buf[PATH_MAX];
|
||||||
if (MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, MAXPATHLEN) == 0)
|
if (MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, PATH_MAX) == 0)
|
||||||
return false;
|
return false;
|
||||||
return PathIsDirectoryW(buf) == FILE_ATTRIBUTE_DIRECTORY;
|
return PathIsDirectoryW(buf) == FILE_ATTRIBUTE_DIRECTORY;
|
||||||
#elif defined(__CELLOS_LV2__)
|
#elif defined(__CELLOS_LV2__)
|
||||||
@ -984,7 +984,7 @@ bool path_file_exists(const char *path)
|
|||||||
|
|
||||||
void fill_pathname(char *out_path, const char *in_path, const char *replace, size_t size)
|
void fill_pathname(char *out_path, const char *in_path, const char *replace, size_t size)
|
||||||
{
|
{
|
||||||
char tmp_path[MAXPATHLEN];
|
char tmp_path[PATH_MAX];
|
||||||
|
|
||||||
ssnes_assert(strlcpy(tmp_path, in_path, sizeof(tmp_path)) < sizeof(tmp_path));
|
ssnes_assert(strlcpy(tmp_path, in_path, sizeof(tmp_path)) < sizeof(tmp_path));
|
||||||
char *tok = strrchr(tmp_path, '.');
|
char *tok = strrchr(tmp_path, '.');
|
||||||
|
83
general.h
83
general.h
@ -22,6 +22,7 @@
|
|||||||
#include "boolean.h"
|
#include "boolean.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <limits.h>
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "record/ffemu.h"
|
#include "record/ffemu.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
@ -50,22 +51,12 @@
|
|||||||
|
|
||||||
#include "audio/hermite.h"
|
#include "audio/hermite.h"
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__CELLOS_LV2__)
|
#ifdef _WIN32
|
||||||
#include <sys/param.h> // MAXPATHLEN
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "msvc/msvc_compat.h"
|
#include "msvc/msvc_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAXPATHLEN
|
|
||||||
#ifdef PATH_MAX
|
|
||||||
#define MAXPATHLEN PATH_MAX
|
|
||||||
#else
|
|
||||||
#define MAXPATHLEN 512
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_PLAYERS 5
|
#define MAX_PLAYERS 5
|
||||||
#define MAX_BINDS (SSNES_BIND_LIST_END + 1)
|
#define MAX_BINDS (SSNES_BIND_LIST_END + 1)
|
||||||
#define SSNES_NO_JOYPAD 0xFFFF
|
#define SSNES_NO_JOYPAD 0xFFFF
|
||||||
@ -94,20 +85,20 @@ struct settings
|
|||||||
bool force_aspect;
|
bool force_aspect;
|
||||||
bool crop_overscan;
|
bool crop_overscan;
|
||||||
float aspect_ratio;
|
float aspect_ratio;
|
||||||
char cg_shader_path[MAXPATHLEN];
|
char cg_shader_path[PATH_MAX];
|
||||||
char bsnes_shader_path[MAXPATHLEN];
|
char bsnes_shader_path[PATH_MAX];
|
||||||
char filter_path[MAXPATHLEN];
|
char filter_path[PATH_MAX];
|
||||||
enum ssnes_shader_type shader_type;
|
enum ssnes_shader_type shader_type;
|
||||||
float refresh_rate;
|
float refresh_rate;
|
||||||
|
|
||||||
bool render_to_texture;
|
bool render_to_texture;
|
||||||
double fbo_scale_x;
|
double fbo_scale_x;
|
||||||
double fbo_scale_y;
|
double fbo_scale_y;
|
||||||
char second_pass_shader[MAXPATHLEN];
|
char second_pass_shader[PATH_MAX];
|
||||||
bool second_pass_smooth;
|
bool second_pass_smooth;
|
||||||
char shader_dir[MAXPATHLEN];
|
char shader_dir[PATH_MAX];
|
||||||
|
|
||||||
char font_path[MAXPATHLEN];
|
char font_path[PATH_MAX];
|
||||||
unsigned font_size;
|
unsigned font_size;
|
||||||
bool font_enable;
|
bool font_enable;
|
||||||
float msg_pos_x;
|
float msg_pos_x;
|
||||||
@ -122,7 +113,7 @@ struct settings
|
|||||||
bool hires_record;
|
bool hires_record;
|
||||||
bool post_filter_record;
|
bool post_filter_record;
|
||||||
|
|
||||||
char external_driver[MAXPATHLEN];
|
char external_driver[PATH_MAX];
|
||||||
} video;
|
} video;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@ -132,12 +123,12 @@ struct settings
|
|||||||
unsigned out_rate;
|
unsigned out_rate;
|
||||||
float in_rate;
|
float in_rate;
|
||||||
float rate_step;
|
float rate_step;
|
||||||
char device[MAXPATHLEN];
|
char device[PATH_MAX];
|
||||||
unsigned latency;
|
unsigned latency;
|
||||||
bool sync;
|
bool sync;
|
||||||
|
|
||||||
char dsp_plugin[MAXPATHLEN];
|
char dsp_plugin[PATH_MAX];
|
||||||
char external_driver[MAXPATHLEN];
|
char external_driver[PATH_MAX];
|
||||||
} audio;
|
} audio;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@ -149,11 +140,11 @@ struct settings
|
|||||||
bool netplay_client_swap_input;
|
bool netplay_client_swap_input;
|
||||||
} input;
|
} input;
|
||||||
|
|
||||||
char libsnes[MAXPATHLEN];
|
char libsnes[PATH_MAX];
|
||||||
char cheat_database[MAXPATHLEN];
|
char cheat_database[PATH_MAX];
|
||||||
char cheat_settings_path[MAXPATHLEN];
|
char cheat_settings_path[PATH_MAX];
|
||||||
|
|
||||||
char screenshot_directory[MAXPATHLEN];
|
char screenshot_directory[PATH_MAX];
|
||||||
|
|
||||||
bool rewind_enable;
|
bool rewind_enable;
|
||||||
size_t rewind_buffer_size;
|
size_t rewind_buffer_size;
|
||||||
@ -195,29 +186,29 @@ struct global
|
|||||||
enum ssnes_game_type game_type;
|
enum ssnes_game_type game_type;
|
||||||
uint32_t cart_crc;
|
uint32_t cart_crc;
|
||||||
|
|
||||||
char gb_rom_path[MAXPATHLEN];
|
char gb_rom_path[PATH_MAX];
|
||||||
char bsx_rom_path[MAXPATHLEN];
|
char bsx_rom_path[PATH_MAX];
|
||||||
char sufami_rom_path[2][MAXPATHLEN];
|
char sufami_rom_path[2][PATH_MAX];
|
||||||
bool has_set_save_path;
|
bool has_set_save_path;
|
||||||
bool has_set_state_path;
|
bool has_set_state_path;
|
||||||
|
|
||||||
#ifdef HAVE_CONFIGFILE
|
#ifdef HAVE_CONFIGFILE
|
||||||
char config_path[MAXPATHLEN];
|
char config_path[PATH_MAX];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char basename[MAXPATHLEN];
|
char basename[PATH_MAX];
|
||||||
char savefile_name_srm[MAXPATHLEN];
|
char savefile_name_srm[PATH_MAX];
|
||||||
char savefile_name_rtc[MAXPATHLEN]; // Make sure that fill_pathname has space.
|
char savefile_name_rtc[PATH_MAX]; // Make sure that fill_pathname has space.
|
||||||
char savefile_name_psrm[MAXPATHLEN];
|
char savefile_name_psrm[PATH_MAX];
|
||||||
char savefile_name_asrm[MAXPATHLEN];
|
char savefile_name_asrm[PATH_MAX];
|
||||||
char savefile_name_bsrm[MAXPATHLEN];
|
char savefile_name_bsrm[PATH_MAX];
|
||||||
char savestate_name[MAXPATHLEN];
|
char savestate_name[PATH_MAX];
|
||||||
char xml_name[MAXPATHLEN];
|
char xml_name[PATH_MAX];
|
||||||
|
|
||||||
bool ups_pref;
|
bool ups_pref;
|
||||||
bool bps_pref;
|
bool bps_pref;
|
||||||
char ups_name[MAXPATHLEN];
|
char ups_name[PATH_MAX];
|
||||||
char bps_name[MAXPATHLEN];
|
char bps_name[PATH_MAX];
|
||||||
|
|
||||||
unsigned state_slot;
|
unsigned state_slot;
|
||||||
|
|
||||||
@ -225,7 +216,7 @@ struct global
|
|||||||
{
|
{
|
||||||
struct snes_geometry geom;
|
struct snes_geometry geom;
|
||||||
unsigned pitch; // If 0, has classic libsnes semantics.
|
unsigned pitch; // If 0, has classic libsnes semantics.
|
||||||
char fullpath[MAXPATHLEN];
|
char fullpath[PATH_MAX];
|
||||||
struct snes_system_timing timing;
|
struct snes_system_timing timing;
|
||||||
bool timing_set;
|
bool timing_set;
|
||||||
bool need_fullpath;
|
bool need_fullpath;
|
||||||
@ -283,11 +274,11 @@ struct global
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bsv_movie_t *movie;
|
bsv_movie_t *movie;
|
||||||
char movie_path[MAXPATHLEN];
|
char movie_path[PATH_MAX];
|
||||||
bool movie_playback;
|
bool movie_playback;
|
||||||
|
|
||||||
// Immediate playback/recording.
|
// Immediate playback/recording.
|
||||||
char movie_start_path[MAXPATHLEN];
|
char movie_start_path[PATH_MAX];
|
||||||
bool movie_start_recording;
|
bool movie_start_recording;
|
||||||
bool movie_start_playback;
|
bool movie_start_playback;
|
||||||
bool movie_end;
|
bool movie_end;
|
||||||
@ -306,7 +297,7 @@ struct global
|
|||||||
// Netplay.
|
// Netplay.
|
||||||
#ifdef HAVE_NETPLAY
|
#ifdef HAVE_NETPLAY
|
||||||
netplay_t *netplay;
|
netplay_t *netplay;
|
||||||
char netplay_server[MAXPATHLEN];
|
char netplay_server[PATH_MAX];
|
||||||
bool netplay_enable;
|
bool netplay_enable;
|
||||||
bool netplay_is_client;
|
bool netplay_is_client;
|
||||||
unsigned netplay_sync_frames;
|
unsigned netplay_sync_frames;
|
||||||
@ -316,7 +307,7 @@ struct global
|
|||||||
// FFmpeg record.
|
// FFmpeg record.
|
||||||
#ifdef HAVE_FFMPEG
|
#ifdef HAVE_FFMPEG
|
||||||
ffemu_t *rec;
|
ffemu_t *rec;
|
||||||
char record_path[MAXPATHLEN];
|
char record_path[PATH_MAX];
|
||||||
bool recording;
|
bool recording;
|
||||||
unsigned record_width;
|
unsigned record_width;
|
||||||
unsigned record_height;
|
unsigned record_height;
|
||||||
@ -400,6 +391,10 @@ static inline uint8_t is_little_endian(void)
|
|||||||
return u.y[0];
|
return u.y[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GEKKO
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void ssnes_sleep(unsigned msec)
|
static inline void ssnes_sleep(unsigned msec)
|
||||||
{
|
{
|
||||||
#ifdef __CELLOS_LV2__
|
#ifdef __CELLOS_LV2__
|
||||||
|
@ -690,7 +690,7 @@ static bool load_preset(const char *path)
|
|||||||
|
|
||||||
int shaders;
|
int shaders;
|
||||||
// Basedir.
|
// Basedir.
|
||||||
char dir_path[MAXPATHLEN];
|
char dir_path[PATH_MAX];
|
||||||
char *ptr = NULL;
|
char *ptr = NULL;
|
||||||
|
|
||||||
SSNES_LOG("Loading Cg meta-shader: %s\n", path);
|
SSNES_LOG("Loading Cg meta-shader: %s\n", path);
|
||||||
@ -874,7 +874,7 @@ static bool load_preset(const char *path)
|
|||||||
{
|
{
|
||||||
char *shader_path;
|
char *shader_path;
|
||||||
char attr_buf[64];
|
char attr_buf[64];
|
||||||
char path_buf[MAXPATHLEN];
|
char path_buf[PATH_MAX];
|
||||||
|
|
||||||
print_buf(attr_buf, "shader%u", i);
|
print_buf(attr_buf, "shader%u", i);
|
||||||
if (config_get_string(conf, attr_buf, &shader_path))
|
if (config_get_string(conf, attr_buf, &shader_path))
|
||||||
|
@ -122,7 +122,7 @@ static char gl_teximage_uniforms[MAX_TEXTURES][64];
|
|||||||
static snes_tracker_t *gl_snes_tracker = NULL;
|
static snes_tracker_t *gl_snes_tracker = NULL;
|
||||||
static struct snes_tracker_uniform_info gl_tracker_info[MAX_VARIABLES];
|
static struct snes_tracker_uniform_info gl_tracker_info[MAX_VARIABLES];
|
||||||
static unsigned gl_tracker_info_cnt = 0;
|
static unsigned gl_tracker_info_cnt = 0;
|
||||||
static char gl_tracker_script[MAXPATHLEN];
|
static char gl_tracker_script[PATH_MAX];
|
||||||
static char gl_tracker_script_class[64];
|
static char gl_tracker_script_class[64];
|
||||||
static xmlChar *gl_script_program = NULL;
|
static xmlChar *gl_script_program = NULL;
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
|
|||||||
if (filter && strcmp((const char*)filter, "nearest") == 0)
|
if (filter && strcmp((const char*)filter, "nearest") == 0)
|
||||||
linear = false;
|
linear = false;
|
||||||
|
|
||||||
char tex_path[MAXPATHLEN];
|
char tex_path[PATH_MAX];
|
||||||
strlcpy(tex_path, shader_path, sizeof(tex_path));
|
strlcpy(tex_path, shader_path, sizeof(tex_path));
|
||||||
|
|
||||||
last = strrchr(tex_path, '/');
|
last = strrchr(tex_path, '/');
|
||||||
|
10
settings.c
10
settings.c
@ -233,7 +233,7 @@ static config_file_t *open_default_config_file(void)
|
|||||||
const char *appdata = getenv("APPDATA");
|
const char *appdata = getenv("APPDATA");
|
||||||
if (appdata)
|
if (appdata)
|
||||||
{
|
{
|
||||||
char conf_path[MAXPATHLEN];
|
char conf_path[PATH_MAX];
|
||||||
strlcpy(conf_path, appdata, sizeof(conf_path));
|
strlcpy(conf_path, appdata, sizeof(conf_path));
|
||||||
strlcat(conf_path, "/ssnes.cfg", sizeof(conf_path));
|
strlcat(conf_path, "/ssnes.cfg", sizeof(conf_path));
|
||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
@ -243,7 +243,7 @@ static config_file_t *open_default_config_file(void)
|
|||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
if (home)
|
if (home)
|
||||||
{
|
{
|
||||||
char conf_path[MAXPATHLEN];
|
char conf_path[PATH_MAX];
|
||||||
strlcpy(conf_path, home, sizeof(conf_path));
|
strlcpy(conf_path, home, sizeof(conf_path));
|
||||||
strlcat(conf_path, "/.ssnes.cfg", sizeof(conf_path));
|
strlcat(conf_path, "/.ssnes.cfg", sizeof(conf_path));
|
||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
@ -260,14 +260,14 @@ static config_file_t *open_default_config_file(void)
|
|||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
if (xdg)
|
if (xdg)
|
||||||
{
|
{
|
||||||
char conf_path[MAXPATHLEN];
|
char conf_path[PATH_MAX];
|
||||||
strlcpy(conf_path, xdg, sizeof(conf_path));
|
strlcpy(conf_path, xdg, sizeof(conf_path));
|
||||||
strlcat(conf_path, "/ssnes/ssnes.cfg", sizeof(conf_path));
|
strlcat(conf_path, "/ssnes/ssnes.cfg", sizeof(conf_path));
|
||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
}
|
}
|
||||||
else if (home)
|
else if (home)
|
||||||
{
|
{
|
||||||
char conf_path[MAXPATHLEN];
|
char conf_path[PATH_MAX];
|
||||||
strlcpy(conf_path, home, sizeof(conf_path));
|
strlcpy(conf_path, home, sizeof(conf_path));
|
||||||
strlcat(conf_path, "/.ssnes.cfg", sizeof(conf_path));
|
strlcat(conf_path, "/.ssnes.cfg", sizeof(conf_path));
|
||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
@ -324,7 +324,7 @@ static void parse_config_file(void)
|
|||||||
int tmp_int;
|
int tmp_int;
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
bool tmp_bool;
|
bool tmp_bool;
|
||||||
char tmp_str[MAXPATHLEN];
|
char tmp_str[PATH_MAX];
|
||||||
|
|
||||||
CONFIG_GET_DOUBLE(video.xscale, "video_xscale");
|
CONFIG_GET_DOUBLE(video.xscale, "video_xscale");
|
||||||
CONFIG_GET_DOUBLE(video.yscale, "video_yscale");
|
CONFIG_GET_DOUBLE(video.yscale, "video_yscale");
|
||||||
|
13
ssnes.c
13
ssnes.c
@ -22,7 +22,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
@ -1153,7 +1152,7 @@ static void init_movie(void)
|
|||||||
}
|
}
|
||||||
else if (g_extern.bsv.movie_start_recording)
|
else if (g_extern.bsv.movie_start_recording)
|
||||||
{
|
{
|
||||||
char msg[MAXPATHLEN];
|
char msg[PATH_MAX];
|
||||||
snprintf(msg, sizeof(msg), "Starting movie record to \"%s\"!",
|
snprintf(msg, sizeof(msg), "Starting movie record to \"%s\"!",
|
||||||
g_extern.bsv.movie_start_path);
|
g_extern.bsv.movie_start_path);
|
||||||
|
|
||||||
@ -1297,7 +1296,7 @@ static void set_savestate_auto_index(void)
|
|||||||
if (!g_settings.savestate_auto_index)
|
if (!g_settings.savestate_auto_index)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char state_path[MAXPATHLEN];
|
char state_path[PATH_MAX];
|
||||||
strlcpy(state_path, g_extern.savestate_name, sizeof(state_path));
|
strlcpy(state_path, g_extern.savestate_name, sizeof(state_path));
|
||||||
|
|
||||||
char *split = strrchr(state_path, '/');
|
char *split = strrchr(state_path, '/');
|
||||||
@ -1408,7 +1407,7 @@ static void check_savestates(void)
|
|||||||
if (g_settings.savestate_auto_index)
|
if (g_settings.savestate_auto_index)
|
||||||
g_extern.state_slot++;
|
g_extern.state_slot++;
|
||||||
|
|
||||||
char save_path[MAXPATHLEN];
|
char save_path[PATH_MAX];
|
||||||
|
|
||||||
if (g_extern.state_slot > 0)
|
if (g_extern.state_slot > 0)
|
||||||
snprintf(save_path, sizeof(save_path), "%s%u", g_extern.savestate_name, g_extern.state_slot);
|
snprintf(save_path, sizeof(save_path), "%s%u", g_extern.savestate_name, g_extern.state_slot);
|
||||||
@ -1434,7 +1433,7 @@ static void check_savestates(void)
|
|||||||
bool should_loadstate = driver.input->key_pressed(driver.input_data, SSNES_LOAD_STATE_KEY);
|
bool should_loadstate = driver.input->key_pressed(driver.input_data, SSNES_LOAD_STATE_KEY);
|
||||||
if (!should_savestate && should_loadstate && !old_should_loadstate)
|
if (!should_savestate && should_loadstate && !old_should_loadstate)
|
||||||
{
|
{
|
||||||
char load_path[MAXPATHLEN];
|
char load_path[PATH_MAX];
|
||||||
|
|
||||||
if (g_extern.state_slot > 0)
|
if (g_extern.state_slot > 0)
|
||||||
snprintf(load_path, sizeof(load_path), "%s%u", g_extern.savestate_name, g_extern.state_slot);
|
snprintf(load_path, sizeof(load_path), "%s%u", g_extern.savestate_name, g_extern.state_slot);
|
||||||
@ -1627,7 +1626,7 @@ static void check_movie_record(void)
|
|||||||
{
|
{
|
||||||
g_settings.rewind_granularity = 1;
|
g_settings.rewind_granularity = 1;
|
||||||
|
|
||||||
char path[MAXPATHLEN];
|
char path[PATH_MAX];
|
||||||
if (g_extern.state_slot > 0)
|
if (g_extern.state_slot > 0)
|
||||||
{
|
{
|
||||||
snprintf(path, sizeof(path), "%s%u.bsv",
|
snprintf(path, sizeof(path), "%s%u.bsv",
|
||||||
@ -1639,7 +1638,7 @@ static void check_movie_record(void)
|
|||||||
g_extern.bsv.movie_path);
|
g_extern.bsv.movie_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
char msg[MAXPATHLEN];
|
char msg[PATH_MAX];
|
||||||
snprintf(msg, sizeof(msg), "Starting movie record to \"%s\"!", path);
|
snprintf(msg, sizeof(msg), "Starting movie record to \"%s\"!", path);
|
||||||
|
|
||||||
g_extern.bsv.movie = bsv_movie_init(path, SSNES_MOVIE_RECORD);
|
g_extern.bsv.movie = bsv_movie_init(path, SSNES_MOVIE_RECORD);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user