If you're familiar with MAME ( then you'll have an idea why I'm wanting this.
I need to grab a whole lot of information out of a datfile, and place it all into useful hashes and arrays. I'm looking for suggestions on how to go about it. PERL's a hobby for me, and while I have a couple of ideas, all of which are VERY inefficient. With this much data, I'd like to make it as efficient as possible. All that said, the first part of the text file looks like this:
The clrmamepro is basically the name of the auditing app the file was written for. The information contained within the brackets I envision having in a hash like this:
etc
I can accomplish this with a series of foreach statements and splits by whitespace and newlines, but I can't help but have the feeling that there's a better way to go about it. My old QBasic days keep yelling that I should use a while loop here...
The rest of the file is a series of entries like this:
There are quite literally THOUSANDS of game entries.
First I need to split out all the game entries to an array, then assign all the useful info into an array I suppose in a similar manner as above.
A single associative array doesn't seem like it would do the trick. It feels almost as if I need a tree of data to access it all instead of a single array. I could really use some insight on how to handle such a situation.
Sorry if I sound like I'm dumping the task off, I'm trying to work it out for myself, but there's a dimension to this that I'm having a hard time bending my brain to. I'm used to writing much simpler scripts...this is a big one for me.
This information will be compared against zipfiles to check crc's and file sizes. Here's what the lines mean
name - the name of the zipfile. In my example, puckmana would be puckmana.zip
description - The real title of the game.
year - when the game was manufactured
manufacturer - who made it
cloneof - These files need files from another set. What is that set?
romof - I'm pretty sure this is always the same as above, need to check on this.
rom () - This contains the names and information for each individual file within the zipfiles I'll be checking. I need to parse this into the array as well.
Ugh, lot of information, isn't it. The suggestions said NOT to braindump. **sigh** help?
I need to grab a whole lot of information out of a datfile, and place it all into useful hashes and arrays. I'm looking for suggestions on how to go about it. PERL's a hobby for me, and while I have a couple of ideas, all of which are VERY inefficient. With this much data, I'd like to make it as efficient as possible. All that said, the first part of the text file looks like this:
Code:
clrmamepro (
name MAME
description "MAME v0.63"
category "Multi Game Arcade Emulator"
version 20030115
author "Logiqx, [URL unfurl="true"]http://www.logiqx.com/"[/URL]
)
The clrmamepro is basically the name of the auditing app the file was written for. The information contained within the brackets I envision having in a hash like this:
Code:
$version_info{name}="MAME";
$version_info{description}="MAME v0.63";
I can accomplish this with a series of foreach statements and splits by whitespace and newlines, but I can't help but have the feeling that there's a better way to go about it. My old QBasic days keep yelling that I should use a while loop here...
The rest of the file is a series of entries like this:
Code:
game (
name puckmana
description "PuckMan (Japan set 2)"
year 1980
manufacturer "Namco"
cloneof puckman
romof puckman
rom ( name pacman.6e size 4096 crc c1e6ab10 )
rom ( name pacman.6f size 4096 crc 1a6fb2d4 )
rom ( name pacman.6h size 4096 crc bcdd1beb )
rom ( name prg7 size 2048 crc b6289b26 )
rom ( name prg8 size 2048 crc 17a88c13 )
rom ( name chg1 size 2048 crc 2066a0b7 )
rom ( name chg2 size 2048 crc 3591b89d )
rom ( name pacman.5f merge pacman.5f size 4096 crc 958fedf9 )
rom ( name 82s123.7f merge 82s123.7f size 32 crc 2fc650bd )
rom ( name 82s126.4a merge 82s126.4a size 256 crc 3eb3a8e4 )
rom ( name 82s126.1m merge 82s126.1m size 256 crc a9cc86bf )
rom ( name 82s126.3m merge 82s126.3m size 256 crc 77245b66 )
)
There are quite literally THOUSANDS of game entries.
First I need to split out all the game entries to an array, then assign all the useful info into an array I suppose in a similar manner as above.
A single associative array doesn't seem like it would do the trick. It feels almost as if I need a tree of data to access it all instead of a single array. I could really use some insight on how to handle such a situation.
Sorry if I sound like I'm dumping the task off, I'm trying to work it out for myself, but there's a dimension to this that I'm having a hard time bending my brain to. I'm used to writing much simpler scripts...this is a big one for me.
This information will be compared against zipfiles to check crc's and file sizes. Here's what the lines mean
name - the name of the zipfile. In my example, puckmana would be puckmana.zip
description - The real title of the game.
year - when the game was manufactured
manufacturer - who made it
cloneof - These files need files from another set. What is that set?
romof - I'm pretty sure this is always the same as above, need to check on this.
rom () - This contains the names and information for each individual file within the zipfiles I'll be checking. I need to parse this into the array as well.
Ugh, lot of information, isn't it. The suggestions said NOT to braindump. **sigh** help?