Add .lutro scanning

When a file wih the .lutro extension is found, the ROM is added to Lutro.lpl. The name of the game is the name of the file without the extension.
This commit is contained in:
Jean-André Santoni 2016-06-29 15:07:12 +02:00
parent b409ced5ad
commit 0f18ade02a
4 changed files with 42 additions and 0 deletions

View File

@ -43,6 +43,7 @@ enum database_type
DATABASE_TYPE_NONE = 0,
DATABASE_TYPE_ITERATE,
DATABASE_TYPE_ITERATE_ZIP,
DATABASE_TYPE_ITERATE_LUTRO,
DATABASE_TYPE_SERIAL_LOOKUP,
DATABASE_TYPE_CRC_LOOKUP
};

View File

@ -186,6 +186,7 @@ uint32_t msg_hash_calculate(const char *s)
#define HASH_EXTENSION_CUE_UPPERCASE 0x0b87db22U
#define HASH_EXTENSION_ISO 0x0b8880d0U
#define HASH_EXTENSION_ISO_UPPERCASE 0x0b87f470U
#define HASH_EXTENSION_LUTRO 0x0fe37b7bU
enum msg_file_type msg_hash_to_file_type(uint32_t hash)
{
@ -294,6 +295,8 @@ enum msg_file_type msg_hash_to_file_type(uint32_t hash)
case HASH_EXTENSION_ISO:
case HASH_EXTENSION_ISO_UPPERCASE:
return FILE_TYPE_ISO;
case HASH_EXTENSION_LUTRO:
return FILE_TYPE_LUTRO;
default:
break;
}

View File

@ -106,6 +106,7 @@ enum msg_file_type
FILE_TYPE_CUE,
FILE_TYPE_ISO,
FILE_TYPE_LUTRO,
FILE_TYPE_LAST
};

View File

@ -208,6 +208,9 @@ static int task_database_iterate_playlist(
iso_get_serial(db_state, db, name, db_state->serial);
db->type = DATABASE_TYPE_SERIAL_LOOKUP;
break;
case FILE_TYPE_LUTRO:
db->type = DATABASE_TYPE_ITERATE_LUTRO;
break;
default:
db->type = DATABASE_TYPE_CRC_LOOKUP;
return file_get_crc(db_state, name, &db_state->crc);
@ -417,6 +420,38 @@ static int task_database_iterate_playlist_zip(
return 1;
}
static int task_database_iterate_playlist_lutro(
database_state_handle_t *db_state,
database_info_handle_t *db,
const char *path)
{
char db_playlist_path[PATH_MAX_LENGTH] = {0};
char game_title[PATH_MAX_LENGTH] = {0};
playlist_t *playlist = NULL;
settings_t *settings = config_get_ptr();
fill_short_pathname_representation_noext(game_title,
path, sizeof(game_title));
fill_pathname_join(db_playlist_path, settings->directory.playlist,
"Lutro.lpl", sizeof(db_playlist_path));
playlist = playlist_init(db_playlist_path, COLLECTION_SIZE);
if(!playlist_entry_exists(playlist, path, "DETECT"))
{
playlist_push(playlist, path,
game_title, "DETECT", "DETECT",
"DETECT", "Lutro.lpl");
}
playlist_write_file(playlist);
playlist_free(playlist);
return 0;
}
static int task_database_iterate_serial_lookup(
database_state_handle_t *db_state,
database_info_handle_t *db, const char *name)
@ -491,6 +526,8 @@ static int task_database_iterate(database_state_handle_t *db_state,
return task_database_iterate_playlist(db_state, db, name);
case DATABASE_TYPE_ITERATE_ZIP:
return task_database_iterate_playlist_zip(db_state, db, name);
case DATABASE_TYPE_ITERATE_LUTRO:
return task_database_iterate_playlist_lutro(db_state, db, name);
case DATABASE_TYPE_SERIAL_LOOKUP:
return task_database_iterate_serial_lookup(db_state, db, name);
case DATABASE_TYPE_CRC_LOOKUP: