Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coco autoload .dsk and .cas support #11706

Merged
merged 2 commits into from
May 21, 2024

Conversation

udance4ever
Copy link

@udance4ever udance4ever commented May 11, 2024

Color Computer (coco) .cas and .dsk files previously did not autoload like other systems (eg. apple2)

Drivers coco & coco3 as of MAME v0.261 have support for .dsk:

[root@BATOCERA]# /usr/bin/mame/mame -listmedia coco
SYSTEM           MEDIA NAME       (brief)    IMAGE FILE EXTENSIONS SUPPORTED
---------------- --------------------------- -------------------------------
coco             floppydisk1      (flop1)    .mfi  .dfi  .hfe  .mfm  .td0  .imd  .d77  .d88  .1dd  .cqm  .cqi  .dsk  .dmk  .sdf  .jvc  .vdk  .os9  

[root@BATOCERA]# /usr/bin/mame/mame -listmedia coco3
SYSTEM           MEDIA NAME       (brief)    IMAGE FILE EXTENSIONS SUPPORTED
---------------- --------------------------- -------------------------------
coco3            floppydisk1      (flop1)    .mfi  .dfi  .hfe  .mfm  .td0  .imd  .d77  .d88  .1dd  .cqm  .cqi  .dsk  .dmk  .sdf  .jvc  .vdk  .os9  

Commit Summary

  1. allow ES to accept .dsk extension. Add “Disk” to coco altRomType choice
  2. add "Tandy Radio Shack Color Computer cassettes" to coco softList choice in Advanced Game Options (lr-mame, standalone MAME)
  3. implement autoload behavior to use “usage” info in coco MAME software lists
  4. implement autoload behavior for .cas and .dsk (.bas in rom basename uses CLOAD/RUN)
  5. implement autoRunCmd override for cass and flop

Default Autoload Behavior (top to bottom)

  1. "usage" info field when using coco MAME software lists (if declared)
  2. Cassette (.cas) files autoload as binary - verified and tested Zaxxon (Datasoft).cas, Zonx (The Rainbow).cas autoload using CLOADM:EXEC (F10 is useful to unthrottle and speed up loading :)
  3. Disk (.dsk) files autoload based on basename (eg. ZONX.dsk autoloads as LOADM “ZONX”:EXEC)
  4. BASIC programs autorun if file basename ends with .bas - examples:
    4a. ALPHAII.BAS.dsk autoloads using RUN “ALPHAII”
    4b. GROVER.bas.cas autoloads using CLOAD:RUN
  5. user defined override (section below)

Example Autoload Behavior Found in MAME Software Lists

  1. run menu on disks that are a collection of programs (eg. Rainbow on Disk (eg. rbwd0288) autoruns RUN “MENU”)
  2. roms that require a series of commands to autoload (eg. Sam Sleuth autoruns LOADM "SLUTHIGH":EXEC:LOADM "SLUTHLOW":EXEC &H073F (as specified by developer)
  3. cassettes (or disks) that have BASIC bootloaders (eg. Grover’s Number Rover (CCW).cas requires CLOAD:RUN prior bootloader loading 2nd binary segment on tape into memory)

NOTE: A software list in “Advanced Game Options” must be selected to enable ES to search for your rom (and usage info, if available). This is not the default (unless you have set a software list for Color Computer in “Per System Advanced Configuration”)

User definable overrides

define autoload overrides in: system/configs/mame/autoload/coco_{cass,flop}_autoload.csv - examples:

  1. run a single BASIC program (able to symlink1988_02a.dsk to Castle of Death (The Rainbow) and autorun RUN “CASTLE”)

blank lines and lines starting with # (comments) are skipped in override file.

please consider contributing your overrides (and declaring new software) in our MAME software lists

Not Implemented

  1. tapes that require loading on both sides - user must attach 2nd .cas in MAME File Manager and continue CLOADM (eg. Sam Sleuth (part {1,2}) (Computerware).cas)) (possible future m3u implementation) (.dsk exists so not a high priority)

Verified carts continue to boot (eg. Personal Finance: finance2.zip)

If any other coco users want to pitch in and test their coco libraries, this would be great but I think I’ve covered most cases.

Let me know if you have any questions!

Complete List of Titles Verified to Autoload

  1. Rainbow on Disk (Feb 1988) (softList:coco_flop, rbwd0288.zip)
  2. Rainbow on Disk (Feb 1988) (1988_02a.dsk, bas, coco_flop override)
    2a. Castle of Death (The Rainbow, Feb 1988) (symlink, Castle of Death (The Rainbow).dsk, bas, coco_flop override)
    2b The Controllers (The Rainbow) (symlink, CONTROL.bas.dsk)
  3. Rainbow on Tape (Apr 1986) (ROT8604a.dsk, bas, coco_flop override)
    3a. Maze of Moycullen (symlink, MOYCULEN.BAS.dsk)
  4. CoCo Zone (cocozone.dsk, bas, override) (softList:coco_flop, cocozone.zip)
  5. Rescue on Alpha II (The Rainbow) (softList:coco_flop, ralpha2.zip)
  6. Rainbow Book of Adventures (softList:coco_flop, rnbadv1.zip)
  7. Rainbow Book of Adventures (RNBADV1{a,b}.dsk, bas, coco_flop override)
    7a. Deed of the York (symlink, DEEDYORK.BAS.dsk)
    7b. Dungeon Adventure (symlink, DUNGEON.BAS.dsk)
    7c. Escape from Sparta (symlink, ESSPARTA.BAS.dsk)
    7d. Head of the Beast (symlink, HEAD.BAS.dsk)
    7e. Lighthouse Adventure (symlink, LIGHTADV.BAS.dsk)
    7f. Search for the Ruby Chalice (symlink, RCHALICE.BAS.dsk)
    7g. An Unexplored Mansion (symlink, UMANSION.BAS.dsk)
  8. Sir Randolf of the Moors (SRANDOLF.dsk, bas)
  9. Second Rainbow Book of Adventures (softList:coco_flop, rnbadv2.zip)
  10. CoCo Max III (v3.1) (softList:coco_flop, ccmax31.zip)
  11. Grover’s Number Rover (softList:coco_flop, grover.zip)
  12. Grover’s Number Rover (cas/grover1.zip, coco_cass override) { prep for softList: coco_cass }
  13. JDOS v1.23 (ccc)
  14. Lansford Mansion (softList:coco_flop, lansford.zip)
  15. Personal Finance II (softList:coco_cart, finance2.zip)
  16. Sam Sleuth (Computerware) (softList:coco_flop, ssleuth.zip)
  17. Zaxxon (Datasoft) (cas, bin)
  18. Zaxxon (Datasoft) (wav, bin)
  19. Zaxxon (Datasoft) (cas/zaxxon1.zip) { prep for softLlist: coco_cass }
  20. Zaxxon (Datasoft) (softList:coco_flop, zaxxon.zip)
  21. Zonx (The Rainbow) (cas, bin)
  22. Zonx (The Rainbow) (cas/zonx1.zip, coco_cass override) { prep for softList: coco_cass }
  23. Zonx (The Rainbow) (softList:coco_flop, zonx.zip)
  24. Zonx (The Rainbow) (wav, bin, media: cass)

@dmanlfc
Copy link
Collaborator

dmanlfc commented May 15, 2024

squash your commits

- Override behavior in /usr/share/batocera/configgen/data/mame/coco_{cass,flop}_autoload.csv - if these files have the intention to be user configurable, then it should be in /userdata/configs/mame/ etc.

@udance4ever
Copy link
Author

udance4ever commented May 16, 2024

squash your commits

Do you have a good article on how to squash commits?

I tried practicing and following this article on a simpler branch in mamedev and feel it made it less readable by bringing non-related commits into the branch.

Override behavior in /usr/share/batocera/configgen/data/mame/coco_{cass,flop}_autoload.csv - if these files have the intention to be user configurable, then it should be in /userdata/configs/mame/ etc.

sanity check: does configgen create a data structure w the contents of an XML software list?

I ask because I believe it is more elegant to extract the usage statements already in the software lists and avoid duplicate effort:

<info name="usage" value="LOADM&quot;ZONX&quot;:EXEC" />

@dmanlfc
Copy link
Collaborator

dmanlfc commented May 16, 2024

I'm not sure of the software that you use but there are numerous ways to do it. Based on how you're working read the associated article(s).
configgen is just python & therefore flexible to leverage various xml source files to extract what you need to improve the user experience before launching etc. The XML files obviously need to be present beforehand.

@udance4ever
Copy link
Author

I'm not sure of the software that you use but there are numerous ways to do it. Based on how you're working read the associated article(s).

did you mean to link some articles? I’m just using CLI git and this stackexchange article makes it sound like this is the right command:

git rebase -i master

it looked like it was working using pick and squash until I wanted to push my commits - git complained I needed to pull and next thing my branch is cluttered with commits from other contributors. I don’t want a rerun of that here (it’s already happened to me twice)

if you have a favorite tool/process you like to use, I’m happy to try it.

configgen is just python & therefore flexible to leverage various xml source files to extract what you need to improve the user experience before launching etc. The XML files obviously need to be present beforehand.

ok based on your response, it doesn’t sound like there’s a global object anywhere with this data. I got the hang of ElementTree this past week so this is what I’d use.

Don’t merge anything until I give the green light - it’s okay if this gets included in v41 (i’ll update the changelog as needed)

I plan to add a menu option for the coco Cassette Software List so I want to build Emulation Station from source to make sure it works.

@dmanlfc
Copy link
Collaborator

dmanlfc commented May 17, 2024

I use sublime merge. but git rebase -i HEAD~14 will do you last 14 commits. and then squash accordingly. remember to use --force. i.e. git push origin coco_boot --force. then use --force for subsequent updates.

@udance4ever udance4ever force-pushed the coco_boot branch 2 times, most recently from f1f2848 to bde5c7f Compare May 17, 2024 04:44
@udance4ever
Copy link
Author

udance4ever commented May 17, 2024

git push origin coco_boot --force

THANK YOU for that - I really struggled with that and this worked perfectly! so much cleaner and now I have no fear of squashing commits in the future ☺️

Just realized I don’t have enough beef (8GB not 16GB+) in my machine for a full build so it craps out building host-batocera-llvm-18.1.2 - is it possible to just rebuild /usr/bin/emulationstation by itself so I can test just the ES menu changes I made?

I tried to go into the shell using make x86_64-shell and make batocera-emulationstation but this target insists on building the llvm target

(btw, as an integrator in a past life, the use of build containers is a godsend! solves soooo many cross-platform build problems we used to have back in the day!)

@udance4ever
Copy link
Author

udance4ever commented May 19, 2024

if these files have the intention to be user configurable, then it should be in /userdata/configs/mame/ etc.

ok - I’m done incorporating your suggestion and pretty happy with the result!

  1. I added & tested 11 coco disk roms I contributed to the official coco_flop MAME software list
  2. optional overrides now definable in system/configs/mame/autoload

updated the changelog & squashed my commits :)

only thing remaining is getting my hands on a build of ES that contains the menu changes. Might you have a build server in the cloud to offer I can get permission to build inside a Docker container and host the update when it’s done?

Even without the menu changes, everything works fine in a patched up v39.

@dmanlfc
Copy link
Collaborator

dmanlfc commented May 19, 2024

are these files still necessary - coco_{cass,flop}_autoload.csv ?
if so, you may want to add them to datainit so they're populated in /userdata at install / update.

@udance4ever
Copy link
Author

udance4ever commented May 19, 2024

because the MAME software lists can do all the heavylifting, it’s only there for power users who aren’t happy with the defaults (and perhaps workarounds). the files are optional and don’t need to be included on install/update.

- allow ES to accept .dsk extension. Add “Disk” to coco altRomType choice
- add "Tandy Radio Shack Color Computer cassettes" to coco softList choice in Advanced Game Options (lr-mame and standalone)
- implement autoload behavior to use "usage" info in MAME software lists
- implement autoload behavior for .cas and .dsk (.bas in rom basename uses CLOAD/RUN)
- implement user definable override (optional) for cass and flop (system/configs/mame/autoload)
@dmanlfc
Copy link
Collaborator

dmanlfc commented May 19, 2024

Understood but my only reservation is that you don't provide an example of the csv. So even to an advanced user, it's not clear what should be in the csv file to make modifications. So my advice is to either provide example files, outline what one looks like in the _info.txt file or remove the reference.

@udance4ever
Copy link
Author

thank you very much for the feedback! I added two files (one simple and one complex example) - I noticed the datainit tree is pretty sparse, did I put them in the right place?

@dmanlfc
Copy link
Collaborator

dmanlfc commented May 20, 2024

you need to do it from the mame package, not the batocera-datainit package. see iortcw.mk or libreretro-mame2003 or just search $(TARGET_DIR)/usr/share/batocera/datainit/system/configs to see multiple package populating the folder accordingly.

@udance4ever
Copy link
Author

ok - thanks. updated the commit. Please review my changes to mame.mk

@dmanlfc dmanlfc merged commit 46d4542 into batocera-linux:master May 21, 2024
@udance4ever
Copy link
Author

udance4ever commented May 31, 2024

thanks for the merge! coco is looking much shinier in Batocera now thanks to your support! :)

tested latest butterfly build (40-dev-9a61198db7 2024/05/27 01:56) and everything that must work works.

2 minor issues:

  1. Choosing the new coco cassette software list option in ES produces the following error from MAME (doesn’t find any matches nor does it report any close ones):
evmapy: no process found
2024-05-30 18:08:42,957 ERROR (emulatorlauncher:555):runCommand 
"zonx1" approximately matches the following
supported software items (best match first):

Workaround: specify “Cassette” as media type (and not use software list)

I confirmed ES passes coco_cass to softList in mameGenerator and that it passes the correct XML file to MAME:

[root@BATOCERA /var/run/mame_software]# ls -al hash/coco_cass.xml coco_cass
lrwxrwxrwx 1 root root 23 Jun  4 00:03 coco_cass -> /userdata/roms/coco/cas
lrwxrwxrwx 1 root root 32 Jun  4 00:03 hash/coco_cass.xml -> /usr/bin/mame/hash/coco_cass.xml

Who on the MAME team could we chat with to better understand how to integrate the following new software list?

https://github.com/udance4ever/mame/blob/coco_cass/hash/coco_cass.xml

  1. system/configs/mame/autoload files don’t show up in a Batocera upgrade - is there an upgrade hook to copy these files into /userdata/system? I notice they exist in the overlay here so they were copied successfully during the build:
/overlay/base/usr/share/batocera/datainit/system/configs/mame/autoload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants