[Scummvm-git-logs] scummvm master -> 3774c2969948c2d668a9d46e9cbbc2d5c17c4ff6
spleen1981
noreply at scummvm.org
Fri Apr 5 22:20:04 UTC 2024
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a5392653d5 LIBRETRO: switch to ModularGraphicsBackend
776f8bfa77 LIBRETRO: refresh screen on thread switch only
03e17cb8d7 LIBRETRO: BUILD: get first line only in sharedlibs_get_include_path
3774c29699 LIBRETRO: add FriBidi support
Commit: a5392653d53bf4cef9ff6d891341b97c84ef001e
https://github.com/scummvm/scummvm/commit/a5392653d53bf4cef9ff6d891341b97c84ef001e
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-04-06T00:18:16+02:00
Commit Message:
LIBRETRO: switch to ModularGraphicsBackend
Changed paths:
A backends/platform/libretro/include/libretro-graphics.h
A backends/platform/libretro/src/libretro-graphics.cpp
R backends/platform/libretro/src/libretro-os-graphics.cpp
backends/platform/libretro/Makefile.common
backends/platform/libretro/include/libretro-defs.h
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-os-inputs.cpp
backends/platform/libretro/src/libretro-timer.cpp
diff --git a/backends/platform/libretro/Makefile.common b/backends/platform/libretro/Makefile.common
index 0d64db679ab..e14f87e4dd0 100644
--- a/backends/platform/libretro/Makefile.common
+++ b/backends/platform/libretro/Makefile.common
@@ -122,14 +122,14 @@ LIBRETRO_OBJS := $(CORE_PATH)/libretro-core.o \
$(CORE_PATH)/libretro-fs.o \
$(CORE_PATH)/libretro-fs-factory.o \
$(CORE_PATH)/libretro-os-base.o \
- $(CORE_PATH)/libretro-os-graphics.o \
$(CORE_PATH)/libretro-os-events.o \
$(CORE_PATH)/libretro-os-inputs.o \
$(CORE_PATH)/libretro-os-utils.o \
$(CORE_PATH)/libretro-threads.o \
$(CORE_PATH)/libretro-timer.o \
$(CORE_PATH)/libretro-mapper.o \
- $(CORE_PATH)/libretro-options-widget.o
+ $(CORE_PATH)/libretro-options-widget.o \
+ $(CORE_PATH)/libretro-graphics.o
OBJS += $(LIBRETRO_OBJS)
diff --git a/backends/platform/libretro/include/libretro-defs.h b/backends/platform/libretro/include/libretro-defs.h
index 9963f6a5df6..392a8150429 100644
--- a/backends/platform/libretro/include/libretro-defs.h
+++ b/backends/platform/libretro/include/libretro-defs.h
@@ -45,11 +45,6 @@ will be updated to include it */
#define AUDIO_STATUS_UPDATE_LATENCY (1 << 4)
#define AUDIO_STATUS_UPDATE_AV_INFO (1 << 5)
-// Thread switch caller
-#define THREAD_SWITCH_POLL (1 << 0)
-#define THREAD_SWITCH_DELAY (1 << 1)
-#define THREAD_SWITCH_UPDATE (1 << 2)
-
// Preliminary scan results
#define TEST_GAME_OK_TARGET_FOUND 0
#define TEST_GAME_OK_ID_FOUND 1
diff --git a/backends/platform/libretro/include/libretro-graphics.h b/backends/platform/libretro/include/libretro-graphics.h
new file mode 100644
index 00000000000..b2772906317
--- /dev/null
+++ b/backends/platform/libretro/include/libretro-graphics.h
@@ -0,0 +1,124 @@
+/* Copyright (C) 2024 Giovanni Cascione <ing.cascione at gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef BACKENDS_LIBRETRO_GRAPHICS_H
+#define BACKENDS_LIBRETRO_GRAPHICS_H
+
+#include "common/system.h"
+#include "graphics/paletteman.h"
+#include "graphics/surface.h"
+#include "backends/graphics/graphics.h"
+
+class LibretroPalette {
+public:
+ const byte *_prevColorsSource;
+ unsigned char _colors[256 * 3];
+ LibretroPalette(void);
+ ~LibretroPalette(void) {};
+ void set(const byte *colors, uint start, uint num);
+ void get(byte *colors, uint start, uint num) const;
+ unsigned char *getColor(uint aIndex) const;
+ void reset(void) {
+ _prevColorsSource = NULL;
+ }
+};
+
+class LibretroGraphics : public GraphicsManager {
+
+public:
+ Graphics::Surface _screen;
+ Graphics::Surface _gameScreen;
+ Graphics::Surface _overlay;
+ Graphics::Surface _mouseImage;
+ LibretroPalette _mousePalette;
+ LibretroPalette _gamePalette;
+
+private:
+ bool _overlayInGUI;
+ bool _overlayVisible;
+ bool _mouseDontScale;
+ bool _mousePaletteEnabled;
+ bool _mouseVisible;
+ int _mouseHotspotX;
+ int _mouseHotspotY;
+ int _mouseKeyColor;
+
+public:
+ LibretroGraphics();
+ ~LibretroGraphics();
+ Common::List<Graphics::PixelFormat> getSupportedFormats() const override;
+ const OSystem::GraphicsMode *getSupportedGraphicsModes(void) const override;
+ void initSize(uint width, uint height, const Graphics::PixelFormat *format) override;
+ int16 getHeight(void) const override;
+ int16 getWidth(void) const override;
+ Graphics::PixelFormat getScreenFormat(void) const override;
+ void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override;
+ void updateScreen(void) override;
+ void showOverlay(bool inGUI) override;
+ void hideOverlay(void) override;
+ void clearOverlay(void) override;
+ void grabOverlay(Graphics::Surface &surface) const override;
+ void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override;
+ int16 getOverlayHeight(void) const override;
+ int16 getOverlayWidth(void) const override;
+ Graphics::PixelFormat getOverlayFormat() const override;
+ const Graphics::Surface &getScreen(void);
+ bool showMouse(bool visible) override;
+ void warpMouse(int x, int y) override;
+ void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL, const byte *mask = nullptr) override;
+ void setCursorPalette(const byte *colors, uint start, uint num) override;
+ bool isOverlayInGUI(void);
+
+ bool hasFeature(OSystem::Feature f) const override;
+ void setFeatureState(OSystem::Feature f, bool enable) override;
+ bool getFeatureState(OSystem::Feature f) const override;
+
+ int getDefaultGraphicsMode() const override {
+ return 0;
+ }
+ bool isOverlayVisible() const override {
+ return _overlayVisible;
+ }
+ bool setGraphicsMode(int mode, uint flags = OSystem::kGfxModeNoFlags) override {
+ return true;
+ }
+ int getGraphicsMode() const override {
+ return 0;
+ }
+ Graphics::Surface *lockScreen() override {
+ return &_gameScreen;
+ }
+ void unlockScreen() override {}
+
+ void setShakePos(int shakeXOffset, int shakeYOffset) override {}
+ int getScreenChangeID() const override {
+ return 0;
+ }
+ void beginGFXTransaction() override {}
+ OSystem::TransactionError endGFXTransaction() override {
+ return OSystem::kTransactionSuccess;
+ }
+ void fillScreen(uint32 col) override {}
+ void fillScreen(const Common::Rect &r, uint32 col) override {}
+ void setFocusRectangle(const Common::Rect &rect) override {}
+ void clearFocusRectangle() override {}
+
+protected:
+ void setPalette(const byte *colors, uint start, uint num) override;
+ void grabPalette(byte *colors, uint start, uint num) const override;
+};
+
+#endif
diff --git a/backends/platform/libretro/include/libretro-os.h b/backends/platform/libretro/include/libretro-os.h
index a82c9e394ae..4df29162ade 100644
--- a/backends/platform/libretro/include/libretro-os.h
+++ b/backends/platform/libretro/include/libretro-os.h
@@ -24,8 +24,7 @@
#include "common/mutex.h"
#include "common/list.h"
#include "common/events.h"
-#include "graphics/paletteman.h"
-#include "graphics/surface.h"
+#include "backends/modular-backend.h"
#define BASE_CURSOR_SPEED 4
#define CURSOR_STATUS_DOING_JOYSTICK (1 << 0)
@@ -35,6 +34,7 @@
#define CURSOR_STATUS_DOING_SLOWER (1 << 4)
#define LIBRETRO_G_SYSTEM dynamic_cast<OSystem_libretro *>(g_system)
+#define LIBRETRO_GRAPHICS_MANAGER dynamic_cast<LibretroGraphics *>(_graphicsManager)
/**
* Dummy mutex implementation
@@ -47,27 +47,11 @@ public:
bool unlock() override { return 0; };
};
-class LibretroPalette {
-public:
- const byte *_prevColorsSource;
- unsigned char _colors[256 * 3];
- LibretroPalette(void);
- ~LibretroPalette(void) {};
- void set(const byte *colors, uint start, uint num);
- void get(byte *colors, uint start, uint num) const;
- unsigned char *getColor(uint aIndex) const;
- void reset(void) { _prevColorsSource = NULL; }
-};
-class OSystem_libretro : public EventsBaseBackend, public PaletteManager {
+class OSystem_libretro : public EventsBaseBackend, ModularGraphicsBackend {
private:
- int _mouseX;
- int _mouseY;
int _relMouseX;
int _relMouseY;
- int _mouseHotspotX;
- int _mouseHotspotY;
- int _mouseKeyColor;
float _mouseXAcc;
float _mouseYAcc;
float _dpadXAcc;
@@ -77,7 +61,6 @@ private:
float _adjusted_cursor_speed;
float _inverse_acceleration_time;
uint32 _startTime;
- uint8 _threadSwitchCaller;
uint8 _cursorStatus;
Common::String s_systemDir;
Common::String s_saveDir;
@@ -86,75 +69,27 @@ private:
public:
Audio::MixerImpl *_mixer;
- Graphics::Surface _screen;
- Graphics::Surface _gameScreen;
- Graphics::Surface _overlay;
- Graphics::Surface _mouseImage;
- LibretroPalette _mousePalette;
- LibretroPalette _gamePalette;
- bool _overlayVisible;
- bool _overlayInGUI;
- bool _mouseDontScale;
bool _mouseButtons[2];
bool _ptrmouseButton;
- bool _mousePaletteEnabled;
- bool _mouseVisible;
+ int _mouseX;
+ int _mouseY;
/* Base */
OSystem_libretro(void);
~OSystem_libretro(void) override;
void initBackend(void) override;
void engineInit(void) override;
- bool hasFeature(Feature f) override;
- void setFeatureState(Feature f, bool enable) override;
- bool getFeatureState(Feature f) override;
void refreshRetroSettings(void);
void destroy(void);
void quit() override {}
+
private:
bool checkPathSetting(const char *setting, Common::String const &defaultPath, bool isDirectory = true);
void setLibretroDir(const char * path, Common::String &var);
- /* Graphics */
-public:
- Common::List<Graphics::PixelFormat> getSupportedFormats() const override;
- const GraphicsMode *getSupportedGraphicsModes(void) const override;
- void initSize(uint width, uint height, const Graphics::PixelFormat *format) override;
- int16 getHeight(void) override;
- int16 getWidth(void) override;
- Graphics::PixelFormat getScreenFormat(void) const override;
- void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override;
- void updateScreen(void) override;
- void showOverlay(bool inGUI) override;
- void hideOverlay(void) override;
- void clearOverlay(void) override;
- void grabOverlay(Graphics::Surface &surface) override;
- void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override;
- int16 getOverlayHeight(void) override;
- int16 getOverlayWidth(void) override;
- Graphics::PixelFormat getOverlayFormat() const override;
- const Graphics::Surface &getScreen(void);
- bool showMouse(bool visible) override;
- void warpMouse(int x, int y) override;
- void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL, const byte *mask = nullptr) override;
- void setCursorPalette(const byte *colors, uint start, uint num) override;
- int getDefaultGraphicsMode() const override { return 0; }
- bool isOverlayVisible() const override { return false; }
- bool setGraphicsMode(int mode, uint flags = kGfxModeNoFlags) override { return true; }
- int getGraphicsMode() const override { return 0; }
- PaletteManager *getPaletteManager() override { return this; }
- Graphics::Surface *lockScreen() override { return &_gameScreen; }
- void unlockScreen() override {}
- GUI::OptionsContainerWidget *buildBackendOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
- void applyBackendSettings() override;
-protected:
- void setPalette(const byte *colors, uint start, uint num) override;
- void grabPalette(byte *colors, uint start, uint num) const override;
-
/* Events */
public:
bool pollEvent(Common::Event &event) override;
- uint8 getThreadSwitchCaller(void);
uint32 getMillis(bool skipRecord = false) override;
void delayMillis(uint msecs) override;
Common::MutexInternal *createMutex(void) override;
@@ -170,6 +105,9 @@ public:
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) override;
const char * const *buildHelpDialogData() override;
Common::String getSaveDir(void);
+ GUI::OptionsContainerWidget *buildBackendOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
+ void applyBackendSettings() override;
+ const Graphics::Surface &getScreen(void);
private:
bool parseGameName(const Common::String &gameName, Common::String &engineId, Common::String &gameId);
@@ -177,7 +115,6 @@ private:
public:
void processInputs(void);
void processKeyEvent(bool down, unsigned keycode, uint32 character, uint16 key_modifiers);
- void setShakePos(int shakeXOffset, int shakeYOffset) override {}
private:
void updateMouseXY(float deltaAcc, float * cumulativeXYAcc, int doing_x);
void getMouseXYFromAnalog(bool is_x, int16 coor);
diff --git a/backends/platform/libretro/include/libretro-timer.h b/backends/platform/libretro/include/libretro-timer.h
index 1889b288f21..9ea4ad7e857 100644
--- a/backends/platform/libretro/include/libretro-timer.h
+++ b/backends/platform/libretro/include/libretro-timer.h
@@ -18,6 +18,11 @@
#ifndef LIBRETRO_TIMER_H
#define LIBRETRO_TIMER_H
+// Thread switch caller
+#define THREAD_SWITCH_POLL (1 << 0)
+#define THREAD_SWITCH_DELAY (1 << 1)
+#define THREAD_SWITCH_UPDATE (1 << 2)
+
#include "backends/timer/default/default-timer.h"
#include "backends/platform/libretro/include/libretro-defs.h"
@@ -25,13 +30,15 @@ class LibretroTimerManager : public DefaultTimerManager {
uint32 _interval;
uint32 _nextSwitchTime;
uint32 _spentOnMainThread;
+ uint8 _threadSwitchCaller;
public:
LibretroTimerManager(uint32 refresh_rate);
~LibretroTimerManager(void) {};
- void switchThread(void);
- void checkThread(void);
+ void switchThread(uint8 caller = 0);
+ void checkThread(uint8 caller = 0);
uint32 timeToNextSwitch(void);
uint32 spentOnMainThread(void);
+ uint8 getThreadSwitchCaller(void);
};
#endif // LIBRETRO_TIMER_H
diff --git a/backends/platform/libretro/src/libretro-os-graphics.cpp b/backends/platform/libretro/src/libretro-graphics.cpp
similarity index 77%
rename from backends/platform/libretro/src/libretro-os-graphics.cpp
rename to backends/platform/libretro/src/libretro-graphics.cpp
index 9f02627963e..e164a27c3e7 100644
--- a/backends/platform/libretro/src/libretro-os-graphics.cpp
+++ b/backends/platform/libretro/src/libretro-graphics.cpp
@@ -25,6 +25,7 @@
#include "backends/platform/libretro/include/libretro-core.h"
#include "backends/platform/libretro/include/libretro-os.h"
#include "backends/platform/libretro/include/libretro-timer.h"
+#include "backends/platform/libretro/include/libretro-graphics.h"
static INLINE void blit_uint8_uint16_fast(Graphics::Surface &aOut, const Graphics::Surface &aIn, const LibretroPalette &aColors) {
for (int i = 0; i < aIn.h; i++) {
@@ -198,7 +199,7 @@ static INLINE void copyRectToSurface(uint8 *pixels, int out_pitch, const uint8 *
} while (--h);
}
-LibretroPalette::LibretroPalette() : _prevColorsSource(NULL){
+LibretroPalette::LibretroPalette() : _prevColorsSource(NULL) {
memset(_colors, 0, sizeof(_colors));
}
@@ -207,28 +208,43 @@ void LibretroPalette::set(const byte *colors, uint start, uint num) {
caused by the corruption of start argument (and consequently colors ptr). Root cause to be investigated. */
if (start > 255) {
start = 0;
- colors=_prevColorsSource;
- }else
+ colors = _prevColorsSource;
+ } else
_prevColorsSource = colors;
- if (num>256)
- num=256;
+ if (num > 256)
+ num = 256;
if (colors)
memcpy(_colors + start * 3, colors, num * 3);
else
- LIBRETRO_G_SYSTEM->logMessage(LogMessageType::kError,"LibretroPalette colors ptr is NULL\n");
+ LIBRETRO_G_SYSTEM->logMessage(LogMessageType::kError, "LibretroPalette colors ptr is NULL\n");
}
void LibretroPalette::get(byte *colors, uint start, uint num) const {
memcpy(colors, _colors + start * 3, num * 3);
}
-unsigned char * LibretroPalette::getColor(uint aIndex) const {
+unsigned char *LibretroPalette::getColor(uint aIndex) const {
return (unsigned char *)&_colors[aIndex * 3];
}
-Common::List<Graphics::PixelFormat> OSystem_libretro::getSupportedFormats() const {
+LibretroGraphics::LibretroGraphics() : _mousePaletteEnabled(false), _mouseVisible(false), _mouseKeyColor(0), _mouseDontScale(false) {
+#ifdef FRONTEND_SUPPORTS_RGB565
+ _overlay.create(RES_W_OVERLAY, RES_H_OVERLAY, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+#else
+ _overlay.create(RES_W_OVERLAY, RES_H_OVERLAY, Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15));
+#endif
+}
+
+LibretroGraphics::~LibretroGraphics() {
+ _gameScreen.free();
+ _overlay.free();
+ _mouseImage.free();
+ _screen.free();
+}
+
+Common::List<Graphics::PixelFormat> LibretroGraphics::getSupportedFormats() const {
Common::List<Graphics::PixelFormat> result;
#ifdef SCUMM_LITTLE_ENDIAN
@@ -251,37 +267,35 @@ Common::List<Graphics::PixelFormat> OSystem_libretro::getSupportedFormats() cons
return result;
}
-const OSystem_libretro::GraphicsMode *OSystem_libretro::getSupportedGraphicsModes() const {
+const OSystem::GraphicsMode *LibretroGraphics::getSupportedGraphicsModes() const {
static const OSystem::GraphicsMode s_noGraphicsModes[] = {{0, 0, 0}};
return s_noGraphicsModes;
}
-
-
-void OSystem_libretro::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
+void LibretroGraphics::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
_gameScreen.create(width, height, format ? *format : Graphics::PixelFormat::createFormatCLUT8());
- refreshRetroSettings();
+ LIBRETRO_G_SYSTEM->refreshRetroSettings();
}
-int16 OSystem_libretro::getHeight() {
+int16 LibretroGraphics::getHeight() const {
return _gameScreen.h;
}
-int16 OSystem_libretro::getWidth() {
+int16 LibretroGraphics::getWidth() const {
return _gameScreen.w;
}
-Graphics::PixelFormat OSystem_libretro::getScreenFormat() const {
+Graphics::PixelFormat LibretroGraphics::getScreenFormat() const {
return _gameScreen.format;
}
-void OSystem_libretro::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
+void LibretroGraphics::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
const uint8 *src = (const uint8 *)buf;
uint8 *pix = (uint8 *)_gameScreen.getPixels();
copyRectToSurface(pix, _gameScreen.pitch, src, pitch, x, y, w, h, _gameScreen.format.bytesPerPixel);
}
-void OSystem_libretro::updateScreen() {
+void LibretroGraphics::updateScreen() {
const Graphics::Surface &srcSurface = (_overlayInGUI) ? _overlay : _gameScreen;
if (srcSurface.w && srcSurface.h) {
switch (srcSurface.format.bytesPerPixel) {
@@ -300,8 +314,8 @@ void OSystem_libretro::updateScreen() {
// Draw Mouse
if (_mouseVisible && _mouseImage.w && _mouseImage.h) {
- const int x = _mouseX - _mouseHotspotX;
- const int y = _mouseY - _mouseHotspotY;
+ const int x = LIBRETRO_G_SYSTEM->_mouseX - _mouseHotspotX;
+ const int y = LIBRETRO_G_SYSTEM->_mouseY - _mouseHotspotY;
switch (_mouseImage.format.bytesPerPixel) {
case 1:
@@ -318,26 +332,25 @@ void OSystem_libretro::updateScreen() {
}
if (! retro_setting_get_timing_inaccuracies_enabled() && !_overlayInGUI) {
- _threadSwitchCaller = THREAD_SWITCH_UPDATE;
- ((LibretroTimerManager *)_timerManager)->checkThread();
+ dynamic_cast<LibretroTimerManager *>(LIBRETRO_G_SYSTEM->getTimerManager())->checkThread(THREAD_SWITCH_UPDATE);
}
}
-void OSystem_libretro::showOverlay(bool inGUI) {
+void LibretroGraphics::showOverlay(bool inGUI) {
_overlayVisible = true;
_overlayInGUI = inGUI;
}
-void OSystem_libretro::hideOverlay() {
+void LibretroGraphics::hideOverlay() {
_overlayVisible = false;
_overlayInGUI = false;
}
-void OSystem_libretro::clearOverlay() {
+void LibretroGraphics::clearOverlay() {
_overlay.fillRect(Common::Rect(_overlay.w, _overlay.h), 0);
}
-void OSystem_libretro::grabOverlay(Graphics::Surface &surface) {
+void LibretroGraphics::grabOverlay(Graphics::Surface &surface) const {
const unsigned char *src = (unsigned char *)_overlay.getPixels();
unsigned char *dst = (byte *)surface.getPixels();
;
@@ -350,36 +363,36 @@ void OSystem_libretro::grabOverlay(Graphics::Surface &surface) {
} while (--i);
}
-void OSystem_libretro::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
+void LibretroGraphics::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
const uint8 *src = (const uint8 *)buf;
uint8 *pix = (uint8 *)_overlay.getPixels();
copyRectToSurface(pix, _overlay.pitch, src, pitch, x, y, w, h, _overlay.format.bytesPerPixel);
}
-int16 OSystem_libretro::getOverlayHeight() {
+int16 LibretroGraphics::getOverlayHeight() const {
return _overlay.h;
}
-int16 OSystem_libretro::getOverlayWidth() {
+int16 LibretroGraphics::getOverlayWidth() const {
return _overlay.w;
}
-Graphics::PixelFormat OSystem_libretro::getOverlayFormat() const {
+Graphics::PixelFormat LibretroGraphics::getOverlayFormat() const {
return _overlay.format;
}
-bool OSystem_libretro::showMouse(bool visible) {
+bool LibretroGraphics::showMouse(bool visible) {
const bool wasVisible = _mouseVisible;
_mouseVisible = visible;
return wasVisible;
}
-void OSystem_libretro::warpMouse(int x, int y) {
- _mouseX = x;
- _mouseY = y;
+void LibretroGraphics::warpMouse(int x, int y) {
+ LIBRETRO_G_SYSTEM->_mouseX = x;
+ LIBRETRO_G_SYSTEM->_mouseY = y;
}
-void OSystem_libretro::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format, const byte *mask) {
+void LibretroGraphics::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format, const byte *mask) {
const Graphics::PixelFormat mformat = format ? *format : Graphics::PixelFormat::createFormatCLUT8();
if (_mouseImage.w != w || _mouseImage.h != h || _mouseImage.format != mformat) {
@@ -394,12 +407,16 @@ void OSystem_libretro::setMouseCursor(const void *buf, uint w, uint h, int hotsp
_mouseDontScale = dontScale;
}
-void OSystem_libretro::setCursorPalette(const byte *colors, uint start, uint num) {
+void LibretroGraphics::setCursorPalette(const byte *colors, uint start, uint num) {
_mousePalette.set(colors, start, num);
_mousePaletteEnabled = true;
}
-const Graphics::Surface &OSystem_libretro::getScreen() {
+bool LibretroGraphics::isOverlayInGUI(void) {
+ return _overlayInGUI;
+}
+
+const Graphics::Surface &LibretroGraphics::getScreen() {
const Graphics::Surface &srcSurface = (_overlayInGUI) ? _overlay : _gameScreen;
if (srcSurface.w != _screen.w || srcSurface.h != _screen.h) {
@@ -413,10 +430,24 @@ const Graphics::Surface &OSystem_libretro::getScreen() {
return _screen;
}
-void OSystem_libretro::setPalette(const byte *colors, uint start, uint num) {
+void LibretroGraphics::setPalette(const byte *colors, uint start, uint num) {
_gamePalette.set(colors, start, num);
}
-void OSystem_libretro::grabPalette(byte *colors, uint start, uint num) const {
+void LibretroGraphics::grabPalette(byte *colors, uint start, uint num) const {
_gamePalette.get(colors, start, num);
}
+
+bool LibretroGraphics::hasFeature(OSystem::Feature f) const {
+ return (f == OSystem::kFeatureCursorPalette) || (f == OSystem::kFeatureCursorAlpha);
+}
+
+void LibretroGraphics::setFeatureState(OSystem::Feature f, bool enable) {
+ if (f == OSystem::kFeatureCursorPalette)
+ _mousePaletteEnabled = enable;
+}
+
+bool LibretroGraphics::getFeatureState(OSystem::Feature f) const {
+ return (f == OSystem::kFeatureCursorPalette) ? _mousePaletteEnabled : false;
+}
+
diff --git a/backends/platform/libretro/src/libretro-os-base.cpp b/backends/platform/libretro/src/libretro-os-base.cpp
index 587ae73c817..8742b35b65d 100644
--- a/backends/platform/libretro/src/libretro-os-base.cpp
+++ b/backends/platform/libretro/src/libretro-os-base.cpp
@@ -37,8 +37,9 @@
#include "backends/platform/libretro/include/libretro-timer.h"
#include "backends/platform/libretro/include/libretro-os.h"
#include "backends/platform/libretro/include/libretro-fs.h"
+#include "backends/platform/libretro/include/libretro-graphics.h"
-OSystem_libretro::OSystem_libretro() : _mousePaletteEnabled(false), _mouseVisible(false), _mouseX(0), _mouseY(0), _mouseXAcc(0.0), _mouseYAcc(0.0), _mouseHotspotX(0), _mouseHotspotY(0), _dpadXAcc(0.0), _dpadYAcc(0.0), _dpadXVel(0.0f), _dpadYVel(0.0f), _mouseKeyColor(0), _mouseDontScale(false), _mixer(0), _startTime(0), _threadSwitchCaller(0), _cursorStatus(0) {
+OSystem_libretro::OSystem_libretro() : _mouseX(0), _mouseY(0), _mouseXAcc(0.0), _mouseYAcc(0.0), _dpadXAcc(0.0), _dpadYAcc(0.0), _dpadXVel(0.0f), _dpadYVel(0.0f), _mixer(0), _startTime(0), _cursorStatus(0) {
_fsFactory = new FS_SYSTEM_FACTORY();
setLibretroDir(retro_get_system_dir(), s_systemDir);
@@ -51,12 +52,8 @@ OSystem_libretro::OSystem_libretro() : _mousePaletteEnabled(false), _mouseVisibl
}
OSystem_libretro::~OSystem_libretro() {
- _gameScreen.free();
- _overlay.free();
- _mouseImage.free();
- _screen.free();
-
delete _mixer;
+ _mixer = nullptr;
}
void OSystem_libretro::initBackend() {
@@ -107,11 +104,6 @@ void OSystem_libretro::initBackend() {
_savefileManager = new DefaultSaveFileManager();
-#ifdef FRONTEND_SUPPORTS_RGB565
- _overlay.create(RES_W_OVERLAY, RES_H_OVERLAY, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
-#else
- _overlay.create(RES_W_OVERLAY, RES_H_OVERLAY, Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15));
-#endif
_mixer = new Audio::MixerImpl(retro_setting_get_sample_rate(), true, retro_setting_get_audio_samples_buffer_size());
retro_log_cb(RETRO_LOG_DEBUG, "Mixer set up at %dHz\n", retro_setting_get_sample_rate());
@@ -119,6 +111,8 @@ void OSystem_libretro::initBackend() {
_mixer->setReady(true);
+ _graphicsManager = new LibretroGraphics();
+
EventsBaseBackend::initBackend();
refreshRetroSettings();
@@ -130,21 +124,8 @@ void OSystem_libretro::engineInit() {
ConfMan.setBool("original_gui", false);
retro_log_cb(RETRO_LOG_INFO, "\"original_gui\" setting forced to false\n");
}
- _mousePalette.reset();
- _gamePalette.reset();
-}
-
-bool OSystem_libretro::hasFeature(Feature f) {
- return (f == OSystem::kFeatureCursorPalette) || (f == OSystem::kFeatureCursorAlpha);
-}
-
-void OSystem_libretro::setFeatureState(Feature f, bool enable) {
- if (f == kFeatureCursorPalette)
- _mousePaletteEnabled = enable;
-}
-
-bool OSystem_libretro::getFeatureState(Feature f) {
- return (f == kFeatureCursorPalette) ? _mousePaletteEnabled : false;
+ LIBRETRO_GRAPHICS_MANAGER->_mousePalette.reset();
+ LIBRETRO_GRAPHICS_MANAGER->_gamePalette.reset();
}
Audio::Mixer *OSystem_libretro::getMixer() {
@@ -152,7 +133,7 @@ Audio::Mixer *OSystem_libretro::getMixer() {
}
void OSystem_libretro::refreshRetroSettings() {
- _adjusted_cursor_speed = (float)BASE_CURSOR_SPEED * retro_setting_get_gamepad_cursor_speed() * (float)(_overlayInGUI ? _overlay.w : _gameScreen.w) / 320.0f; // Dpad cursor speed should always be based off a 320 wide screen, to keep speeds consistent;
+ _adjusted_cursor_speed = (float)BASE_CURSOR_SPEED * retro_setting_get_gamepad_cursor_speed() * (float)(LIBRETRO_GRAPHICS_MANAGER->isOverlayInGUI() ? LIBRETRO_GRAPHICS_MANAGER->getOverlayWidth() : LIBRETRO_GRAPHICS_MANAGER->getWidth()) / 320.0f; // Dpad cursor speed should always be based off a 320 wide screen, to keep speeds consistent;
_inverse_acceleration_time = (retro_setting_get_gamepad_acceleration_time() > 0.0) ? (1.0f / (float)retro_setting_get_frame_rate()) * (1.0f / retro_setting_get_gamepad_acceleration_time()) : 1.0f;
}
@@ -182,3 +163,7 @@ void OSystem_libretro::setLibretroDir(const char * path, Common::String &var) {
var.clear();
return;
}
+
+const Graphics::Surface &OSystem_libretro::getScreen() {
+ return LIBRETRO_GRAPHICS_MANAGER->getScreen();
+}
diff --git a/backends/platform/libretro/src/libretro-os-events.cpp b/backends/platform/libretro/src/libretro-os-events.cpp
index cde74dfc401..7ca1ada6519 100644
--- a/backends/platform/libretro/src/libretro-os-events.cpp
+++ b/backends/platform/libretro/src/libretro-os-events.cpp
@@ -25,10 +25,10 @@
#include "backends/platform/libretro/include/libretro-core.h"
#include "backends/platform/libretro/include/libretro-os.h"
#include "backends/platform/libretro/include/libretro-timer.h"
+#include "backends/platform/libretro/include/libretro-graphics.h"
bool OSystem_libretro::pollEvent(Common::Event &event) {
- _threadSwitchCaller = THREAD_SWITCH_POLL;
- ((LibretroTimerManager *)_timerManager)->checkThread();
+ ((LibretroTimerManager *)_timerManager)->checkThread(THREAD_SWITCH_POLL);
if (!_events.empty()) {
event = _events.front();
_events.pop_front();
@@ -38,10 +38,6 @@ bool OSystem_libretro::pollEvent(Common::Event &event) {
return false;
}
-uint8 OSystem_libretro::getThreadSwitchCaller(){
- return _threadSwitchCaller;
-}
-
uint32 OSystem_libretro::getMillis(bool skipRecord) {
return (uint32)(cpu_features_get_time_usec() / 1000) - _startTime;
}
@@ -50,14 +46,12 @@ void OSystem_libretro::delayMillis(uint msecs) {
uint32 start_time = getMillis();
uint32 elapsed_time = 0;
- _threadSwitchCaller = THREAD_SWITCH_DELAY;
-
if (retro_setting_get_timing_inaccuracies_enabled()) {
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() && !_overlayInGUI)
- ((LibretroTimerManager *)_timerManager)->checkThread();
+ if (msecs - elapsed_time >= ((LibretroTimerManager *)_timerManager)->timeToNextSwitch() && !LIBRETRO_GRAPHICS_MANAGER->isOverlayInGUI())
+ ((LibretroTimerManager *)_timerManager)->checkThread(THREAD_SWITCH_DELAY);
else
usleep(1000);
@@ -69,8 +63,8 @@ void OSystem_libretro::delayMillis(uint msecs) {
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() && !_overlayInGUI)
- ((LibretroTimerManager *)_timerManager)->checkThread();
+ if (msecs - elapsed_time >= ((LibretroTimerManager *)_timerManager)->spentOnMainThread() && !((LibretroTimerManager *)_timerManager)->timeToNextSwitch() && !LIBRETRO_GRAPHICS_MANAGER->isOverlayInGUI())
+ ((LibretroTimerManager *)_timerManager)->checkThread(THREAD_SWITCH_DELAY);
else
usleep(1000);
elapsed_time = getMillis() - start_time;
diff --git a/backends/platform/libretro/src/libretro-os-inputs.cpp b/backends/platform/libretro/src/libretro-os-inputs.cpp
index 329bf6b516f..ff6441e5f67 100644
--- a/backends/platform/libretro/src/libretro-os-inputs.cpp
+++ b/backends/platform/libretro/src/libretro-os-inputs.cpp
@@ -22,10 +22,11 @@
#include "backends/platform/libretro/include/libretro-os.h"
#include "backends/platform/libretro/include/libretro-mapper.h"
#include "backends/platform/libretro/include/libretro-core.h"
+#include "backends/platform/libretro/include/libretro-graphics.h"
void OSystem_libretro::updateMouseXY(float deltaAcc, float *cumulativeXYAcc, int doing_x) {
int *mouseXY;
- int16 *screen_wh;
+ const int16 *screen_wh;
int *relMouseXY;
int cumulativeXYAcc_int;
@@ -38,12 +39,12 @@ void OSystem_libretro::updateMouseXY(float deltaAcc, float *cumulativeXYAcc, int
if (doing_x) {
_cursorStatus |= CURSOR_STATUS_DOING_X;
mouseXY = &_mouseX;
- screen_wh = &_screen.w;
+ screen_wh = &(LIBRETRO_GRAPHICS_MANAGER->getScreen().w);
relMouseXY = &_relMouseX;
} else {
_cursorStatus |= CURSOR_STATUS_DOING_Y;
mouseXY = &_mouseY;
- screen_wh = &_screen.h;
+ screen_wh = &(LIBRETRO_GRAPHICS_MANAGER->getScreen().h);
relMouseXY = &_relMouseY;
}
*cumulativeXYAcc += deltaAcc;
@@ -213,8 +214,8 @@ void OSystem_libretro::processInputs(void) {
int p_x = retro_input_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X);
int p_y = retro_input_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y);
int p_press = retro_input_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
- int px = (int)((p_x + 0x7fff) * _screen.w / 0xffff);
- int py = (int)((p_y + 0x7fff) * _screen.h / 0xffff);
+ int px = (int)((p_x + 0x7fff) * LIBRETRO_GRAPHICS_MANAGER->getScreen().w / 0xffff);
+ int py = (int)((p_y + 0x7fff) * LIBRETRO_GRAPHICS_MANAGER->getScreen().h / 0xffff);
// printf("(%d,%d) p:%d\n",px,py,pp);
static int ptrhold = 0;
diff --git a/backends/platform/libretro/src/libretro-timer.cpp b/backends/platform/libretro/src/libretro-timer.cpp
index 49a6aeedb1d..7623e897769 100644
--- a/backends/platform/libretro/src/libretro-timer.cpp
+++ b/backends/platform/libretro/src/libretro-timer.cpp
@@ -27,17 +27,18 @@ LibretroTimerManager::LibretroTimerManager(uint32 refresh_rate) {
_nextSwitchTime = _interval + g_system->getMillis();
}
-void LibretroTimerManager::switchThread(void) {
+void LibretroTimerManager::switchThread(uint8 caller) {
_spentOnMainThread = g_system->getMillis();
+ _threadSwitchCaller = caller;
retro_switch_to_main_thread();
_spentOnMainThread = g_system->getMillis() - _spentOnMainThread;
_nextSwitchTime = g_system->getMillis() + _interval;
handler();
}
-void LibretroTimerManager::checkThread(void) {
+void LibretroTimerManager::checkThread(uint8 caller) {
if (g_system->getMillis() >= _nextSwitchTime)
- switchThread();
+ switchThread(caller);
}
uint32 LibretroTimerManager::timeToNextSwitch(void) {
@@ -48,4 +49,8 @@ uint32 LibretroTimerManager::timeToNextSwitch(void) {
uint32 LibretroTimerManager::spentOnMainThread(void) {
return _spentOnMainThread;
}
+
+uint8 LibretroTimerManager::getThreadSwitchCaller(void){
+ return _threadSwitchCaller;
+}
#endif
Commit: 776f8bfa77687511707e8ca76fee3188f8c14cbe
https://github.com/scummvm/scummvm/commit/776f8bfa77687511707e8ca76fee3188f8c14cbe
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-04-06T00:18:53+02:00
Commit Message:
LIBRETRO: refresh screen on thread switch only
Changed paths:
backends/platform/libretro/include/libretro-graphics.h
backends/platform/libretro/include/libretro-os.h
backends/platform/libretro/src/libretro-graphics.cpp
backends/platform/libretro/src/libretro-os-base.cpp
backends/platform/libretro/src/libretro-timer.cpp
diff --git a/backends/platform/libretro/include/libretro-graphics.h b/backends/platform/libretro/include/libretro-graphics.h
index b2772906317..884f9f62ea3 100644
--- a/backends/platform/libretro/include/libretro-graphics.h
+++ b/backends/platform/libretro/include/libretro-graphics.h
@@ -52,6 +52,7 @@ private:
bool _mouseDontScale;
bool _mousePaletteEnabled;
bool _mouseVisible;
+ bool _screenUpdatePending;
int _mouseHotspotX;
int _mouseHotspotY;
int _mouseKeyColor;
@@ -116,6 +117,8 @@ public:
void setFocusRectangle(const Common::Rect &rect) override {}
void clearFocusRectangle() override {}
+ void realUpdateScreen(void);
+
protected:
void setPalette(const byte *colors, uint start, uint num) override;
void grabPalette(byte *colors, uint start, uint num) const override;
diff --git a/backends/platform/libretro/include/libretro-os.h b/backends/platform/libretro/include/libretro-os.h
index 4df29162ade..1f5bf2666cd 100644
--- a/backends/platform/libretro/include/libretro-os.h
+++ b/backends/platform/libretro/include/libretro-os.h
@@ -80,6 +80,7 @@ public:
void initBackend(void) override;
void engineInit(void) override;
void refreshRetroSettings(void);
+ void refreshScreen(void);
void destroy(void);
void quit() override {}
diff --git a/backends/platform/libretro/src/libretro-graphics.cpp b/backends/platform/libretro/src/libretro-graphics.cpp
index e164a27c3e7..32596740ff3 100644
--- a/backends/platform/libretro/src/libretro-graphics.cpp
+++ b/backends/platform/libretro/src/libretro-graphics.cpp
@@ -229,7 +229,7 @@ unsigned char *LibretroPalette::getColor(uint aIndex) const {
return (unsigned char *)&_colors[aIndex * 3];
}
-LibretroGraphics::LibretroGraphics() : _mousePaletteEnabled(false), _mouseVisible(false), _mouseKeyColor(0), _mouseDontScale(false) {
+LibretroGraphics::LibretroGraphics() : _mousePaletteEnabled(false), _mouseVisible(false), _mouseKeyColor(0), _mouseDontScale(false), _screenUpdatePending(false) {
#ifdef FRONTEND_SUPPORTS_RGB565
_overlay.create(RES_W_OVERLAY, RES_H_OVERLAY, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
#else
@@ -296,6 +296,12 @@ void LibretroGraphics::copyRectToScreen(const void *buf, int pitch, int x, int y
}
void LibretroGraphics::updateScreen() {
+ _screenUpdatePending = true;
+ if (! retro_setting_get_timing_inaccuracies_enabled() && !_overlayInGUI)
+ dynamic_cast<LibretroTimerManager *>(LIBRETRO_G_SYSTEM->getTimerManager())->checkThread(THREAD_SWITCH_UPDATE);
+}
+
+void LibretroGraphics::realUpdateScreen(void) {
const Graphics::Surface &srcSurface = (_overlayInGUI) ? _overlay : _gameScreen;
if (srcSurface.w && srcSurface.h) {
switch (srcSurface.format.bytesPerPixel) {
@@ -330,10 +336,7 @@ void LibretroGraphics::updateScreen() {
break;
}
}
-
- if (! retro_setting_get_timing_inaccuracies_enabled() && !_overlayInGUI) {
- dynamic_cast<LibretroTimerManager *>(LIBRETRO_G_SYSTEM->getTimerManager())->checkThread(THREAD_SWITCH_UPDATE);
- }
+ _screenUpdatePending = false;
}
void LibretroGraphics::showOverlay(bool inGUI) {
diff --git a/backends/platform/libretro/src/libretro-os-base.cpp b/backends/platform/libretro/src/libretro-os-base.cpp
index 8742b35b65d..8a4f7bb10e9 100644
--- a/backends/platform/libretro/src/libretro-os-base.cpp
+++ b/backends/platform/libretro/src/libretro-os-base.cpp
@@ -167,3 +167,7 @@ void OSystem_libretro::setLibretroDir(const char * path, Common::String &var) {
const Graphics::Surface &OSystem_libretro::getScreen() {
return LIBRETRO_GRAPHICS_MANAGER->getScreen();
}
+
+void OSystem_libretro::refreshScreen(void) {
+ LIBRETRO_GRAPHICS_MANAGER->realUpdateScreen();
+}
diff --git a/backends/platform/libretro/src/libretro-timer.cpp b/backends/platform/libretro/src/libretro-timer.cpp
index 7623e897769..3c41fae237d 100644
--- a/backends/platform/libretro/src/libretro-timer.cpp
+++ b/backends/platform/libretro/src/libretro-timer.cpp
@@ -18,6 +18,7 @@
#if defined(__LIBRETRO__)
#include "common/scummsys.h"
#include "common/timer.h"
+#include "backends/platform/libretro/include/libretro-os.h"
#include "backends/platform/libretro/include/libretro-threads.h"
#include "backends/platform/libretro/include/libretro-timer.h"
#include "backends/platform/libretro/include/libretro-defs.h"
@@ -30,6 +31,7 @@ LibretroTimerManager::LibretroTimerManager(uint32 refresh_rate) {
void LibretroTimerManager::switchThread(uint8 caller) {
_spentOnMainThread = g_system->getMillis();
_threadSwitchCaller = caller;
+ LIBRETRO_G_SYSTEM->refreshScreen();
retro_switch_to_main_thread();
_spentOnMainThread = g_system->getMillis() - _spentOnMainThread;
_nextSwitchTime = g_system->getMillis() + _interval;
Commit: 03e17cb8d73aa152f1ec20a20b8e9a41494a950b
https://github.com/scummvm/scummvm/commit/03e17cb8d73aa152f1ec20a20b8e9a41494a950b
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-04-06T00:19:17+02:00
Commit Message:
LIBRETRO: BUILD: get first line only in sharedlibs_get_include_path
Changed paths:
backends/platform/libretro/dependencies.mk
diff --git a/backends/platform/libretro/dependencies.mk b/backends/platform/libretro/dependencies.mk
index f28ea005ddc..bdc31a0676b 100644
--- a/backends/platform/libretro/dependencies.mk
+++ b/backends/platform/libretro/dependencies.mk
@@ -26,7 +26,7 @@ endif
# Shared libs functions
this_lib_available := no
sharedlibs_test_cc = '\#include <$(this_lib_subpath)$(this_lib_header)>\nint main(){return 0;}'
-sharedlibs_get_include_path = $(shell printf $(sharedlibs_test_cc) | $(CC) -E -Wp,-v - 2>/dev/null | grep "$(this_lib_subpath)$(this_lib_header)" | cut -d \" -f 2 | sed "s|/$(this_lib_header)||")
+sharedlibs_get_include_path = $(shell printf $(sharedlibs_test_cc) | $(CC) -E -Wp,-v - 2>/dev/null | grep "$(this_lib_subpath)$(this_lib_header)" | cut -d \" -f 2 | sed "s|/$(this_lib_header)||" | head -n 1)
sharedlibs_this_lib_includes = $(if $(this_lib_subpath),-I$(call sharedlibs_get_include_path))
sharedlibs_is_lib_available = $(if $(shell result=$$(printf $(sharedlibs_test_cc) | $(CC) -xc -Wall -O -o /dev/null $(this_lib_flags) $(sharedlibs_this_lib_includes) - > /dev/null 2>&1 ; printf $$?) ; { [ -z $$result ] || [ ! $$result = 0 ] ; } && printf error),no,yes)
sharedlibs_system_lib_message = $(info - Use system shared $(shell printf ' $(this_lib_flags)' | sed -e "s|.*-l||" -e "s| .*||"): $(this_lib_available))
Commit: 3774c2969948c2d668a9d46e9cbbc2d5c17c4ff6
https://github.com/scummvm/scummvm/commit/3774c2969948c2d668a9d46e9cbbc2d5c17c4ff6
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2024-04-06T00:19:35+02:00
Commit Message:
LIBRETRO: add FriBidi support
Changed paths:
backends/platform/libretro/Makefile.common
backends/platform/libretro/dependencies.mk
diff --git a/backends/platform/libretro/Makefile.common b/backends/platform/libretro/Makefile.common
index e14f87e4dd0..38323508f97 100644
--- a/backends/platform/libretro/Makefile.common
+++ b/backends/platform/libretro/Makefile.common
@@ -22,6 +22,7 @@ USE_LUA = 1
LOAD_RULES_MK = 1
USE_TINYGL = 1
USE_BINK = 1
+USE_FRIBIDI = 1
POSIX = 1
USE_RGB_COLOR = 1
ENABLE_VKEYBD = 1
diff --git a/backends/platform/libretro/dependencies.mk b/backends/platform/libretro/dependencies.mk
index bdc31a0676b..de7da2f22b5 100644
--- a/backends/platform/libretro/dependencies.mk
+++ b/backends/platform/libretro/dependencies.mk
@@ -7,7 +7,7 @@ DEPS_SUBMODULES := libretro-deps libretro-common
DEPS_FOLDER_libretro-deps := libretro-deps
DEPS_URL_libretro-deps := https://github.com/libretro/libretro-deps
-DEPS_COMMIT_libretro-deps := c8638d7d317c397c19aa4551038bf648a467ffe6
+DEPS_COMMIT_libretro-deps := abf5246b016569759e7d1b0ea91bb98c2e34d160
DEPS_FOLDER_libretro-common := libretro-common
DEPS_URL_libretro-common := https://github.com/libretro/libretro-common
@@ -547,6 +547,39 @@ OBJS_DEPS += $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/freetype/src/autofit/afan
endif
endif
+######################################################################
+# fribidi settings
+######################################################################
+
+ifeq ($(USE_FRIBIDI), 1)
+DEFINES += -DUSE_FRIBIDI
+this_lib_subpath :=
+this_lib_header := fribidi/fribidi.h
+this_lib_flags := -lfribidi
+include $(ROOT_PATH)/sharedlib_test.mk
+ifneq ($(this_lib_available), yes)
+INCLUDES += -I$(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps) -I$(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi
+OBJS_DEPS += $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-arabic.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-bidi-types.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-bidi.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-brackets.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-char-sets-cap-rtl.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-char-sets-cp1255.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-char-sets-cp1256.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-char-sets-iso8859-6.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-char-sets-iso8859-8.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-char-sets-utf8.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-char-sets.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-deprecated.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-joining-types.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-joining.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-mirroring.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-run.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi-shape.o \
+ $(DEPS_PATH)/$(DEPS_FOLDER_libretro-deps)/fribidi/fribidi.o
+endif
+endif
+
######################################################################
# libcurl settings
######################################################################
More information about the Scummvm-git-logs
mailing list