diff --git a/desktop/last-release b/desktop/last-release index b6a7d89c..98d9bcb7 100644 --- a/desktop/last-release +++ b/desktop/last-release @@ -1 +1 @@ -16 +17 diff --git a/desktop/src-common/advent/steam.clj b/desktop/src-common/advent/steam.clj index 4a150650..08fb8dba 100644 --- a/desktop/src-common/advent/steam.clj +++ b/desktop/src-common/advent/steam.clj @@ -82,14 +82,13 @@ (.put bb# bytes#) (.fileWrite rs# ~filename bb# (count bytes#)))))) -(defn download-screenshot [filename] - (when (and has-steam? (not (.exists (files! :local filename)))) +(defn get-screenshot-bytes [filename] + (if has-steam? (eval `(let [rs# (SteamRemoteStorage. nil) len# (.getFileSize rs# ~filename) bb# (ByteBuffer/allocateDirect len#) bytes# (make-array Byte/TYPE len#)] (do (.fileRead rs# ~filename bb# len#) (.get bb# bytes#) - (.writeBytes (files! :local ~filename) - bytes# - false)))))) + bytes#))) + (.readBytes (files! :local filename)))) diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index 43342ffc..a792daaa 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -74,12 +74,11 @@ (defn snapshot-screenshots [] (doall (for [snapshot (snapshot-list)] - (do - (steam/download-screenshot (:screenshot snapshot)) - (update-in snapshot [:screenshot] - #(try (Pixmap. (files! :local %) ) - (catch Exception e - (Pixmap. 160 120 Pixmap$Format/RGB888)))))))) + (assoc-in snapshot [:screenshot] + (try (let [bytes (steam/get-screenshot-bytes (:screenshot snapshot))] + (Pixmap. bytes 0 (count bytes))) + (catch Exception e + (Pixmap. 160 120 Pixmap$Format/RGB888))))))) (defn save-chapter [entities chapter] (let [prefs (.getPreferences (Gdx/app) "ticks-tales-saves")