(task database) optimize detect_psp_game

This commit is contained in:
twinaphex 2020-06-11 02:39:07 +02:00
parent d714520c64
commit a2184bcd07
1 changed files with 58 additions and 42 deletions

View File

@ -247,27 +247,39 @@ int detect_psp_game(intfstream_t *fd, char *game_id)
if (intfstream_read(fd, game_id, 5) > 0) if (intfstream_read(fd, game_id, 5) > 0)
{ {
bool found = false;
game_id[5] = '\0'; game_id[5] = '\0';
if (string_starts_with(game_id, "UL"))
{
if ( if (
(string_is_equal(game_id, "ULES-")) (string_is_equal(game_id, "ULES-"))
|| (string_is_equal(game_id, "ULUS-"))
|| (string_is_equal(game_id, "ULJS-")) || (string_is_equal(game_id, "ULJS-"))
|| (string_is_equal(game_id, "ULEM-")) || (string_is_equal(game_id, "ULEM-"))
|| (string_is_equal(game_id, "ULUM-")) || (string_is_equal(game_id, "ULUM-"))
|| (string_is_equal(game_id, "ULJM-")) || (string_is_equal(game_id, "ULJM-"))
|| (string_is_equal(game_id, "ULKS-"))
|| (string_is_equal(game_id, "UCES-")) || (string_is_equal(game_id, "ULAS-"))
)
found = true;
}
if (!found && string_starts_with(game_id, "UC"))
{
if (
(string_is_equal(game_id, "UCES-"))
|| (string_is_equal(game_id, "UCUS-"))
|| (string_is_equal(game_id, "UCUS-")) || (string_is_equal(game_id, "UCUS-"))
|| (string_is_equal(game_id, "UCJS-")) || (string_is_equal(game_id, "UCJS-"))
|| (string_is_equal(game_id, "UCAS-")) || (string_is_equal(game_id, "UCAS-"))
|| (string_is_equal(game_id, "UCKS-")) || (string_is_equal(game_id, "UCKS-"))
)
found = true;
}
|| (string_is_equal(game_id, "ULKS-")) if (!found && string_starts_with(game_id, "NP"))
|| (string_is_equal(game_id, "ULAS-")) {
if (
|| (string_is_equal(game_id, "NPEH-")) (string_is_equal(game_id, "NPEH-"))
|| (string_is_equal(game_id, "NPUH-")) || (string_is_equal(game_id, "NPUH-"))
|| (string_is_equal(game_id, "NPJH-")) || (string_is_equal(game_id, "NPJH-"))
@ -280,6 +292,10 @@ int detect_psp_game(intfstream_t *fd, char *game_id)
|| (string_is_equal(game_id, "NPUZ-")) || (string_is_equal(game_id, "NPUZ-"))
|| (string_is_equal(game_id, "NPJZ-")) || (string_is_equal(game_id, "NPJZ-"))
) )
found = true;
}
if (found)
{ {
intfstream_seek(fd, pos, SEEK_SET); intfstream_seek(fd, pos, SEEK_SET);
if (intfstream_read(fd, game_id, 10) > 0) if (intfstream_read(fd, game_id, 10) > 0)