From c146b0eb4e7db278c3996c03c82848a8efeafe4a Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Sat, 23 Nov 2024 02:00:55 -0600 Subject: [PATCH 1/2] emmo help --- CMakeLists.txt | 2 +- dZoneManager/Level.cpp | 59 +++++++++++++++++++++++++++--------------- dZoneManager/Zone.cpp | 1 + 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d9d394b2..4a6c4b235 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,7 @@ if(UNIX) endif() if(${DYNAMIC} AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - add_compile_options("-rdynamic") + add_link_options("-export-dynamic") endif() if(${GGDB}) diff --git a/dZoneManager/Level.cpp b/dZoneManager/Level.cpp index 5f35b6290..354f96230 100644 --- a/dZoneManager/Level.cpp +++ b/dZoneManager/Level.cpp @@ -131,12 +131,17 @@ void Level::ReadChunks(std::istream& file) { if (initPos == std::streamoff(0)) { //Really old chunk version file.seekg(0); Header header; - header.id = ChunkTypeID::FileInfo; //I guess? + header.id = ChunkTypeID::FileInfo; BinaryIO::BinaryRead(file, header.chunkVersion); BinaryIO::BinaryRead(file, header.chunkType); - file.ignore(1); - BinaryIO::BinaryRead(file, header.fileInfo.revision); - + uint8_t important = 0; + BinaryIO::BinaryRead(file, important); + // file.ignore(1); //probably used + if (header.chunkVersion > 36) { + LOG("DOING THINGS"); + BinaryIO::BinaryRead(file, header.fileInfo.revision); + } + // HARDCODED 3 if (header.chunkVersion >= 45) file.ignore(4); file.ignore(4 * (4 * 3)); @@ -170,25 +175,31 @@ void Level::ReadChunks(std::istream& file) { } } - for (uint32_t i = 0; i < 6; ++i) { - uint32_t count = 0; - BinaryIO::BinaryRead(file, count); - file.ignore(count); + // skydome info + uint32_t count = 0; + BinaryIO::BinaryRead(file, count); + file.ignore(count); + + if (header.chunkVersion >= 33) { + for (uint32_t i = 0; i < 5; ++i) { + uint32_t count = 0; + BinaryIO::BinaryRead(file, count); + file.ignore(count); + } } + // editor settings + if (!important && header.chunkVersion >= 37){ + file.ignore(4); - file.ignore(4); + uint32_t count = 0; + BinaryIO::BinaryRead(file, count); + file.ignore(count * 12); - uint32_t count = 0; - BinaryIO::BinaryRead(file, count); - file.ignore(count * 12); + } + header.id = ChunkTypeID::SceneObjectData; + ReadSceneObjectDataChunk(file, header); m_ChunkHeaders.insert(std::make_pair(header.id, header)); - - //Now pretend to be a normal file and read Objects chunk: - Header hdr; - hdr.id = ChunkTypeID::SceneObjectData; - ReadSceneObjectDataChunk(file, hdr); - m_ChunkHeaders.insert(std::make_pair(hdr.id, hdr)); } break; } } @@ -223,9 +234,15 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) { SceneObject obj; BinaryIO::BinaryRead(file, obj.id); BinaryIO::BinaryRead(file, obj.lot); - - /*if (header.fileInfo->version >= 0x26)*/ BinaryIO::BinaryRead(file, obj.nodeType); - /*if (header.fileInfo->version >= 0x20)*/ BinaryIO::BinaryRead(file, obj.glomId); + LOG("HEADER VERSION: %i", header.chunkVersion ); + if (header.chunkVersion >= 38) { + uint32_t tmp = 1; + BinaryIO::BinaryRead(file, tmp); + if (tmp > -1 && tmp < 11) obj.nodeType = tmp; + } + if (header.chunkVersion >= 32) { + BinaryIO::BinaryRead(file, obj.glomId); + } BinaryIO::BinaryRead(file, obj.position); BinaryIO::BinaryRead(file, obj.rotation); diff --git a/dZoneManager/Zone.cpp b/dZoneManager/Zone.cpp index 44532fc9d..1d6570754 100644 --- a/dZoneManager/Zone.cpp +++ b/dZoneManager/Zone.cpp @@ -160,6 +160,7 @@ std::string Zone::GetFilePathForZoneID() { if (zone != nullptr) { std::string toReturn = "maps/" + zone->zoneName; std::transform(toReturn.begin(), toReturn.end(), toReturn.begin(), ::tolower); + std::ranges::replace(toReturn, '\\', '/'); return toReturn; } From 79de91adaf213b38de8c1658827de949110b04ab Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Sat, 23 Nov 2024 12:19:57 -0800 Subject: [PATCH 2/2] fix parsing live data --- dZoneManager/Level.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dZoneManager/Level.cpp b/dZoneManager/Level.cpp index 354f96230..d2b67b290 100644 --- a/dZoneManager/Level.cpp +++ b/dZoneManager/Level.cpp @@ -138,7 +138,6 @@ void Level::ReadChunks(std::istream& file) { BinaryIO::BinaryRead(file, important); // file.ignore(1); //probably used if (header.chunkVersion > 36) { - LOG("DOING THINGS"); BinaryIO::BinaryRead(file, header.fileInfo.revision); } // HARDCODED 3 @@ -198,6 +197,7 @@ void Level::ReadChunks(std::istream& file) { } header.id = ChunkTypeID::SceneObjectData; + header.fileInfo.version = header.chunkVersion; ReadSceneObjectDataChunk(file, header); m_ChunkHeaders.insert(std::make_pair(header.id, header)); } break; @@ -234,13 +234,13 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) { SceneObject obj; BinaryIO::BinaryRead(file, obj.id); BinaryIO::BinaryRead(file, obj.lot); - LOG("HEADER VERSION: %i", header.chunkVersion ); - if (header.chunkVersion >= 38) { + + if (header.fileInfo.version >= 38) { uint32_t tmp = 1; BinaryIO::BinaryRead(file, tmp); if (tmp > -1 && tmp < 11) obj.nodeType = tmp; } - if (header.chunkVersion >= 32) { + if (header.fileInfo.version >= 32) { BinaryIO::BinaryRead(file, obj.glomId); }