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: 'View controls' button concept I came up with...  (Read 3280 times)

0 Members and 1 Guest are viewing this topic.

Optics

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 27
  • Last login:December 25, 2008, 12:41:31 pm
'View controls' button concept I came up with...
« on: December 12, 2007, 08:20:39 am »
I've been working on the design of my control panel and machine in general, and since i've decided to go with a multi-emulator setup i'm going to have a range of 6-7 buttons, and of course tons of arcade games that only use two or three.  Orginally this concerned me because I wasn't sure how to let whomever I was playing with what buttons did what for what game. (Even I can't memorize them all!) Thanks to a post by DaveMMR, I learned of a neat little program called Cpviewer, which works with the frontend to display controls before the game itself loads.

 I was particularly pleased, and thought all my worries were solved.  As I was falling asleep the other night, I received some inspiration based on this concept, and decided to take it another step.   I thought to myself: "What if I had a button on top of my control panel, centered, next to an "Exit" button called 'Pause/View Controls, or just View Controls?"  The idea sounded great in nature, but I had no idea how to make it work, until now.  I don't know if anyone here is familiar with a program called AutoIt, but basically it's a program which allows you to write custom scripts to preform 'macros.' (A systematic set of actions on your computer based on pre-defined inputs and variables.)  For this to work, simply map the View Controls button to any unused key, such as F8, Delete, Insert, or anything else that won't get in the way.

 This key will run a custom script file in AutoIt, which will control your computers actions in order to do what we want it to.  Since AutoIt uses a mild scripting language, you  can use things such as If statements to essentially guide outcomes.  Here's how the script, in theory, would work:  1) The hotkey is pressed, AutoIt which is running in the background runs the script. 2) If Statement Branch: One of three things can happen here: A) 'If Frontend' - runs if you're in the FronteEnd. B) 'If Game'  - runs if you're in a game. or C) 'If viewing controls'  - runs if you're already viewing controls.  To figure out not only what program you're currently in but the name of the game you're playing, AutoIt would simply check the title of the application currently maxamized, and to detect what game you're playing AutoIt simply grabs the title name of Mame's exe. If you minimize mame as you're playing you'll notice that it'll read: "Mame: Teenage Mutant Ninja Turtles"  - depending on the game.  So in theory you simply grab the game name, and compare it using a series of if statements. (EG: If gamename = 'Teenage Mutant Ninja turtles' , do XYZ.)  After determining the application to be TMNT, the script would: 3) A) First PAUSE the game. (I think it's P by default?) and then B) Display an image in full screen mode from storage on your harddrive with the name "TMNT CONTROLS." This image file would be your custom made "HOW TO PLAY" screen.  So in sum, if you press the button the game pauses and the screen changes to display the controls for the specific game you're currently in!  There are two more actions in this script however, one which does nothing if the game is in frontend (unless you designate it to display a help or something), and another which runs if an image is currently being displayed. (It would check to see if the image was running, and if it was it would CLOSE the image, switch to mame, and press P again unpausing the game, all at one button stroke and an incredible speed.

So that's more or less it.  I'm posting this because you guys have helped me a lot so far with my machine, and I so I thought i'd put the idea out there for anyone who's in a similar predicament to me with controls.  This may have been done before, I don't know - but take it for what you will.  Scripting can be pretty powerful, and can be configured to do much more then display controls, the possibilities are limitless.  I will be attempting to do this for my arcade machine, so if I get the script working i'll be sure to post it with the necessary tweaks for anyone who wants to configure it and set it up themselves.  The ability to be able to view controls at any time during a game excites me quite a bit.  I won't have to worry about friends complaining they don't know how to play: Instead they can simply check!

patrickl

  • I cannot know for certain which will be tastiest
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4614
  • Last login:August 27, 2021, 09:25:30 am
  • Yo momma llama
    • PocketGalaga
Re: 'View controls' button concept I came up with...
« Reply #1 on: December 12, 2007, 08:34:24 am »
Sounds pretty easy to set up. I still need to look into this one, but I also saw how headkaze had a similar solution.

forum: CPWizard
This signature is intentionally left blank

Optics

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 27
  • Last login:December 25, 2008, 12:41:31 pm
Re: 'View controls' button concept I came up with...
« Reply #2 on: December 12, 2007, 10:43:36 am »
Pretty cool link. Seems to be mame specific though, so unfortunately I'll have to stick with a macro if I want to get this feature working for other emulators too. Ah, well!  :blah:

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: 'View controls' button concept I came up with...
« Reply #3 on: December 12, 2007, 02:45:04 pm »
This key will run a custom script file in AutoIt, which will control your computers actions in order to do what we want it to.  Since AutoIt uses a mild scripting language, you  can use things such as If statements to essentially guide outcomes.  Here's how the script, in theory, would work:  1) The hotkey is pressed, AutoIt which is running in the background runs the script. 2) If Statement Branch: One of three things can happen here: A) 'If Frontend' - runs if you're in the FronteEnd. B) 'If Game'  - runs if you're in a game. or C) 'If viewing controls'  - runs if you're already viewing controls.  To figure out not only what program you're currently in but the name of the game you're playing, AutoIt would simply check the title of the application currently maxamized, and to detect what game you're playing AutoIt simply grabs the title name of Mame's exe. If you minimize mame as you're playing you'll notice that it'll read: "Mame: Teenage Mutant Ninja Turtles"  - depending on the game.  So in theory you simply grab the game name, and compare it using a series of if statements. (EG: If gamename = 'Teenage Mutant Ninja turtles' , do XYZ.)  After determining the application to be TMNT, the script would: 3) A) First PAUSE the game. (I think it's P by default?) and then B) Display an image in full screen mode from storage on your harddrive with the name "TMNT CONTROLS." This image file would be your custom made "HOW TO PLAY" screen.  So in sum, if you press the button the game pauses and the screen changes to display the controls for the specific game you're currently in!  There are two more actions in this script however, one which does nothing if the game is in frontend (unless you designate it to display a help or something), and another which runs if an image is currently being displayed. (It would check to see if the image was running, and if it was it would CLOSE the image, switch to mame, and press P again unpausing the game, all at one button stroke and an incredible speed.

This is exactly what CPWizard does, but it doesn't use AutoIt, it's all internal code. To detect Mame running it uses Mame's output system. When you press Mame's pause key I then search for the MAME window class to get the hWnd. Then I minimize Mame and show the controls. If your using an earlier version of Mame before it's output system was implemented (around 107 I believe) it will just be searching out the Mame window and get the game name from it's titlebar like you suggest.

It will also work for other Emulators (but some don't like being minimized like Project 64 but I'm working on improving that) by searching out the emulator's exe name. You can have CPWizard send keys to the emulator before it shows your controls or after it is maximized. To show custom labels for the game you edit a file in the Data\Labels folder and create entries for the game. It can also uses mdb databases to fill out other game labels.

Eg. N64.ini
Code: [Select]
[Default]
EMU_EMUNAME=Nintendo 64
[Mario Kart 64]
S=Start / Pause
A=Throttle
B=Break
L=Music Toggle
R=Jump / Slide
Z=Shoot / Item Switch
CL=
CR=Toggle Game Screen
CU=Change Camera
CD=Item Switch

There hasn't been alot of testing with other Emulators using CPWizard yet so I need people to test it and report back any issues to the CPWizard thread.

BTW The idea of using AutoIt for displaying a CP is not a new concept, infact tigerheli goes into detail about doing with Johnny5 here. When I wrote CPWizard I wanted to automate all this AutoIt crap into the program itself.

You don't have to send command line info to CPWizard for Mame as it detects the game running automatically. But for other emulators you will have to send the name of the game to it. Eg. CPWizard -gamename [ROMName]. Also you have to set up entries for each emulator in Edit->Options as per the attached screenshot. CPWizard must be set to "Run on Startup". It will not yet launch and exit because there is alot of data it must read in for Mame. I really need to write some documentation on how it all works one day lol
« Last Edit: December 12, 2007, 03:02:22 pm by headkaze »

Optics

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 27
  • Last login:December 25, 2008, 12:41:31 pm
Re: 'View controls' button concept I came up with...
« Reply #4 on: December 12, 2007, 04:01:18 pm »
Oh cool so I'll be able to set up CpWizard for other emulators and their games? If so that'd save me a ton of work!  Also, I know this isn't the place, but since you're here anyway does CpWizard allow you to make custom image files for each game, or is it done in some sort of ini/config file? Thanks in advance and your post was a very interesting read.

Edit: Also, i've noticed that CpWizard adds a bunch of menus and things to the game, is there any way to not use those features and go strictly with the pause/view controls scheme? I'd try it out myself but have yet to find the time.. thanks.
« Last Edit: December 12, 2007, 04:05:48 pm by Optics »

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: 'View controls' button concept I came up with...
« Reply #5 on: December 13, 2007, 07:43:35 am »
Oh cool so I'll be able to set up CpWizard for other emulators and their games? If so that'd save me a ton of work!  Also, I know this isn't the place, but since you're here anyway does CpWizard allow you to make custom image files for each game, or is it done in some sort of ini/config file? Thanks in advance and your post was a very interesting read.

You can have  a separate layout for each game if you want, but the easiest way to deal with games is to use label files that change the labels for each game. And that way you have one layout for one system. But you can use "layout override" to have layouts for specific games. Not sure why you would want to do a separate layout for each game.

Edit: Also, i've noticed that CpWizard adds a bunch of menus and things to the game, is there any way to not use those features and go strictly with the pause/view controls scheme? I'd try it out myself but have yet to find the time.. thanks.

Good idea, I can implement that in a future version. "View CP Only" or something like that. The feature I'm working on at the moment is so you can display the CP for a number of seconds then it closes. This is so you can display your CP before you run a game.

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: 'View controls' button concept I came up with...
« Reply #6 on: December 13, 2007, 09:15:14 am »
CPWizard must be set to "Run on Startup". It will not yet launch and exit because there is alot of data it must read in for Mame.
But you could probably have your frontend launch a batchfile that launched CP Wizard along with MAME and then had a -taskkill CPwizard statement to close it, but I haven't experimented with this (or even with the basic program yet.)

Quote
I really need to write some documentation on how it all works one day lol
That would help a lot!!!   8) >:D
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

Optics

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 27
  • Last login:December 25, 2008, 12:41:31 pm
Re: 'View controls' button concept I came up with...
« Reply #7 on: December 13, 2007, 11:25:04 am »
Quote
You can have  a separate layout for each game if you want, but the easiest way to deal with games is to use label files that change the labels for each game. And that way you have one layout for one system. But you can use "layout override" to have layouts for specific games. Not sure why you would want to do a separate layout for each game.

I'm working on an arcade machine that rotates from one of three control panels, so depending on the game I'm trying to design the control panel display around the one the game currently uses, as well as display a little message in the corner "Please switch to panel 1..." or something like that.

Anyway, send me a PM or something if you do decide to do the "Enable view controls" only.. it's not that I'm not impressed with everything you were able to do, it's that I'm trying to go with a classic arcade feel; where the gamer is faced with the game and not options around it - it may sound weird, but to each his own I suppose, right?
« Last Edit: December 13, 2007, 11:27:03 am by Optics »

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: 'View controls' button concept I came up with...
« Reply #8 on: December 13, 2007, 11:36:15 am »
Anyway, send me a PM or something if you do decide to do the "Enable view controls" only.. it's not that I'm not impressed with everything you were able to do, it's that I'm trying to go with a classic arcade feel; where the gamer is faced with the game and not options around it - it may sound weird, but to each his own I suppose, right?

I'll try and get that into the next version for ya  ;)

EDIT: Done :) Check out Version 1.2 here
« Last Edit: December 14, 2007, 07:52:20 pm by headkaze »