From 20420da326ac7910e2a83791366ee253e293523c Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 8 Jul 2023 13:09:05 +1000 Subject: [PATCH] Input/SDL: Don't pass stdio handle to SDL Apparently on cmake, SDL isn't compiled with stdio support... --- pcsx2/Input/SDLInputSource.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pcsx2/Input/SDLInputSource.cpp b/pcsx2/Input/SDLInputSource.cpp index 236e52a56c..eea3babd96 100644 --- a/pcsx2/Input/SDLInputSource.cpp +++ b/pcsx2/Input/SDLInputSource.cpp @@ -225,15 +225,15 @@ void SDLInputSource::SetHints() bool SDLInputSource::LoadControllerDB() { Error error; - std::FILE* fp = - FileSystem::OpenCFile(Path::Combine(EmuFolders::Resources, CONTROLLER_DB_FILENAME).c_str(), "rb", &error); - if (!fp) + auto fp = FileSystem::OpenManagedCFile(Path::Combine(EmuFolders::Resources, CONTROLLER_DB_FILENAME).c_str(), "rb", &error); + std::optional data; + if (!fp || !(data = FileSystem::ReadFileToString(fp.get()))) { Console.Error(fmt::format("SDLInputSource: Failed to open controller database: {}", error.GetDescription())); return false; } - if (SDL_GameControllerAddMappingsFromRW(SDL_RWFromFP(fp, SDL_TRUE), SDL_TRUE) < 0) + if (SDL_GameControllerAddMappingsFromRW(SDL_RWFromConstMem(data->c_str(), data->length()), SDL_TRUE) < 0) { Console.Error(fmt::format("SDLInputSource: SDL_GameControllerAddMappingsFromRW() failed: {}", SDL_GetError())); return false;