remove some more shitty strings

This commit is contained in:
Arisotura 2021-11-17 20:57:30 +01:00
parent 5bb8f4c922
commit 13afaa0303
5 changed files with 32 additions and 37 deletions

View File

@ -30,7 +30,7 @@
AudioSettingsDialog* AudioSettingsDialog::currentDlg = nullptr;
extern char* EmuDirectory;
extern std::string EmuDirectory;
AudioSettingsDialog::AudioSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AudioSettingsDialog)
@ -129,7 +129,7 @@ void AudioSettingsDialog::on_btnMicWavBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select WAV file...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"WAV files (*.wav);;Any file (*.*)");
if (file.isEmpty()) return;

View File

@ -32,7 +32,7 @@
CheatsDialog* CheatsDialog::currentDlg = nullptr;
extern char* EmuDirectory;
extern std::string EmuDirectory;
namespace Frontend { extern ARCodeFile* CheatFile; }

View File

@ -33,7 +33,7 @@
EmuSettingsDialog* EmuSettingsDialog::currentDlg = nullptr;
extern char* EmuDirectory;
extern std::string EmuDirectory;
extern bool RunningSomething;
bool EmuSettingsDialog::needsReset = false;
@ -294,7 +294,7 @@ void EmuSettingsDialog::on_btnBIOS9Browse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DS-mode ARM9 BIOS...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"BIOS files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
@ -306,7 +306,7 @@ void EmuSettingsDialog::on_btnBIOS7Browse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DS-mode ARM7 BIOS...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"BIOS files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
@ -318,7 +318,7 @@ void EmuSettingsDialog::on_btnFirmwareBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DS-mode firmware...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"Firmware files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
@ -330,7 +330,7 @@ void EmuSettingsDialog::on_btnDSiBIOS9Browse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi-mode ARM9 BIOS...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"BIOS files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
@ -342,7 +342,7 @@ void EmuSettingsDialog::on_btnDSiBIOS7Browse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi-mode ARM7 BIOS...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"BIOS files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
@ -368,7 +368,7 @@ void EmuSettingsDialog::on_btnDLDISDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DLDI SD image...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"Image files (*.bin *.rom *.img *.dmg);;Any file (*.*)");
if (file.isEmpty()) return;
@ -387,7 +387,7 @@ void EmuSettingsDialog::on_btnDLDIFolderBrowse_clicked()
{
QString dir = QFileDialog::getExistingDirectory(this,
"Select DLDI SD folder...",
EmuDirectory);
QString::fromStdString(EmuDirectory));
if (dir.isEmpty()) return;
@ -398,7 +398,7 @@ void EmuSettingsDialog::on_btnDSiFirmwareBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi DS-mode firmware...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"Firmware files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
@ -410,7 +410,7 @@ void EmuSettingsDialog::on_btnDSiNANDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi NAND...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"NAND files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
@ -436,7 +436,7 @@ void EmuSettingsDialog::on_btnDSiSDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi SD image...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"Image files (*.bin *.rom *.img *.dmg);;Any file (*.*)");
if (file.isEmpty()) return;
@ -455,7 +455,7 @@ void EmuSettingsDialog::on_btnDSiSDFolderBrowse_clicked()
{
QString dir = QFileDialog::getExistingDirectory(this,
"Select DSi SD folder...",
EmuDirectory);
QString::fromStdString(EmuDirectory));
if (dir.isEmpty()) return;

View File

@ -61,7 +61,7 @@
#endif
char* EmuDirectory;
std::string EmuDirectory;
void emuStop();
@ -90,35 +90,29 @@ void Init(int argc, char** argv)
}
if (len > 0)
{
EmuDirectory = new char[len+1];
strncpy(EmuDirectory, argv[0], len);
EmuDirectory[len] = '\0';
std::string emudir = argv[0];
EmuDirectory = emudir.substr(0, len);
}
else
{
EmuDirectory = new char[2];
strcpy(EmuDirectory, ".");
EmuDirectory = ".";
}
}
else
{
EmuDirectory = new char[2];
strcpy(EmuDirectory, ".");
EmuDirectory = ".";
}
#else
QString confdir;
QDir config(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
config.mkdir("melonDS");
confdir = config.absolutePath() + "/melonDS/";
EmuDirectory = new char[confdir.length() + 1];
memcpy(EmuDirectory, confdir.toUtf8().data(), confdir.length());
EmuDirectory[confdir.length()] = '\0';
EmuDirectory = confdir.toStdString();
#endif
}
void DeInit()
{
delete[] EmuDirectory;
}
@ -197,7 +191,7 @@ std::string GetConfigString(ConfigEntry entry)
FILE* OpenFile(std::string path, std::string mode, bool mustexist)
{
QFile f(path.c_str());
QFile f(QString::fromStdString(path));
if (mustexist && !f.exists())
{
@ -231,24 +225,25 @@ FILE* OpenFile(std::string path, std::string mode, bool mustexist)
FILE* OpenLocalFile(std::string path, std::string mode)
{
QDir dir(path.c_str());
QString qpath = QString::fromStdString(path);
QDir dir(qpath);
QString fullpath;
if (dir.isAbsolute())
{
// If it's an absolute path, just open that.
fullpath = path.c_str();
fullpath = qpath;
}
else
{
#ifdef PORTABLE
fullpath = QString(EmuDirectory) + QDir::separator() + path.c_str();
fullpath = QString::fromStdString(EmuDirectory) + QDir::separator() + qpath;
#else
// Check user configuration directory
QDir config(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
config.mkdir("melonDS");
fullpath = config.absolutePath() + "/melonDS/";
fullpath.append(path.c_str());
fullpath.append(qpath);
#endif
}

View File

@ -35,7 +35,7 @@
FILE* TitleManagerDialog::curNAND = nullptr;
TitleManagerDialog* TitleManagerDialog::currentDlg = nullptr;
extern char* EmuDirectory;
extern std::string EmuDirectory;
TitleManagerDialog::TitleManagerDialog(QWidget* parent) : QDialog(parent), ui(new Ui::TitleManagerDialog)
@ -285,7 +285,7 @@ void TitleManagerDialog::onImportTitleData()
QString file = QFileDialog::getOpenFileName(this,
"Select file to import...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"Title data files (*.sav);;Any file (*.*)");
if (file.isEmpty()) return;
@ -355,7 +355,7 @@ void TitleManagerDialog::onExportTitleData()
QString file = QFileDialog::getSaveFileName(this,
"Select path to export to...",
QString(EmuDirectory) + exportname,
QString::fromStdString(EmuDirectory) + exportname,
"Title data files (*.sav);;Any file (*.*)");
if (file.isEmpty()) return;
@ -528,7 +528,7 @@ void TitleImportDialog::on_btnAppBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select title executable...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"DSiWare executables (*.app *.nds *.dsi *.srl);;Any file (*.*)");
if (file.isEmpty()) return;
@ -540,7 +540,7 @@ void TitleImportDialog::on_btnTmdBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select title metadata...",
EmuDirectory,
QString::fromStdString(EmuDirectory),
"DSiWare metadata (*.tmd);;Any file (*.*)");
if (file.isEmpty()) return;