Author
|
Topic: johnny 5 (or CPViewer) for non-mame (Read 291 times)
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
I
would like to try and use Johnny for non-mame "emulators", specifically
my PC Games (I've got about 30 on my cab). I tend to tweak stuff a lot
so I have to manually re-generate the static images whenever I change
something, and it's a major pain.
I was thinking that I could create a "fake" controls.ini file for my PC
games and let Johnny magically place the labels to generate the static
images, but Johnny uses mame.
I've seen this thread on the Johnny forum: http://fe.donkeyfly.com/forum/index.php?PHPSESSID=5d56ba0b504a6262aaa408bc16619c17&topic=165.0 but since I'm not sure how the driver info is used by Johnny the answer doesn't make a lot of sense to me.
could we just create a "fake" mame executable (or batch file) that
would return fake driver info that would make the process work somehow?
|
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
how does johnny query mame (I'm not really familiar with the FE related
options to mame) and how does mame "answer" (to standard out, in a
file, ...?).
I might be easier to create a batch file or small program that pretends
to be a mame executable but simply answers with what johnny needs, all
you'd have to do is point johnny to that fake mame executable when
creating the images. |
|
|
|
Popcorrin
Full Member
  
Offline
Posts: 385
|
I
used to do this with the old version of Johnny5 and it worked
fine. All I had to do was add entries to controls.ini. |
|
|
|
Minwah
Developers
Full Member
  
Offline
Posts: 5621

|
I know John (jcrouse) uses CPViewer for various systems...I am not sure how exactly tho.
|
|
|
|
|
jcrouse
Full Member
  
Offline
Posts: 558
|
I
use CPVW for about 80 patforms (console and computer). It is very
simple. If you read the CPVW docs you'll see you can specify a
background image to use. I have created a static BG image for each
system with the logo across the top and the button hard-labeled, using
Photoshop. The buttons don't really change much for consoles. I'll
attach an example.
John
|
|
|
|
jcrouse
Full Member
  
Offline
Posts: 558
|
Oh, it also works great for a MameWAH controls viewer. This way your
user only needs to remember one key. If they press it they get the
following image and should tem know what all the controls do while in
the FE.
John
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
Yes, I understand that, that's what I was referring to as "static" images. I currently use cpvw also.
The problem I'm trying to solve is that I have about 30 PC games, each
with *very* different mappings, and I'm reluctant to generate 30 static
images, because if I change anything on my panel, I'll have to
re-generate the images by hand.
|
|
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
So do you think it would work? (I haven't tried with CPViewer yet).
I couldn't get it working properly with johnny5 because it calls mame
to game some info about the rom (could be operator error on my part
since popcorrin says he got it to work, but maybe it's something that
stopped working with version 2 of johnny5) |
|
|
|
jcrouse
Full Member
  
Offline
Posts: 558
|
I'd say yes, if the entries are the same structure/format as the
controls.ini file. CPViewer/CPVW is not as complex of a program as
Johnny5. It does nothing with your mame ctrlr files or the mame
executable. It simply looks up tags in an ini file.
John
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
great! I'll give it a try tonight.
|
|
|
|
jcrouse
Full Member
  
Offline
Posts: 558
|
Papa...email me at the address on my website.
John
|
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
I
did more testing yesterday and it did work for me too, it must have
been operator error, or it was the problem listed in this thread since I discovered it around the same time.
I do have additional information, and I think I'm 95% of the way where I want to be:
It seems the easiest way to do this is to add your PC games at the end
of the real controls.ini. I think I'll keep a PCcontrols.ini file that
I can append at the end of the official controls.ini whenever I
download a new version. Just like you did, I kept all the fields that
appear in a regular mame entry, maybe it's not necessary but it won't
hurt. You can even set the alternating and numplayers fields to
describe the game if you want to.
You then just set P1NumButtons and enter the proper P1_BUTTON? labels,
just like in your example. Make sure that P1NumButtons is set to the
right value, or johnny5 will ignore "extra" button labels.
I had another problem to solve: in my PC games, I use additional
buttons that are either not used in MAME or are considered "admin"
buttons by johnny5 and therefore ignored by its parsing.
For example I may have mapped a PC game control to the "1" key, which
is the player 1 start key for mame, labelled "START1" in the CTRLR
files. I tried adding "START1=test" to the entry in controls.ini, but
johnny5 ignores it, even if I create a label for "KEYCODE_1" in the
layout designer. johnny5 seems to only match KEYCODE_? labels in the
layout file to P1_BUTTON? entries in the control.ini.
I managed to solve the problem with the following "hack":
I defined my additional buttons as P1_BUTTON10 through P1_BUTTON14 in
my CTRLR file. I don't have Internet access at home right now (typing
this from work) so I can't cut and paste what it looks like, but just
look at the definition of "P1_BUTTON1" and cut and paste it and modify
the button name to P1_BUTTON10 and change the keycode to the right
value.
Note that's it's OK to have multiple definitions for a single
keystroke. For example mame's START1 is mapped to the "1" key, but you
can also map "P1_BUTTON10" to the same "1" key.
I then added the corresponding keycode labels in my layout file, for
example I added a label for KEYCODE_1 under the picture of the player 1
start button (which is now also defined as player 1 button 10).
An entry for a game would then look something like:
[testgame]
gamename=This is a test
numPlayers=1
alternating=0
mirrored=0
tilt=0
cocktail=0
usesService=0
miscDetails=This is only a test
P1NumButtons=14
P1Controls=8-way Joystick+joy8way
P1_BUTTON1=Fire
P1_BUTTON2=Bomb
P1_BUTTON3=Evade
P1_BUTTON4=Flare
P1_BUTTON5=Countermeasures
P1_BUTTON6=Afterburner
P1_BUTTON7=Bail
P1_BUTTON10=Map
P1_BUTTON11=Switch View
P1_BUTTON14=Menu
The entries in blue show the "regular" mame buttons and the entries in
red show the "additional" buttons that are either unused or admin
buttons in mame. For example P1_BUTTON10 is tied to key "1" as
explained above and P1_BUTTON14 is tied to "P" on my cab.
There is one issue that I haven't solved yet, and that's why I don't
consider this a full solution yet: the game "rom" name should not
contain any spaces:
I use mamewah and have it setup to show the link name in the rom list,
so I have a game called "Tower of the Ancients.lnk" so mamewah passes
"Tower of the Ancients" to johnny5 as the ROM name, but then johnny5
only looks for a ROM named "tower".
One way to deal with it is to makes an entry in the controls.ini with a
rom name of [tower] and a game name of "Tower of the Ancients". This
will work as long as you don't have another game that also starts with
the name tower. If you have both "Tower of the Ancients" and "Tower of
Doom" then this trick won't work.
Another way to deal with it would be to replace the spaces in the name
with underlines. This would however cause mamewah to show the game in
the game list as "Tower_of_the_Ancients" which is not too bad but not
really what we want.
I know mamewah has a {8.3} tag for the command line, but I haven't
explored what it does. If it takes a full name and turns it into a
unique 8.3 name, we might be able to use that.
EDIT:Tiger-Heli, feel free to copy/edit for your web page, since it's becoming the johnny5 reference page.
EDIT again: I'm working on something similar with CPViewer. It works a
little differently so I'll poost something when I'm have something
worked out. |
|
|
|
Tiger-Heli
Full Member
  
Online
Posts: 4075

Ron Howard? . . . er, I mean . . . Run, Coward!!!
|
It seems the easiest way to
do this is to add your PC games at the end of the real controls.ini. I
think I'll keep a PCcontrols.ini file that I can append at the end of
the official controls.ini whenever I download a new version.
I still think a better way to do it is to setup a new directory with
Johnny5 for PC games and use the custom controls.ini file in this
directory.
NOTE - In my example, I didn't mess with MAME's controller entries at
all, but I doubt I could have had a P1_Button14 either. . .
There is one issue that I
haven't solved yet, and that's why I don't consider this a full
solution yet: the game "rom" name should not contain any spaces:
I use mamewah and have it setup to show the link name in the rom list,
so I have a game called "Tower of the Ancients.lnk" so mamewah passes
"Tower of the Ancients" to johnny5 as the ROM name, but then johnny5
only looks for a ROM named "tower".
One way to deal with it is to makes an entry in the controls.ini with a
rom name of [tower] and a game name of "Tower of the Ancients". This
will work as long as you don't have another game that also starts with
the name tower. If you have both "Tower of the Ancients" and "Tower of
Doom" then this trick won't work.
Another way to deal with it would be to replace the spaces in the name
with underlines. This would however cause mamewah to show the game in
the game list as "Tower_of_the_Ancients" which is not too bad but not
really what we want.
I know mamewah has a {8.3} tag for the command line, but I haven't
explored what it does. If it takes a full name and turns it into a
unique 8.3 name, we might be able to use that.
Not sure how to work around this. EmuLoader has an unsupported
custom feature that allows you to assign a romname and gamename at
will. Perhaps if you enclose the info in quotes, Johnny5 will
take it, but I doubt it. I also thought about putting the link
into a batch file tower.bat, tower1.bat, but that won't do what you
want either.
You could also do:
Tower of the ancients.lnk
Tower1 of Doom.lnk
Tower2 of Power.lnk
Tower3 Trouble.lnk
but that's not perfect either. . .
EDIT:Tiger-Heli, feel free to copy/edit for your web page, since it's becoming the johnny5 reference page.
Already planned to, I'll credit you of course. It's looking like
the page will need an "Advanced Concepts PC Games page, and I don't
even have the basic methods posted yet . . .
|
The hypocrites are slandering the sacred halls of Truth
Ancient nobles showering their bitterness on youth
Can't we find the minds that made us strong? - RUSH, A Farewell to Kings
|
|
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
yes it is.
As far as MAME is concerned, the 1 key is mapped to the START1 "event",
it will ignore the fact that 1 is also mapped to "P1_BUTTON10"
As far as johnny5 is concerned it will see that P1_BUTTON10 is mapped
to the 1 key and that it has a label for KEYCODE_1 so it will display
the P1_BUTTON10 entry in the KEYCODE_1 label. |
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
The same basic idea works with CPViewer: either add entries at the end
of controls.ini or create a new directory with a PCgames specific
controls.ini and fill in game entries as with johnny. Note however that
the P1NumButtons is not really used in CPViewer
[testgame]
gamename=This is a test
numPlayers=1
alternating=0
mirrored=0
tilt=0
cocktail=0
usesService=0
miscDetails=This is only a test
P1NumButtons=14
P1Controls=8-way Joystick+joy8way
P1_BUTTON1=Fire
P1_BUTTON2=Bomb
P1_BUTTON3=Evade
P1_BUTTON4=Flare
P1_BUTTON5=Countermeasures
P1_BUTTON6=Afterburner
Things are handled differently in CPViewer/cpvw: the program doesn't
try to be so intelligent of mapping entries in your CTRLR file to your
layout file the way johnny5 does. Instead it directly matches entry
names in controls.ini to a label name in your layout.
Basically if you have a label for "P1_BUTTON1", it looks for a corresponding "P1_BUTTON1" label in controls.ini
By default, it will also attach the same value to the "P2_BUTTON1" in your layout if you have added that label.
The "trick" to use here is that you can override P2_BUTTON? entries so that they don't match the corresponding P1_ entries.
For example, if you mapped additional PC game controls to your P2
entries (I'm assuming the PC game is single player in this example),
then you can just add them in by specifying their P2_BUTTON? equivalent:
P2_BUTTON1=Cockpit Cam
P2_BUTTON2=Tail Cam
P2_BUTTON3=Wing Cam
P2_BUTTON4=Wide view
P2_BUTTON5=Zoom in
P2_BUTTON6=Zoom out
Now you may have mapped some controls to "admin" buttons on your
control panel. For example, let's say that in addition to your 2
buttons per players, you also have a player 1 start (mapped to "1"),
player 2 start (mapped to "2"), pause (mapped to "P"), mame menu
(mapped to TAB).
Your PC game may have somehing mapped to the 1, 2, and TAB key, so you want to label them in CPViewer.
if you have set up your CP for MAME, then you have told CPViewer to
create labels for P1_BUTTON1..P1_BUTTON6 and P2_BUTTON1..P2_BUTTON6.
Since CPViewer lets you define up to 8 buttons per player, you have 4
spares (2 on player 1 and 2 on player 2)
Since CPViewer doesn't really care what your buttons are, you can put a
P1_BUTTON7 label under your player start1, a P1_BUTTON8 under your
player 2 start, P2_BUTTON7 under the amme menu/tab button, etc...
Assuming that key "1" and "2" in your PC game are mapped to "easy" and
"difficult" and TAB is used for "quicksave", you can add the following
to the game's entry in controls.ini:
P1_BUTTON7=Easy
P1_BUTTON8=Difficult
P2_BUTTON7=QuickSave
Your final controls.ini then looks like this:
[testgame]
gamename=This is a test
numPlayers=1
alternating=0
mirrored=0
tilt=0
cocktail=0
usesService=0
miscDetails=This is only a test
P1NumButtons=3
P1Controls=8-way Joystick+joy8way
P1_BUTTON1=Fire
P1_BUTTON2=Bomb
P1_BUTTON3=Evade
P1_BUTTON4=Flare
P1_BUTTON5=Countermeasures
P1_BUTTON6=Afterburner
P2_BUTTON1=Cockpit Cam
P2_BUTTON2=Tail Cam
P2_BUTTON3=Wing Cam
P2_BUTTON4=Wide view
P2_BUTTON5=Zoom in
P2_BUTTON6=Zoom out
P1_BUTTON7=Easy
P1_BUTTON8=Difficult
P2_BUTTON7=QuickSave
Your are limited to a total of 16 mappable buttons however, which may
or may not be a limiting factor depending on how complex your CP is. In
my case, I have a single player cabinet with P1_ buttons, so I have 10
spares that I can use.
The other thing to be aware of, is that if you use that same layout for
MAME, you may have buttons mislabelled, for example the P1_BUTTON7 text
would show under your player 1 start with the example above, even
though pressing that button would not act as the player's 7th button.
This can be solved by using a different layout for MAME and PC Games.
Maybe future versions of CPViewer coud add "custom" buttons to the list
in addition to the 1..8 P1 and P2 buttons.
|
|
|
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
I have made contact with the CPVW author and we are planning on some
changes. For starters adding P3 and P4 buttons. We will also probably
make about 12 labels per user AND a generic set of labels, probably
eight or ten, you can use as you want. I will make a special layout
designer specificall for the application to rid out the massive
overhead of CPViewer. The designer will still require the .Net
framework. However, you could create the layout by hand. I did that
over the weekend.
Also, for some reason CPVW, as it is now, needs the alternating field
and it must be set to either one or two. I'm not sure why but that
seems to be the way it is.
I'll post more news as it materializes.
John
I'm not at home right now so I can't check, but I don't think I had
anything special to do with the "alternating=" line, even thoguh I saw
your comment in your email. My cab is an upright, is yours a cocktail?
could it be why alternating seems to matter for you but not me? I'm not
quite sure what the viewer setup wizard does under the hood, but
cabinet style and orientation does seem to matter a lot.
Edit: the additional buttons sound great!
|
|
|
|
Howard_Casto
Idiot Police
Developers
Full Member
  
Offline
Posts: 4291

Your post's soul is mine!

|
I just wanted to clarify some things.
I made j5 as generic as possible because I had always planned on
expanding it for other uses. J5 is a data translator, with a very
few exceptions, there are no constants in j5 that prevent you from
"making" other physical inputs. The list of possible inputs are
stored and read from a simple text file and it looks for those inputs
in the ini cfg/ect files. It doesn't look to see if they are
valid, nor does it care. A search string is a search
string.
I did this because mame also supports "non mame" inputs. Mame
outputs these extra controls on a joystick/keyboard as whatever the
windows driver labels them. Since I have no way of knowing every
possible input every odd-ball joystick puts out, this had to be
done.
To officially add these labels to the layout viewer simply open up the
"keycode constants.txt" in the data files folder and add them at the
bottom. (I would suggest adding a nice header like "PC Inputs
Only: ") This is also how you add static labels btw, just
remember to put a "*" first in the case fo static labels.
I tried to add "START1=test" in controls.ini since START1 is one of the
official MAME controls defined in my CTRLR file for MAME. More exactly
it is defined as KEYCODE_1 or KEYCODE_ENTER. I think the default for
MAME is just KEYCODE_1 but I have it set up as ENTER in my keyboard
encoder, because ENTER is commonly needed in PC Games, especially for
menu selections, which makes it fitting to be mapped to START1.
I added a KEYCODE_ENTER label in my layout, expecting it to show up in the generated picture but it didn't work.
I tried to run johnny5 with the -debug option and saw nothing in the debug window that referenced looking for START1.
what am I mising?
It's quite simple really..... do you have start defined as enter
anywhere in mame? I talked about adding more physical inputs, not
virtual ones. Since none of your mame mappings have Start1 mapped
to enter it has no way of knowing that you use start1 as enter.
And of course start1 has to be somewhere in the p1controltype string
setup properly in the format. Viewers know which labels to read
from an entry by the controltype entry at the beginning. |
It waits..... It shall return...
|
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
Cool, thanks the the explanation, I may handle it that way since it seems cleaner that my "P1_BUTTON10..." hack.
|
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
yes, I actually figured out how that part worked (thanks to the -debug
option), which is why I was able to add extra buttons that are defined
in the MAME CTRLR file but not really used for MAME (I don't play any
10 button games.) |
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
actually I am referring to mame's ctrlr file, if I remember right the
mame.ini points to it and it's in the mame/ini directory.
I think Johnny might be smart enough to get it from a game specific ini file but I haven't tried it.
|
|
|
|
|
|
papaschtroumpf
Full Member
  
Offline
Posts: 848

Have a Cow!
|
I've got only a single player control panel, so I didn't run into the issue.
I known CPViewer does support P2_ entries, becuase I tried doing the
opposite: entering "P2" entries so that I would have more "spare"
buttons. |
|
|
|
|