remove some stuff from Platform
This commit is contained in:
parent
5fb8836440
commit
41e9715f7f
|
@ -79,18 +79,6 @@ enum StopReason {
|
|||
*/
|
||||
void SignalStop(StopReason reason);
|
||||
|
||||
/**
|
||||
* @returns The ID of the running melonDS instance if running in local multiplayer mode,
|
||||
* or 0 if not.
|
||||
*/
|
||||
int InstanceID();
|
||||
|
||||
/**
|
||||
* @returns A suffix that should be appended to all instance-specific paths
|
||||
* if running in local multiplayer mode,
|
||||
* or the empty string if not.
|
||||
*/
|
||||
std::string InstanceFileSuffix();
|
||||
|
||||
/**
|
||||
* Denotes how a file will be opened and accessed.
|
||||
|
|
|
@ -108,6 +108,15 @@ EmuInstance::~EmuInstance()
|
|||
}
|
||||
|
||||
|
||||
std::string EmuInstance::instanceFileSuffix()
|
||||
{
|
||||
if (instanceID == 0) return "";
|
||||
|
||||
char suffix[16] = {0};
|
||||
snprintf(suffix, 15, ".%d", instanceID+1);
|
||||
return suffix;
|
||||
}
|
||||
|
||||
void EmuInstance::createWindow()
|
||||
{
|
||||
if (numWindows >= kMaxWindows)
|
||||
|
@ -557,7 +566,7 @@ bool EmuInstance::loadState(const std::string& filename)
|
|||
|
||||
std::string savefile = filename.substr(lastSep(filename)+1);
|
||||
savefile = getAssetPath(false, globalCfg.GetString("SaveFilePath"), ".sav", savefile);
|
||||
savefile += Platform::InstanceFileSuffix();
|
||||
savefile += instanceFileSuffix();
|
||||
ndsSave->SetPath(savefile, true);
|
||||
}
|
||||
|
||||
|
@ -608,7 +617,7 @@ bool EmuInstance::saveState(const std::string& filename)
|
|||
{
|
||||
std::string savefile = filename.substr(lastSep(filename)+1);
|
||||
savefile = getAssetPath(false, globalCfg.GetString("SaveFilePath"), ".sav", savefile);
|
||||
savefile += Platform::InstanceFileSuffix();
|
||||
savefile += instanceFileSuffix();
|
||||
ndsSave->SetPath(savefile, false);
|
||||
}
|
||||
|
||||
|
@ -1170,7 +1179,7 @@ void EmuInstance::reset()
|
|||
{
|
||||
std::string oldsave = ndsSave->GetPath();
|
||||
std::string newsave = getAssetPath(false, globalCfg.GetString("SaveFilePath"), ".sav");
|
||||
newsave += Platform::InstanceFileSuffix();
|
||||
newsave += instanceFileSuffix();
|
||||
if (oldsave != newsave)
|
||||
ndsSave->SetPath(newsave, false);
|
||||
}
|
||||
|
@ -1179,7 +1188,7 @@ void EmuInstance::reset()
|
|||
{
|
||||
std::string oldsave = gbaSave->GetPath();
|
||||
std::string newsave = getAssetPath(true, globalCfg.GetString("SaveFilePath"), ".sav");
|
||||
newsave += Platform::InstanceFileSuffix();
|
||||
newsave += instanceFileSuffix();
|
||||
if (oldsave != newsave)
|
||||
gbaSave->SetPath(newsave, false);
|
||||
}
|
||||
|
@ -1192,13 +1201,13 @@ void EmuInstance::reset()
|
|||
if (globalCfg.GetBool("Emu.ExternalBIOSEnable"))
|
||||
{
|
||||
if (nds->ConsoleType == 1)
|
||||
newsave = globalCfg.GetString("DSi.FirmwarePath") + Platform::InstanceFileSuffix();
|
||||
newsave = globalCfg.GetString("DSi.FirmwarePath") + instanceFileSuffix();
|
||||
else
|
||||
newsave = globalCfg.GetString("DS.FirmwarePath") + Platform::InstanceFileSuffix();
|
||||
newsave = globalCfg.GetString("DS.FirmwarePath") + instanceFileSuffix();
|
||||
}
|
||||
else
|
||||
{
|
||||
newsave = kWifiSettingsPath + Platform::InstanceFileSuffix();
|
||||
newsave = kWifiSettingsPath + instanceFileSuffix();
|
||||
}
|
||||
|
||||
if (oldsave != newsave)
|
||||
|
@ -1341,7 +1350,7 @@ pair<unique_ptr<Firmware>, string> EmuInstance::generateDefaultFirmware()
|
|||
// Try to open the instanced Wi-fi settings, falling back to the regular Wi-fi settings if they don't exist.
|
||||
// We don't need to save the whole firmware, just the part that may actually change.
|
||||
std::string wfcsettingspath = kWifiSettingsPath;
|
||||
settingspath = wfcsettingspath + Platform::InstanceFileSuffix();
|
||||
settingspath = wfcsettingspath + instanceFileSuffix();
|
||||
FileHandle* f = Platform::OpenLocalFile(settingspath, FileMode::Read);
|
||||
if (!f)
|
||||
{
|
||||
|
@ -1493,13 +1502,12 @@ void EmuInstance::customizeFirmware(Firmware& firmware, bool overridesettings) n
|
|||
}
|
||||
}
|
||||
|
||||
int inst = Platform::InstanceID();
|
||||
if (inst > 0)
|
||||
if (instanceID > 0)
|
||||
{
|
||||
rep = true;
|
||||
mac[3] += inst;
|
||||
mac[4] += inst*0x44;
|
||||
mac[5] += inst*0x10;
|
||||
mac[3] += instanceID;
|
||||
mac[4] += instanceID*0x44;
|
||||
mac[5] += instanceID*0x10;
|
||||
}
|
||||
|
||||
if (rep)
|
||||
|
@ -1630,7 +1638,7 @@ bool EmuInstance::loadROM(QStringList filepath, bool reset)
|
|||
|
||||
std::string savname = getAssetPath(false, globalCfg.GetString("SaveFilePath"), ".sav");
|
||||
std::string origsav = savname;
|
||||
savname += Platform::InstanceFileSuffix();
|
||||
savname += instanceFileSuffix();
|
||||
|
||||
FileHandle* sav = Platform::OpenFile(savname, FileMode::Read);
|
||||
if (!sav)
|
||||
|
@ -1772,7 +1780,7 @@ bool EmuInstance::loadGBAROM(QStringList filepath)
|
|||
|
||||
std::string savname = getAssetPath(true, globalCfg.GetString("SaveFilePath"), ".sav");
|
||||
std::string origsav = savname;
|
||||
savname += Platform::InstanceFileSuffix();
|
||||
savname += instanceFileSuffix();
|
||||
|
||||
FileHandle* sav = Platform::OpenFile(savname, FileMode::Read);
|
||||
if (!sav)
|
||||
|
|
|
@ -84,6 +84,8 @@ public:
|
|||
Config::Table& getGlobalConfig() { return globalCfg; }
|
||||
Config::Table& getLocalConfig() { return localCfg; }
|
||||
|
||||
std::string instanceFileSuffix();
|
||||
|
||||
void createWindow();
|
||||
|
||||
void osdAddMessage(unsigned int color, const char* fmt, ...);
|
||||
|
|
|
@ -420,7 +420,7 @@ void EmuThread::run()
|
|||
if (winUpdateFreq < 1)
|
||||
winUpdateFreq = 1;
|
||||
|
||||
int inst = Platform::InstanceID();
|
||||
int inst = emuInstance->instanceID;
|
||||
if (inst == 0)
|
||||
sprintf(melontitle, "[%d/%.0f] melonDS " MELONDS_VERSION, fps, fpstarget);
|
||||
else
|
||||
|
@ -439,7 +439,7 @@ void EmuThread::run()
|
|||
|
||||
EmuStatus = EmuRunning;
|
||||
|
||||
int inst = Platform::InstanceID();
|
||||
int inst = emuInstance->instanceID;
|
||||
if (inst == 0)
|
||||
sprintf(melontitle, "melonDS " MELONDS_VERSION);
|
||||
else
|
||||
|
@ -483,7 +483,6 @@ void EmuThread::run()
|
|||
EmuStatus = emuStatus_Exit;
|
||||
|
||||
NDS::Current = nullptr;
|
||||
// nds is out of scope, so unique_ptr cleans it up for us
|
||||
}
|
||||
|
||||
void EmuThread::changeWindowTitle(char* title)
|
||||
|
|
|
@ -53,7 +53,7 @@ PathSettingsDialog::PathSettingsDialog(QWidget* parent) : QDialog(parent), ui(ne
|
|||
ui->txtSavestatePath->setText(cfg.GetQString("SavestatePath"));
|
||||
ui->txtCheatFilePath->setText(cfg.GetQString("CheatFilePath"));
|
||||
|
||||
int inst = Platform::InstanceID();
|
||||
int inst = emuInstance->getInstanceID();
|
||||
if (inst > 0)
|
||||
ui->lblInstanceNum->setText(QString("Configuring paths for instance %1").arg(inst+1));
|
||||
else
|
||||
|
|
|
@ -204,21 +204,6 @@ void SignalStop(StopReason reason)
|
|||
}
|
||||
|
||||
|
||||
int InstanceID()
|
||||
{
|
||||
return IPCInstanceID;
|
||||
}
|
||||
|
||||
std::string InstanceFileSuffix()
|
||||
{
|
||||
int inst = IPCInstanceID;
|
||||
if (inst == 0) return "";
|
||||
|
||||
char suffix[16] = {0};
|
||||
snprintf(suffix, 15, ".%d", inst+1);
|
||||
return suffix;
|
||||
}
|
||||
|
||||
static QIODevice::OpenMode GetQMode(FileMode mode)
|
||||
{
|
||||
QIODevice::OpenMode qmode = QIODevice::OpenModeFlag::NotOpen;
|
||||
|
|
|
@ -89,7 +89,7 @@ PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent),
|
|||
}
|
||||
|
||||
|
||||
int inst = Platform::InstanceID();
|
||||
int inst = emuInstance->getInstanceID();
|
||||
if (inst > 0)
|
||||
ui->lblInstanceNum->setText(QString("Setting battery levels for instance %1").arg(inst+1));
|
||||
else
|
||||
|
|
|
@ -16,20 +16,13 @@
|
|||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#ifndef _WIN32
|
||||
#ifndef APPLE
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
|
@ -57,12 +50,6 @@
|
|||
using namespace melonDS;
|
||||
|
||||
|
||||
// TEMP
|
||||
extern bool RunningSomething;
|
||||
|
||||
extern int videoRenderer;
|
||||
extern bool videoSettingsDirty;
|
||||
|
||||
const u32 kOSDMargin = 6;
|
||||
|
||||
|
||||
|
|
|
@ -232,8 +232,6 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
|||
setAcceptDrops(true);
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
|
||||
//int inst = Platform::InstanceID();
|
||||
|
||||
QMenuBar* menubar = new QMenuBar();
|
||||
{
|
||||
QMenu* menu = menubar->addMenu("File");
|
||||
|
|
Loading…
Reference in New Issue