From 34963ad14298f32b215b8415ade1d273e756455f Mon Sep 17 00:00:00 2001 From: bgk Date: Sun, 2 Sep 2012 17:26:08 +0000 Subject: [PATCH] LINK: Don't assume the data we want to send is the first to be written to SIOMLT_SEND since last transfer. But rather the one present in SIOMLT_SEND when master sets the start transfert bit. Fixes Advance Wars --- src/gba/GBA.cpp | 2 -- src/gba/GBALink.cpp | 33 +-------------------------------- src/gba/GBALink.h | 9 --------- 3 files changed, 1 insertion(+), 43 deletions(-) diff --git a/src/gba/GBA.cpp b/src/gba/GBA.cpp index 0bced723..e1d1a0c7 100644 --- a/src/gba/GBA.cpp +++ b/src/gba/GBA.cpp @@ -2828,8 +2828,6 @@ void CPUUpdateRegister(u32 address, u16 value) break; case COMM_SIODATA8: - if (gba_link_enabled) - LinkSSend(value); UPDATE_REG(COMM_SIODATA8, value); break; diff --git a/src/gba/GBALink.cpp b/src/gba/GBALink.cpp index 1c05ff0b..4f650fe0 100644 --- a/src/gba/GBALink.cpp +++ b/src/gba/GBALink.cpp @@ -484,10 +484,8 @@ void LinkUpdate(int ticks) { linkdata[linkid] = READ16LE(&ioMem[COMM_SIODATA8]); - if (!lc.oncesend) - lc.Send(); + lc.Send(); - lc.oncesend = false; UPDATE_REG(COMM_SIODATA32_L, linkdata[0]); UPDATE_REG(COMM_SIOCNT, READ16LE(&ioMem[COMM_SIOCNT]) | 0x80); transfer = 1; @@ -1350,7 +1348,6 @@ lclient::lclient(void){ intoutbuffer = (s32*)outbuffer; u16outbuffer = (u16*)outbuffer; numtransfers = 0; - oncesend = false; return; } @@ -1467,7 +1464,6 @@ void lclient::CheckConn(void){ } after = false; oncewait = true; - oncesend = true; } return; } @@ -1516,31 +1512,4 @@ void lclient::Send(){ lanlink.tcpsocket.Send(outbuffer, 4); return; } - - -// Uncalled -void LinkSStop(void){ - if(!oncewait){ - if(linkid){ - if(lanlink.numslaves==1) return; - lc.Recv(); - } - else ls.Recv(); - - oncewait = true; - UPDATE_REG(COMM_SIOMULTI1, linkdata[1]); - UPDATE_REG(COMM_SIOMULTI2, linkdata[2]); - UPDATE_REG(COMM_SIOMULTI3, linkdata[3]); - } - return; -} - -// ??? Called when COMM_SIODATA8 written -void LinkSSend(u16 value){ - if(linkid&&!lc.oncesend){ - linkdata[linkid] = value; - lc.Send(); - lc.oncesend = true; - } -} #endif diff --git a/src/gba/GBALink.h b/src/gba/GBALink.h index 89ed793d..c2d7024f 100644 --- a/src/gba/GBALink.h +++ b/src/gba/GBALink.h @@ -120,7 +120,6 @@ class lclient{ u16 *u16outbuffer; int numbytes; public: - bool oncesend; sf::IPAddress serveraddr; unsigned short serverport; sf::SocketTCP noblock; @@ -157,11 +156,7 @@ extern bool InitLink(); extern void CloseLink(); extern void StartLink(u16); extern void StartGPLink(u16); -extern void LinkSSend(u16); extern void LinkUpdate(int); -extern void LinkChildStop(); -extern void LinkChildSend(u16); -extern void CloseLanLink(); extern void CleanLocalLink(); extern LANLINKDATA lanlink; extern int vbaid; @@ -185,11 +180,7 @@ inline bool InitLink() { return true; } inline void CloseLink() { } inline void StartLink(u16) { } inline void StartGPLink(u16) { } -inline void LinkSSend(u16) { } inline void LinkUpdate(int) { } -inline void LinkChildStop() { } -inline void LinkChildSend(u16) { } -inline void CloseLanLink() { } inline void CleanLocalLink() { } #endif