Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. My bare hosting costs are currently not met so please consider donating by either clicking this text or the Patreon link on the right.

Patreon

Recommended Posts

Posted

Hey everyone, I've been wanting to set up GameEx to run C64 Disks through WinVice, when I hit a snag - disk changing. These are handled by fliplists in the emulator, but I was too lazy to manually create lists for my entire No-Intro set, so I made a bash script for it. Thought this might be of use to others, so here it is!

DISCLAIMER: I am a poor coder, and know bash at the bare minimum. This script worked for me using Cygwin, and that's all I needed - it's definitely not efficient, there's minimal error-checking, and might have redundancies. If you know enough about bash scripting to improve this code, please post here!! As always, use at your own risk.

This script is specifically for Cygwin - I'm sure it wouldn't take much tinkering to edit it for Mac and Linux.

Known Bugs:

- There are a few newlines at the end of each created fliplist file, it doesn't interfere with WinVice so I didn't bother fixing it
- Any game that has different versions (ie. (Alt 1), (1.1), etc.) get written to the original version's fliplist as well, along with having their own fliplists. All you have to do is ignore them when changing disks in WinVice
- I haven't tested this with any symlinks, but I assume it probably won't work properly

Prerequisites:

- A C64 disk set with No-Intro naming conventions (multi-sided disks are labelled with "Side x"), unzipped and in *.g64 format (if they're in *.nib format, use NibTools to convert them - http://c64preservati.../files/nibtools)
- Cygwin
- This script, saved in your C64 Disk rom folder

After the script has run, there should be a folder named "fliplists" in your roms folder. In GameEx, you must set the launch parameters for WinVice to include the flag

-flipname "[ROMPATH]\fliplists\[ROMFILE].vfl" 

In the emulator, use ALT+B or ALT+N to switch between disks.


NOTE: These fliplists will break if you ever move or rename your roms!

Script:

#!/bin/bash#Poorly coded by pforkp#Prerequisites: C64 (PP) Roms, aka Disks, named according to the No-Into dat, unzipped in a directory, in *.g64 format#Put this script in your C64 Disk rom folder, and run it with Cygwin. It creates a folder called fliplists containing fliplists for WinVice.#You must set the launch parameters for WinVice in GameEx to include the -flipname "[ROMPATH]\fliplists\[ROMFILE]" flag#Set current directoryTMPDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"#Change the Cygwin path to Windows formatDIR="$( cygpath -w "$TMPDIR" )"#create filename listsls>>filenames.txtgrep "(Side 1)" filenames.txt>>filenames2.txt# Make fliplists directory in current dir if it doesn't existmkdir -p "fliplists"#search for (Side 1)grep "(Side 1)" filenames2.txt | while read linedo#create a .vfl file with the current file nameecho "Creating $line.vfl"touch "./fliplists/$line.vfl"#fill with WinVice information, including the current file nameecho -e "# Vice fliplist file\\n\\nUNIT 8\\n$DIR\\$line\\n">>"./fliplists/$line.vfl"#Set find to all text before (Side 1)find=`echo ${line%" (Side 1"*}`#search filenames for everything matching "find", write it to the file so long as it's not equal to the Side 1 filegrep "$find" filenames.txt | while read line2do[ "$line2" != "$line" ] && echo -e "$DIR\\$line2\\n">>"./fliplists/$line.vfl"donedone#Cleanuprm -v ./filenames.txtrm -v ./filenames2.txt

If you edit this in a Windows text editor, be sure to run dos2unix on the script to convert the text to Unix format! Also, if you have issues running this script as-is, try converting with dos2unix as your first troubleshooting step.

To do this from the Cygwin command line, navigate to the folder containing the script and run:

dos2unix -n "scriptname" "convertedscript" 

where "scriptname" is the name of the script you edited, and "convertedscript" is the new UNIX-friendly file.

Again, please let me know of any improvements you can think of (I'm sure there are plenty), or if you can edit it to be compatible with Mac and Linux!

  • Like 1
Posted

Cool, thanks for the share pforkp! Welcome to the GameEx forums! I guessing this script will come in handy for quite a few Commodore64 enthusiasts. It also never hurts to spread the word on Cygwin! ;) Looks to me like this would work in any BASH shell (gotta love redundancy) so I'm guessing it would already be good to go for most Linux distributions. Well done!

Posted

Thanks! Yeah, I thought it might be compatible with Linux, minus the first couple of lines converting the current path from Linux to Windows. I don't have a distro handy to test it, but I *think* you can just rename the first variable from TMPDIR to DIR, then delete the second line (the one that uses cygpath to convert the path) - should be good to go in Linux.

Guest
This topic is now closed to further replies.
×
×
  • Create New...