Skip to content

Commit

Permalink
Fixed a bug causing a crash on boot under certain circumstances.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinnegatamante committed Sep 26, 2022
1 parent 6477acf commit c1f0806
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions selector/main.cpp
Expand Up @@ -190,38 +190,48 @@ void AppendCompatibilityDatabase(const char *file) {
bool perform_slow_check = true;
ptr += 1000; // Let's skip some data to improve performances
ptr = strstr(ptr, "\"labels\":");
char *old_ptr = ptr;
ptr = strstr(ptr + 150, "\"name\":");
ptr += 9;
if (ptr[0] == 'P') {
node->playable = true;
node->ingame_low = false;
node->ingame_plus = false;
node->crash = false;
} else if (ptr[0] == 'C') {
if (ptr) {
ptr += 9;
if (ptr[0] == 'P') {
node->playable = true;
node->ingame_low = false;
node->ingame_plus = false;
node->crash = false;
} else if (ptr[0] == 'C') {
node->playable = false;
node->ingame_low = false;
node->ingame_plus = false;
node->slow = false;
node->crash = true;
perform_slow_check = false;
} else {
node->playable = false;
node->crash = false;
end = strstr(ptr, "\"");
if ((end - ptr) == 13) {
node->ingame_plus = true;
node->ingame_low = false;
}else {
node->ingame_low = true;
node->ingame_plus = false;
}
}
ptr += 120; // Let's skip some data to improve performances
if (perform_slow_check) {
end = ptr;
ptr = strstr(ptr, "]");
if ((ptr - end) > 200) node->slow = true;
else node->slow = false;
}
} else {
ptr = old_ptr;
node->playable = false;
node->ingame_low = false;
node->ingame_plus = false;
node->slow = false;
node->crash = true;
perform_slow_check = false;
} else {
node->playable = false;
node->crash = false;
end = strstr(ptr, "\"");
if ((end - ptr) == 13) {
node->ingame_plus = true;
node->ingame_low = false;
}else {
node->ingame_low = true;
node->ingame_plus = false;
}
}
ptr += 120; // Let's skip some data to improve performances
if (perform_slow_check) {
end = ptr;
ptr = strstr(ptr, "]");
if ((ptr - end) > 200) node->slow = true;
else node->slow = false;
node->slow = false;
}

ptr += 350; // Let's skip some data to improve performances
Expand Down

0 comments on commit c1f0806

Please sign in to comment.