From 2ac43ba7df3b2c3dc40c6b87c2bc57c4b02ffa42 Mon Sep 17 00:00:00 2001 From: hop311 Date: Sun, 5 May 2024 18:36:21 +0100 Subject: Add GDScript XAC and XSM loaders --- extension/src/openvic-extension/singletons/GameSingleton.cpp | 5 +++++ extension/src/openvic-extension/singletons/GameSingleton.hpp | 1 + 2 files changed, 6 insertions(+) (limited to 'extension/src/openvic-extension') diff --git a/extension/src/openvic-extension/singletons/GameSingleton.cpp b/extension/src/openvic-extension/singletons/GameSingleton.cpp index 838542d..12e2df1 100644 --- a/extension/src/openvic-extension/singletons/GameSingleton.cpp +++ b/extension/src/openvic-extension/singletons/GameSingleton.cpp @@ -44,6 +44,7 @@ void GameSingleton::_bind_methods() { OV_BIND_METHOD(GameSingleton::load_defines_compatibility_mode, { "file_paths" }); OV_BIND_SMETHOD(search_for_game_path, { "hint_path" }, DEFVAL(String {})); + OV_BIND_METHOD(GameSingleton::lookup_file_path, { "path" }); OV_BIND_METHOD(GameSingleton::setup_game, { "bookmark_index" }); @@ -593,3 +594,7 @@ Error GameSingleton::load_defines_compatibility_mode(PackedStringArray const& fi String GameSingleton::search_for_game_path(String const& hint_path) { return std_to_godot_string(Dataloader::search_for_game_path(godot_to_std_string(hint_path)).string()); } + +String GameSingleton::lookup_file_path(String const& path) const { + return std_to_godot_string(dataloader.lookup_file(godot_to_std_string(path)).string()); +} diff --git a/extension/src/openvic-extension/singletons/GameSingleton.hpp b/extension/src/openvic-extension/singletons/GameSingleton.hpp index f2b88ac..f793fae 100644 --- a/extension/src/openvic-extension/singletons/GameSingleton.hpp +++ b/extension/src/openvic-extension/singletons/GameSingleton.hpp @@ -59,6 +59,7 @@ namespace OpenVic { godot::Error load_defines_compatibility_mode(godot::PackedStringArray const& file_paths); static godot::String search_for_game_path(godot::String const& hint_path = {}); + godot::String lookup_file_path(godot::String const& path) const; /* Post-load/restart game setup - reset the game to post-load state and load the specified bookmark. */ godot::Error setup_game(int32_t bookmark_index); -- cgit v1.2.3-56-ga3b1