Skip to content

Commit 6bc7c91

Browse files
Doom app: work towards file listing and choice
1 parent 280ccf5 commit 6bc7c91

File tree

1 file changed

+10
-10
lines changed
  • internal_filesystem/apps/com.micropythonos.doom/assets

1 file changed

+10
-10
lines changed

internal_filesystem/apps/com.micropythonos.doom/assets/doom.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,16 @@ def onCreate(self):
2525
self.setContentView(screen)
2626

2727
def onResume(self, screen):
28+
# Try to mount the SD card and if successful, use it, as retro-go can only use one or the other:
29+
bootfile_prefix = ""
30+
mounted_sdcard = sdcard.mount_with_optional_format(self.mountpoint_sdcard)
31+
if mounted_sdcard:
32+
print("sdcard is mounted, configuring it...")
33+
bootfile_prefix = self.mountpoint_sdcard
34+
bootfile_to_write = bootfile_prefix + self.bootfile
35+
print(f"writing to {bootfile_to_write}")
2836
# Do it in a separate task so the UI doesn't hang (shows progress, status_label) and the serial console keeps showing prints
29-
TaskManager.create_task(self.start_wad(self.doomdir + '/Doom v1.9 Free Shareware.zip'))
37+
TaskManager.create_task(self.start_wad(bootfile_prefix, bootfile_to_write, self.doomdir + '/Doom v1.9 Free Shareware.zip'))
3038

3139
def mkdir(self, dirname):
3240
# Would be better to only create it if it doesn't exist
@@ -37,15 +45,7 @@ def mkdir(self, dirname):
3745
# Not really useful to show this in the UI, as it's usually just an "already exists" error:
3846
print(f"Info: could not create directory {dirname} because: {e}")
3947

40-
async def start_wad(self, wadfile):
41-
# Try to mount the SD card and if successful, use it, as retro-go can only use one or the other:
42-
bootfile_prefix = ""
43-
mounted_sdcard = sdcard.mount_with_optional_format(self.mountpoint_sdcard)
44-
if mounted_sdcard:
45-
print("sdcard is mounted, configuring it...")
46-
bootfile_prefix = self.mountpoint_sdcard
47-
bootfile_to_write = bootfile_prefix + self.bootfile
48-
print(f"writing to {bootfile_to_write}")
48+
async def start_wad(self, bootfile_prefix, bootfile_to_write, wadfile):
4949
self.status_label.set_text(f"Launching Doom with file: {bootfile_prefix}{wadfile}")
5050
await TaskManager.sleep(1) # Give the user a minimal amount of time to read the filename
5151

0 commit comments

Comments
 (0)