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.
2026-04-27 21:15:01 +02:00
|
|
|
#include "remorse/file_system.h"
|
|
|
|
|
#include "remorse/shape_archive.h"
|
|
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
const auto root = remorse::findGameDataRoot(std::filesystem::current_path());
|
|
|
|
|
assert(root.has_value());
|
|
|
|
|
|
|
|
|
|
const auto shapesPath = remorse::resolveGameDataPath(*root, std::filesystem::path("STATIC") / "SHAPES.FLX");
|
|
|
|
|
assert(shapesPath.has_value());
|
|
|
|
|
|
|
|
|
|
const auto archive = remorse::loadShapeArchive(*shapesPath);
|
|
|
|
|
assert(archive.has_value());
|
|
|
|
|
|
|
|
|
|
bool decodedFrame = false;
|
|
|
|
|
for (remorse::u32 shape = 0; shape < archive->archive.entryCount; ++shape) {
|
|
|
|
|
const auto frame = remorse::decodeShapeFrame(*archive, shape, 0);
|
|
|
|
|
if (frame && !frame->pixels.empty()) {
|
|
|
|
|
assert(frame->frame.width > 0);
|
|
|
|
|
assert(frame->frame.height > 0);
|
2026-10-07 00:18:08 +02:00
|
|
|
const auto parsedFrames = remorse::loadShapeFrames(*archive, shape);
|
|
|
|
|
assert(parsedFrames && !parsedFrames->empty());
|
|
|
|
|
const auto decodedFromParsed = remorse::decodeShapeFrame(parsedFrames->front());
|
|
|
|
|
assert(decodedFromParsed && decodedFromParsed->pixels == frame->pixels);
|
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.
2026-04-27 21:15:01 +02:00
|
|
|
decodedFrame = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
assert(decodedFrame);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|