mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-14 07:35:12 +01:00
Joystick fixes
This commit is contained in:
parent
9fc781c55e
commit
fa3e08bee8
@ -100,7 +100,8 @@ C64::C64()
|
|||||||
memset(RAM1541, 0, DRIVE_RAM_SIZE);
|
memset(RAM1541, 0, DRIVE_RAM_SIZE);
|
||||||
|
|
||||||
// Open joystick drivers if required
|
// Open joystick drivers if required
|
||||||
open_close_joysticks(0, 0, ThePrefs.Joystick1Port, ThePrefs.Joystick2Port);
|
open_joystick(0);
|
||||||
|
open_joystick(1);
|
||||||
joykey = 0xff;
|
joykey = 0xff;
|
||||||
|
|
||||||
#ifdef FRODO_SC
|
#ifdef FRODO_SC
|
||||||
@ -118,7 +119,8 @@ C64::C64()
|
|||||||
|
|
||||||
C64::~C64()
|
C64::~C64()
|
||||||
{
|
{
|
||||||
open_close_joysticks(ThePrefs.Joystick1Port, ThePrefs.Joystick2Port, 0, 0);
|
close_joystick(0);
|
||||||
|
close_joystick(1);
|
||||||
|
|
||||||
delete TheJob1541;
|
delete TheJob1541;
|
||||||
delete TheREU;
|
delete TheREU;
|
||||||
@ -130,8 +132,6 @@ C64::~C64()
|
|||||||
delete TheCPU1541;
|
delete TheCPU1541;
|
||||||
delete TheCPU;
|
delete TheCPU;
|
||||||
delete TheDisplay;
|
delete TheDisplay;
|
||||||
if (this->network)
|
|
||||||
delete this->network;
|
|
||||||
|
|
||||||
delete[] RAM;
|
delete[] RAM;
|
||||||
delete[] Basic;
|
delete[] Basic;
|
||||||
@ -178,7 +178,6 @@ void C64::NMI(void)
|
|||||||
|
|
||||||
void C64::NewPrefs(Prefs *prefs)
|
void C64::NewPrefs(Prefs *prefs)
|
||||||
{
|
{
|
||||||
open_close_joysticks(ThePrefs.Joystick1Port, ThePrefs.Joystick2Port, prefs->Joystick1Port, prefs->Joystick2Port);
|
|
||||||
PatchKernal(prefs->FastReset, prefs->Emul1541Proc);
|
PatchKernal(prefs->FastReset, prefs->Emul1541Proc);
|
||||||
|
|
||||||
TheDisplay->NewPrefs(prefs);
|
TheDisplay->NewPrefs(prefs);
|
||||||
|
@ -159,7 +159,8 @@ private:
|
|||||||
void c64_ctor1(void);
|
void c64_ctor1(void);
|
||||||
void c64_ctor2(void);
|
void c64_ctor2(void);
|
||||||
void c64_dtor(void);
|
void c64_dtor(void);
|
||||||
void open_close_joysticks(int oldjoy1, int oldjoy2, int newjoy1, int newjoy2);
|
void open_joystick(int port);
|
||||||
|
void close_joystick(int port);
|
||||||
uint8 poll_joystick(int port);
|
uint8 poll_joystick(int port);
|
||||||
uint8 poll_joystick_axes(int port, bool *has_event);
|
uint8 poll_joystick_axes(int port, bool *has_event);
|
||||||
uint8 poll_joystick_hats(int port, bool *has_event);
|
uint8 poll_joystick_hats(int port, bool *has_event);
|
||||||
@ -206,13 +207,11 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __unix
|
#ifdef __unix
|
||||||
void open_close_joystick(int port, int oldjoy, int newjoy);
|
|
||||||
double speed_index;
|
double speed_index;
|
||||||
public:
|
public:
|
||||||
CmdPipe *gui;
|
CmdPipe *gui;
|
||||||
#elif defined(GEKKO)
|
#elif defined(GEKKO)
|
||||||
public:
|
public:
|
||||||
void open_close_joystick(int port, int oldjoy, int newjoy);
|
|
||||||
double speed_index;
|
double speed_index;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SDL
|
#ifdef HAVE_SDL
|
||||||
|
@ -752,29 +752,21 @@ bool C64Display::NumLock(void)
|
|||||||
* Open/close joystick drivers given old and new state of
|
* Open/close joystick drivers given old and new state of
|
||||||
* joystick preferences
|
* joystick preferences
|
||||||
*/
|
*/
|
||||||
void C64::open_close_joystick(int port, int oldjoy, int newjoy)
|
void C64::open_joystick(int port)
|
||||||
{
|
{
|
||||||
if (oldjoy != newjoy) {
|
joy_minx[port] = joy_miny[port] = -32767; // Reset calibration
|
||||||
joy_minx[port] = joy_miny[port] = -32767; // Reset calibration
|
joy_maxx[port] = joy_maxy[port] = 32768;
|
||||||
joy_maxx[port] = joy_maxy[port] = 32768;
|
joy[port] = SDL_JoystickOpen(port);
|
||||||
if (newjoy) {
|
if (joy[port] == NULL)
|
||||||
joy[port] = SDL_JoystickOpen(newjoy - 1);
|
fprintf(stderr, "Couldn't open joystick %d\n", port + 1);
|
||||||
if (joy[port] == NULL)
|
|
||||||
fprintf(stderr, "Couldn't open joystick %d\n", port + 1);
|
|
||||||
} else {
|
|
||||||
if (joy[port]) {
|
|
||||||
SDL_JoystickClose(joy[port]);
|
|
||||||
joy[port] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void C64::open_close_joysticks(int oldjoy1, int oldjoy2, int newjoy1, int newjoy2)
|
void C64::close_joystick(int port)
|
||||||
{
|
{
|
||||||
open_close_joystick(0, oldjoy1, newjoy1);
|
if (joy[port]) {
|
||||||
if (SDL_NumJoysticks() > 1)
|
SDL_JoystickClose(joy[port]);
|
||||||
open_close_joystick(1, oldjoy2, newjoy2);
|
joy[port] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The implementation principles are borrowed from UAE */
|
/* The implementation principles are borrowed from UAE */
|
||||||
|
@ -86,7 +86,7 @@ Prefs::Prefs()
|
|||||||
SIDType = SIDTYPE_DIGITAL;
|
SIDType = SIDTYPE_DIGITAL;
|
||||||
REUSize = REU_NONE;
|
REUSize = REU_NONE;
|
||||||
DisplayType = DISPTYPE_WINDOW;
|
DisplayType = DISPTYPE_WINDOW;
|
||||||
Joystick1Port = 1; /* Default to on */
|
Joystick1Port = 0; /* Default to on */
|
||||||
Joystick2Port = 1;
|
Joystick2Port = 1;
|
||||||
|
|
||||||
SpritesOn = true;
|
SpritesOn = true;
|
||||||
@ -204,6 +204,7 @@ void Prefs::SetupJoystickDefaults()
|
|||||||
/* Saitek P380 */
|
/* Saitek P380 */
|
||||||
else if (strcmp(name, "Jess Tech Dual Analog Pad") == 0)
|
else if (strcmp(name, "Jess Tech Dual Analog Pad") == 0)
|
||||||
{
|
{
|
||||||
|
printf("Found joystikk\n");
|
||||||
/* Pad */
|
/* Pad */
|
||||||
this->JoystickHats[0] = HAT_PLAIN;
|
this->JoystickHats[0] = HAT_PLAIN;
|
||||||
this->MenuJoystickHats[0] = HAT_PLAIN;
|
this->MenuJoystickHats[0] = HAT_PLAIN;
|
||||||
@ -214,6 +215,9 @@ void Prefs::SetupJoystickDefaults()
|
|||||||
this->JoystickAxes[2] = JOY_HORIZ;
|
this->JoystickAxes[2] = JOY_HORIZ;
|
||||||
this->JoystickAxes[3] = JOY_VERT;
|
this->JoystickAxes[3] = JOY_VERT;
|
||||||
|
|
||||||
|
this->JoystickButtons[0] = (0 << 3) | 4;
|
||||||
|
this->JoystickButtons[1] = (0 << 3) | 5;
|
||||||
|
|
||||||
/* Button 4 Fire */
|
/* Button 4 Fire */
|
||||||
this->JoystickButtons[3] = 0x50;
|
this->JoystickButtons[3] = 0x50;
|
||||||
this->MenuJoystickButtons[3] = KEY_SELECT;
|
this->MenuJoystickButtons[3] = KEY_SELECT;
|
||||||
|
Loading…
Reference in New Issue
Block a user