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

I wrote a little application yesterday for a specific purpose as there didn't seem to be anything around to do what I wanted.

Hopefully it will be of use to others!

Problem

I have a set of disc images for a particular Emulator.

The files were all zipped in rar format and unzipped into ISO, CUE files.

The filenames were a bit untidy so I wanted to rename them.

A few examples:

3_in_1_DUO_Demo_CD_(NTSC-U)_[DUO_DEMO_01].rar

Advanced_Variable_Geo_(NTSC-J)_[GLCD4001].rar

Basted_(NTSC-J)_[NAPR-1042].rar

F1_Team_Simulation_Project_F_(NTSC-J)_[TJCD2026].rar

Zero_Wing_(NTSC-J)_[NXCD1003].rar

I know that GameEx can replace underscores and hide text in brackets but I wanted to tidy them up. You can use the same method for simple things like changing the Regions from (U) to (USA) for thousands of files...

Solution - Part 1 - Extract All

Firstly I selected all 500+ files and selected WinRAR option "Extract Here".

This left me with 1000+ files in this format:

3_in_1_DUO_Demo_CD_(NTSC-U)_[DUO_DEMO_01].iso

3_in_1_DUO_Demo_CD_(NTSC-U)_[DUO_DEMO_01].cue

Advanced_Variable_Geo_(NTSC-J)_[GLCD4001].iso

Advanced_Variable_Geo_(NTSC-J)_[GLCD4001].cue

Basted_(NTSC-J)_[NAPR-1042].iso

Basted_(NTSC-J)_[NAPR-1042].cue

F1_Team_Simulation_Project_F_(NTSC-J)_[TJCD2026].iso

F1_Team_Simulation_Project_F_(NTSC-J)_[TJCD2026].cue

Zero_Wing_(NTSC-J)_[NXCD1003].iso

Zero_Wing_(NTSC-J)_[NXCD1003].cue

Solution - Part 2 - Renaming Files

I copied the ISOs and CUEs only into a seperate folder.

I then downloaded this portable application:

http://portableapps....enamer_portable

What you do is point Ant Renamer to a folder and then you can replace or delete certain characters from the filenames in one swoop.

I made these changes:

- String Replacement - Replace '(NTSC-J)' with '(Japan)'

- String Replacement - Replace '(NTSC-U)' with '(USA)'

- Characters Deletion - After The String ')' to remove the text in square brackets (i.e. '[NXCD1003]'). I had to click this a few times until everything was cleared. It does not touch the file extension so you can spam it.

- String Replacement - Replace '_' with ' ' to replace the Underscores with spaces.

The files are now named like this:

3 in 1 DUO Demo CD (USA).cue

3 in 1 DUO Demo CD (USA).iso

Advanced Variable Geo (Japan).cue

Advanced Variable Geo (Japan).iso

Basted (Japan).cue

Basted (Japan).iso

F1 Team Simulation Project F (Japan).cue

F1 Team Simulation Project F (Japan).iso

Zero Wing (Japan).cue

Zero Wing (Japan).iso

Solution - Part 3 - The CUE Problem

Now this is where I have a problem. Each cue file will have an entry on the first line pointing to the name of the related ISO/BIN/IMG file like this:

FILE "3_IN_1_DUO_DEMO_CD_(NTSC-U)_[DUO_DEMO_01].ISO" BINARY

TRACK 01 AUDIO

INDEX 01 00:00:00

TRACK 02 MODE1/2352

PREGAP 00:03:00

INDEX 01 00:44:65

TRACK 03 AUDIO

PREGAP 00:02:00

INDEX 01 01:04:29

TRACK 04 MODE1/2352 etc etc

As you can see - it still has the name of the old file.

It needs to now read like this:

FILE "3 in 1 DUO Demo CD (USA).ISO" BINARY

TRACK 01 AUDIO

INDEX 01 00:00:00

TRACK 02 MODE1/2352

PREGAP 00:03:00

INDEX 01 00:44:65

TRACK 03 AUDIO

PREGAP 00:02:00

INDEX 01 01:04:29

TRACK 04 MODE1/2352 etc etc

I scanned the internet for something that would change just the first row in a text file to the name of another file.

Nothing exists and so this means manually copying and pasting the new filename into each of the 500+ cue files.. :angry:

Solution - Part 4 - Correcting the Cues

Since nothing exists I wrote a small application in Dot.Net to do the job.

Here it is!

CUERenamer.exe.txt (Remove .txt Extension)

It was written using Dot.net 3.5 which runs natively in Windows 7 so it doesn't need to be installed. You may have to install the Dot Net framework on XP though.

My colleague at work has also made a ".bat" file for this purpose as well so if you don't trust running my EXE file I will post this as well. Mine is quicker though - processing 500 cue files in about 3 seconds!

This is how to use the app:

- Open the App

- Select a folder that contains the CUE files using the '...' button at the top

- All CUE files found will be populated into the list box

- Click "Process" and it will go through all of the CUE files one by one and amend the first row to correspond with the name of the CUE file.

So this:

FILE "3_IN_1_DUO_DEMO_CD_(NTSC-U)_[DUO_DEMO_01].ISO" BINARY

Becomes this:

FILE "3 in 1 DUO Demo CD (USA).ISO" BINARY

The file extension (iso, bin, img) will remain the same as the original - just the filename will change (the bit highlighted in blue above).

It will read the original CUE files and write new CUE files for each into a Subfolder named 'Output'. It won't change the original files.

Note that if you have cue files with entries to multiple BIN files or WAV/MP3 files - these will have to be updated manually - this only updates the first row.

Took me about 3 hours to write this application but has saved 3 times that time in effort already.

Here are some screenshots showing what I describe above.

ProcessCUEsVisualGuide.pdf

Hope it's of some use to others.

B)

  • Like 3
Posted

Always nice to see things being coded up! Nice work. :)

Posted

Here is the BAT file my colleague made as well:

CueRen.bat.txt (remove .txt Extension)

Simply put the bat file in the folder with all of your CUES and run it.

Amended CUEs are again copied into a "\Output" folder.

It will do the same thing - albeit a little slower :)

Nice to see we are both making the most of our time at work eh!

I think you just have to amend this line if your cue files relate to anything but ISOs:

set str=%str:cue=iso%

change to (for example)

set str=%str:cue=bin%

set str=%str:cue=img%

etc

Posted

This has been a HUGE help to me... thank you!

What can I now use to batch rezip them?

I would want them all individually 7-zipped.

Posted

This has been a HUGE help to me... thank you!

What can I now use to batch rezip them?

I would want them all individually 7-zipped.

That would require some more bat file work.

I'll give it some thought for you!

Posted

OK.

Download 7-Zip portable and install if you don't have it. Get a portable version here:

http://portableapps..../7-zip_portable

The only files you will need from the installation are:

7z.exe

7z.dll

Copy these from the 7z Installation folder (eg. PortableApps\7-ZipPortable\App\7-Zip) into the same folder as the cue files and related bins/isos.

Download this bat file and copy this to the same folder as well:

Rezip.bat.txt (remove .txt extension)

Run the Rezip.bat file!

  • Like 1
  • 1 year later...
Posted

Thank you for your great tool!

It saved me a lot of work!

One tiny thing, why a output folder? i now have to move many files :-(, maybe there should be a checkbox if you want it to be in a output folder (ok i got it, it's only a probelm when you have separate folders :-(

and maybe look in folders

Keep up the good work

PS: It took me hours to figure out why MEDNAFEN (PCE CD) was suddenly not working, GameEx changed the Name of the Iso's, replacing dashes, and the CUE files pointed to the original names with dashes.

Maybe there should be a little warning when enabling it in GameEx-Wizard, like: warning beware of your cue files etc. this will screw you! ;-)

  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...