[Scummvm-git-logs] scummvm master -> c493ac84d788e8bf7f1ee3084e4759453f844609

sev- sev at scummvm.org
Mon Nov 4 00:29:11 CET 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c493ac84d7 SCUMM HE: MBC: Do not block execution when sending packets


Commit: c493ac84d788e8bf7f1ee3084e4759453f844609
    https://github.com/scummvm/scummvm/commit/c493ac84d788e8bf7f1ee3084e4759453f844609
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-04T00:28:42+01:00

Commit Message:
SCUMM HE: MBC: Do not block execution when sending packets

Changed paths:
    engines/scumm/he/moonbase/net_main.cpp
    engines/scumm/he/moonbase/net_main.h


diff --git a/engines/scumm/he/moonbase/net_main.cpp b/engines/scumm/he/moonbase/net_main.cpp
index 519a802..99b46a9 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 6151ef8..a482f0e 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);





More information about the Scummvm-git-logs mailing list