Merge branch 'master' of ssh://femoz.anipic.ru:222/Sunshine/mkxp-sunshine

This commit is contained in:
DepressedTWM 2026-06-26 22:33:30 +04:00
commit 90a3444c4d
1 changed files with 12 additions and 8 deletions

View File

@ -68,7 +68,7 @@ struct OneshotPrivate{
bool allowExit; bool allowExit;
// Alpha texture data for portions of window obscured by screen edges // Alpha texture data for portions of window obscured by screen edges
int winX, winY; int winX, winY, winW, winH;
SDL_Mutex *winMutex; SDL_Mutex *winMutex;
bool winPosChanged; bool winPosChanged;
std::vector<uint8_t> obscuredMap; std::vector<uint8_t> obscuredMap;
@ -170,10 +170,11 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
p = new OneshotPrivate(); p = new OneshotPrivate();
p->window = threadData.window; p->window = threadData.window;
p->savePath = threadData.config.commonDataPath.substr(0, threadData.config.commonDataPath.size() - 1); p->savePath = threadData.config.commonDataPath.substr(0, threadData.config.commonDataPath.size() - 1);
p->obscuredMap.resize(threadData.config.defScreenW * threadData.config.defScreenH, 255);
obscuredDirty = true;
p->winX = 0; p->winX = 0;
p->winY = 0; p->winY = 0;
SDL_GetWindowSize(p->window, &p->winW, &p->winH);
p->obscuredMap.resize(p->winW * p->winH, 255);
obscuredDirty = true;
p->winPosChanged = false; p->winPosChanged = false;
p->allowExit = true; p->allowExit = true;
p->exiting = false; p->exiting = false;
@ -335,17 +336,19 @@ void Oneshot::update(){
screenRect.x = p->winX; screenRect.x = p->winX;
screenRect.y = p->winY; screenRect.y = p->winY;
SDL_UnlockMutex(p->winMutex); SDL_UnlockMutex(p->winMutex);
screenRect.w = conf.defScreenW; screenRect.w = p->winW;
screenRect.h = conf.defScreenH; screenRect.h = p->winH;
//костыль ебучий //костыль ебучий
int num_displays; int num_displays;
SDL_DisplayID *displays = SDL_GetDisplays(&num_displays); SDL_DisplayID *displays = SDL_GetDisplays(&num_displays);
SDL_free(displays); if (!displays)
printf("SDL_GetDisplays failed (oneshot.cpp)\n");
//Update obscured map and texture for window portion offscreen //Update obscured map and texture for window portion offscreen
for (int i = 0, max = num_displays; i < max; ++i){ for (int i = 0, max = num_displays; i < max; ++i){
SDL_Rect bounds; SDL_Rect bounds;
SDL_GetDisplayBounds(i, &bounds); if (!SDL_GetDisplayBounds(displays[i], &bounds))
printf("SDL_GetDisplayBounds failed (oneshot.cpp)\n");
//Get intersection of window and the screen //Get intersection of window and the screen
SDL_Rect intersect; SDL_Rect intersect;
@ -360,10 +363,11 @@ void Oneshot::update(){
return; return;
for (int y = intersect.y; y < intersect.y + intersect.h; ++y){ for (int y = intersect.y; y < intersect.y + intersect.h; ++y){
int start = y * 640 + intersect.x; int start = y * p->winW + intersect.x;
std::fill(obscuredFrame.begin() + start, obscuredFrame.begin() + (start + intersect.w), false); std::fill(obscuredFrame.begin() + start, obscuredFrame.begin() + (start + intersect.w), false);
} }
} }
SDL_free(displays);
//Update the obscured map, and return prematurely if we don't have any changes //Update the obscured map, and return prematurely if we don't have any changes
//to make to the texture //to make to the texture