mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-11-03 07:51:58 +00:00
feat: QOS (007: Quantum of Solace) support (#894)
* feat: QOS (007: Quantum of Solace) support * feat: add qos localize loader * feat: add qos stringtable loader * chore: comment about official zones * fix: add qos gfximage runtime fields * chore: remove useless dev time comments * fix: remove all `static_asserts`s from asset headers causing build fail on x64 * chore: change union ordering of qos `entryInternalData` * chore: move qos asset type enum to qos.h * fix: qos and t4 xsurface index buffer * chore: implement qos MaterialInfo struct * chore: adjust some gfxworld struct members * chore: implement qos PhysPreset and PhysConstraints * chore: fix and adjust slight inconsistencies with qos zone code * chore: reorder qos ZoneCode.lua entries in order of asset type enum * chore: remove asset types that are not actual asset types in zones * chore: check common asset arrays with static_assert * chore: rename qos assets * chore: reorder qos in templates to be in alphabetical order * chore: use function for CopyMipLevel in Dx9TextureLoader * chore: use templates for qos MapEntsDumper * chore: add missing braces in XModelToCommonConverter * chore: add generic way to peek at zone data * Qos does not use a classic ZoneHeader so code needs to be more generic * fix: do not use raw_byte and raw_uint typedefs for qos * fix: not being able to write clipmapmp * chore: additional research on qos vertex property and stuff --------- Co-authored-by: Jan Laupetin <[email protected]>
This commit is contained in:
1 parent
5c0a7257fd
commit
9f49e0e31c
142 files changed
+6000
-97
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#include "ZoneLoading.h"
|
||||
|
||||
#include "Loading/IZoneLoaderFactory.h"
|
||||
#include "Loading/ZoneDataPeeking.h"
|
||||
#include "Loading/ZoneLoader.h"
|
||||
|
||||
#include <filesystem>
|
||||
@@ -20,18 +21,14 @@ std::expected<std::unique_ptr<Zone>, std::string> ZoneLoading::LoadZone(const st
|
||||
if (!file.is_open())
|
||||
return std::unexpected(std::format("Could not open file '{}'.", path));
|
||||
|
||||
ZoneHeader header{};
|
||||
file.read(reinterpret_cast<char*>(&header), sizeof(header));
|
||||
if (file.gcount() != sizeof(header))
|
||||
return std::unexpected(std::format("Failed to read zone header from file '{}'.", path));
|
||||
|
||||
ZoneDataPeeking dataPeeking(file);
|
||||
std::unique_ptr<ZoneLoader> zoneLoader;
|
||||
for (auto game = 0u; game < static_cast<unsigned>(GameId::COUNT); game++)
|
||||
{
|
||||
const auto* factory = IZoneLoaderFactory::GetZoneLoaderFactoryForGame(static_cast<GameId>(game));
|
||||
if (factory->InspectZoneHeader(header))
|
||||
if (factory->InspectZoneHeader(dataPeeking))
|
||||
{
|
||||
zoneLoader = factory->CreateLoaderForHeader(header, zoneName, std::move(progressCallback));
|
||||
zoneLoader = factory->CreateLoaderForHeader(dataPeeking, zoneName, std::move(progressCallback));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -39,6 +36,10 @@ std::expected<std::unique_ptr<Zone>, std::string> ZoneLoading::LoadZone(const st
|
||||
if (!zoneLoader)
|
||||
return std::unexpected(std::format("Could not create factory for zone '{}'.", zoneName));
|
||||
|
||||
// Revert to beginning to make sure no peeking has advanced the read position.
|
||||
// (As different peeking logic may advance by different amounts of bytes).
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
auto loadedZone = zoneLoader->LoadZone(file);
|
||||
|
||||
file.close();
|
||||
|
||||
Reference in new issue
Block a user