aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2021-11-17 20:42:11 +0100
committerArisotura <thetotalworm@gmail.com>2021-11-17 20:42:11 +0100
commit5bb8f4c9226ec5967bb3a994a37d38435a44223e (patch)
treed7f7de13a433a3b132e1d9f39df582954187b460 /src/frontend/qt_sdl
parent69715043cad65db6e5adb252746f9ec4c1f61087 (diff)
* remove more Config dependencies from the core
* also use less shitty strings
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r--src/frontend/qt_sdl/Platform.cpp38
-rw-r--r--src/frontend/qt_sdl/PlatformConfig.cpp22
-rw-r--r--src/frontend/qt_sdl/PlatformConfig.h11
3 files changed, 60 insertions, 11 deletions
diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp
index 0d31e27..283b497 100644
--- a/src/frontend/qt_sdl/Platform.cpp
+++ b/src/frontend/qt_sdl/Platform.cpp
@@ -43,6 +43,7 @@
#endif
#include <QStandardPaths>
+#include <QString>
#include <QDir>
#include <QThread>
#include <QSemaphore>
@@ -133,7 +134,9 @@ int GetConfigInt(ConfigEntry entry)
switch (entry)
{
+#ifdef JIT_ENABLED
case JIT_MaxBlockSize: return Config::JIT_MaxBlockSize;
+#endif
case DLDI_ImageSize: return imgsizes[Config::DLDISize];
@@ -147,10 +150,14 @@ bool GetConfigBool(ConfigEntry entry)
{
switch (entry)
{
+#ifdef JIT_ENABLED
case JIT_Enable: return Config::JIT_Enable != 0;
case JIT_LiteralOptimizations: return Config::JIT_LiteralOptimisations != 0;
case JIT_BranchOptimizations: return Config::JIT_BranchOptimisations != 0;
case JIT_FastMemory: return Config::JIT_FastMemory != 0;
+#endif
+
+ case ExternalBIOSEnable: return Config::ExternalBIOSEnable != 0;
case DLDI_Enable: return Config::DLDIEnable != 0;
case DLDI_ReadOnly: return Config::DLDIReadOnly != 0;
@@ -168,6 +175,15 @@ std::string GetConfigString(ConfigEntry entry)
{
switch (entry)
{
+ case BIOS9Path: return Config::BIOS9Path;
+ case BIOS7Path: return Config::BIOS7Path;
+ case FirmwarePath: return Config::FirmwarePath;
+
+ case DSi_BIOS9Path: return Config::DSiBIOS9Path;
+ case DSi_BIOS7Path: return Config::DSiBIOS7Path;
+ case DSi_FirmwarePath: return Config::DSiFirmwarePath;
+ case DSi_NANDPath: return Config::DSiNANDPath;
+
case DLDI_ImagePath: return Config::DLDISDPath;
case DLDI_FolderPath: return Config::DLDIFolderPath;
@@ -179,9 +195,9 @@ std::string GetConfigString(ConfigEntry entry)
}
-FILE* OpenFile(const char* path, const char* mode, bool mustexist)
+FILE* OpenFile(std::string path, std::string mode, bool mustexist)
{
- QFile f(path);
+ QFile f(path.c_str());
if (mustexist && !f.exists())
{
@@ -189,11 +205,11 @@ FILE* OpenFile(const char* path, const char* mode, bool mustexist)
}
QIODevice::OpenMode qmode;
- if (strlen(mode) > 1 && mode[0] == 'r' && mode[1] == '+')
+ if (mode.length() > 1 && mode[0] == 'r' && mode[1] == '+')
{
qmode = QIODevice::OpenModeFlag::ReadWrite;
}
- else if (strlen(mode) > 1 && mode[0] == 'w' && mode[1] == '+')
+ else if (mode.length() > 1 && mode[0] == 'w' && mode[1] == '+')
{
qmode = QIODevice::OpenModeFlag::Truncate | QIODevice::OpenModeFlag::ReadWrite;
}
@@ -207,36 +223,36 @@ FILE* OpenFile(const char* path, const char* mode, bool mustexist)
}
f.open(qmode);
- FILE* file = fdopen(dup(f.handle()), mode);
+ FILE* file = fdopen(dup(f.handle()), mode.c_str());
f.close();
return file;
}
-FILE* OpenLocalFile(const char* path, const char* mode)
+FILE* OpenLocalFile(std::string path, std::string mode)
{
- QDir dir(path);
+ QDir dir(path.c_str());
QString fullpath;
if (dir.isAbsolute())
{
// If it's an absolute path, just open that.
- fullpath = path;
+ fullpath = path.c_str();
}
else
{
#ifdef PORTABLE
- fullpath = QString(EmuDirectory) + QDir::separator() + path;
+ fullpath = QString(EmuDirectory) + QDir::separator() + path.c_str();
#else
// Check user configuration directory
QDir config(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
config.mkdir("melonDS");
fullpath = config.absolutePath() + "/melonDS/";
- fullpath.append(path);
+ fullpath.append(path.c_str());
#endif
}
- return OpenFile(fullpath.toUtf8(), mode, mode[0] != 'w');
+ return OpenFile(fullpath.toStdString(), mode, mode[0] != 'w');
}
Thread* Thread_Create(std::function<void()> func)
diff --git a/src/frontend/qt_sdl/PlatformConfig.cpp b/src/frontend/qt_sdl/PlatformConfig.cpp
index a224b66..70fc852 100644
--- a/src/frontend/qt_sdl/PlatformConfig.cpp
+++ b/src/frontend/qt_sdl/PlatformConfig.cpp
@@ -71,6 +71,17 @@ int JIT_LiteralOptimisations = true;
int JIT_FastMemory = true;
#endif
+int ExternalBIOSEnable;
+
+char BIOS9Path[1024];
+char BIOS7Path[1024];
+char FirmwarePath[1024];
+
+char DSiBIOS9Path[1024];
+char DSiBIOS7Path[1024];
+char DSiFirmwarePath[1024];
+char DSiNANDPath[1024];
+
int DLDIEnable;
char DLDISDPath[1024];
int DLDISize;
@@ -206,6 +217,17 @@ ConfigEntry PlatformConfigFile[] =
#endif
#endif
+ {"ExternalBIOSEnable", 0, &ExternalBIOSEnable, 0, NULL, 0},
+
+ {"BIOS9Path", 1, BIOS9Path, 0, "", 1023},
+ {"BIOS7Path", 1, BIOS7Path, 0, "", 1023},
+ {"FirmwarePath", 1, FirmwarePath, 0, "", 1023},
+
+ {"DSiBIOS9Path", 1, DSiBIOS9Path, 0, "", 1023},
+ {"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023},
+ {"DSiFirmwarePath", 1, DSiFirmwarePath, 0, "", 1023},
+ {"DSiNANDPath", 1, DSiNANDPath, 0, "", 1023},
+
{"DLDIEnable", 0, &DLDIEnable, 0, NULL, 0},
{"DLDISDPath", 1, DLDISDPath, 0, "dldi.bin", 1023},
{"DLDISize", 0, &DLDISize, 0, NULL, 0},
diff --git a/src/frontend/qt_sdl/PlatformConfig.h b/src/frontend/qt_sdl/PlatformConfig.h
index 891606c..0a224e9 100644
--- a/src/frontend/qt_sdl/PlatformConfig.h
+++ b/src/frontend/qt_sdl/PlatformConfig.h
@@ -87,6 +87,17 @@ extern int JIT_LiteralOptimisations;
extern int JIT_FastMemory;
#endif
+extern int ExternalBIOSEnable;
+
+extern char BIOS9Path[1024];
+extern char BIOS7Path[1024];
+extern char FirmwarePath[1024];
+
+extern char DSiBIOS9Path[1024];
+extern char DSiBIOS7Path[1024];
+extern char DSiFirmwarePath[1024];
+extern char DSiNANDPath[1024];
+
extern int DLDIEnable;
extern char DLDISDPath[1024];
extern int DLDISize;