From 3ed1459568c97caf8e1869d21d6dd71e5e37255a Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Murcia Date: Mon, 4 Apr 2022 21:00:03 +0200 Subject: [PATCH] If SDL initialization fails, the background will still start but show an error to let the user know why the sound doesn't work Signed-off-by: Alexis Maiquez Murcia --- .../background-doesn-t-load-properly.md | 13 +++++++++---- main.cpp | 10 ++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/background-doesn-t-load-properly.md b/.github/ISSUE_TEMPLATE/background-doesn-t-load-properly.md index 4a6e41f..cc2e20b 100644 --- a/.github/ISSUE_TEMPLATE/background-doesn-t-load-properly.md +++ b/.github/ISSUE_TEMPLATE/background-doesn-t-load-properly.md @@ -8,19 +8,24 @@ assignees: Almamu --- -**Wallpaper Engine Background** -A link to the background in the steam workshop or it's background ID. +**Wallpaper Engine Background(s)** + +Link(s) to the backgorund(s) in the steam workshop or their background ID(s). **Console output** + When a background cannot be loaded It's usually due to some unexpected error that is logged into the terminal. Please attach the program's output so we can properly debug it if needed. **Screenshots** + If you have any screenshot of it working on Windows that'll help so we can compare both outputs **Desktop (please complete the following information):** - - OS: [e.g. Arch Linux] + +- OS: [e.g. Arch Linux] - Desktop Environment: [e.g. GNOME, CINNAMON, KDE...] - Window Manager: [if in doubt, just leave it empty] **Additional context** -Any additional information about your setup (like + +Any additional information about your setup \ No newline at end of file diff --git a/main.cpp b/main.cpp index 09ddd6a..e47266c 100644 --- a/main.cpp +++ b/main.cpp @@ -345,12 +345,14 @@ int main (int argc, char* argv[]) { // Mix_GetError is an alias for SDL_GetError, so calling it directly will yield the correct result // it doesn't matter if SDL_Init or Mix_Init failed, both report the errors through the same functions - fprintf (stderr, "Cannot initialize SDL audio system, SDL_GetError: %s", SDL_GetError ()); - return 2; + std::cerr << "Cannot initialize SDL audio system, SDL_GetError: " << SDL_GetError() << std::endl; + std::cerr << "Continuing without audio support" << std::endl; + shouldEnableAudio = false; } - // initialize audio engine - Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640); + // initialize audio engine if it should be + if (shouldEnableAudio) + Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640); } // TODO: FIGURE OUT THE REQUIRED INPUT MODE, AS SOME WALLPAPERS USE THINGS LIKE MOUSE POSITION