[Scummvm-git-logs] scummvm master -> e6b2615f340ca15fabdc8356bb879d29e0265cf8
sev-
sev at scummvm.org
Mon Nov 4 10:41:19 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:
e6b2615f34 SCUMM HE: MBC: Implement Net::endSession()
Commit: e6b2615f340ca15fabdc8356bb879d29e0265cf8
https://github.com/scummvm/scummvm/commit/e6b2615f340ca15fabdc8356bb879d29e0265cf8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-04T10:40:20+01:00
Commit Message:
SCUMM HE: MBC: Implement Net::endSession()
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 a315c92..303697b 100644
--- a/engines/scumm/he/moonbase/net_main.cpp
+++ b/engines/scumm/he/moonbase/net_main.cpp
@@ -194,10 +194,37 @@ int Net::joinSession(int sessionIndex) {
}
int Net::endSession() {
- warning("STUB: Net::endSession()"); // PN_EndSession
- return 0;
+ debug(1, "Net::endSession()"); // PN_EndSession
+
+ Networking::PostRequest rq(_serverprefix + "/endsession",
+ new Common::Callback<Net, Common::JSONValue *>(this, &Net::endSessionCallback),
+ new Common::Callback<Net, Networking::ErrorResponse>(this, &Net::endSessionErrorCallback));
+
+ char *buf = (char *)malloc(MAX_PACKET_SIZE);
+ snprintf(buf, MAX_PACKET_SIZE, "{\"sessionid\":%d}", _sessionid);
+ rq.setPostData((byte *)buf, strlen(buf));
+ rq.setContentType("application/json");
+
+ rq.start();
+
+ while(rq.state() == Networking::PROCESSING) {
+ g_system->delayMillis(5);
+ }
+
+ return _lastResult;
+}
+
+void Net::endSessionCallback(Common::JSONValue *response) {
+ _lastResult = 1;
}
+void Net::endSessionErrorCallback(Networking::ErrorResponse error) {
+ warning("Error in endSession(): %ld %s", error.httpResponseCode, error.response.c_str());
+
+ _lastResult = 0;
+}
+
+
void Net::disableSessionJoining() {
warning("STUB: Net::disableSessionJoining()"); // PN_DisableSessionPlayerJoin
}
diff --git a/engines/scumm/he/moonbase/net_main.h b/engines/scumm/he/moonbase/net_main.h
index aaa5b9a..54b5496 100644
--- a/engines/scumm/he/moonbase/net_main.h
+++ b/engines/scumm/he/moonbase/net_main.h
@@ -78,6 +78,9 @@ private:
void addUserCallback(Common::JSONValue *response);
void addUserErrorCallback(Networking::ErrorResponse error);
+ void endSessionCallback(Common::JSONValue *response);
+ void endSessionErrorCallback(Networking::ErrorResponse error);
+
void remoteSendDataCallback(Common::JSONValue *response);
void remoteSendDataErrorCallback(Networking::ErrorResponse error);
More information about the Scummvm-git-logs
mailing list