diff options
author | Alexander Tkachev | 2016-08-15 20:06:53 +0600 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-30 23:26:29 +0200 |
commit | 3c64e4958dd6920644a568e0ea38e4e7edd43b71 (patch) | |
tree | 99376b8d4a52120f162da6ead23ecabb2a3d510b | |
parent | 6cfcf1f1796c9d3125596666362ce5162fd406ae (diff) | |
download | scummvm-rg350-3c64e4958dd6920644a568e0ea38e4e7edd43b71.tar.gz scummvm-rg350-3c64e4958dd6920644a568e0ea38e4e7edd43b71.tar.bz2 scummvm-rg350-3c64e4958dd6920644a568e0ea38e4e7edd43b71.zip |
SCUMM HE: Add some Moonbase logic
Logic for getting host name and IP from name. Net gets more stubs.
-rw-r--r-- | engines/scumm/he/logic/moonbase_logic.cpp | 23 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/net_main.cpp | 10 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/net_main.h | 3 |
3 files changed, 32 insertions, 4 deletions
diff --git a/engines/scumm/he/logic/moonbase_logic.cpp b/engines/scumm/he/logic/moonbase_logic.cpp index 7e7736835d..04e694e1e7 100644 --- a/engines/scumm/he/logic/moonbase_logic.cpp +++ b/engines/scumm/he/logic/moonbase_logic.cpp @@ -503,13 +503,28 @@ int LogicHEmoonbase::op_net_set_provider_by_name(int op, int numArgs, int32 *arg void LogicHEmoonbase::op_net_set_fake_latency(int op, int numArgs, int32 *args) { warning("STUB: op_net_set_fake_latency()"); } + int LogicHEmoonbase::op_net_get_host_name(int op, int numArgs, int32 *args) { - warning("STUB: op_net_get_host_name()"); - return 1; + char name[MAX_HOSTNAME_SIZE]; + + if (_vm1->_moonbase->_net->getHostName(name, MAX_HOSTNAME_SIZE)) { // PN_GetHostName + return _vm1->setupStringArrayFromString(name); + } + + return 0; } + int LogicHEmoonbase::op_net_get_ip_from_name(int op, int numArgs, int32 *args) { - warning("STUB: op_net_get_ip_from_name()"); - return 1; + char szName[MAX_HOSTNAME_SIZE]; + _vm1->getStringFromArray(args[0], szName, sizeof(szName)); + + char ip[MAX_IP_SIZE]; + + if (_vm1->_moonbase->_net->getIPfromName(ip, MAX_IP_SIZE, szName)) { // PN_GetIPfromName + return _vm1->setupStringArrayFromString(ip); + } + + return 0; } int LogicHEmoonbase::op_net_host_tcpip_game(int op, int numArgs, int32 *args) { diff --git a/engines/scumm/he/moonbase/net_main.cpp b/engines/scumm/he/moonbase/net_main.cpp index eb54250fdd..2d92313b1d 100644 --- a/engines/scumm/he/moonbase/net_main.cpp +++ b/engines/scumm/he/moonbase/net_main.cpp @@ -60,4 +60,14 @@ int Net::whoAmI() { return 0; } +bool Net::getHostName(char *hostname, int length) { + warning("STUB: Net::getHostName(\"%s\", %d)", hostname, length); // PN_GetHostName + return false; +} + +bool Net::getIPfromName(char *ip, int ipLength, char *nameBuffer) { + warning("STUB: Net::getIPfromName(\"%s\", %d, \"%s\")", ip, ipLength, nameBuffer); // PN_GetIPfromName + return false; +} + } // End of namespace Scumm diff --git a/engines/scumm/he/moonbase/net_main.h b/engines/scumm/he/moonbase/net_main.h index f8c289cade..8b555942dd 100644 --- a/engines/scumm/he/moonbase/net_main.h +++ b/engines/scumm/he/moonbase/net_main.h @@ -39,10 +39,13 @@ public: int removeUser(); int whoSentThis(); int whoAmI(); + private: public: //getters + bool getHostName(char *hostname, int length); + bool getIPfromName(char *ip, int ipLength, char *nameBuffer); private: //mostly getters |