port 2D step 5b: PackInitialize + pack:// asset_io backend over the ported EterPackManager
Platform UserInterface PackInitialize/PackSingletons (40250 bootstrap, on-disk dbname resolution), EterBase/FileLoader.cpp mirror, mtpack40250 backend behind asset_io's pack:// scheme and a Metin2Pack node. port_eterpack_test now registers through PackInitialize. Nothing reads pack:// at runtime yet; port-map stays TODO. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include "pack40250_node.h"
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
|
||||
#include "asset_io.h"
|
||||
#include "platform/PackBackend.h"
|
||||
|
||||
using namespace godot;
|
||||
|
||||
namespace mtgodot {
|
||||
|
||||
bool Metin2Pack::initialize(const String &client_dir) {
|
||||
return mtpack40250::initialize(client_dir.utf8().get_data());
|
||||
}
|
||||
|
||||
bool Metin2Pack::is_ready() {
|
||||
return mtpack40250::ready();
|
||||
}
|
||||
|
||||
bool Metin2Pack::exists(const String &name) {
|
||||
return file_exists(String(PACK_SCHEME) + name);
|
||||
}
|
||||
|
||||
PackedByteArray Metin2Pack::get_bytes(const String &name) {
|
||||
return read_file(String(PACK_SCHEME) + name);
|
||||
}
|
||||
|
||||
void Metin2Pack::_bind_methods() {
|
||||
ClassDB::bind_static_method("Metin2Pack", D_METHOD("initialize", "client_dir"), &Metin2Pack::initialize);
|
||||
ClassDB::bind_static_method("Metin2Pack", D_METHOD("is_ready"), &Metin2Pack::is_ready);
|
||||
ClassDB::bind_static_method("Metin2Pack", D_METHOD("exists", "name"), &Metin2Pack::exists);
|
||||
ClassDB::bind_static_method("Metin2Pack", D_METHOD("get_bytes", "name"), &Metin2Pack::get_bytes);
|
||||
}
|
||||
|
||||
} // namespace mtgodot
|
||||
Reference in New Issue
Block a user