Merge branch 'melonDS-emu:master' into mem9_timings

This commit is contained in:
DesperateProgrammer 2024-02-05 12:41:41 +01:00 committed by GitHub
commit 97aabe0f4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 98 additions and 38 deletions

View File

@ -39,6 +39,8 @@ enum RegionMask : u32
RegionFree = 0xFFFFFFFF,
};
constexpr u32 DSiWareTitleIDHigh = 0x00030004;
// Consult GBATEK for info on what these are
struct NDSHeader
{
@ -198,8 +200,9 @@ struct NDSHeader
u8 HeaderSignature[128]; // RSA-SHA1 across 0x000..0xDFF
/// @return \c true if this header represents a DSi title
/// (either a physical cartridge or a DSiWare title).
/// @return \c true if this header represents a title
/// that is DSi-exclusive (including DSiWare)
/// or DSi-enhanced (including cartridges).
[[nodiscard]] bool IsDSi() const { return (UnitCode & 0x02) != 0; }
[[nodiscard]] u32 GameCodeAsU32() const {
return (u32)GameCode[3] << 24 |
@ -213,7 +216,7 @@ struct NDSHeader
}
/// @return \c true if this header represents a DSiWare title.
[[nodiscard]] bool IsDSiWare() const { return IsDSi() && DSiRegionStart == 0; }
[[nodiscard]] bool IsDSiWare() const { return IsDSi() && DSiTitleIDHigh == DSiWareTitleIDHigh; }
};
static_assert(sizeof(NDSHeader) == 4096, "NDSHeader is not 4096 bytes!");

View File

@ -61,6 +61,7 @@ int GL_ScaleFactor;
bool GL_BetterPolygons;
bool LimitFPS;
int MaxFPS;
bool AudioSync;
bool ShowOSD;
@ -251,6 +252,7 @@ ConfigEntry ConfigFile[] =
{"GL_BetterPolygons", 1, &GL_BetterPolygons, false, false},
{"LimitFPS", 1, &LimitFPS, true, false},
{"MaxFPS", 0, &MaxFPS, 1000, false},
{"AudioSync", 1, &AudioSync, false},
{"ShowOSD", 1, &ShowOSD, true, false},

View File

@ -105,6 +105,7 @@ extern int GL_ScaleFactor;
extern bool GL_BetterPolygons;
extern bool LimitFPS;
extern int MaxFPS;
extern bool AudioSync;
extern bool ShowOSD;

View File

@ -576,7 +576,7 @@ void EmuThread::run()
{
bool limitfps = Config::LimitFPS && !fastforward;
double practicalFramelimit = limitfps ? frametimeStep : 1.0 / 1000.0;
double practicalFramelimit = limitfps ? frametimeStep : 1.0 / Config::MaxFPS;
double curtime = SDL_GetPerformanceCounter() * perfCountsSec;

View File

@ -34,6 +34,7 @@ InterfaceSettingsDialog::InterfaceSettingsDialog(QWidget* parent) : QDialog(pare
ui->spinMouseHideSeconds->setEnabled(Config::MouseHide != 0);
ui->spinMouseHideSeconds->setValue(Config::MouseHideSeconds);
ui->cbPauseLostFocus->setChecked(Config::PauseLostFocus != 0);
ui->spinMaxFPS->setValue(Config::MaxFPS);
}
InterfaceSettingsDialog::~InterfaceSettingsDialog()
@ -60,6 +61,7 @@ void InterfaceSettingsDialog::done(int r)
Config::MouseHide = ui->cbMouseHide->isChecked() ? 1:0;
Config::MouseHideSeconds = ui->spinMouseHideSeconds->value();
Config::PauseLostFocus = ui->cbPauseLostFocus->isChecked() ? 1:0;
Config::MaxFPS = ui->spinMaxFPS->value();
Config::Save();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>262</width>
<height>113</height>
<width>337</width>
<height>233</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,32 +19,96 @@
<property name="windowTitle">
<string>Interface settings - melonDS</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" alignment="Qt::AlignLeft">
<widget class="QLabel" name="label">
<property name="text">
<string>Hide after</string>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
<item alignment="Qt::AlignTop">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Main window</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="cbMouseHide">
<property name="text">
<string>Hide mouse after inactivity</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
<property name="leftMargin">
<number>18</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>After</string>
</property>
<property name="buddy">
<cstring>spinMouseHideSeconds</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinMouseHideSeconds"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>seconds</string>
</property>
<property name="buddy">
<cstring>spinMouseHideSeconds</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="cbPauseLostFocus">
<property name="text">
<string>Pause emulation when window is not in focus</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QCheckBox" name="cbPauseLostFocus">
<property name="text">
<string>Pause emulation when window is not in focus</string>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Framerate </string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Fast-forward limit</string>
</property>
<property name="buddy">
<cstring>spinMaxFPS</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinMaxFPS">
<property name="suffix">
<string> FPS</string>
</property>
<property name="minimum">
<number>60</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="5">
<widget class="QCheckBox" name="cbMouseHide">
<property name="text">
<string>Hide mouse after inactivity</string>
</property>
</widget>
</item>
<item row="1" column="1" alignment="Qt::AlignLeft">
<widget class="QSpinBox" name="spinMouseHideSeconds"/>
</item>
<item row="3" column="0" colspan="5">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -54,20 +118,8 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>seconds of inactivity</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>cbMouseHide</tabstop>
<tabstop>spinMouseHideSeconds</tabstop>
<tabstop>cbPauseLostFocus</tabstop>
</tabstops>
<resources/>
<connections>
<connection>