mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
much simpler design for RTC stuff
This commit is contained in:
@ -337,6 +337,9 @@ void WriteGBASave(const u8* savedata, u32 savelen, u32 writeoffset, u32 writelen
|
|||||||
/// @param writelen The number of bytes that were written to firmware.
|
/// @param writelen The number of bytes that were written to firmware.
|
||||||
void WriteFirmware(const SPI_Firmware::Firmware& firmware, u32 writeoffset, u32 writelen);
|
void WriteFirmware(const SPI_Firmware::Firmware& firmware, u32 writeoffset, u32 writelen);
|
||||||
|
|
||||||
|
// called when the RTC date/time is changed and the frontend might need to take it into account
|
||||||
|
void WriteDateTime(int year, int month, int day, int hour, int minute, int second);
|
||||||
|
|
||||||
|
|
||||||
// local multiplayer comm interface
|
// local multiplayer comm interface
|
||||||
// packet type: DS-style TX header (12 bytes) + original 802.11 frame
|
// packet type: DS-style TX header (12 bytes) + original 802.11 frame
|
||||||
|
11
src/RTC.cpp
11
src/RTC.cpp
@ -455,6 +455,13 @@ void WriteDateTime(int num, u8 val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveDateTime()
|
||||||
|
{
|
||||||
|
int y, m, d, h, i, s;
|
||||||
|
GetDateTime(y, m, d, h, i, s);
|
||||||
|
Platform::WriteDateTime(y, m, d, h, i, s);
|
||||||
|
}
|
||||||
|
|
||||||
void CmdRead()
|
void CmdRead()
|
||||||
{
|
{
|
||||||
if ((CurCmd & 0x0F) == 0x06)
|
if ((CurCmd & 0x0F) == 0x06)
|
||||||
@ -607,11 +614,15 @@ void CmdWrite(u8 val)
|
|||||||
case 0x20:
|
case 0x20:
|
||||||
if (InputPos <= 7)
|
if (InputPos <= 7)
|
||||||
WriteDateTime(InputPos, val);
|
WriteDateTime(InputPos, val);
|
||||||
|
if (InputPos == 7)
|
||||||
|
SaveDateTime();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x60:
|
case 0x60:
|
||||||
if (InputPos <= 3)
|
if (InputPos <= 3)
|
||||||
WriteDateTime(InputPos+4, val);
|
WriteDateTime(InputPos+4, val);
|
||||||
|
if (InputPos == 3)
|
||||||
|
SaveDateTime();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x10:
|
case 0x10:
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
@ -140,10 +141,7 @@ int MouseHideSeconds;
|
|||||||
|
|
||||||
bool PauseLostFocus;
|
bool PauseLostFocus;
|
||||||
|
|
||||||
int RTCMode;
|
int64_t RTCOffset;
|
||||||
std::string RTCLastTime;
|
|
||||||
std::string RTCLastHostTime;
|
|
||||||
std::string RTCNewTime;
|
|
||||||
|
|
||||||
bool DSBatteryLevelOkay;
|
bool DSBatteryLevelOkay;
|
||||||
int DSiBatteryLevel;
|
int DSiBatteryLevel;
|
||||||
@ -344,10 +342,7 @@ ConfigEntry ConfigFile[] =
|
|||||||
{"MouseHideSeconds", 0, &MouseHideSeconds, 5, false},
|
{"MouseHideSeconds", 0, &MouseHideSeconds, 5, false},
|
||||||
{"PauseLostFocus", 1, &PauseLostFocus, false, false},
|
{"PauseLostFocus", 1, &PauseLostFocus, false, false},
|
||||||
|
|
||||||
{"RTCMode", 0, &RTCMode, 0, true},
|
{"RTCOffset", 3, &RTCOffset, 0LL, true},
|
||||||
{"RTCLastTime", 2, &RTCLastTime, (std::string)"", true},
|
|
||||||
{"RTCLastHostTime", 2, &RTCLastHostTime, (std::string)"", true},
|
|
||||||
{"RTCNewTime", 2, &RTCNewTime, (std::string)"", true},
|
|
||||||
|
|
||||||
{"DSBatteryLevelOkay", 1, &DSBatteryLevelOkay, true, true},
|
{"DSBatteryLevelOkay", 1, &DSBatteryLevelOkay, true, true},
|
||||||
{"DSiBatteryLevel", 0, &DSiBatteryLevel, 0xF, true},
|
{"DSiBatteryLevel", 0, &DSiBatteryLevel, 0xF, true},
|
||||||
@ -416,6 +411,7 @@ void LoadFile(int inst)
|
|||||||
case 0: *(int*)entry->Value = strtol(entryval, NULL, 10); break;
|
case 0: *(int*)entry->Value = strtol(entryval, NULL, 10); break;
|
||||||
case 1: *(bool*)entry->Value = strtol(entryval, NULL, 10) ? true:false; break;
|
case 1: *(bool*)entry->Value = strtol(entryval, NULL, 10) ? true:false; break;
|
||||||
case 2: *(std::string*)entry->Value = entryval; break;
|
case 2: *(std::string*)entry->Value = entryval; break;
|
||||||
|
case 3: *(int64_t*)entry->Value = strtoll(entryval, NULL, 10); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -436,6 +432,7 @@ void Load()
|
|||||||
case 0: *(int*)entry->Value = std::get<int>(entry->Default); break;
|
case 0: *(int*)entry->Value = std::get<int>(entry->Default); break;
|
||||||
case 1: *(bool*)entry->Value = std::get<bool>(entry->Default); break;
|
case 1: *(bool*)entry->Value = std::get<bool>(entry->Default); break;
|
||||||
case 2: *(std::string*)entry->Value = std::get<std::string>(entry->Default); break;
|
case 2: *(std::string*)entry->Value = std::get<std::string>(entry->Default); break;
|
||||||
|
case 3: *(int64_t*)entry->Value = std::get<int64_t>(entry->Default); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,6 +469,7 @@ void Save()
|
|||||||
case 0: Platform::FileWriteFormatted(f, "%s=%d\r\n", entry->Name, *(int*)entry->Value); break;
|
case 0: Platform::FileWriteFormatted(f, "%s=%d\r\n", entry->Name, *(int*)entry->Value); break;
|
||||||
case 1: Platform::FileWriteFormatted(f, "%s=%d\r\n", entry->Name, *(bool*)entry->Value ? 1:0); break;
|
case 1: Platform::FileWriteFormatted(f, "%s=%d\r\n", entry->Name, *(bool*)entry->Value ? 1:0); break;
|
||||||
case 2: Platform::FileWriteFormatted(f, "%s=%s\r\n", entry->Name, (*(std::string*)entry->Value).c_str()); break;
|
case 2: Platform::FileWriteFormatted(f, "%s=%s\r\n", entry->Name, (*(std::string*)entry->Value).c_str()); break;
|
||||||
|
case 3: Platform::FileWriteFormatted(f, "%s=%"PRId64"\r\n", entry->Name, *(int64_t*)entry->Value); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ namespace Config
|
|||||||
struct ConfigEntry
|
struct ConfigEntry
|
||||||
{
|
{
|
||||||
char Name[32];
|
char Name[32];
|
||||||
int Type; // 0=int 1=bool 2=string
|
int Type; // 0=int 1=bool 2=string 3=64bit int
|
||||||
void* Value; // pointer to the value variable
|
void* Value; // pointer to the value variable
|
||||||
std::variant<int, bool, std::string> Default;
|
std::variant<int, bool, std::string, int64_t> Default;
|
||||||
bool InstanceUnique; // whether the setting can exist individually for each instance in multiplayer
|
bool InstanceUnique; // whether the setting can exist individually for each instance in multiplayer
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -185,10 +185,7 @@ extern bool MouseHide;
|
|||||||
extern int MouseHideSeconds;
|
extern int MouseHideSeconds;
|
||||||
extern bool PauseLostFocus;
|
extern bool PauseLostFocus;
|
||||||
|
|
||||||
extern int RTCMode;
|
extern int64_t RTCOffset;
|
||||||
extern std::string RTCLastTime;
|
|
||||||
extern std::string RTCLastHostTime;
|
|
||||||
extern std::string RTCNewTime;
|
|
||||||
|
|
||||||
extern bool DSBatteryLevelOkay;
|
extern bool DSBatteryLevelOkay;
|
||||||
extern int DSiBatteryLevel;
|
extern int DSiBatteryLevel;
|
||||||
|
@ -32,46 +32,16 @@ DateTimeDialog::DateTimeDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Da
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
grpTimeMode = new QButtonGroup(this);
|
|
||||||
grpTimeMode->addButton(ui->rbSystemTime, 0);
|
|
||||||
grpTimeMode->addButton(ui->rbCustomTime, 1);
|
|
||||||
connect(grpTimeMode, SIGNAL(buttonClicked(int)), this, SLOT(onChangeTimeMode(int)));
|
|
||||||
grpTimeMode->button(Config::RTCMode)->setChecked(true);
|
|
||||||
|
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
customTime = now;
|
customTime = now.addSecs(Config::RTCOffset);
|
||||||
|
|
||||||
ui->chkChangeTime->setChecked(false);
|
ui->chkChangeTime->setChecked(false);
|
||||||
|
ui->chkResetTime->setChecked(false);
|
||||||
if (Config::RTCNewTime != "")
|
|
||||||
{
|
|
||||||
QDateTime newtime = QDateTime::fromString(QString::fromStdString(Config::RTCNewTime), Qt::ISODate);
|
|
||||||
|
|
||||||
if (newtime.isValid())
|
|
||||||
{
|
|
||||||
ui->chkChangeTime->setChecked(true);
|
|
||||||
ui->txtNewCustomTime->setDateTime(newtime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config::RTCLastTime != "" && Config::RTCLastHostTime != "")
|
|
||||||
{
|
|
||||||
QDateTime lasttime = QDateTime::fromString(QString::fromStdString(Config::RTCLastTime), Qt::ISODate);
|
|
||||||
QDateTime lasthost = QDateTime::fromString(QString::fromStdString(Config::RTCLastHostTime), Qt::ISODate);
|
|
||||||
|
|
||||||
if (lasttime.isValid() && lasthost.isValid())
|
|
||||||
{
|
|
||||||
qint64 offset = lasthost.secsTo(now);
|
|
||||||
customTime = lasttime.addSecs(offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->lblCustomTime->setText(customTime.toString(ui->txtNewCustomTime->displayFormat()));
|
ui->lblCustomTime->setText(customTime.toString(ui->txtNewCustomTime->displayFormat()));
|
||||||
startTimer(1000);
|
startTimer(1000);
|
||||||
|
|
||||||
bool iscustom = (Config::RTCMode == 1);
|
ui->txtNewCustomTime->setEnabled(ui->chkChangeTime->isChecked());
|
||||||
ui->chkChangeTime->setEnabled(iscustom);
|
|
||||||
ui->txtNewCustomTime->setEnabled(iscustom && ui->chkChangeTime->isChecked());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTimeDialog::~DateTimeDialog()
|
DateTimeDialog::~DateTimeDialog()
|
||||||
@ -89,12 +59,13 @@ void DateTimeDialog::done(int r)
|
|||||||
{
|
{
|
||||||
if (r == QDialog::Accepted)
|
if (r == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
Config::RTCMode = grpTimeMode->checkedId();
|
|
||||||
|
|
||||||
if (ui->chkChangeTime->isChecked())
|
if (ui->chkChangeTime->isChecked())
|
||||||
Config::RTCNewTime = ui->txtNewCustomTime->dateTime().toString(Qt::ISODate).toStdString();
|
{
|
||||||
else
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
Config::RTCNewTime = "";
|
Config::RTCOffset = now.secsTo(ui->txtNewCustomTime->dateTime());
|
||||||
|
}
|
||||||
|
else if (ui->chkResetTime->isChecked())
|
||||||
|
Config::RTCOffset = 0;
|
||||||
|
|
||||||
Config::Save();
|
Config::Save();
|
||||||
}
|
}
|
||||||
@ -106,21 +77,15 @@ void DateTimeDialog::done(int r)
|
|||||||
|
|
||||||
void DateTimeDialog::on_chkChangeTime_clicked(bool checked)
|
void DateTimeDialog::on_chkChangeTime_clicked(bool checked)
|
||||||
{
|
{
|
||||||
bool iscustom = (grpTimeMode->checkedId() == 1);
|
if (checked) ui->chkResetTime->setChecked(false);
|
||||||
|
ui->txtNewCustomTime->setEnabled(checked);
|
||||||
ui->txtNewCustomTime->setEnabled(iscustom && checked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DateTimeDialog::onChangeTimeMode(int mode)
|
void DateTimeDialog::on_chkResetTime_clicked(bool checked)
|
||||||
{
|
{
|
||||||
bool iscustom = (mode == 1);
|
if (checked)
|
||||||
|
{
|
||||||
ui->chkChangeTime->setEnabled(iscustom);
|
ui->chkChangeTime->setChecked(false);
|
||||||
ui->txtNewCustomTime->setEnabled(iscustom && ui->chkChangeTime->isChecked());
|
ui->txtNewCustomTime->setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCustomTimeLabel()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -59,13 +59,11 @@ private slots:
|
|||||||
void done(int r);
|
void done(int r);
|
||||||
|
|
||||||
void on_chkChangeTime_clicked(bool checked);
|
void on_chkChangeTime_clicked(bool checked);
|
||||||
void onChangeTimeMode(int mode);
|
void on_chkResetTime_clicked(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DateTimeDialog* ui;
|
Ui::DateTimeDialog* ui;
|
||||||
|
|
||||||
QButtonGroup* grpTimeMode;
|
|
||||||
|
|
||||||
QDateTime customTime;
|
QDateTime customTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,40 +7,17 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>357</width>
|
<width>357</width>
|
||||||
<height>259</height>
|
<height>161</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Date and time - melonDS</string>
|
<string>Date and time - melonDS</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>General settings</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QRadioButton" name="rbCustomTime">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use custom date and time</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QRadioButton" name="rbSystemTime">
|
|
||||||
<property name="text">
|
|
||||||
<string>Always use system date and time</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Custom date and time</string>
|
<string>Date and time</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
@ -64,28 +41,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="2" column="0">
|
||||||
<widget class="QCheckBox" name="chkChangeTime">
|
<widget class="QCheckBox" name="chkChangeTime">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Change</string>
|
<string>Change to:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>New value:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>The new value will be applied on the next boot.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QDateTimeEdit" name="txtNewCustomTime">
|
<widget class="QDateTimeEdit" name="txtNewCustomTime">
|
||||||
<property name="dateTime">
|
<property name="dateTime">
|
||||||
<datetime>
|
<datetime>
|
||||||
@ -125,6 +88,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="chkResetTime">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset to system date and time</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QDateTime>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QSemaphore>
|
#include <QSemaphore>
|
||||||
@ -610,6 +611,15 @@ void WriteFirmware(const SPI_Firmware::Firmware& firmware, u32 writeoffset, u32
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriteDateTime(int year, int month, int day, int hour, int minute, int second)
|
||||||
|
{
|
||||||
|
QDateTime hosttime = QDateTime::currentDateTime();
|
||||||
|
QDateTime time = QDateTime(QDate(year, month, day), QTime(hour, minute, second));
|
||||||
|
|
||||||
|
Config::RTCOffset = hosttime.secsTo(time);
|
||||||
|
Config::Save();
|
||||||
|
}
|
||||||
|
|
||||||
bool MP_Init()
|
bool MP_Init()
|
||||||
{
|
{
|
||||||
return LocalMP::Init();
|
return LocalMP::Init();
|
||||||
|
@ -595,49 +595,10 @@ void SetBatteryLevels()
|
|||||||
void SetDateTime()
|
void SetDateTime()
|
||||||
{
|
{
|
||||||
QDateTime hosttime = QDateTime::currentDateTime();
|
QDateTime hosttime = QDateTime::currentDateTime();
|
||||||
QDateTime time;
|
QDateTime time = hosttime.addSecs(Config::RTCOffset);
|
||||||
|
|
||||||
if (Config::RTCMode == 0)
|
|
||||||
{
|
|
||||||
// use current system time
|
|
||||||
|
|
||||||
time = hosttime;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// use custom time
|
|
||||||
|
|
||||||
if (Config::RTCNewTime != "")
|
|
||||||
{
|
|
||||||
// assign a new custom time
|
|
||||||
|
|
||||||
time = QDateTime::fromString(QString::fromStdString(Config::RTCNewTime), Qt::ISODate);
|
|
||||||
if (!time.isValid())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (Config::RTCLastTime != "" && Config::RTCLastHostTime != "")
|
|
||||||
{
|
|
||||||
// deduce the custom time based on the last saved times
|
|
||||||
|
|
||||||
QDateTime lasttime = QDateTime::fromString(QString::fromStdString(Config::RTCLastTime), Qt::ISODate);
|
|
||||||
QDateTime lasthost = QDateTime::fromString(QString::fromStdString(Config::RTCLastHostTime), Qt::ISODate);
|
|
||||||
|
|
||||||
if (lasttime.isValid() && lasthost.isValid())
|
|
||||||
{
|
|
||||||
qint64 offset = lasthost.secsTo(hosttime);
|
|
||||||
time = lasttime.addSecs(offset);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RTC::SetDateTime(time.date().year(), time.date().month(), time.date().day(),
|
RTC::SetDateTime(time.date().year(), time.date().month(), time.date().day(),
|
||||||
time.time().hour(), time.time().minute(), time.time().second());
|
time.time().hour(), time.time().minute(), time.time().second());
|
||||||
|
|
||||||
Config::RTCLastTime = time.toString(Qt::ISODate).toStdString();
|
|
||||||
Config::RTCLastHostTime = hosttime.toString(Qt::ISODate).toStdString();
|
|
||||||
Config::RTCNewTime = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
|
@ -316,7 +316,6 @@ void EmuThread::run()
|
|||||||
{
|
{
|
||||||
u32 mainScreenPos[3];
|
u32 mainScreenPos[3];
|
||||||
Platform::FileHandle* file;
|
Platform::FileHandle* file;
|
||||||
bool hasrun = false;
|
|
||||||
|
|
||||||
NDS::Init();
|
NDS::Init();
|
||||||
|
|
||||||
@ -441,8 +440,6 @@ void EmuThread::run()
|
|||||||
|
|
||||||
if (EmuRunning == emuStatus_Running || EmuRunning == emuStatus_FrameStep)
|
if (EmuRunning == emuStatus_Running || EmuRunning == emuStatus_FrameStep)
|
||||||
{
|
{
|
||||||
hasrun = true;
|
|
||||||
|
|
||||||
EmuStatus = emuStatus_Running;
|
EmuStatus = emuStatus_Running;
|
||||||
if (EmuRunning == emuStatus_FrameStep) EmuRunning = emuStatus_Paused;
|
if (EmuRunning == emuStatus_FrameStep) EmuRunning = emuStatus_Paused;
|
||||||
|
|
||||||
@ -673,17 +670,6 @@ void EmuThread::run()
|
|||||||
Platform::FileWrite(&state, sizeof(state), 1, file);
|
Platform::FileWrite(&state, sizeof(state), 1, file);
|
||||||
Platform::CloseFile(file);
|
Platform::CloseFile(file);
|
||||||
}
|
}
|
||||||
if (hasrun)
|
|
||||||
{
|
|
||||||
int y, m, d, h, i, s;
|
|
||||||
RTC::GetDateTime(y, m, d, h, i, s);
|
|
||||||
|
|
||||||
QDateTime hosttime = QDateTime::currentDateTime();
|
|
||||||
QDateTime time = QDateTime(QDate(y, m, d), QTime(h, i, s));
|
|
||||||
|
|
||||||
Config::RTCLastTime = time.toString(Qt::ISODate).toStdString();
|
|
||||||
Config::RTCLastHostTime = hosttime.toString(Qt::ISODate).toStdString();
|
|
||||||
}
|
|
||||||
|
|
||||||
EmuStatus = emuStatus_Exit;
|
EmuStatus = emuStatus_Exit;
|
||||||
|
|
||||||
@ -3339,7 +3325,6 @@ int main(int argc, char** argv)
|
|||||||
SANITIZE(Config::ScreenSizing, 0, (int)Frontend::screenSizing_MAX);
|
SANITIZE(Config::ScreenSizing, 0, (int)Frontend::screenSizing_MAX);
|
||||||
SANITIZE(Config::ScreenAspectTop, 0, AspectRatiosNum);
|
SANITIZE(Config::ScreenAspectTop, 0, AspectRatiosNum);
|
||||||
SANITIZE(Config::ScreenAspectBot, 0, AspectRatiosNum);
|
SANITIZE(Config::ScreenAspectBot, 0, AspectRatiosNum);
|
||||||
SANITIZE(Config::RTCMode, 0, 1);
|
|
||||||
#undef SANITIZE
|
#undef SANITIZE
|
||||||
|
|
||||||
AudioInOut::Init();
|
AudioInOut::Init();
|
||||||
|
Reference in New Issue
Block a user