diff --git a/CMakeLists.txt b/CMakeLists.txt
index b185f52865..f0106f9e92 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -828,6 +828,8 @@ add_library(Common STATIC
Common/Net/WebsocketServer.h
Common/Profiler/Profiler.cpp
Common/Profiler/Profiler.h
+ Common/Render/AtlasGen.cpp
+ Common/Render/AtlasGen.h
Common/Render/TextureAtlas.cpp
Common/Render/TextureAtlas.h
Common/Render/DrawBuffer.cpp
diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj
index 7bea24a69d..518217997b 100644
--- a/Common/Common.vcxproj
+++ b/Common/Common.vcxproj
@@ -463,6 +463,7 @@
+
@@ -917,6 +918,7 @@
+
diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters
index 10c2cc8417..d384e88d47 100644
--- a/Common/Common.vcxproj.filters
+++ b/Common/Common.vcxproj.filters
@@ -689,6 +689,9 @@
Audio
+
+ Render
+
@@ -1290,6 +1293,9 @@
ext\imgui
+
+ Render
+
diff --git a/Common/Render/AtlasGen.cpp b/Common/Render/AtlasGen.cpp
new file mode 100644
index 0000000000..071fefd607
--- /dev/null
+++ b/Common/Render/AtlasGen.cpp
@@ -0,0 +1,249 @@
+
+#include
+#include
+#include
+#include
@@ -999,6 +1002,9 @@
ext\imgui
+
+ Render
+
diff --git a/Windows/WASAPIContext.cpp b/Windows/WASAPIContext.cpp
index 1b622df3ba..368a2d2eeb 100644
--- a/Windows/WASAPIContext.cpp
+++ b/Windows/WASAPIContext.cpp
@@ -345,12 +345,14 @@ void WASAPIContext::AudioLoop() {
if (framesToWrite > 0 && SUCCEEDED(renderClient_->GetBuffer(framesToWrite, &buffer))) {
if (!tempBuf_) {
// Mix directly to the output buffer, avoiding a copy.
- callback_(reinterpret_cast(buffer), framesToWrite, format_->nSamplesPerSec, userdata_);
+ if (buffer) {
+ callback_(reinterpret_cast(buffer), framesToWrite, format_->nSamplesPerSec, userdata_);
+ }
} else {
// We decided previously that we need conversion, so mix to our temp buffer...
callback_(tempBuf_, framesToWrite, format_->nSamplesPerSec, userdata_);
// .. and convert according to format (we support multi-channel float and s16)
- if (format == AudioFormat::S16) {
+ if (format == AudioFormat::S16 && buffer) {
// Need to convert.
s16 *dest = reinterpret_cast(buffer);
for (UINT32 i = 0; i < framesToWrite; i++) {
@@ -367,7 +369,7 @@ void WASAPIContext::AudioLoop() {
}
}
}
- } else if (format == AudioFormat::Float) {
+ } else if (format == AudioFormat::Float && buffer) {
// We have a non-2 number of channels (since we're in the tempBuf_ 'if'), so we contract/expand.
float *dest = reinterpret_cast(buffer);
for (UINT32 i = 0; i < framesToWrite; i++) {
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index aa551d1152..29c5ea777c 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -324,6 +324,7 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Common/GPU/ShaderTranslation.cpp \
$(SRC)/Common/Render/ManagedTexture.cpp \
$(SRC)/Common/Render/DrawBuffer.cpp \
+ $(SRC)/Common/Render/AtlasGen.cpp \
$(SRC)/Common/Render/TextureAtlas.cpp \
$(SRC)/Common/Render/Text/draw_text.cpp \
$(SRC)/Common/Render/Text/draw_text_android.cpp \
diff --git a/build_fontatlas.sh b/build_fontatlas.sh
index bb5dbfd3ed..41fc74e330 100755
--- a/build_fontatlas.sh
+++ b/build_fontatlas.sh
@@ -1,2 +1,5 @@
-./ext/native/tools/build/atlastool font_atlasscript.txt font 8888 && mv font_atlas.zim font_atlas.meta assets && rm font_atlas.cpp font_atlas.h
-./ext/native/tools/build/atlastool asciifont_atlasscript.txt asciifont 8888 && mv asciifont_atlas.zim asciifont_atlas.meta assets && rm asciifont_atlas.cpp asciifont_atlas.h
+TOOL=./ext/native/tools/build/atlastool
+# TOOL=Windows/ARM64/Debug/AtlasTool.exe
+
+$TOOL font_atlasscript.txt font 8888 && mv font_atlas.zim font_atlas.meta assets && rm font_atlas.cpp font_atlas.h
+$TOOL asciifont_atlasscript.txt asciifont 8888 && mv asciifont_atlas.zim asciifont_atlas.meta assets && rm asciifont_atlas.cpp asciifont_atlas.h
diff --git a/buildatlas.sh b/buildatlas.sh
index 0142b9b0c0..e16c716fc1 100755
--- a/buildatlas.sh
+++ b/buildatlas.sh
@@ -1 +1,4 @@
-./ext/native/tools/build/atlastool ui_atlasscript.txt ui 8888 && mv ui_atlas.zim ui_atlas.meta assets && rm ui_atlas.cpp ui_atlas.h
+TOOL=./ext/native/tools/build/atlastool
+# TOOL=Windows/ARM64/Debug/AtlasTool.exe
+
+$TOOL ui_atlasscript.txt ui 8888 && mv ui_atlas.zim ui_atlas.meta assets && rm ui_atlas.cpp ui_atlas.h
diff --git a/ext/native/tools/atlastool.cpp b/ext/native/tools/atlastool.cpp
index 25b65e373e..a0571b5d11 100644
--- a/ext/native/tools/atlastool.cpp
+++ b/ext/native/tools/atlastool.cpp
@@ -18,25 +18,25 @@
// line height
// dist-per-pixel
+#include
#include
-#include
-#include
-#include
+#include
#include
-#include