From ac9e390b0c0b7cfab79034671510426d14a3b4ee Mon Sep 17 00:00:00 2001 From: "Chris Forseth (C4)" Date: Thu, 19 May 2022 11:44:25 -0500 Subject: [PATCH] Start parsing through the next section, OLST? --- LegoBlobReader/LegoBlobReader.cpp | 107 ++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 5 deletions(-) diff --git a/LegoBlobReader/LegoBlobReader.cpp b/LegoBlobReader/LegoBlobReader.cpp index 06a4f2c..16589b1 100644 --- a/LegoBlobReader/LegoBlobReader.cpp +++ b/LegoBlobReader/LegoBlobReader.cpp @@ -202,12 +202,12 @@ static void DisplayProgress(BinaryReader const& reader) size_t bytes_to_show = reader.get_bytes_remaining(); bytes_to_show = std::min(bytes_to_show, 16); size_t offset = reader.get_read_offset(); - printf("\nAt %u (0x%08x) into buffer... Next %u byte(s) are...\n> ", offset, offset, bytes_to_show); + printf("\n\n--== PROGRESS ==--\nAt %u (0x%08x) into buffer... Next %u byte(s) are...\n> ", offset, offset, bytes_to_show); for (size_t i = 0; i < bytes_to_show; ++i) { byte b = reader[offset + i]; printf("%02X ", b); } - printf("<\n"); + printf("<\n\n"); } //-------------------------------------------------------------------------------------------------------- @@ -251,7 +251,7 @@ static void ParseClasses(BinaryReader& reader) uint32 class_size = reader.read(0); // to skip to end of this class std::string class_id = reader.read_string(); // "Class" class_info.name = reader.read_string(); - printf("\n> Class: %s\n:", class_info.name.c_str()); + printf("\n> [%u] class: %s\n:", i, class_info.name.c_str()); uint32 some_count = reader.read(0); std::string ver_str = reader.read_string(); // "Version" @@ -269,7 +269,7 @@ static void ParseClasses(BinaryReader& reader) type_info_t const& type = Types[type_idx]; std::string mem_name = reader.read_string(); - printf(">> %s : %s;\n", mem_name.c_str(), type.name.c_str()); + printf(" %s : %s;\n", mem_name.c_str(), type.name.c_str()); class_member_info_t mem_info; mem_info.name = mem_name; @@ -306,6 +306,100 @@ static void ParseClasses(BinaryReader& reader) } } +//-------------------------------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------------------------------- +static void ParseOLST(BinaryReader& reader, size_t end_of_section) +{ + reader.read(0); // 1 - subobject count? + + reader.read(0); // skip two bytes, why? type? (0) + reader.read(0); // sub section len? 0x098c (probably how much room is left) + + std::string subobj_name = reader.read_string(); // MOBJ + reader.read(0); // 0 + reader.read(0); // 9 + + //------ + + // cut1 + std::string path0 = reader.read_string(); // cut/story/ep1/ep1_main/ep1_mainintro_sequence.scene_baked + reader.read(0); // 0x00000001 + reader.read(0); // 0x00000100 + reader.read(0); // 0x00010000 + reader.skip(3); // 3 bytes, 0x000000? + + // level1 + std::string path1 = reader.read_string(); //levels/hub/prelevels/episode_01/ep1_prelevel_01/ep1pl01_catchupcrawl.scene_baked + reader.read(0); // 1 + reader.read(0); // 0 + reader.read(0); // 0 + reader.read(0); // 0x00010100 + reader.read(0); // 0x01000000 + reader.read(0); // 0 + reader.read(0); // 0x00010000 + reader.skip(3); // ??? + + // ep1 + std::string ep01 = reader.read_string(); // Episode1 + reader.read(0); // 0 + + //------ + + + // cut + std::string cut2 = reader.read_string(); // cut/story/ep2/ep2_main/ep2_mainintro_sequence.scene_baked + reader.read(0); // 0x00000001 + reader.read(0); // 0x00000100 + reader.read(0); // 0x00010000 + reader.skip(3); // possibly uint bool, uint bool, uint bool, so would be 1, false, 1 false, 1 false? + + // level + std::string level2 = reader.read_string(); // levels/hub/prelevels/episode_02/ep2_prelevel_01/ep2pl01_catchupcrawl.scene_baked + reader.read(0); // 0x00000001 + reader.read(0); // 0 + reader.read(0); // 0 + reader.read(0); // 0x00010100 + reader.read(0); // 0x01000000 + reader.read(0); // 0 + reader.read(0); // 0x00010000 + reader.skip(3); // ??? + + // ep + std::string ep2 = reader.read_string(); // Episode2 + reader.read(0); // 0 + + //------ + + // cut + std::string cut3 = reader.read_string(); // cut/story/ep3/ep3_main/ep3_mainintro_sequence.scene_baked + reader.read(0); // 0x00000001 + reader.read(0); // 0x00000100 + reader.read(0); // 0x00010000 + reader.skip(3); // possibly uint bool, uint bool, uint bool, so would be 1, false, 1 false, 1 false? + + // level + std::string level3 = reader.read_string(); // levels/hub/prelevels/episode_03/ep3_prelevel_01/ep3pl01_catchupcrawl.scene_baked + reader.read(0); // 0x00000001 + reader.read(0); // 0 + reader.read(0); // 0 + reader.read(0); // 0x00010100 + reader.read(0); // 0x01000000 + reader.read(0); // 0 + reader.read(0); // 0x00010000 + reader.skip(3); // ??? + + // ep + std::string ep3 = reader.read_string(); // Episode3 + reader.read(0); // 0 + + //------ + + // level hub? + std::string level_hub = reader.read_string(); // Levels/Hub/Planets/Tatooine/Locations/Settlements/Tatooine_desertArea/tatooine_desertarea.scene_baked + + DisplayProgress(reader); // +} + //-------------------------------------------------------------------------------------------------------- // main file reading function //-------------------------------------------------------------------------------------------------------- @@ -339,7 +433,10 @@ static void ParseBuffer(BinaryReader& reader) std::string section_name = reader.read_string(); // "OLST" ++sections_read; - printf("Section '%s' at 0x%08x.\n", section_name.c_str(), end_of_section - section_len); + printf("Section '%s' at 0x%08x.\n", section_name.c_str(), end_of_section - section_len); + if (_strcmpi(section_name.c_str(), "OLST") == 0) { + ParseOLST(reader, end_of_section); + } reader.set_read_offset(end_of_section); // this is taking me past the end by 4; }