diff --git a/database_info.h b/database_info.h index f7c04ff8db..3a961857b7 100644 --- a/database_info.h +++ b/database_info.h @@ -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 }; diff --git a/msg_hash.c b/msg_hash.c index be704aea81..365bda5988 100644 --- a/msg_hash.c +++ b/msg_hash.c @@ -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; } diff --git a/msg_hash.h b/msg_hash.h index 73109bf7e2..5b9df3429b 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -106,6 +106,7 @@ enum msg_file_type FILE_TYPE_CUE, FILE_TYPE_ISO, + FILE_TYPE_LUTRO, FILE_TYPE_LAST }; diff --git a/tasks/task_database.c b/tasks/task_database.c index 1a41136dec..8f973245e8 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -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: