Skip to content

Commit db0ddbe

Browse files
committed
Updates
1 parent 6419cc4 commit db0ddbe

13 files changed

Lines changed: 237 additions & 139 deletions

File tree

audio/dsp_filters/Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ INSTALLDIR := $(PREFIX)/lib/retroarch/filters/audio
88

99
ifeq ($(platform),)
1010
platform = unix
11-
ifeq ($(shell uname -a),)
11+
ifeq ($(shell uname -s),)
1212
platform = win
13-
else ifneq ($(findstring MINGW,$(shell uname -a)),)
14-
platform = win
15-
else ifneq ($(findstring Darwin,$(shell uname -a)),)
13+
else ifneq ($(findstring Darwin,$(shell uname -s)),)
1614
platform = osx
17-
arch = intel
15+
arch = intel
1816
ifeq ($(shell uname -p),powerpc)
1917
arch = ppc
2018
endif
21-
else ifneq ($(findstring win,$(shell uname -a)),)
19+
else ifneq ($(findstring MINGW,$(shell uname -s)),)
2220
platform = win
2321
endif
2422
endif

features/features_cpu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,12 @@ static unsigned char check_arm_cpu_feature(const char* feature)
348348
if (!fp)
349349
return 0;
350350

351-
while (filestream_gets(fp, line, sizeof(line)) != NULL)
351+
while (filestream_gets(fp, line, sizeof(line)))
352352
{
353353
if (strncmp(line, "Features\t: ", 11))
354354
continue;
355355

356-
if (strstr(line + 11, feature) != NULL)
356+
if (strstr(line + 11, feature))
357357
status = 1;
358358

359359
break;

file/archive_file_7z.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static int sevenzip_file_read(
256256

257257
outsize = outSizeProcessed;
258258

259-
if (optional_outfile != NULL)
259+
if (optional_outfile)
260260
{
261261
const void *ptr = (const void*)(output + offset);
262262

file/config_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ static config_file_t *config_file_new_internal(
450450

451451
conf->tail = list;
452452

453-
if (cb != NULL && list->key != NULL && list->value != NULL)
453+
if (cb && list->key && list->value)
454454
cb->config_file_new_entry_cb(list->key, list->value) ;
455455
}
456456

file/retro_dirent.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void dirent_vfs_init(const struct retro_vfs_interface_info* vfs_info)
6161

6262
struct RDIR *retro_opendir_include_hidden(const char *name, bool include_hidden)
6363
{
64-
if (dirent_opendir_cb != NULL)
64+
if (dirent_opendir_cb)
6565
return (struct RDIR *)dirent_opendir_cb(name, include_hidden);
6666
return (struct RDIR *)retro_vfs_opendir_impl(name, include_hidden);
6767
}
@@ -79,14 +79,14 @@ bool retro_dirent_error(struct RDIR *rdir)
7979

8080
int retro_readdir(struct RDIR *rdir)
8181
{
82-
if (dirent_readdir_cb != NULL)
82+
if (dirent_readdir_cb)
8383
return dirent_readdir_cb((struct retro_vfs_dir_handle *)rdir);
8484
return retro_vfs_readdir_impl((struct retro_vfs_dir_handle *)rdir);
8585
}
8686

8787
const char *retro_dirent_get_name(struct RDIR *rdir)
8888
{
89-
if (dirent_dirent_get_name_cb != NULL)
89+
if (dirent_dirent_get_name_cb)
9090
return dirent_dirent_get_name_cb((struct retro_vfs_dir_handle *)rdir);
9191
return retro_vfs_dirent_get_name_impl((struct retro_vfs_dir_handle *)rdir);
9292
}
@@ -104,14 +104,14 @@ const char *retro_dirent_get_name(struct RDIR *rdir)
104104
*/
105105
bool retro_dirent_is_dir(struct RDIR *rdir, const char *unused)
106106
{
107-
if (dirent_dirent_is_dir_cb != NULL)
107+
if (dirent_dirent_is_dir_cb)
108108
return dirent_dirent_is_dir_cb((struct retro_vfs_dir_handle *)rdir);
109109
return retro_vfs_dirent_is_dir_impl((struct retro_vfs_dir_handle *)rdir);
110110
}
111111

112112
void retro_closedir(struct RDIR *rdir)
113113
{
114-
if (dirent_closedir_cb != NULL)
114+
if (dirent_closedir_cb)
115115
dirent_closedir_cb((struct retro_vfs_dir_handle *)rdir);
116116
else
117117
retro_vfs_closedir_impl((struct retro_vfs_dir_handle *)rdir);

formats/cdfs/cdfs.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,19 +156,15 @@ int cdfs_open_file(cdfs_file_t* file, cdfs_track_t* track, const char* path)
156156
file->track = track;
157157

158158
file->current_sector = -1;
159-
if (path != NULL)
160-
{
159+
if (path)
161160
file->first_sector = cdfs_find_file(file, path);
162-
}
163161
else if (file->track->stream_sector_size)
164162
{
165163
file->first_sector = 0;
166164
file->size = (intfstream_get_size(file->track->stream) / file->track->stream_sector_size) * 2048;
167165
}
168166
else
169-
{
170167
file->first_sector = -1;
171-
}
172168

173169
return (file->first_sector >= 0);
174170
}

include/libretro.h

Lines changed: 121 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ enum retro_mod
11171117
* This may be still be done regardless of the core options
11181118
* interface version.
11191119
*
1120-
* If version is 1 however, core options may instead be set by
1120+
* If version is >= 1 however, core options may instead be set by
11211121
* passing an array of retro_core_option_definition structs to
11221122
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS, or a 2D array of
11231123
* retro_core_option_definition structs to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL.
@@ -1132,8 +1132,8 @@ enum retro_mod
11321132
* GET_VARIABLE.
11331133
* This allows the frontend to present these variables to
11341134
* a user dynamically.
1135-
* This should only be called if RETRO_ENVIRONMENT_GET_ENHANCED_CORE_OPTIONS
1136-
* returns an API version of 1.
1135+
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
1136+
* returns an API version of >= 1.
11371137
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
11381138
* This should be called the first time as early as
11391139
* possible (ideally in retro_set_environment).
@@ -1169,8 +1169,6 @@ enum retro_mod
11691169
* i.e. it should be feasible to cycle through options
11701170
* without a keyboard.
11711171
*
1172-
* First entry should be treated as a default.
1173-
*
11741172
* Example entry:
11751173
* {
11761174
* "foo_option",
@@ -1196,8 +1194,8 @@ enum retro_mod
11961194
* GET_VARIABLE.
11971195
* This allows the frontend to present these variables to
11981196
* a user dynamically.
1199-
* This should only be called if RETRO_ENVIRONMENT_GET_ENHANCED_CORE_OPTIONS
1200-
* returns an API version of 1.
1197+
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
1198+
* returns an API version of >= 1.
12011199
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
12021200
* This should be called the first time as early as
12031201
* possible (ideally in retro_set_environment).
@@ -1257,7 +1255,38 @@ enum retro_mod
12571255
*
12581256
* 'data' points to an unsigned variable
12591257
*/
1260-
1258+
1259+
#define RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION 57
1260+
/* unsigned * --
1261+
* Unsigned value is the API version number of the disk control
1262+
* interface supported by the frontend. If callback return false,
1263+
* API version is assumed to be 0.
1264+
*
1265+
* In legacy code, the disk control interface is defined by passing
1266+
* a struct of type retro_disk_control_callback to
1267+
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE.
1268+
* This may be still be done regardless of the disk control
1269+
* interface version.
1270+
*
1271+
* If version is >= 1 however, the disk control interface may
1272+
* instead be defined by passing a struct of type
1273+
* retro_disk_control_ext_callback to
1274+
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE.
1275+
* This allows the core to provide additional information about
1276+
* disk images to the frontend and/or enables extra
1277+
* disk control functionality by the frontend.
1278+
*/
1279+
1280+
#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE 58
1281+
/* const struct retro_disk_control_ext_callback * --
1282+
* Sets an interface which frontend can use to eject and insert
1283+
* disk images, and also obtain information about individual
1284+
* disk image files registered by the core.
1285+
* This is used for games which consist of multiple images and
1286+
* must be manually swapped out by the user (e.g. PSX, floppy disk
1287+
* based systems).
1288+
*/
1289+
12611290
/* VFS functionality */
12621291

12631292
/* File paths:
@@ -2307,7 +2336,8 @@ struct retro_keyboard_callback
23072336
retro_keyboard_event_t callback;
23082337
};
23092338

2310-
/* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE.
2339+
/* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE &
2340+
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE.
23112341
* Should be set for implementations which can swap out multiple disk
23122342
* images in runtime.
23132343
*
@@ -2365,6 +2395,53 @@ typedef bool (RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index,
23652395
* with replace_image_index. */
23662396
typedef bool (RETRO_CALLCONV *retro_add_image_index_t)(void);
23672397

2398+
/* Sets initial image to insert in drive when calling
2399+
* core_load_game().
2400+
* Since we cannot pass the initial index when loading
2401+
* content (this would require a major API change), this
2402+
* is set by the frontend *before* calling the core's
2403+
* retro_load_game()/retro_load_game_special() implementation.
2404+
* A core should therefore cache the index/path values and handle
2405+
* them inside retro_load_game()/retro_load_game_special().
2406+
* - If 'index' is invalid (index >= get_num_images()), the
2407+
* core should ignore the set value and instead use 0
2408+
* - 'path' is used purely for error checking - i.e. when
2409+
* content is loaded, the core should verify that the
2410+
* disk specified by 'index' has the specified file path.
2411+
* This is to guard against auto selecting the wrong image
2412+
* if (for example) the user should modify an existing M3U
2413+
* playlist. We have to let the core handle this because
2414+
* set_initial_image() must be called before loading content,
2415+
* i.e. the frontend cannot access image paths in advance
2416+
* and thus cannot perform the error check itself.
2417+
* If set path and content path do not match, the core should
2418+
* ignore the set 'index' value and instead use 0
2419+
* Returns 'false' if index or 'path' are invalid, or core
2420+
* does not support this functionality
2421+
*/
2422+
typedef bool (RETRO_CALLCONV *retro_set_initial_image_t)(unsigned index, const char *path);
2423+
2424+
/* Fetches the path of the specified disk image file.
2425+
* Returns 'false' if index is invalid (index >= get_num_images())
2426+
* or path is otherwise unavailable.
2427+
*/
2428+
typedef bool (RETRO_CALLCONV *retro_get_image_path_t)(unsigned index, char *path, size_t len);
2429+
2430+
/* Fetches a core-provided 'label' for the specified disk
2431+
* image file. In the simplest case this may be a file name
2432+
* (without extension), but for cores with more complex
2433+
* content requirements information may be provided to
2434+
* facilitate user disk swapping - for example, a core
2435+
* running floppy-disk-based content may uniquely label
2436+
* save disks, data disks, level disks, etc. with names
2437+
* corresponding to in-game disk change prompts (so the
2438+
* frontend can provide better user guidance than a 'dumb'
2439+
* disk index value).
2440+
* Returns 'false' if index is invalid (index >= get_num_images())
2441+
* or label is otherwise unavailable.
2442+
*/
2443+
typedef bool (RETRO_CALLCONV *retro_get_image_label_t)(unsigned index, char *label, size_t len);
2444+
23682445
struct retro_disk_control_callback
23692446
{
23702447
retro_set_eject_state_t set_eject_state;
@@ -2378,6 +2455,27 @@ struct retro_disk_control_callback
23782455
retro_add_image_index_t add_image_index;
23792456
};
23802457

2458+
struct retro_disk_control_ext_callback
2459+
{
2460+
retro_set_eject_state_t set_eject_state;
2461+
retro_get_eject_state_t get_eject_state;
2462+
2463+
retro_get_image_index_t get_image_index;
2464+
retro_set_image_index_t set_image_index;
2465+
retro_get_num_images_t get_num_images;
2466+
2467+
retro_replace_image_index_t replace_image_index;
2468+
retro_add_image_index_t add_image_index;
2469+
2470+
/* NOTE: Frontend will only attempt to record/restore
2471+
* last used disk index if both set_initial_image()
2472+
* and get_image_path() are implemented */
2473+
retro_set_initial_image_t set_initial_image; /* Optional - may be NULL */
2474+
2475+
retro_get_image_path_t get_image_path; /* Optional - may be NULL */
2476+
retro_get_image_label_t get_image_label; /* Optional - may be NULL */
2477+
};
2478+
23812479
enum retro_pixel_format
23822480
{
23832481
/* 0RGB1555, native endian.
@@ -2522,8 +2620,20 @@ struct retro_core_option_display
25222620
};
25232621

25242622
/* Maximum number of values permitted for a core option
2525-
* NOTE: This may be increased on a core-by-core basis
2526-
* if required (doing so has no effect on the frontend) */
2623+
* > Note: We have to set a maximum value due the limitations
2624+
* of the C language - i.e. it is not possible to create an
2625+
* array of structs each containing a variable sized array,
2626+
* so the retro_core_option_definition values array must
2627+
* have a fixed size. The size limit of 128 is a balancing
2628+
* act - it needs to be large enough to support all 'sane'
2629+
* core options, but setting it too large may impact low memory
2630+
* platforms. In practise, if a core option has more than
2631+
* 128 values then the implementation is likely flawed.
2632+
* To quote the above API reference:
2633+
* "The number of possible options should be very limited
2634+
* i.e. it should be feasible to cycle through options
2635+
* without a keyboard."
2636+
*/
25272637
#define RETRO_NUM_CORE_OPTION_VALUES_MAX 128
25282638

25292639
struct retro_core_option_value

media/media_detect_cd.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,11 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
334334

335335
if (!memcmp(buf + offset, "SEGADISCSYSTEM", strlen("SEGADISCSYSTEM")))
336336
{
337-
const char *title_pos;
338-
const char *serial_pos;
339-
bool title_found = false;
337+
const char *title_pos = NULL;
338+
const char *serial_pos = NULL;
339+
#if 0
340+
bool title_found = false;
341+
#endif
340342

341343
/* All discs currently in Redump for MCD start with SEGADISCSYSTEM. There are other strings mentioned elsewhere online,
342344
* but I have not seen any real examples of them. */
@@ -366,11 +368,13 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
366368
}
367369
else if (!memcmp(buf + offset, "SEGA SEGASATURN", strlen("SEGA SEGASATURN")))
368370
{
369-
const char *title_pos;
370-
const char *serial_pos;
371-
const char *version_pos;
372-
const char *release_date_pos;
373-
bool title_found = false;
371+
const char *title_pos = NULL;
372+
const char *serial_pos = NULL;
373+
const char *version_pos = NULL;
374+
const char *release_date_pos = NULL;
375+
#if 0
376+
bool title_found = false;
377+
#endif
374378

375379
info->system_id = MEDIA_CD_SYSTEM_SATURN;
376380

@@ -418,11 +422,13 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
418422
}
419423
else if (!memcmp(buf + offset, "SEGA SEGAKATANA", strlen("SEGA SEGAKATANA")))
420424
{
421-
const char *title_pos;
422-
const char *serial_pos;
423-
const char *version_pos;
424-
const char *release_date_pos;
425-
bool title_found = false;
425+
const char *title_pos = NULL;
426+
const char *serial_pos = NULL;
427+
const char *version_pos = NULL;
428+
const char *release_date_pos = NULL;
429+
#if 0
430+
bool title_found = false;
431+
#endif
426432

427433
info->system_id = MEDIA_CD_SYSTEM_DREAMCAST;
428434

@@ -472,7 +478,9 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
472478
else if (!memcmp(buf + offset + (16 * sector_size), "\1CD001\1\0PLAYSTATION", 19))
473479
{
474480
const char *title_pos = NULL;
481+
#if 0
475482
bool title_found = false;
483+
#endif
476484

477485
info->system_id = MEDIA_CD_SYSTEM_PSX;
478486

0 commit comments

Comments
 (0)