diff --git a/code/__DEFINES/tgs.dm b/code/__DEFINES/tgs.dm index af09ab6711..83e06658c5 100644 --- a/code/__DEFINES/tgs.dm +++ b/code/__DEFINES/tgs.dm @@ -1,6 +1,6 @@ // tgstation-server DMAPI -#define TGS_DMAPI_VERSION "6.0.3" +#define TGS_DMAPI_VERSION "6.0.6" // All functions and datums outside this document are subject to change with any version and should not be relied on. @@ -102,6 +102,8 @@ // #define TGS_EVENT_WORLD_REBOOT 20 /// Watchdog event when TgsInitializationComplete() is called. No parameters. #define TGS_EVENT_WORLD_PRIME 21 +// DMAPI also doesnt implement this +// #define TGS_EVENT_DREAM_DAEMON_LAUNCH 22 // OTHER ENUMS diff --git a/code/modules/tgs/README.md b/code/modules/tgs/README.md index 445cee41f5..6319028d81 100644 --- a/code/modules/tgs/README.md +++ b/code/modules/tgs/README.md @@ -7,7 +7,7 @@ This folder should be placed on it's own inside a codebase that wishes to use th - The other versioned folders contain code for the different DMAPI versions. - [v3210](./v3210) contains the final TGS3 API. - [v4](./v4) is the legacy DMAPI 4 (Used in TGS 4.0.X versions). - - [v5](./v5) is the current DMAPI version used by TGS4 >=4.1. + - [v5](./v5) is the current DMAPI version used by TGS >=4.1. - [LICENSE](./LICENSE) is the MIT license for the DMAPI. APIs communicate with TGS in two ways. All versions implement TGS -> DM communication using /world/Topic. DM -> TGS communication, called the bridge method, is different for each version. diff --git a/code/modules/tgs/v3210/api.dm b/code/modules/tgs/v3210/api.dm index 6382325100..3c218d5b10 100644 --- a/code/modules/tgs/v3210/api.dm +++ b/code/modules/tgs/v3210/api.dm @@ -28,6 +28,8 @@ #define SERVICE_RETURN_SUCCESS "SUCCESS" +#define TGS_FILE2LIST(filename) (splittext(trim_left(trim_right(file2text(filename))), "\n")) + /datum/tgs_api/v3210 var/reboot_mode = REBOOT_MODE_NORMAL var/comms_key @@ -53,9 +55,6 @@ return copytext(text, 1, i + 1) return "" -/datum/tgs_api/v3210/proc/file2list(filename) - return splittext(trim_left(trim_right(file2text(filename))), "\n") - /datum/tgs_api/v3210/OnWorldNew(minimum_required_security_level) . = FALSE @@ -64,13 +63,21 @@ if(!instance_name) instance_name = "TG Station Server" //maybe just upgraded - var/list/logs = file2list(".git/logs/HEAD") + var/list/logs = TGS_FILE2LIST(".git/logs/HEAD") if(logs.len) - logs = splittext(logs[logs.len - 1], " ") - commit = logs[2] - logs = file2list(".git/logs/refs/remotes/origin/master") + logs = splittext(logs[logs.len], " ") + if (logs.len >= 2) + commit = logs[2] + else + TGS_ERROR_LOG("Error parsing commit logs") + + logs = TGS_FILE2LIST(".git/logs/refs/remotes/origin/master") if(logs.len) - originmastercommit = splittext(logs[logs.len - 1], " ")[2] + logs = splittext(logs[logs.len], " ") + if (logs.len >= 2) + originmastercommit = logs[2] + else + TGS_ERROR_LOG("Error parsing origin commmit logs") if(world.system_type != MS_WINDOWS) TGS_ERROR_LOG("This API version is only supported on Windows. Not running on Windows. Aborting initialization!") @@ -92,7 +99,11 @@ if(skip_compat_check && !fexists(SERVICE_INTERFACE_DLL)) TGS_ERROR_LOG("Service parameter present but no interface DLL detected. This is symptomatic of running a service less than version 3.1! Please upgrade.") return + #if DM_VERSION >= 515 + call_ext(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(instance_name, command) //trust no retval + #else call(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(instance_name, command) //trust no retval + #endif return TRUE /datum/tgs_api/v3210/OnTopic(T) @@ -226,3 +237,5 @@ #undef SERVICE_REQUEST_API_VERSION #undef SERVICE_RETURN_SUCCESS + +#undef TGS_FILE2LIST diff --git a/code/modules/tgs/v5/api.dm b/code/modules/tgs/v5/api.dm index 704ff873c0..572944ed40 100644 --- a/code/modules/tgs/v5/api.dm +++ b/code/modules/tgs/v5/api.dm @@ -269,7 +269,7 @@ if(!result) return - //okay so the standard TGS4 proceedure is: right before rebooting change the port to whatever was sent to us in the above json's data parameter + //okay so the standard TGS proceedure is: right before rebooting change the port to whatever was sent to us in the above json's data parameter var/port = result[DMAPI5_BRIDGE_RESPONSE_NEW_PORT] if(!isnum(port))