Fix half-broken Replays (slippi bug?)

This commit is contained in:
Nekobit 2023-09-12 12:58:18 -04:00
parent 26282fef91
commit 041ebbf1b5
2 changed files with 10 additions and 4 deletions

View File

@ -27,9 +27,9 @@ Eina_Bool
_scroll_loop_cb(void* data) _scroll_loop_cb(void* data)
{ {
int x, y, w, h; int x, y, w, h;
elm_scroller_region_get(mainer, &x, &y, &w, &h); //elm_scroller_region_get(mainer, &x, &y, &w, &h);
y += y_mod; y += y_mod;
elm_scroller_region_show(mainer, x, y, w, h); //elm_scroller_region_show(mainer, x, y, w, h);
return EINA_TRUE; return EINA_TRUE;
} }

View File

@ -58,6 +58,7 @@ ubjson_search(unsigned char* buf, long length, char const* key, long* offset)
{ {
size_t key_len = strlen(key); size_t key_len = strlen(key);
char* start = sstrstr(buf, key, length); char* start = sstrstr(buf, key, length);
if (!start) return NULL;
start += key_len; start += key_len;
// Just 8 bits for now... // Just 8 bits for now...
uint8_t value_len = start[0]; uint8_t value_len = start[0];
@ -167,14 +168,19 @@ replays_strings(void* data, Evas_Object* obj, const char* part)
{ {
long idx = data; long idx = data;
// Check this is text for the part we're expecting // Check this is text for the part we're expecting
if (strcmp(part, "elm.text") == 0) if (strcmp(part, "elm.text") == 0 &&
/* DQ after join */
(replays[idx].p1 != NULL && replays[idx].p2 != NULL))
{ {
char* c; char* c;
asprintf(&c, "%s | %s [%s] Vs. %s [%s]", gameend2str(replays[idx].game_state), asprintf(&c, "[[%s]] %s [%s] Vs. %s [%s]", gameend2str(replays[idx].game_state),
replays[idx].p1, replays[idx].p1code, replays[idx].p1, replays[idx].p1code,
replays[idx].p2, replays[idx].p2code); replays[idx].p2, replays[idx].p2code);
return c; return c;
} }
else if (replays[idx].p1 == NULL || replays[idx].p2 == NULL)
printf("[Replay Warning] %s is a incomplete replay. Good idea to delete it.\n",
replays[idx].filename);
else else
return NULL; return NULL;
} }