aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/util/Base64Util.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-07-22 16:06:07 +0200
committerLinnea Gräf <nea@nea.moe>2024-07-22 16:06:07 +0200
commit4585a11434f44fa0900351825eb3ca38ce64f187 (patch)
tree29e5997ba56b7dd848f594bf360bb40c3a037cd0 /src/main/kotlin/moe/nea/firmament/util/Base64Util.kt
parentd3895dd911b6ef59613bc94feeb2e79b59573c7b (diff)
downloadfirmament-4585a11434f44fa0900351825eb3ca38ce64f187.tar.gz
firmament-4585a11434f44fa0900351825eb3ca38ce64f187.tar.bz2
firmament-4585a11434f44fa0900351825eb3ca38ce64f187.zip
Fix some textures not being loaded to due being misaligned base64 data
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util/Base64Util.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/util/Base64Util.kt15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/Base64Util.kt b/src/main/kotlin/moe/nea/firmament/util/Base64Util.kt
new file mode 100644
index 0000000..d02a23c
--- /dev/null
+++ b/src/main/kotlin/moe/nea/firmament/util/Base64Util.kt
@@ -0,0 +1,15 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.util
+
+object Base64Util {
+ fun String.padToValidBase64(): String {
+ val align = this.length % 4
+ if (align == 0) return this
+ return this + "=".repeat(4 - align)
+ }
+}