Importing Images Issues

Do you have trouble to set-up your emulator for a platform?, need a script?...ask here, we might be able to help you!
User avatar
Shando
Posts: 25
Joined: 13 Nov 2015, 06:39
Location: Perth, Western Australia

Importing Images Issues

Unread post by Shando » 14 Sep 2016, 04:21

Hi All,

I am having some issues with importing Images into ECC.

I have downloaded several GB of Images and the relevant DAT files from http://www.progettosnaps.net. The DAT files appear to be in clrmamepro format:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE datafile PUBLIC "-//Logiqx//DTD ROM Management Datafile//EN" "http://www.logiqx.com/Dats/datafile.dtd">

<datafile>
	<header>
		<name>progetto-SNAPS - Bosses</name>
		<description>pS Bosses 20160812</description>
		<category>MAME Arts</category>
		<version>0.176</version>
		<date>12/08/2016</date>
		<author>AntoPISA</author>
		<email>progettosnaps@gmail.com</email>
		<homepage>http://www.progettosnaps.net/</homepage>
		<url>http://www.progettosnaps.net/snapshots/</url>
		<comment>-</comment>
		<clrmamepro/>
	</header>
	<machine name="bosses">
		<description>bosses</description>
		<manufacturer>????</manufacturer>
		<rom name="1941.png" size="27785" crc="0e1c7a3c"/>
		<rom name="1941j.png" size="20284" crc="f7eae714"/>
		<rom name="1941r1.png" size="29562" crc="df46f1d2"/>
		<rom name="1941u.png" size="32355" crc="d982d303"/>
		<rom name="1942.png" size="5991" crc="35662917"/>
		<rom name="1943.png" size="16296" crc="3100bf67"/>
		<rom name="1943b.png" size="12697" crc="7f3d9611"/>
		<rom name="1943j.png" size="5949" crc="863bf391"/>
		<rom name="1943ja.png" size="15945" crc="9ce8554b"/>
		<rom name="1943kai.png" size="7423" crc="8022e32f"/>
		<rom name="1943u.png" size="6471" crc="23c07737"/>
Unfortunately, the "Import Platform Images From Local Folder" option doesn't recognise the DAT:

"This RomCenter DAT Version is Not Supported".

I have tried converting from clrmamepro to romcenter using dutil but when I try the new RomCenter version it imports 0 images, even though there are over 1300 in the directory named according to the DAT file??

Any help would be greatly appreciated.

Regards

Shando

User avatar
Phoenix
ECC Developer 2006-2016
Posts: 9057
Joined: 27 Aug 2006, 01:17
Location: Deventer, The Netherlands
Contact:

Re: Importing Images Issues

Unread post by Phoenix » 14 Sep 2016, 18:41

I will look into this! :detective:

Any luck converting the XML to proper CTRLMAME DAT first?, see here: viewtopic.php?f=54&t=2871
Sebastiaan Ebeltjes | ECC Developer 2006-2016 | ECC Forum Admin | Phoenix Interactive WebMaster
[- ECC programs -]
eccUpdate, eccScriptSystem, GtkThemeSelect, DatFileUpdater (DFU), ImagePackCenter (IPC), eccDiagnostics, 3dGallery, iccImageInject
eccKameleonCode, eccCreateStartmenuShotcut, eccThirdPartyConfig (TPC), EmuMoviesDownloader (EMD), eccVideoPlayer
MobyGamesImporter (MGI), ECC Amiga GetGemusConfig.

User avatar
Shando
Posts: 25
Joined: 13 Nov 2015, 06:39
Location: Perth, Western Australia

Re: Importing Images Issues

Unread post by Shando » 15 Sep 2016, 01:01

Hey buddy,

No joy converting :(

I'll see if I can put together a little program to rename the files.

Regards

Shando

User avatar
Shando
Posts: 25
Joined: 13 Nov 2015, 06:39
Location: Perth, Western Australia

Re: Importing Images Issues

Unread post by Shando » 15 Sep 2016, 09:56

I have put together a small Python program (using Qt for the GUI) and it renames all the files based on the DAT from Progetto-Snaps.

Just waiting on the fix for ECC to see if they import properly ;)

Regards

Shando

PS: If anyone is interested I can upload a zip file with the code etc. though you will have to have PyDev & Eclipse installed to run it as I can't get PyInstaller to create an exe that works ](*,)

User avatar
Phoenix
ECC Developer 2006-2016
Posts: 9057
Joined: 27 Aug 2006, 01:17
Location: Deventer, The Netherlands
Contact:

Re: Importing Images Issues

Unread post by Phoenix » 15 Sep 2016, 18:41

Please upload the ZIP, i am interested, maybe i can convert it to Autoit3 and adjust the imageimporter
Sebastiaan Ebeltjes | ECC Developer 2006-2016 | ECC Forum Admin | Phoenix Interactive WebMaster
[- ECC programs -]
eccUpdate, eccScriptSystem, GtkThemeSelect, DatFileUpdater (DFU), ImagePackCenter (IPC), eccDiagnostics, 3dGallery, iccImageInject
eccKameleonCode, eccCreateStartmenuShotcut, eccThirdPartyConfig (TPC), EmuMoviesDownloader (EMD), eccVideoPlayer
MobyGamesImporter (MGI), ECC Amiga GetGemusConfig.

User avatar
Shando
Posts: 25
Joined: 13 Nov 2015, 06:39
Location: Perth, Western Australia

Re: Importing Images Issues

Unread post by Shando » 16 Sep 2016, 00:50

Hi Phoenix,

I thought I would just post the relevant code from my main Python file as it is really a simple XML reader that renames the relevant .png file (the rest is all GUI stuff so probably not of much interest??):

Code: Select all

    def parseDAT(self):
        # "untangle" is a simple xml parser for Python
        # "self.sDATFile is the relevant Progetto-Snaps DAT file
        o = untangle.parse(str(self.sDATFile))

        iCount = 0
                
        self.txtConversion.setText('Renaming ......')

        # simple loop through all items in xml file
        for item in o.datafile.machine.rom:
            # "iName" is the "name" field from the "datafile -> machine -> rom" section of the xml
            iName = item['name']
            # "iCRC" is the "CRC" field from the "datafile -> machine -> rom" section of the xml
            iCRC = item['crc']

            if iName:
                iCount = iCount + 1

                # "srcFile" is the relevant ".png" with the given "iName"
                srcFile = os.path.join(str(self.sFolder), os.path.basename(iName))
                
                # This is a check to ensure that the ".png" with the given "iName" exists
                if isfile(srcFile):
                    dstFile = os.path.join(str(self.sFolder), os.path.basename(iCRC) + '.png')

                    # This line renames the new file to "CRC.png" from "name.png"
                    os.rename(srcFile, dstFile)
                
        self.txtConversion.setText('%s Images Renamed.' %iCount)
HTH

If you would still like me to upload all the files (approx. 12MB in total), let me know and I'll put them on my OneDrive account and provide a link.

Regards

Shando

PS: Just found a minor issue in that Titles and Snaps are on a per machine basis, not an overall basis like the others:

Code: Select all

	<machine name="3do_m2">
		<description>3do_m2</description>
		<manufacturer>????</manufacturer>
		<rom name="imsarcng.png" size="727" crc="0f455fbb"/>
	</machine>
	<machine name="a2600">
		<description>a2600</description>
		<manufacturer>????</manufacturer>
		<rom name="2pakblac.png" size="1750" crc="8b2a6ac3"/>
		<rom name="2pakblaca.png" size="1750" crc="8b2a6ac3"/>
		<rom name="2pakblue.png" size="1386" crc="e726bc6c"/>
		<rom name="2pakdblu.png" size="1750" crc="8b2a6ac3"/>
		<rom name="2pakdo.png" size="1750" crc="8b2a6ac3"/>
		<rom name="2pakgrne.png" size="1750" crc="8b2a6ac3"/>
		<rom name="2paklgrn.png" size="1300" crc="e023d9e8"/>
PPS: Just found another issue with duplicate CRCs in the Snaps and Titles DAT files:

Code: Select all

		<rom name="miss3000e.png" size="663" crc="fe434924"/>
		<rom name="miss3000ed.png" size="663" crc="fe434924"/>
		<rom name="missile.png" size="489" crc="6b4360d1"/>
		<rom name="missile1.png" size="489" crc="6b4360d1"/>

User avatar
Shando
Posts: 25
Joined: 13 Nov 2015, 06:39
Location: Perth, Western Australia

Re: Importing Images Issues

Unread post by Shando » 16 Sep 2016, 02:57

Just thought I'd post my updated code which seems to account for both of the above issues:

Code: Select all

    def parseDAT(self):
        o = untangle.parse(str(self.sDATFile))

        iCount = 0
                
        self.txtConversion.setText('Renaming ......')

        fi = ntpath.basename(str(self.sDATFile))

        if ( fi[:7] == "pS_Snap" or fi[:7] == "pS_Titl"):
            for item in o.datafile.machine:
                for item1 in item.rom:
                    iName = item1['name']
                    iCRC = item1['crc']
                       
                    if iName:
                        iCount = iCount + 1

                        srcFile = os.path.join(str(self.sFolder), os.path.basename(iName))
                
                        if isfile(srcFile):
                            dstFile = os.path.join(str(self.sFolder), os.path.basename(iCRC) + '.png')
                            
                            if not os.path.isfile(dstFile):
                                os.rename(srcFile, dstFile)
        else:            
            for item in o.datafile.machine.rom:
                iName = item['name']
                iCRC = item['crc']
   
                if iName:
                    iCount = iCount + 1
    
                    srcFile = os.path.join(str(self.sFolder), os.path.basename(iName))
                    
                    if isfile(srcFile):
                        dstFile = os.path.join(str(self.sFolder), os.path.basename(iCRC) + '.png')

                        if not os.path.isfile(dstFile):
                            os.rename(srcFile, dstFile)
                
        self.txtConversion.setText('%s Images Renamed.' %iCount)

User avatar
Shando
Posts: 25
Joined: 13 Nov 2015, 06:39
Location: Perth, Western Australia

Re: Importing Images Issues

Unread post by Shando » 22 Sep 2016, 01:11

Hi Again,

Just come across an issue with these images :cry: It looks to me like the CRCs do not match the ROMs!@!@!

I'm going to dig a bit deeper and I'll let you know how I gat on.

Shando

User avatar
Phoenix
ECC Developer 2006-2016
Posts: 9057
Joined: 27 Aug 2006, 01:17
Location: Deventer, The Netherlands
Contact:

Re: Importing Images Issues

Unread post by Phoenix » 22 Sep 2016, 09:00

Hi Shando,

That could be correct, ECC calculates the CRC32 diffrently, you then have to use a name based import/export code (instead of CRC32)....
Sebastiaan Ebeltjes | ECC Developer 2006-2016 | ECC Forum Admin | Phoenix Interactive WebMaster
[- ECC programs -]
eccUpdate, eccScriptSystem, GtkThemeSelect, DatFileUpdater (DFU), ImagePackCenter (IPC), eccDiagnostics, 3dGallery, iccImageInject
eccKameleonCode, eccCreateStartmenuShotcut, eccThirdPartyConfig (TPC), EmuMoviesDownloader (EMD), eccVideoPlayer
MobyGamesImporter (MGI), ECC Amiga GetGemusConfig.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests