@@ -102,6 +102,10 @@ class APEntryState extends MusicBeatState
102102 static final wsCheck = ~/ ^ wss? :\/\/ / ;
103103
104104 static final APWorld : String = " apworld/fridaynightfunkin.apworld" ;
105+ static var currentAPLocation : String = new yutautil.save. MixSaveWrapper (null , " save/apLocation.json" , true ).getItem (" apLocation" ) != null
106+ ? new yutautil.save. MixSaveWrapper (null , " save/apLocation.json" , true ).getItem (" apLocation" )
107+ : " C:/ProgramData/Archipelago" ;
108+
105109 // #if embed
106110 // @:embed(APWorld) static var apWorldBytes:ByteArray;
107111 // #end
@@ -248,11 +252,41 @@ class APEntryState extends MusicBeatState
248252
249253 super .create ();
250254
255+
251256 #if sys
252- var apWorldButtonText = FileSystem .exists (" C:/ProgramData/Archipelago/custom_worlds/fridaynightfunkin.apworld" ) ? " Update APWorld" : " Install APWorld" ;
257+ var changeAPLocationButton = new PsychUIButton (0 , 0 , " Change AP Location" , function () {
258+ var before = currentAPLocation ;
259+ currentAPLocation = yutautil. ImprovedFileHandling .selectFolder (" Select Archipelago Folder" , true );
260+ if (currentAPLocation != null && currentAPLocation .trim () != " " ) {
261+ var save = new yutautil.save. MixSaveWrapper (null , " save/apLocation.json" , true ).setItem (" apLocation" , currentAPLocation );
262+ Application .current .window .alert (" Archipelago location changed to: " + currentAPLocation , " Archipelago Location Changed" );
263+ save .save ();
264+ }
265+ else {
266+ Application .current .window .alert (" Archipelago location not changed." , " Archipelago Location Not Changed" );
267+ currentAPLocation = before ;
268+ }
269+ });
270+ changeAPLocationButton .x = (FlxG .width / 2 ) - 10 - changeAPLocationButton .width ;
271+ changeAPLocationButton .y = FlxG .height - changeAPLocationButton .height - 100 ;
272+ add (changeAPLocationButton );
273+
274+ var apWorldButtonText = FileSystem .exists (currentAPLocation + " /custom_worlds/fridaynightfunkin.apworld" ) ? " Update APWorld" : " Install APWorld" ;
253275 var apWorldButton = new PsychUIButton (0 , 0 , apWorldButtonText , installAPWorld );
254276 apWorldButton .x = (FlxG .width / 2 ) - 10 - apWorldButton .width ;
255277 apWorldButton .y = FlxG .height - apWorldButton .height - 50 ;
278+
279+ if (! FileSystem .exists (currentAPLocation )) {
280+ apWorldButton .normalStyle .bgColor = FlxColor .DARK_GRAY ;
281+ apWorldButton .normalStyle .textColor = FlxColor .LIGHT_GRAY ;
282+ apWorldButton .hoverStyle .bgColor = FlxColor .DARK_GRAY ;
283+ apWorldButton .hoverStyle .textColor = FlxColor .LIGHT_GRAY ;
284+ apWorldButton .clickStyle .bgColor = FlxColor .DARK_GRAY ;
285+ apWorldButton .clickStyle .textColor = FlxColor .LIGHT_GRAY ;
286+ apWorldButton .onClick = function () {
287+ Application .current .window .alert (" Archipelago not found.\n Please install Archipelago to use this feature." , " APWorld Installation" );
288+ };
289+ }
256290 add (apWorldButton );
257291 #end
258292
@@ -467,7 +501,7 @@ class APEntryState extends MusicBeatState
467501 public static function checkAPWorld (): {status :String , message :String }
468502 {
469503 #if sys
470- var programDataPath = " C:/ProgramData/Archipelago /" ;
504+ var programDataPath = currentAPLocation + " /" ;
471505 var customWorldsPath = programDataPath + " custom_worlds/" ;
472506 var apWorldFile = customWorldsPath + " fridaynightfunkin.apworld" ;
473507
@@ -524,7 +558,7 @@ class APEntryState extends MusicBeatState
524558 public static function installAPWorld (): Void
525559 {
526560 #if sys
527- var programDataPath = " C:/ProgramData/Archipelago /" ;
561+ var programDataPath = currentAPLocation + " /" ;
528562 var launcherPath = programDataPath + " ArchipelagoLauncher.exe" ;
529563 var customWorldsPath = programDataPath + " custom_worlds/" ;
530564 var apWorldFile = customWorldsPath + " fridaynightfunkin.apworld" ;
0 commit comments