Skip to content

Commit 02a7574

Browse files
committed
Error code framework
As one of the feedbacks from the RetroArch UI Improvements series put together by Nic Watt, the ways RetroArch (or any other frontend) could indicate errors about the cores, is quite limited. The Libretro API functions provide little feedback opportunity for the cores to indicate problems. By introducing a new environment call, the possibility will be available across the board. This change is a wireframe and may be extended / adopted as needed.
1 parent cb69d25 commit 02a7574

File tree

3 files changed

+166
-1
lines changed

3 files changed

+166
-1
lines changed

libretro-common/include/libretro.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,20 @@ enum retro_mod
711711
RETROKMOD_DUMMY = INT_MAX /* Ensure sizeof(enum) == sizeof(int) */
712712
};
713713

714+
/* Error codes that can be reported by the core. */
715+
enum retro_error
716+
{
717+
RETROE_NONE = 0x00000000,
718+
RETROE_MASK_CORE = 0x0000FFFF, /* Mask value for core/frontend split */
719+
720+
RETROE_UNSUPPORTED_CONTENT_FORMAT = 0x01000000,
721+
RETROE_MISSING_BIOS = 0x02000000,
722+
RETROE_HARDWARE_RENDERING_NOT_AVAILABLE = 0x03000000,
723+
724+
RETROE_MASK_FRONTEND = 0x7FFF0000, /* Mask value for core/frontend split - limited to 31 bit due to C89 */
725+
RETROE_DUMMY = INT_MAX /* Ensure sizeof(enum) == sizeof(int) */
726+
};
727+
714728
/**
715729
* @defgroup RETRO_ENVIRONMENT Environment Callbacks
716730
* @{
@@ -2574,6 +2588,17 @@ enum retro_mod
25742588
*/
25752589
#define RETRO_ENVIRONMENT_GET_FILE_BROWSER_START_DIRECTORY 80
25762590

2591+
/**
2592+
* Informs the frontend of an error occurrence during the current operation.
2593+
*
2594+
* @param[in] data <tt>const uint32_t*</tt>.
2595+
* Valid values of the upper 16 bit are defined as retro_error.
2596+
* The lower 16 bits are reserved for the core.
2597+
* @return \c true if the environment call is available.
2598+
* @see retro_error
2599+
*/
2600+
#define RETRO_ENVIRONMENT_SET_ERROR_CODE 81
2601+
25772602
/**@}*/
25782603

25792604
/**

0 commit comments

Comments
 (0)