aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/fmplayer_fontrom.h6
-rw-r--r--common/fmplayer_fontrom_unix.c5
-rw-r--r--common/fmplayer_fontrom_win.c5
3 files changed, 10 insertions, 6 deletions
diff --git a/common/fmplayer_fontrom.h b/common/fmplayer_fontrom.h
index 7a67133..601cecc 100644
--- a/common/fmplayer_fontrom.h
+++ b/common/fmplayer_fontrom.h
@@ -1,9 +1,11 @@
#ifndef MYON_FMPLAYER_FONTROM_H_INCLUDED
#define MYON_FMPLAYER_FONTROM_H_INCLUDED
+#include <stdbool.h>
+
struct fmdsp_font;
-// always succeeds
-void fmplayer_font_rom_load(struct fmdsp_font *font);
+// true if font rom available, false if using alternatives
+bool fmplayer_font_rom_load(struct fmdsp_font *font);
#endif // MYON_FMPLAYER_FONTROM_H_INCLUDED
diff --git a/common/fmplayer_fontrom_unix.c b/common/fmplayer_fontrom_unix.c
index bb8f12e..238be9c 100644
--- a/common/fmplayer_fontrom_unix.c
+++ b/common/fmplayer_fontrom_unix.c
@@ -13,7 +13,7 @@ static struct {
uint8_t fontrombuf[FONT_ROM_FILESIZE];
} g;
-void fmplayer_font_rom_load(struct fmdsp_font *font) {
+bool fmplayer_font_rom_load(struct fmdsp_font *font) {
const char *path = "font.rom";
const char *home = getenv("HOME");
char *dpath = 0;
@@ -40,9 +40,10 @@ void fmplayer_font_rom_load(struct fmdsp_font *font) {
goto err;
}
fclose(f);
- return;
+ return true;
err:
if (f) fclose(f);
fmdsp_font_from_font_rom(font, fmdsp_shinonome_font_rom);
+ return false;
}
diff --git a/common/fmplayer_fontrom_win.c b/common/fmplayer_fontrom_win.c
index 8ba8300..4f9ed12 100644
--- a/common/fmplayer_fontrom_win.c
+++ b/common/fmplayer_fontrom_win.c
@@ -13,7 +13,7 @@ static struct {
bool font_rom_loaded;
} g;
-void fmplayer_font_rom_load(struct fmdsp_font *font) {
+bool fmplayer_font_rom_load(struct fmdsp_font *font) {
const wchar_t *path = L"font.rom";
wchar_t exepath[MAX_PATH];
if (GetModuleFileNameW(0, exepath, MAX_PATH)) {
@@ -33,8 +33,9 @@ void fmplayer_font_rom_load(struct fmdsp_font *font) {
CloseHandle(file);
fmdsp_font_from_font_rom(font, g.fontrombuf);
g.font_rom_loaded = true;
- return;
+ return true;
err:
if (file != INVALID_HANDLE_VALUE) CloseHandle(file);
fmdsp_font_win(font);
+ return false;
}