Metin2 game client (P0–P11) + mobile asset pipeline
Networked client on the existing Godot 4.7 + libgr2 renderer:
- net: m2dev wire protocol (libsodium KX + XChaCha20), auth/select/game
phases, EntityStore world model, ~all GC/CG headers. char create/delete,
private shop / mall / cube, SHOP_GC_START_EX, guild, party (+ CG_PARTY_SET_STATE),
quests, dragon soul, refine, safebox, exchange.
- UI: in-game windows migrated 1:1 from the reference uiscript/root .py —
char status (/stat), inventory+equipment, select-item ([SELECT_ITEM] quest
token), system-option + game-option + ESC system menu, private-shop 39-grid,
party info board, shop tabs, atlas, minimap, quickbar, chat, …
- EterGrnLib polish: GR2 material blend/two-sided, LOD crossfade, motion-event
dispatch, contact shadow, ray-AABB picking, weapon grip pre-transform.
Portable asset IO (A1) — all extension/libgr2/formats/mtproto reads routed
through godot::FileAccess (res:// PCK works on iOS/Android); standalone-lib
*_path() kept for the non-Godot CTests. AssetResolver + PropertyRegistry
switched to a baked index (bake_asset_index.gd) instead of std::filesystem.
Mobile builds: build-{android,ios}.sh, export-android.sh, pack-assets.sh,
gen-debug-keystore.sh. Assets ship as a zip mounted at runtime by
project/asset_pack.gd (adb push now; HTTP download is a drop-in later).
ctest 10/10, 34 GDScript suites, macOS/iOS/Android all build.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EJxkHiNKS4kybHS3XKyAJ
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
// packtool — cross-platform replacement for the fork's PackMaker.exe.
|
||||
// packtool pack <folder> <out.epk> [--encrypt]
|
||||
// packtool unpack <in.epk> <out_folder>
|
||||
// packtool list <in.epk>
|
||||
#include "../src/pack/eterpack.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
using namespace mtpack;
|
||||
|
||||
static std::vector<uint8_t> slurp(const fs::path &p) {
|
||||
std::ifstream f(p, std::ios::binary);
|
||||
return {std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>()};
|
||||
}
|
||||
|
||||
static int do_pack(const char *folder, const char *out, bool enc) {
|
||||
fs::path root(folder);
|
||||
std::vector<InputFile> files;
|
||||
for (auto &e : fs::recursive_directory_iterator(root)) {
|
||||
if (!e.is_regular_file()) {
|
||||
continue;
|
||||
}
|
||||
std::string rel = fs::relative(e.path(), root).generic_string();
|
||||
files.push_back({rel, slurp(e.path())});
|
||||
}
|
||||
std::string err;
|
||||
if (!write_pack(out, files, enc, &err)) {
|
||||
std::fprintf(stderr, "pack failed: %s\n", err.c_str());
|
||||
return 1;
|
||||
}
|
||||
std::printf("packed %zu files -> %s%s\n", files.size(), out, enc ? " (encrypted)" : "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_unpack(const char *in, const char *out_folder) {
|
||||
EterPack pk;
|
||||
std::string err;
|
||||
if (!pk.open(in, &err)) {
|
||||
std::fprintf(stderr, "open failed: %s\n", err.c_str());
|
||||
return 1;
|
||||
}
|
||||
for (const auto &name : pk.names()) {
|
||||
std::vector<uint8_t> data;
|
||||
if (!pk.read(name, data, &err)) {
|
||||
std::fprintf(stderr, "read %s: %s\n", name.c_str(), err.c_str());
|
||||
return 1;
|
||||
}
|
||||
fs::path dst = fs::path(out_folder) / name;
|
||||
fs::create_directories(dst.parent_path());
|
||||
std::ofstream f(dst, std::ios::binary);
|
||||
f.write(reinterpret_cast<const char *>(data.data()), static_cast<std::streamsize>(data.size()));
|
||||
}
|
||||
std::printf("unpacked %zu files -> %s\n", pk.count(), out_folder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_list(const char *in) {
|
||||
EterPack pk;
|
||||
std::string err;
|
||||
if (!pk.open(in, &err)) {
|
||||
std::fprintf(stderr, "open failed: %s\n", err.c_str());
|
||||
return 1;
|
||||
}
|
||||
std::printf("%zu entries, name-field=%d\n", pk.count(), pk.name_field());
|
||||
for (const auto &n : pk.names()) {
|
||||
std::printf(" %s\n", n.c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc >= 4 && std::strcmp(argv[1], "pack") == 0) {
|
||||
bool enc = argc >= 5 && std::strcmp(argv[4], "--encrypt") == 0;
|
||||
return do_pack(argv[2], argv[3], enc);
|
||||
}
|
||||
if (argc == 4 && std::strcmp(argv[1], "unpack") == 0) {
|
||||
return do_unpack(argv[2], argv[3]);
|
||||
}
|
||||
if (argc == 3 && std::strcmp(argv[1], "list") == 0) {
|
||||
return do_list(argv[2]);
|
||||
}
|
||||
std::fprintf(stderr,
|
||||
"usage:\n"
|
||||
" packtool pack <folder> <out.epk> [--encrypt]\n"
|
||||
" packtool unpack <in.epk> <out_folder>\n"
|
||||
" packtool list <in.epk>\n");
|
||||
return 2;
|
||||
}
|
||||
Reference in New Issue
Block a user