@@ -6,11 +6,11 @@ var command : String
66var _substitutes := {}
77
88func _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 () )
1111 var binpath := RetroHubGenericEmulator .find_path (emulator_raw , "binpath" , _substitutes )
1212 if not binpath .is_empty ():
13- _substitutes [ "binpath" ] = binpath
13+ add_substitute ( "binpath" , binpath )
1414 command = RetroHubGenericEmulator .substitute_str (emulator_raw ["command" ], _substitutes )
1515 else :
1616 print ("Could not find binpath for emulator \" %s \" " % emulator_raw ["name" ])
@@ -36,6 +36,9 @@ static func load_icon(_name: String) -> Texture2D:
3636 return load (path )
3737 return null
3838
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+
3942func is_valid () -> bool :
4043 return not command .is_empty ()
4144
@@ -53,4 +56,5 @@ func launch_game() -> int:
5356 else :
5457 command_args .append (regex_results [idx ].strings [0 ])
5558
59+ prints ("Launching emulator process:" , command_base , command_args )
5660 return OS .create_process (command_base , command_args )
0 commit comments