Make sure interfaces are removed on unload as otherwise it causes seg fault on unloading.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
87ddb8033f
commit
38ecf366d6
3 changed files with 24 additions and 23 deletions
|
@ -1,6 +1,8 @@
|
|||
#include "StdAfx.h"
|
||||
#include "frontends/libretro/game.h"
|
||||
#include "frontends/libretro/retroregistry.h"
|
||||
#include "frontends/libretro/joypad.h"
|
||||
#include "frontends/libretro/analog.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "CardManager.h"
|
||||
|
@ -54,11 +56,30 @@ Game::Game()
|
|||
|
||||
const size_t size = myHeight * myPitch;
|
||||
myVideoBuffer.resize(size);
|
||||
|
||||
switch (ourInputDevices[0])
|
||||
{
|
||||
case RETRO_DEVICE_NONE:
|
||||
Paddle::instance().reset();
|
||||
break;
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
Paddle::instance().reset(new Joypad);
|
||||
Paddle::setSquaring(false);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
Paddle::instance().reset(new Analog);
|
||||
Paddle::setSquaring(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
{
|
||||
uninitialiseEmulator();
|
||||
Paddle::instance().reset();
|
||||
Registry::instance.reset();
|
||||
}
|
||||
|
||||
retro_usec_t Game::ourFrameTime = 0;
|
||||
|
@ -232,7 +253,7 @@ bool Game::checkButtonPressed(unsigned id)
|
|||
|
||||
void Game::keyboardEmulation()
|
||||
{
|
||||
if (input_devices[0] != RETRO_DEVICE_NONE)
|
||||
if (ourInputDevices[0] != RETRO_DEVICE_NONE)
|
||||
{
|
||||
if (checkButtonPressed(RETRO_DEVICE_ID_JOYPAD_R))
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
static void frameTimeCallback(retro_usec_t usec);
|
||||
static constexpr size_t FPS = 60;
|
||||
static unsigned input_devices[MAX_PADS];
|
||||
static unsigned ourInputDevices[MAX_PADS];
|
||||
static retro_usec_t ourFrameTime;
|
||||
|
||||
private:
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include "frontends/libretro/game.h"
|
||||
#include "frontends/libretro/environment.h"
|
||||
#include "frontends/libretro/joypad.h"
|
||||
#include "frontends/libretro/analog.h"
|
||||
#include "frontends/libretro/rdirectsound.h"
|
||||
#include "frontends/libretro/retroregistry.h"
|
||||
|
||||
|
@ -56,27 +54,9 @@ unsigned retro_api_version(void)
|
|||
void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||
{
|
||||
log_cb(RETRO_LOG_INFO, "RA2: %s, Plugging device %u into port %u.\n", __FUNCTION__, device, port);
|
||||
|
||||
if (port == 0)
|
||||
{
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_NONE:
|
||||
Paddle::instance().reset();
|
||||
break;
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
Paddle::instance().reset(new Joypad);
|
||||
Paddle::setSquaring(false);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
Paddle::instance().reset(new Analog);
|
||||
Paddle::setSquaring(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Game::input_devices[port] = device;
|
||||
Game::ourInputDevices[port] = device;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue