Merge pull request #9246 from ShadowLarkens/vchat_export_optimization

13x Performance for Export chatlog, update rust_g to 0.4.6-vorestation
This commit is contained in:
Novacat
2020-10-19 23:18:53 -04:00
committed by GitHub
12 changed files with 130 additions and 42 deletions
+1 -5
View File
@@ -119,18 +119,14 @@ GLOBAL_LIST_EMPTY(asset_datums)
if (size[SPRSZ_STRIPPED])
continue
#ifdef RUST_G
// save flattened version
var/fname = "data/spritesheets/[name]_[size_id].png"
fcopy(size[SPRSZ_ICON], fname)
var/error = call(RUST_G, "dmi_strip_metadata")(fname)
var/error = rustg_dmi_strip_metadata(fname)
if(length(error))
stack_trace("Failed to strip [name]_[size_id].png: [error]")
size[SPRSZ_STRIPPED] = icon(fname)
fdel(fname)
#else
#warn It looks like you don't have RUST_G enabled. Without RUST_G, the RPD icons will not function, so it strongly recommended you reenable it.
#endif
/datum/asset/spritesheet/proc/generate_css()
var/list/out = list()
+8 -8
View File
@@ -397,22 +397,22 @@ var/to_chat_src
to_chat(src, "<span class='warning'>Error: Your chat log is already being prepared. Please wait until it's been downloaded before trying to export it again.</span>")
return
o_file = file(o_file)
// Write the CSS file to the log
o_file << "<html><head><style>"
o_file << file2text(file("code/modules/vchat/css/ss13styles.css"))
o_file << "</style></head><body>"
var/text_blob = "<html><head><style>"
text_blob += file2text(file("code/modules/vchat/css/ss13styles.css"))
text_blob += "</style></head><body>"
// Write the messages to the log
for(var/list/result in results)
o_file << "[result["message"]]<br>"
text_blob += "[result["message"]]<br>"
CHECK_TICK
o_file << "</body></html>"
text_blob += "</body></html>"
rustg_file_write(text_blob, o_file)
// Send the log to the client
src << ftp(o_file, "log_[time2text(world.timeofday, "YYYY_MM_DD_(hh_mm)")].html")
src << ftp(file(o_file), "log_[time2text(world.timeofday, "YYYY_MM_DD_(hh_mm)")].html")
// clean up the file on our end
spawn(10 SECONDS)
+2 -8
View File
@@ -187,14 +187,8 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
return FALSE
//Write it out
#ifdef RUST_G
call(RUST_G, "file_write")(json_to_file, path)
#else
// Fall back to using old format if we are not using rust-g
if(fexists(path))
fdel(path) //Byond only supports APPENDING to files, not replacing.
text2file(json_to_file, path)
#endif
rustg_file_write(json_to_file, path)
if(!fexists(path))
log_debug("Saving: [path] failed file write")
return FALSE