Fixed the crash that would occur if a GBA link mode were used with a GB game.
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1243 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
cc0101622a
commit
ad29903c8e
|
@ -808,7 +808,7 @@ void gbWriteMemory(register u16 address, register u8 value)
|
|||
}
|
||||
EmuReseted = false;
|
||||
gbMemory[0xff02] = value;
|
||||
if (gbSerialOn) {
|
||||
if (gbSerialOn && GetLinkMode() == LINK_GAMEBOY) {
|
||||
gbSerialTicks = GBSERIAL_CLOCK_TICKS;
|
||||
|
||||
LinkIsWaiting = true;
|
||||
|
@ -2201,8 +2201,10 @@ void gbGetHardwareType()
|
|||
void gbReset()
|
||||
{
|
||||
#ifndef NO_LINK
|
||||
EmuReseted = true;
|
||||
gbLinkReset();
|
||||
if (GetLinkMode() == LINK_GAMEBOY) {
|
||||
EmuReseted = true;
|
||||
gbLinkReset();
|
||||
}
|
||||
#endif
|
||||
|
||||
gbGetHardwareType();
|
||||
|
@ -5254,7 +5256,8 @@ void gbEmulate(int ticksToStop)
|
|||
static int SIOctr = 0;
|
||||
SIOctr++;
|
||||
if (SIOctr % 5)
|
||||
if (gbSerialOn) { //Transfer Started
|
||||
//Transfer Started
|
||||
if (gbSerialOn && GetLinkMode() == LINK_GAMEBOY) {
|
||||
#ifdef OLD_GB_LINK
|
||||
if (linkConnected) {
|
||||
gbSerialTicks -= clockTicks;
|
||||
|
|
|
@ -300,7 +300,6 @@ typedef struct {
|
|||
int type;
|
||||
bool server;
|
||||
bool speed; //speedhack
|
||||
bool active; //network/single computer
|
||||
} LANLINKDATA;
|
||||
|
||||
class lserver{
|
||||
|
@ -1882,7 +1881,7 @@ bool LinkRFUUpdate()
|
|||
{
|
||||
//if (IsLinkConnected()) {
|
||||
//}
|
||||
if (!lanlink.active || rfu_enabled) {
|
||||
if (rfu_enabled) {
|
||||
if (transfer&&rfu_transfer_end <= 0)
|
||||
{
|
||||
if (rfu_waiting) {
|
||||
|
@ -2231,6 +2230,9 @@ static ConnectionState InitSocket() {
|
|||
|
||||
ConnectionState InitLink(LinkMode mode)
|
||||
{
|
||||
if (mode == LINK_DISCONNECTED)
|
||||
return LINK_ABORT;
|
||||
|
||||
// Do nothing if we are already connected
|
||||
if (GetLinkMode() != LINK_DISCONNECTED) {
|
||||
systemMessage(0, N_("Error, link already connected"));
|
||||
|
@ -2720,7 +2722,7 @@ u8 gbStartLink(u8 b) //used on internal clock
|
|||
if (!gba_link_enabled) return 0xff;
|
||||
|
||||
//Single Computer
|
||||
if (!lanlink.active)
|
||||
if (GetLinkMode() == LINK_GAMEBOY)
|
||||
{
|
||||
u32 tm = GetTickCount();
|
||||
do {
|
||||
|
@ -2764,7 +2766,7 @@ u16 gbLinkUpdate(u8 b, int gbSerialOn) //used on external clock
|
|||
if (gbSerialOn) {
|
||||
if (gba_link_enabled)
|
||||
//Single Computer
|
||||
if (!lanlink.active)
|
||||
if (GetLinkMode() == LINK_GAMEBOY)
|
||||
{
|
||||
u32 tm;// = GetTickCount();
|
||||
//do {
|
||||
|
|
|
@ -133,6 +133,15 @@ void LinkOptions::OnOk()
|
|||
SetLinkTimeout(timeout);
|
||||
|
||||
LinkMode newMode = (LinkMode) m_type;
|
||||
|
||||
if (newMode == LINK_DISCONNECTED) {
|
||||
theApp.linkTimeout = timeout;
|
||||
theApp.linkMode = LINK_DISCONNECTED;
|
||||
theApp.linkHost = host;
|
||||
CDialog::OnOK();
|
||||
return;
|
||||
}
|
||||
|
||||
bool needsServerHost = newMode == LINK_GAMECUBE_DOLPHIN || (newMode == LINK_CABLE_SOCKET && !m_server);
|
||||
|
||||
if (needsServerHost) {
|
||||
|
|
Loading…
Reference in New Issue