Skip to content

Commit 76ecd78

Browse files
committed
Fix emulator paths using forward slashes on Windows
1 parent 398cc60 commit 76ecd78

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

source/emulators/GenericEmulator.gd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ var command : String
66
var _substitutes := {}
77

88
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())
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+
3942
func 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)

source/emulators/RetroarchEmulator.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ func _init(emulator_raw : Dictionary, game_data : RetroHubGameData, system_cores
6464
if corepath.is_empty():
6565
corepath = RetroHubRetroArchEmulator.find_path(emulator_raw, "corepath", _substitutes)
6666
var corefile : String
67-
_substitutes["corepath"] = corepath
67+
add_substitute("corepath", corepath)
6868
for core_name in system_cores:
6969
corefile = RetroHubRetroArchEmulator.find_core_path(core_name, emulator_raw, corepath)
7070
if not corefile.is_empty():
7171
break
7272

7373
if not corefile.is_empty():
74-
_substitutes["corefile"] = corefile
74+
add_substitute("corefile", corefile)
7575
command = RetroHubRetroArchEmulator.substitute_str(command, _substitutes)
7676
else:
7777
print("Could not find valid core file for emulator \"%s\"" % game_data.system.name)

0 commit comments

Comments
 (0)