port video settings shit

This commit is contained in:
Arisotura 2024-05-26 21:28:00 +02:00
parent de18f029a6
commit 5fb8836440
12 changed files with 183 additions and 165 deletions

View File

@ -37,17 +37,6 @@ namespace Config
{
using namespace melonDS;
bool ScreenUseGL;
bool ScreenVSync;
int ScreenVSyncInterval;
int _3DRenderer;
bool Threaded3D;
int GL_ScaleFactor;
bool GL_BetterPolygons;
bool GL_HiresCoordinates;
const char* kConfigFile = "melonDS.toml";
@ -63,6 +52,7 @@ DefaultList<int> DefaultInts =
{"Instance*.Window*.Width", 256},
{"Instance*.Window*.Height", 384},
{"Screen.VSyncInterval", 1},
{"3D.Renderer", renderer3D_Software},
{"3D.GL.ScaleFactor", 1},
{"MaxFPS", 1000},
#ifdef JIT_ENABLED
@ -86,11 +76,7 @@ DefaultList<int> DefaultInts =
RangeList IntRanges =
{
{"Emu.ConsoleType", {0, 1}},
#ifdef OGLRENDERER_ENABLED
{"3D.Renderer", {0, 1}},
#else
{"3D.Renderer", {0, 0}},
#endif
{"3D.Renderer", {0, renderer3D_Max-1}},
{"Screen.VSyncInterval", {1, 20}},
{"3D.GL.ScaleFactor", {1, 16}},
{"Audio.Interpolation", {0, 3}},
@ -108,7 +94,8 @@ RangeList IntRanges =
DefaultList<bool> DefaultBools =
{
{"Screen.Filter", true},
{"3D.Soft.Threaded3D", true},
{"3D.Soft.Threaded", true},
{"3D.GL.HiresCoordinates", true},
{"LimitFPS", true},
{"Window*.ShowOSD", true},
{"Emu.DirectBoot", true},
@ -205,10 +192,11 @@ LegacyEntry LegacyFile[] =
{"ScreenVSyncInterval", 0, "Screen.VSyncInterval", false},
{"3DRenderer", 0, "3D.Renderer", false},
{"Threaded3D", 1, "3D.Soft.Threaded3D", false},
{"Threaded3D", 1, "3D.Soft.Threaded", false},
{"GL_ScaleFactor", 0, "3D.GL.ScaleFactor", false},
{"GL_BetterPolygons", 1, "3D.GL.BetterPolygons", false},
{"GL_HiresCoordinates", 1, "3D.GL.HiresCoordinates", false},
{"LimitFPS", 1, "LimitFPS", false},
{"MaxFPS", 0, "MaxFPS", false},

View File

@ -16,8 +16,8 @@
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#ifndef PLATFORMCONFIG_H
#define PLATFORMCONFIG_H
#ifndef CONFIG_H
#define CONFIG_H
#include <variant>
#include <string>
@ -131,18 +131,6 @@ private:
};
extern bool ScreenUseGL;
extern bool ScreenVSync;
extern int ScreenVSyncInterval;
extern int _3DRenderer;
extern bool Threaded3D;
extern int GL_ScaleFactor;
extern bool GL_BetterPolygons;
extern bool GL_HiresCoordinates;
bool Load();
void Save();
@ -151,4 +139,4 @@ inline Table GetGlobalTable() { return GetLocalTable(-1); }
}
#endif // PLATFORMCONFIG_H
#endif // CONFIG_H

View File

@ -156,6 +156,64 @@ void EmuInstance::osdAddMessage(unsigned int color, const char* fmt, ...)
}
bool EmuInstance::usesOpenGL()
{
return globalCfg.GetBool("Screen.UseGL") ||
(globalCfg.GetInt("3D.Renderer") != renderer3D_Software);
}
void EmuInstance::initOpenGL()
{
for (int i = 0; i < kMaxWindows; i++)
{
if (windowList[i])
windowList[i]->initOpenGL();
}
setVSyncGL(true);
}
void EmuInstance::deinitOpenGL()
{
for (int i = 0; i < kMaxWindows; i++)
{
if (windowList[i])
windowList[i]->deinitOpenGL();
}
}
void EmuInstance::setVSyncGL(bool vsync)
{
int intv;
vsync = vsync && globalCfg.GetBool("Screen.VSync");
if (vsync)
intv = globalCfg.GetInt("Screen.VSyncInterval");
else
intv = 0;
for (int i = 0; i < kMaxWindows; i++)
{
if (windowList[i])
windowList[i]->setGLSwapInterval(intv);
}
}
void EmuInstance::makeCurrentGL()
{
mainWindow->makeCurrentGL();
}
void EmuInstance::drawScreenGL()
{
for (int i = 0; i < kMaxWindows; i++)
{
if (windowList[i])
windowList[i]->drawScreenGL();
}
}
int EmuInstance::lastSep(const std::string& path)
{
int i = path.length() - 1;

View File

@ -88,6 +88,13 @@ public:
void osdAddMessage(unsigned int color, const char* fmt, ...);
bool usesOpenGL();
void initOpenGL();
void deinitOpenGL();
void setVSyncGL(bool vsync);
void makeCurrentGL();
void drawScreenGL();
// return: empty string = setup OK, non-empty = error message
QString verifySetup();

View File

@ -66,9 +66,6 @@ using namespace melonDS;
// TEMP
extern bool RunningSomething;
//extern MainWindow* mainWindow;
extern int autoScreenSizing;
extern int videoRenderer;
extern bool videoSettingsDirty;
EmuThread::EmuThread(EmuInstance* inst, QObject* parent) : QThread(parent)
@ -83,10 +80,6 @@ EmuThread::EmuThread(EmuInstance* inst, QObject* parent) : QThread(parent)
void EmuThread::attachWindow(MainWindow* window)
{
windowList.push_back(window);
window->attachEmuThread(this);
mainWindow = windowList.front();
connect(this, SIGNAL(windowUpdate()), window->panel, SLOT(repaint()));
connect(this, SIGNAL(windowTitleChange(QString)), window, SLOT(onTitleUpdate(QString)));
connect(this, SIGNAL(windowEmuStart()), window, SLOT(onEmuStart()));
@ -115,14 +108,11 @@ void EmuThread::detachWindow(MainWindow* window)
disconnect(this, SIGNAL(windowFullscreenToggle()), window, SLOT(onFullscreenToggled()));
disconnect(this, SIGNAL(swapScreensToggle()), window->actScreenSwap, SLOT(trigger()));
disconnect(this, SIGNAL(screenEmphasisToggle()), window, SLOT(onScreenEmphasisToggled()));
windowList.remove(window);
window->attachEmuThread(nullptr);
mainWindow = windowList.front();
}
void EmuThread::run()
{
Config::Table& globalCfg = emuInstance->getGlobalConfig();
u32 mainScreenPos[3];
Platform::FileHandle* file;
@ -136,25 +126,18 @@ void EmuThread::run()
videoSettingsDirty = false;
if (mainWindow->hasOpenGL())
if (emuInstance->usesOpenGL())
{
//screenGL = static_cast<ScreenPanelGL*>(mainWindow->panel);
//screenGL->initOpenGL();
//mainWindow->initOpenGL();
for (auto window : windowList)
window->initOpenGL();
emuInstance->initOpenGL();
useOpenGL = true;
videoRenderer = Config::_3DRenderer;
videoRenderer = globalCfg.GetInt("3D.Renderer");
}
else
{
//screenGL = nullptr;
useOpenGL = false;
videoRenderer = 0;
}
//screenGL = nullptr;
//videoRenderer = 0;
updateRenderer();
@ -253,20 +236,15 @@ void EmuThread::run()
}
if (useOpenGL)
mainWindow->makeCurrentGL();
emuInstance->makeCurrentGL();
// update render settings if needed
// HACK:
// once the fast forward hotkey is released, we need to update vsync
// to the old setting again
if (videoSettingsDirty || emuInstance->hotkeyReleased(HK_FastForward))
if (videoSettingsDirty)
{
if (useOpenGL)
{
for (auto window : windowList)
window->setGLSwapInterval(Config::ScreenVSync ? Config::ScreenVSyncInterval : 0);
videoRenderer = Config::_3DRenderer;
emuInstance->setVSyncGL(true);
videoRenderer = globalCfg.GetInt("3D.Renderer");
}
#ifdef OGLRENDERER_ENABLED
else
@ -353,9 +331,7 @@ void EmuThread::run()
else
{
FrontBuffer = emuInstance->nds->GPU.FrontBuffer;
//screenGL->drawScreenGL();
for (auto window : windowList)
window->drawScreenGL();
emuInstance->drawScreenGL();
}
#ifdef MELONCAP
@ -373,11 +349,17 @@ void EmuThread::run()
bool fastforward = emuInstance->hotkeyDown(HK_FastForward);
if (fastforward && useOpenGL && Config::ScreenVSync)
if (useOpenGL)
{
//screenGL->setSwapInterval(0);
for (auto window : windowList)
window->setGLSwapInterval(0);
// when using OpenGL: when toggling fast-forward, change the vsync interval
if (emuInstance->hotkeyPressed(HK_FastForward))
{
emuInstance->setVSyncGL(false);
}
else if (emuInstance->hotkeyReleased(HK_FastForward))
{
emuInstance->setVSyncGL(true);
}
}
if (emuInstance->audioDSiVolumeSync && emuInstance->nds->ConsoleType == 1)
@ -468,27 +450,20 @@ void EmuThread::run()
if (useOpenGL)
{
for (auto window : windowList)
window->drawScreenGL();
emuInstance->drawScreenGL();
}
ContextRequestKind contextRequest = ContextRequest;
if (contextRequest == contextRequest_InitGL)
{
//screenGL = static_cast<ScreenPanelGL*>(mainWindow->panel);
//screenGL->initOpenGL();
for (auto window : windowList)
window->initOpenGL();
emuInstance->initOpenGL();
useOpenGL = true;
ContextRequest = contextRequest_None;
}
else if (contextRequest == contextRequest_DeInitGL)
{
//screenGL->deinitOpenGL();
//screenGL = nullptr;
for (auto window : windowList)
window->deinitOpenGL();
emuInstance->deinitOpenGL();
useOpenGL = false;
ContextRequest = contextRequest_None;
@ -608,16 +583,23 @@ void EmuThread::updateRenderer()
}
lastVideoRenderer = videoRenderer;
auto& cfg = emuInstance->getGlobalConfig();
switch (videoRenderer)
{
case renderer3D_Software:
static_cast<SoftRenderer&>(emuInstance->nds->GPU.GetRenderer3D()).SetThreaded(Config::Threaded3D, emuInstance->nds->GPU);
static_cast<SoftRenderer&>(emuInstance->nds->GPU.GetRenderer3D()).SetThreaded(
cfg.GetBool("3D.Soft.Threaded"),
emuInstance->nds->GPU);
break;
case renderer3D_OpenGL:
static_cast<GLRenderer&>(emuInstance->nds->GPU.GetRenderer3D()).SetRenderSettings(Config::GL_BetterPolygons, Config::GL_ScaleFactor);
static_cast<GLRenderer&>(emuInstance->nds->GPU.GetRenderer3D()).SetRenderSettings(
cfg.GetBool("3D.GL.BetterPolygons"),
cfg.GetInt("3D.GL.ScaleFactor"));
break;
case renderer3D_OpenGLCompute:
static_cast<ComputeRenderer&>(emuInstance->nds->GPU.GetRenderer3D()).SetRenderSettings(Config::GL_ScaleFactor, Config::GL_HiresCoordinates);
static_cast<ComputeRenderer&>(emuInstance->nds->GPU.GetRenderer3D()).SetRenderSettings(
cfg.GetInt("3D.GL.ScaleFactor"),
cfg.GetBool("3D.GL.HiresCoordinates"));
break;
default: __builtin_unreachable();
}

View File

@ -67,6 +67,7 @@ public:
void initContext();
void deinitContext();
void updateVideoSettings() { videoSettingsDirty = true; }
int FrontBuffer = 0;
QMutex FrontBufferLock;
@ -122,10 +123,6 @@ private:
EmuInstance* emuInstance;
//ScreenPanelGL* screenGL;
MainWindow* mainWindow;
std::list<MainWindow*> windowList;
int autoScreenSizing;
int lastVideoRenderer = -1;

View File

@ -873,8 +873,6 @@ void ScreenPanelGL::initOpenGL()
glEnableVertexAttribArray(0); // position
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, (void*)(0));
glContext->SetSwapInterval(Config::ScreenVSync ? Config::ScreenVSyncInterval : 0);
transferLayout();
}

View File

@ -16,7 +16,6 @@
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#include <stdio.h>
#include <QFileDialog>
#include <QtGlobal>
@ -30,21 +29,25 @@
#include "ui_VideoSettingsDialog.h"
inline bool UsesGL()
inline bool VideoSettingsDialog::UsesGL()
{
return (Config::ScreenUseGL != 0) || (Config::_3DRenderer != renderer3D_Software);
auto& cfg = emuInstance->getGlobalConfig();
return cfg.GetBool("Screen.UseGL") || (cfg.GetInt("3D.Renderer") != renderer3D_Software);
}
VideoSettingsDialog* VideoSettingsDialog::currentDlg = nullptr;
void VideoSettingsDialog::setEnabled()
{
bool softwareRenderer = Config::_3DRenderer == renderer3D_Software;
auto& cfg = emuInstance->getGlobalConfig();
int renderer = cfg.GetInt("3D.Renderer");
bool softwareRenderer = renderer == renderer3D_Software;
ui->cbGLDisplay->setEnabled(softwareRenderer);
ui->cbSoftwareThreaded->setEnabled(softwareRenderer);
ui->cbxGLResolution->setEnabled(!softwareRenderer);
ui->cbBetterPolygons->setEnabled(Config::_3DRenderer == renderer3D_OpenGL);
ui->cbxComputeHiResCoords->setEnabled(Config::_3DRenderer == renderer3D_OpenGLCompute);
ui->cbBetterPolygons->setEnabled(renderer == renderer3D_OpenGL);
ui->cbxComputeHiResCoords->setEnabled(renderer == renderer3D_OpenGLCompute);
}
VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::VideoSettingsDialog)
@ -52,14 +55,17 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
oldRenderer = Config::_3DRenderer;
oldGLDisplay = Config::ScreenUseGL;
oldVSync = Config::ScreenVSync;
oldVSyncInterval = Config::ScreenVSyncInterval;
oldSoftThreaded = Config::Threaded3D;
oldGLScale = Config::GL_ScaleFactor;
oldGLBetterPolygons = Config::GL_BetterPolygons;
oldHiresCoordinates = Config::GL_HiresCoordinates;
emuInstance = ((MainWindow*)parent)->getEmuInstance();
auto& cfg = emuInstance->getGlobalConfig();
oldRenderer = cfg.GetInt("3D.Renderer");
oldGLDisplay = cfg.GetBool("Screen.UseGL");
oldVSync = cfg.GetBool("Screen.VSync");
oldVSyncInterval = cfg.GetInt("Screen.VSyncInterval");
oldSoftThreaded = cfg.GetBool("3D.Soft.Threaded");
oldGLScale = cfg.GetInt("3D.GL.ScaleFactor");
oldGLBetterPolygons = cfg.GetBool("3D.GL.BetterPolygons");
oldHiresCoordinates = cfg.GetBool("3D.GL.HiresCoordinates");
grp3DRenderer = new QButtonGroup(this);
grp3DRenderer->addButton(ui->rb3DSoftware, renderer3D_Software);
@ -70,7 +76,7 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
#else
connect(grp3DRenderer, SIGNAL(idClicked(int)), this, SLOT(onChange3DRenderer(int)));
#endif
grp3DRenderer->button(Config::_3DRenderer)->setChecked(true);
grp3DRenderer->button(oldRenderer)->setChecked(true);
#ifndef OGLRENDERER_ENABLED
ui->rb3DOpenGL->setEnabled(false);
@ -80,21 +86,21 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
ui->rb3DCompute->setEnabled(false);
#endif
ui->cbGLDisplay->setChecked(Config::ScreenUseGL != 0);
ui->cbGLDisplay->setChecked(oldGLDisplay != 0);
ui->cbVSync->setChecked(Config::ScreenVSync != 0);
ui->sbVSyncInterval->setValue(Config::ScreenVSyncInterval);
ui->cbVSync->setChecked(oldVSync != 0);
ui->sbVSyncInterval->setValue(oldVSyncInterval);
ui->cbSoftwareThreaded->setChecked(Config::Threaded3D != 0);
ui->cbSoftwareThreaded->setChecked(oldSoftThreaded);
for (int i = 1; i <= 16; i++)
ui->cbxGLResolution->addItem(QString("%1x native (%2x%3)").arg(i).arg(256*i).arg(192*i));
ui->cbxGLResolution->setCurrentIndex(Config::GL_ScaleFactor-1);
ui->cbxGLResolution->setCurrentIndex(oldGLScale-1);
ui->cbBetterPolygons->setChecked(Config::GL_BetterPolygons != 0);
ui->cbxComputeHiResCoords->setChecked(Config::GL_HiresCoordinates != 0);
ui->cbBetterPolygons->setChecked(oldGLBetterPolygons != 0);
ui->cbxComputeHiResCoords->setChecked(oldHiresCoordinates != 0);
if (!Config::ScreenVSync)
if (!oldVSync)
ui->sbVSyncInterval->setEnabled(false);
setVsyncControlEnable(UsesGL());
@ -117,14 +123,15 @@ void VideoSettingsDialog::on_VideoSettingsDialog_rejected()
{
bool old_gl = UsesGL();
Config::_3DRenderer = oldRenderer;
Config::ScreenUseGL = oldGLDisplay;
Config::ScreenVSync = oldVSync;
Config::ScreenVSyncInterval = oldVSyncInterval;
Config::Threaded3D = oldSoftThreaded;
Config::GL_ScaleFactor = oldGLScale;
Config::GL_BetterPolygons = oldGLBetterPolygons;
Config::GL_HiresCoordinates = oldHiresCoordinates;
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetInt("3D.Renderer", oldRenderer);
cfg.SetBool("Screen.UseGL", oldGLDisplay);
cfg.SetBool("Screen.VSync", oldVSync);
cfg.SetInt("Screen.VSyncInterval", oldVSyncInterval);
cfg.SetBool("3D.Soft.Threaded", oldSoftThreaded);
cfg.SetInt("3D.GL.ScaleFactor", oldGLScale);
cfg.SetBool("3D.GL.BetterPolygons", oldGLBetterPolygons);
cfg.SetBool("3D.GL.HiresCoordinates", oldHiresCoordinates);
emit updateVideoSettings(old_gl != UsesGL());
@ -141,7 +148,8 @@ void VideoSettingsDialog::onChange3DRenderer(int renderer)
{
bool old_gl = UsesGL();
Config::_3DRenderer = renderer;
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetInt("3D.Renderer", renderer);
setEnabled();
@ -152,7 +160,8 @@ void VideoSettingsDialog::on_cbGLDisplay_stateChanged(int state)
{
bool old_gl = UsesGL();
Config::ScreenUseGL = (state != 0);
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetBool("Screen.UseGL", (state != 0));
setVsyncControlEnable(UsesGL());
@ -163,19 +172,25 @@ void VideoSettingsDialog::on_cbVSync_stateChanged(int state)
{
bool vsync = (state != 0);
ui->sbVSyncInterval->setEnabled(vsync);
Config::ScreenVSync = vsync;
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetBool("Screen.VSync", vsync);
emit updateVideoSettings(false);
}
void VideoSettingsDialog::on_sbVSyncInterval_valueChanged(int val)
{
Config::ScreenVSyncInterval = val;
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetInt("Screen.VSyncInterval", val);
emit updateVideoSettings(false);
}
void VideoSettingsDialog::on_cbSoftwareThreaded_stateChanged(int state)
{
Config::Threaded3D = (state != 0);
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetBool("3D.Soft.Threaded", (state != 0));
emit updateVideoSettings(false);
}
@ -185,7 +200,8 @@ void VideoSettingsDialog::on_cbxGLResolution_currentIndexChanged(int idx)
// prevent a spurious change
if (ui->cbxGLResolution->count() < 16) return;
Config::GL_ScaleFactor = idx+1;
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetInt("3D.GL.ScaleFactor", idx+1);
setVsyncControlEnable(UsesGL());
@ -194,14 +210,16 @@ void VideoSettingsDialog::on_cbxGLResolution_currentIndexChanged(int idx)
void VideoSettingsDialog::on_cbBetterPolygons_stateChanged(int state)
{
Config::GL_BetterPolygons = (state != 0);
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetBool("3D.GL.BetterPolygons", (state != 0));
emit updateVideoSettings(false);
}
void VideoSettingsDialog::on_cbxComputeHiResCoords_stateChanged(int state)
{
Config::GL_HiresCoordinates = (state != 0);
auto& cfg = emuInstance->getGlobalConfig();
cfg.SetBool("3D.GL.HiresCoordinates", (state != 0));
emit updateVideoSettings(false);
}

View File

@ -24,6 +24,7 @@
namespace Ui { class VideoSettingsDialog; }
class VideoSettingsDialog;
class EmuInstance;
class VideoSettingsDialog : public QDialog
{
@ -33,6 +34,8 @@ public:
explicit VideoSettingsDialog(QWidget* parent);
~VideoSettingsDialog();
bool UsesGL();
static VideoSettingsDialog* currentDlg;
static VideoSettingsDialog* openDlg(QWidget* parent)
{
@ -73,6 +76,7 @@ private:
void setEnabled();
Ui::VideoSettingsDialog* ui;
EmuInstance* emuInstance;
QButtonGroup* grp3DRenderer;

View File

@ -107,9 +107,6 @@ static bool FileIsSupportedFiletype(const QString& filename, bool insideArchive)
extern CameraManager* camManager[2];
extern bool camStarted[2];
extern int videoRenderer;
extern bool videoSettingsDirty;
// AAAAAAA
static bool FileExtensionInList(const QString& filename, const QStringList& extensions, Qt::CaseSensitivity cs = Qt::CaseInsensitive)
@ -203,7 +200,8 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
emuInstance(inst),
globalCfg(inst->globalCfg),
localCfg(inst->localCfg),
windowCfg(localCfg.GetTable("Window"+std::to_string(id), "Window0"))
windowCfg(localCfg.GetTable("Window"+std::to_string(id), "Window0")),
emuThread(inst->getEmuThread())
{
test_num = test++;
#ifndef _WIN32
@ -709,11 +707,6 @@ MainWindow::~MainWindow()
delete[] actScreenAspectBot;
}
void MainWindow::attachEmuThread(EmuThread* thread)
{
emuThread = thread;
}
void MainWindow::osdAddMessage(unsigned int color, const char* msg)
{
if (!showOSD) return;
@ -731,16 +724,20 @@ void MainWindow::closeEvent(QCloseEvent* event)
if (hasOGL)
{
// we intentionally don't unpause here
// TODO this ought to change if we do multi-window shiz
emuThread->emuPause();
emuThread->deinitContext();
}
emuThread->detachWindow(this);
QMainWindow::closeEvent(event);
}
void MainWindow::createScreenPanel()
{
hasOGL = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
hasOGL = globalCfg.GetBool("Screen.UseGL") ||
(globalCfg.GetInt("3D.Renderer") != renderer3D_Software);
if (hasOGL)
{
@ -749,8 +746,7 @@ void MainWindow::createScreenPanel()
panel = panelGL;
bool res = panelGL->createContext();
printf("WIN %d CONTEXT: %d\n", test_num, res);
panelGL->createContext();
}
if (!hasOGL)
@ -777,7 +773,7 @@ GL::Context* MainWindow::getOGLContext()
}
void MainWindow::initOpenGL()
{printf("WINDOW %d INIT OPENGL %d\n", test_num, hasOGL);
{
if (!hasOGL) return;
ScreenPanelGL* glpanel = static_cast<ScreenPanelGL*>(panel);
@ -2087,8 +2083,7 @@ void MainWindow::onUpdateVideoSettings(bool glchange)
connect(emuThread, SIGNAL(windowUpdate()), panel, SLOT(repaint()));
}
printf("update video settings\n");
videoSettingsDirty = true;
emuThread->updateVideoSettings();
if (glchange)
{

View File

@ -110,8 +110,6 @@ public:
EmuInstance* getEmuInstance() { return emuInstance; }
Config::Table& getWindowConfig() { return windowCfg; }
void attachEmuThread(EmuThread* thread);
bool hasOpenGL() { return hasOGL; }
GL::Context* getOGLContext();
void initOpenGL();

View File

@ -135,17 +135,9 @@ bool RunningSomething;
//EmuThread* emuThread;
EmuInstance* testinst;
int autoScreenSizing = 0;
int videoRenderer;
bool videoSettingsDirty;
CameraManager* camManager[2];
bool camStarted[2];
//extern int AspectRatiosNum;
@ -299,7 +291,7 @@ int main(int argc, char** argv)
QString errorStr = "Failed to initialize SDL. This could indicate an issue with your audio driver.\n\nThe error was: ";
errorStr += err;
QMessageBox::critical(NULL, "melonDS", errorStr);
QMessageBox::critical(nullptr, "melonDS", errorStr);
return 1;
}
@ -308,17 +300,10 @@ int main(int argc, char** argv)
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_EnableScreenSaver(); SDL_DisableScreenSaver();
if (!Config::Load()) QMessageBox::critical(NULL, "melonDS", "Unable to write to config.\nPlease check the write permissions of the folder you placed melonDS in.");
#define SANITIZE(var, min, max) { var = std::clamp(var, min, max); }
#ifdef OGLRENDERER_ENABLED
SANITIZE(Config::_3DRenderer, 0, 1); // 0 is the software renderer, 1 is the OpenGL renderer
#else
SANITIZE(Config::_3DRenderer, 0, 0);
#endif
SANITIZE(Config::ScreenVSyncInterval, 1, 20);
SANITIZE(Config::GL_ScaleFactor, 1, 16);
#undef SANITIZE
if (!Config::Load())
QMessageBox::critical(nullptr,
"melonDS",
"Unable to write to config.\nPlease check the write permissions of the folder you placed melonDS in.");
camStarted[0] = false;
camStarted[1] = false;