mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Cheevos) Stylistic changes; try to fit text within 80-char limit,
remove brackets around conditionals that exist out of one line, etc.
This commit is contained in:
parent
8328043897
commit
bbabbd1373
@ -279,7 +279,7 @@ static void rcheevos_filter_url_param(char* url, char* param)
|
||||
size_t param_len = strlen(param);
|
||||
char *start = strchr(url, '?');
|
||||
if (!start)
|
||||
start = url;
|
||||
start = url;
|
||||
else
|
||||
++start;
|
||||
|
||||
@ -290,11 +290,11 @@ static void rcheevos_filter_url_param(char* url, char* param)
|
||||
if (start[param_len] == '=' && memcmp(start, param, param_len) == 0)
|
||||
{
|
||||
if (next)
|
||||
strcpy(start, next + 1);
|
||||
strcpy_literal(start, next + 1);
|
||||
else if (start > url)
|
||||
start[-1] = '\0';
|
||||
else
|
||||
*start = '\0';
|
||||
*start = '\0';
|
||||
|
||||
return;
|
||||
}
|
||||
@ -361,7 +361,8 @@ static void rcheevos_log_post_url(
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool rcheevos_condset_contains_memref(const rc_condset_t* condset, const rc_memref_value_t* memref)
|
||||
static bool rcheevos_condset_contains_memref(const rc_condset_t* condset,
|
||||
const rc_memref_value_t* memref)
|
||||
{
|
||||
if (condset)
|
||||
{
|
||||
@ -377,7 +378,8 @@ static bool rcheevos_condset_contains_memref(const rc_condset_t* condset, const
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool rcheevos_trigger_contains_memref(const rc_trigger_t* trigger, const rc_memref_value_t* memref)
|
||||
static bool rcheevos_trigger_contains_memref(const rc_trigger_t* trigger,
|
||||
const rc_memref_value_t* memref)
|
||||
{
|
||||
rc_condset_t* condset;
|
||||
if (!trigger)
|
||||
@ -400,9 +402,10 @@ static void rcheevos_invalidate_address(unsigned address)
|
||||
unsigned i, count;
|
||||
rcheevos_racheevo_t* cheevo = NULL;
|
||||
rcheevos_ralboard_t* lboard = NULL;
|
||||
/* remove the invalid memref from the chain so we don't try to evaluate it in the future.
|
||||
* it's still there, so anything referencing it will continue to fetch 0.
|
||||
*/
|
||||
/* Remove the invalid memref from the chain so we don't
|
||||
* try to evaluate it in the future.
|
||||
* It's still there, so anything referencing it will
|
||||
* continue to fetch 0. */
|
||||
rc_memref_value_t **last_memref = &rcheevos_locals.runtime.memrefs;
|
||||
rc_memref_value_t *memref = *last_memref;
|
||||
|
||||
@ -416,7 +419,7 @@ static void rcheevos_invalidate_address(unsigned address)
|
||||
|
||||
last_memref = &memref->next;
|
||||
memref = *last_memref;
|
||||
} while (memref);
|
||||
} while(memref);
|
||||
|
||||
/* If the address is only used indirectly,
|
||||
* don't disable anything dependent on it */
|
||||
@ -441,11 +444,14 @@ static void rcheevos_invalidate_address(unsigned address)
|
||||
{
|
||||
if (cheevo->memaddr)
|
||||
{
|
||||
const rc_trigger_t* trigger = rc_runtime_get_achievement(&rcheevos_locals.runtime, cheevo->id);
|
||||
const rc_trigger_t* trigger = rc_runtime_get_achievement(
|
||||
&rcheevos_locals.runtime, cheevo->id);
|
||||
|
||||
if (trigger && rcheevos_trigger_contains_memref(trigger, memref))
|
||||
{
|
||||
CHEEVOS_ERR(RCHEEVOS_TAG "Achievement disabled (invalid address %06X): %s\n", address, cheevo->title);
|
||||
rc_runtime_deactivate_achievement(&rcheevos_locals.runtime, cheevo->id);
|
||||
rc_runtime_deactivate_achievement(&rcheevos_locals.runtime,
|
||||
cheevo->id);
|
||||
|
||||
CHEEVOS_FREE(cheevo->memaddr);
|
||||
cheevo->memaddr = NULL;
|
||||
@ -462,12 +468,16 @@ static void rcheevos_invalidate_address(unsigned address)
|
||||
{
|
||||
if (lboard->mem)
|
||||
{
|
||||
const rc_lboard_t* rc_lboard = rc_runtime_get_lboard(&rcheevos_locals.runtime, lboard->id);
|
||||
if (rc_lboard &&
|
||||
(rcheevos_trigger_contains_memref(&rc_lboard->start, memref) ||
|
||||
const rc_lboard_t* rc_lboard = rc_runtime_get_lboard(
|
||||
&rcheevos_locals.runtime, lboard->id);
|
||||
|
||||
if ( rc_lboard &&
|
||||
( rcheevos_trigger_contains_memref(&rc_lboard->start, memref) ||
|
||||
rcheevos_trigger_contains_memref(&rc_lboard->cancel, memref) ||
|
||||
rcheevos_trigger_contains_memref(&rc_lboard->submit, memref) ||
|
||||
rcheevos_condset_contains_memref(rc_lboard->value.conditions, memref)))
|
||||
rcheevos_condset_contains_memref(rc_lboard->value.conditions,
|
||||
memref))
|
||||
)
|
||||
{
|
||||
CHEEVOS_ERR(RCHEEVOS_TAG "Leaderboard disabled (invalid address %06X): %s\n", address, lboard->title);
|
||||
rc_runtime_deactivate_lboard(&rcheevos_locals.runtime, lboard->id);
|
||||
@ -512,7 +522,12 @@ static void rcheevos_async_award_achievement(
|
||||
{
|
||||
char buffer[256];
|
||||
settings_t *settings = config_get_ptr();
|
||||
int ret = rc_url_award_cheevo(buffer, sizeof(buffer), settings->arrays.cheevos_username, locals->token, request->id, request->hardcore, locals->hash);
|
||||
int ret = rc_url_award_cheevo(buffer, sizeof(buffer),
|
||||
settings->arrays.cheevos_username,
|
||||
locals->token,
|
||||
request->id,
|
||||
request->hardcore,
|
||||
locals->hash);
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
@ -522,11 +537,13 @@ static void rcheevos_async_award_achievement(
|
||||
}
|
||||
|
||||
rcheevos_log_url("rc_url_award_cheevo", buffer);
|
||||
task_push_http_transfer_with_user_agent(buffer, true, NULL, request->user_agent, rcheevos_async_task_callback, request);
|
||||
task_push_http_transfer_with_user_agent(buffer, true, NULL,
|
||||
request->user_agent, rcheevos_async_task_callback, request);
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
if (settings->bools.cheevos_unlock_sound_enable)
|
||||
audio_driver_mixer_play_menu_sound(AUDIO_MIXER_SYSTEM_SLOT_ACHIEVEMENT_UNLOCK);
|
||||
audio_driver_mixer_play_menu_sound(
|
||||
AUDIO_MIXER_SYSTEM_SLOT_ACHIEVEMENT_UNLOCK);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -622,44 +639,47 @@ static void rcheevos_async_schedule(
|
||||
static void rcheevos_async_task_callback(
|
||||
retro_task_t* task, void* task_data, void* user_data, const char* error)
|
||||
{
|
||||
rcheevos_async_io_request* request = (rcheevos_async_io_request*)user_data;
|
||||
http_transfer_data_t* data = (http_transfer_data_t*)task_data;
|
||||
rcheevos_async_io_request *request = (rcheevos_async_io_request*)user_data;
|
||||
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
|
||||
|
||||
if (!error)
|
||||
{
|
||||
char buffer[224] = "";
|
||||
/* Server did not return HTTP headers */
|
||||
if (!data)
|
||||
{
|
||||
/* server did not return HTTP headers */
|
||||
snprintf(buffer, sizeof(buffer), "Server communication error");
|
||||
}
|
||||
else if (data->status != 200)
|
||||
{
|
||||
/* server returned an error via status code - check to see if it also returned a JSON error */
|
||||
/* Server returned an error via status code.
|
||||
* Check to see if it also returned a JSON error */
|
||||
if (!data->data || rcheevos_get_json_error(data->data, buffer, sizeof(buffer)) != RC_OK)
|
||||
snprintf(buffer, sizeof(buffer), "HTTP error code: %d", data->status);
|
||||
snprintf(buffer, sizeof(buffer), "HTTP error code: %d",
|
||||
data->status);
|
||||
}
|
||||
else if (!data->data || !data->len)
|
||||
{
|
||||
/* server sent an empty response without an error status code */
|
||||
/* Server sent an empty response without an error status code */
|
||||
snprintf(buffer, sizeof(buffer), "No response from server");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* server sent a message - assume its JSON and check for a JSON error */
|
||||
/* Server sent a message - assume it's JSON
|
||||
* and check for a JSON error */
|
||||
rcheevos_get_json_error(data->data, buffer, sizeof(buffer));
|
||||
}
|
||||
|
||||
if (buffer[0])
|
||||
{
|
||||
char errbuf[256];
|
||||
snprintf(errbuf, sizeof(errbuf), "%s %u: %s", request->failure_message, request->id, buffer);
|
||||
snprintf(errbuf, sizeof(errbuf), "%s %u: %s",
|
||||
request->failure_message, request->id, buffer);
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", errbuf);
|
||||
|
||||
switch (request->type)
|
||||
{
|
||||
case CHEEVOS_ASYNC_RICHPRESENCE:
|
||||
/* don't bother informing user when rich presence update fails */
|
||||
/* Don't bother informing user when
|
||||
* rich presence update fails */
|
||||
break;
|
||||
|
||||
case CHEEVOS_ASYNC_AWARD_ACHIEVEMENT:
|
||||
@ -684,14 +704,19 @@ static void rcheevos_async_task_callback(
|
||||
}
|
||||
else
|
||||
{
|
||||
/* double the wait between each attempt until we hit a maximum delay of two minutes
|
||||
/* Double the wait between each attempt until we hit
|
||||
* a maximum delay of two minutes.
|
||||
* 250ms -> 500ms -> 1s -> 2s -> 4s -> 8s -> 16s -> 32s -> 64s -> 120s -> 120s... */
|
||||
retro_time_t retry_delay = (request->attempt_count > 8) ? (120 * 1000 * 1000) : ((250 * 1000) << request->attempt_count);
|
||||
retro_time_t retry_delay =
|
||||
(request->attempt_count > 8)
|
||||
? (120 * 1000 * 1000)
|
||||
: ((250 * 1000) << request->attempt_count);
|
||||
|
||||
request->attempt_count++;
|
||||
rcheevos_async_schedule(request, retry_delay);
|
||||
|
||||
CHEEVOS_ERR(RCHEEVOS_TAG "%s %u: %s\n", request->failure_message, request->id, error);
|
||||
CHEEVOS_ERR(RCHEEVOS_TAG "%s %u: %s\n", request->failure_message,
|
||||
request->id, error);
|
||||
}
|
||||
|
||||
if (data)
|
||||
@ -710,7 +735,8 @@ static void rcheevos_validate_memrefs(rcheevos_locals_t* locals)
|
||||
{
|
||||
if (!memref->memref.is_indirect)
|
||||
{
|
||||
uint8_t* data = rcheevos_memory_find(&rcheevos_locals.memory, memref->memref.address);
|
||||
uint8_t* data = rcheevos_memory_find(&rcheevos_locals.memory,
|
||||
memref->memref.address);
|
||||
if (!data)
|
||||
rcheevos_invalidate_address(memref->memref.address);
|
||||
}
|
||||
@ -722,14 +748,15 @@ static void rcheevos_validate_memrefs(rcheevos_locals_t* locals)
|
||||
static void rcheevos_activate_achievements(rcheevos_locals_t *locals,
|
||||
rcheevos_racheevo_t* cheevo, unsigned count, unsigned flags)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
char buffer[256];
|
||||
unsigned i;
|
||||
int res;
|
||||
unsigned i;
|
||||
char buffer[256];
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for (i = 0; i < count; i++, cheevo++)
|
||||
{
|
||||
res = rc_runtime_activate_achievement(&locals->runtime, cheevo->id, cheevo->memaddr, NULL, 0);
|
||||
res = rc_runtime_activate_achievement(&locals->runtime, cheevo->id,
|
||||
cheevo->memaddr, NULL, 0);
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
@ -738,7 +765,8 @@ static void rcheevos_activate_achievements(rcheevos_locals_t *locals,
|
||||
cheevo->id, cheevo->title, rc_error_str(res));
|
||||
|
||||
if (settings->bools.cheevos_verbose_enable)
|
||||
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
|
||||
CHEEVOS_ERR(RCHEEVOS_TAG "%s: mem %s\n", buffer, cheevo->memaddr);
|
||||
CHEEVOS_FREE(cheevo->memaddr);
|
||||
@ -746,7 +774,10 @@ static void rcheevos_activate_achievements(rcheevos_locals_t *locals,
|
||||
continue;
|
||||
}
|
||||
|
||||
cheevo->active = RCHEEVOS_ACTIVE_SOFTCORE | RCHEEVOS_ACTIVE_HARDCORE | flags;
|
||||
cheevo->active =
|
||||
RCHEEVOS_ACTIVE_SOFTCORE
|
||||
| RCHEEVOS_ACTIVE_HARDCORE
|
||||
| flags;
|
||||
}
|
||||
}
|
||||
|
||||
@ -762,9 +793,9 @@ static int rcheevos_parse(rcheevos_locals_t *locals, const char* json)
|
||||
|
||||
if (res != 0)
|
||||
{
|
||||
char* ptr = NULL;
|
||||
char *ptr = NULL;
|
||||
strcpy_literal(buffer, "Error retrieving achievement data: ");
|
||||
ptr = buffer + strlen(buffer);
|
||||
ptr = buffer + strlen(buffer);
|
||||
|
||||
/* Extract the Error field from the JSON.
|
||||
* If not found, remove the colon from the message. */
|
||||
@ -807,17 +838,17 @@ static int rcheevos_parse(rcheevos_locals_t *locals, const char* json)
|
||||
rcheevos_locals.core_supports = false;
|
||||
|
||||
if (settings->bools.cheevos_verbose_enable)
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CANNOT_ACTIVATE_ACHIEVEMENTS_WITH_THIS_CORE),
|
||||
0, 4 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
|
||||
}
|
||||
0, 4 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
|
||||
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize. */
|
||||
rcheevos_activate_achievements(locals, locals->patchdata.core, locals->patchdata.core_count, 0);
|
||||
rcheevos_activate_achievements(locals, locals->patchdata.core,
|
||||
locals->patchdata.core_count, 0);
|
||||
|
||||
if (settings->bools.cheevos_test_unofficial)
|
||||
rcheevos_activate_achievements(locals, locals->patchdata.unofficial,
|
||||
@ -830,7 +861,8 @@ static int rcheevos_parse(rcheevos_locals_t *locals, const char* json)
|
||||
|
||||
for (j = 0; j < count; j++, lboard++)
|
||||
{
|
||||
res = rc_runtime_activate_lboard(&locals->runtime, lboard->id, lboard->mem, NULL, 0);
|
||||
res = rc_runtime_activate_lboard(&locals->runtime, lboard->id,
|
||||
lboard->mem, NULL, 0);
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
@ -839,7 +871,8 @@ static int rcheevos_parse(rcheevos_locals_t *locals, const char* json)
|
||||
lboard->id, lboard->title, rc_error_str(res));
|
||||
|
||||
if (settings->bools.cheevos_verbose_enable)
|
||||
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
|
||||
CHEEVOS_ERR(RCHEEVOS_TAG "%s mem: %s\n", buffer, lboard->mem);
|
||||
CHEEVOS_FREE(lboard->mem);
|
||||
@ -853,7 +886,8 @@ static int rcheevos_parse(rcheevos_locals_t *locals, const char* json)
|
||||
if ( locals->patchdata.richpresence_script
|
||||
&& *locals->patchdata.richpresence_script)
|
||||
{
|
||||
res = rc_runtime_activate_richpresence(&locals->runtime, locals->patchdata.richpresence_script, NULL, 0);
|
||||
res = rc_runtime_activate_richpresence(&locals->runtime,
|
||||
locals->patchdata.richpresence_script, NULL, 0);
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
@ -862,7 +896,8 @@ static int rcheevos_parse(rcheevos_locals_t *locals, const char* json)
|
||||
rc_error_str(res));
|
||||
|
||||
if (settings->bools.cheevos_verbose_enable)
|
||||
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
|
||||
CHEEVOS_ERR(RCHEEVOS_TAG "%s\n", buffer);
|
||||
}
|
||||
@ -877,8 +912,10 @@ static int rcheevos_parse(rcheevos_locals_t *locals, const char* json)
|
||||
|
||||
if (locals->runtime.richpresence_display_buffer)
|
||||
{
|
||||
memcpy(locals->runtime.richpresence_display_buffer, "Playing ", 8);
|
||||
memcpy(&locals->runtime.richpresence_display_buffer[8], locals->patchdata.title, len + 1);
|
||||
memcpy(locals->runtime.richpresence_display_buffer,
|
||||
"Playing ", 8);
|
||||
memcpy(&locals->runtime.richpresence_display_buffer[8],
|
||||
locals->patchdata.title, len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -925,7 +962,8 @@ static rcheevos_racheevo_t* rcheevos_find_cheevo(unsigned id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void rcheevos_award_achievement(rcheevos_locals_t *locals, rcheevos_racheevo_t* cheevo, bool widgets_ready)
|
||||
static void rcheevos_award_achievement(rcheevos_locals_t *locals,
|
||||
rcheevos_racheevo_t* cheevo, bool widgets_ready)
|
||||
{
|
||||
char buffer[256] = "";
|
||||
|
||||
@ -950,9 +988,12 @@ static void rcheevos_award_achievement(rcheevos_locals_t *locals, rcheevos_rache
|
||||
else
|
||||
#endif
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer), "Achievement Unlocked: %s", cheevo->title);
|
||||
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
runloop_msg_queue_push(cheevo->description, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Achievement Unlocked: %s", cheevo->title);
|
||||
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
runloop_msg_queue_push(cheevo->description, 0, 3 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -986,10 +1027,15 @@ static void rcheevos_award_achievement(rcheevos_locals_t *locals, rcheevos_rache
|
||||
|
||||
if (take_screenshot(settings->paths.directory_screenshot,
|
||||
shotname, true,
|
||||
video_driver_cached_frame_has_valid_framebuffer(), false, true))
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Captured screenshot for achievement %u\n", cheevo->id);
|
||||
video_driver_cached_frame_has_valid_framebuffer(),
|
||||
false, true))
|
||||
CHEEVOS_LOG(
|
||||
RCHEEVOS_TAG "Captured screenshot for achievement %u\n",
|
||||
cheevo->id);
|
||||
else
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Failed to capture screenshot for achievement %u\n", cheevo->id);
|
||||
CHEEVOS_LOG(
|
||||
RCHEEVOS_TAG "Failed to capture screenshot for achievement %u\n",
|
||||
cheevo->id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1000,7 +1046,7 @@ static void rcheevos_async_submit_lboard(rcheevos_locals_t *locals,
|
||||
{
|
||||
char buffer[256];
|
||||
settings_t *settings = config_get_ptr();
|
||||
int ret = rc_url_submit_lboard(buffer, sizeof(buffer),
|
||||
int ret = rc_url_submit_lboard(buffer, sizeof(buffer),
|
||||
settings->arrays.cheevos_username,
|
||||
locals->token, request->id, request->value);
|
||||
|
||||
@ -1012,7 +1058,8 @@ static void rcheevos_async_submit_lboard(rcheevos_locals_t *locals,
|
||||
}
|
||||
|
||||
rcheevos_log_url("rc_url_submit_lboard", buffer);
|
||||
task_push_http_transfer_with_user_agent(buffer, true, NULL, request->user_agent, rcheevos_async_task_callback, request);
|
||||
task_push_http_transfer_with_user_agent(buffer, true, NULL,
|
||||
request->user_agent, rcheevos_async_task_callback, request);
|
||||
}
|
||||
|
||||
static rcheevos_ralboard_t* rcheevos_find_lboard(unsigned id)
|
||||
@ -1036,12 +1083,15 @@ static void rcheevos_lboard_submit(rcheevos_locals_t *locals,
|
||||
char formatted_value[16];
|
||||
|
||||
/* Show the OSD message (regardless of notifications setting). */
|
||||
rc_format_value(formatted_value, sizeof(formatted_value), value, lboard->format);
|
||||
rc_format_value(formatted_value, sizeof(formatted_value),
|
||||
value, lboard->format);
|
||||
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Submitting %s for leaderboard %u\n", formatted_value, lboard->id);
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Submitting %s for leaderboard %u\n",
|
||||
formatted_value, lboard->id);
|
||||
snprintf(buffer, sizeof(buffer), "Submitted %s for %s",
|
||||
formatted_value, lboard->title);
|
||||
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
/* Hide the tracker */
|
||||
@ -1051,10 +1101,13 @@ static void rcheevos_lboard_submit(rcheevos_locals_t *locals,
|
||||
|
||||
/* Start the submit task. */
|
||||
{
|
||||
rcheevos_async_io_request* request = (rcheevos_async_io_request*)calloc(1, sizeof(rcheevos_async_io_request));
|
||||
request->type = CHEEVOS_ASYNC_SUBMIT_LBOARD;
|
||||
request->id = lboard->id;
|
||||
request->value = value;
|
||||
rcheevos_async_io_request
|
||||
*request = (rcheevos_async_io_request*)
|
||||
calloc(1, sizeof(rcheevos_async_io_request));
|
||||
|
||||
request->type = CHEEVOS_ASYNC_SUBMIT_LBOARD;
|
||||
request->id = lboard->id;
|
||||
request->value = value;
|
||||
request->success_message = "Submitted leaderboard";
|
||||
request->failure_message = "Error submitting leaderboard";
|
||||
rcheevos_get_user_agent(locals,
|
||||
@ -1070,7 +1123,8 @@ static void rcheevos_lboard_canceled(rcheevos_ralboard_t * lboard,
|
||||
if (!lboard)
|
||||
return;
|
||||
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Leaderboard %u canceled: %s\n", lboard->id, lboard->title);
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Leaderboard %u canceled: %s\n",
|
||||
lboard->id, lboard->title);
|
||||
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
if (widgets_ready)
|
||||
@ -1079,7 +1133,8 @@ static void rcheevos_lboard_canceled(rcheevos_ralboard_t * lboard,
|
||||
|
||||
if (rcheevos_locals.leaderboard_notifications)
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer), "Leaderboard attempt failed: %s", lboard->title);
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Leaderboard attempt failed: %s", lboard->title);
|
||||
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
@ -1092,7 +1147,8 @@ static void rcheevos_lboard_started(rcheevos_ralboard_t * lboard, int value,
|
||||
if (!lboard)
|
||||
return;
|
||||
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Leaderboard %u started: %s\n", lboard->id, lboard->title);
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Leaderboard %u started: %s\n",
|
||||
lboard->id, lboard->title);
|
||||
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
if (widgets_ready && rcheevos_locals.leaderboard_trackers)
|
||||
@ -1105,9 +1161,13 @@ static void rcheevos_lboard_started(rcheevos_ralboard_t * lboard, int value,
|
||||
if (rcheevos_locals.leaderboard_notifications)
|
||||
{
|
||||
if (lboard->description && *lboard->description)
|
||||
snprintf(buffer, sizeof(buffer), "Leaderboard attempt started: %s - %s", lboard->title, lboard->description);
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Leaderboard attempt started: %s - %s",
|
||||
lboard->title, lboard->description);
|
||||
else
|
||||
snprintf(buffer, sizeof(buffer), "Leaderboard attempt started: %s", lboard->title);
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Leaderboard attempt started: %s",
|
||||
lboard->title);
|
||||
|
||||
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
@ -1151,42 +1211,48 @@ void rcheevos_reset_game(bool widgets_ready)
|
||||
|
||||
rc_runtime_reset(&rcheevos_locals.runtime);
|
||||
|
||||
/* some cores reallocate memory on reset, make sure we update our pointers */
|
||||
/* Some cores reallocate memory on reset,
|
||||
* make sure we update our pointers */
|
||||
if (rcheevos_locals.memory.total_size > 0)
|
||||
rcheevos_memory_init(&rcheevos_locals.memory, rcheevos_locals.patchdata.console_id);
|
||||
rcheevos_memory_init(
|
||||
&rcheevos_locals.memory,
|
||||
rcheevos_locals.patchdata.console_id);
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
void rcheevos_get_achievement_state(unsigned index,
|
||||
char *buffer, size_t len)
|
||||
{
|
||||
rcheevos_racheevo_t* cheevo;
|
||||
enum msg_hash_enums enum_idx;
|
||||
bool check_measured = false;
|
||||
rcheevos_racheevo_t *cheevo = NULL;
|
||||
bool check_measured = false;
|
||||
|
||||
if (index < rcheevos_locals.patchdata.core_count)
|
||||
{
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY;
|
||||
cheevo = rcheevos_locals.patchdata.core ? &rcheevos_locals.patchdata.core[index] : NULL;
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY;
|
||||
if (rcheevos_locals.patchdata.core)
|
||||
cheevo = &rcheevos_locals.patchdata.core[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNOFFICIAL_ENTRY;
|
||||
cheevo = rcheevos_locals.patchdata.unofficial ? &rcheevos_locals.patchdata.unofficial[index - rcheevos_locals.patchdata.core_count] : NULL;
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNOFFICIAL_ENTRY;
|
||||
if (rcheevos_locals.patchdata.unofficial)
|
||||
cheevo = &rcheevos_locals.patchdata.unofficial[index -
|
||||
rcheevos_locals.patchdata.core_count];
|
||||
}
|
||||
|
||||
if (!cheevo || !cheevo->memaddr)
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNSUPPORTED_ENTRY;
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNSUPPORTED_ENTRY;
|
||||
else if (!(cheevo->active & RCHEEVOS_ACTIVE_HARDCORE))
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE;
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE;
|
||||
else if (!(cheevo->active & RCHEEVOS_ACTIVE_SOFTCORE))
|
||||
{
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY;
|
||||
/* if in hardcore mode, track progress towards hardcore unlock */
|
||||
check_measured = rcheevos_locals.hardcore_active;
|
||||
|
||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY;
|
||||
}
|
||||
/* Use either "Locked" for core or "Unofficial" for unofficial as set above and track progress */
|
||||
/* Use either "Locked" for core or "Unofficial"
|
||||
* for unofficial as set above and track progress */
|
||||
else
|
||||
check_measured = true;
|
||||
|
||||
@ -1194,22 +1260,26 @@ void rcheevos_get_achievement_state(unsigned index,
|
||||
|
||||
if (check_measured)
|
||||
{
|
||||
const rc_trigger_t* trigger = rc_runtime_get_achievement(&rcheevos_locals.runtime, cheevo->id);
|
||||
const unsigned int target = trigger->measured_target;
|
||||
const rc_trigger_t* trigger = rc_runtime_get_achievement(
|
||||
&rcheevos_locals.runtime, cheevo->id);
|
||||
const unsigned int target = trigger->measured_target;
|
||||
|
||||
if (target > 0 && trigger->measured_value > 0)
|
||||
{
|
||||
char measured_buffer[12];
|
||||
const unsigned int value = MIN(trigger->measured_value, target);
|
||||
const int percent = (int)(((unsigned long)value) * 100 / target);
|
||||
|
||||
snprintf(measured_buffer, sizeof(measured_buffer), " - %d%%", percent);
|
||||
snprintf(measured_buffer, sizeof(measured_buffer),
|
||||
" - %d%%", percent);
|
||||
strlcat(buffer, measured_buffer, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rcheevos_append_menu_achievement(
|
||||
menu_displaylist_info_t* info, size_t idx, rcheevos_racheevo_t* cheevo)
|
||||
menu_displaylist_info_t* info, size_t idx,
|
||||
rcheevos_racheevo_t* cheevo)
|
||||
{
|
||||
bool badge_grayscale;
|
||||
|
||||
@ -1217,6 +1287,10 @@ static void rcheevos_append_menu_achievement(
|
||||
cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY,
|
||||
(unsigned)(MENU_SETTINGS_CHEEVOS_START + idx), 0, 0);
|
||||
|
||||
/* TODO/FIXME - can we refactor this?
|
||||
* Make badge_grayscale true by default, then
|
||||
* have one conditional (second one here) that sets it
|
||||
* to false */
|
||||
if (!cheevo->memaddr)
|
||||
badge_grayscale = true; /* unsupported */
|
||||
else if (!(cheevo->active & RCHEEVOS_ACTIVE_HARDCORE) ||
|
||||
@ -1359,10 +1433,9 @@ bool rcheevos_get_description(rcheevos_ctx_desc_t* desc)
|
||||
{
|
||||
idx -= rcheevos_locals.patchdata.core_count;
|
||||
|
||||
if (idx < rcheevos_locals.patchdata.unofficial_count)
|
||||
cheevo = rcheevos_locals.patchdata.unofficial + idx;
|
||||
else
|
||||
if (idx >= rcheevos_locals.patchdata.unofficial_count)
|
||||
return true;
|
||||
cheevo = rcheevos_locals.patchdata.unofficial + idx;
|
||||
}
|
||||
|
||||
strlcpy(desc->s, cheevo->description, desc->len);
|
||||
@ -1424,7 +1497,8 @@ bool rcheevos_unload(void)
|
||||
|
||||
rc_runtime_destroy(&rcheevos_locals.runtime);
|
||||
|
||||
/* if the config-level token has been cleared, we need to re-login on loading the next game */
|
||||
/* If the config-level token has been cleared,
|
||||
* we need to re-login on loading the next game */
|
||||
if (!settings->arrays.cheevos_token[0])
|
||||
rcheevos_locals.token[0] = '\0';
|
||||
|
||||
@ -1434,13 +1508,16 @@ bool rcheevos_unload(void)
|
||||
static void rcheevos_toggle_hardcore_achievements(rcheevos_locals_t *locals,
|
||||
rcheevos_racheevo_t* cheevo, unsigned count)
|
||||
{
|
||||
const unsigned active_mask = RCHEEVOS_ACTIVE_SOFTCORE | RCHEEVOS_ACTIVE_HARDCORE;
|
||||
const unsigned active_mask =
|
||||
RCHEEVOS_ACTIVE_SOFTCORE | RCHEEVOS_ACTIVE_HARDCORE;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
if (cheevo->memaddr && (cheevo->active & active_mask) == RCHEEVOS_ACTIVE_HARDCORE)
|
||||
if (cheevo->memaddr && (cheevo->active & active_mask)
|
||||
== RCHEEVOS_ACTIVE_HARDCORE)
|
||||
{
|
||||
/* player has unlocked achievement in non-hardcore but has not unlocked in hardcore; toggle state */
|
||||
/* player has unlocked achievement in non-hardcore,
|
||||
* but has not unlocked in hardcore. Toggle state */
|
||||
if (locals->hardcore_active)
|
||||
{
|
||||
rc_runtime_activate_achievement(&locals->runtime, cheevo->id, cheevo->memaddr, NULL, 0);
|
||||
@ -1465,7 +1542,8 @@ static void rcheevos_activate_leaderboards(rcheevos_locals_t* locals)
|
||||
for (i = 0; i < locals->patchdata.lboard_count; ++i, ++lboard)
|
||||
{
|
||||
if (lboard->mem)
|
||||
rc_runtime_activate_lboard(&locals->runtime, lboard->id, lboard->mem, NULL, 0);
|
||||
rc_runtime_activate_lboard(&locals->runtime, lboard->id,
|
||||
lboard->mem, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1490,9 +1568,9 @@ static void rcheevos_deactivate_leaderboards(rcheevos_locals_t* locals)
|
||||
|
||||
void rcheevos_leaderboards_enabled_changed(void)
|
||||
{
|
||||
const settings_t* settings = config_get_ptr();
|
||||
const bool leaderboards_enabled = rcheevos_locals.leaderboards_enabled;
|
||||
const bool leaderboard_trackers = rcheevos_locals.leaderboard_trackers;
|
||||
const settings_t* settings = config_get_ptr();
|
||||
const bool leaderboards_enabled = rcheevos_locals.leaderboards_enabled;
|
||||
const bool leaderboard_trackers = rcheevos_locals.leaderboard_trackers;
|
||||
|
||||
rcheevos_locals.leaderboards_enabled = rcheevos_hardcore_active();
|
||||
|
||||
@ -1502,22 +1580,24 @@ void rcheevos_leaderboards_enabled_changed(void)
|
||||
rcheevos_locals.leaderboard_trackers = true;
|
||||
}
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
else if (string_is_equal(settings->arrays.cheevos_leaderboards_enable, "trackers"))
|
||||
else if (string_is_equal(
|
||||
settings->arrays.cheevos_leaderboards_enable, "trackers"))
|
||||
{
|
||||
rcheevos_locals.leaderboard_notifications = false;
|
||||
rcheevos_locals.leaderboard_trackers = true;
|
||||
rcheevos_locals.leaderboard_trackers = true;
|
||||
}
|
||||
else if (string_is_equal(settings->arrays.cheevos_leaderboards_enable, "notifications"))
|
||||
else if (string_is_equal(
|
||||
settings->arrays.cheevos_leaderboards_enable, "notifications"))
|
||||
{
|
||||
rcheevos_locals.leaderboard_notifications = true;
|
||||
rcheevos_locals.leaderboard_trackers = false;
|
||||
rcheevos_locals.leaderboard_trackers = false;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
rcheevos_locals.leaderboards_enabled = false;
|
||||
rcheevos_locals.leaderboards_enabled = false;
|
||||
rcheevos_locals.leaderboard_notifications = false;
|
||||
rcheevos_locals.leaderboard_trackers = false;
|
||||
rcheevos_locals.leaderboard_trackers = false;
|
||||
}
|
||||
|
||||
if (rcheevos_locals.loaded)
|
||||
@ -1534,8 +1614,8 @@ void rcheevos_leaderboards_enabled_changed(void)
|
||||
if (!rcheevos_locals.leaderboard_trackers && leaderboard_trackers)
|
||||
{
|
||||
/* Hide any visible trackers */
|
||||
rcheevos_ralboard_t* lboard = rcheevos_locals.patchdata.lboards;
|
||||
unsigned i;
|
||||
rcheevos_ralboard_t* lboard = rcheevos_locals.patchdata.lboards;
|
||||
|
||||
for (i = 0; i < rcheevos_locals.patchdata.lboard_count; ++i, ++lboard)
|
||||
{
|
||||
@ -1550,20 +1630,20 @@ void rcheevos_leaderboards_enabled_changed(void)
|
||||
static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
|
||||
{
|
||||
settings_t* settings = config_get_ptr();
|
||||
bool rewind_enable = settings->bools.rewind_enable;
|
||||
bool rewind_enable = settings->bools.rewind_enable;
|
||||
|
||||
if (!locals->hardcore_active)
|
||||
{
|
||||
/* activate hardcore */
|
||||
/* Activate hardcore */
|
||||
locals->hardcore_active = true;
|
||||
|
||||
/* if one or more invalid settings is enabled, abort*/
|
||||
/* If one or more invalid settings is enabled, abort*/
|
||||
rcheevos_validate_config_settings();
|
||||
if (!locals->hardcore_active)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_CHEATS
|
||||
/* if one or more emulator managed cheats is active, abort */
|
||||
/* If one or more emulator managed cheats is active, abort */
|
||||
cheat_manager_apply_cheats();
|
||||
if (!locals->hardcore_active)
|
||||
return;
|
||||
@ -1576,7 +1656,7 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
|
||||
runloop_msg_queue_push(msg, 0, 3 * 60, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
|
||||
/* reactivate leaderboards */
|
||||
/* Reactivate leaderboards */
|
||||
if (locals->leaderboards_enabled)
|
||||
rcheevos_activate_leaderboards(locals);
|
||||
|
||||
@ -1588,7 +1668,9 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
|
||||
if (rewind_enable)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
/* have to "schedule" this. CMD_EVENT_REWIND_DEINIT should only be called on the main thread */
|
||||
/* have to "schedule" this.
|
||||
* CMD_EVENT_REWIND_DEINIT should
|
||||
* only be called on the main thread */
|
||||
rcheevos_locals.queued_command = CMD_EVENT_REWIND_DEINIT;
|
||||
#else
|
||||
command_event(CMD_EVENT_REWIND_DEINIT, NULL);
|
||||
@ -1612,7 +1694,9 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
|
||||
if (rewind_enable)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
/* have to "schedule" this. CMD_EVENT_REWIND_INIT should only be called on the main thread */
|
||||
/* have to "schedule" this.
|
||||
* CMD_EVENT_REWIND_INIT should
|
||||
* only be called on the main thread */
|
||||
rcheevos_locals.queued_command = CMD_EVENT_REWIND_INIT;
|
||||
#else
|
||||
command_event(CMD_EVENT_REWIND_INIT, NULL);
|
||||
@ -1622,19 +1706,18 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
|
||||
|
||||
if (locals->loaded)
|
||||
{
|
||||
rcheevos_toggle_hardcore_achievements(locals, locals->patchdata.core, locals->patchdata.core_count);
|
||||
rcheevos_toggle_hardcore_achievements(locals,
|
||||
locals->patchdata.core, locals->patchdata.core_count);
|
||||
if (settings->bools.cheevos_test_unofficial)
|
||||
{
|
||||
rcheevos_toggle_hardcore_achievements(locals,
|
||||
locals->patchdata.unofficial, locals->patchdata.unofficial_count);
|
||||
}
|
||||
locals->patchdata.unofficial,
|
||||
locals->patchdata.unofficial_count);
|
||||
}
|
||||
}
|
||||
|
||||
void rcheevos_toggle_hardcore_paused(void)
|
||||
{
|
||||
settings_t* settings = config_get_ptr();
|
||||
|
||||
/* if hardcore mode is not enabled, we can't toggle it */
|
||||
if (settings->bools.cheevos_hardcore_mode_enable)
|
||||
rcheevos_toggle_hardcore_active(&rcheevos_locals);
|
||||
@ -1643,7 +1726,9 @@ void rcheevos_toggle_hardcore_paused(void)
|
||||
void rcheevos_hardcore_enabled_changed(void)
|
||||
{
|
||||
const settings_t* settings = config_get_ptr();
|
||||
const bool enabled = settings && settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable;
|
||||
const bool enabled = settings
|
||||
&& settings->bools.cheevos_enable
|
||||
&& settings->bools.cheevos_hardcore_mode_enable;
|
||||
|
||||
if (enabled != rcheevos_locals.hardcore_active)
|
||||
{
|
||||
@ -1667,38 +1752,38 @@ typedef struct rc_disallowed_core_settings_t
|
||||
} rc_disallowed_core_settings_t;
|
||||
|
||||
static const rc_disallowed_setting_t _rc_disallowed_dolphin_settings[] = {
|
||||
{ "dolphin_cheats_enabled", "enabled" },
|
||||
{ "dolphin_cheats_enabled", "enabled" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static const rc_disallowed_setting_t _rc_disallowed_ecwolf_settings[] = {
|
||||
{ "ecwolf-invulnerability", "enabled" },
|
||||
{ "ecwolf-invulnerability", "enabled" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static const rc_disallowed_setting_t _rc_disallowed_fbneo_settings[] = {
|
||||
{ "fbneo-allow-patched-romsets", "enabled" },
|
||||
{ "fbneo-cheat-*", "!,Disabled,0 - Disabled" },
|
||||
{ "fbneo-cheat-*", "!,Disabled,0 - Disabled" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static const rc_disallowed_setting_t _rc_disallowed_gpgx_settings[] = {
|
||||
{ "genesis_plus_gx_lock_on", ",action replay (pro),game genie" },
|
||||
{ "genesis_plus_gx_lock_on", ",action replay (pro),game genie" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static const rc_disallowed_setting_t _rc_disallowed_ppsspp_settings[] = {
|
||||
{ "ppsspp_cheats", "enabled" },
|
||||
{ "ppsspp_cheats", "enabled" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static const rc_disallowed_core_settings_t rc_disallowed_core_settings[] = {
|
||||
{ "dolphin-emu", _rc_disallowed_dolphin_settings },
|
||||
{ "ecwolf", _rc_disallowed_ecwolf_settings },
|
||||
{ "FinalBurn Neo", _rc_disallowed_fbneo_settings },
|
||||
{ "dolphin-emu", _rc_disallowed_dolphin_settings },
|
||||
{ "ecwolf", _rc_disallowed_ecwolf_settings },
|
||||
{ "FinalBurn Neo", _rc_disallowed_fbneo_settings },
|
||||
{ "Genesis Plus GX", _rc_disallowed_gpgx_settings },
|
||||
{ "PPSSPP", _rc_disallowed_ppsspp_settings },
|
||||
{ NULL, NULL }
|
||||
{ "PPSSPP", _rc_disallowed_ppsspp_settings },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static int rcheevos_match_value(const char* val, const char* match)
|
||||
@ -1731,7 +1816,8 @@ static int rcheevos_match_value(const char* val, const char* match)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* a leading exclamation point means the provided value(s) are not forbidden (are allowed) */
|
||||
/* a leading exclamation point means the provided value(s)
|
||||
* are not forbidden (are allowed) */
|
||||
if (*match == '!')
|
||||
return !rcheevos_match_value(val, &match[1]);
|
||||
|
||||
@ -1773,7 +1859,9 @@ void rcheevos_validate_config_settings(void)
|
||||
if (string_starts_with_size(
|
||||
coreopts->opts[i].key, key, key_len - 1))
|
||||
{
|
||||
const char* val = core_option_manager_get_val(coreopts, i);
|
||||
const char* val = core_option_manager_get_val(
|
||||
coreopts, i);
|
||||
|
||||
if (val)
|
||||
{
|
||||
if (rcheevos_match_value(
|
||||
@ -1811,7 +1899,7 @@ void rcheevos_validate_config_settings(void)
|
||||
rcheevos_pause_hardcore();
|
||||
|
||||
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1884,10 +1972,10 @@ void rcheevos_test(void)
|
||||
/* we were unable to initialize memory earlier, try now */
|
||||
if (!rcheevos_memory_init(&rcheevos_locals.memory, rcheevos_locals.patchdata.console_id))
|
||||
{
|
||||
const settings_t* settings = config_get_ptr();
|
||||
const settings_t* settings = config_get_ptr();
|
||||
rcheevos_locals.core_supports = false;
|
||||
|
||||
CHEEVOS_ERR(RCHEEVOS_TAG "No memory exposed by core\n");
|
||||
rcheevos_locals.core_supports = false;
|
||||
|
||||
if (settings && settings->bools.cheevos_verbose_enable)
|
||||
{
|
||||
@ -1910,7 +1998,6 @@ size_t rcheevos_get_serialize_size(void)
|
||||
{
|
||||
if (!rcheevos_locals.loaded)
|
||||
return 0;
|
||||
|
||||
return rc_runtime_progress_size(&rcheevos_locals.runtime, NULL);
|
||||
}
|
||||
|
||||
@ -1918,7 +2005,6 @@ bool rcheevos_get_serialized_data(void* buffer)
|
||||
{
|
||||
if (!rcheevos_locals.loaded)
|
||||
return false;
|
||||
|
||||
return (rc_runtime_serialize_progress(buffer, &rcheevos_locals.runtime, NULL) == RC_OK);
|
||||
}
|
||||
|
||||
@ -2135,20 +2221,19 @@ static int rcheevos_iterate(rcheevos_coro_t* coro)
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
if (rcheevos_locals.patchdata.core_count == 0
|
||||
&& rcheevos_locals.patchdata.unofficial_count == 0
|
||||
&& rcheevos_locals.patchdata.lboard_count == 0)
|
||||
if ( rcheevos_locals.patchdata.core_count == 0
|
||||
&& rcheevos_locals.patchdata.unofficial_count == 0
|
||||
&& rcheevos_locals.patchdata.lboard_count == 0
|
||||
)
|
||||
{
|
||||
runloop_msg_queue_push(
|
||||
"This game has no achievements.",
|
||||
0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
"This game has no achievements.",
|
||||
0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
|
||||
rcheevos_pause_hardcore();
|
||||
}
|
||||
else
|
||||
{
|
||||
rcheevos_locals.loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_REWIND
|
||||
|
Loading…
x
Reference in New Issue
Block a user