From 903be342172b1b2590133376d6f91469903f1858 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Fri, 23 Oct 2020 14:48:31 -0230 Subject: [PATCH] libretro: Minor doc updates and code rearrangement. --- src/libretro/FBBackendLIBRETRO.hxx | 7 +-- src/libretro/FBSurfaceLIBRETRO.hxx | 2 +- src/libretro/SoundLIBRETRO.cxx | 11 ----- src/libretro/SoundLIBRETRO.hxx | 71 +++++++----------------------- src/libretro/StellaLIBRETRO.cxx | 7 +-- 5 files changed, 21 insertions(+), 77 deletions(-) diff --git a/src/libretro/FBBackendLIBRETRO.hxx b/src/libretro/FBBackendLIBRETRO.hxx index a8948156c..7b1dc6b4a 100644 --- a/src/libretro/FBBackendLIBRETRO.hxx +++ b/src/libretro/FBBackendLIBRETRO.hxx @@ -24,17 +24,14 @@ class OSystem; #include "FBBackend.hxx" /** - This class implements a standard LIBRETRO backend. Most of the - functionality is not used, since libretro has its own rendering system. + This class implements a standard LIBRETRO framebuffer backend. Most of + the functionality is not used, since libretro has its own rendering system. @author Stephen Anthony */ class FBBackendLIBRETRO : public FBBackend { public: - /** - Creates a new LIBRETRO framebuffer. - */ explicit FBBackendLIBRETRO(OSystem&) { } ~FBBackendLIBRETRO() override { } diff --git a/src/libretro/FBSurfaceLIBRETRO.hxx b/src/libretro/FBSurfaceLIBRETRO.hxx index 43cd276bd..646d2c46c 100644 --- a/src/libretro/FBSurfaceLIBRETRO.hxx +++ b/src/libretro/FBSurfaceLIBRETRO.hxx @@ -22,7 +22,7 @@ #include "FBSurface.hxx" /** - An FBSurface suitable for the LIBRETRO Render2D API. As with FBBackend, + An FBSurface suitable for the LIBRETRO API. As with FBBackend, most of the functionality here is handled by libretro directly. @author Stephen Anthony diff --git a/src/libretro/SoundLIBRETRO.cxx b/src/libretro/SoundLIBRETRO.cxx index eef9c7dd5..2c15ce04d 100644 --- a/src/libretro/SoundLIBRETRO.cxx +++ b/src/libretro/SoundLIBRETRO.cxx @@ -31,15 +31,10 @@ #include "AudioQueue.hxx" #include "EmulationTiming.hxx" #include "AudioSettings.hxx" -#include "StaggeredLogger.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SoundLIBRETRO::SoundLIBRETRO(OSystem& osystem, AudioSettings& audioSettings) : Sound(osystem), - myIsInitializedFlag(false), - myEmulationTiming(nullptr), - myCurrentFragment(nullptr), - myUnderrun(false), myAudioSettings(audioSettings) { Logger::debug("SoundLIBRETRO::SoundLIBRETRO started ..."); @@ -99,7 +94,6 @@ void SoundLIBRETRO::dequeue(Int16* stream, uInt32* samples) myCurrentFragment = nextFragment; - for (uInt32 i = 0; i < myAudioQueue->fragmentSize(); ++i) { Int16 sampleL, sampleR; @@ -120,9 +114,4 @@ void SoundLIBRETRO::dequeue(Int16* stream, uInt32* samples) *samples = outIndex / 2; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundLIBRETRO::queryHardware(VariantList& devices) -{ -} - #endif // SOUND_SUPPORT diff --git a/src/libretro/SoundLIBRETRO.hxx b/src/libretro/SoundLIBRETRO.hxx index 8bdb77fd3..b8da9566f 100644 --- a/src/libretro/SoundLIBRETRO.hxx +++ b/src/libretro/SoundLIBRETRO.hxx @@ -44,18 +44,12 @@ class SoundLIBRETRO : public Sound ~SoundLIBRETRO() override; public: - /** - Enables/disables the sound subsystem. - - @param enable Either true or false, to enable or disable the sound system - */ - void setEnabled(bool enable) override { } - /** Initializes the sound device. This must be called before any calls are made to derived methods. */ - void open(shared_ptr audioQueue, EmulationTiming* emulationTiming) override; + void open(shared_ptr audioQueue, + EmulationTiming* emulationTiming) override; /** Should be called to close the sound device. Once called the sound @@ -63,43 +57,6 @@ class SoundLIBRETRO : public Sound */ void close() override; - /** - Set the mute state of the sound object. While muted no sound is played. - - @param state Mutes sound if true, unmute if false - - @return The previous (old) mute state - */ - bool mute(bool state) override { return !myIsInitializedFlag; } - - /** - Toggles the sound mute state. While muted no sound is played. - - @return The previous (old) mute state - */ - bool toggleMute() override { return !myIsInitializedFlag; } - - /** - Sets the volume of the sound device to the specified level. The - volume is given as a percentage from 0 to 100. Values outside - this range indicate that the volume shouldn't be changed at all. - - @param percent The new volume percentage level for the sound device - */ - void setVolume(uInt32 percent) override { } - - /** - Adjusts the volume of the sound device based on the given direction. - - @param direction +1 indicates increase, -1 indicates decrease. - */ - void adjustVolume(int direction = +1) override { } - - /** - This method is called to provide information about the sound device. - */ - string about() const override { return ""; } - /** Empties the playback buffer. @@ -109,23 +66,29 @@ class SoundLIBRETRO : public Sound void dequeue(Int16* stream, uInt32* samples); protected: - /** - This method is called to query the audio devices. + ////////////////////////////////////////////////////////////////////// + // Most methods here aren't used at all. See Sound class for + // description, if needed. + ////////////////////////////////////////////////////////////////////// - @param devices List of device names - */ - void queryHardware(VariantList& devices) override; + void setEnabled(bool enable) override { } + void queryHardware(VariantList& devices) override { } + void setVolume(uInt32 percent) override { } + void adjustVolume(int direction = +1) override { } + bool mute(bool state) override { return !myIsInitializedFlag; } + bool toggleMute() override { return !myIsInitializedFlag; } + string about() const override { return ""; } private: // Indicates if the sound device was successfully initialized - bool myIsInitializedFlag; + bool myIsInitializedFlag{false}; shared_ptr myAudioQueue; - EmulationTiming* myEmulationTiming; + EmulationTiming* myEmulationTiming{nullptr}; - Int16* myCurrentFragment; - bool myUnderrun; + Int16* myCurrentFragment{nullptr}; + bool myUnderrun{false}; AudioSettings& myAudioSettings; diff --git a/src/libretro/StellaLIBRETRO.cxx b/src/libretro/StellaLIBRETRO.cxx index b5aaecffc..b80d517d9 100644 --- a/src/libretro/StellaLIBRETRO.cxx +++ b/src/libretro/StellaLIBRETRO.cxx @@ -297,12 +297,7 @@ void* StellaLIBRETRO::getVideoBuffer() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool StellaLIBRETRO::getVideoNTSC() const { - const ConsoleInfo& console_info = myOSystem->console().about(); - string format = console_info.DisplayFormat; - - return (format == "NTSC") || (format == "NTSC*") || - (format == "PAL60") || (format == "PAL60*") || - (format == "SECAM60") || (format == "SECAM60*"); + return myOSystem->console().gameRefreshRate() == 60; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -