Skip to content

Commit

Permalink
Dunno
Browse files Browse the repository at this point in the history
  • Loading branch information
Furrior committed Sep 28, 2023
1 parent cf5e609 commit abb9ee6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
17 changes: 4 additions & 13 deletions modular_ss220/text_to_speech/code/rust_g_ss220.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,10 @@
#endif

/// Gets the version of rust_g
/proc/rustgss220_get_version() return RUSTG_CALL(RUST_G_SS220, "get_version")()
/proc/rustg_ss220_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)


#ifdef RUSTG_OVERRIDE_BUILTINS
#define md5(thing) (isfile(thing) ? rustgss220_hash_file(RUSTG_HASH_MD5, "[thing]") : rustgss220_hash_string(RUSTG_HASH_MD5, thing))
#endif
#define rustg_ss220_file_write_b64decode(text, fname) RUSTG_CALL(RUST_G_SS220, "file_write")(text, fname, "true")

// 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]")
#define rustg_ss220_cyrillic_to_latin(text) RUSTG_CALL(RUST_G_SS220, "cyrillic_to_latin")("[text]")
#define rustg_ss220_latin_to_cyrillic(text) RUSTG_CALL(RUST_G_SS220, "latin_to_cyrillic")("[text]")
8 changes: 4 additions & 4 deletions modular_ss220/text_to_speech/code/tts_subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ SUBSYSTEM_DEF(tts220)
if(traits & TTS_TRAIT_PITCH_WHISPER)
text = provider.pitch_whisper(text)

var/hash = rustgss220_hash_string(RUSTG_HASH_MD5, text)
var/hash = rustg_hash_string(RUSTG_HASH_MD5, text)
var/filename = "data/tts_cache/[seed.name]/[hash]"

var/datum/callback/play_tts_cb = CALLBACK(src, PROC_REF(play_tts), speaker, listener, filename, is_local, effect, preSFX, postSFX)
Expand Down Expand Up @@ -330,7 +330,7 @@ SUBSYSTEM_DEF(tts220)
if(!voice)
return

rustgss220_file_write_b64decode(voice, "[filename].ogg")
rustg_ss220_file_write_b64decode(voice, "[filename].ogg")

if (!GLOB.configuration.tts.tts_cache_enabled)
addtimer(CALLBACK(src, PROC_REF(cleanup_tts_file), "[filename].ogg"), 30 SECONDS)
Expand Down Expand Up @@ -458,7 +458,7 @@ SUBSYSTEM_DEF(tts220)
/datum/controller/subsystem/tts220/proc/sanitize_tts_input(message)
var/hash
if(sanitized_messages_caching)
hash = rustgss220_hash_string(RUSTG_HASH_MD5, message)
hash = rustg_hash_string(RUSTG_HASH_MD5, message)
if(sanitized_messages_cache[hash])
sanitized_messages_cache_hit++
return sanitized_messages_cache[hash]
Expand All @@ -481,7 +481,7 @@ SUBSYSTEM_DEF(tts220)
. = replacetext(., words, /proc/tts_word_replacer)
for(var/job in tts_job_replacements)
. = replacetext(., regex(job, "igm"), tts_job_replacements[job])
. = rustgss220_latin_to_cyrillic(.)
. = rustg_ss220_latin_to_cyrillic(.)

var/static/regex/decimals = new(@"-?\d+\.\d+", "g")
. = replacetext(., decimals, /proc/dec_in_words)
Expand Down
14 changes: 3 additions & 11 deletions modular_ss220/text_to_speech/code/~undefs/~undefs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,11 @@
#undef TTS_TRAIT_RATE_FASTER
#undef TTS_TRAIT_RATE_MEDIUM

#undef rustgss220_file_write_b64decode

#undef rustgss220_hash_string
#undef rustgss220_hash_file


#ifdef RUSTG_OVERRIDE_BUILTINS
#undef md5
#endif
#undef rustg_ss220_file_write_b64decode

// Text Operations //
#undef rustgss220_cyrillic_to_latin
#undef rustgss220_latin_to_cyrillic
#undef rustg_ss220_cyrillic_to_latin
#undef rustg_ss220_latin_to_cyrillic

#undef TTS_CATEGORY_OTHER
#undef TTS_CATEGORY_WARCRAFT3
Expand Down

0 comments on commit abb9ee6

Please sign in to comment.