@@ -22,6 +22,8 @@ var _systems_raw : Dictionary
22
22
var _system_renames : Dictionary
23
23
var emulators_map : Dictionary
24
24
25
+ var _is_sc := false
26
+
25
27
const CONTROLLER_AXIS_FLAG : int = (1 << 8 )
26
28
27
29
var _implicit_mappings := {
@@ -33,6 +35,9 @@ var _implicit_mappings := {
33
35
"rh_down" : "ui_down"
34
36
}
35
37
38
+ func _enter_tree ():
39
+ _determine_sc_mode ()
40
+
36
41
func _ready ():
37
42
get_window ().min_size = Vector2 (1024 , 576 )
38
43
if FileUtils .get_os_id () == FileUtils .OS_ID .UNSUPPORTED :
@@ -702,8 +707,22 @@ func remove_custom_emulator(emulator_raw: Dictionary):
702
707
JSONUtils .save_json_file (emulator_config , get_custom_emulators_file ())
703
708
return
704
709
710
+ func _determine_sc_mode ():
711
+ # This functionality is not exposed on exported projects, so
712
+ # we replicate it from engine code
713
+ var exe_path := OS .get_executable_path ().get_base_dir ()
714
+ if FileUtils .get_os_id () == FileUtils .OS_ID .MACOS :
715
+ if exe_path .ends_with ("MacOS" ) and exe_path .path_join (".." ).simplify_path ().ends_with ("Contents" ):
716
+ exe_path = exe_path .path_join ("../../.." ).simplify_path ()
717
+
718
+ if FileAccess .file_exists (exe_path + "/._sc_" ) or FileAccess .file_exists (exe_path + "/_sc_" ):
719
+ _is_sc = true
720
+
705
721
func get_config_dir () -> String :
706
722
var path : String
723
+ if _is_sc :
724
+ return OS .get_executable_path ().get_base_dir () + "/config"
725
+
707
726
match FileUtils .get_os_id ():
708
727
FileUtils .OS_ID .WINDOWS :
709
728
path = FileUtils .get_home_dir () + "/RetroHub"
0 commit comments