Dinomight Posted March 13, 2022 Author Share Posted March 13, 2022 2 hours ago, rmetzger said: I have a question on this. I downloaded and it works great as long as the 4 way is the primary controller. I had atari 5200 which had "atari joystick" as the primary controller and I added 4 way under it so that it would switch automatically to 4 way and it didn't. I then got rid of "atari joystick" and it worked fine. If I put atari joystick after the 4 way it still worked. I'm guessing it has to be the primary controller for this to work. Correct on this thought? After a change to the last release there is an easy fix for this without having to make a bunch of changes in launchbox. The plugin config file now has a field with a list of 4-way and 8-way controllers. all we have to do is add atari jokstick to the list and blam it will work for all atari joysticks. I'll update the plugin but if you don't want to wait you can make the fix yourself following these steps. 1. open the servosticker config file. This is located in the launchbox plugin folder. the file is called ServoStiker.conf. in this file find the line like this: "4-way-names": "4-Way Joystick,Double 4-Way Joysticks,Half 4-Way Joystick,Double Horizontal Joysticks,Double Vertical JoysticksHorizontal Joystick,Vertical Joystick", Add ",atari joystick" to the list in the quotes the line should read something like this: "4-way-names": "4-Way Joystick,Double 4-Way Joysticks,Half 4-Way Joystick,Double Horizontal Joysticks,Double Vertical JoysticksHorizontal Joystick,Vertical Joystick,Atari Joystick", Save the file and restart launchbox If you have any others controller types you can add them just like that. Out of curiosity, Are there other controller types that i should add by default to the list? I wasn't aware of atari joysticks so i didn't know i should include it. Quote Link to comment Share on other sites More sharing options...
Dinomight Posted March 13, 2022 Author Share Posted March 13, 2022 new version: let me know if it works for you ServoStiker.1.03.zip Quote Link to comment Share on other sites More sharing options...
rmetzger Posted March 13, 2022 Share Posted March 13, 2022 well, Atari games can be 4 or 8 way. I was referring to a game like Pac Man where you want it to be a 4 way joystick. Atari joystick was 1st and then 4 way was 2nd, it didn't work. I put 4 way first and atari 2nd and it worked. There are atari games that are 8 way so I wouldn't want them to be all 4 way.. I was just asking if I need to make sure that the 4 way is 1st and then atari is 2nd so that it will change automatically. The atari joystick is more for playlists than anything I believe. Quote Link to comment Share on other sites More sharing options...
Dinomight Posted March 13, 2022 Author Share Posted March 13, 2022 Ok i will make a change again to the plugin to check to see if any controller is 4-way it will set it to 4 way. the latest update is going to turn all atari to 4 way (I miss understood) I'll get an update posted soon (Might not be today) Quote Link to comment Share on other sites More sharing options...
Dinomight Posted March 13, 2022 Author Share Posted March 13, 2022 Ok i had a few free minutes so i got another build up try it out and let me know if it is good now. ServoStiker.1.0.4.zip Quote Link to comment Share on other sites More sharing options...
rmetzger Posted March 14, 2022 Share Posted March 14, 2022 Just got to try this and it works great. If Atari joystick is 1st and I add the 4 way joystick, it moves the sticks to 4 way position. Thank you for all your hard work! Quote Link to comment Share on other sites More sharing options...
Dinomight Posted March 15, 2022 Author Share Posted March 15, 2022 I'm glad it is working thanks for reporting back Quote Link to comment Share on other sites More sharing options...
96P993 Posted April 6, 2022 Share Posted April 6, 2022 Hey all, just wanted to make sure 1.0.4 is still the latest version...Thanks for all the work on this!!! Quote Link to comment Share on other sites More sharing options...
Dinomight Posted April 6, 2022 Author Share Posted April 6, 2022 58 minutes ago, 96P993 said: Hey all, just wanted to make sure 1.0.4 is still the latest version...Thanks for all the work on this!!! Yes it should be. (are you having trouble with it?) Quote Link to comment Share on other sites More sharing options...
96P993 Posted April 6, 2022 Share Posted April 6, 2022 34 minutes ago, Dinomight said: Yes it should be. (are you having trouble with it?) Not at all, I just wanted to know before I start down that path...Thanks again for doing this!!!! Quote Link to comment Share on other sites More sharing options...
1015eclipse Posted June 12, 2022 Share Posted June 12, 2022 Nice job works great! Had to reinstall joytray. Love the default 8 way mode. Quote Link to comment Share on other sites More sharing options...
cybermat Posted January 27, 2023 Share Posted January 27, 2023 Thanks for this plugin that i will try on my Bartop. I'm not a coder but i modified the coding for another frontend, in order to avoid to stress servostik if not necessary. Example : I start from 8 ways (default) and i play a 4 ways : a command is sent to rotate. In this case a variable X should take 4. I exit from that game and I play another 2/4 ways. If x=4 there's no need to send any command. I exit and i play a 8 (or more) ways. Since X != 8 then rotate and X=8 and so on... Do you think that it's feasible ? Quote Link to comment Share on other sites More sharing options...
cybermat Posted February 1, 2023 Share Posted February 1, 2023 (edited) On 9/30/2021 at 6:57 AM, Dinomight said: In case you want to contribute here is the github link : https://github.com/Darkmadda/ServoStiker I checked the source code of the DLL and is different. Could you please post the source code of the latest DLL ? (1.0.4) ? Anyway, i decompiled the DLL in order to get the code and changed the behaviour when the stick is already in 4 or 8 ways, in order to no stress the motor. It seems working but i need to reproduce different user cases. In the conf file there is a typo "4-way-names": "4-Way Joystick,Double 4-Way Joysticks,Half 4-Way Joystick,Double Horizontal Joysticks,Double Vertical JoysticksHorizontal Joystick,Vertical Joystick", Edited February 1, 2023 by cybermat Quote Link to comment Share on other sites More sharing options...
Dinomight Posted February 1, 2023 Author Share Posted February 1, 2023 6 hours ago, cybermat said: I checked the source code of the DLL and is different. Could you please post the source code of the latest DLL ? (1.0.4) ? Anyway, i decompiled the DLL in order to get the code and changed the behaviour when the stick is already in 4 or 8 ways, in order to no stress the motor. It seems working but i need to reproduce different user cases. In the conf file there is a typo "4-way-names": "4-Way Joystick,Double 4-Way Joysticks,Half 4-Way Joystick,Double Horizontal Joysticks,Double Vertical JoysticksHorizontal Joystick,Vertical Joystick", Thanks for checking that. I will fix the typo and do state management (My only concern was if the joystick was changed and the plugin being unaware of this change which would mean it wouldn't switch properly. I think know how i want to do it.) I probably won't be able to work on it until this weekend but once i do it should only take a few minutes. I will message you with the latest version once it's done and have you test it before i upload the version to the launchbox download system. Thank you again. Quote Link to comment Share on other sites More sharing options...
cybermat Posted February 1, 2023 Share Posted February 1, 2023 First of all thanks for your plugin. I'm a total noob regarding coding, but analyzing your code i did same changes i applied for another front end. So according with my test cases, now i send rotate command only when needed. I tried to load a lot of 4 ways games, then a lot of 8 ways games with just one rotation. Furthermore, in order to cover all the cases (i hope), i also tested with games "out" from the config file and i get properly the default value only if i've servo rotated to 4 ways. (i put 8 ways as default, but turned off RESET on exit). The only case where i could "force" is when i boot the first time. using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using TinyJson; using Unbroken.LaunchBox.Plugins; using Unbroken.LaunchBox.Plugins.Data; namespace ServoStiker { public class ServoStiker : IGameLaunchingPlugin { private string pathToJoyToTray; private string pathToConfig; private string defaultMode; private string[] eightNames; private string[] fourNames; private string resetOnExit; string arguments = ""; int x = 0; public ServoStiker() { this.pathToConfig = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\ServoStiker.conf"; Dictionary<string, object> dictionary = (Dictionary<string, object>)File.ReadAllText(this.pathToConfig).FromJson<object>(); this.pathToJoyToTray = dictionary["joytrayPath"].ToString(); this.defaultMode = dictionary["default"].ToString(); char[] chArray = new char[2] { ',', ';' }; this.eightNames = dictionary["8-way-names"].ToString().Split(chArray); this.fourNames = dictionary["4-way-names"].ToString().Split(chArray); this.resetOnExit = dictionary["reset-on-exit"].ToString(); } public void OnAfterGameLaunched(IGame game, IAdditionalApplication app, IEmulator emulator) { } public void OnBeforeGameLaunching(IGame game, IAdditionalApplication app, IEmulator emulator) { KeyValuePair<IGameController, int?>[] controllerSupport = game.GetControllerSupport(); for (int index = 0; index < controllerSupport.Length; ++index) { KeyValuePair<IGameController, int?> keyValuePair = controllerSupport[index]; int num1 = Array.IndexOf<string>(this.fourNames, keyValuePair.Key.Name); int num2 = Array.IndexOf<string>(this.eightNames, keyValuePair.Key.Name); if ((num1 > -1) && (x != 4)) { arguments = "-servo joy4way"; x = 4; Process.Start(this.pathToJoyToTray, arguments); } else if ((num2 > -1) && (x != 8)) { arguments = "-servo joy8way"; x = 8; Process.Start(this.pathToJoyToTray, arguments); } else if ((this.defaultMode == "4-way") && (num1 <= -1) && (num2 <= -1) && (x != 4)) { arguments = "-servo joy4way"; x = 4; Process.Start(this.pathToJoyToTray, arguments); } else if ((this.defaultMode == "8-way") && (num1 <= -1) && (num2 <= -1) && (x != 8)) { arguments = "-servo joy8way"; x = 8; Process.Start(this.pathToJoyToTray, arguments); } } } public void OnGameExited() { if (!(this.resetOnExit == "True")) return; string arguments = ""; if (this.defaultMode == "8-way") arguments = "-servo joy8way"; else if (this.defaultMode == "4-way") arguments = "-servo joy4way"; Process.Start(this.pathToJoyToTray, arguments); } } } Quote Link to comment Share on other sites More sharing options...
Drybonz Posted February 27, 2023 Share Posted February 27, 2023 Does this work for the U360's as well? I have been looking for a simple solution for the auto-mapping. Thanks. Quote Link to comment Share on other sites More sharing options...
Jakobud Posted April 20 Share Posted April 20 This works perfectly thank you. Quote Link to comment Share on other sites More sharing options...
ajt12 Posted September 7 Share Posted September 7 Hey mate, great plugin! The first version works great but it does have the issues that you fixed in that other versions. Problem is, the links you've provided aren't working anymore. Can you please link that most updated version (1.0.4 I think). Thanks mate!!! (Or anyone who has it) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.