Load GDExtension libs (WIP)

This commit is contained in:
Nordup 2023-06-25 11:58:47 +04:00
parent 106554a6b4
commit ebb00279cb
4 changed files with 16 additions and 1 deletions

View file

@ -6,4 +6,4 @@
script = ExtResource("1_oiju7")
local_url = "http://127.0.0.1:8000"
remote_url = "http://95.163.241.188:8000"
host_type = 0
host_type = 1

View file

@ -5,8 +5,10 @@ var title: String
var description: String
var image_url: String
var resource_pack_url: String
var libraries: PackedStringArray
const section = "gate"
const libs_section = "libraries"
func _init(path: String, base_url: String) -> void:
@ -15,3 +17,10 @@ func _init(path: String, base_url: String) -> void:
description = get_string(section, "description")
image_url = Url.join(base_url, get_string(section, "image"))
resource_pack_url = Url.join(base_url, get_string(section, "resource_pack"))
libraries = get_libraries(base_url)
func get_libraries(base_url: String) -> PackedStringArray:
var libraries = GDExtension.find_extension_library("", config).split(";")
for i in range(libraries.size()): libraries[i] = Url.join(base_url, libraries[i])
return libraries

View file

@ -19,4 +19,9 @@ func load_gate(config_url: String) -> void:
gate_events.gate_info_loaded_emit(gate)
gate.resource_pack = await FileDownloader.download(c_gate.resource_pack_url)
Debug.logr("Loading GDExtension libraries: " + str(c_gate.libraries))
for lib in c_gate.libraries:
var lib_path = await FileDownloader.download(lib)
gate_events.gate_loaded_emit(gate)

View file

@ -19,6 +19,7 @@ func create_process(gate: Gate) -> void:
var pack_file = ProjectSettings.globalize_path(gate.resource_pack)
var args = [
"--main-pack", pack_file,
"--gdext-libs-dir", "/home/nordup/projects/godot/the-gates-folder/ServerFiles/exports/rust",
"--resolution", "%dx%d" % [render_result.width, render_result.height]
]
Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET)