From 57a8699152fbb16d1fbb1c5e7e60af8dc8c5b652 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 21 Jun 2022 21:17:22 +1000 Subject: [PATCH] OpenBSD: Fix being unable to start due to unable being able to find a supported font (Thanks zielony12, addresses #954) --- src/Audio.c | 9 +++------ src/Drawer2D.h | 2 +- src/Platform_Posix.c | 16 +++++++++++----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Audio.c b/src/Audio.c index e3a693480..381886218 100644 --- a/src/Audio.c +++ b/src/Audio.c @@ -1306,13 +1306,10 @@ static void Music_RunLoop(void) { if (res) { Logger_SysWarn2(res, "opening", &path); break; } res = Music_PlayOgg(&stream); - if (res) { - Logger_SimpleWarn2(res, "playing", &path); - stream.Close(&stream); break; - } + if (res) { Logger_SimpleWarn2(res, "playing", &path); } - res = stream.Close(&stream); - if (res) { Logger_SysWarn2(res, "closing", &path); break; } + /* No point logging error for closing readonly file */ + (void)stream.Close(&stream); if (music_stopping) break; delay = Random_Range(&rnd, music_minDelay, music_maxDelay); diff --git a/src/Drawer2D.h b/src/Drawer2D.h index 3f89d801e..e4e005125 100644 --- a/src/Drawer2D.h +++ b/src/Drawer2D.h @@ -91,7 +91,7 @@ char Drawer2D_LastColor(const cc_string* text, int start); cc_bool Drawer2D_IsWhiteColor(char c); cc_bool Drawer2D_UNSAFE_NextPart(cc_string* left, cc_string* part, BitmapCol* color); -/* Allocates a new instance of the default font using the given size and flags +/* Allocates a new instance of the default font using the given size and flags */ /* Uses Font_MakeBitmapped or SysFont_MakeDefault depending on Drawer2D_BitmappedText */ CC_API void Font_Make(struct FontDesc* desc, int size, int flags); /* Frees an allocated font */ diff --git a/src/Platform_Posix.c b/src/Platform_Posix.c index 47cbd3cb0..b2a856b2c 100644 --- a/src/Platform_Posix.c +++ b/src/Platform_Posix.c @@ -421,28 +421,34 @@ static void FontDirCallback(const cc_string* path, void* obj) { void Platform_LoadSysFonts(void) { int i; #if defined CC_BUILD_ANDROID - static const cc_string dirs[3] = { + static const cc_string dirs[] = { String_FromConst("/system/fonts"), String_FromConst("/system/font"), String_FromConst("/data/fonts"), }; #elif defined CC_BUILD_NETBSD - static const cc_string dirs[3] = { + static const cc_string dirs[] = { String_FromConst("/usr/X11R7/lib/X11/fonts"), String_FromConst("/usr/pkg/lib/X11/fonts"), String_FromConst("/usr/pkg/share/fonts") }; +#elif defined CC_BUILD_OPENBSD + static const cc_string dirs[] = { + String_FromConst("/usr/X11R6/lib/X11/fonts"), + String_FromConst("/usr/share/fonts"), + String_FromConst("/usr/local/share/fonts") + }; #elif defined CC_BUILD_HAIKU - static const cc_string dirs[1] = { + static const cc_string dirs[] = { String_FromConst("/system/data/fonts") }; #elif defined CC_BUILD_DARWIN - static const cc_string dirs[2] = { + static const cc_string dirs[] = { String_FromConst("/System/Library/Fonts"), String_FromConst("/Library/Fonts") }; #else - static const cc_string dirs[2] = { + static const cc_string dirs[] = { String_FromConst("/usr/share/fonts"), String_FromConst("/usr/local/share/fonts") };