Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Rom Loaded Detection  (Read 4077 times)

0 Members and 1 Guest are viewing this topic.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Rom Loaded Detection
« on: May 12, 2003, 07:45:53 pm »
I just finishing coding an application that can detect when any rom is loaded into memory.  The list gets compiled from the MAME.EXE file so it is always accurate and up to date.  Now I need your help with ideas on what features to program.

Some ideas I had:
Launch file to speak name of game when it is launched.

Launch program to light up LEDs under buttons that are used for that game.

Display game title on LED marquee.

------------------------------------------

I am sure there are many more uses and would like you ideas on them.  Once I have finished the program with good features I will release it.  I have tested the program and currently have it displaying a msgbox of the game name for testing.  So far all my test worked and all games are being detected proprly.  I am using Windows XP but will test other OS's later.

« Last Edit: May 12, 2003, 07:46:44 pm by DinoRoger »

CitznFish

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 831
  • Last login:November 13, 2024, 01:18:45 am
  • www.subvertcity.com - Prof. Strength Slackwear
Re:Rom Loaded Detection
« Reply #1 on: May 12, 2003, 08:49:43 pm »
Launch program to light up LEDs under buttons that are used for that game.


but isn't this what your other LED program is doing?

Jakobud

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1962
  • Last login:June 30, 2025, 02:20:39 pm
Re:Rom Loaded Detection
« Reply #2 on: May 12, 2003, 08:59:40 pm »
Wow Dino, you have come out of nowhere and really been relasing some awesome software lately. I'm very impressed and grateful :)

Brax

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1426
  • Last login:January 06, 2009, 09:03:48 am
  • Bring on the power tools!
Re:Rom Loaded Detection
« Reply #3 on: May 12, 2003, 09:03:27 pm »
Man, this would probably work with that LED marquee idea that was floating around a while back!

This has some real potential! Great work!
If you build a frankenpanel, chances are I don't care for you as a person.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #4 on: May 12, 2003, 10:13:06 pm »
Sorry this post wont delete???  

[This space for rent]
« Last Edit: May 12, 2003, 10:17:21 pm by DinoRoger »

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #5 on: May 12, 2003, 10:14:09 pm »
Launch program to light up LEDs under buttons that are used for that game.


but isn't this what your other LED program is doing?

Yes it is but better.  While I was working on that idea this idea came to mind.  This would allow any Front end to work with my LED software/hardware, not just FE's that support launching files.

I did run into a snag but not a really bad one.  I wrote a program that will compile a list of ROMS from Mame with the same name they are listed when running from memory.  Unfortantly the rome with the word "The" appear at the end on the title and when ran in memory the game is displayed with "The" at the beginning.  SO I will need to edit my program to put all the "The, at the begining for me unless someone knows a way to pull the rom names from Mame like they will be displayed in memory.
« Last Edit: May 12, 2003, 10:15:38 pm by DinoRoger »

TheTick

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 411
  • Last login:December 21, 2009, 12:24:27 pm
  • I.P. Daley
Re:Rom Loaded Detection
« Reply #6 on: May 12, 2003, 10:21:17 pm »
How about a plugin for Girder and/or LCDProc?

Than you can display the name of the ROM, and a set of instructions on a 4x40 LCD display. Would look nice on my HTPC.
Mucal invader, is there no end to your oozing?!

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #7 on: May 12, 2003, 11:08:52 pm »
Here is a test version I need help with.  Please follow the instructions below before running the application.  This test version will create a list of all the roms it detects in memory.  Please tell me if you find it not to detect a particular rom.  I am trusting programming to build a correct list so it may need some tweaking.  So far I've tested about 50 roms and it detected all of them.

INSTRUCTIONS:
1. Download and unzip the program to a directory
http://www.pchelplive.com/dinos/RomWatch.zip

2. Copy MAME.EXE into the directory you unzipped the application too.

3. Run the file MLIST.EXE and wait until it completes.  You will see a list of all the rom tiltles it is building.

4. Run the Application - Filename = ROMWATCH.EXE

5.  You can minimize RomWatch but you must leave it open.

6. Now go and play your games any way you normaly do (comman line, front end........).

7. When you return to RomWath application the Games Detected list should display all the games that you played.

NOTE: If you set the refresh counter to 30 seconds you may need to stay in the game for 30 seconds before RomWatcher detects it.  This feature was added for slower systems and resource problems.  I suggest 5-10 seconds for newer systems.

Please report any problems.

liquid8

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 156
  • Last login:June 11, 2017, 04:02:02 am
  • I working on it.. it'll be a while.
Re:Rom Loaded Detection
« Reply #8 on: May 13, 2003, 12:46:04 pm »
I'm with TheTick on this one.. that would be sweet, since my LCD is just sitting in my computer not being used.

Just one request.. DON'T DO JUST MAME! :) (CONSOLES)

LiQuiD8

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8188
  • Last login:Today at 12:38:01 am
  • The Bears Still Suck!
Re:Rom Loaded Detection
« Reply #9 on: May 13, 2003, 12:48:41 pm »
hmmm, why did you decide to go this route?  It seems insanely difficult when you just could have made a mame wrapper.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #10 on: May 13, 2003, 12:56:24 pm »
hmmm, why did you decide to go this route?  It seems insanely difficult when you just could have made a mame wrapper.

I;m not sure what you mean (MAME Rapper).  Could you provide more details please.  Actualy the program was very easy to write and I did it in about an hour.

Rasher2k

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 79
  • Last login:December 12, 2003, 11:34:23 am
  • Dwarf on smoko.
Re:Rom Loaded Detection
« Reply #11 on: May 13, 2003, 01:33:57 pm »
Wrapper: The thin layer of plastic (ie, your code) that covers the delicious candy underneath (ie, mame). All commands are sent thru the wrapper, then passed to the underlying program.

Less fuss when trying to figure out what you've just run - especially non-mame programs - just ask the wrapper.
Too much blood in the alcohol stream.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #12 on: May 13, 2003, 02:13:57 pm »
I threw away my wrapper in a trash can so I went this route instead.  I decided to create this as a seperatly running application so it could be universaly no matter what front end you are using.  Future designs will also include other emulatos roms like console games.  So I dont think think a wrapper would work well unless I create this app for all emulators individually.

Lilwolf

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4945
  • Last login:July 31, 2022, 10:26:34 pm
Re:Rom Loaded Detection
« Reply #13 on: May 13, 2003, 02:35:17 pm »
A wrapper would have been a nice way to go so it would work in OS's other then win98/me.

2k/XP, you can't look at other memory spaces.

And a wrapper would do it VERY easy.

So you write a program that captures the command line mame and then launchs mame with the same parameters... but you know what game is running... and when it exits.

This is kind of the middleware approach that allows other frontends to utilize your options.  

But if you have it working, then there probably isn't much reason to change it... as long as it doesn't take any cpu time to check whats running.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #14 on: May 13, 2003, 03:07:45 pm »
My program works in all Microsoft OS's inluding 2k, XP.

Rasher2k

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 79
  • Last login:December 12, 2003, 11:34:23 am
  • Dwarf on smoko.
Re:Rom Loaded Detection
« Reply #15 on: May 13, 2003, 03:19:34 pm »


I can see the benefit of having a standalone program independant of the frontend, but aren't you going to have to create code for each individual emulator anyway? I'm pretty sure they dont all store data in memory the same way.

It just looks to me like the wrapper solution would be way less fuss, especially if you want events to happen for programs you haven't coded for.
Too much blood in the alcohol stream.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #16 on: May 13, 2003, 04:15:20 pm »
My program actual doesnt even know its looking for just a mame rom only how an application is identified in memory via the title area.  So the list can include any rom from any emulator even can detect things like NOTEPAD.EXE running.  This way its one program for all.   ;D

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8188
  • Last login:Today at 12:38:01 am
  • The Bears Still Suck!
Re:Rom Loaded Detection
« Reply #17 on: May 13, 2003, 04:33:14 pm »
My program actual doesnt even know its looking for just a mame rom only how an application is identified in memory via the title area.  So the list can include any rom from any emulator even can detect things like NOTEPAD.EXE running.  This way its one program for all.   ;D

That's kinda scary, some bad things can happen with that.

Yeah, a wrapper.  Like HowardC's wrappers for his frontend.  Basically it is a program that will start mame with the right arguments, but you could do other things too with a setup file.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #18 on: May 13, 2003, 04:37:12 pm »
Not sure how bad things could happen with this style.  The program has to be specific, as a title for example "Street Fighter II (Japan) [SF2J]" may be how the rom is identified.  If a game on the list is not detected nothing happens.

Maybe Im using the wrong word by saying memory.  How the game is displaed in the Application running list of Windows.  Does that make more sense?
« Last Edit: May 13, 2003, 04:39:51 pm by DinoRoger »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 11:38:27 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re:Rom Loaded Detection
« Reply #19 on: May 14, 2003, 12:54:10 am »
I apprecaite your efforts and I really like the ideas you are coming up with, but let me give you this warning....

The others are completely and totally right about the direct memory access thing.  

DON'T DO IT.... IT WILL CAUSE SYSTEM INSTABILITY

I know this because early on in the development stages of my wrappers I exprimented with it.  With mame 90% of the time you are going to be ok.  It's other programs you have to look out for.  As you never know what they are going to do with the memory you are accessing, potentially fatal crashes can result, including crashes that damage the rom or emulator via a backwash if you happen to scan at the wrong time.  

Usually nothing will happen, but when it does you are going to lock up the pc  or creat a huge memory leak best case scenario.  Worst case you could damage files on the harddrive.  

Wrappers are often used for this situation and wre used for emulation long before I thought of it for command line translation.  Th best example of this is the zinc gui front end/wrapper for zinc.  It allows you to launch a special third party cheat program for each game prior to loading each game.  When you load up the game it automatically loads the cheater settings for that game for you.  It's knows which settings to use because you just told it which game you wanted to launch when you selected it (duh.)  This kind of pre planning is much eaiser code wise... will work on any app, not just mame and more importantly is safe for your users.  

Your programs are great thus far, and I actually intend to add support for them, but don't directly access other programs memory unless you have to, it's just a bad idea all around.  From what I can see, you don't have to at this point.  

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #20 on: May 14, 2003, 01:00:42 am »
I think I said it wrong when I said read memory.  THe application only looks at application loaded in Windows application list not memory.  For example hit CTRL+ALT+DEL and the Application list there is what I am reading from.  I used memory earlier by mistake.  What I am reading is totaly safe and does not interfere with other programs or system resources.

 :-X

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8188
  • Last login:Today at 12:38:01 am
  • The Bears Still Suck!
Re:Rom Loaded Detection
« Reply #21 on: May 14, 2003, 01:24:02 am »
interesting, so how often does your program check the running apps?  In otherwords, how much proccessor is it taking up.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #22 on: May 14, 2003, 08:16:29 am »
I include a slide bar from 1-30 seconds of your choosing.  At 1 second checks I have never seen it rise above 9% CPU usage.  Remeber it checks in about a millisecond so the 9% is actualy the spike not actual usage.

Rasher2k

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 79
  • Last login:December 12, 2003, 11:34:23 am
  • Dwarf on smoko.
Re:Rom Loaded Detection
« Reply #23 on: May 14, 2003, 04:42:23 pm »
A program polling every second stealing 9% of a cpu cycle may have detrimental effects to an emulated game due to the fact current emulators are very cpu intensive.

Might wanna test it.
Too much blood in the alcohol stream.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #24 on: May 14, 2003, 05:57:40 pm »
9% is actualy the spike not actual usage

IIOIOOIOO

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 295
  • Last login:August 04, 2003, 02:18:12 pm
Re:Rom Loaded Detection
« Reply #25 on: May 14, 2003, 06:39:33 pm »
Are you just cycling through hWNDs or PIDs looking for one with the correct title? If so, let me give you a couple tips.

The first time you find a match, retain the hWND for the matching window. Then (at your interval) just recheck that hWND to check two things...
 (The PID exists)
 (The name is unchanged)
This will prevent you from having to endlessly recycle through your list.

Load up your full list of names into memory at startup for the process, and keep them there. Memory is abundant, and more quickly seeked against. Also, use a sorted memory structure to store the data in memory, further increasing your seek speed. Finally, if you want to compress memory usage even further, hash the key down to a smaller structure, and use that for all your seeks/stores.

Also, if you're not, apply some pattern sanity checking against the key you get back from the API before you seek against your list. The more keys you can throw away without any further checking, the better.

Make an application that is a VERY generic wrapper, which will shell a command of their choosing. Then capture the PID off the shell command, and use that to get the hWND info if necessary, and display the key information for that spawned process to the user, so they can get an idea of how to set up the config file for your app.

I have a lot of other notes, but I'm at work, so I must dole them out sparingly.

...I might just have to write this myself to demonstrate what I'm talking about. So easy.

BTW, I really like your LED controller. Can you point me towards the technical reference you used to build your harness/controller off of?

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #26 on: May 14, 2003, 07:21:49 pm »
What are you thinking, applying logic to programming is a sin.  JUST KIDDING  ;D Great idea.

Will add feature where it will not check entire list if current rom is still loaded.  This will cause at max 1% CPU usage while in MAME.

Rasher2k

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 79
  • Last login:December 12, 2003, 11:34:23 am
  • Dwarf on smoko.
Re:Rom Loaded Detection
« Reply #27 on: May 15, 2003, 12:20:47 am »
9% is actualy the spike not actual usage

Exactly: 9% of cpu grunt stolen on a cycle creates that individual spike. What you may see in many beefy emulated games are pauses at 30 second intervals as the emulator stutters while the cycles are stolen.
Too much blood in the alcohol stream.

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #28 on: May 15, 2003, 12:29:18 am »
Fixed problem.  Now when not running the game its a 5% spike but when in a game its 0% CPU usage even at a 1 second refresh rate. Cant go any lower  ;D.  Also a wrapper is not going to work for me.  This software will be designed for much more than just MAME.  It can be used on any emulator.  I do not wish to create a seperate application for exery game emulator.  I think everyone can see the benefit of one application for all.

Problem has been fixed. Next
« Last Edit: May 15, 2003, 12:37:11 am by DinoRoger »

IIOIOOIOO

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 295
  • Last login:August 04, 2003, 02:18:12 pm
Re:Rom Loaded Detection
« Reply #29 on: May 15, 2003, 02:32:58 am »
I'll feed them to you all day long, I just want a free "sample" of your wares when you start building up the little boards. What's your next issue?

Also, dude... turn off directory browsing on your website. Otherwise someone's going to steal a copy of your ultimate arcade II construction plans, as well as the circuit diagram for your led circuits off of parallel :)

BTW, I love that sideart, did you actually apply it yet, or is it still hypothetical?

DinoRoger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 139
  • Last login:October 24, 2005, 02:00:37 am
  • Hey, can I borrow a quarter?
Re:Rom Loaded Detection
« Reply #30 on: May 15, 2003, 02:45:48 am »
Y thanx got rid of those docs before there another sticky thread about those plans. LOL  I paid for mine.

For the LED board I decided to go with a USB I/O board instead and will be ordering to parts very soon.  I will also be implimenting a scrolling marquee design soon with my software.  

I am currently putting together my new UAII cab now but have not printed the side art.  Lots of mock drawings is what you saw.  I like to have everything perfected before I print.

BTW just uploaded latest BETA of Rom Watcher that has a pre-built MAME .67 list included.  You can assign application to run in the background when game is detected.  All customizable.  Everything is still BETA and the GUI is bad but you should get the idea from this functional BETA.  Program has a long way to go yet, but the more ideas the better.

If interested please read all the directions on this page below before downloading.

http://www.pchelplive.com/mameu/Downloads.htm

« Last Edit: May 15, 2003, 02:46:40 am by DinoRoger »