From 11f4096403465142970ab594d5b839c209b42ae1 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Wed, 19 Dec 2012 13:46:52 +0100 Subject: [PATCH] Added memory-limit option --- classes/API/ServerAPI.php | 5 +++ common/config.php | 3 +- common/default.properties | 1 + pstruct/RakNet.php | 75 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) diff --git a/classes/API/ServerAPI.php b/classes/API/ServerAPI.php index bc23548775..7cb54686f3 100644 --- a/classes/API/ServerAPI.php +++ b/classes/API/ServerAPI.php @@ -212,6 +212,11 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run } private function loadProperties(){ + if(isset($this->config["memory-limit"])){ + @ini_set("memory_limit", $this->config["memory-limit"]); + }else{ + $this->config["memory-limit"] = "256M"; + } if(is_object($this->server)){ $this->server->setType($this->config["server-type"]); $this->server->timePerSecond = $this->config["time-per-second"]; diff --git a/common/config.php b/common/config.php index 07d64ce664..57d7554bc6 100644 --- a/common/config.php +++ b/common/config.php @@ -29,11 +29,12 @@ set_time_limit(0); date_default_timezone_set(@date_default_timezone_get()); gc_enable(); error_reporting(E_ALL ^ E_NOTICE); +ini_set("allow_url_fopen", 1); ini_set("display_errors", 1); ini_set('default_charset', 'utf-8'); define("FILE_PATH", dirname(__FILE__)."/../"); set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH . PATH_SEPARATOR . FILE_PATH . "/classes/"); -ini_set("memory_limit", "1024M"); +ini_set("memory_limit", "256M"); define("CURRENT_PROTOCOL", 5); define("CURRENT_VERSION", 1); define("LOG", true); diff --git a/common/default.properties b/common/default.properties index c22d763d8d..5751f27920 100644 --- a/common/default.properties +++ b/common/default.properties @@ -4,6 +4,7 @@ description= This is a Work in Progress custom server. motd=Welcome to PHP Server port=19132 protocol=CURRENT +memory-limit=256M last-update=false white-list=false debug=2 diff --git a/pstruct/RakNet.php b/pstruct/RakNet.php index 97b1557547..46153c1d81 100644 --- a/pstruct/RakNet.php +++ b/pstruct/RakNet.php @@ -86,17 +86,72 @@ $pstruct = array( "customData", ), + + 0x81 => array( + "itriad", + "ubyte", + "customData", + ), + + 0x82 => array( + "itriad", + "ubyte", + "customData", + ), + + 0x83 => array( + "itriad", + "ubyte", + "customData", + ), + 0x84 => array( "itriad", "ubyte", "customData", ), + 0x85 => array( + "itriad", + "ubyte", + "customData", + ), + + 0x86 => array( + "itriad", + "ubyte", + "customData", + ), + + 0x87 => array( + "itriad", + "ubyte", + "customData", + ), + 0x88 => array( "itriad", "ubyte", "customData", ), + + 0x89 => array( + "itriad", + "ubyte", + "customData", + ), + + 0x8a => array( + "itriad", + "ubyte", + "customData", + ), + + 0x8b => array( + "itriad", + "ubyte", + "customData", + ), 0x8c => array( "itriad", @@ -104,6 +159,26 @@ $pstruct = array( "customData", ), + 0x8d => array( + "itriad", + "ubyte", + "customData", + ), + + 0x8e => array( + "itriad", + "ubyte", + "customData", + ), + + 0x8f => array( + "itriad", + "ubyte", + "customData", + ), + + + 0xa0 => array( "short", "bool",