diff --git a/dependencies.sh b/dependencies.sh index 2daae6126cabc..d675fc003919b 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -9,7 +9,7 @@ export BYOND_MINOR=1637 #rust_g git tag export RUST_G_VERSION=3.5.1 -export RUST_G_VERSION_SS220=3.0.0-ss220 +export RUST_UTILS_VERSION=0.1.0-release #node version export NODE_VERSION_LTS=22.11.0 diff --git a/librust_utils.dll b/librust_utils.dll new file mode 100644 index 0000000000000..a96405068e776 Binary files /dev/null and b/librust_utils.dll differ diff --git a/modular_bandastation/_rust_utils/_rust_utils.dm b/modular_bandastation/_rust_utils/_rust_utils.dm new file mode 100644 index 0000000000000..c9c35792e08f6 --- /dev/null +++ b/modular_bandastation/_rust_utils/_rust_utils.dm @@ -0,0 +1,4 @@ +/datum/modpack/rust_utils + name = "Rust Utils" + desc = "Набор утилит на rust" + author = "furior, gaxeer" diff --git a/modular_bandastation/_rust_utils/_rust_utils.dme b/modular_bandastation/_rust_utils/_rust_utils.dme new file mode 100644 index 0000000000000..a0635e8a48903 --- /dev/null +++ b/modular_bandastation/_rust_utils/_rust_utils.dme @@ -0,0 +1,3 @@ +#include "_rust_utils.dm" + +#include "code/rust_utils.dm" diff --git a/modular_bandastation/_rust_utils/code/rust_utils.dm b/modular_bandastation/_rust_utils/code/rust_utils.dm new file mode 100644 index 0000000000000..17e880bd5a976 --- /dev/null +++ b/modular_bandastation/_rust_utils/code/rust_utils.dm @@ -0,0 +1,27 @@ +#ifndef RUST_UTILS + +/* This comment bypasses grep checks */ /var/__rust_utils + +/proc/__detect_rust_utils() + if(world.system_type == UNIX) + if(fexists("./librust_utils.so")) + // No need for LD_LIBRARY_PATH badness. + return __rust_utils = "./librust_utils.so" + else + // It's not in the current directory, so try others + return __rust_utils = "librust_utils.so" + else + return __rust_utils = "librust_utils" + +#define RUST_UTILS (__rust_utils || __detect_rust_utils()) +#endif + +/// Gets the version of rust_utils +/proc/rust_utils_get_version() return RUSTG_CALL(RUST_UTILS, "get_version")() + +#define rustutils_file_write_b64decode(text, fname) RUSTG_CALL(RUST_UTILS, "file_write")(text, fname, "true") + +#define rustutils_regex_replace(text, re, re_params, replacement) RUSTG_CALL(RUST_UTILS, "regex_replace")(text, re, re_params, replacement) + +#define rustutils_cyrillic_to_latin(text) RUSTG_CALL(RUST_UTILS, "cyrillic_to_latin")("[text]") +#define rustutils_latin_to_cyrillic(text) RUSTG_CALL(RUST_UTILS, "latin_to_cyrillic")("[text]") diff --git a/modular_bandastation/modular_bandastation.dme b/modular_bandastation/modular_bandastation.dme index 19956bbef3eac..c6667aa344221 100644 --- a/modular_bandastation/modular_bandastation.dme +++ b/modular_bandastation/modular_bandastation.dme @@ -3,6 +3,7 @@ #include "_defines220/_defines220.dme" #include "_helpers220/_helpers220.dme" +#include "_rust_utils/_rust_utils.dme" #include "_signals220/_signals220.dme" #include "_singletons/_singletons.dme" #include "title_screen/_title_screen.dme" diff --git a/modular_bandastation/tts/_tts.dme b/modular_bandastation/tts/_tts.dme index 3a6a21bc0fe9b..227d0aec4d1e5 100644 --- a/modular_bandastation/tts/_tts.dme +++ b/modular_bandastation/tts/_tts.dme @@ -1,6 +1,5 @@ #include "_tts.dm" -#include "code/_tts_rust_g_ss220.dm" #include "code/numbers.dm" #include "code/shell.dm" #include "code/SSHttp.dm" diff --git a/modular_bandastation/tts/code/SSHttp.dm b/modular_bandastation/tts/code/SSHttp.dm index d9d96ff38c08a..cc4196e8a6259 100644 --- a/modular_bandastation/tts/code/SSHttp.dm +++ b/modular_bandastation/tts/code/SSHttp.dm @@ -11,10 +11,6 @@ SUBSYSTEM_DEF(http) /// Total requests the SS has processed in a round var/total_requests -/datum/controller/subsystem/http/PreInit() - . = ..() - rustgss220_create_async_http_client() // Open the door - /datum/controller/subsystem/http/fire(resumed) for(var/r in active_async_requests) var/datum/http_request/req = r @@ -84,7 +80,3 @@ SUBSYSTEM_DEF(http) /datum/http_request /// Callback for executing after async requests. Will be called with an argument of [/datum/http_response] as first argument var/datum/callback/cb - -/world/Del() - rustgss220_close_async_http_client() - . = ..() diff --git a/modular_bandastation/tts/code/_tts_rust_g_ss220.dm b/modular_bandastation/tts/code/_tts_rust_g_ss220.dm deleted file mode 100644 index 54599608e3cb6..0000000000000 --- a/modular_bandastation/tts/code/_tts_rust_g_ss220.dm +++ /dev/null @@ -1,61 +0,0 @@ -// rust_g_ss220.dm - DM API for rust_g_ss220 extension library -// -// To configure, create a `rust_g_ss220.config.dm` and set what you care about from -// the following options: -// -// #define RUST_G_SS220 "path/to/rust_g_ss220" -// Override the .dll/.so detection logic with a fixed path or with detection -// logic of your own. -// -// #define RUSTG_OVERRIDE_BUILTINS -// Enable replacement rust-g functions for certain builtins. Off by default. - -#ifndef RUST_G_SS220 -// Default automatic RUST_G_SS220 detection. -// On Windows, looks in the standard places for `rust_g_ss220.dll`. -// On Linux, looks in `.`, `$LD_LIBRARY_PATH`, and `~/.byond/bin` for either of -// `librust_g_ss220.so` (preferred) or `rust_g_ss220` (old). - -/* This comment bypasses grep checks */ /var/__rust_g_ss220 - -/proc/__detect_rust_g_ss220() - if (world.system_type == UNIX) - if (fexists("./librust_g_ss220.so")) - // No need for LD_LIBRARY_PATH badness. - return __rust_g_ss220 = "./librust_g_ss220.so" - else if (fexists("./rust_g_ss220")) - // Old dumb filename. - return __rust_g_ss220 = "./rust_g_ss220" - else if (fexists("[world.GetConfig("env", "HOME")]/.byond/bin/rust_g_ss220")) - // Old dumb filename in `~/.byond/bin`. - return __rust_g_ss220 = "rust_g_ss220" - else - // It's not in the current directory, so try others - return __rust_g_ss220 = "librust_g_ss220.so" - else - return __rust_g_ss220 = "rust_g_ss220" - -#define RUST_G_SS220 (__rust_g_ss220 || __detect_rust_g_ss220()) -#endif - -/// Gets the version of rust_g -/proc/rustgss220_get_version() return RUSTG_CALL(RUST_G_SS220, "get_version")() - -#define rustgss220_file_write_b64decode(text, fname) RUSTG_CALL(RUST_G_SS220, "file_write")(text, fname, "true") - -// Hashing Operations // -#define rustgss220_hash_string(algorithm, text) RUSTG_CALL(RUST_G_SS220, "hash_string")(algorithm, text) -#define rustgss220_hash_file(algorithm, fname) RUSTG_CALL(RUST_G_SS220, "hash_file")(algorithm, fname) - -#define RUSTG_HASH_MD5 "md5" - -#ifdef RUSTG_OVERRIDE_BUILTINS - #define md5(thing) (isfile(thing) ? rustgss220_hash_file(RUSTG_HASH_MD5, "[thing]") : rustgss220_hash_string(RUSTG_HASH_MD5, thing)) -#endif - -// Text Operations // -#define rustgss220_cyrillic_to_latin(text) RUSTG_CALL(RUST_G_SS220, "cyrillic_to_latin")("[text]") -#define rustgss220_latin_to_cyrillic(text) RUSTG_CALL(RUST_G_SS220, "latin_to_cyrillic")("[text]") - -/proc/rustgss220_create_async_http_client() return RUSTG_CALL(RUST_G_SS220, "start_http_client")() -/proc/rustgss220_close_async_http_client() return RUSTG_CALL(RUST_G_SS220, "shutdown_http_client")() diff --git a/modular_bandastation/tts/code/tts_subsystem.dm b/modular_bandastation/tts/code/tts_subsystem.dm index d0ea9f247945d..17a2791ee20cf 100644 --- a/modular_bandastation/tts/code/tts_subsystem.dm +++ b/modular_bandastation/tts/code/tts_subsystem.dm @@ -315,7 +315,7 @@ SUBSYSTEM_DEF(tts220) if(!voice) return - rustgss220_file_write_b64decode(voice, "[filename].ogg") + rustutils_file_write_b64decode(voice, "[filename].ogg") if(!CONFIG_GET(flag/tts_cache_enabled)) addtimer(CALLBACK(src, PROC_REF(cleanup_tts_file), "[filename].ogg"), FILE_CLEANUP_DELAY) @@ -466,7 +466,7 @@ SUBSYSTEM_DEF(tts220) if(LAZYLEN(tts_job_replacements)) for(var/job in tts_job_replacements) . = replacetext_char(., job, tts_job_replacements[job]) - . = rustgss220_latin_to_cyrillic(.) + . = rustutils_latin_to_cyrillic(.) var/static/regex/decimals = new(@"-?\d+\.\d+", "g") . = replacetext_char(., decimals, GLOBAL_PROC_REF(dec_in_words)) diff --git a/modular_bandastation/tts/code/~undefs/~undefs.dm b/modular_bandastation/tts/code/~undefs/~undefs.dm index 0ef279d250dc4..58d9c75436e56 100644 --- a/modular_bandastation/tts/code/~undefs/~undefs.dm +++ b/modular_bandastation/tts/code/~undefs/~undefs.dm @@ -6,21 +6,6 @@ #undef TTS_TRAIT_ROBOTIZE -#undef rustgss220_file_write_b64decode - -#undef rustgss220_hash_string -#undef rustgss220_hash_file - -#undef RUSTG_HASH_MD5 - -#ifdef RUSTG_OVERRIDE_BUILTINS - #undef md5 -#endif - -// Text Operations // -#undef rustgss220_cyrillic_to_latin -#undef rustgss220_latin_to_cyrillic - #undef TTS_CATEGORY_OTHER #undef TTS_CATEGORY_WARCRAFT3 #undef TTS_CATEGORY_HALFLIFE2 diff --git a/rust_g_ss220.dll b/rust_g_ss220.dll deleted file mode 100644 index ef1d0ec0bdd59..0000000000000 Binary files a/rust_g_ss220.dll and /dev/null differ diff --git a/tools/ci/install_rust_g.sh b/tools/ci/install_rust_g.sh index 582e80536f5d0..a1a3509963d1d 100755 --- a/tools/ci/install_rust_g.sh +++ b/tools/ci/install_rust_g.sh @@ -8,6 +8,6 @@ wget -nv -O ~/.byond/bin/librust_g.so "https://github.com/tgstation/rust-g/relea chmod +x ~/.byond/bin/librust_g.so ldd ~/.byond/bin/librust_g.so -wget -nv -O ~/.byond/bin/librust_g_ss220.so "https://github.com/ss220club/rust-g-tg/releases/download/$RUST_G_VERSION_SS220/librust_g.so" -chmod +x ~/.byond/bin/librust_g_ss220.so -ldd ~/.byond/bin/librust_g_ss220.so +wget -nv -O ~/.byond/bin/librust_utils.so "https://github.com/ss220club/rust-utils/releases/download/$RUST_UTILS_VERSION/librust_utils.so" +chmod +x ~/.byond/bin/librust_utils.so +ldd ~/.byond/bin/librust_utils.so diff --git a/tools/tgs_scripts/PreCompile.sh b/tools/tgs_scripts/PreCompile.sh index 761c9f1389209..1825937e97011 100755 --- a/tools/tgs_scripts/PreCompile.sh +++ b/tools/tgs_scripts/PreCompile.sh @@ -32,24 +32,24 @@ env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --ignore-rust-version --re mv target/i686-unknown-linux-gnu/release/librust_g.so "$1/librust_g.so" cd .. -# update rust-g-tg s220 -if [ ! -d "rust-g-tg" ]; then - echo "Cloning rust-g ss220..." - git clone https://github.com/ss220club/rust-g-tg - cd rust-g-tg +# update rust-utils +if [ ! -d "rust-utils" ]; then + echo "Cloning rust-utils..." + git clone https://github.com/ss220club/rust-utils + cd rust-utils ~/.cargo/bin/rustup target add i686-unknown-linux-gnu else - echo "Fetching rust-g ss220..." - cd rust-g-tg + echo "Fetching rust-utils..." + cd rust-utils git fetch ~/.cargo/bin/rustup target add i686-unknown-linux-gnu fi -echo "Deploying rust-g ss220..." -git checkout master - ~/.cargo/bin/cargo clean +echo "Deploying rust utils..." +git checkout "$RUST_UTILS_VERSION" env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --ignore-rust-version --release --target=i686-unknown-linux-gnu -mv target/i686-unknown-linux-gnu/release/librust_g.so "$1/librust_g_ss220.so" +mv target/i686-unknown-linux-gnu/release/librust_utils.so "$1/librust_utils.so" +cd .. # cd "$original_dir" # update dreamluau