mirror of https://github.com/mgba-emu/mgba.git
Qt: Pass logging context through to video proxy thread (fixes #3095)
This commit is contained in:
parent
4590dfc68b
commit
7727b6434d
1
CHANGES
1
CHANGES
|
@ -28,6 +28,7 @@ Misc:
|
|||
- mGUI: Persist fast forwarding after closing menu (fixes mgba.io/i/2414)
|
||||
- Qt: Handle multiple save game files for disparate games separately (fixes mgba.io/i/2887)
|
||||
- Qt: Remove maligned double-click-to-fullscreen shortcut (closes mgba.io/i/2632)
|
||||
- Qt: Pass logging context through to video proxy thread (fixes mgba.io/i/3095)
|
||||
- Scripting: Add `callbacks:oneshot` for single-call callbacks
|
||||
- Switch: Add bilinear filtering option (closes mgba.io/i/3111)
|
||||
- Vita: Add imc0 and xmc0 mount point support
|
||||
|
|
|
@ -48,12 +48,14 @@ VideoProxy::~VideoProxy() {
|
|||
|
||||
void VideoProxy::attach(CoreController* controller) {
|
||||
CoreController::Interrupter interrupter(controller);
|
||||
m_logContext = &controller->thread()->logger.d;
|
||||
controller->thread()->core->videoLogger = &m_logger;
|
||||
}
|
||||
|
||||
void VideoProxy::detach(CoreController* controller) {
|
||||
CoreController::Interrupter interrupter(controller);
|
||||
if (controller->thread()->core->videoLogger == &m_logger) {
|
||||
m_logContext = nullptr;
|
||||
controller->thread()->core->videoLogger = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -64,11 +66,13 @@ void VideoProxy::setProxiedBackend(VideoBackend* backend) {
|
|||
}
|
||||
|
||||
void VideoProxy::processData() {
|
||||
mLogSetThreadLogger(m_logContext);
|
||||
mVideoLoggerRendererRun(&m_logger, false);
|
||||
m_fromThreadCond.wakeAll();
|
||||
}
|
||||
|
||||
void VideoProxy::processCommands() {
|
||||
mLogSetThreadLogger(m_logContext);
|
||||
mVideoProxyBackendRun(&m_backend, false);
|
||||
}
|
||||
|
||||
|
@ -88,6 +92,7 @@ bool VideoProxy::writeData(const void* data, size_t length) {
|
|||
while (!RingFIFOWrite(&m_dirtyQueue, data, length)) {
|
||||
if (QThread::currentThread() == thread()) {
|
||||
// We're on the main thread
|
||||
mLogSetThreadLogger(m_logContext);
|
||||
mVideoLoggerRendererRun(&m_logger, false);
|
||||
} else {
|
||||
emit dataAvailable();
|
||||
|
@ -124,6 +129,7 @@ void VideoProxy::postEvent(enum mVideoLoggerEvent event) {
|
|||
|
||||
void VideoProxy::handleEvent(int event) {
|
||||
QMutexLocker locker(&m_mutex);
|
||||
mLogSetThreadLogger(m_logContext);
|
||||
m_logger.handleEvent(&m_logger, static_cast<enum mVideoLoggerEvent>(event));
|
||||
}
|
||||
|
||||
|
@ -140,6 +146,7 @@ void VideoProxy::wait() {
|
|||
while (RingFIFOSize(&m_dirtyQueue)) {
|
||||
if (QThread::currentThread() == thread()) {
|
||||
// We're on the main thread
|
||||
mLogSetThreadLogger(m_logContext);
|
||||
mVideoLoggerRendererRun(&m_logger, false);
|
||||
} else {
|
||||
emit dataAvailable();
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <QReadWriteLock>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include <mgba/core/log.h>
|
||||
#include <mgba/feature/video-logger.h>
|
||||
#include <mgba/feature/proxy-backend.h>
|
||||
#include <mgba-util/ring-fifo.h>
|
||||
|
@ -72,6 +73,7 @@ private:
|
|||
} m_logger;
|
||||
|
||||
struct mVideoProxyBackend m_backend;
|
||||
struct mLogger* m_logContext = nullptr;
|
||||
|
||||
RingFIFO m_dirtyQueue;
|
||||
QMutex m_mutex;
|
||||
|
|
Loading…
Reference in New Issue