Librakaly
A C compatible shared library for converting Paradox games into plaintext
Install / Use
/learn @rakaly/LibrakalyREADME
LibRakaly
librakaly is a shared library for PDX Tools functionality that exposes a C and C++ interface and can be embedded in any application that can call C or C++ code.
Below is a whirlwind tour of the C++ API (for more usage, see sample.cpp).
namespace fs = std::filesystem;
rakaly::GameFile parseSave(fs::path filePath, const std::string &input) {
if (filePath.extension() == ".eu4") {
return rakaly::parseEu4(input);
} else if (filePath.extension() == ".ck3") {
return rakaly::parseCk3(input);
} else if (filePath.extension() == ".hoi4") {
return rakaly::parseHoi4(input);
} else if (filePath.extension() == ".rome") {
return rakaly::parseImperator(input);
} else if (filePath.extension() == ".v3") {
return rakaly::parseVic3(input);
} else {
throw std::runtime_error("unrecognized file extension");
}
}
int main(int argc, const char *argv[]) {
// ... snip getting file path and reading file ...
const auto save = parseSave(filePath, input);
if (save.is_binary()) {
std::cerr << "cool! This save is binary!\n";
}
auto melt = save.melt();
if (melt.has_unknown_tokens()) {
std::cerr << "unable to melt all fields\n";
}
melt.writeData(input);
std::cout << input;
}
Tutorial
While these steps are linux specific, librakaly can also be used with ease on windows or mac. This tutorial will assume using the prebuilt shared library. If one wants to build librakaly for themselves, see the "Building" section.
- Create a directory to house the tutorial
- Go to the latest librakaly release
- Download the librakaly.so
- Download the rakaly.h
- Download
sample.cppfor the C++ example. If writing C, one can base their implementation off the C++ wrapper in./src/cpp_helper.h - Invoke gcc as follows
g++ sample.cpp -std=c++17 -o melter -O2 librakaly.so
- Then invoke the melter like:
LD_LIBRARY_PATH=. ./melter save my-ironman-save.eu4
Building
To build:
- Have the rust toolchain installed
- Define an environment variable
EU4_IRONMAN_TOKENSpointing to a file containing the ironman tokens. More info in the eu4save repo. - Define an environment variable
CK3_IRONMAN_TOKENSpointing to a file containing the ironman tokens. More info in the ck3save repo. - Define an environment variable
IMPERATOR_TOKENSpointing to a file containing the ironman tokens. More info in the imperator repo. - Define an environment variable
HOI4_IRONMAN_TOKENSpointing to a file containing the ironman tokens. More info in the hoi4 repo. - Invoke
cargo build --release
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
