Make the Transferpak only init the GBCart when we have either a read or a load to the transferpak.
This commit is contained in:
parent
ff4bd28e3e
commit
6e45f2d90f
|
@ -31,14 +31,23 @@ void Transferpak::Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transferpak::Release()
|
void Transferpak::Release()
|
||||||
|
{
|
||||||
|
if (tpak.gb_cart.rom != NULL)
|
||||||
{
|
{
|
||||||
GBCart::release_gb_cart(&tpak.gb_cart);
|
GBCart::release_gb_cart(&tpak.gb_cart);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Transferpak::ReadFrom(uint16_t address, uint8_t * data)
|
void Transferpak::ReadFrom(uint16_t address, uint8_t * data)
|
||||||
{
|
{
|
||||||
if ((address >= 0x8000) && (address <= 0x8FFF))
|
if ((address >= 0x8000) && (address <= 0x8FFF))
|
||||||
{
|
{
|
||||||
|
//Ensure we actually have a ROM loaded in first.
|
||||||
|
if (tpak.gb_cart.rom == NULL)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
//Get whether the GB cart is enabled or disabled
|
//Get whether the GB cart is enabled or disabled
|
||||||
uint8_t value = (tpak.enabled) ? 0x84 : 0x00;
|
uint8_t value = (tpak.enabled) ? 0x84 : 0x00;
|
||||||
|
|
||||||
|
@ -71,8 +80,15 @@ void Transferpak::ReadFrom(uint16_t address, uint8_t * data)
|
||||||
|
|
||||||
void Transferpak::WriteTo(uint16_t address, uint8_t * data)
|
void Transferpak::WriteTo(uint16_t address, uint8_t * data)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((address >= 0x8000) && (address <= 0x8FFF))
|
if ((address >= 0x8000) && (address <= 0x8FFF))
|
||||||
{
|
{
|
||||||
|
//Ensure we actually have a ROM loaded in first.
|
||||||
|
if (tpak.gb_cart.rom == NULL)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
//Set whether the gb cart is enabled or disabled.
|
//Set whether the gb cart is enabled or disabled.
|
||||||
switch (*data)
|
switch (*data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -687,22 +687,6 @@ bool CN64System::SetActiveSystem(bool bActive)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "g_Plugins->Initiate Failed");
|
WriteTrace(TraceN64System, TraceError, "g_Plugins->Initiate Failed");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
CONTROL * Controllers = g_Plugins->Control()->PluginControllers();
|
|
||||||
for (int i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
if (Controllers[i].Present)
|
|
||||||
{
|
|
||||||
switch (Controllers[i].Plugin)
|
|
||||||
{
|
|
||||||
case PLUGIN_TANSFER_PAK:
|
|
||||||
Transferpak::Init();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bReset)
|
if (bReset)
|
||||||
|
|
Loading…
Reference in New Issue