Recover DreamLink hardware after load state
This commit is contained in:
parent
d3a46a1e33
commit
1207f988e0
|
@ -2500,7 +2500,7 @@ struct DreamLinkPurupuru : public maple_sega_purupuru
|
||||||
static std::list<std::shared_ptr<DreamLinkVmu>> dreamLinkVmus[2];
|
static std::list<std::shared_ptr<DreamLinkVmu>> dreamLinkVmus[2];
|
||||||
static std::list<std::shared_ptr<DreamLinkPurupuru>> dreamLinkPurupurus;
|
static std::list<std::shared_ptr<DreamLinkPurupuru>> dreamLinkPurupurus;
|
||||||
|
|
||||||
void createDreamLinkDevices(std::shared_ptr<DreamLink> dreamlink, bool gameStart)
|
void createDreamLinkDevices(std::shared_ptr<DreamLink> dreamlink, bool gameStart, bool stateLoaded)
|
||||||
{
|
{
|
||||||
const int bus = dreamlink->getBus();
|
const int bus = dreamlink->getBus();
|
||||||
|
|
||||||
|
@ -2522,7 +2522,7 @@ void createDreamLinkDevices(std::shared_ptr<DreamLink> dreamlink, bool gameStart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameStart || !vmuFound)
|
if (gameStart || stateLoaded || !vmuFound)
|
||||||
{
|
{
|
||||||
if (!vmu)
|
if (!vmu)
|
||||||
{
|
{
|
||||||
|
@ -2531,6 +2531,13 @@ void createDreamLinkDevices(std::shared_ptr<DreamLink> dreamlink, bool gameStart
|
||||||
|
|
||||||
vmu->Setup(bus, i);
|
vmu->Setup(bus, i);
|
||||||
|
|
||||||
|
if (stateLoaded && vmu->useRealVmuMemory)
|
||||||
|
{
|
||||||
|
// Disconnect from real VMU memory when a state is loaded
|
||||||
|
vmu->useRealVmuMemory = false;
|
||||||
|
os_notify("WARNING: Disconnected from physical VMU memory due to load state", 6000);
|
||||||
|
}
|
||||||
|
|
||||||
if (!vmuFound && dev && dev->get_device_type() == MDT_SegaVMU && !vmu->useRealVmuMemory) {
|
if (!vmuFound && dev && dev->get_device_type() == MDT_SegaVMU && !vmu->useRealVmuMemory) {
|
||||||
// Only copy data from virtual VMU if Physical VMU Only is disabled
|
// Only copy data from virtual VMU if Physical VMU Only is disabled
|
||||||
vmu->copyIn(std::static_pointer_cast<maple_sega_vmu>(dev));
|
vmu->copyIn(std::static_pointer_cast<maple_sega_vmu>(dev));
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include <setupapi.h>
|
#include <setupapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void createDreamLinkDevices(std::shared_ptr<DreamLink> dreamlink, bool gameStart);
|
void createDreamLinkDevices(std::shared_ptr<DreamLink> dreamlink, bool gameStart, bool stateLoaded);
|
||||||
void tearDownDreamLinkDevices(std::shared_ptr<DreamLink> dreamlink);
|
void tearDownDreamLinkDevices(std::shared_ptr<DreamLink> dreamlink);
|
||||||
|
|
||||||
bool DreamLinkGamepad::isDreamcastController(int deviceIndex)
|
bool DreamLinkGamepad::isDreamcastController(int deviceIndex)
|
||||||
|
@ -146,21 +146,22 @@ void DreamLinkGamepad::registered()
|
||||||
dreamlink->connect();
|
dreamlink->connect();
|
||||||
|
|
||||||
// Create DreamLink Maple Devices here just in case game is already running
|
// Create DreamLink Maple Devices here just in case game is already running
|
||||||
createDreamLinkDevices(dreamlink, false);
|
createDreamLinkDevices(dreamlink, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DreamLinkGamepad::handleEvent(Event event, void *arg)
|
void DreamLinkGamepad::handleEvent(Event event, void *arg)
|
||||||
{
|
{
|
||||||
DreamLinkGamepad *gamepad = static_cast<DreamLinkGamepad*>(arg);
|
DreamLinkGamepad *gamepad = static_cast<DreamLinkGamepad*>(arg);
|
||||||
if (gamepad->dreamlink != nullptr && event != Event::Terminate) {
|
if (gamepad->dreamlink != nullptr)
|
||||||
createDreamLinkDevices(gamepad->dreamlink, event == Event::Start);
|
{
|
||||||
|
if (event != Event::Terminate) {
|
||||||
|
createDreamLinkDevices(gamepad->dreamlink, event == Event::Start, event == Event::LoadState);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gamepad->dreamlink->gameTermination();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamepad->dreamlink != nullptr && event == Event::Terminate)
|
|
||||||
{
|
|
||||||
gamepad->dreamlink->gameTermination();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DreamLinkGamepad::resetMappingToDefault(bool arcade, bool gamepad) {
|
void DreamLinkGamepad::resetMappingToDefault(bool arcade, bool gamepad) {
|
||||||
|
|
|
@ -937,7 +937,8 @@ void gui_settings_controls(bool& maple_devices_changed)
|
||||||
{
|
{
|
||||||
DisabledScope scope(game_started);
|
DisabledScope scope(game_started);
|
||||||
OptionCheckbox("Use Physical VMU Memory", config::UsePhysicalVmuMemory,
|
OptionCheckbox("Use Physical VMU Memory", config::UsePhysicalVmuMemory,
|
||||||
"Enables direct read/write access to physical VMU memory via DreamPicoPort/DreamConn.");
|
"Enables direct read/write access to physical VMU memory via DreamPicoPort/DreamConn. "
|
||||||
|
"This is not compatible with load state.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue