69 lines
3.7 KiB
C++
69 lines
3.7 KiB
C++
|
|
#include "remorse/combat_tactics.h"
|
||
|
|
#include "remorse/entity_dispatch_entry.h"
|
||
|
|
#include "remorse/file_system.h"
|
||
|
|
#include "remorse/flex_archive.h"
|
||
|
|
#include "remorse/fixed_map.h"
|
||
|
|
#include "remorse/glob_archive.h"
|
||
|
|
#include "remorse/palette.h"
|
||
|
|
#include "remorse/runtime.h"
|
||
|
|
#include "remorse/type_flags.h"
|
||
|
|
|
||
|
|
#include <filesystem>
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
int main(int argc, char** argv)
|
||
|
|
{
|
||
|
|
const std::filesystem::path manifestPath = argc > 1
|
||
|
|
? std::filesystem::path(argv[1])
|
||
|
|
: remorse::defaultManifestPath(std::filesystem::current_path());
|
||
|
|
|
||
|
|
const auto manifest = remorse::loadExportManifestSummary(manifestPath);
|
||
|
|
if (!manifest) {
|
||
|
|
std::cerr << "Could not read export manifest: " << manifestPath.string() << '\n';
|
||
|
|
return 2;
|
||
|
|
}
|
||
|
|
|
||
|
|
remorse::printStartupReport(*manifest);
|
||
|
|
remorse::EntityDispatchEntryBase entry{};
|
||
|
|
remorse::EntityDispatchEntry::initBase(&entry);
|
||
|
|
remorse::EntityDispatchEntry::setGroupId(entry, 1);
|
||
|
|
|
||
|
|
const auto gameDataRoot = remorse::findGameDataRoot(std::filesystem::current_path());
|
||
|
|
std::cout << "Game data root: " << (gameDataRoot ? gameDataRoot->path.string() : "not found") << '\n';
|
||
|
|
if (gameDataRoot) {
|
||
|
|
const auto palettePath = remorse::resolveGameDataPath(*gameDataRoot, std::filesystem::path("STATIC") / "GAMEPAL.PAL");
|
||
|
|
const auto paletteBytes = palettePath ? remorse::readBinaryFile(*palettePath) : std::nullopt;
|
||
|
|
std::cout << "GAMEPAL.PAL bytes: " << (paletteBytes ? paletteBytes->size() : 0) << '\n';
|
||
|
|
const auto palette = palettePath ? remorse::loadPalette256(*palettePath) : std::nullopt;
|
||
|
|
std::cout << "GAMEPAL.PAL colors: " << (palette ? palette->colors.size() : 0) << '\n';
|
||
|
|
|
||
|
|
const auto combatPath = remorse::resolveGameDataPath(*gameDataRoot, std::filesystem::path("STATIC") / "COMBAT.DAT");
|
||
|
|
const auto combatArchive = combatPath ? remorse::loadFlexArchive(*combatPath) : std::nullopt;
|
||
|
|
std::cout << "COMBAT.DAT populated entries: " << (combatArchive ? combatArchive->populatedEntries.size() : 0) << '\n';
|
||
|
|
const auto combatTactics = combatPath ? remorse::loadCombatTactics(*combatPath) : std::nullopt;
|
||
|
|
std::cout << "COMBAT.DAT tactics: " << (combatTactics ? combatTactics->size() : 0) << '\n';
|
||
|
|
|
||
|
|
const auto fixedPath = remorse::resolveGameDataPath(*gameDataRoot, std::filesystem::path("STATIC") / "FIXED.DAT");
|
||
|
|
const auto fixedArchive = fixedPath ? remorse::loadFixedMapArchive(*fixedPath) : std::nullopt;
|
||
|
|
std::cout << "FIXED.DAT maps: " << (fixedArchive ? fixedArchive->mapCount : 0) << '\n';
|
||
|
|
if (fixedArchive) {
|
||
|
|
for (remorse::u32 index = 0; index < fixedArchive->mapCount; ++index) {
|
||
|
|
const auto map = remorse::loadFixedMap(*fixedArchive, index);
|
||
|
|
if (map && !map->entries.empty()) {
|
||
|
|
std::cout << "FIXED.DAT first non-empty map: " << index << '\n';
|
||
|
|
std::cout << "FIXED.DAT first non-empty entries: " << map->entries.size() << '\n';
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
const auto globPath = remorse::resolveGameDataPath(*gameDataRoot, std::filesystem::path("STATIC") / "GLOB.FLX");
|
||
|
|
const auto globObjects = globPath ? remorse::loadGlobObjects(*globPath) : std::nullopt;
|
||
|
|
std::cout << "GLOB.FLX objects: " << (globObjects ? globObjects->size() : 0) << '\n';
|
||
|
|
|
||
|
|
const auto typeFlagPath = remorse::resolveGameDataPath(*gameDataRoot, std::filesystem::path("STATIC") / "TYPEFLAG.DAT");
|
||
|
|
const auto typeFlags = typeFlagPath ? remorse::loadTypeFlags(*typeFlagPath) : std::nullopt;
|
||
|
|
std::cout << "TYPEFLAG.DAT shapes: " << (typeFlags ? typeFlags->size() : 0) << '\n';
|
||
|
|
}
|
||
|
|
return 0;
|
||
|
|
}
|