@@ -6,11 +6,11 @@ var command : String
6
6
var _substitutes := {}
7
7
8
8
func _init (emulator_raw : Dictionary , game_data : RetroHubGameData ):
9
- _substitutes [ "rompath" ] = game_data .path
10
- _substitutes [ "romfolder" ] = game_data .path .get_base_dir ()
9
+ add_substitute ( "rompath" , game_data .path )
10
+ add_substitute ( "romfolder" , game_data .path .get_base_dir () )
11
11
var binpath := RetroHubGenericEmulator .find_path (emulator_raw , "binpath" , _substitutes )
12
12
if not binpath .is_empty ():
13
- _substitutes [ "binpath" ] = binpath
13
+ add_substitute ( "binpath" , binpath )
14
14
command = RetroHubGenericEmulator .substitute_str (emulator_raw ["command" ], _substitutes )
15
15
else :
16
16
print ("Could not find binpath for emulator \" %s \" " % emulator_raw ["name" ])
@@ -36,6 +36,9 @@ static func load_icon(_name: String) -> Texture2D:
36
36
return load (path )
37
37
return null
38
38
39
+ func add_substitute (key : String , path : String ) -> void :
40
+ _substitutes [key ] = path .replace ('/' , '\\ ' ) if FileUtils .get_os_id () == FileUtils .OS_ID .WINDOWS else path
41
+
39
42
func is_valid () -> bool :
40
43
return not command .is_empty ()
41
44
@@ -53,4 +56,5 @@ func launch_game() -> int:
53
56
else :
54
57
command_args .append (regex_results [idx ].strings [0 ])
55
58
59
+ prints ("Launching emulator process:" , command_base , command_args )
56
60
return OS .create_process (command_base , command_args )
0 commit comments