Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 55 additions & 5 deletions cores/libretro-net-retropad/net_retropad_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ static bool input_test_file_read(const char* file_path)
(int)rjson_get_source_line(parser),
(int)rjson_get_source_column(parser),
(*rjson_get_error(parser) ? rjson_get_error(parser) : "format error"));
if (last_test_step > MAX_TEST_STEPS)
last_test_step = 0;
}

/* Free parser */
Expand All @@ -412,6 +414,12 @@ static bool input_test_file_read(const char* file_path)
{
NETRETROPAD_CORE_PREFIX(log_cb)(RETRO_LOG_WARN,"[Remote RetroPad]: too long test input json, maximum size: %d\n",MAX_TEST_STEPS);
}
if (last_test_step == 0)
{
NETRETROPAD_CORE_PREFIX(log_cb)(RETRO_LOG_WARN,"[Remote RetroPad]: no steps in input json\n");
success = false;
}

for (current_test_step = 0; current_test_step < last_test_step; current_test_step++)
{
NETRETROPAD_CORE_PREFIX(log_cb)(RETRO_LOG_DEBUG,
Expand Down Expand Up @@ -562,7 +570,14 @@ unsigned NETRETROPAD_CORE_PREFIX(retro_api_version)(void)
}

void NETRETROPAD_CORE_PREFIX(retro_set_controller_port_device)(
unsigned port, unsigned device) { }
unsigned port, unsigned device)
{
const char msg[] = "Input device type change is not supported!";
struct retro_error_message e;
e.code = RETROE_UNSUPPORTED_ACTION | ((port & 0xFF) << 8) | (device & 0xFF);
e.message = msg;
NETRETROPAD_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_ERROR_CODE, &e);
}

void NETRETROPAD_CORE_PREFIX(retro_get_system_info)(
struct retro_system_info *info)
Expand Down Expand Up @@ -1385,13 +1400,16 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)

bool NETRETROPAD_CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
{
bool load_result = true;

netretropad_check_variables();
open_UDP_socket();

/* If a .ratst file is given (only possible via command line),
* initialize test sequence. */
if (info)
input_test_file_read(info->path);
load_result = input_test_file_read(info->path);

if (last_test_step > MAX_TEST_STEPS)
current_test_step = last_test_step;
else
Expand All @@ -1402,7 +1420,25 @@ bool NETRETROPAD_CORE_PREFIX(retro_load_game)(const struct retro_game_info *info
NETRETROPAD_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_MESSAGE, &message);
}

return true;
if (!load_result)
{
const char msg[] = "Invalid test input file!";
struct retro_error_message e;
e.code = RETROE_UNSUPPORTED_CONTENT_FORMAT;
e.message = msg;
NETRETROPAD_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_ERROR_CODE, &e);
}

if (false)
{
const char msg[] = "Simulated load error - BIOS!";
struct retro_error_message e;
e.code = RETROE_MISSING_BIOS | 0x4321;
e.message = msg;
NETRETROPAD_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_ERROR_CODE, &e);
load_result = false;
}
return load_result;
}

void NETRETROPAD_CORE_PREFIX(retro_unload_game)(void) { }
Expand All @@ -1411,9 +1447,23 @@ bool NETRETROPAD_CORE_PREFIX(retro_load_game_special)(unsigned type,
const struct retro_game_info *info, size_t num) { return false; }
size_t NETRETROPAD_CORE_PREFIX(retro_serialize_size)(void) { return 0; }
bool NETRETROPAD_CORE_PREFIX(retro_serialize)(void *data,
size_t len) { return false; }
size_t len)
{
struct retro_error_message e;
e.code = RETROE_UNSUPPORTED_ACTION_SERIALIZE;
e.message = NULL;
NETRETROPAD_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_ERROR_CODE, &e);
return false;
}
bool NETRETROPAD_CORE_PREFIX(retro_unserialize)(const void *data,
size_t len) { return false; }
size_t len)
{
struct retro_error_message e;
e.code = RETROE_UNSUPPORTED_ACTION_UNSERIALIZE;
e.message = NULL;
NETRETROPAD_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_ERROR_CODE, &e);
return false;
}
size_t NETRETROPAD_CORE_PREFIX(retro_get_memory_size)(
unsigned id) { return 0; }
void NETRETROPAD_CORE_PREFIX(retro_cheat_reset)(void) { }
Expand Down
63 changes: 63 additions & 0 deletions intl/msg_hash_us.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,69 @@ int msg_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
}
#endif

#define ERROR_CODE_CASE(CODE) \
case CODE :\
return strlcpy(s, msg_hash_to_str(MSG_##CODE), len);\
break;

int msg_hash_get_error_msg_us_enum(enum retro_error err, char *s, size_t len)
{
settings_t *settings = config_get_ptr();

switch (err & RETROE_MASK_FRONTEND)
{
ERROR_CODE_CASE(RETROE_UNSUPPORTED_CONTENT)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_CONTENT_ISO_FORMAT_ERROR)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_CONTENT_CHD_FORMAT_ERROR)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_CONTENT_CUE_FORMAT_ERROR)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_CONTENT_BIN_FORMAT_ERROR)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_CONTENT_ZIP_FORMAT_ERROR)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_CONTENT_7Z_FORMAT_ERROR)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_CONTENT_FORMAT)
ERROR_CODE_CASE(RETROE_MISSING_BIOS)
ERROR_CODE_CASE(RETROE_MISSING_BIOS_REGION_PAL)
ERROR_CODE_CASE(RETROE_MISSING_BIOS_REGION_NTSC)
ERROR_CODE_CASE(RETROE_MISSING_BIOS_REGION_WORLD)
ERROR_CODE_CASE(RETROE_MISSING_BIOS_REGION_USA)
ERROR_CODE_CASE(RETROE_MISSING_BIOS_REGION_JAPAN)
ERROR_CODE_CASE(RETROE_MISSING_BIOS_REGION_EUROPE)
ERROR_CODE_CASE(RETROE_MISSING_BIOS_REGION_BRAZIL)
ERROR_CODE_CASE(RETROE_MISSING_BIOS_REGION_COUNTRY)
ERROR_CODE_CASE(RETROE_MISSING_SYSTEM_FILES)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING_VULKAN_NOT_AVAILABLE)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING_VULKAN_VERSION_ERROR)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING_OPENGL_NOT_AVAILABLE)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING_OPENGL_VERSION_ERROR)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING_DX11_NOT_AVAILABLE)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING_DX12_NOT_AVAILABLE)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING_PXFMT_XRGB8888_UNSUPP)
ERROR_CODE_CASE(RETROE_HARDWARE_RENDERING_PXFMT_RGB565_UNSUPP)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_ACTION)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_ACTION_SERIALIZE)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_ACTION_UNSERIALIZE)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_ACTION_UNSERIALIZE_FORMAT)
ERROR_CODE_CASE(RETROE_UNSUPPORTED_ACTION_CORE_OPTION_COMBI)

default:
if ( err > RETROE_UNSUPPORTED_CONTENT &&
err < RETROE_UNSUPPORTED_CONTENT_RANGE_END)
return strlcpy(s, msg_hash_to_str(MSG_RETROE_UNSUPPORTED_CONTENT), len);
else if ( err > RETROE_MISSING_BIOS &&
err < RETROE_MISSING_BIOS_RANGE_END)
return strlcpy(s, msg_hash_to_str(MSG_RETROE_MISSING_BIOS), len);
else if ( err > RETROE_HARDWARE_RENDERING &&
err < RETROE_HARDWARE_RENDERING_RANGE_END)
return strlcpy(s, msg_hash_to_str(MSG_RETROE_HARDWARE_RENDERING), len);
else if ( err > RETROE_UNSUPPORTED_ACTION &&
err < RETROE_UNSUPPORTED_ACTION_RANGE_END)
return strlcpy(s, msg_hash_to_str(MSG_RETROE_UNSUPPORTED_ACTION), len);
else
return strlcpy(s, msg_hash_to_str(MSG_RETROE_UNKNOWN), len);
}
return 0;
}

#ifdef HAVE_MENU
static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
{
Expand Down
132 changes: 132 additions & 0 deletions intl/msg_hash_us.h
Original file line number Diff line number Diff line change
Expand Up @@ -16707,6 +16707,138 @@ MSG_HASH(
MSG_AI_SERVICE_STOPPED,
"stopped."
)
MSG_HASH(
MSG_RETROE_UNKNOWN,
"Unknown error code received from core."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_CONTENT,
"This core does not support this kind of content."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_CONTENT_ISO_FORMAT_ERROR,
"This core does not support the specific ISO format of this content."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_CONTENT_CHD_FORMAT_ERROR,
"This core does not support the specific CHD format of this content."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_CONTENT_CUE_FORMAT_ERROR,
"This core does not support the specific CUE format of this content."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_CONTENT_BIN_FORMAT_ERROR,
"This core does not support the specific BIN format of this content."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_CONTENT_ZIP_FORMAT_ERROR,
"This core does not support the specific ZIP format of this content."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_CONTENT_7Z_FORMAT_ERROR,
"This core does not support the specific 7Z format of this content."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_CONTENT_FORMAT,
"This core does not support the specific format of this content."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS,
"Necessary BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS_REGION_PAL,
"Necessary PAL region BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS_REGION_NTSC,
"Necessary NTSC region BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS_REGION_WORLD,
"Necessary world region BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS_REGION_USA,
"Necessary USA region BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS_REGION_JAPAN,
"Necessary Japan region BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS_REGION_EUROPE,
"Necessary Europe region BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS_REGION_BRAZIL,
"Necessary Brazil region BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_BIOS_REGION_COUNTRY,
"Necessary country specific BIOS file(s) to run this content are not present."
)
MSG_HASH(
MSG_RETROE_MISSING_SYSTEM_FILES,
"Necessary system file(s) to run this content are not present, they may be retrieved with the online updater."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING,
"This core would require a hardware rendering feature that is not available."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING_VULKAN_NOT_AVAILABLE,
"This core would require Vulkan rendering that is not available."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING_VULKAN_VERSION_ERROR,
"This core would require a Vulkan rendering version that is not available."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING_OPENGL_NOT_AVAILABLE,
"This core would require OpenGL rendering that is not available."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING_OPENGL_VERSION_ERROR,
"This core would require an OpenGL rendering version that is not available."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING_DX11_NOT_AVAILABLE,
"This core would require DirectX 11 rendering that is not available."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING_DX12_NOT_AVAILABLE,
"This core would require DirectX 12 rendering that is not available."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING_PXFMT_XRGB8888_UNSUPP,
"This core would require pixel format XRGB8888 that is not available."
)
MSG_HASH(
MSG_RETROE_HARDWARE_RENDERING_PXFMT_RGB565_UNSUPP,
"This core would require pixel format RGB565 that is not available."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_ACTION,
"This core does not support this action."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_ACTION_SERIALIZE,
"This core does not support serialization (save states)."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_ACTION_UNSERIALIZE,
"This core does not support unserialization (save state loading)."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_ACTION_UNSERIALIZE_FORMAT,
"Error encountered with save state format."
)
MSG_HASH(
MSG_RETROE_UNSUPPORTED_ACTION_CORE_OPTION_COMBI,
"This combination of core options is invalid."
)
#ifdef HAVE_GAME_AI
MSG_HASH(
MENU_ENUM_LABEL_VALUE_GAME_AI_MENU_OPTION,
Expand Down
Loading
Loading