Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions romloader.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
### Make sure this directory exists on your SD card (will try to create it if /romloader)
default_destination: "/romloader"

### uncomment to have romloader write the name of the selected MSU pack to a file
# title_output_file: "C:/Users/Username/romloader.txt"
### default title to write for non-msu packs
# default_title: "Not an MSU pack"

### a set of rules to use to put certain ROMs in certain locations, such as your randomizer ROMs, useful for MSU1 users
rules:
alttpr:
Expand Down
24 changes: 20 additions & 4 deletions romloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show_exception_and_exit(exc_type, exc_value, tb):
try:
with open(scriptpath + "\\romloader.yaml") as configfile:
try:
config = yaml.load(configfile)
config = yaml.safe_load(configfile)
print("loading config file at " +
os.path.abspath(scriptpath + "\\romloader.yaml"))
except yaml.YAMLError as e:
Expand All @@ -37,7 +37,7 @@ def show_exception_and_exit(exc_type, exc_value, tb):
try:
with open("romloader.yaml") as configfile:
try:
config = yaml.load(configfile)
config = yaml.safe_load(configfile)
print("loading config file at " +
os.path.abspath("romloader.yaml"))
except yaml.YAMLError as e:
Expand All @@ -54,6 +54,8 @@ async def main():
raise Exception('We need a path to the ROM file to load.')
sys.exit(1)
filename = os.path.basename(rompath)

title = None

rule = matchrule(filename)
if rule:
Expand All @@ -70,14 +72,26 @@ async def main():
path = '/romloader'
romname = filename
else:
path, romname = get_destination(rule, filename)
path, romname, title = get_destination(rule, filename)
else:
try:
path = config['default_destination']
except KeyError:
path = '/romloader'
romname = filename

if not title:
if "default_title" in config:
title = config['default_title']
else:
title = 'Not an MSU pack'

if "title_output_file" in config:
title_output_file = os.path.abspath(config['title_output_file'])
with open(title_output_file, 'w') as file:
file.write(title)
print('Pack selection written to ' + title_output_file)

# initiate connection to the websocket server
snes = py2snes.snes()

Expand Down Expand Up @@ -148,9 +162,11 @@ def get_destination(rule, romname):
path = config['rules'][rule]['destinations'][int(dst_idx)]['path']
try:
name = config['rules'][rule]['destinations'][int(dst_idx)]['romname']
title = config['rules'][rule]['destinations'][int(dst_idx)]['name']
except KeyError:
name = romname
return path, name
title = None
return path, name, title


def get_comm_device(devicelist):
Expand Down
17 changes: 13 additions & 4 deletions romloader.spec
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# -*- mode: python -*-
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['romloader.py'],
pathex=['D:\\Code\\RomLoader'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
Expand All @@ -16,16 +19,22 @@ a = Analysis(['romloader.py'],
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)

exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
a.datas,
[],
name='romloader',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )