[Scummvm-git-logs] scummvm master -> d9f2a6296d2eaac5c9bb57bead0976471fa27ad4
spleen1981
noreply at scummvm.org
Wed Nov 13 12:07:34 UTC 2024
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6349e5f085 LIBRETRO: use _overlayVisible to choose active surface
199d5ec885 LIBRETRO: simplify delayMillis
3a019c1c4c LIBRETRO: remove unneeded context reset
d874e5795c LIBRETRO: add launcher redraw on resolution change
d9f2a6296d LIBRETRO: limit cursor scaling to overlays
Commit: 6349e5f0859cbef8082d54ad8df142cb75330a02
https://github.com/scummvm/scummvm/commit/6349e5f0859cbef8082d54ad8df142cb75330a02
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-11-13T13:06:00+01:00
Commit Message:
LIBRETRO: use _overlayVisible to choose active surface
Changed paths:
backends/platform/libretro/src/libretro-graphics-surface.cpp
diff --git a/backends/platform/libretro/src/libretro-graphics-surface.cpp b/backends/platform/libretro/src/libretro-graphics-surface.cpp
index b5615aa9db5..bbff18d9dbb 100644
--- a/backends/platform/libretro/src/libretro-graphics-surface.cpp
+++ b/backends/platform/libretro/src/libretro-graphics-surface.cpp
@@ -126,7 +126,7 @@ void LibretroGraphics::updateScreen() {
}
void LibretroGraphics::realUpdateScreen(void) {
- const Graphics::Surface &srcSurface = (_overlayInGUI) ? _overlay : _gameScreen;
+ const Graphics::Surface &srcSurface = (_overlayVisible) ? _overlay : _gameScreen;
if (srcSurface.w && srcSurface.h)
_screen.blitFrom(srcSurface, Common::Rect(srcSurface.w,srcSurface.h),Common::Rect(_screen.w,_screen.h),&_gamePalette);
Commit: 199d5ec885cf09afb1ca827987cd1739cb7c76d0
https://github.com/scummvm/scummvm/commit/199d5ec885cf09afb1ca827987cd1739cb7c76d0
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-11-13T13:06:13+01:00
Commit Message:
LIBRETRO: simplify delayMillis
Changed paths:
backends/platform/libretro/include/libretro-os.h
backends/platform/libretro/include/libretro-timer.h
backends/platform/libretro/src/libretro-os-base.cpp
backends/platform/libretro/src/libretro-os-events.cpp
backends/platform/libretro/src/libretro-timer.cpp
diff --git a/backends/platform/libretro/include/libretro-os.h b/backends/platform/libretro/include/libretro-os.h
index a7c3dcf3437..32a1b052270 100644
--- a/backends/platform/libretro/include/libretro-os.h
+++ b/backends/platform/libretro/include/libretro-os.h
@@ -91,7 +91,6 @@ public:
void getScreen(const Graphics::ManagedSurface *&screen);
int16 getScreenWidth(void);
int16 getScreenHeight(void);
- bool isOverlayInGUI(void);
bool inLauncher(void);
#ifdef USE_OPENGL
diff --git a/backends/platform/libretro/include/libretro-timer.h b/backends/platform/libretro/include/libretro-timer.h
index 9ea4ad7e857..f85fcbfdf91 100644
--- a/backends/platform/libretro/include/libretro-timer.h
+++ b/backends/platform/libretro/include/libretro-timer.h
@@ -35,7 +35,7 @@ public:
LibretroTimerManager(uint32 refresh_rate);
~LibretroTimerManager(void) {};
void switchThread(uint8 caller = 0);
- void checkThread(uint8 caller = 0);
+ bool checkThread(uint8 caller = 0);
uint32 timeToNextSwitch(void);
uint32 spentOnMainThread(void);
uint8 getThreadSwitchCaller(void);
diff --git a/backends/platform/libretro/src/libretro-os-base.cpp b/backends/platform/libretro/src/libretro-os-base.cpp
index 49b713816f8..17565096d84 100644
--- a/backends/platform/libretro/src/libretro-os-base.cpp
+++ b/backends/platform/libretro/src/libretro-os-base.cpp
@@ -144,15 +144,6 @@ int16 OSystem_libretro::getScreenHeight(void){
return dynamic_cast<WindowedGraphicsManager *>(_graphicsManager)->getWindowHeight();
}
-bool OSystem_libretro::isOverlayInGUI(void) {
-#ifdef USE_OPENGL
- if (retro_get_video_hw_mode() & VIDEO_GRAPHIC_MODE_REQUEST_HW)
- return dynamic_cast<LibretroOpenGLGraphics *>(_graphicsManager)->isOverlayInGUI();
- else
-#endif
- return dynamic_cast<LibretroGraphics *>(_graphicsManager)->isOverlayInGUI();
-}
-
void OSystem_libretro::resetGraphicsManager(void) {
if (_graphicsManager) {
diff --git a/backends/platform/libretro/src/libretro-os-events.cpp b/backends/platform/libretro/src/libretro-os-events.cpp
index a3f0d36c99b..b03959268af 100644
--- a/backends/platform/libretro/src/libretro-os-events.cpp
+++ b/backends/platform/libretro/src/libretro-os-events.cpp
@@ -53,22 +53,15 @@ void OSystem_libretro::delayMillis(uint msecs) {
while (elapsed_time < msecs) {
/* When remaining delay would take us past the next thread switch time, we switch immediately
in order to burn as much as possible delay time in the main RetroArch thread as soon as possible. */
- if (msecs - elapsed_time >= ((LibretroTimerManager *)_timerManager)->timeToNextSwitch() && !isOverlayInGUI())
- ((LibretroTimerManager *)_timerManager)->checkThread(THREAD_SWITCH_DELAY);
+ if (msecs - elapsed_time >= ((LibretroTimerManager *)_timerManager)->timeToNextSwitch())
+ ((LibretroTimerManager *)_timerManager)->switchThread(THREAD_SWITCH_DELAY);
else
usleep(1000);
-
- /* Actual delay provided will be lower than requested: elapsed time is calculated cumulatively.
- i.e. the higher the requested delay, the higher the actual delay reduction */
- elapsed_time += getMillis() - start_time;
+ elapsed_time = getMillis() - start_time;
}
} else {
while (elapsed_time < msecs) {
- /* if remaining delay is lower than last amount of time spent on main thread, burn it in emu thread
- to avoid exceeding requested delay */
- if (msecs - elapsed_time >= ((LibretroTimerManager *)_timerManager)->spentOnMainThread() && !((LibretroTimerManager *)_timerManager)->timeToNextSwitch() && !isOverlayInGUI())
- ((LibretroTimerManager *)_timerManager)->checkThread(THREAD_SWITCH_DELAY);
- else
+ if (!((LibretroTimerManager *)_timerManager)->checkThread(THREAD_SWITCH_DELAY))
usleep(1000);
elapsed_time = getMillis() - start_time;
}
diff --git a/backends/platform/libretro/src/libretro-timer.cpp b/backends/platform/libretro/src/libretro-timer.cpp
index 3c41fae237d..3fb387fb805 100644
--- a/backends/platform/libretro/src/libretro-timer.cpp
+++ b/backends/platform/libretro/src/libretro-timer.cpp
@@ -38,9 +38,12 @@ void LibretroTimerManager::switchThread(uint8 caller) {
handler();
}
-void LibretroTimerManager::checkThread(uint8 caller) {
- if (g_system->getMillis() >= _nextSwitchTime)
+bool LibretroTimerManager::checkThread(uint8 caller) {
+ if (g_system->getMillis() >= _nextSwitchTime) {
switchThread(caller);
+ return true;
+ } else
+ return false;
}
uint32 LibretroTimerManager::timeToNextSwitch(void) {
Commit: 3a019c1c4c49493190d57b953275321c9ec7e89c
https://github.com/scummvm/scummvm/commit/3a019c1c4c49493190d57b953275321c9ec7e89c
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-11-13T13:06:29+01:00
Commit Message:
LIBRETRO: remove unneeded context reset
Changed paths:
backends/platform/libretro/src/libretro-core.cpp
diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index acb368057da..c9bb1e2e90d 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -1121,9 +1121,6 @@ void retro_run(void) {
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &info);
av_status &= ~(AV_STATUS_UPDATE_AV_INFO | AV_STATUS_UPDATE_GEOMETRY);
-#ifdef USE_OPENGL
- context_reset();
-#endif
}
if (av_status & AUDIO_STATUS_UPDATE_LATENCY) {
Commit: d874e5795c5b22759f3b8be8fcfd28de352ae906
https://github.com/scummvm/scummvm/commit/d874e5795c5b22759f3b8be8fcfd28de352ae906
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-11-13T13:06:42+01:00
Commit Message:
LIBRETRO: add launcher redraw on resolution change
Changed paths:
backends/platform/libretro/src/libretro-graphics-opengl.cpp
diff --git a/backends/platform/libretro/src/libretro-graphics-opengl.cpp b/backends/platform/libretro/src/libretro-graphics-opengl.cpp
index 11fdf54da70..641f617a78b 100644
--- a/backends/platform/libretro/src/libretro-graphics-opengl.cpp
+++ b/backends/platform/libretro/src/libretro-graphics-opengl.cpp
@@ -66,8 +66,11 @@ void LibretroOpenGLGraphics::overrideCursorScaling(){
}
void LibretroOpenGLGraphics::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
+ bool force_gui_redraw = false;
/* Override for ScummVM Launcher */
if (nullptr == ConfMan.getActiveDomain()){
+ /* 0 w/h is used to notify libretro gui res settings is changed */
+ force_gui_redraw = (width == 0);
width = retro_setting_get_gui_res_w();
height = retro_setting_get_gui_res_h();
}
@@ -79,6 +82,9 @@ void LibretroOpenGLGraphics::initSize(uint width, uint height, const Graphics::P
handleResize(width, height);
OpenGL::OpenGLGraphicsManager::initSize(width, height, format);
LIBRETRO_G_SYSTEM->refreshRetroSettings();
+
+ if (force_gui_redraw)
+ g_gui.checkScreenChange();
}
OSystem::TransactionError LibretroOpenGLGraphics::endGFXTransaction() {
Commit: d9f2a6296d2eaac5c9bb57bead0976471fa27ad4
https://github.com/scummvm/scummvm/commit/d9f2a6296d2eaac5c9bb57bead0976471fa27ad4
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-11-13T13:06:57+01:00
Commit Message:
LIBRETRO: limit cursor scaling to overlays
As game screen is always drawn at original resolution
Changed paths:
backends/platform/libretro/src/libretro-graphics-opengl.cpp
backends/platform/libretro/src/libretro-graphics-surface.cpp
diff --git a/backends/platform/libretro/src/libretro-graphics-opengl.cpp b/backends/platform/libretro/src/libretro-graphics-opengl.cpp
index 641f617a78b..ec2669f01a5 100644
--- a/backends/platform/libretro/src/libretro-graphics-opengl.cpp
+++ b/backends/platform/libretro/src/libretro-graphics-opengl.cpp
@@ -55,7 +55,7 @@ void LibretroOpenGLGraphics::overrideCursorScaling(){
OpenGL::OpenGLGraphicsManager::recalculateCursorScaling();
if (_cursor){
- const frac_t screenScaleFactor = _cursorDontScale ? intToFrac(1) : intToFrac(getWindowHeight()) / 200; /* hard coded as base resolution 320x200 is hard coded upstream */
+ const frac_t screenScaleFactor = (_cursorDontScale || ! _overlayVisible) ? intToFrac(1) : intToFrac(getWindowHeight()) / 200; /* hard coded as base resolution 320x200 is hard coded upstream */
_cursorHotspotXScaled = fracToInt(_cursorHotspotX * screenScaleFactor);
_cursorWidthScaled = fracToDouble(_cursor->getWidth() * screenScaleFactor);
diff --git a/backends/platform/libretro/src/libretro-graphics-surface.cpp b/backends/platform/libretro/src/libretro-graphics-surface.cpp
index bbff18d9dbb..9fd41742729 100644
--- a/backends/platform/libretro/src/libretro-graphics-surface.cpp
+++ b/backends/platform/libretro/src/libretro-graphics-surface.cpp
@@ -169,7 +169,7 @@ void LibretroGraphics::warpMouse(int x, int y) {
}
void LibretroGraphics::overrideCursorScaling(){
- const frac_t screenScaleFactor = _cursorDontScale ? intToFrac(1) : intToFrac(getWindowHeight()) / 200; /* hard coded as base resolution 320x200 is hard coded upstream */
+ const frac_t screenScaleFactor = (_cursorDontScale || ! _overlayVisible) ? intToFrac(1) : intToFrac(getWindowHeight()) / 200; /* hard coded as base resolution 320x200 is hard coded upstream */
_cursorHotspotXScaled = fracToInt(_cursorHotspotX * screenScaleFactor);
_cursorWidthScaled = fracToDouble(_cursor.w * screenScaleFactor);
More information about the Scummvm-git-logs
mailing list