View Full Version : Need help with a script for switching Magsticks with a servo
RetroBorg
01-14-2011, 01:34 PM
Hi guys,
I have two Magstick plus joysticks that switch from 4-way to 8-way using a servo.
A guy called terrahwk on the BYOAC forum who originally did something like this has automated it using a batch file. http://forum.arcadecontrols.com/index.php?topic=104762.0;all
Here's a video of it switching, I ran Juno First followed by Donkey Kong, just from the command line prompt.
j2r5UnU0F0Q
I haven't been able to get it to work from HyperSpin yet and was hoping someone here could help out and probably come up with a much better way to do it.
The following is terrahwk's quote from the BYOAC forum:
The servo controller contains a small amount of flash RAM, and it comes with software and a simple programming language. With a servo, you simply tell it where you want it to "be" and it will rotate to that position and stay there. Any attempts to move it will be met with resistance, depending on how strong the servo is. The position will vary according to each build. You can use the software that comes with the servo controller to play with it until you find the right value.
http://i1219.photobucket.com/albums/dd425/terrahwk/PololuServoController.png
You can use the software and move the slider, the servo will move in real time. Basically I wrote the following script in the above software and saved it to the servo controller. The script gets called whenever I want the servos to move.
8
sub start
8 equals if
4105 frame
else
7373 frame
endif
0 frame
quit
sub frame
dup
0 servo
1 servo
1000 delay
return
I'm no coding guru, so all this does is set up some simple logic - If I call the script with the value "8" (or no value) then it will tell both servos to move to position 4105. If the script is called with any other value, the servos will move to position 7373. (The scripting language uses RPN-like notation, which is why it might look a little odd) These values were found by experimentation.
The batch file (I'm using Windows XP) looks like this and I call it "runmame.bat":
@echo off
d:
cd d:\mame
findstr /b /r "%1$" game-stick-mapping.txt > result.txt
for /f %%A in ("result.txt") do if %%~zA NEQ 0 goto four
echo 8-way
usccmd --sub 0,8
goto end
:four
echo 4-way
usccmd --sub 0,4
:end
mame "%1"
Again, I take the easy way out. I have made a hacked version of controls.xml and it simply contains the rom names of roms that are 2 or 4-way games. I did this as my XML parsing skills are non-existant, but I can write a simple batch file :)
Basically, the batch file searches for the ROM name in the file "game-stick-mapping.txt". The result is written to a temporary file. If the file size is 0 then obviously the ROM name wasn't found so the assumption is made that the game is 8-way. It then calls the servo controller and passes the parameter "8" (or "4", if the ROM was found) and then finally calls mame. The file I use is here (but all credit should go to the creators of controls.xml, any mistakes are likely to be from me) http://pastebin.com/download.php?i=twbzDgSf
The batch file is therefore called like you would mame:
runmame.bat 1942.zip
I use Hyperspin as the front-end. Hyperspin won't run batch files, so I came across a utility called "Bat-to-exe-converter" here http://www.f2ko.de/programs.php?lang=en&pid=b2e
You can feed it a batch file (like the one above) and it will "convert/compile" it into an exe. Hyperspin then accepts this exe instead of mame.exe. (although I don't pass any other parameters to mame.exe - I have it all set up in mame.ini. If you pass parameters through you might need to adjust the batch file)
Anyway terrahwk has done a great job getting it all to work but I thought somone here could come up with a script for the MAME module that could simplify the whole thing. I've been using the new Hyperlaunch 2.0.
Cheers.
Phil[YOUTUBE HD][/YOUTUBE HD]
RetroBorg
01-16-2011, 03:35 AM
Someone on Autohotkey tried helping me out with this, which I added into the MAME module, I've highlighted what he did in red.
; MAME
; MAME .140
; by BBB
; 1.0
;
; Info:
; Since MAME needs to save hi scores and data on exit, then we can't force
; MAME closed with a hotkey. So make sure you have your own exit key setup
; in MAME first. We will leave the CloseProcess section below blank, but
; it is still required.
;
;----------------------------------------------------------------------------
If !(1) ; do nothing on empty command line parameter 1 (game name missing)
Return
mappingsFile = E:\HyperSpin\Emulators\Mame\game-stick-mapping.txt
FileRead, mappingsFileData, %mappingsFile%
If RegExMatch(mappingsFileData, 1 . "$") ; if data contains command line parameter at end of line somewhere
RunWait, usccmd --sub 0`,4, , Hide ; you might need to specify whole path and working directory
Else
RunWait, usccmd --sub 0`,8, , Hide ; you might need to specify whole path and working directory
Runwait, %executable% %romName%, %emuPath%, Hide UseErrorLevel
if(ErrorLevel != 0){
if (ErrorLevel = 1){
Error = Failed Validity
}else if(ErrorLevel = 2){
Error = Missing Files
}else if(ErrorLevel = 3){
Error = Fatal Error
}else if(ErrorLevel = 4){
Error = Device Error
}else if(ErrorLevel = 5){
Error = Game Does Not Exist
}else if(ErrorLevel = 6){
Error = Invalid Config
}else if(ErrorLevel = 7 || ErrorLevel = 8 || ErrorLevel = 9){
Error = Identification Error
}else{
Error = Mame Error
}
MsgBox Mame Error - %Error%
}
ExitApp
;Required
CloseProcess:
;Doesnt have to do anything but make sure to have the line before and after this line.
return
Unfortunately it didn't work it doesn't pick up any of the 4-way games I have in my list.
Anyone here see what is wrong.
Cheers.
Phil
You could parse the controls.xml that cpwizard uses and use that info to script where the servo should be. The controls.xml (or dat) has the control type for each game.
Use an xml engine like xpath (http://www.autohotkey.com/forum/topic17549.html) to do it.
RetroBorg
01-16-2011, 01:37 PM
You could parse the controls.xml that cpwizard uses and use that info to script where the servo should be. The controls.xml (or dat) has the control type for each game.
Use an xml engine like xpath (http://www.autohotkey.com/forum/topic17549.html) to do it.
I think that would be the ultimate solution but unfortunately I feel it is way beyond me.
I would like to of come up with an easy solution using Autohotkey so I could create a module for others using this method of switching joysticks.
I have now played around with the previous batch file I posted and removed the .zip from each romname in the 4-way game list and have it working with hyperLaunch
The batch file is called Joystick.bat and the file game-stick-mapping.txt contains a list of all 4-way romnames.
@echo off
findstr /b /r "%1$" E:\HyperSpin\Emulators\Mame\game-stick-mapping.txt > E:\HyperSpin\Emulators\Mame\result.txt
for /f %%A in ("E:\HyperSpin\Emulators\Mame\result.txt") do if %%~zA NEQ 0 goto four
echo 8-way
usccmd --sub 0,8
goto end
:four
echo 4-way
usccmd --sub 0,4
:end
;----------------------------------------------------------------------------
; MAME
; MAME .140
; by BBB
; 1.0
;
; Info:
; Since MAME needs to save hi scores and data on exit, then we can't force
; MAME closed with a hotkey. So make sure you have your own exit key setup
; in MAME first. We will leave the CloseProcess section below blank, but
; it is still required.
;
;----------------------------------------------------------------------------
Runwait, E:\HyperSpin\Emulators\Mame\Joystick.bat %romName%
Runwait, %executable% %romName%, %emuPath%, Hide UseErrorLevel
if(ErrorLevel != 0){
if (ErrorLevel = 1){
Error = Failed Validity
}else if(ErrorLevel = 2){
Error = Missing Files
}else if(ErrorLevel = 3){
Error = Fatal Error
}else if(ErrorLevel = 4){
Error = Device Error
}else if(ErrorLevel = 5){
Error = Game Does Not Exist
}else if(ErrorLevel = 6){
Error = Invalid Config
}else if(ErrorLevel = 7 || ErrorLevel = 8 || ErrorLevel = 9){
Error = Identification Error
}else{
Error = Mame Error
}
MsgBox Mame Error - %Error%
}
ExitApp
;Required
CloseProcess:
;Doesnt have to do anything but make sure to have the line before and after this line.
Nice chillin, I forgot about the ini version. I was trying to think of how I could parse the xml into an ini, which I know very well how to utilize in ahk, unlike xml.
Kodiak
01-16-2011, 04:38 PM
Interesting I'll have to see about adding something like this to HL-AI...are there any other controllers out there that need support?
@ djvj -
couldn't you read an XML into a string with AHK then apply RegEx and test the result? I do this all the time with AI rather than dealing with XPath.
chillinwater
01-16-2011, 04:48 PM
Sorry I accidentally deleted the previous post.
[Repasted from Deleted post]
I also have (2) magsticks (havent installed them or servos, controller board or linkage) and would love to get this going with the servos eventually.
So....
This is very rudimentary and ONLY a proof of concept.
An autohotkey guru could use more complex and efficient commands.
The "controls.ini" is basically the same as the "controls.xml" but using the ini alleviates the need to get more complicated and bloated by using "xpath"
4 files required for testing included as scripts below:
-4-way Joystick+joy4way.ahk -dummy file for testing (Temporarily replaces the actual "Pololu Maestro Control Center" script you would use for 4-way positioning on post one of this thread)
-8-way Joystick+joy8way.ahk -dummy file for testing (Temporarily replaces the actual "Pololu Maestro Control Center" script you would use for 8-way positioning on post one of this thread)
-Magstick.bat -batch file to test Magstick.exe (Outside Hyperspin)
-controls.ini - http://controls.arcadecontrols.com/controls/controls_dat.php (http://controls.arcadecontrols.com/controls/controls_dat.php)
-MagStick.ahk -compiled file to add to Mame module once tested
-Command line parameter for MagStick.exe:
Mag-Stick.exe "romname"
Theoretical operation:
-reads/parses the file, "controls.ini", from:
http://controls.arcadecontrols.com/controls/controls_dat.php (http://controls.arcadecontrols.com/controls/controls_dat.php)
also see partial "controls.ini" below at the bottom.
1)if game is a 4-way controlled game it runs the bat converted to exe or "Pololu Maestro Control Center" script on post #1 (the names I used are different than the bat\exe conversions or PMCC script)
2)if game is a 8-way controlled game it runs the bat converted to exe or "Pololu Maestro Control Center" script on post #1 (the names I used are different than the bat\exe conversions or PMCC script)
3)reads/writes the previous state of magstick from "controls.ini" to prevent unecessary movement (user added section in controls ini below)
4)if a particular game has no 4-way or 8-way designation, Nothing will change to protect servos
[For testing Inside Hyperspin]
-Line to add to Mame module (just before the run command)
(if placed in hyperspin root directory)
run, %a_scriptdir%\Mag-Stick.exe "%romname%"
or
(if placed in "any other directory")
run, "any other directory"\Magstick.exe "%romname%"
-place all files in the same folder (your choice)
[For testing Outside Hyperspin]
The (2) following files/scripts are just dummies and temporarily replace the actual "Pololu Maestro Control Center" script you would use for 4-way and/or 8-way positioning on post one of this thread.
(these do not need to be compiled for testing purposes)
-place all files in the same folder (your choice)
-the bat\exe converted files from previous posts would need to be named like this.
-edit the batch file to simulate the run of the game
-run the batch file and see that it does what your looking for.
(it only simulates the running of the game but does not actually load a game in Mame)
[4-way Joystick+joy4way.ahk]-for testing only!
guiheight:=A_ScreenHeight/9*4
Gui, +toolwindow -Caption +AlwaysOnTop
Gui, Color, black
Gui, Font, S24 Cred, verdanna
Gui, Add, Text, y%guiheight% W%A_ScreenWidth% H%A_ScreenHeight% center, Now Changing `nTo `n"4-Way" Controls
Gui, Show, W%A_ScreenWidth% H%A_ScreenHeight%,
sleep, 5000
gui destroy
exitapp
[8-way Joystick+joy8way.ahk]-for testing only!
guiheight:=A_ScreenHeight/9*4
Gui, +toolwindow -Caption +AlwaysOnTop
Gui, Color, black
Gui, Font, S24 Cred, verdanna
Gui, Add, Text, y%guiheight% W%A_ScreenWidth% H%A_ScreenHeight% center, Now Changing `nTo `n"8-Way" Controls
Gui, Show, W%A_ScreenWidth% H%A_ScreenHeight%,
sleep, 5000
gui destroy
exitapp
[Magstick.bat] -for testing only!
-this batch file is just for testing the command line parameters of MagStick.exe (Outside Hyperspin)
you can add more roms to it for testing if needed. (these are the first 4 games of the "controls.ini" file)
They each have a different control configuration.
magstick.exe "005"
rem "4-way Joystick+joy4way"
rem magstick.exe "10yardj"
rem "8-way Joystick+joy8way"
rem magstick.exe "88games"
rem "Just Buttons+button"
rem magstick.exe "gtmr"
rem "270 Steering Wheel+paddle|Pedal (Microswitch)+button+P1_BUTTON1"
-Main File
[MagStick.ahk] -save and compile
-remove or comment out the first (4) "msgbox" commands when done testing.
-change directories if needed ("%a_scriptdir%" assumes you have placed all files in one directory)
;[Mag-Stick.exe]
;compile this script
;add the following line before the "run" command in mame module
;run, %a_scriptdir%\Mag-Stick.exe %romname%
;
romName = %1%
param := "%romName%"
msgbox, romname=%romName%
;reads state of 4-way, 8-way joystick (user added line in "controls.ini")
iniread, state, %a_scriptdir%\controls.ini, Controls, PrevState
msgbox, Previous State=%state%
;reads actual Mame documented Control type
iniread, controls, %a_scriptdir%\controls.ini, %romname%, P1controls
msgbox, controls=%controls%
ifinstring, controls, error, exitapp
iniwrite, %controls%, %a_scriptdir%\controls.ini, controls, PrevState
;exits with no change to the position of mag stick,, to prevent servos from moving un-necessarily
if (controls = state)
{
msgbox, No Change necessary, Now Exiting!
exitapp
}
;changes to proper 4-way or 8-way control
else if (controls != state)
{
ifexist, run, %a_scriptdir%\%controls%.ahk
exitapp
}
;exits with no change to the position of mag stick, if error in the "controls.ini" file and sends message so you'll no to update the controls.ini file
else if (controls = "error")
{
msgbox, ERROR, No configuration exists in "controls.ini" for %romname%, NO Control Change!
exitapp
}
[controls.ini] from: http://controls.arcadecontrols.com/controls/controls_dat.php (http://controls.arcadecontrols.com/controls/controls_dat.php)
-This code below is only a sampling of the "controls.ini" file.
(Pasting it here is too large and the server times out on me.)
so get it from the link above and add these lines to it.
[Controls]
PrevState=
-The test file and bat/exe conversion file names are derived from these sections below.
You should only really need:
4-way Joystick+joy4way
and
8-way Joystick+joy8way
for naming.
(note) - Just Buttons+button
and 270 Steering Wheel+paddle|Pedal (Microswitch)+button+P1_BUTTON1
arent needed but are highligted just to show where the information comes from.
;;Controls.dat INI file Version=0.141.1, Time=2011-01-05 18:17:26, Generated by=SirPoonga
[Controls]
PrevState=4-way Joystick+joy4way
[88games]
gamename='88 Games
numPlayers=2
alternating=0
mirrored=1
tilt=0
cocktail=1
usesService=0
miscDetails=This is a 4 player team type game where 2 players compete each time
P1NumButtons=3
P1Controls=Just Buttons+button
P1_BUTTON1=Run
P1_BUTTON2=Jump
P1_BUTTON3=Run
[005]
gamename=005
numPlayers=2
alternating=1
mirrored=1
tilt=0
cocktail=1
usesService=0
miscDetails=
P1NumButtons=1
P1Controls=4-way Joystick+joy4way
P1_BUTTON1=Fire
P1_JOYSTICK_UP=Up
P1_JOYSTICK_DOWN=Down
P1_JOYSTICK_LEFT=Left
P1_JOYSTICK_RIGHT=Right
[10yardj]
gamename=10-Yard Fight (Japan)
numPlayers=2
alternating=1
mirrored=1
tilt=0
cocktail=1
usesService=0
miscDetails=
P1NumButtons=2
P1Controls=8-way Joystick+joy8way
P1_BUTTON1=Pass / Hike
P1_BUTTON2=Lateral
P1_JOYSTICK_UP=Up
P1_JOYSTICK_DOWN=Down
P1_JOYSTICK_LEFT=Left
P1_JOYSTICK_RIGHT=Right
[gtmr]
gamename=1000 Miglia: Great 1000 Miles Rally (94/07/18)
numPlayers=2
alternating=1
mirrored=1
tilt=1
cocktail=1
usesService=0
miscDetails=IMPORTANT NOTE: This game has several options regarding the control type. It has an optional brake pedal/button as well as the option to play the game with either a 270 wheel or an 8way joystick. The controls shown here are the ones used on the dedicated model. Notice the lack of the brake pedal. It seems that the brake pedal was used in conversion kits as the dedicated cabinet didn't have one.
P1NumButtons=1
P1Controls=270 Steering Wheel+paddle|Pedal (Microswitch)+button+P1_BUTTON1
P1_BUTTON1=Accelerate
P1_PADDLE=Left
P1_PADDLE_EXT=Right
RetroBorg
01-17-2011, 01:12 PM
Wow, thanks, this looks awesome, I quickly saw your reply while I was at work yesterday but when I got home from work I couldn't get on the forum so I couldn't test it. I finally got on the forum just as I was going to bed so I'll have to test it tonight when I get home from work. I'll copy code everything now so if I can't get on I've still got the code.
Is it just my computer or does the HyperSpin site continually go down?
Theoretical operation:
4)if a particular game has no 4-way or 8-way designation, Nothing will change to protect servos
I'm not too sure about this line here, just say I play Donkey Kong (4-way) and then I want to play Sinistar (49-way), it would be much better to switch to 8-way also the same would apply for those who don't have a trackball and they want to play Centipede with a joystick.
There is also the matter of Q*Bert and any of it sequels, clones etc, while it is a 4-way game it is a rotated 4-way which you can play quite well with an 8-way if you configure it right within MAME itself.
Anyway, I guess they are issues for later on, the important thing is to test the code and see if it switches the servos, so I'll check all that out tonight when I get home.
Thanks again.
Phil
chillinwater
01-17-2011, 03:10 PM
ok so in those events...
currently there are two .ahk scripts for testing use.
one is,
4-way Joystick+joy4way.ahk
and the other is,
8-way Joystick+joy8way.ahk
But you can make more....
These names are taken directly from the control.ini description of controls for a particular game.
If for example you scroll down in the control.ini file to "Sinistar (49-way)"
looking for:
[Sinistar]
P1Controls=Whatever this control designation is
this is what you would name a (third) test file .ahk or actual PMCC script or bat/exe and use the script that changes it to the 4-way or 8-way config you want, named:
Whatever this control designation is.ahk
Its setup so you Can make as many files as you want but also setup so that if the state of the Magstick is already set at say 8-way it knows that via these lines in the "control.ini"
(this is written based on the rom each time a game is launched)
[Controls]
PrevState=8-way Joystick+joy8way
or if its somthing like
270 Steering Wheel+paddle|Pedal (Microswitch)+button+P1_BUTTON1
it wont move the servos which should protect them from wear and tear.
(unless you make a script/bat/exe/ahk for it too)
Does PMCC know what state itself is in so it doesnt try to move the servos if not needed?
I can already see that you cant make a file name with this "|" in it (no-quotes) so we would have to remove that out of the controls.ini for that game i.e.
[gtmr]
P1controls=270 Steering Wheel+paddle|Pedal (Microswitch)+button+P1_BUTTON1
Remember this is only a basic test and with your questions like this one I can further understand how PNCC works and write some new checks and balances that you need or someone else can also chime in.
I cant actually test it (other than the way I have it) since I dont have the servos or the circuit board and I dont know how the script for PMCC is called or run from PMCC.
i.e.what does the script file extension look like and if you click on it does it move the servos?) Is PMCC command line to run a particuar script. I know it runs or can run a script on startup.
So to sum up a minimum of (2) test files are needed
(a 4-way and an 8-way).
you can make as many as you want but of course you are limited in reality to only 4-way and 8-way even if they are named:
270 Steering Wheel+paddle|Pedal (Microswitch)+button+P1_BUTTON1.ahk
or
Just Buttons+button.ahk
Hope this makes sense.
Kodiak, I have read a couple times that RegEx can be wonky and not work right at times with ahk, that it's suggested to use an xml engine instead.
Kodiak
01-17-2011, 04:10 PM
ahh okay...well it was an idea to toss out there. :)
RetroBorg
01-17-2011, 11:27 PM
Okay I have run all the tests above and they all work, well done! :congrats:
On running the [For testing Inside Hyperspin] the messages that come up you have to press okay to and if you take to long the game starts and you can't continue pressing okay.
I did notice that controls.ini didn't contain Juno First and a quick look through controls.ini it certainly didn't look like a full list of romnames. Perhaps controls.ini still has some way to go to be a complete list and we may need an alternative to make this a viable solution.
I cant actually test it (other than the way I have it) since I dont have the servos or the circuit board and I dont know how the script for PMCC is called or run from PMCC.
i.e.what does the script file extension look like and if you click on it does it move the servos?) Is PMCC command line to run a particuar script. I know it runs or can run a script on startup.
As far as the servo controller stuff goes, terrahwk made up this script within the Master Control Centre, the software you use to program the controller.
8
sub start
8 equals if
4105 frame
else
7373 frame
endif
0 frame
quit
sub frame
dup
0 servo
1 servo
1000 delay
return
This is then saved to the flash rom on the servo controller.
The commands to run it are:
usccmd --sub 0,8 (for 8-way mode)
usccmd --sub 0,4 (for 4-way mode)
I hope this is the info you're after because quite frankly this stuff is right over my head. :hmmmm:
Anyway, thanks for your help so far this is looking really promising.
Cheers.
Phil
chillinwater
01-18-2011, 07:35 AM
OK,
Its still viable its just that someone would have to supplement all of "Sirpoongas" hard work.
for now all we need to add are these lines in the control.ini for each missing game
[romname]
P1controls=xxxxxxxxxx
The script i've written takes into account "error" if no game is found and does nothing (no movement) currently.
We could make it do somthing like make sure it switches to 4- way or 8-way by default if its not already in that position.
All the message boxes are just for testing (except the last one) and can be removed or commented out by adding ";" like this:
;msgbox whatever
I have some ideas to streamline the checks and balances so all you would need are the two scripts or test files (one for 4-way one for 8-way)
In all cases this is the line that currently runs the script or test file.
ifexist, run, %a_scriptdir%\%controls%.ahk
ill change this line above to take advantage of the command lines.
usccmd --sub 0,8 (for 8-way mode)
usccmd --sub 0,4 (for 4-way mode)
For games like "Juno First" you have to edit the control.ini and add control designations to it and although not necessary, all the other stuff/info if desired.
Thats what the last messagebox is for to give you a heads up (to edit) on those games "Juno First" Im sure there are more missing.
(dont disable the last messagebox for that reason)
{
msgbox, ERROR, No configuration exists in "controls.ini" for %romname%, NO Control Change!
exitapp
}
I have surgery on my wrist to reattach a severed tendon today so Ill be on vicodin and hypercrack later today and probably wont get the script re-written for a day or so.
(unless together the drugs work like weed....good weed!)
chillinwater
01-18-2011, 07:57 AM
I know the "control.ini" is a big file and potentially alot of work but..
We have to start somwhere and Sirpoonga has already done alot.
What you could do is go through all the rom control designations and determine what it is you want them to do i.e. (4-way and 8-way are a given) and fill in missing rom sections if you know which ones are missing.
just to name a few...
P1controls=Just Buttons+button (do you want 4-way or 8-way?)
P1controls=270 Steering Wheel+paddle|Pedal (Microswitch+button+P1_BUTTON1 (do you want 4-way or 8-way?)
and so on.............
also for
[qbert]
P1controls=xxxxxxxxxxx(you wanted 8way right?)
xxxxxxxxx=I dont know the control designation at the moment
Lastly,
If the "Controls.XML" is better, (has more info in it) than the "Controls.INI" I may be able to use it for Mame.
I've had success getting xpath to work and read "xmls" for Mame romnames.
Other emus that use roms with "[" or "]" in the name Ive been unsuccesful getting to work.
(this shouldnt really matter anyway as I'm not aware of a controls.ini or similar for other emus)
RetroBorg
01-18-2011, 03:48 PM
Maybe we are over complicating the process by using Controls.INI, it would of been a great resource if it was complete but it looks like it would require quite a large amount of work to do so.
Maybe we should simplify it by having a txt file that contains the following romnames:
All 2-way games, dual 2-way games, 4-way games and dual 4-way games.
We get the script to look for romname we are launching and if it's in the txt file we switch the joysticks to 4-way.
If we don't get a match we switch to 8-way.
I used the command mame -listxml >mame.xml to make my mame.xml list (MAME 0.141s), then using Romlister (http://www.waste.org/~winkles/ROMLister/) I made a list of all roms containing all 2-way games, dual 2-way games, 4-way games, dual 4-way games and saved it as Controls.txt.
http://www.waste.org/~winkles/ROMLister/main.jpg
I then edited Controls.txt by doing a find for "qbert" and deleted about six of the Q*Bert entries.
This gives me 940 romnames on the list, I've read that mame.xml never used to be all that accurate when it came to control listing but I also have read it has improved recently, I'm sure it isn't as accurate as Controls.dat but it does cover all roms that MAME supports including clones.
It is also much simpler to edit if you find an error than what the Controls.ini file would be if you find an error.
I have surgery on my wrist to reattach a severed tendon today so Ill be on vicodin and hypercrack later today and probably wont get the script re-written for a day or so.
(unless together the drugs work like weed....good weed!)
I hope your surgery goes well and the drugs work together like good weed for ya!
chillinwater
01-18-2011, 11:50 PM
Yeah thanks, it turns out I severed (2) tendons and the drugs are working pretty good and the procedure went well so far.
Thats completly doable with that list. I'm also familiar with Romlister.
I didnt realize the controls.ini and/or .xml were so incomplete.
so in theory...let me know if this isnt the correct scenario...
-For all the games in your list, the Magstick/servo will be moved to the (4-way) position unless its already there then no change.
-For all other games not in your list, the Magstick/servo will be moved to the (8-way) position unless its already there then no change.
If these parameters are true, I'll modify the script to read your list which also will be slightly modified.
Also, can you test these (2) scripts to see if these will turn the servos back and forth?
(no need to compile)
[4_Way.ahk]
run, "ChangeToYourDirectory"\usccmd.exe --sub 0,4 ;(for 4-way mode)
[8_Way.ahk]
run, "ChangeToYourDirectory"\usccmd.exe --sub 0,8 ;(for 8-way mode)
RetroBorg
01-19-2011, 01:03 AM
Yeah thanks, it turns out I severed (2) tendons and the drugs are working pretty good and the procedure went well so far.
Glad everything went well, I hope the drugs don't wear off too early.
so in theory...let me know if this isnt the correct scenario...
-For all the games in your list, the Magstick/servo will be moved to the (4-way) position unless its already there then no change.
-For all other games not in your list, the Magstick/servo will be moved to the (8-way) position unless its already there then no change.
Yep, that sounds good.
Also, can you test these (2) scripts to see if these will turn the servos back and forth?
(no need to compile)
[4_Way.ahk]
run, "ChangeToYourDirectory"\usccmd.exe --sub 0,4 ;(for 4-way mode)
[8_Way.ahk]
run, "ChangeToYourDirectory"\usccmd.exe --sub 0,8 ;(for 8-way mode)
I'll test them when I get home from work.
Cheers.
I didnt realize the controls.ini and/or .xml were so incomplete.
I read once that the xml doesn't include clones on purpose. Maybe they wanted to tackle parent first. I notice there are a ton of games missing controls when I use cpwizard.
RetroBorg
01-19-2011, 03:54 AM
[4_Way.ahk]
run, "ChangeToYourDirectory"\usccmd.exe --sub 0,4 ;(for 4-way mode)
[8_Way.ahk]
run, "ChangeToYourDirectory"\usccmd.exe --sub 0,8 ;(for 8-way mode)
Those didn't work but these commands do:
Run %comspec% /c "usccmd --sub 0`,4" ;(for 4-way mode)
Run %comspec% /c "usccmd --sub 0`,8" ;(for 8-way mode)
RetroBorg
01-19-2011, 12:40 PM
I've had some help from Leef-me on the Autohotkey forum and he has come up with this solution which works great.
I've named it Joystick.ahk and have put it in my MAME directory.
#singleinstance force
;---------------- leefme's version of the batch file
;
; depending how you have installed AutoHotkey,
; AHk script may or maynot be provided parameters from a DOS command line.
;
; If the parameters are not passed, compile the script to an Exe
if %0%=0
{
msgbox %A_ScriptName%: will exit now
exitapp
}
fileread, FileContents, E:\HyperSpin\Emulators\Mame\Controls.txt ;this line would have to be changed to suit each user
Loop, parse, FileContents, `n, `r ; Specifying `n prior to `r allows both Windows and Unix files to be parsed.
{
IfInString, A_LoopField, %1%
{
found = 1
break
}
}
if found = 1
{
Run %comspec% /c "usccmd --sub 0`,4"
}
else
{
Run %comspec% /c "usccmd --sub 0`,8"
}
exitapp
And this is the MAME module:
;----------------------------------------------------------------------------
; MAME
; MAME .140
; by BBB
; 1.0
;
; Info:
; Since MAME needs to save hi scores and data on exit, then we can't force
; MAME closed with a hotkey. So make sure you have your own exit key setup
; in MAME first. We will leave the CloseProcess section below blank, but
; it is still required.
;
;----------------------------------------------------------------------------
Runwait, E:\HyperSpin\Emulators\Mame\Joystick.ahk %romName%
Runwait, %executable% %romName%, %emuPath%, Hide UseErrorLevel
if(ErrorLevel != 0){
if (ErrorLevel = 1){
Error = Failed Validity
}else if(ErrorLevel = 2){
Error = Missing Files
}else if(ErrorLevel = 3){
Error = Fatal Error
}else if(ErrorLevel = 4){
Error = Device Error
}else if(ErrorLevel = 5){
Error = Game Does Not Exist
}else if(ErrorLevel = 6){
Error = Invalid Config
}else if(ErrorLevel = 7 || ErrorLevel = 8 || ErrorLevel = 9){
Error = Identification Error
}else{
Error = Mame Error
}
MsgBox Mame Error - %Error%
}
ExitApp
;Required
CloseProcess:
;Doesnt have to do anything but make sure to have the line before and after this line.
return
Now is it possible to combine both scripts for one MAME module script?
chillinwater
01-19-2011, 04:00 PM
Glad you got another one going...
I finished the one I was working on. Let me know if you want to try it.
You could combine but I wouldnt, keeps it cleaner the way you have it.
Works just like we discussed.
You can change:
Runwait, E:\HyperSpin\Emulators\Mame\Joystick.ahk %romName%
to
Runwait, %emuPath%Joystick.ahk %romName%
This allows anyone to use the script, regardless of where they have their mame folder.
RetroBorg
01-19-2011, 07:28 PM
Glad you got another one going...
Yeah, when I first posted here there wasn't any interest until you looked at it soI had also posted over at Autohotkey where Leef_me came up with a working method.
I finished the one I was working on. Let me know if you want to try it.
Let's give it a go.
You could combine but I wouldnt, keeps it cleaner the way you have it.
Fair enough, I was just thinking we could make it just one script that could be downloaded from the module section called MAME (servo module), and in the script we could contain a link to somewhere we upload the latest Controls.txt file to make it easier for anyone else going for this method.
Something I hadn't previously thought about is what happens if you're playing Donkey Kong in MAME, then decide to leave MAME and play Nintendo 64 games, the current script will have the joysticks stuck in 4-way mode. I think we need a way to always return the joysticks to 8-way mode when exiting a game to avoid this from happening.
RetroBorg
01-19-2011, 07:30 PM
You can change:
Runwait, E:\HyperSpin\Emulators\Mame\Joystick.ahk %romName%
to
Runwait, %emuPath%Joystick.ahk %romName%
This allows anyone to use the script, regardless of where they have their mame folder.
Yep, that's an obvious improvement I will change the script to that.
Cheers.
chillinwater
01-19-2011, 07:48 PM
Here is the other one:
updated: http://www.megaupload.com/?d=8H2WCSXF
Sorry for any codine enhanced uglyness in the script and one handed typing.
The files marked with "-" are all you need the rest are just for testing purposes.
-Magstick.ahk
-Magstick.ini
-various test only files (4) splash screens and (1) testing batch file for (outside Hyperspin
Unzip to one folder to test, then move to the mame folder if you want.
(just keeps it tidy)
[removed] - to avoid confusion
see post #29 http://www.hyperspin-fe.com/forum/showpost.php?p=104808&postcount=29
RetroBorg
01-20-2011, 03:41 AM
Okay I tested your scripts.
I put the MAME.ahk file in the MAME module directory and all the rest of the files in my E:\HyperSpin\Emulators\Mame directory, I found the following line in the MAME.ahk file didn't write to the Magstick.ini file.
iniwrite, 8_way, %a_scriptdir%\Magstick.ini, controls, PrevState
I changed it to:
iniwrite, 8_way, %emuPath%\Magstick.ini, controls, PrevState
and found that works good, well done chillinwater, not bad for a one handed man.
I like your screens that display changing to 8-way etc, is it possible to have some graphics of like a joystick with 8 arrows coming from etc?
By the way how did you do your tendons?
I did a tendon in my ankle once while I was paralytically drunk and couldn't believe how painful it was, I hate to think how painful it would of been if I was sober.
chillinwater
01-20-2011, 07:03 PM
I changed it to:
Code:
iniwrite, 8_way, %emuPath%\Magstick.ini, controls, PrevState
Yeah %emupath% after the move to mame directory, cool. (sorry bout that)
I may add a few more lines of code in the mame module for resetting the controls after mame exits
(I know it was somthing but cant remember what it was atm)
I like your screens that display changing to 8-way etc, is it possible to have some graphics of like a joystick with 8 arrows coming from etc?
Hehe those screens were just for testing so you could see what was going on without the proper equipment but yes you can add pictures.
Another pill is kickin in so the command escapes me atm
(look up "splash image" in the autohotkey help file)
Progress / SplashImage
Creates or updates a window containing a progress bar or an image.
SplashImage, Off
SplashImage [, ImageFile, Options, SubText, MainText, WinTitle, FontName]
Progress, Off
Progress, ProgressParam1 [, SubText, MainText, WinTitle, FontName]
and found that works good, well done chillinwater, not bad for a one handed man.
Thats "True Grit". Oh wait thats a one-eyed fat man. 1 out of 2
By the way how did you do your tendons?
Well I just started a new electrical contracting business and on a job I was drilling a hole in a plate, the plate spun and hit/severed two tendons.
Do a thumbs up and you can see those tendons pop up just below the big thumbknuckle. (left hand thankfully)
The bad thing is they waited so long to do the surgery (7-days because of scheduling or whatever bs excuse they have) the tendens shrank and after they finally found them half way up my arm they were to short to reattach.
So they had to graft my index finger's tendon on to them to make them long enough.
But they say I should have a full recovery after 10 weeks in a cast and then some therapy.
They didnt say anything about my mental therapy :D The pills are for more than just physical pain I guess.
chillinwater
01-20-2011, 08:03 PM
@Retroborg
Do you have the complete MagStick/servo assembly built already?
-2 magsticks
-controller board
-linkage
-servos
I have the (2) sticks and would love to get my hands on the rest.
The problem is I cant build it now with one hand. (#%ck cant even play the games)
I would gladly pay you or somone to do it.
and here are some other informational MagStick Reads:
Inspiration to this thread?: Anyone made a auto 4way/8way switching joystick? (http://forum.arcadecontrols.com/index.php?topic=104762.0)
MagStick Modifcation Project: http://www.cosam.org/projects/magstik.html
Where to buy MagSticks: http://www.ultimarc.com/controls.html (http://www.ultimarc.com/controls.html)
Other Related Stuff and comments:
http://forum.arcadecontrols.com/index.php?topic=106319.0
http://www.gameex.info/forums/index.php?showtopic=8396
http://forum.arcadecontrols.com/index.php?topic=79803.0
chillinwater
01-21-2011, 05:11 AM
MagStick.exe now supports the following command lines:
magstick.exe "romName"
and the new parameter,
magstick.exe "" "reset"
Downloads:
MagStick-Test: http://www.megaupload.com/?d=8H2WCSXF
(includes all test files from previous post)
MagStick-Final: http://www.megaupload.com/?d=E6A8AC6E
The new command line param was inplemented to keep the mame module nice and tidy.
The lines to use in the Mame module are highlighted green.
magstick.exe "romName" ;to run Magstick before Mame launches
and (at the bottom of module)
magstick.exe "" "reset" ;to reset the controllers to the default "8-way" setting if needed and to prevent un-necessary movement when not needed while exiting mame.
(remove or comment out ";" the red lines after testing.)
;----------------------------------------------------------------------------
; MAME
; MAME .140
; by BBB
; 1.0
;
; Info:
; Since MAME needs to save hi scores and data on exit, then we can't force
; MAME closed with a hotkey. So make sure you have your own exit key setup
; in MAME first. We will leave the CloseProcess section below blank, but
; it is still required.
;
;----------------------------------------------------------------------------
Runwait, %emuPath%\Magstick.ahk "%romName%"
Runwait, %executable% %romName%, %emuPath%, Hide UseErrorLevel
if(ErrorLevel != 0){
if (ErrorLevel = 1){
Error = Failed Validity
}else if(ErrorLevel = 2){
Error = Missing Files
}else if(ErrorLevel = 3){
Error = Fatal Error
}else if(ErrorLevel = 4){
Error = Device Error
}else if(ErrorLevel = 5){
Error = Game Does Not Exist
}else if(ErrorLevel = 6){
Error = Invalid Config
}else if(ErrorLevel = 7 || ErrorLevel = 8 || ErrorLevel = 9){
Error = Identification Error
}else{
Error = Mame Error
}
MsgBox Mame Error - %Error%
}
;to switch back to the default "8-way" configuration on exit of mame:
process, waitclose, %executable%
Run, %emupath%\MagStick.exe, "" "reset"
ExitApp
;Required
CloseProcess:
;Doesnt have to do anything but make sure to have the line before and after this line.
return
New, this replaces the "MagStick" script in the previous posts. The "ZIP" was updated in the previous post.
(remove or comment out ";" the red lines after testing.)
[To Display SplashScreens using Images]
-Images can be either BMP, GIF, JPG, PNG, TIF or ICO.
-from the autohotkey help file:
(to display file formats such as PNG, TIF, and ICO, consider using the Gui (http://www.hyperspin-fe.com/forum/Gui.htm) command to create a window containing a picture control).
-For best results they should be sized to match you desktop resolution.
These lines in the "MagStick" script, Can replace each and all of the current ahk "Text" SplashScreens and will display "Image" SplashScreens if desired. Enable them by removing the ";" no quotes.
Edit these lines in the script (x6) for your directories, image file extensions and the time to display the images using these examples:
-SplashImage, %emupath%\YOUR_IMAGE.jpg, B ;if IMAGE is in the same folder as Mame.
-SplashImage, YOUR_DIRECTORY\YOUR_IMAGE.jpg, B ;whatever folder the IMAGE is in.
-SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B ;if IMAGE is in the same folder as the script.
-sleep, 5000 ;to adust the time to display the image. (5000=5secs, 1000=1sec)
[MagStick.exe]-test Version
;by chillinwater
#SingleInstance force
romName = %1%
reset = %2%
param := "%romName%"
param := "%reset%"
msgbox, "RomName" should be blank if resetting controllers to "8-way" on Mame exit. "Romname"=%romName%
msgbox, "Reset" should be blank if running MagStick upon launching of Mame. "Reset"=%reset%
;reads 4_way controlled roms list
IniRead, 4WayRoms, %A_ScriptDir%\Magstick.ini, controls, Set2_4_way
;msgbox, 1, , 4-way controlled Roms List= %4wayroms%,
;reads state of 4-way, 8-way joystick
iniread, state, %a_scriptdir%\Magstick.ini, Controls, PrevState
msgbox, Previous State=%state%
ifinstring, reset, reset, gosub, reset
ifnotinstring, 4WayRoms, %romname%, gosub, 8way
4way:
if ( State = "4_way")
{
run, %a_scriptdir%\NoChange4way.ahk
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "8_way")
{
run, %a_scriptdir%\4way.ahk
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;Run %comspec% /c "usccmd --sub 0`,4" ;(for 4-way mode)
iniwrite, 4_Way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
8way:
if ( State = "8_way" )
{
run, %a_scriptdir%\NoChange8way.ahk
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "4_way")
{
run, %a_scriptdir%\8way.ahk
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;Run %comspec% /c "usccmd --sub 0`,8" ;(for 8-way mode)
iniwrite, 8_way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
;to switch back to 8-way on exit of mame or other
reset:
msgbox, Exiting Mame, Verifying current State of Magstick
if ( State = "8_way" )
{
run, %a_scriptdir%\NoChange8way.ahk
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "4_way")
{
run, %a_scriptdir%\8way.ahk
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;Run %comspec% /c "usccmd --sub 0`,8" ;(for 8-way mode)
iniwrite, 8_way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
[MagStick.exe]-Final Clean Version
;by chillinwater
#SingleInstance force
romName = %1%
reset = %2%
param := "%romName%"
param := "%reset%"
;reads 4_way controlled roms list
IniRead, 4WayRoms, %A_ScriptDir%\Magstick.ini, controls, Set2_4_way
;reads state of 4-way, 8-way joystick
iniread, state, %a_scriptdir%\Magstick.ini, Controls, PrevState
ifinstring, reset, reset, gosub, reset
ifnotinstring, 4WayRoms, %romname%, gosub, 8way
4way:
if ( State = "4_way")
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "8_way")
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
Run %comspec% /c "usccmd --sub 0`,4" ;(for 4-way mode)
iniwrite, 4_Way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
8way:
if ( State = "8_way" )
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "4_way")
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
Run %comspec% /c "usccmd --sub 0`,8" ;(for 8-way mode)
iniwrite, 8_way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
;to switch back to 8-way on exit of mame or other
reset:
if ( State = "8_way" )
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "4_way")
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
Run %comspec% /c "usccmd --sub 0`,8" ;(for 8-way mode)
iniwrite, 8_way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
RetroBorg
01-22-2011, 03:34 AM
@Retroborg
Do you have the complete MagStick/servo assembly built already?
-2 magsticks
-controller board
-linkage
-servos
I have just a mock up control panel, the top is made out of 3 millimetre thick wood, it's roughly the same size as the control panel I'm eventually going to get made up. It's just for seeing if everything fits alright before I fork out the money to get it built. I don't have any carpentry skills and only have a few basic tools. Once I decide on my layout and what parts I'm going to use I will probably get Arcade Worx (http://arcadeworx.com.au/index.php?osCsid=0a07ec0d1810ab739e574eef8839232a) to CNC me the control panel. I already have an Australian style lowboy design cabinet to put it into.
http://img294.imageshack.us/img294/3633/lowboylg8.jpg
So far the control panel consists of two Magstick Plus joysticks with seven buttons each plus with the servo connected to them and a 8-way rotary control plus four player buttons. I hope to add a spinner in the centre, trackball on the right and some flipper buttons.
http://img337.imageshack.us/img337/2471/toptj.jpg
http://img819.imageshack.us/img819/3702/underneath.jpg
I have the (2) sticks and would love to get my hands on the rest.
The problem is I cant build it now with one hand. (#%ck cant even play the games)
I would gladly pay you or somone to do it.
Are you are talking about building the entire control panel of just putting together the servo part of it?
If it's the servo part you need two parts made, the rod that links the joysticks to the servo and some sort of mount for the servo.
I gave the measurement for the rod to my father inlaw and he had some scrap metal lying around and cut it out with an angle grinder, it turned out incredibly close but is still not perfect, I would like to make some adjustable system so I can fine tune it.
As far as the mount goes mine is dodgy as hell, if you look at the video you can see the servo moving around, I haven't decided on how I'm going to do it when I get my real control panel made up.
I bought my parts in Australia.
Micro Maestro 6-channel USB/Serial Servo Controller (Assembled) (http://www.robotgear.com.au/Product.aspx/Details/403) for $25.30.
http://www.robotgear.com.au/Cache/Files/ProductImages/505_Micro%20Maestro%206-Channel%20USB%20Servo%20Controller.jpg
This Power HD High-Torque Servo 1501MG (http://www.robotgear.com.au/Product.aspx/Details/421) for $25.85.
http://www.robotgear.com.au/Cache/Files/ProductImages/565_Power%20HD%20High-Torque%20Servo%201501MG.jpg
Both were purchased from Robot Gear Australia (http://www.robotgear.com.au/), their service and delivery were excellent.
I would see if you can the same parts locally that way you can use the same script for the servo as myself and terrahwk have used plus you will know the scripts you have written can command the servo controller.
RetroBorg
01-22-2011, 03:41 AM
MagStick.exe now supports the following command lines:
magstick.exe "romName"
and the new parameter,
magstick.exe "" "reset"
Downloads:
MagStick-Test: http://www.megaupload.com/?d=8H2WCSXF
(includes all test files from previous post)
MagStick-Final: http://www.megaupload.com/?d=E6A8AC6E
The new command line param was inplemented to keep the mame module nice and tidy.
Wow, it looks like you've been busy, I'll check them out, I like the idea of splash screen.
Cheers.
Phil
chillinwater
01-22-2011, 08:31 AM
Thanks for all the info Retro.
I was originally going to just modify my X-arcade Tankstick.
first with:
-2 Turbo-Twists (Spinners + wheels) (already have parts)
-colored button replacements (already have parts)
-2 mouse buttons to work with the trackball (already have parts)
then
-2 Magsticks (already have parts)
with this mod:
MagStick Modifcation Project: http://www.cosam.org/projects/magstik.html (http://www.cosam.org/projects/magstik.html)
(no parts yet)
then
-the servo/auto switching mechanism idea which is fairly new or a new find to me.
(no parts yet)
And now that there is a way to switch it all automatically and while in HyperSpin, Im salivating.
However, I can see that the real estate in the X-arcade TankStick is growing smaller and smaller and probably would look like crap, all jumbled topside.
Like this, its pretty funny what people will cobble together. What is this CRAP!: http://www.wickedretarded.com/~crapmame/
So I may have to start a new controller from scratch.
For your linkage, if you cut a section out of the middle (watch your tendons) and replaced that section with a longer aluminum bar section with multiple holes (light weight yet strong) along the length of it, it would then be adjustable.
But all in all whats wrong with the linkage you have?
It looks like its mounted solidly and lined up pretty well.
I will probably have to postpone all this goodness till later
(what with the doctor bills and all)
chillinwater
01-22-2011, 12:15 PM
ok i saw the servo posts move in the video.
I would go to the hardware store and buy a section of metal tubing to make spacers between the bottom of the (4) servo mounts (plastic)and where the screws attach to the wood.
then buy some wood screws to fit into the tubes, long enough to fit through the top of the servo mounts (4) and as deep as you can go to get a good bite into the wood.
You should be able to tighten them real tight without breaking the plastic mounts with the spacers.
RetroBorg
01-22-2011, 12:53 PM
For your linkage, if you cut a section out of the middle (watch your tendons) and replaced that section with a longer aluminum bar section with multiple holes (light weight yet strong) along the length of it, it would then be adjustable.
I think if you are trying to move two joysticks with one servo it's important to mount the centre of the servo in line with the centre of the joysticks.
That would mean the section in the middle linking the servo would need to be longer than I currently have it.
ok i saw the servo posts move in the video.
I would go to the hardware store and buy a section of metal tubing to make spacers between the bottom of the (4) servo mounts (plastic)and where the screws attach to the wood.
then buy some wood screws to fit into the tubes, long enough to fit through the top of the servo mounts (4) and as deep as you can go to get a good bite into the wood.
You should be able to tighten them real tight without breaking the plastic mounts with the spacers.
I have played around with my setup a little and have improved it a little bit, if you look at my picture of underneath the control panel you will see I have mounted the servo the other way around since the video I took. The servo is now bolted tight to the control panel and I use a longer screw linking the servo to the linkage. There is still some movement mainly because the wood is so thin it flexes and I think this is created due to to the servo not being centred with the joysticks centre.
http://img406.imageshack.us/img406/5862/servolinkage.jpg
ItDekZbw8HY
RetroBorg
01-22-2011, 02:10 PM
[MagStick.exe]-Final Clean Version
;by chillinwater
#SingleInstance force
romName = %1%
reset = %2%
param := "%romName%"
param := "%reset%"
;reads 4_way controlled roms list
IniRead, 4WayRoms, %A_ScriptDir%\Magstick.ini, controls, Set2_4_way
;reads state of 4-way, 8-way joystick (user added line in "controls.ini")
iniread, state, %a_scriptdir%\Magstick.ini, Controls, PrevState
ifinstring, reset, reset, gosub, reset
ifnotinstring, 4WayRoms, %romname%, gosub, 8way
4way:
if ( State = "4_way")
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "8_way")
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
Run %comspec% /c "usccmd --sub 0`,4" ;(for 4-way mode)
iniwrite, 4_Way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
8way:
if ( State = "8_way" )
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "4_way")
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
Run %comspec% /c "usccmd --sub 0`,8" ;(for 8-way mode)
iniwrite, 8_way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
;to switch back to 8-way on exit of mame or other
reset:
if ( State = "8_way" )
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
;sleep, 5000
;SplashImage, off
exitapp
}
else if ( State = "4_way")
{
;SplashImage, %A_ScriptDir%\YOUR_IMAGE.jpg, B
Run %comspec% /c "usccmd --sub 0`,8" ;(for 8-way mode)
iniwrite, 8_way, %a_scriptdir%\Magstick.ini, controls, PrevState
;sleep, 5000
;SplashImage, off
exitapp
}
This works well.
I've made the following splash screens for now:
http://img9.imageshack.us/img9/3645/4way.th.jpg (http://img9.imageshack.us/i/4way.jpg/)
http://img502.imageshack.us/img502/5864/8way.th.jpg (http://img502.imageshack.us/i/8way.jpg/)
chillinwater
01-22-2011, 04:20 PM
I like em! can you do some sort of 3d-ish pics also? Im no good with photoshop yet.
I cant wait till I can set this up. My girlfriend hates playing pacman and donkey kong on the 8-way, even if setup throgh mame to only detect the four ways like this:
from somwhere on byoac:
Is there a way to remove diagonals from a 8-way stick in software using MAME?
Yes.
For Q-bert you can use a sort of AND option to require both up and left for a diagonal, but can you also exclude diagonals?
So LEFT, not LEFT+UP, not LEFT+DOWN?
Actually it would be LEFT, not UP, not DOWN.
You can do this when you try to set the keys in MAME.
Press the direction you want and then immediately hit the direction(s) you don't want twice.
What do I mean?
Well once you have MAME ready to accept a new key for LEFT, you hit the following key sequence:
LEFT UP UP DOWN DOWN.
If you did it quickly enough it should now show "LEFT not UP not DOWN".
This will make MAME respond to LEFT when ONLY LEFT is pressed
(so if you hit diagonals a lot of nothing will happen).
I hope this is what you wanted.
RetroBorg
01-22-2011, 04:32 PM
I like em! can you do some sort of 3d-ish pics also? Im no good with photoshop yet.
Yeah these were made just for a quick test, 3D looking splash screen with joystick and arrows would be the end goal. I'm okay with cutting out pictures in photoshop not so good with drawing but I do have a Photoshop book that teaches this so I might give this a go.
I cant wait till I can set this up. My girlfriend hates playing pacman and donkey kong on the 8-way, even if setup through mame to only detect the four ways like this:
from somwhere on byoac:
I haven't played around with LEFT not UP stuff.