diff --git a/project/the_gates/scripts/loading/gate_loader.gd b/project/the_gates/scripts/loading/gate_loader.gd index 21c3fa5..3adacb5 100644 --- a/project/the_gates/scripts/loading/gate_loader.gd +++ b/project/the_gates/scripts/loading/gate_loader.gd @@ -10,7 +10,7 @@ func _ready() -> void: func load_gate(config_url: String) -> void: - Debug.logr("======== " + config_url + " ========") + Debug.logclr("======== " + config_url + " ========", Color.GREEN) var config_path: String = await FileDownloader.download(config_url) c_gate = ConfigGate.new(config_path, config_url) diff --git a/project/the_gates/scripts/loading/sandbox_manager.gd b/project/the_gates/scripts/loading/sandbox_manager.gd index b6ee43d..8d04c00 100644 --- a/project/the_gates/scripts/loading/sandbox_manager.gd +++ b/project/the_gates/scripts/loading/sandbox_manager.gd @@ -19,14 +19,11 @@ func create_process(gate: Gate) -> void: var pack_file = ProjectSettings.globalize_path(gate.resource_pack) var args = [ "--main-pack", pack_file, - "--resolution", "%dx%d" % [render_result.width, render_result.height], - "--fd-path", render_result.fd_path + "--resolution", "%dx%d" % [render_result.width, render_result.height] ] Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET) sandbox_pid = OS.create_process(snbx_executable.path, args) - if OS.get_name() == "Windows": render_result.fd_path += "|" + str(sandbox_pid) - gate_events.gate_entered_emit() diff --git a/project/the_gates/scripts/resources/command_events.gd b/project/the_gates/scripts/resources/command_events.gd index 178c630..d0b6805 100644 --- a/project/the_gates/scripts/resources/command_events.gd +++ b/project/the_gates/scripts/resources/command_events.gd @@ -1,12 +1,12 @@ extends Resource class_name CommandEvents -signal send_filehandle +signal send_filehandle(filehandle_path: String) signal set_mouse_mode(mode: int) -func send_filehandle_emit() -> void: - send_filehandle.emit() +func send_filehandle_emit(filehandle_path: String) -> void: + send_filehandle.emit(filehandle_path) func set_mouse_mode_emit(mode: int) -> void: diff --git a/project/the_gates/scripts/sandbox/command_sync.gd b/project/the_gates/scripts/sandbox/command_sync.gd index 4618045..c7b6952 100644 --- a/project/the_gates/scripts/sandbox/command_sync.gd +++ b/project/the_gates/scripts/sandbox/command_sync.gd @@ -14,10 +14,11 @@ func _physics_process(_delta: float) -> void: func _execute_function(command: Command) -> Variant: - Debug.logclr("Recieved command: " + command.name, Color.SANDY_BROWN) + Debug.logclr("Recieved command: " + command.name + ". Args: " + str(command.args), Color.SANDY_BROWN) match command.name: "send_filehandle": - command_events.send_filehandle_emit() + if command.args.size() != 1: Debug.logerr("Arg count should be 1"); return "" + command_events.send_filehandle_emit(command.args[0]) "set_mouse_mode": if command.args.size() != 1: Debug.logerr("Arg count should be 1"); return "" command_events.set_mouse_mode_emit(command.args[0]) diff --git a/project/the_gates/scripts/sandbox/render_result.gd b/project/the_gates/scripts/sandbox/render_result.gd index 9d8eb8a..b10536f 100644 --- a/project/the_gates/scripts/sandbox/render_result.gd +++ b/project/the_gates/scripts/sandbox/render_result.gd @@ -8,16 +8,12 @@ class_name RenderResult @onready var width = get_viewport().size.x @onready var height = get_viewport().size.y -var fd_path: String var rd: RenderingDevice var ext_texure: ExternalTexture var texture_rid: RID func _ready() -> void: - if OS.get_name() == "Windows": fd_path = "ipc://external_texture" - else: fd_path = "/tmp/external_texture" - gate_events.gate_entered.connect(create_external_texture) command_events.send_filehandle.connect(send_filehandle) initialize() @@ -30,7 +26,6 @@ func initialize() -> void: self.texture = ImageTexture.create_from_image(image) texture_rid = RenderingServer.texture_get_rd_texture(self.texture.get_rid()) if not texture_rid.is_valid(): Debug.logerr("Cannot create ImageTexture") - else: Debug.logclr("Render result texture created", Color.AQUAMARINE) func create_external_texture() -> void: @@ -53,11 +48,11 @@ func create_external_texture() -> void: else: Debug.logclr("External texture created", Color.AQUAMARINE) -func send_filehandle() -> void: - Debug.logr("Sending send_filehandle...") +func send_filehandle(filehandle_path: String) -> void: + Debug.logr("Sending filehandle...") var sent = false while not sent: - sent = ext_texure.send_filehandle(fd_path) + sent = ext_texure.send_filehandle(filehandle_path) await get_tree().create_timer(0.1).timeout Debug.logr("filehandle was sent")