diff options
author | Eugene Sandulenko | 2019-11-04 00:28:42 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-04 00:28:42 +0100 |
commit | c493ac84d788e8bf7f1ee3084e4759453f844609 (patch) | |
tree | d18c448224c1266b0bf29ea9a38c3feccff44cee /engines/scumm/he | |
parent | 1370873a8a77d8e881789d7b349d4e8a3b6307f0 (diff) | |
download | scummvm-rg350-c493ac84d788e8bf7f1ee3084e4759453f844609.tar.gz scummvm-rg350-c493ac84d788e8bf7f1ee3084e4759453f844609.tar.bz2 scummvm-rg350-c493ac84d788e8bf7f1ee3084e4759453f844609.zip |
SCUMM HE: MBC: Do not block execution when sending packets
Diffstat (limited to 'engines/scumm/he')
-rw-r--r-- | engines/scumm/he/moonbase/net_main.cpp | 15 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/net_main.h | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/engines/scumm/he/moonbase/net_main.cpp b/engines/scumm/he/moonbase/net_main.cpp index 519a8025a9..99b46a954e 100644 --- a/engines/scumm/he/moonbase/net_main.cpp +++ b/engines/scumm/he/moonbase/net_main.cpp @@ -337,10 +337,10 @@ void Net::remoteStartScript(int typeOfSend, int sendTypeParam, int priority, int warning("STUB: Net::remoteStartScript(%d, %d, %d, %d, ...)", typeOfSend, sendTypeParam, priority, argsCount); // PN_RemoteStartScriptCommand - remoteSendData(typeOfSend, sendTypeParam, PACKETTYPE_REMOTESTARTSCRIPT, res, 0); + remoteSendData(typeOfSend, sendTypeParam, PACKETTYPE_REMOTESTARTSCRIPT, res); } -int Net::remoteSendData(int typeOfSend, int sendTypeParam, int type, Common::String data, int defaultRes) { +int Net::remoteSendData(int typeOfSend, int sendTypeParam, int type, Common::String data, int defaultRes, bool wait) { // Since I am lazy, instead of constructing the JSON object manually // I'd rather parse it Common::String res = Common::String::format( @@ -362,8 +362,13 @@ int Net::remoteSendData(int typeOfSend, int sendTypeParam, int type, Common::Str rq.start(); + if (!wait) + return 0; + while(rq.state() == Networking::PROCESSING) { g_system->delayMillis(5); + + _vm->parseEvents(); } if (!_sessions) @@ -423,7 +428,7 @@ void Net::remoteSendArray(int typeOfSend, int sendTypeParam, int priority, int a jsonData += "]"; } - remoteSendData(typeOfSend, sendTypeParam, PACKETTYPE_REMOTESENDSCUMMARRAY, jsonData, 0); + remoteSendData(typeOfSend, sendTypeParam, PACKETTYPE_REMOTESENDSCUMMARRAY, jsonData); } int Net::remoteStartScriptFunction(int typeOfSend, int sendTypeParam, int priority, int defaultReturnValue, int argsCount, int32 *args) { @@ -440,7 +445,7 @@ int Net::remoteStartScriptFunction(int typeOfSend, int sendTypeParam, int priori warning("STUB: Net::remoteStartScriptFunction(%d, %d, %d, %d, %d, ...)", typeOfSend, sendTypeParam, priority, defaultReturnValue, argsCount); // PN_RemoteStartScriptFunction - return remoteSendData(typeOfSend, sendTypeParam, PACKETTYPE_REMOTESTARTSCRIPTRETURN, res, defaultReturnValue); + return remoteSendData(typeOfSend, sendTypeParam, PACKETTYPE_REMOTESTARTSCRIPTRETURN, res, defaultReturnValue, true); } bool Net::getHostName(char *hostname, int length) { @@ -553,7 +558,7 @@ bool Net::remoteReceiveData() { Common::String res = Common::String::format("\"result\": %d", result); - remoteSendData(PN_SENDTYPE_INDIVIDUAL, from, PACKETTYPE_REMOTESTARTSCRIPTRESULT, res, 0); + remoteSendData(PN_SENDTYPE_INDIVIDUAL, from, PACKETTYPE_REMOTESTARTSCRIPTRESULT, res); } break; diff --git a/engines/scumm/he/moonbase/net_main.h b/engines/scumm/he/moonbase/net_main.h index 6151ef81d3..a482f0e098 100644 --- a/engines/scumm/he/moonbase/net_main.h +++ b/engines/scumm/he/moonbase/net_main.h @@ -61,7 +61,7 @@ public: bool initSession(); bool initUser(); void remoteStartScript(int typeOfSend, int sendTypeParam, int priority, int argsCount, int32 *args); - int remoteSendData(int typeOfSend, int sendTypeParam, int type, Common::String data, int defaultRes); + int remoteSendData(int typeOfSend, int sendTypeParam, int type, Common::String data, int defaultRes = 0, bool wait = false); void remoteSendArray(int typeOfSend, int sendTypeParam, int priority, int arrayIndex); int remoteStartScriptFunction(int typeOfSend, int sendTypeParam, int priority, int defaultReturnValue, int argsCount, int32 *args); void doNetworkOnceAFrame(int msecs); |