Software Support > PowerMAME

Question to PowerMAME32 users

<< < (4/4)

screaming:

--- Quote from: Silver on February 27, 2006, 11:41:55 pm ---I'm no expert programmer, generally learning as I go...

The DOM approach lets you essentially treat the XML as a database, (it loads the entire tree to memory, and you can search for any value or node) but is essentially useless for any reasonably sized XML file. (Don't even think about it for mame).

What I did is do a single pass of the XML file using the SAX parser, but I flagged up all the info I was interested in - romname, full game name, romof, cloneof, and every joystick and button, - for every game. All of this info is passed into simple arrays in memory during the parse. Everything else in the xml is ignored. The entire process takes well under 2 seconds for me. This gives me arrays so that if rom(10) is 1942, then romname(10), full game name(10), romof(10), cloneof(10),joystick(10)..... gives all the info associated with 1942.

I then go through the users actual roms on disk and pull the info from the arrays as needed. So if I find 1942.zip in the rom folder, I'll search the rom() array for '1942' to find its position in the array - get a return of '10' - and I have instant access to all the info I need for 1942. (You can build a Hash table of the rom()  for searching - makes it enormously quick to search).

This is a bit simplistic, and its not that far removed from txt scanning the xml line by line and pulling all the info you need, but the SAX parser (from MSXML I used - yes a dependancy - but I think there are lots of other SAX parsers out there) is basically doing the same thing and returning data for nodes you specify in advance....

(In my program I SAX parse mame.xml and then controlsdat.xml to pull all the data into memory arrays, then search controlsdat to get accurate data, then search mame.xml if controlsdat has no info - remember to check for clones in controlsDat of course...  ;) )

--- End quote ---

  Good description.

SirPoonga:

--- Quote from: Silver on February 27, 2006, 11:41:55 pm ---What I did is do a single pass of the XML file using the SAX parser, but I flagged up all the info I was interested in - romname, full game name, romof, cloneof, and every joystick and button, - for every game. All of this info is passed into simple arrays in memory during the parse. Everything else in the xml is ignored. The entire process takes well under 2 seconds for me. This gives me arrays so that if rom(10) is 1942, then romname(10), full game name(10), romof(10), cloneof(10),joystick(10)..... gives all the info associated with 1942.


--- End quote ---
Which is why I think you are going to see new frontends start to use a local database like sql server express, access, or sqllite.   It owuld be much easier to dump all that info to a database and query the database instead of loading it all into memory when program starts up.

Howard_Casto:

--- Quote from: SirPoonga on February 28, 2006, 04:17:29 pm ---
--- Quote from: Silver on February 27, 2006, 11:41:55 pm ---What I did is do a single pass of the XML file using the SAX parser, but I flagged up all the info I was interested in - romname, full game name, romof, cloneof, and every joystick and button, - for every game. All of this info is passed into simple arrays in memory during the parse. Everything else in the xml is ignored. The entire process takes well under 2 seconds for me. This gives me arrays so that if rom(10) is 1942, then romname(10), full game name(10), romof(10), cloneof(10),joystick(10)..... gives all the info associated with 1942.


--- End quote ---
Which is why I think you are going to see new frontends start to use a local database like sql server express, access, or sqllite.   It owuld be much easier to dump all that info to a database and query the database instead of loading it all into memory when program starts up.

--- End quote ---


Have you looked at new front ends lately?  I mean no offense to anyone out there, but after 3 years of dormancy dk is still the only fe out there that supports advanced filtering techniques.  3d arcade does it, but to a more limited degree.  Again though... emulaxian/3d arcade is like three years older than dk.  So as I see it we get one good fe every 3 years and a slew of crappy ones.  Not crappy as in they don't look nice, or won't launch a game, but crappy as in they don't have the basic functionality needed to actually manage a 5000+ entry masterlist of games.

And to all of you out there that are confused by that comment, "mangage" does not mean make a single, giant "mame" gamelist.  Manage, does not mean hardcoding gamelists based on catvers when the average user probably doesn't want to waste a 4 entry gamelist for "basket-weaving / underwater".  Manage also doesn't mean forcing a user to manually add/delete/tag every single game in the masterlist to make a new custom gamelist.  Manage means being able to add a few simple search/filter strings into the fe somehow and have it spit out a gamelist based on those requirements.   

ok I'm done ranting....

Buddabing:

--- Quote from: SirPoonga on February 28, 2006, 04:17:29 pm ---
--- Quote from: Silver on February 27, 2006, 11:41:55 pm ---What I did is do a single pass of the XML file using the SAX parser, but I flagged up all the info I was interested in - romname, full game name, romof, cloneof, and every joystick and button, - for every game. All of this info is passed into simple arrays in memory during the parse. Everything else in the xml is ignored. The entire process takes well under 2 seconds for me. This gives me arrays so that if rom(10) is 1942, then romname(10), full game name(10), romof(10), cloneof(10),joystick(10)..... gives all the info associated with 1942.


--- End quote ---
Which is why I think you are going to see new frontends start to use a local database like sql server express, access, or sqllite.   It owuld be much easier to dump all that info to a database and query the database instead of loading it all into memory when program starts up.

--- End quote ---

Yep. That's what my ListGen utility does. If I ever build a frontend around ListGen, it will have SQLite built in, and will have great search capabilities, and list generation will be fast.

Silver:
Yes I'm surprised there is not more demand/response for on-the-fly list generation/filtering in frontends. Something like SQLite or similar eats 6000 game database entrys for breakfast, and could cope easily with flipping between genres or years or similar - which is something I hope to be doing when I finally get round to building a cabinet....

Navigation

[0] Message Index

[*] Previous page

Go to full version