diff --git a/source/gfx/SplashScreenDrawer.cpp b/source/gfx/SplashScreenDrawer.cpp index 5d8f3ae..4f5c57b 100644 --- a/source/gfx/SplashScreenDrawer.cpp +++ b/source/gfx/SplashScreenDrawer.cpp @@ -102,6 +102,19 @@ constexpr uint8_t s_texturePixelShaderCompiled[] = { 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +/** empty png as fallback */ +uint8_t empty_png[119] = { + 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, + 0x08, 0x02, 0x00, 0x00, 0x00, 0xFD, 0xD4, 0x9A, 0x73, 0x00, 0x00, 0x00, + 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xAE, 0xCE, 0x1C, 0xE9, 0x00, 0x00, + 0x00, 0x04, 0x67, 0x41, 0x4D, 0x41, 0x00, 0x00, 0xB1, 0x8F, 0x0B, 0xFC, + 0x61, 0x05, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, + 0x16, 0x25, 0x00, 0x00, 0x16, 0x25, 0x01, 0x49, 0x52, 0x24, 0xF0, 0x00, + 0x00, 0x00, 0x0C, 0x49, 0x44, 0x41, 0x54, 0x18, 0x57, 0x63, 0x40, 0x02, + 0x0C, 0x0C, 0x00, 0x00, 0x0E, 0x00, 0x01, 0x7A, 0xB1, 0xB9, 0x30, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82}; + static GX2Texture *LoadImageAsTexture(std::string_view path) { std::vector buffer; if (LoadFileIntoBuffer(std::string(path).append("splash.png"), buffer)) { @@ -115,7 +128,7 @@ static GX2Texture *LoadImageAsTexture(std::string_view path) { return texture; } } - return nullptr; + return PNG_LoadTexture(empty_png); } SplashScreenDrawer::SplashScreenDrawer(std::string_view splash_base_path) { diff --git a/source/main.cpp b/source/main.cpp index dd01ca9..c669a3e 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -17,16 +17,12 @@ int32_t main(int32_t argc, char **argv) { basePath = argv[0]; } - if (existsAsFile(basePath + "/splash.png") || existsAsFile(basePath + "/splash.tga")) { - GfxInit(); - { - SplashScreenDrawer splashScreenDrawer(basePath + "/"); - splashScreenDrawer.Draw(); - } - GfxShutdown(); - } else { - DEBUG_FUNCTION_LINE_INFO("No splash.png or splash.tga found in \"%s\". Skipping splash screen.", basePath.c_str()); + GfxInit(); + { + SplashScreenDrawer splashScreenDrawer(basePath + "/"); + splashScreenDrawer.Draw(); } + GfxShutdown(); deinitLogging(); diff --git a/source/utils/utils.h b/source/utils/utils.h index 8f2ab93..8fe92b9 100644 --- a/source/utils/utils.h +++ b/source/utils/utils.h @@ -6,14 +6,3 @@ #include bool LoadFileIntoBuffer(std::string_view path, std::vector &buffer); - -static inline bool existsAsFile(std::string_view path) { - struct stat st {}; - if (stat(path.data(), &st) >= 0 && S_ISREG(st.st_mode)) { - DEBUG_FUNCTION_LINE_VERBOSE("\"%s\" exists", path.data()); - return true; - } else { - DEBUG_FUNCTION_LINE_VERBOSE("\"%s\" doesn't exists", path.data()); - } - return false; -} \ No newline at end of file