From e04cbc061b248fda1d1538770cf4f903e5f3807c Mon Sep 17 00:00:00 2001 From: ZakatTeamI2P Date: Mon, 30 Mar 2026 20:11:38 +0400 Subject: [PATCH] edgophrsfhoip[wrj[iyn53 --- src/input.cpp | 4 ++-- src/keybindings.cpp | 24 ++++++++++++------------ src/keybindings.h | 6 +++--- src/main.cpp | 36 +++++++++++++++++------------------- src/oneshot.cpp | 13 +++++++++---- 5 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index e1ed663..82ca688 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -26,8 +26,8 @@ #include "exception.h" #include "util.h" -#include -#include +#include +#include #include #include diff --git a/src/keybindings.cpp b/src/keybindings.cpp index 84976ab..b1bb4cf 100644 --- a/src/keybindings.cpp +++ b/src/keybindings.cpp @@ -107,18 +107,18 @@ static elementsN(defaultKbBindings); static const GcBindingData defaultGcBindings[] = { - { SDL_CONTROLLER_BUTTON_DPAD_LEFT, Input::Left }, - { SDL_CONTROLLER_BUTTON_DPAD_RIGHT, Input::Right }, - { SDL_CONTROLLER_BUTTON_DPAD_UP, Input::Up }, - { SDL_CONTROLLER_BUTTON_DPAD_DOWN, Input::Down }, - { SDL_CONTROLLER_BUTTON_A, Input::Action }, - { SDL_CONTROLLER_BUTTON_B, Input::Cancel }, - { SDL_CONTROLLER_BUTTON_X, Input::Run }, - { SDL_CONTROLLER_BUTTON_Y, Input::Items }, - { SDL_CONTROLLER_BUTTON_START, Input::Menu }, - { SDL_CONTROLLER_BUTTON_BACK, Input::Deactivate }, - { SDL_CONTROLLER_BUTTON_LEFTSHOULDER, Input::L }, - { SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, Input::R }, + { SDL_GAMEPAD_BUTTON_DPAD_LEFT, Input::Left }, + { SDL_GAMEPAD_BUTTON_DPAD_RIGHT, Input::Right }, + { SDL_GAMEPAD_BUTTON_DPAD_UP, Input::Up }, + { SDL_GAMEPAD_BUTTON_DPAD_DOWN, Input::Down }, + { SDL_GAMEPAD_BUTTON_A, Input::Action }, + { SDL_GAMEPAD_BUTTON_B, Input::Cancel }, + { SDL_GAMEPAD_BUTTON_X, Input::Run }, + { SDL_GAMEPAD_BUTTON_Y, Input::Items }, + { SDL_GAMEPAD_BUTTON_START, Input::Menu }, + { SDL_GAMEPAD_BUTTON_BACK, Input::Deactivate }, + { SDL_GAMEPAD_BUTTON_LEFTSHOULDER, Input::L }, + { SDL_GAMEPAD_BUTTON_RIGHTSHOULDER, Input::R }, }; static elementsN(defaultGcBindings); diff --git a/src/keybindings.h b/src/keybindings.h index c843701..fcb7429 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -24,9 +24,9 @@ #include "input.h" -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/src/main.cpp b/src/main.cpp index fa71c1b..7c2e129 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,10 +21,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include #ifdef _MSC_VER @@ -107,7 +107,7 @@ int rgssThreadFun(void *userdata) catch (const Exception &exc) { rgssThreadError(threadData, exc.msg); - SDL_GL_DeleteContext(glCtx); + SDL_GL_DestroyContext(glCtx); return 0; } @@ -149,7 +149,7 @@ int rgssThreadFun(void *userdata) { rgssThreadError(threadData, exc.msg); alcDestroyContext(alcCtx); - SDL_GL_DeleteContext(glCtx); + SDL_GL_DestroyContext(glCtx); return 0; } @@ -163,7 +163,7 @@ int rgssThreadFun(void *userdata) SharedState::finiInstance(); alcDestroyContext(alcCtx); - SDL_GL_DeleteContext(glCtx); + SDL_GL_DestroyContext(glCtx); return 0; } @@ -171,24 +171,24 @@ int rgssThreadFun(void *userdata) static void showInitError(const std::string &msg) { Debug() << msg; - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OneShot", msg.c_str(), 0); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OneShot: sunshine", msg.c_str(), 0); } static void setupWindowIcon(const Config &conf, SDL_Window *win) { - SDL_RWops *iconSrc; + SDL_IOStream *iconSrc; if (conf.iconPath.empty()) - iconSrc = SDL_RWFromConstMem(assets_icon_png, assets_icon_png_len); + iconSrc = SDL_IOFromConstMem(assets_icon_png, assets_icon_png_len); else - iconSrc = SDL_RWFromFile(conf.iconPath.c_str(), "rb"); + iconSrc = SDL_IOFromFile(conf.iconPath.c_str(), "rb"); - SDL_Surface *iconImg = IMG_Load_RW(iconSrc, SDL_TRUE); + SDL_Surface *iconImg = IMG_Load_IO(iconSrc, true); if (iconImg) { SDL_SetWindowIcon(win, iconImg); - SDL_FreeSurface(iconImg); + SDL_DestroySurface(iconImg); } } @@ -337,10 +337,8 @@ int main(int argc, char *argv[]) if (conf.fullscreen) winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; - - win = SDL_CreateWindow(conf.windowTitle.c_str(), - SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, - conf.defScreenW, conf.defScreenH, winFlags); + //SDL_CreateWindow() has been simplified and no longer takes a window position. + win = SDL_CreateWindow(conf.windowTitle.c_str(), conf.defScreenW, conf.defScreenH, winFlags); if (!win) { @@ -382,9 +380,9 @@ int main(int argc, char *argv[]) #ifndef STEAM /* Add controller bindings from embedded controller DB */ - SDL_RWops *controllerDB = SDL_RWFromConstMem(assets_gamecontrollerdb_txt, + SDL_IOStream *controllerDB = SDL_IOFromConstMem(assets_gamecontrollerdb_txt, assets_gamecontrollerdb_txt_len); - SDL_GameControllerAddMappingsFromRW(controllerDB, 1); + SDL_AddGamepadMappingsFromIO(controllerDB, 1); #endif int winW, winH; diff --git a/src/oneshot.cpp b/src/oneshot.cpp index bc9e275..2f7740c 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -9,9 +9,9 @@ #include "bitmap.h" #include "font.h" -#include -#include -#include +#include +#include +#include // OS-Specific code #if defined _WIN32 @@ -311,6 +311,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : desktopEnv = "kde"; } else if (desktop.find("lxde") != std::string::npos) { desktopEnv = "lxde"; + } else if (desktop.find("lxde") != std::string::npos) { + desktopEnv = "lxqt"; } else if (desktop.find("deepin") != std::string::npos) { desktopEnv = "deepin"; } @@ -355,6 +357,9 @@ void Oneshot::update() screenRect.w = 640; screenRect.h = 480; + int num_displays; + SDL_DisplayID *displays = SDL_GetDisplays(&num_displays) + //Update obscured map and texture for window portion offscreen for (int i = 0, max = SDL_GetNumVideoDisplays(); i < max; ++i) { @@ -363,7 +368,7 @@ void Oneshot::update() //Get intersection of window and the screen SDL_Rect intersect; - if (!SDL_IntersectRect(&screenRect, &bounds, &intersect)) + if (!SDL_GetRectIntersection(&screenRect, &bounds, &intersect)) continue; intersect.x -= screenRect.x; intersect.y -= screenRect.y;