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

Probably. I'm old school. :)

Posted

OK, this is only related to your super awesome plug-in in a weird way. When I run MAME games on one screen it works great. When I use your app to split a game, say punch out, it puts the main screen, the fighting one in this example, on the smaller top screen and the secondary screen on the lower main screen. Any ideas?

Posted

It's because of the original hardware. The top screen was set to be the stats screen and the bottom screen was set to be the game play.

To adjust this I actually had to press the TAB key to bring up the main menu, then select DISPLAY, and switch the screens that were displayed so that Screen 0 is the hardware's Screen 1 and Screen 1 is screen 0. I had to do this for my PC10 games too unfortunately. :(

I wonder if that can be done in the command line? I had mine set up a long time ago so I never had the option of making the adjustment.

Posted

I'm pretty pumped about this feature since we're getting to the point where you don't need to know anything to your customized settings up and running (other than the ROM name which is next on my improvements list) Sooo....

I don't suppose I can get anyone to bug test the new BETA with the MAME command line switch imports for me before I move on to the game search function? Hmmmmm?

post-680-0-53415600-1323391833_thumb.png post-680-0-74403500-1323391851_thumb.png

Pretty please?

My wife gave me my xmas present today so I'll be spending a bit less time in development and a bit more time on the 3DS in the next few days and I'd be happy knowing this feature is ready for public release before I crack out on Super Mario 3D Land.

I would really appreciate it!

Posted

That's a really sweet feature Adultery.

Have you thought about having options based on info from the xml that MAME can generate? The source I sent you the other day includes a parser for this file so it should just be a matter of obtaining the path to the MAME exe from GX. From the xml you can get info like the number of players, buttons, and even if it's a cocktail cabinet. Anyway having the ability to set switches based on these things rather than having to go through one game at a time would be a great feature.

Posted

I've been trying to implement it on the side actually. :)

Not a hard thing to get the MAME path since I already have that set as a string in the INI scrape (among a few other things I'll use later). I didn't want to steal your SC so I was using it as a reference point and trying to code my own module to read the XML data. I may just usher in your code in the interest of pumping it out though. :D

I'm gonna need that XML parsing to work for the search feature I'm working on next for sure.

Posted

IMO parsing an entire XML file to get data is crazy. :blink:

A simple regex is all that is needed to get the data you need.

This is how it is done in AHK:


FileRead, XML, E:\Arcade _Emulation_Misc\ListXML.txt
RomName = turtles
Pos := RegExMatch( XML, "s)<game name=""" RomName """.+?<input players=""(.+?)"".+?</game>", Players )
Pos := RegExMatch( XML, "s)<game name=""" RomName """.+?<input players=.+?buttons=""(.+?)"".+?</game>", Buttons )
MsgBox, %Players1%,%Buttons1%

I'm surprised that the non AHK programmers didn't point this out. B)

Posted

Well, I wouldn't be parsing an entire XML file technically, I'd be sending the wildcard (say pc10.c for example) to MAME and only getting the game data for that particular item (in this case a list of games that use the PC10 driver). I already snagged the MAME path and the EXE in GameEx's setings.ini so really it's a matter of doing a quick stream read and returning the results. :)

I wouldn't need an actual xml file if I can do a stream read instead, and the user wouldn't see the XML file. I also wouldn't need to rebuild the XML everytime the user changes or updates the MAME exe.

Posted

Updated to 2.07s. :)

Posted

Thanks Tempest! :)

It sounds good in theory but I still need it to actually do it right everytime. :D

That's more of a hurdle for me than the programming. Learning as need arises and all that. :)

Posted

Thanks Tempest! :)

It sounds good in theory but I still need it to actually do it right everytime. :D

That's more of a hurdle for me than the programming. Learning as need arises and all that. :)

Great men feel learning as a need... Personally I don't think your pugin is of use for me, but, nonetheless, I strongly appreciate your work... My compliments Adultery!

Posted

If others use it, great! As long as it works for me! :D

Posted

If others use it, great! As long as it works for me! :D

I was a member of a team that was used to translate TES:IV Oblivion Mods. In first instance, I translated mods that I was going to play. The generosity resides in sharing your work, because it could be of use for others. So I perfectly understand your statement! ^_^

Posted

IMO parsing an entire XML file to get data is crazy. :blink:

A simple regex is all that is needed to get the data you need.

This is how it is done in AHK:


FileRead, XML, E:\Arcade _Emulation_Misc\ListXML.txt
RomName = turtles
Pos := RegExMatch( XML, "s)<game name=""" RomName """.+?<input players=""(.+?)"".+?</game>", Players )
Pos := RegExMatch( XML, "s)<game name=""" RomName """.+?<input players=.+?buttons=""(.+?)"".+?</game>", Buttons )
MsgBox, %Players1%,%Buttons1%

I'm surprised that the non AHK programmers didn't point this out. B)

Regular expressions are not actually a good idea for parsing large files. They are notoriously inefficient. I send Adultery code to parse the xml using .NET's built in xml parser and that's the best way to do it.

Posted

Regular expressions are not actually a good idea for parsing large files. They are notoriously inefficient. I send Adultery code to parse the xml using .NET's built in xml parser and that's the best way to do it.

Just for my own personal edification are you referring specifically to the XmlTextReader in .NET or to SAX implementations in general? I come more from the Java world and am relatively familiar with Java implementations of SAX (or more recently JAXB) - but .NET not so much. Without delving too far into .NET vs. Java debates would you say that parsing XML in .NET offers specific advantages? Certainly not questioning your assessment, I just like to talk to other developers about the tools they use. I wouldn’t be surprised if it’s more efficient on Windows based systems.

Posted

Just for my own personal edification are you referring specifically to the XmlTextReader in .NET or to SAX implementations in general? I come more from the Java world and am relatively familiar with Java implementations of SAX (or more recently JAXB) - but .NET not so much. Without delving too far into .NET vs. Java debates would you say that parsing XML in .NET offers specific advantages? Certainly not questioning your assessment, I just like to talk to other developers about the tools they use. I wouldn’t be surprised if it’s more efficient on Windows based systems.

Yes it uses XmlTextReader. I find it fast although I haven't got any hard figures for you. You could probably get some rough time vs file size from CPWizard's log file. What I usually do though when I parse MAME's xml is write out a custom cut down version for parsing later on. When CPWizard detects a new version of MAME it creates it again. That saves a bit of time. Sorry but I have no idea what Java's parsing is like as I haven't used that langauge since Uni.

Incidently Adultery should only parse MAME's xml when it's launched from the Plugin Manager. Then just write back the data to the ini file. There is no point in parsing it during GameEx's initialization because much of that data is passed through the plugin system anyway.

Posted

Okay I saw a "hint" in there!

The way I would have approached it probably is to actually do the XML parsing when one opens the Configuration form, and only then if the MAME version number is different.

I saw that you can snag the data through the plugin itself (but then only if GameEx is running):

 Public Structure Mame_Info

Public Players As String
Public Control As String
Public CloneOf As String
Public Orientation As String
Public VideoWidth As Integer
Public VideoHeight As Integer
Public Cocktail As Boolean

End Structure

...but some crucial stuff is missing here and it's of no help in searching anyways when a user is trying to, say, change the switches for all the cocktail games or playch10.c games, etc.

I'm totally hitting the wall with this XML thing. Your code is helpful but it's way more complex than my skill set allows for... But XML is the way of the future and if I don't sit down and figure it out now I'll be screwed later anyways. So here I am with a huge block of source code to parse MAME's XML and no idea how to implement it into my project. I hope no one was holding their breath waiting for me to figure out the XML reader. :)

Why do you have to use an XML file anyway? Can't you just look for the value in a Stream Read and post results accordingly on the fly? Or is that just ridiculous?

Thanks for your help on this one Ben, and I hope you don't mind holding my hand through this.

Posted

Happy to help Adultery :)

With my MameXml class it's pretty easy to use. I load everything into an internal class for speed so the idea is to get everything loaded into RAM first.

- Instanciate an object of the MameXml class. Eg. MameXml mameXml = new MameXml();

- Call CreateListInfoXml passing in Mame's exe path. It will then generate the actual xml file to parse.

- Call ReadListInfoXml() to read the xml

- Now just access all the data either by using the dictionary (GameHash) or list (GameArray)

The data is stored in a class called "GameNode". The easiest way is to access the data using the dictionary.

GameNode gameNode = mameXml.GameHash[ROMName];

You might also want to look up Dictionary's TryGetValue method because the above will cause and exception if the ROM name doesn't exist.

There are some static helper classes (static means you don't need an object to access the method Eg. MameXml.GetMameVersion(...))

- GetMameVersion() pretty obvious it gets the mame version

- GetMameROMInfoXml() will generate output for a single game

- There are others in there that do various things mostly obvious by their name

Posted

Damn that covers everything then! Lol!

OK. I just get freaked when I see alot of imports I don't recognize. :)

The c# converts nicely into Vb though so over 90% is readable in the language I know. Its so much it just looks impressive! Realistically how much time went into this? Just because I'm curious (and trying to gauge how long it takes to be that fluent).

Posted

Damn that covers everything then! Lol!

OK. I just get freaked when I see alot of imports I don't recognize. :)

The c# converts nicely into Vb though so over 90% is readable in the language I know. Its so much it just looks impressive! Realistically how much time went into this? Just because I'm curious (and trying to gauge how long it takes to be that fluent).

I have no idea TBH. I think that's the version from CPWizard which is a project I started around 4 years ago. So yeah no idea and classes are often organic things that are built upon over the lifetime of the project anyway. You'll find youself getting faster the more you get familiar with the language and namespaces.

Posted

Updated to 2.08s

  • 2 months later...
Posted

Hate to bump an old thread, but since I started coding I've become more proficient with some things (like xml parsing/writing) and have really gotten comfortable with the plugin system. As if I don't have enough irons in the fire, there's gonna be a big overhaul of this plugin soon, so if anyone is using this and has any features they'd like to see added, now's the time. :)

  • 1 year later...
Posted

HUGE UPDATE!

2.1.2 is pretty much a completely new version with a ton of new features! So many I don't wanna type it all out again. Just do me a favor and check out what's new in the first post!

Thanks going to Tempest for his outstanding work on Mame Mapping Magician, a program which undoubtedly inspired this project from front to back. Make sure you guys give him props for all his hard work around here. :)

Posted

Nice One! If you exit out before creating the xml file it will crash the plugin manager. Also when it detected a different MAME version and you select to update it crashes the Plugin Manager as well.

3/18/2013 2:51:47 PM : MAME Commander (Version: 2.1.2)
3/18/2013 2:51:47 PM : Diagnostics: Begin system enumeraion...
3/18/2013 2:51:47 PM : OS: Microsoft Windows 7 Home Premium
3/18/2013 2:51:47 PM : Version: 6.1.7601
3/18/2013 2:51:47 PM : Build: 7601
3/18/2013 2:51:47 PM : Total RAM: 16334 MB
3/18/2013 2:51:47 PM : Available RAM: 3336 MB
3/18/2013 2:51:48 PM : CPU: Intel® Core i7-3820 CPU @ 3.60GHz
3/18/2013 2:51:48 PM : Video Card: NVIDIA GeForce GTX 670
3/18/2013 2:51:48 PM : Video Driver: 9.18.13.1421
3/18/2013 2:51:48 PM : Video RAM: 2047.6875 MB
3/18/2013 2:51:48 PM : .NET: .NET Framework 1.1 Installed
3/18/2013 2:51:48 PM : .NET: .NET Framework 2.0 Installed
3/18/2013 2:51:48 PM : .NET: .NET Framework 4.0 Installed
3/18/2013 2:51:48 PM : Diagnostics: System enumeraion completed successfully!
3/18/2013 2:51:48 PM : XML PATH: C:\GameEx\PLUGINS\MAME Commander 2\settings.xml
3/18/2013 2:51:48 PM : XML: XML file was loaded OK!
3/18/2013 2:51:48 PM : Settings loaded OK!
3/18/2013 2:51:48 PM : Loading search types...
3/18/2013 2:51:48 PM : Loading command-line switches...
3/18/2013 2:51:48 PM : Getting switch data...
3/18/2013 2:51:48 PM : Loading switches...
3/18/2013 2:51:48 PM : Populating switch data...
3/18/2013 2:51:48 PM : Switch data populated OK!
3/18/2013 2:51:48 PM : Switches loaded OK!
3/18/2013 2:51:48 PM : Getting GameEx info...
3/18/2013 2:51:48 PM : Loading GameEx ini...
3/18/2013 2:51:48 PM : GAMEEX INI READ: C:\GameEx\CONFIG\GameEx.ini
3/18/2013 2:51:48 PM : Getting global switches...
3/18/2013 2:51:48 PM : Setting up variables...
3/18/2013 2:51:48 PM : SETTING OUT:: XML(Write_Setting) - mameexe
3/18/2013 2:51:48 PM : SETTING IN:: XML(Write_Setting) - mameexe=E:\Arcade\MameUIHI64\mameuihiscore64_nogui.exe
3/18/2013 2:51:48 PM : XML PATH: C:\GameEx\PLUGINS\MAME Commander 2\settings.xml
3/18/2013 2:51:48 PM : XML: XML file was saved OK!
3/18/2013 2:51:48 PM : SETTING OUT:: XML(Write_Setting) - catver
3/18/2013 2:51:48 PM : SETTING OUT:: XML(Write_Setting) - catver
3/18/2013 2:51:48 PM : SETTING OUT:: XML(Write_Setting) - nplayers
3/18/2013 2:51:48 PM : SETTING OUT:: XML(Write_Setting) - nplayers
3/18/2013 2:51:48 PM : SETTING OUT:: XML(Write_Setting) - history
3/18/2013 2:51:48 PM : SETTING OUT:: XML(Write_Setting) - history
3/18/2013 2:51:48 PM : SETTING OUT:: XML(Write_Setting) - mameinfo
3/18/2013 2:51:48 PM : GAMEEX.INI: mamepath=E:\Arcade\MameUIHI64\mameuihiscore64_nogui.exe
3/18/2013 2:51:48 PM : GAMEEX.INI: catverpath=\DATA\catver.ini
3/18/2013 2:51:48 PM : GAMEEX.INI: nplayerspath=\DATA\nplayers.ini
3/18/2013 2:51:48 PM : GAMEEX.INI: historypath=E:\My Emulators\Arcade\MAMEUI\history.dat
3/18/2013 2:51:48 PM : GAMEEX.INI: mameinfopath=
3/18/2013 2:51:48 PM : GAMEEX.INI: cabinetpath=E:\Arcade\MameUIHI64\cabinets
3/18/2013 2:51:48 PM : GAMEEX.INI: snappath=E:\Arcade\MameUIHI64\snap
3/18/2013 2:51:48 PM : GAMEEX.INI: titlepath=E:\Arcade\MameUIHI64\titles
3/18/2013 2:51:48 PM : GAMEEX.INI: marqueepath=E:\Arcade\MameUIHI64\marquees
3/18/2013 2:51:48 PM : GAMEEX.INI: controlspath=E:\Arcade\MameUIHI64\cpanel
3/18/2013 2:51:48 PM : GAMEEX.INI: pcbpath=L:\Arcade\MameUIHI64\pcb
3/18/2013 2:51:48 PM : GAMEEX.INI: iconpath=E:\Arcade\MameUIHI64\icons
3/18/2013 2:51:48 PM : GAMEEX.INI: excludedroms=d2k11
3/18/2013 2:51:48 PM : GAMEEX.INI: donotfilterroms=pacman;splatter;dkongx
3/18/2013 2:51:48 PM : GameEx ini loaded OK!
3/18/2013 2:51:48 PM : Configuration initialized OK!
3/18/2013 2:51:48 PM : Building available game list...
3/18/2013 2:51:48 PM : Loading mame.xml...
3/18/2013 2:52:11 PM : Getting MAME version...
3/18/2013 2:52:11 PM : Getting XML version...
3/18/2013 2:52:11 PM : Getting game count...
3/18/2013 2:52:11 PM : Checking versions for update...
3/18/2013 2:52:11 PM : Update detected!
3/18/2013 2:53:02 PM : Generating updated mame.xml...

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...