From 398019867ba57e9cefb6ff0a67c34fca26291701 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Sun, 29 Sep 2024 20:47:55 -0700 Subject: [PATCH] sdl: Fix use of functions that now return SDL_bool (#1160) --- src/audio_core/sdl_audio.cpp | 6 +++--- src/input/controller.cpp | 2 +- src/sdl_window.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/audio_core/sdl_audio.cpp b/src/audio_core/sdl_audio.cpp index f544c52f9..9aec70c24 100644 --- a/src/audio_core/sdl_audio.cpp +++ b/src/audio_core/sdl_audio.cpp @@ -101,14 +101,14 @@ s32 SDLAudio::AudioOutOutput(s32 handle, const void* ptr) { return 0; } // TODO mixing channels - int result = SDL_PutAudioStreamData(port.stream, ptr, - port.samples_num * port.sample_size * port.channels_num); + SDL_bool result = SDL_PutAudioStreamData( + port.stream, ptr, port.samples_num * port.sample_size * port.channels_num); // TODO find a correct value 8192 is estimated while (SDL_GetAudioStreamAvailable(port.stream) > 65536) { SDL_Delay(0); } - return result; + return result ? ORBIS_OK : -1; } bool SDLAudio::AudioOutSetVolume(s32 handle, s32 bitflag, s32* volume) { diff --git a/src/input/controller.cpp b/src/input/controller.cpp index 4de6d83b8..dcd8ed946 100644 --- a/src/input/controller.cpp +++ b/src/input/controller.cpp @@ -127,7 +127,7 @@ void GameController::SetLightBarRGB(u8 r, u8 g, u8 b) { bool GameController::SetVibration(u8 smallMotor, u8 largeMotor) { if (m_sdl_gamepad != nullptr) { return SDL_RumbleGamepad(m_sdl_gamepad, (smallMotor / 255.0f) * 0xFFFF, - (largeMotor / 255.0f) * 0xFFFF, -1) == 0; + (largeMotor / 255.0f) * 0xFFFF, -1); } return true; } diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index f7835aabe..bd2cc39d2 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -23,7 +23,7 @@ namespace Frontend { WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_, std::string_view window_title) : width{width_}, height{height_}, controller{controller_} { - if (SDL_Init(SDL_INIT_VIDEO) < 0) { + if (!SDL_Init(SDL_INIT_VIDEO)) { UNREACHABLE_MSG("Failed to initialize SDL video subsystem: {}", SDL_GetError()); } SDL_InitSubSystem(SDL_INIT_AUDIO);