Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - wrybread

Pages: 1 ... 5 6 [7]
91
Scripting / Ultimarc Servo-Stik plugin for Linux
« on: February 12, 2018, 11:43:30 PM »
EDIT: don't use this method! The author of RGBCommander just made a utility that switches the ServoStik via commandline, works great. I'll update this plugin once he posts it.

Leaving this here in case it's useful, but repeat, don't use this method, since switching your ServoStik controller board into "hardware mode" is irreversable.






I couldn't find a reliable way to control my ServoStik under Linux so I made a plugin to control it using "hardware mode" and these cheapie USB relays ($4 shipped!):

https://github.com/darrylb123/usbrelay

Works beautifully with Attract Mode and my joystick is finally always in the right mode for whatever game I'm playing. Whoohoo!

Setup notes:

- put the Servo-Stik's control board into "hardware mode" as described here:

https://www.ultimarc.com/servostik.html

Note that this makes it so you can't control the Servo-Stik via USB anymore, which is a shame. And the change is permanent! So proceed with caution, and you might want to read my "alternative methods" section below before proceeding.

Once you make this change you're essentially switching the mode of the Servo-Stik with a relay acting as a toggle switch.

- Get your relay using the instructions here https://github.com/darrylb123/usbrelay, I got the single relay for $4 shipped to California.

- Strip the wires from a USB mini cable. Connect the red and black wires to a 5v power supply (the 5v pins on the USB relay didn't seem to provide enough power for reliable operation), then connect the white wire to the NO pin of the relay, the green wire to the NC pin of the relay, and roll up the shielding and connect it to the common pin of the relay.

- When you're done it'll look something like the attached image, except that I wouldn't recommend getting power from the relay board itself as in the picture, things were really flaky for me until I connected the power to a stripped down 5v wall wort.

- You'll need to install the usbrelay program as described here (https://github.com/darrylb123/usbrelay), or in Debian variants you can just run "sudo apt-get install usbrelay". After installing run "usbrelay" to see the address of your relay and adapt this plugin if needed. You can adapt it either through Attract Mode's plugin configuration section, or directly in the code of the plugin.

On my system this command turns on the relay:

usbrelay HURTM_1=1

And this turns off the relay:

usbrelay HURTM_1=0

If you have things wired up you should see your Servo-Stik magically switching between 4 and 8 way. If not, run simply "usbrelay" to get the address of the relay ("HURTM" in the example above). I don't know if the address varies from relay to relay. If you have a different address you'll need to edit the plugin either directly or by going to it's plugin config section of Attract Mode. You should be able to switch the mode of the Servo-Stik with the above lines of code at this point. If not, go over the steps above carefully.

- With the configuration here, I'm turning on the relay for 2 and 4 way games, and turning it off for 8 way games. Works great.

- And note that this plugin was adapted from http://forum.attractmode.org/index.php?action=post;msg=14283;topic=1898.0

Feel free to email directly with any questions, since I don't think the post notification feature is working on this board. My email is wrybread at gmail dot you know what.


Alternate methods:

- I'm really impressed with the Servo-Stik, but it would be nice if we didn't have to put the control board into "hardware board" to control it in from a relay or switch, since doing so is a permanent change, meaning we can't control it via USB ever again. Andy, if you're listening, how about adding a couple of pins to the board so this is always possible, even in regular USB mode? Or a jumper to return the board to regular USB mode?

- I tried RGBCommander, which was able to control the ServoStik, but not in conjunction with Attract Mode since my version of MAME (.175) isn't supported. Most of my ROMs didn't work with later versions of MAME so I abandoned that route, but more notes on the issue are in this thread http://forum.arcadecontrols.com/index.php?topic=156479.0.

- the author of RGBCommander said he has a commandline utility to switch the Servo-Stik, which would solve the issue completely, but as of now he hasn't released it yet. Please do?

- I'd love to make a Python script to control the Servo-Stik directly using pyusb, but couldn't find very many details on the protocol. Andy sent this over, maybe someone can make sense of it?

Code: [Select]
Private Sub button4_Click()
    OutputReportData(3) = 0
    OutputReportData(2) = 0
    OutputReportData(1) = 0
    OutputReportData(0) = 0
    Call ReadAndWriteToDevice
 
End Sub
 
Private Sub button8_Click()
    OutputReportData(3) = 1
    OutputReportData(2) = 0
    OutputReportData(1) = 0
    OutputReportData(0) = 0
    Call ReadAndWriteToDevice
End Sub

Anyway, plugin attached and pasted below, hopefully it's useful to someone.

Code: [Select]
/*

This is an Attract-Mode plugin to use a ServoStik under Linux (or other OS's)
with a USB relay. These USB relays are dirt cheap, under $5 shipped to the U.S.,
and work beautifully with a ServoStik in hardware mode.

More notes on the relays here:

https://github.com/darrylb123/usbrelay

More setup notes for this plugin here:

http://forum.attractmode.org/index.php?topic=2123.0

wrybread at gmail dot you know what
February 12, 2018

*/



// user config
class UserConfig </ help="Plugin to use a ServoStik joystick in hardware mode under Linux. See the header of the ServoStikUSBRelay plugin for more information." /> {

// path to usbrelay if necessary
</ label="Executable name", help="Full path to the usbrelay utility if necessary", order=1 />
command = "usbrelay";

// command to turn on the relay
</ label="Command relay on", help="Command to turn on the relay for 2 and 4 way games", order=2 />
command_relay_on = "HURTM_1=1";

// command to turn off the relay
</ label="Command relay off", help="Command to turn off the relay for 8 way games", order=3 />
command_relay_off = "HURTM_1=0";

}

// process the local config
local config=fe.get_config();

// register the callback for when games are launched
fe.add_transition_callback( "joytray_plugin_transition" );

// function to  process each game's launch
function joytray_plugin_transition( ttype, var, ttime ) {

if ( ScreenSaverActive ) return false;

switch ( ttype )  {

case Transition.ToGame:

// turn relay on for 4 way games
if (fe.game_info( Info.Control ) == "joystick (4-way),joystick (4-way)") fe.plugin_command_bg(config["command"], config["command_relay_on"] );

// turn relay on for 2 way games
else if (fe.game_info( Info.Control ) == "joystick (2-way),joystick (2-way)") fe.plugin_command_bg(config["command"], config["command_relay_on"] );

// turn relay off for 8 way games
else fe.plugin_command_bg( config["command"], config["command_relay_off"]);

break;

}

return false; // must return false
}



92
Scripting / How to put cabinet artwork in layouts?
« on: February 12, 2018, 11:01:35 PM »
I'm trying to put pictures of the arcade cabinets behind the list of games during scrolling. I can show the marquee with:

   local snap = fe.add_artwork( "marquee", 0, 0,  fe.layout.width,  fe.layout.height );

And snapshots with:

   local snap = fe.add_artwork( "snap", 0, 0,  fe.layout.width,  fe.layout.height );

But I can't figure out how to show the cabinets. I have a folder called "cabinets", but changing that keyword to cabinet doesn't work.

Any ideas?




93
Scripting / Re: Styling the filters menu and exit window , how?
« on: January 28, 2018, 12:34:29 AM »
That already looks styled. If I remember correctly, it's styled according to the Display you're using.

To change the wording of the exit window, you can modify the language files (or create a new language).


94
Scripting / Re: Ultimarc ServoStik Plugin
« on: January 26, 2018, 06:39:57 PM »
Thanks for the above code, I was able to adapt it to make a plugin to control the Servo-Stik from Linux, notes here in case it's useful to anyone:

http://forum.attractmode.org/index.php?topic=2123.msg14494#msg14494

95
Themes / Re: WryCade theme - simple theme for classic games
« on: November 17, 2017, 02:38:40 PM »
Awesome on the scrolling module!

As far as the sound, here's my code. It doesn't play the sound for ToGame though. Any idea what I'm doing wrong?

Code: [Select]
function fade_transitions( ttype, var, ttime ) {

switch ( ttype ) {

// sound when starting game. Not working.
  case Transition.ToGame:
local sound = fe.add_sound("sounds/SpaceInvaders_Bass02.wav");
sound.playing=true;
break;

// sound when switching to new list
  case Transition.ToNewList:
local Wheelclick = fe.add_sound("sounds/nintendo_04.wav");
Wheelclick.playing=true;
break;

// sound when scrolling through roms
  case Transition.ToNewSelection:
local Wheelclick = fe.add_sound("sounds/clicked.wav");
Wheelclick.playing=true;
break;
  }


return false;
}


fe.add_transition_callback( "fade_transitions" );


96
Themes / WryCade theme - simple theme for classic arcade cabinets
« on: November 17, 2017, 01:28:31 PM »
I'm new to Attract Mode and absolutely love it! Running beautifully on my Lubuntu Linux box. But I couldn't find a theme that looked right on my cabinet, which gets used mostly to play old 80s games. I like the front-end to look like the games it plays, and all the themes I found looked a bit too modern or busy.  And I'm a big fan of the old front end Game Launcher, which sadly only runs on Windows, so this is my approximation of the look and feel of that.

Here's a video of my theme running on a vertical monitor:

https://www.youtube.com/watch?v=PJnCFQpRiBM

It works well with horizontal monitors too. All the layout options can be adjusted in the layout configuration, shown in the video.

Feedback invited!

And thanks again to all who worked on this awesome program!

And for what it's worth here's a few things I'd love to add from Game Launcher to my theme:

- I like the scrolling behavior better in Game Launcher, which puts a new list of ROMs onto the screen and then scrolls through them, which I find much easier to follow than the way Attract Mode moves the whole list. See this video of someone else's cabinet for a view of Game Launcher:

https://www.youtube.com/watch?v=6mU3MmS0IAc

- And I like the transition when a game is chosen. I couldn't get a sound for that to work in my Theme, and have no idea how I'd make that animation happen.

- I also like the selection style in Game Launcher, where it puts a stroke around the selected ROM. No biggie on that one though.


97
Scripting / Re: Play sound when starting game?
« on: November 17, 2017, 12:52:13 AM »
It works if I change the transition to FromGame (it then plays the sound when I return from the game), so I'm wondering if it's just not giving the sound enough time to play?

Can someone confirm that playing sounds with ToGame works?


98
Scripting / Re: Play sound when starting game?
« on: November 16, 2017, 11:26:31 PM »
Thanks for the tip on cleaning up the switch statement. I think this is a better way to write it, but I'm still not sure I understand the "break" statements, and whether I need one in each case:

Code: [Select]
function fade_transitions( ttype, var, ttime ) {

switch ( ttype ) {

  case Transition.ToGame:
  local sound = fe.add_sound("sounds/Burgertime_Dies.wav");
sound.playing=true;
break;

  case Transition.ToNewList:
local Wheelclick = fe.add_sound("sounds/Asteroids_Tone02.wav");
Wheelclick.playing=true;
break;

  case Transition.ToNewSelection:
local Wheelclick = fe.add_sound("sounds/clicked.wav");
Wheelclick.playing=true;
break;
  }


return false;
}


fe.add_transition_callback( "fade_transitions" );

But still no joy.

And substituting the whole block for the code that @jedione posted also doesn't work for me.

Any idea why?

99
Scripting / Play sound when starting game?
« on: November 16, 2017, 05:29:31 PM »
I'm trying to play a different sound when I switch selected ROM, switch display and start a ROM. All works well with the below code except starting a ROM. Is the transition not "ToGame"?

Code: [Select]
function fade_transitions( ttype, var, ttime ) {


switch ( ttype ) {
  case Transition.ToNewList:
local Wheelclick = fe.add_sound("sounds/teleport.wav")
Wheelclick.playing=true
return false;
break;
  }

switch ( ttype ) {
  case Transition.ToGame:
  local Wheelclick = fe.add_sound("sounds/boom.wav")
Wheelclick.playing=true
break;
  }

switch ( ttype ) {
  case Transition.ToNewSelection:
  ;case Transition.ToNewList:
local Wheelclick = fe.add_sound("sounds/clicked.wav")
Wheelclick.playing=true
break;
  }


return false;
}

fe.add_transition_callback( "fade_transitions" );




100
General / Possible to choose random game, and then run it?
« on: November 16, 2017, 11:44:34 AM »
I have a button set to choose a random game, which is great. But it just highlights the game. Is there some way to choose the random game and have it run automatically?

Thanks for the help. Finally got attract mode running on my Lubuntu Linux machine, working beautifully! What an amazing program this is.

Pages: 1 ... 5 6 [7]