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

Hi,

I was a little disappointed that THE home computer of the 80ies just has poor support in GameEx. I don´t speak of the database and GameEx itself - it´s simply the fact that there are no screenshot packs, box shots etc. out there that can be used immediately with GameEx. The only way to get a good base for C64 games in GameEx seemed to be to use the outdated GoodTools script that renames the short names of GB64 V3 to long names. Nevertheless, a screenshot converter was still missing...

So I took some time, took a deeper look into the GB64 v5 database (get if from www.gb64.com) and searched for WHS code snippets.

And here is the result:

gb64.jpg

gb642.jpg

The Code:

inputRomFolder = "Games"
inputSnapFolder = "Screenshots"
'inputCoverFolder = "Cover"
outputRomFolder = "GB64Ren\roms"
outputSnapFolder = "GB64Ren\snaps"
outputTitlesFolder = "GB64Ren\titles"
outputCoverFolder = "GB64Ren\boxes"

On Error Resume Next

Set fso = CreateObject("Scripting.FileSystemObject")
Set gameFile = fso.CreateTextFile("GB64roms2Good.bat", True)
Set snapFile = fso.CreateTextFile("GB64snap2Good.bat", True)
Set boxesFile = fso.CreateTextFile("GB64boxes2Good.bat", True)

gameFile.WriteLine ("chcp 1252")
gameFile.WriteLine ("md " & outputRomFolder)
snapFile.WriteLine ("chcp 1252")
snapFile.WriteLine ("md " & outputSnapFolder)
snapFile.WriteLine ("md " & outputTitlesFolder)
boxesFile.WriteLine ("chcp 1252")
boxesFile.WriteLine ("md " & OutputCoverFolder)

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=GBC_v05.mdb"

Set objRecordSet = CreateObject("ADODB.Recordset")
objRecordSet.Open "SELECT * FROM Games ORDER BY GA_Id" , objConnection, 3, 3
objRecordSet.MoveFirst

Do Until objRecordSet.EOF
outputFilename = objRecordSet.Fields.Item("Name")
outputFilename = Replace(outputFilename,"\","-")
outputFilename = Replace(outputFilename,"/","-")
outputFilename = Replace(outputFilename,":","-")
outputFilename = Replace(outputFilename,"*","-")
outputFilename = Replace(outputFilename,"?","-")
outputFilename = Replace(outputFilename,"<","-")
outputFilename = Replace(outputFilename,">","-")
outputFilename = Replace(outputFilename,"|","-")
outputFilename = Replace(outputFilename,chr(34),"-")

If Len(objRecordSet.Fields.Item("Filename"))<>0 then
gameFile.WriteLine ("copy /Y ") & chr(34) & inputRomFolder & ("\") & objRecordSet.Fields.Item("Filename") & chr(34) & chr(32) & chr(34) & outputRomFolder & ("\") & outputFilename & (" (") & objRecordSet.Fields.Item("GA_Id") & (")") & Right(objRecordSet.Fields.Item("Filename"),4) & chr(34)
snapFile.WriteLine ("copy /Y ") & chr(34) & inputSnapFolder & ("\") & objRecordSet.Fields.Item("ScrnshotFilename") & chr(34) & chr(32) & chr(34) & outputSnapFolder & ("\") & outputFilename & (" (") & objRecordSet.Fields.Item("GA_Id") & (")") & Right(objRecordSet.Fields.Item("ScrnshotFilename"),4) & chr(34)
snapFile.WriteLine ("copy /Y ") & chr(34) & inputSnapFolder & ("\") & Left(objRecordSet.Fields.Item("ScrnshotFilename"),Len(objRecordSet.Fields.Item("ScrnshotFilename"))-4) & ("_1") & Right(objRecordSet.Fields.Item("ScrnshotFilename"),4) & chr(34) & chr(32) & chr(34) & outputTitlesFolder & ("\") & outputFilename & (" (") & objRecordSet.Fields.Item("GA_Id") & (")") & Right(objRecordSet.Fields.Item("ScrnshotFilename"),4) & chr(34)
End If
objRecordSet.MoveNext
Loop

Set objRecordSet2 = CreateObject("ADODB.Recordset")
objRecordSet2.Open "SELECT * FROM Extras ORDER BY GA_Id, DisplayOrder" , objConnection, 3, 3
objRecordSet2.MoveFirst
objRecordSet.MoveFirst
last_gaid = 0

Do Until objRecordSet2.EOF
If Left(objRecordSet2.Fields.Item("Name"),Len("Cover")) = "Cover" AND Left(objRecordSet2.Fields.Item("Name"),Len("Magazine")) <> "Magazine" then
Do Until objRecordSet.EOF
If objRecordSet2.Fields.Item("GA_Id") <> objRecordSet.Fields.Item("GA_Id") Then
objRecordSet.MoveNext
Else
outputFilename = objRecordSet.Fields.Item("Name")
outputFilename = Replace(outputFilename,"\","-")
outputFilename = Replace(outputFilename,"/","-")
outputFilename = Replace(outputFilename,":","-")
outputFilename = Replace(outputFilename,"*","-")
outputFilename = Replace(outputFilename,"?","-")
outputFilename = Replace(outputFilename,"<","-")
outputFilename = Replace(outputFilename,">","-")
outputFilename = Replace(outputFilename,"|","-")
outputFilename = Replace(outputFilename,chr(34),"-")
boxesFile.WriteLine ("copy /Y ") & chr(34) & objRecordSet2.Fields.Item("Path") & chr(34) & chr(32) & chr(34) & outputCoverFolder & ("\") & outputFilename & (" (") & objRecordSet.Fields.Item("GA_Id") & (")") & Right(objRecordSet2.Fields.Item("Path"),4) & chr(34)
last_gaid = objRecordSet2.Fields.Item("GA_Id")
Do While objRecordSet2.Fields.Item("GA_Id") = last_gaid
objRecordSet2.MoveNext
Loop
Exit Do
End If
Loop
End If
objRecordSet2.MoveNext
Loop

gameFile.Close
snapFile.Close
boxFile.Close

What does this script do?

It creates "GB64roms2Good.bat", "GB64snap2Good.bat" and "GB64boxes2Good.bat". Those *.bats simply copy files from the GB64 collection to the folders GB64Ren\roms, GB64Ren\snaps, GB64Ren\titles and GB64Ren\boxes and give them a unique name (like the GoodTools v3 gbc2long.bat script) so that the games can directly be played in GameEx after setting the right paths in the Emulator Setup page.

How do I use it?

Simply copy the text above to a text file, rename it e.g. to "Convert_GB64_v5.vbs", move it to the same directory where the Gamebase64 database file "GBC_v05.mdb" is located and run it. It will create the three *.bat files within a few seconds. Then, put the *.bat files in your Gamebase directory just above the folder "Games", "Screenshots" and "Covers" and start them (you can also run all 3 at the same time). A new directory GB64Ren as well as subdirectories will be created and the files are being copied automatically in the right folders.

How does it work?

This script accesses the Gamebase database by using the Windows Scripting Host. It opens the table "Games" and goes through it line-by-line reading the entries "Filename", "ScrnshotFilename", "Name" and "GA_Id". The first one contains the original GB64-filename, "ScrnshotFilename" the base name of the snapshots, "Name" the unshortened game name and "GA_Id" the unique Gamebase-ID. The following codelines write DOS-copy commands to the *.bats using the original game name and the Gamebase-ID for the new filenames, e.g. :

copy /Y "Games\0\100KPYRA_00001_01.zip" "GB64Ren\roms\$100,000 Pyramid, The (1).zip

If there are special characters in the game name that are not allowed on the Windows file systems, they are being converted before. Furthermore, the DOS line "chcp 1252" allows correct renaming of filenames that use umlauts etc.

The same is being done for the screenshots. Browsing through the Gamebase database online, I found out that very often the second screenshot (with the extension "_1.jpg") is the title or boot screenshot. So, an additional copy-line is generated that copies the "_1"-screenshot to the titles folder while the first screenshot goes to the GB64Ren/snaps directory. If the "_1"-screenshot does not exist, you simply get an "file not found" error message. So every database entry becomes something like:

copy /Y "Screenshots\0\The_$100,000_Pyramid.png" "GB64Ren\snaps\$100,000 Pyramid, The (1).png"

copy /Y "Screenshots\0\The_$100,000_Pyramid_1.png" "GB64Ren\titles\$100,000 Pyramid, The (1).png"

The last passages have been written for getting covers out of the GB64 extras pack and put it into the folder GB64Ren\boxes. For this, the table "Extras" is being read, and if the field "Name" has the entry "Cover", the file mentioned in the field "Path" is being copied. If there are further covers for the same game (i.e. if the GA_Id stays the same within the next database entries) they are simply ignored.

Customization

You can change every path apart from the "covers" path because not every cover has been stored in the "Cover" subdirectory - some are also located in the folder "Magcover".

To-do and problems

1) From what I can see, this script is working without bugs and is fast enough. Nevertheless, as I am not a WSH and DB guru, I think that the code could be much more readable if someone else here with more scripting knowledge could optimize it. And because I started taking a deeper look into the SQL commands quite late, there might also be a lot of room for improvements... But, well, it works ;)

2) SOLVED: When using the GameEx C64 database, I had to wait here for more than 15 minutes when reading the directory for the first time! Here is a Q6600 with 2 GByte RAM, all ROMs an images stored on a local HD --- only happens the first time.

3) Although the games have exactly the same names like the screenshots and titles, sometimes a wrong image is being displayed as title (see the "Defender" screenshot below feat. "Defender of the Crown" as "title" - I know, that this is not the real title screen, but that the "_1" picture in GB64...); in fact, there should be none as there is not title shot for the game "Defender"). Any way to turn off the fuzzy matching here?

4) Does GameEx support more than one screenshot per game?

5) Currently, games in the list with the same name are only differenciated by their Gamebase-ID shown in brackets (as long this is activated in the settings). Maybe it would make sense to add additionally info about the version in a second bracket (like "US" or the publisher´s name).

6) Adopt it to Gamebase Amiga etc. ... ;)

gb64wrongtitle.jpg

Have fun... - any suggestions and help are very welcome ;)

Posted

Great post. Thanks.

RE: The 15 minutes. GameEx should only do this once, or if you change the config for the emulator. It does use caching techniques.

RE: The snap matching, ive actually improved this for the next version avaiable shortly.

If you email me ill send you the Beta.

Keep it up ;)

Posted
Great post. Thanks.

RE: The 15 minutes. GameEx should only do this once, or if you change the config for the emulator. It does use caching techniques.

RE: The snap matching, ive actually improved this for the next version avaiable shortly.

If you email me ill send you the Beta.

Keep it up ;)

Just checked it again with the database - indeed this only seems to happen once. Going to edit my text above...

Concerning the Beta - thanks for the offer, and if you need bugreports, feel free to send it to me ;)

But to be honest: I can´t promise giving you fast feedback until you release it - I think that you will release the new version around next weekend?

Posted

Just working on the Amiga "version". As I expected: Minor modifications.

1) The name of the MDB file is of course different

2) The boxes in the table "Extras" are now called "Boxscan - Front" and not "Covers" anymore

3) The base screenshot name refers to the title screenshot, while "_1" is a game screenshot, so it´s the opposite of how it has been done in most cases in GB64.

Nevertheless, it´s a little bit annoying that I found a "/" in several screenshot pathnames which needs to be replaced against "\".

I haven´t installed Gamebase Amiga yet, just used the mdb file. There is said to be support for the IDF image file format which I currently don´t take care of (I also do similar on the C64 renaming because I ignore additional cards and tapes delivered with some extra packages, but it´s now already more games than mankind can play ;)).

And, I have to admit that I did not test a single game yet, so maybe it would also be necessary to generate script files for every game that delivers the recommended kickstart version etc. as parameters to UAE. Going to check posts first that deal with running Amiga games...

When I have finished testing the renaming, I am going to release it and see later on, what still needs to be done to get Amiga games starting as comfortable as possible.

Posted

Just so you know I've already converted the GameBase 64 database to the mdb format GameEx uses. It's just going to take a long time to fill out it's missing parts (such as description etc.) so I'm not really sure what is different with your database.

Also I have already written software to convert the GameBase Amiga database which is available in WinUAE Loader and has full GameEx support built in. It also contains tools to convert all the snaps and titlescreens into a format that works with GameEx. And you are right the database contains scripts for WHDLoad and info on what is required to boot the game. Again this is automated in WinUAE Loader.

Just thought I'd let you know incase I can save you some time.

Posted
Just so you know I've already converted the GameBase 64 database to the mdb format GameEx uses. It's just going to take a long time to fill out it's missing parts (such as description etc.) so I'm not really sure what is different with your database.

Also I have already written software to convert the GameBase Amiga database which is available in WinUAE Loader and has full GameEx support built in. It also contains tools to convert all the snaps and titlescreens into a format that works with GameEx. And you are right the database contains scripts for WHDLoad and info on what is required to boot the game. Again this is automated in WinUAE Loader.

Just thought I'd let you know incase I can save you some time.

I just had to make a few adjustments on my script to get the Amiga things working, so it was no big work getting this working. And I had in mind that there has been a thread here about Amiga support, so I will take a closer look what already has been done. At least, I did not know that there is also a conversion function for snaps and titlescreens etc.

However, I see this renaming script "project" also as opportunity to see other Gamebase collections (CPC, Spectrum etc.) working with GameEx just by changing a few lines in the code. If I would find the time, it would be worth to port it to AutoIt and create a GUI where you can change all the relevant parameters - some kind of GameBase-2-GameEx-Converter...

  • 3 weeks later...
Posted

thanks - i used your script and it worked very well.

now my c64-collection is much more enjoyable.

info for c-64 fans:

i use ccs64 for the games and had always problems with screen tearing. (because 50 hz of c64)

i changed to 100 hz and tearing was better, but not perfect.

then i customized my windows settings (nvidia-system)

set resolution to 800x600 and 100,24 Hz. (c64 runs original at 50,12)

now i have perfect picture without tearing.

greets and thanks for your work

iceman311

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