Author Topic: Script to set RomPath in ClrMamePro for TOSEC dats  (Read 11144 times)

Offline sl0ppy

  • Newbie
  • *
  • Posts: 3
Script to set RomPath in ClrMamePro for TOSEC dats
« on: January 14, 2010, 02:53:37 PM »
Hello,

I just wrote a Perl script that will read in the ClrMamePro settings files and set the RomPath for each TOSEC dat automatically.  It follows the TOSEC directory naming convention that is created with their directory creation scripts.

Before running this script, import all the TOSEC dats into clrmamepro, and then load them all using Batchmode and perform a scan so that clrmamepro generates the .cmp file for each dat in the clrmamepro settings directory.   

I didn't feel like clicking through each new dat in ClrMamePro to configure all of them so I whipped this up.

Just FYI I only tested this in Linux but it should work on other platforms.

http://dhp.com/~sloppy/code/clrmamepro_tosec.pl
« Last Edit: January 15, 2010, 05:47:33 PM by sl0ppy »



Offline PandMonium

  • Administrator
  • Hero Member
  • *****
  • Posts: 1332
Re: Script to set RomPath in ClrMamePro for TOSEC dats
« Reply #1 on: January 14, 2010, 04:02:34 PM »
Hey,

thanks sl0ppy, i'm sure that will help a lot of guys around.
Symmo (a member here) also had some method of doing that with cmp, he also found a small bug that happened with .sh scripts under ext4 i think.

Anyway if you need something to use in your scripts just ask :)

Offline sl0ppy

  • Newbie
  • *
  • Posts: 3
Re: Script to set RomPath in ClrMamePro for TOSEC dats
« Reply #2 on: January 14, 2010, 04:18:54 PM »
I think that I encountered that bug.  When I ran the shell scripts to create the directory it created all the directories with a ^M appended to the end.  I had to do a mkdir /tmp/deleted; find /roms/TOSEC -type d -name \*(hold down Control and press v and then m) -exec mv  {} /tmp/deleted\; to delete them. Next I cat'd the TOSEC script and cut and pasted it into a seperate file and it worked correctly.

Hey,

thanks sl0ppy, i'm sure that will help a lot of guys around.
Symmo (a member here) also had some method of doing that with cmp, he also found a small bug that happened with .sh scripts under ext4 i think.

Anyway if you need something to use in your scripts just ask :)

Offline sl0ppy

  • Newbie
  • *
  • Posts: 3
Re: Script to set RomPath in ClrMamePro for TOSEC dats
« Reply #3 on: January 14, 2010, 04:36:33 PM »
What makes it more complicated to script this is that the TOSEC dat filenames do not always delineate the company name and model.  So for example you can have:

Texas Instruments TI-82 - BIOS (TOSEC-v2006-04-21_CM).dat
Dir: Texas Instruments/TI-82/BIOS/
Better filename: Texas Instruments - TI-82 - BIOS

Tandy Radio Shack - TRS-80 MC-10 - Various (TOSEC-v2006-06-08_CM).dat
Dir: Tandy Radio Shack/TRS-80 MC-10/Various
This works as is!

Sinclair ZX Spectrum - Compilations - Demos - [Hobeta] (TOSEC-v2007-01-01_CM).dat
Sinclair/ZX Spectrum/Compilations/Demos/[Hobeta]
Better filename: Sinclair - ZX Spectrum - Compilations - Demos - [Hobeta]

The - (dash) in the filenames are great for determining what are the subdirectories, but for a lot of them there is no dash between the company name and model so it's not very simple to come up with what the RomPath will be.


Offline PandMonium

  • Administrator
  • Hero Member
  • *****
  • Posts: 1332
Re: Script to set RomPath in ClrMamePro for TOSEC dats
« Reply #4 on: January 14, 2010, 04:51:50 PM »
Yes, it is hard to get that (impossible :P) without any 'help', the format we use is:
Company System - Categories ...
that's why you'll find most of the dats using:
"Sinclair ZX Spectrum - Categories", instead of "Sinclair - ZX Spectrum - Categories", the later shouldn't exist at all and if there are some in that format they will change in the future, i think it is not great to have company and system sepparated ("Nintendo - 64", "Sega - Game Gear", and so on).

Anyway, that was the reason i asked if you wanted some help, i can provide you a list of folders based on datnames, a list of the valid companies or systems or something like that :P
As for the .sh yes, they had an extra char at the end due to being done in windows (EOL differences), if you want the fixed ones (i hope) : http://www.tosecdev.org/TOSEC_folders%20(2009-12-27).zip

Offline tmlmad

  • Newbie
  • *
  • Posts: 8
Re: Script to set RomPath in ClrMamePro for TOSEC dats
« Reply #5 on: January 16, 2010, 04:34:35 PM »
Hi

I have too made 2 little freebasic programm, some week ago

The First change the CMP dat before load dat on cmp pro

Hes add Rebuild to on dat

The Secund change the dat after load on a profile on cmp

With check of Tosec Dat and good company and name of set

Thats change the dat files on the root cmp setting folder (no file on sub folder arent change)

You have source *.bas and exe

Make a copy of the clrmamepro folder before use

You can examine, see, check then bas file ..... and, why not,  try the exe
it's the same post on pleasuredome site

You must use tosec folder structure and put the software on the root of you rom

bye bye
« Last Edit: January 16, 2010, 04:40:05 PM by tmlmad »

Offline Symmo

  • TOSEC Contributor
  • Jr. Member
  • **
  • Posts: 55
Re: Script to set RomPath in ClrMamePro for TOSEC dats
« Reply #6 on: January 17, 2010, 01:00:44 PM »
Thats right about the eol thing .
There is a unix tool to convert such things i have found dos2unix the command is to convert it back.
Try this as your wallpaper if you are new :-) http://symmo.net/tosec/tosectnc.png