Files
hunterk f049089880 initial libretro-ization. Some things partial/nonexistent
fix linking, rename lib, prep for GB/C

get more consoles working. PCE still not there

fix PCE hucard loading; CD still broken

fix PCE CD loading and firmware. SGB still not quite there

get SGB working

add gitlab recipe for libretro buildbot
2026-08-29 10:21:13 -05:00

76 lines
1.6 KiB
C++

#pragma once
#include "pch.h"
#include "Utilities/SimpleLock.h"
#include "Utilities/AutoResetEvent.h"
#include "Shared/SettingTypes.h"
#include "Shared/RenderedFrame.h"
#include <thread>
class BaseVideoFilter;
class ScaleFilter;
class RotateFilter;
class IRenderingDevice;
class Emulator;
class VideoDecoder
{
private:
Emulator* _emu;
ConsoleType _consoleType = ConsoleType::Snes;
#ifdef LIBRETRO
unique_ptr<std::thread> _decodeThread;
#else
unique_ptr<thread> _decodeThread;
#endif
SimpleLock _stopStartLock;
AutoResetEvent _waitForFrame;
atomic<bool> _frameChanged;
atomic<bool> _stopFlag;
uint32_t _frameCount = 0;
bool _forceFilterUpdate = false;
double _lastAspectRatio = 0.0;
FrameInfo _baseFrameSize = {};
FrameInfo _lastFrameSize = {};
RenderedFrame _frame = {};
VideoFilterType _videoFilterType = VideoFilterType::None;
unique_ptr<BaseVideoFilter> _videoFilter;
unique_ptr<ScaleFilter> _scaleFilter;
unique_ptr<RotateFilter> _rotateFilter;
void UpdateVideoFilter();
void DecodeThread();
public:
VideoDecoder(Emulator* console);
~VideoDecoder();
void Init();
void DecodeFrame(bool synchronous = false);
void TakeScreenshot(string romName = "");
void TakeScreenshot(std::stringstream& stream);
void ForceFilterUpdate() { _forceFilterUpdate = true; }
uint32_t GetFrameCount();
FrameInfo GetBaseFrameInfo(bool removeOverscan);
FrameInfo GetFrameInfo();
double GetLastFrameScale() { return _frame.Scale; }
void UpdateFrame(RenderedFrame frame, bool sync, bool forRewind);
void WaitForAsyncFrameDecode();
bool IsRunning();
void StartThread();
void StopThread();
};