VOGONS

Common searches


First post, by bOingball

User metadata
Rank Newbie
Rank
Newbie

Hi All,

I'm porting the current version of Dosbox over to the gp2x linux handheld (version 0.70)

I'm just wanting some info to get a Joystick mapped to keyboard keys in the mapper.txt

The joystick in Dosbox is detected as "Using joystick PEP Joy with 0 axes and 19 buttons"

Don't worry thats the correct number of buttons it has as it's on a handheld device.

I started putting entrys into the mapper.txt file as below.

jbutton_0_0 "key 112"
jbutton_0_1 "key 109"
jbutton_0_2 "key 107"
jbutton_0_3 "key 306"
jbutton_0_4 "key 116"
jbutton_0_5 "key 121"
jbutton_0_6 "key 117"

But pressing the buttons on the handheld causes nothing to be typed at the dosprompt.

I do get an error in the output saying "Can't find matching event for jbutton_0_6" (or any button higher to be honest) (so I need to know how to get all 19 buttons detected as well)

Is the correct way to map buttons

We have a 0.65 port which runs fine (we use a keyboard hack to make this version worked)

It would be nice if we can get the joystick mapping to work though.

Anyone with any insight would be helpful.

Regards
bOing

Reply 1 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Maybe start off with the mapper, and remap a few keys to the joystick
device, that is klick on one of the keys, then that ADD button, then push
the respective button you want to be the trigger for the selected key.

Then save the mapper.txt, close dosbox and re-open it to see if the
buttons produce key presses now. If so have a look at the generated
mapper.txt

Also be sure to disable the buttonwrap ([joystick] section of dosbox.conf),
this should allow up to 16 different buttons to be remapped. Changing the
sdl_mapper.cpp a bit should give you the 19 or more.

Reply 2 of 19, by bOingball

User metadata
Rank Newbie
Rank
Newbie

Starting the mapper is a little bit of a problem on the handheld, as the handheld has no mouse / keyboard 🙁

and it crashed when trying to start, I'll work on getting the mapper program recompiled to work on the gp2x though.

But anyone who has a joystick working with keys that would post a working example mapper would be appreacated to start me off on a guessing game 😀

Regards
bOing

Reply 3 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

as the handheld has no mouse / keyboard

Erm right 😀

But anyone who has a joystick working with keys that would post a working
example mapper would be appreacated to start me off on a guessing game

Think the mapper entries you posted are fine, do buttons 0-3 produce
anything with this?

The joystick data is read in CStickBindGroup::ActivateJoystickBoundEvents
(SDL_JoystickGetButton()) so maybe place some LOG_MSG()s there to
see if this is at least working.

What videodriver does SDL use for gp2x? Could be that keys aren't defined there...

Reply 4 of 19, by bOingball

User metadata
Rank Newbie
Rank
Newbie

Nothing gets produced when hitting any of the buttons on the joystick.

I'll put that log message in, which file is it in? (I'm looking now though)

Also I'm not too sure of the SDL used with I've used SDL joystick in previous projects before and thats always worked (as it's the gp2x's default input)

It's great having DOSBox on the GP2x 😀 hence I'm hoping the latest version improves it even more (I can see it's more crash resistant now even though I can't input stuff to it 😉 )

bOing

Reply 6 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I can see it's more crash resistant now even though I can't input stuff to it

Hehe that should be put in the readme, game crashes: try without using
any input device 😉

That ActivateJoystickBoundEvents() triggers the ActivateBindList() if some
buttonstate has changed. This should arrive at CBind::Activate(), which
calls CTriggeredEvent::Activate() and then at CKeyEvent::Active(true)
to simulate a key press.
So you have a few places for logging.....
Another thing would be the CKeyBindGroup::CreateConfigBind and
CKeyBindGroup::CreateKeyBind to see if the binding is lost already when
it should be created.

Reply 7 of 19, by bOingball

User metadata
Rank Newbie
Rank
Newbie

🤣 yeah 100% way to stop crashing 😉

Thank you for the list of the functions, it will come in handy later tonight when i recompile it again

My initial tests nothing is coming back to console. when hitting buttons
(I'm just firing off a MSG_LOG("something was pressed"))
right after the case for SDL_JOYBUTTONDOWN

LOG_MSG should output to my telnet console right?

(telnet shows the console init data etc, the gp2x displays the dosbox main screen)

bOing

Reply 8 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

It has a dirty hack to translate the joystick calls from the gp2x to keyboard calls.

Don't think that much has changed that this translation would be impossible.
Be sure to have joysticktype=none so the joystick isn't queried (though you
need to open/care about the SDL joystick thingie then elsewhere).
Another thing to try: have a look at REDUCE_JOYSTICK_POLLING
(ie. disable that) as this disables the SDL polling and queries the joystick
inside dosbox code (joysticktype must not be none then!).

Reply 9 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

right after the case for SDL_JOYBUTTONDOWN

Those in CheckEvent? This function isn't used any more. Disabling the
REDUCE_JOYSTICK_POLLING should make that work again, though i
don't know if it is still functional.

Reply 10 of 19, by bOingball

User metadata
Rank Newbie
Rank
Newbie

Cheers,

If I comment that joystick polling out. and put the hack back in and tell the config file to have joystick = none it should skip the joystick detection all together? as i could see that working.

the hack sits in the sdl_main file and basically monitors the JOYBUTTONS

and then converts them (in an ugly way) to keyevents.

bOing

Reply 11 of 19, by bOingball

User metadata
Rank Newbie
Rank
Newbie

(I'm getting closer 😀 )

Ok I commented out the POLLING options and re-added the hack.

My telnet log is showing this...

SDL_GP2X: CreateDevice
SDL_GP2X: VideoInit
SDL_GP2X: Physical screen = 320x240 (ilace = 0)
SDL_GP2X: Looking for a mouse
SDL_GP2X: No mice found
SDL_GP2X: Creating cursor 16x16
SDL_GP2X: Allocated WMcursor @ 0x1c81b38 (32)
SDL_GP2X: SurfaceManager allocating 256 bytes
SDL_SYS_JoystickInit

...
so all my parts taking care off, but I still notice that the internal dosbox joystick prog is taking over as this still comes up : Using joystick PEP Joy with 0 axes and 19 buttons

Whats the easiest way to disable all joystick functions so my mapper hack can take over these functions.

Regards
bOing

Reply 12 of 19, by bOingball

User metadata
Rank Newbie
Rank
Newbie

You are a hero,

I've fixed it with your help.

Sorry since you where not here to reply I kept working on it and I can tell you now, the keyboard hack is back working as long as we don't enable joystick 🤣

enable joystick and dosbox seems to like it but has no mapper to work with so I'll stick with keyboard hack.

Thank you.

All the best and long live DOSBOX 0.70 (and now the gp2x port)

now to get some games packed with it and online for the masses,

Interesting note. DOSBOX 0.65 ported by me was downloaded 2590 times. nice to know DOSBOX is good to use for a lot of people 😀

bOing

Reply 13 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Nice you got it working 😀 Maybe somewhen zodttd finnishes the
dynrec arm backend to see if that's faster or slower than the
simple core. If you see him around leave him a note 😉

Reply 15 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Would still be interesting to know if it'd work with the mapper alone.
But that's not really important, and i can't guarantee that it's worth
delving deeper into this, but who knows...

Reply 16 of 19, by bOingball

User metadata
Rank Newbie
Rank
Newbie

Yeah my dev time on that would be a lot of time I guess,

Getting this working with a hacked version ain't bad though.

Just been playing tyrian, it's working really nice and I can see a few speedups as well when theres a lot on the screen it does not slow down as much as 0.65

I did notice 0.65 with tyrian comes up with joystick detected

and in 0.70 joystick not detected (as I disabled the joystick routines)

so I'm guessing 0.65 joystick function works ok on the gp2x but I'm not trying it just yet.

Next up is getting some games patched up in a rar file with working configs and then maybe speedups if possible.

bOing

Reply 18 of 19, by bOingball

User metadata
Rank Newbie
Rank
Newbie

Sorry, I just think it's the slow downs in the ARM emulation on the gp2x I think I looked at the completed code of the sb16 and noticed it was not fully done according to the status page.

I was a bit tipsy when I posted as well so my code debuggin skills was not the best at the time.

and when I looked at this forum I didn't know what u where posting too ha! - my bad - sorry 😀

bOing

Reply 19 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Well sb digital output shouldn't be really demanding, but fm synthesis/opl.
But don't know why that should be a bug or slowdown, it's simply a
cpu intensive processing.
You might want to have a look at Moe's patch on sourceforge about the
cleaned/optimized ymf262.c