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
This commit is contained in:
bgk 2012-09-02 17:26:08 +00:00
parent 00791f6801
commit 34963ad142
3 changed files with 1 additions and 43 deletions

View File

@ -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;

View File

@ -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

View File

@ -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