Add core functionality for loading and processing game assets
- Implemented palette loading from binary files in `palette.cpp`. - Added runtime utilities for reading text and JSON files in `runtime.cpp`. - Created shape archive handling in `shape_archive.cpp`, including frame parsing and pixel decoding. - Introduced type flag loading functionality in `type_flags.cpp`. - Developed tests for combat tactics, entity dispatch entries, file system operations, fixed maps, flex archives, glob archives, map rendering, palette loading, shape archives, and type flags. - Added a Python script for importing Ghidra-exported function slices with reporting capabilities.
This commit is contained in:
parent
6ca3b18c3e
commit
8907604b84
41 changed files with 2889 additions and 0 deletions
69
rebuild/remorse/src/main.cpp
Normal file
69
rebuild/remorse/src/main.cpp
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue