Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
70 user(s) are online (52 user(s) are browsing Forums)

Members: 1
Guests: 69

samo79, more...
Support us!
Recent OS4 Files
OS4Depot.net



« 1 (2)


Re: Problems with AmigaInputAnywhere
Not too shy to talk
Joined:
2008/1/8 15:28
From Dublin/Glasgow
Posts: 277
@LiveForIt

Quote:
Looked at the code, I do not query offsets, for buttons etc.

You *must* query for offsets for every controller. The struct that contains the data from all the controller's inputs varies in size depending on the number of axes, hats and buttons it has. Without querying it, you're assuming a certain layout, which is probably why your buttons are getting swapped and why I have buttons that correspond to axes on my controller. It's additionally risky if the controller is simpler, because then you could be accessing data beyond the end of the struct.

Quote:
I was always going rewrite it from scratch if where do more on AmigaInputAnywhere.

That would be nice, but I've started work on my own fixed alternative anyway that's implemented as a commodity.

Quote:
There is no disconnected event type or device event type or anything like that in my SDK.

True, it's not an event you're looking for. But to read an event, you need a valid context, so you need to be sure your device is connected before you use GetEvent()

Quote:
I can query the device by intervals, using AIN_Query() this command takes the context, so if the context is deleted, it will crash...

True, but you don't query a device if you don't have context so that should never happen. Once you find out that the device is disconnected (while you still have context), you drop the context and don't carry out any more reading of the device. Instead, you start from scratch with a new context, repeating if necessary until a suitable device is found.

Quote:
Well i obtained the device, my program owns the device, until my program release the device.

Which is fine in theory, but in reality your program doesn't own the device, the user does. And the user can take away that device no matter what your program thinks.

Quote:
I created the context, its my job delete the context.
the context might not be valid,
but it should safe to use it.

I agree, any accesses when the context is no longer valid should return an error code to that effect so that you know it's no longer valid (and out-of-context queries should not be forwarded to the USB stack), but unfortunately this isn't the case. As with obtaining the device, the context is at the mercy of the user, not just your program. If the user changes the context, it can't be valid any longer and must be refreshed.

Quote:
I'm not checking the signal before AIN_GetEvent(...)
this might be the major mistake in the code.

I guess this is becouse its not using GetMsg( MsgPort )..

This might be a good idea, though it shouldn't be necessary. What might also be a good thing to do, is to query if the controller is connected before AIN_GetEvent().

_________________
   Report Go to top

Re: Problems with AmigaInputAnywhere
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2774
@Daedalus

Quote:
but I've started work on my own fixed alternative anyway that's implemented as a commodity.


Yes that should like the best way to do it.

Quote:
because then you could be accessing data beyond the end of the struct.


Amiga Input anywhere is reading events it does not poke the device memory, so there is no rick here.

Quote:
This might be a good idea, though it shouldn't be necessary. What might also be a good thing to do, is to query if the controller is connected before AIN_GetEvent().


But it wont be atomic, the user might unplug it between checkng if its connected and AIN_GetEvent,

player can also unplug it while program is event loop, reading the queue

while ( event AIN_GetEvent(AIO) )
{
   switch (
event -> type)
   {
     .
     .
     .
   }

   
AIN_FreeEvent(event);
}


Amiga Input is broken but I agree I can make my code safer maybe.


Edited by LiveForIt on 2020/2/15 15:38:40
Edited by LiveForIt on 2020/2/15 15:44:34
Edited by LiveForIt on 2020/2/15 15:45:11
Edited by LiveForIt on 2020/2/15 15:50:02
_________________
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
   Report Go to top

Re: Problems with AmigaInputAnywhere
Not too shy to talk
Joined:
2008/1/8 15:28
From Dublin/Glasgow
Posts: 277
@LiveForIt

Quote:
Amiga Input anywhere is reading events it does not poke the device memory, so there is no rick here.

Fair enough, in which case it would appear that AmigaInput itself is misaligning the struct contents. That would mean the risk is still there of course, just not directly from your code. In that case, perhaps polling it once per frame (the old-fashioned Amiga way of doing things) would be a better option all round? At least supported controllers would be properly recognised.

Quote:
But it wont be atomic, the user might unplug it between checkng if its connected and AIN_GetEvent,

player can also unplug it while program is event loop, reading the queue

Yes, that's true, but the time between the check and the event fetch should be very small compared to the rest of the game loop, which minimises the risk. As for the event list, you can check for connection before each read of the event, or copy the event struct contents to a dummy struct so that each check in the event loop isn't reading the event again.

Quote:
Amiga Input is broken but I agree I can make my code safer maybe.

Yep, it is broken, but a lot can be done to avoid the issues or greatly reduce the risk of them occurring, rather than just shrugging them off.

_________________
   Report Go to top

Re: Problems with AmigaInputAnywhere
Just popping in
Joined:
2007/1/10 21:56
From Stockholm Sweden
Posts: 58
@LiveForIt

AmigaInput or AmigaInputAnywhere related i dont know!

But here goes anyway!
Last week I tried my Retroflag SNES joypad with no succes at all with my X5000 until I RTFM! I press Y while connecting the USB and it works nicely.

I have an old Logitech Rumblepad2 which have worked now and then through the years with AmigaInput but always at some point crashed/destroyed EnvArc:Sys/AmigaInput..

But since I've switched to the SNES joypad no more crashes/corrupted prefs!

Which leave me to believe that USB stack is the guilty one,
what is the max ampere drain allowed by AOS4.1 USB stack and/or AmigaInput?

I know the X5000 has much weaker ampere on USB ports than my A1XE had but worth checking!

_________________
1989-> A500, A600, A3000, A4000, A1200, CD32, µA1, PegII, A1XE, CDTV, Amy/416D79, A1X5000, Vampire 500 V2+, Vampire 600 V2, Amy-ITX<-2020
   Report Go to top

Re: Problems with AmigaInputAnywhere
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2774
@khayoz

These problems are not related,

AmigaInputAnywhere is tool to fix game and programs that don’t support joypads, I was kind of making fun of AmigaAnywhere at the time, this where name comes from.

The only problem I know of in AmigaInput is that it crashes if PCI is enabled, and that no gamepads are found unless they are calibrated.

Other issues your describing can be result of updating OS, or file corruption in the OS, the filesystem your using and how careful you are when powering off, or rebooting your computer.

Don’t think you have hardware problem, but you always check in Linux if your USB devices are losing connection.

_________________
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
   Report Go to top

Re: Problems with AmigaInputAnywhere
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2774
@Daedalus

If there is any issue, its most likely when the event is pushed into input.device, this where I think Amiga Input Anywhere might fail, it use to work ok, something might have changed in the OS, that I do not control.

Not I had similar problems with vkeyboard as well, of freezes issues. way it never got released.

_________________
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
   Report Go to top

Re: Problems with AmigaInputAnywhere
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2774
AmigaInputAnywhere now open sourced.

https://github.com/khval/AmigaInputAnywhere

_________________
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
   Report Go to top

Re: Problems with AmigaInputAnywhere
Not too shy to talk
Joined:
2008/1/8 15:28
From Dublin/Glasgow
Posts: 277
@LiveForIt

Awesome, thanks very much for that! I'll check it out at some point when I have time.

_________________
   Report Go to top


« 1 (2)



[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project