Super Metroid: more path fixes

This commit is contained in:
Fabian Dill
2021-11-14 20:51:10 +01:00
parent 55bfc71269
commit 16cd2760a4
4 changed files with 12 additions and 15 deletions

View File

@@ -2,16 +2,15 @@ import os, importlib
from logic.logic import Logic
from patches.common.patches import patches, additional_PLMs
from utils.parameters import appDir
from Utils import is_frozen
class PatchAccess(object):
def __init__(self):
# load all ips patches
self.patchesPath = {}
commonDir = os.path.join(appDir, 'lib' if is_frozen() else '', 'worlds/sm/variaRandomizer/patches/common/ips/')
commonDir = os.path.join(appDir, 'worlds/sm/variaRandomizer/patches/common/ips/')
for patch in os.listdir(commonDir):
self.patchesPath[patch] = commonDir
logicDir = os.path.join(appDir, 'lib' if is_frozen() else '', 'worlds/sm/variaRandomizer/patches/{}/ips/'.format(Logic.patches))
logicDir = os.path.join(appDir, 'worlds/sm/variaRandomizer/patches/{}/ips/'.format(Logic.patches))
for patch in os.listdir(logicDir):
self.patchesPath[patch] = logicDir

View File

@@ -352,7 +352,7 @@ class VariaRandomizer:
sys.exit(-1)
else:
preset = 'default'
PresetLoader.factory('{}/{}/{}.json'.format(appDir, getPresetDir('casual'), 'casual')).load(self.player)
PresetLoader.factory(os.path.join(appDir, getPresetDir('casual'), 'casual.json')).load(self.player)

View File

@@ -1,19 +1,17 @@
import os, json, sys, re, random
import os, json, re, random
from utils.parameters import Knows, Settings, Controller, isKnows, isSettings, isButton
from utils.parameters import easy, medium, hard, harder, hardcore, mania, text2diff
from logic.smbool import SMBool
from Utils import is_frozen
def isStdPreset(preset):
return preset in ['newbie', 'casual', 'regular', 'veteran', 'expert', 'master', 'samus', 'solution', 'Season_Races', 'SMRAT2021']
def getPresetDir(preset):
def getPresetDir(preset) -> str:
if isStdPreset(preset):
return 'lib/worlds/sm/variaRandomizer/standard_presets' if is_frozen() else 'worlds/sm/variaRandomizer/standard_presets'
return 'worlds/sm/variaRandomizer/standard_presets'
else:
return 'lib/worlds/sm/variaRandomizer/community_presets' if is_frozen() else 'worlds/sm/variaRandomizer/community_presets'
return 'worlds/sm/variaRandomizer/community_presets'
def removeChars(string, toRemove):
return re.sub('[{}]+'.format(toRemove), '', string)