@@ -38,7 +38,12 @@ static void unpack_ps2_logo(BuildAsset& build, InputStream& src, BuildConfig con
3838static void unpack_primary_volume_descriptor (BuildAsset& build, const IsoPrimaryVolumeDescriptor& pvd);
3939static void enumerate_global_wads (std::vector<UnpackInfo>& dest, BuildAsset& build, const table_of_contents& toc, InputStream& src, Game game);
4040static std::string parse_system_cnf (BuildAsset& build, const std::string& src, const IsoDirectory& root);
41- static void enumerate_level_wads (std::vector<UnpackInfo>& dest, CollectionAsset& levels, const table_of_contents& toc, InputStream& src);
41+ static void enumerate_level_wads (
42+ std::vector<UnpackInfo>& dest,
43+ CollectionAsset& levels,
44+ const table_of_contents& toc,
45+ InputStream& src,
46+ Game game);
4247static void enumerate_extra_files (std::vector<UnpackInfo>& dest, CollectionAsset& files, fs::path out, const IsoDirectory& dir, InputStream& src, const std::string& boot_elf);
4348static size_t get_global_wad_file_size (const GlobalWadInfo& global, const table_of_contents& toc);
4449
@@ -86,7 +91,7 @@ void unpack_iso(BuildAsset& dest, InputStream& src, BuildConfig config, AssetUnp
8691 verify (boot_elf_found, " Failed to find boot ELF '%s'." , boot_elf.c_str ());
8792
8893 enumerate_global_wads (files, dest, toc, src, config.game ());
89- enumerate_level_wads (files, dest.levels (SWITCH_FILES), toc, src);
94+ enumerate_level_wads (files, dest.levels (SWITCH_FILES), toc, src, config. game () );
9095 enumerate_extra_files (files, dest.files (SWITCH_FILES), " " , filesystem.root , src, boot_elf);
9196
9297 // The reported completion percentage is based on how far through the file
@@ -264,14 +269,22 @@ static void enumerate_level_wads(
264269 std::vector<UnpackInfo>& dest,
265270 CollectionAsset& levels,
266271 const table_of_contents& toc,
267- InputStream& src)
272+ InputStream& src,
273+ Game game)
268274{
269275 for (s32 i = 0 ; i < (s32) toc.levels .size (); i++) {
270276 const LevelInfo& level = toc.levels [i];
271277
272- if (level.level .has_value ()) {
273- verify_fatal (level.level ->header .size () >= 0xc );
274- s32 id = *(s32*) &level.level ->header [8 ];
278+ if (level.level .has_value () || level.audio .has_value () || level.scene .has_value ()) {
279+ s32 id;
280+ if (level.level .has_value ()) {
281+ verify_fatal (level.level ->header .size () >= 0xc );
282+ id = *(s32*) &level.level ->header [8 ];
283+ } else {
284+ verify (game == Game::UYA && i == 38 ,
285+ " Level %d doesn't have a level WAD." );
286+ id = 38 ;
287+ }
275288
276289 std::string path = generate_level_asset_path (id, levels);
277290 LevelAsset& level_asset = levels.foreign_child <LevelAsset>(path, true , id);
0 commit comments