Page 1 of 1

Oricutron : Joysticks not working

Posted: Thu Jun 28, 2018 9:04 pm
by jede
Telestrat Joysticks does not work in Oricutron

Code: Select all

; How to emulate joysticks attached to the telestrat
; Options are 'none', 'kbjoy1', 'kbjoy2', 'sdljoyN', 'mouse'
telejoy_a =  kbjoy2
telejoy_b = mouse

; Keys to emulate joystick, set 1
; NOTE: "fire2" is only available on telestrat
kbjoy1_up = 'KP8'
kbjoy1_down = 'KP2'
kbjoy1_left = 'KP4'
kbjoy1_right = 'KP6'
kbjoy1_fire1 = 'KP_ENTER'
kbjoy2_fire2 = 'KP_PLUS'

; Keys to emulate joystick, set 2
kbjoy2_up = 'W'
kbjoy2_down = 'S'
kbjoy2_left = 'A'
kbjoy2_right = 'D'
kbjoy2_fire1 = 'SPACE'
kbjoy2_fire2 = 'N'
If i write kbjoy1 or kbjoy2 or mouse for telejoy_a, oricutron does not get any input. VIA 2 registers does not change. I use a code which work on real hardware.

I am running the last version of oricutron (from github).

Any idea ?

Re: Oricutron : Joysticks not working

Posted: Fri Jun 29, 2018 11:29 am
by christian
I think the issue is in joy_build_mask() function in joystick.c

If you uncomment the sprintf() call in joy_filter_event() function, you can see the joystick state changing in the title bar of the window.

In the joy_build_mask():
  • the joystick state mask is only build when joyinterface is set to 'ijk', 'pase' or 'altai' in oricutron.cfg not depending of the machine type.
  • the joysitck's state is sent to the port A of the VIA 1 which is not correct in case of Telestrat
If I change

Code: Select all

  if( gimme_port_a )
  {
    oric->via.write_port_a( &oric->via, 0xff, mkmask );
    oric->porta_is_ay = SDL_FALSE;
  } else {
    if( !oric->porta_is_ay )
    {
      oric->via.write_port_a( &oric->via, 0xff, oric->porta_ay );
      oric->porta_is_ay = SDL_TRUE;
    }
  }
by

Code: Select all

  // caution weird hack
  if( gimme_port_a )
  {
    oric->via.write_port_b( &oric->tele_via, 0xff, mkmask );
    oric->porta_is_ay = SDL_FALSE;
  } else {
    if( !oric->porta_is_ay )
    {
      oric->via.write_port_b( &oric->tele_via, 0xff, oric->porta_ay );
      oric->porta_is_ay = SDL_TRUE;
    }
  }
and set joyinterface to 'pase' or 'altai', I can get the joystick's state

I think the joy_buildmask() function should test the oric machine type and set the right port of the right VIA