diff --git a/internal_filesystem/apps/com.micropythonos.doom/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.micropythonos.doom/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..dad1371a --- /dev/null +++ b/internal_filesystem/apps/com.micropythonos.doom/META-INF/MANIFEST.JSON @@ -0,0 +1,24 @@ +{ +"name": "Doom", +"publisher": "MicroPythonOS", +"short_description": "Legendary 3D shooter", +"long_description": "Plays Doom 1, 2 and modded .wad files from internal storage or SD card and plays them. Place them in the folder /roms/doom/ . Uses ducalex's retro-go port of PrBoom. Supports zipped wad files too.", +"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.doom/icons/com.micropythonos.doom_0.0.1_64x64.png", +"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.doom/mpks/com.micropythonos.doom_0.0.1.mpk", +"fullname": "com.micropythonos.doom", +"version": "0.0.1", +"category": "games", +"activities": [ + { + "entrypoint": "assets/doom.py", + "classname": "Doom", + "intent_filters": [ + { + "action": "main", + "category": "launcher" + } + ] + } + ] +} + diff --git a/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py b/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py new file mode 100644 index 00000000..28591b6d --- /dev/null +++ b/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py @@ -0,0 +1,88 @@ +from mpos.apps import Activity + +class Doom(Activity): + + romdir = "/roms" + doomdir = romdir + "/doom" + retrogodir = "/retro-go" + configdir = retrogodir + "/config" + bootfile = configdir + "/boot.json" + #partition_label = "prboom-go" + partition_label = "retro-core" + # Widgets: + status_label = None + + def onCreate(self): + screen = lv.obj() + self.status_label = lv.label(screen) + self.status_label.set_width(lv.pct(90)) + self.status_label.set_text(f'Looking for .wad or .zip files in {self.doomdir} on internal storage and SD card...') + self.status_label.set_long_mode(lv.label.LONG_MODE.WRAP) + self.status_label.center() + self.setContentView(screen) + + def onResume(self, screen): + self.start_wad(self.doomdir + '/Doom v1.9 Free Shareware.zip') + + def mkdir(self, dirname): + # Would be better to only create it if it doesn't exist + try: + import os + os.mkdir(dirname) + except Exception as e: + self.status_label.set_text(f"Info: could not create directory {dirname} because: {e}") + + def start_wad(self, wadfile): + self.mkdir(self.romdir) + self.mkdir(self.doomdir) + self.mkdir(self.retrogodir) + self.mkdir(self.configdir) + try: + import os + import json + # Would be better to only write this if it differs from what's already there: + fd = open(self.bootfile, 'w') + ''' + bootconfig = { + "BootName": "doom", + "BootArgs": f"/sd{wadfile}", + "BootSlot": -1, + "BootFlags": 0 + } + ''' + bootconfig = { + "BootName": "nes", + "BootArgs": "/sd/roms/nes/homebrew/Yun.zip", + "BootSlot": -1, + "BootFlags": 0 + } + json.dump(bootconfig, fd) + fd.close() + except Exception as e: + self.status_label.set_text(f"ERROR: could not write config file: {e}") + return + results = [] + try: + from esp32 import Partition + results = Partition.find(label=self.partition_label) + except Exception as e: + self.status_label.set_text(f"ERROR: could not search for internal partition with label {self.partition_label}, unable to start: {e}") + return + if len(results) < 1: + self.status_label.set_text(f"ERROR: could not find internal partition with label {self.partition_label}, unable to start") + return + partition = results[0] + try: + partition.set_boot() + except Exception as e: + print(f"ERROR: could not set partition {partition} as boot, it probably doesn't contain a valid program: {e}") + try: + import vfs + vfs.umount('/') + except Exception as e: + print(f"Warning: could not unmount internal filesystem from /: {e}") + try: + import machine + machine.reset() + except Exception as e: + print(f"Warning: could not restart machine: {e}") diff --git a/internal_filesystem/apps/com.micropythonos.doom/res/mipmap-mdpi/icon_64x64.png b/internal_filesystem/apps/com.micropythonos.doom/res/mipmap-mdpi/icon_64x64.png new file mode 100644 index 00000000..2c64582b Binary files /dev/null and b/internal_filesystem/apps/com.micropythonos.doom/res/mipmap-mdpi/icon_64x64.png differ diff --git a/scripts/flash_over_usb.sh b/scripts/flash_over_usb.sh index 8033bbf0..c56030f5 100755 --- a/scripts/flash_over_usb.sh +++ b/scripts/flash_over_usb.sh @@ -9,5 +9,5 @@ ls -al $fwfile echo "Add --erase-all if needed" sleep 5 # This needs python and the esptool -~/.espressif/python_env/*/bin/python -m esptool --chip esp32s3 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0 $fwfile $1 +~/.espressif/python_env/*/bin/python -m esptool --chip esp32s3 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0 $fwfile $@ diff --git a/scripts/mklittlefs.sh b/scripts/mklittlefs.sh index 1f7be0c4..a9d0aa78 100755 --- a/scripts/mklittlefs.sh +++ b/scripts/mklittlefs.sh @@ -3,6 +3,9 @@ mydir=$(readlink -f "$0") mydir=$(dirname "$mydir") -size=0x200000 # 2MB -~/sources/mklittlefs/mklittlefs -c "$mydir"/../internal_filesystem/ -s "$size" internal_filesystem.bin +#size=0x200000 # 2MB +#~/sources/mklittlefs/mklittlefs -c "$mydir"/../internal_filesystem/ -s "$size" internal_filesystem.bin + +size=0x520000 +~/sources/mklittlefs/mklittlefs -c "$mydir"/../../../internalsd_zips_removed_gb_romart -s "$size" internalsd_zips_removed_gb_romart.bin