X
GO
en-USen-GBfr-FRes-ESit-ITnn-NOsv-SE
Read the Article
Apr
12
2019

Every! ... and non-standard gamepad support...

Posted 126 days ago ago by Admin     0 Comments
Admin

0 Great article! Great article! I'm neutral on this

Every! ... and non-standard gamepad support...

 

Hey all!

I finished this yesterday evening, but had not time to post it. There was one major structure command missing in AMOS 2, every. Every  XXX Gosub / Every XXX Proc.

I postponed this one as it implies interrupting the main application, executing the procedure or routine, and restoring back. So I had to do a little cleaning in the main loop of the runtime application. Done! And it prepares the way for AMAL, the next step of the project which will also be interrupting the main application and... be compiled... by a smaller compiler integrated in the runtime, that will save the generated compiled AMAL routine as a Blob and then load it as a normal js script. Javascript, the language that programs itself! So fantastic.

 

AMOS-2 applications will be compiled applications that contain a compiler! Kind of cool when you think about it! :) - who want to make a compiler in AMAL? :D

...and, thanks to Paul Kitching and Teamviewer, I have seen what was wrong with his gamepads: they do not respect the HTML5 gamepad specifications. It is a rather new specification, a couple of years will be necessary for all the manufacturers to respect it. And there will always be people in the depth of China who will not respect them... (not because they cannot, just because bad drivers artificially maintain a lower level of quality, and they can sell the same hardware at different prices and occupy more markets... clever Chinese ;) )

 

So there had to be a system to manually define how your gamepad works, and remap the buttons, axes and triggers to the standard ones so that AMOS 2 gamepad functions return the correct values.

 

If you have a gamepad that does not work, I would appreciate that your create the mapping in AMOS-2 by trial and error, and then send me back the AMOS program along with the name of the gamepad: I will integrate that in the code of the runtime, and it will support it natively later.

 

I guess you should save in a separate folder the 'debugging' application of the previous version before unzipping this one, as I think I have erased the code... It used to contain a gamepad test application.

 

Haaaa.....  aaaaaamal. Next! (Y)  (Y)  (Y)  :)  

 

## *AMOS 2 Compiler version 0.2 - 08/04/2019*

### New
- Every XXX Gosub
- Every XXX Proc
- Gamepad Map Buttons "name of gamepad", list of redirections

   Adds support for one specific gamepad by remapping the number of the buttons, and aking your specific gamepad compatible with AMOS 2... Suggestion: read the documentation about gamepad support in a browser.


- "name of gamepad" : the name of the gamepad for which this new map is used (use the Gamepad Name() function to find th ename of the device)
- list of redirections :  a list of numbers, from 0 to 15. The POSITION in the list correspond to the value ou would use in the Gamepad Buttons() function.
- 1st : Bottom button in right cluster ('A' on XBox controller, used by the Fire function)
- 2nd : Right button in right cluster ( 'B' on XBox controller)
- 3rd : Left button in right cluster ('X' on XBox controller)
- 4th : Top button in right cluster ('Y' on XBox controller)
- 5th : Top left front button
- 6th : Top right front button
- 7th : Bottom left front button
- 8th : Bottom right front button
- 9th : Left button in center cluster (gamepad left 'control' button)
- 10th : Right button in center cluster (gamepad right 'control' button)
- 11th : Left stick pressed button
- 12th : Right stick pressed button
- 13th : Top button in left cluster (JUp)
- 14th : Bottom button in left cluster (JDown)
- 15th : Left button in left cluster (JLeft)
- 16th : Right button in left cluster (JRight)


   The VALUE of each number indicates the mapping, and must be a number between 0 and 15. You can indicate that the value will be read from the Axes of the structure returned by Chrome, by setting bit $80 to 1.

```Gamepad Map Buttons "My super gamepad", 15,14,13,12,11,10,9,8,7,6,5,4,3,2,$81```

   ...will inverse all the buttons, and will read the 'right button in left trigger' from the Axes structure.
- Gamepad Map Axes "name of gamepad", list of redirections
   Adds support for one specific gamepad by remapping the number of the axes.
- "name of gamepad" : the name of the gamepad for which this new map is used (use the Gamepad Name() function to find th ename of the device)
- list of redirections :  a list of numbers, from 0 to 3 . The POSITION in the list correspond to the value you would use in the Gamepad Axes() function.
- 1st : Horizontal axis for left stick
- 2nd : Vertical axis for left stick
- 3rd : Horizontal axis for right stick
- 4th : Vertical axis for right stick
  

 The VALUE of each number indicates the mapping, and must be a number between 0 and 15. If you set bt #8 of the number, the value will be taken from the Axes of the structure returned by Chrome.


- Gamepad Map Triggers "name of gamepad", list of redirections
   Adds support for one specific gamepad by remapping the number of the triggers. Please note that the triggers are remapped to AXES, as I have noticed that badly

programmed gamepad drivers used Axes to store the result
- "name of gamepad" : the name of the gamepad for which this new map is used (use the Gamepad Name() function to find th ename of the device)
- list of redirections :  a list of numbers, from 0 to 15 . The POSITION in the list correspond to the value you would use in the Gamepad Axes() function.
- 1st : Left front trigger
- 2nd : Right front trigger
   The VALUE of each number indicates the mapping, and must be a number between 0 and 15, and set bit #8 to indicate you want to get the values from the Axes part of the structure.

Please note that I can incorporate your mappings directly in the distribution, do not hesitate to send me the file by email when you have implemented new mapping for specific hardware.

https://drive.google.com/drive/folders/189QBsS_Py9TUWE4jfacxpkuwjQ4j1TBU?usp=sharing






No Comments



You need to login to comment.