mirror of
https://github.com/libretro/RetroArch
synced 2024-07-08 20:25:47 +00:00
Cleanups - C-style comments, 80-char limit
This commit is contained in:
parent
5574e00ae3
commit
46b6b112b8
|
@ -24,10 +24,13 @@ autosave_t *autosave_new(const char *path, const void *data,
|
||||||
size_t size, unsigned interval);
|
size_t size, unsigned interval);
|
||||||
|
|
||||||
void autosave_lock(autosave_t *handle);
|
void autosave_lock(autosave_t *handle);
|
||||||
|
|
||||||
void autosave_unlock(autosave_t *handle);
|
void autosave_unlock(autosave_t *handle);
|
||||||
|
|
||||||
void autosave_free(autosave_t *handle);
|
void autosave_free(autosave_t *handle);
|
||||||
|
|
||||||
void lock_autosave(void);
|
void lock_autosave(void);
|
||||||
|
|
||||||
void unlock_autosave(void);
|
void unlock_autosave(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -364,7 +364,6 @@ static void network_cmd_poll(rarch_cmd_t *handle)
|
||||||
#ifdef HAVE_STDIN_CMD
|
#ifdef HAVE_STDIN_CMD
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Oh you, Win32 ... <_<
|
|
||||||
static size_t read_stdin(char *buf, size_t size)
|
static size_t read_stdin(char *buf, size_t size)
|
||||||
{
|
{
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
@ -546,8 +545,8 @@ static bool send_udp_packet(const char *host,
|
||||||
if (getaddrinfo(host, port_buf, &hints, &res) < 0)
|
if (getaddrinfo(host, port_buf, &hints, &res) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Send to all possible targets.
|
/* Send to all possible targets.
|
||||||
// "localhost" might resolve to several different IPs.
|
* "localhost" might resolve to several different IPs. */
|
||||||
tmp = (const struct addrinfo*)res;
|
tmp = (const struct addrinfo*)res;
|
||||||
while (tmp)
|
while (tmp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BUFFER_H
|
#ifndef __FIFO_BUFFER_H
|
||||||
#define __BUFFER_H
|
#define __FIFO_BUFFER_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -24,10 +24,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FIFO_BUF_TYPEDEF
|
|
||||||
#define FIFO_BUF_TYPEDEF
|
|
||||||
typedef struct fifo_buffer fifo_buffer_t;
|
typedef struct fifo_buffer fifo_buffer_t;
|
||||||
#endif
|
|
||||||
|
|
||||||
fifo_buffer_t *fifo_new(size_t size);
|
fifo_buffer_t *fifo_new(size_t size);
|
||||||
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size);
|
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size);
|
||||||
|
|
27
file.c
27
file.c
|
@ -133,13 +133,22 @@ static ssize_t read_content_file(const char *path, void **buf)
|
||||||
{
|
{
|
||||||
uint8_t *ret_buf = NULL;
|
uint8_t *ret_buf = NULL;
|
||||||
ssize_t ret = -1;
|
ssize_t ret = -1;
|
||||||
/* Here we check, whether the file, we are about to read is inside an archive, or not.
|
|
||||||
We determine, whether a file is inside a compressed archive, by checking, if the archive string is a substring of the
|
/* Here we check, whether the file, we are about to read is
|
||||||
complete path
|
* inside an archive, or not.
|
||||||
For example: fullpath: /home/user/game.7z/mygame.rom
|
*
|
||||||
carchive_path: /home/user/game.7z */
|
* We determine, whether a file is inside a compressed archive,
|
||||||
|
* by checking, if the archive string is a substring of the
|
||||||
|
* complete path
|
||||||
|
*
|
||||||
|
* For example: fullpath: /home/user/game.7z/mygame.rom
|
||||||
|
* carchive_path: /home/user/game.7z
|
||||||
|
* */
|
||||||
|
|
||||||
#ifdef HAVE_COMPRESSION
|
#ifdef HAVE_COMPRESSION
|
||||||
const char* archive_found = (const char*)strstr(path, g_extern.carchive_path);
|
const char* archive_found = (const char*)strstr(path,
|
||||||
|
g_extern.carchive_path);
|
||||||
|
|
||||||
if (g_extern.is_carchive)
|
if (g_extern.is_carchive)
|
||||||
{
|
{
|
||||||
if(archive_found)
|
if(archive_found)
|
||||||
|
@ -149,7 +158,8 @@ static ssize_t read_content_file(const char *path, void **buf)
|
||||||
char rel_path[PATH_MAX];
|
char rel_path[PATH_MAX];
|
||||||
snprintf(rel_path, sizeof(rel_path),
|
snprintf(rel_path, sizeof(rel_path),
|
||||||
"%s", archive_found + strlen(g_extern.carchive_path) + 1);
|
"%s", archive_found + strlen(g_extern.carchive_path) + 1);
|
||||||
ret = read_compressed_file(g_extern.carchive_path, rel_path, (void**)&ret_buf);
|
ret = read_compressed_file(g_extern.carchive_path,
|
||||||
|
rel_path, (void**)&ret_buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -450,7 +460,8 @@ bool init_content_file(void)
|
||||||
RARCH_ERR("libretro core requires special content, but none were provided.\n");
|
RARCH_ERR("libretro core requires special content, but none were provided.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (special->num_roms && special->num_roms != g_extern.subsystem_fullpaths->size)
|
else if (special->num_roms && special->num_roms
|
||||||
|
!= g_extern.subsystem_fullpaths->size)
|
||||||
{
|
{
|
||||||
RARCH_ERR("libretro core requires %u content files for subsystem \"%s\", but %u content files were provided.\n",
|
RARCH_ERR("libretro core requires %u content files for subsystem \"%s\", but %u content files were provided.\n",
|
||||||
special->num_roms, special->desc,
|
special->num_roms, special->desc,
|
||||||
|
|
3
movie.c
3
movie.c
|
@ -107,7 +107,8 @@ static bool init_record(bsv_movie_t *handle, const char *path)
|
||||||
|
|
||||||
uint32_t header[4] = {0};
|
uint32_t header[4] = {0};
|
||||||
|
|
||||||
/* This value is supposed to show up as BSV1 in a HEX editor, big-endian. */
|
/* This value is supposed to show up as
|
||||||
|
* BSV1 in a HEX editor, big-endian. */
|
||||||
header[MAGIC_INDEX] = swap_if_little32(BSV_MAGIC);
|
header[MAGIC_INDEX] = swap_if_little32(BSV_MAGIC);
|
||||||
|
|
||||||
header[CRC_INDEX] = swap_if_big32(g_extern.content_crc);
|
header[CRC_INDEX] = swap_if_big32(g_extern.content_crc);
|
||||||
|
|
31
settings.c
31
settings.c
|
@ -591,6 +591,7 @@ static void config_load_core_specific(void)
|
||||||
/* Force some parameters which are implied when using core specific configs.
|
/* Force some parameters which are implied when using core specific configs.
|
||||||
* Don't have the core config file overwrite the libretro path. */
|
* Don't have the core config file overwrite the libretro path. */
|
||||||
strlcpy(g_settings.libretro, tmp, sizeof(g_settings.libretro));
|
strlcpy(g_settings.libretro, tmp, sizeof(g_settings.libretro));
|
||||||
|
|
||||||
/* This must be true for core specific configs. */
|
/* This must be true for core specific configs. */
|
||||||
g_settings.core_specific_config = true;
|
g_settings.core_specific_config = true;
|
||||||
}
|
}
|
||||||
|
@ -653,10 +654,12 @@ static config_file_t *open_default_config_file(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saved)
|
if (saved)
|
||||||
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path); // WARN here to make sure user has a good chance of seeing it.
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to create new config file in: \"%s\".\n", conf_path);
|
/* WARN here to make sure user has a good chance of seeing it. */
|
||||||
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n",
|
||||||
|
conf_path);
|
||||||
config_file_free(conf);
|
config_file_free(conf);
|
||||||
conf = NULL;
|
conf = NULL;
|
||||||
}
|
}
|
||||||
|
@ -691,10 +694,12 @@ static config_file_t *open_default_config_file(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saved)
|
if (saved)
|
||||||
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path); // WARN here to make sure user has a good chance of seeing it.
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to create new config file in: \"%s\".\n", conf_path);
|
/* WARN here to make sure user has a good chance of seeing it. */
|
||||||
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n",
|
||||||
|
conf_path);
|
||||||
config_file_free(conf);
|
config_file_free(conf);
|
||||||
conf = NULL;
|
conf = NULL;
|
||||||
}
|
}
|
||||||
|
@ -708,7 +713,7 @@ static config_file_t *open_default_config_file(void)
|
||||||
const char *xdg = getenv("XDG_CONFIG_HOME");
|
const char *xdg = getenv("XDG_CONFIG_HOME");
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
|
|
||||||
// XDG_CONFIG_HOME falls back to $HOME/.config.
|
/* XDG_CONFIG_HOME falls back to $HOME/.config. */
|
||||||
if (xdg)
|
if (xdg)
|
||||||
fill_pathname_join(conf_path, xdg,
|
fill_pathname_join(conf_path, xdg,
|
||||||
"retroarch/retroarch.cfg", sizeof(conf_path));
|
"retroarch/retroarch.cfg", sizeof(conf_path));
|
||||||
|
@ -727,7 +732,7 @@ static config_file_t *open_default_config_file(void)
|
||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to $HOME/.retroarch.cfg.
|
/* Fallback to $HOME/.retroarch.cfg. */
|
||||||
if (!conf && home)
|
if (!conf && home)
|
||||||
{
|
{
|
||||||
fill_pathname_join(conf_path, home,
|
fill_pathname_join(conf_path, home,
|
||||||
|
@ -736,10 +741,10 @@ static config_file_t *open_default_config_file(void)
|
||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to create a new config file.
|
/* Try to create a new config file. */
|
||||||
if (!conf && (home || xdg))
|
if (!conf && (home || xdg))
|
||||||
{
|
{
|
||||||
// XDG_CONFIG_HOME falls back to $HOME/.config.
|
/* XDG_CONFIG_HOME falls back to $HOME/.config. */
|
||||||
if (xdg)
|
if (xdg)
|
||||||
fill_pathname_join(conf_path, xdg,
|
fill_pathname_join(conf_path, xdg,
|
||||||
"retroarch/retroarch.cfg", sizeof(conf_path));
|
"retroarch/retroarch.cfg", sizeof(conf_path));
|
||||||
|
@ -776,14 +781,16 @@ static config_file_t *open_default_config_file(void)
|
||||||
bool saved = false;
|
bool saved = false;
|
||||||
if (conf)
|
if (conf)
|
||||||
{
|
{
|
||||||
config_set_bool(conf, "config_save_on_exit", true); // Since this is a clean config file, we can safely use config_save_on_exit.
|
/* Since this is a clean config file, we can safely use config_save_on_exit. */
|
||||||
|
config_set_bool(conf, "config_save_on_exit", true);
|
||||||
saved = config_file_write(conf, conf_path);
|
saved = config_file_write(conf, conf_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saved)
|
if (saved)
|
||||||
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path); // WARN here to make sure user has a good chance of seeing it.
|
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* WARN here to make sure user has a good chance of seeing it. */
|
||||||
RARCH_ERR("Failed to create new config file in: \"%s\".\n", conf_path);
|
RARCH_ERR("Failed to create new config file in: \"%s\".\n", conf_path);
|
||||||
config_file_free(conf);
|
config_file_free(conf);
|
||||||
conf = NULL;
|
conf = NULL;
|
||||||
|
@ -993,7 +1000,7 @@ bool config_load_file(const char *path, bool set_defaults)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audio settings.
|
/* Audio settings. */
|
||||||
CONFIG_GET_BOOL(audio.enable, "audio_enable");
|
CONFIG_GET_BOOL(audio.enable, "audio_enable");
|
||||||
CONFIG_GET_INT(audio.out_rate, "audio_out_rate");
|
CONFIG_GET_INT(audio.out_rate, "audio_out_rate");
|
||||||
CONFIG_GET_INT(audio.block_frames, "audio_block_frames");
|
CONFIG_GET_INT(audio.block_frames, "audio_block_frames");
|
||||||
|
@ -1026,7 +1033,7 @@ bool config_load_file(const char *path, bool set_defaults)
|
||||||
if (!g_extern.has_set_libretro_directory)
|
if (!g_extern.has_set_libretro_directory)
|
||||||
CONFIG_GET_PATH(libretro_directory, "libretro_directory");
|
CONFIG_GET_PATH(libretro_directory, "libretro_directory");
|
||||||
|
|
||||||
// Safe-guard against older behavior.
|
/* Safe-guard against older behavior. */
|
||||||
if (path_is_directory(g_settings.libretro))
|
if (path_is_directory(g_settings.libretro))
|
||||||
{
|
{
|
||||||
RARCH_WARN("\"libretro_path\" is a directory, using this for \"libretro_directory\" instead.\n");
|
RARCH_WARN("\"libretro_path\" is a directory, using this for \"libretro_directory\" instead.\n");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user