Merge pull request #5765 from Cacodemon345/1ms
Switch to 1ms frame intervals
This commit is contained in:
17
src/86box.c
17
src/86box.c
@@ -217,6 +217,7 @@ int test_mode = 0; /* (C) Test mo
|
||||
char uuid[MAX_UUID_LEN] = { '\0' }; /* (C) UUID or machine identifier */
|
||||
int sound_muted = 0; /* (C) Is sound muted? */
|
||||
int inhibit_multimedia_keys; /* (C) Inhibit multimedia keys on Windows. */
|
||||
int force_10ms; /* (C) Force 10ms CPU frame intervals. */
|
||||
|
||||
int other_ide_present = 0; /* IDE controllers from non-IDE cards are
|
||||
present */
|
||||
@@ -1592,19 +1593,19 @@ update_mouse_msg(void)
|
||||
*(wcp - 1) = L'\0';
|
||||
mbstowcs(wcpu, cpu_s->name, strlen(cpu_s->name) + 1);
|
||||
#ifdef _WIN32
|
||||
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%%i%%%% - %ls",
|
||||
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%%i.%%i%%%% - %ls",
|
||||
plat_get_string(STRING_MOUSE_CAPTURE));
|
||||
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%%i%%%% - %ls",
|
||||
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%%i.%%i%%%% - %ls",
|
||||
(mouse_get_buttons() > 2) ? plat_get_string(STRING_MOUSE_RELEASE) : plat_get_string(STRING_MOUSE_RELEASE_MMB));
|
||||
wcsncpy(mouse_msg[2], L"%i%%", sizeof_w(mouse_msg[2]));
|
||||
#else
|
||||
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls",
|
||||
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%ls v%ls - %%i.%%i%%%% - %ls - %ls/%ls - %ls",
|
||||
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,
|
||||
plat_get_string(STRING_MOUSE_CAPTURE));
|
||||
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls",
|
||||
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%ls v%ls - %%i.%%i%%%% - %ls - %ls/%ls - %ls",
|
||||
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,
|
||||
(mouse_get_buttons() > 2) ? plat_get_string(STRING_MOUSE_RELEASE) : plat_get_string(STRING_MOUSE_RELEASE_MMB));
|
||||
swprintf(mouse_msg[2], sizeof_w(mouse_msg[2]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls",
|
||||
swprintf(mouse_msg[2], sizeof_w(mouse_msg[2]), L"%ls v%ls - %%i.%%i%%%% - %ls - %ls/%ls",
|
||||
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu);
|
||||
#endif
|
||||
}
|
||||
@@ -1714,7 +1715,7 @@ pc_run(void)
|
||||
|
||||
/* Run a block of code. */
|
||||
startblit();
|
||||
cpu_exec((int32_t) cpu_s->rspeed / 100);
|
||||
cpu_exec((int32_t) cpu_s->rspeed / (force_10ms ? 100 : 1000));
|
||||
ack_pause();
|
||||
#ifdef USE_GDBSTUB /* avoid a KBC FIFO overflow when CPU emulation is stalled */
|
||||
if (gdbstub_step == GDBSTUB_EXEC) {
|
||||
@@ -1729,14 +1730,14 @@ pc_run(void)
|
||||
|
||||
/* Done with this frame, update statistics. */
|
||||
framecount++;
|
||||
if (++framecountx >= 100) {
|
||||
if (++framecountx >= (force_10ms ? 100 : 1000)) {
|
||||
framecountx = 0;
|
||||
frames = 0;
|
||||
}
|
||||
|
||||
if (title_update) {
|
||||
mouse_msg_idx = ((mouse_type == MOUSE_TYPE_NONE) || (mouse_input_mode >= 1)) ? 2 : !!mouse_capture;
|
||||
swprintf(temp, sizeof_w(temp), mouse_msg[mouse_msg_idx], fps);
|
||||
swprintf(temp, sizeof_w(temp), mouse_msg[mouse_msg_idx], fps / (force_10ms ? 1 : 10), force_10ms ? 0 : (fps % 10));
|
||||
#ifdef __APPLE__
|
||||
/* Needed due to modifying the UI on the non-main thread is a big no-no. */
|
||||
dispatch_async_f(dispatch_get_main_queue(), wcsdup((const wchar_t *) temp), _ui_window_title);
|
||||
|
||||
@@ -144,6 +144,8 @@ load_general(void)
|
||||
video_grayscale = ini_section_get_int(cat, "video_grayscale", 0);
|
||||
video_graytype = ini_section_get_int(cat, "video_graytype", 0);
|
||||
|
||||
force_10ms = !!ini_section_get_int(cat, "force_10ms", 0);
|
||||
|
||||
rctrl_is_lalt = ini_section_get_int(cat, "rctrl_is_lalt", 0);
|
||||
update_icons = ini_section_get_int(cat, "update_icons", 1);
|
||||
|
||||
@@ -1947,6 +1949,10 @@ save_general(void)
|
||||
|
||||
const char *va_name;
|
||||
|
||||
ini_section_set_int(cat, "force_10ms", force_10ms);
|
||||
if (force_10ms == 0)
|
||||
ini_section_delete_var(cat, "force_10ms");
|
||||
|
||||
ini_section_set_int(cat, "inhibit_multimedia_keys", inhibit_multimedia_keys);
|
||||
if (inhibit_multimedia_keys == 0)
|
||||
ini_section_delete_var(cat, "inhibit_multimedia_keys");
|
||||
|
||||
@@ -739,7 +739,7 @@ exec386_dynarec(int32_t cycs)
|
||||
uint64_t oldtsc;
|
||||
uint64_t delta;
|
||||
|
||||
int32_t cyc_period = cycs / 2000; /*5us*/
|
||||
int32_t cyc_period = cycs / (force_10ms ? 2000 : 200); /*5us*/
|
||||
|
||||
# ifdef USE_ACYCS
|
||||
acycs = 0;
|
||||
|
||||
@@ -154,6 +154,7 @@ extern int confirm_reset; /* (C) enable reset confirmation */
|
||||
extern int confirm_exit; /* (C) enable exit confirmation */
|
||||
extern int confirm_save; /* (C) enable save confirmation */
|
||||
extern int enable_discord; /* (C) enable Discord integration */
|
||||
extern int force_10ms; /* (C) force 10ms CPU frame interval */
|
||||
extern int other_ide_present; /* IDE controllers from non-IDE cards are present */
|
||||
extern int other_scsi_present; /* SCSI controllers from non-SCSI cards are present */
|
||||
|
||||
|
||||
@@ -437,6 +437,9 @@ main_thread_fn()
|
||||
int frames;
|
||||
|
||||
QThread::currentThread()->setPriority(QThread::HighestPriority);
|
||||
#ifdef _WIN32
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
#endif
|
||||
plat_set_thread_name(nullptr, "main_thread_fn");
|
||||
framecountx = 0;
|
||||
// title_update = 1;
|
||||
@@ -448,14 +451,14 @@ main_thread_fn()
|
||||
const uint64_t new_time = elapsed_timer.elapsed();
|
||||
#ifdef USE_GDBSTUB
|
||||
if (gdbstub_next_asap && (drawits <= 0))
|
||||
drawits = 10;
|
||||
drawits = force_10ms ? 10 : 1;
|
||||
else
|
||||
#endif
|
||||
drawits += static_cast<int>(new_time - old_time);
|
||||
old_time = new_time;
|
||||
if (drawits > 0 && !dopause) {
|
||||
/* Yes, so do one frame now. */
|
||||
drawits -= 10;
|
||||
drawits -= force_10ms ? 10 : 1;
|
||||
if (drawits > 50)
|
||||
drawits = 0;
|
||||
|
||||
@@ -474,8 +477,8 @@ main_thread_fn()
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
/* Every 200 frames we save the machine status. */
|
||||
if (++frames >= 200 && nvr_dosave) {
|
||||
/* Every 2 emulated seconds we save the machine status. */
|
||||
if (++frames >= (force_10ms ? 200 : 2000) && nvr_dosave) {
|
||||
qt_nvr_save();
|
||||
nvr_dosave = 0;
|
||||
frames = 0;
|
||||
|
||||
@@ -117,6 +117,9 @@ SettingsMachine::SettingsMachine(QWidget *parent)
|
||||
ui->comboBoxMachineType->setCurrentIndex(-1);
|
||||
ui->comboBoxMachineType->setCurrentIndex(selectedMachineType);
|
||||
|
||||
ui->radioButtonLargerFrames->setChecked(force_10ms);
|
||||
ui->radioButtonSmallerFrames->setChecked(!force_10ms);
|
||||
|
||||
#ifndef USE_DYNAREC
|
||||
ui->checkBoxDynamicRecompiler->setEnabled(false);
|
||||
ui->checkBoxDynamicRecompiler->setVisible(false);
|
||||
@@ -137,6 +140,7 @@ SettingsMachine::save()
|
||||
fpu_type = ui->comboBoxFPU->currentData().toInt();
|
||||
cpu_use_dynarec = ui->checkBoxDynamicRecompiler->isChecked() ? 1 : 0;
|
||||
fpu_softfloat = ui->checkBoxFPUSoftfloat->isChecked() ? 1 : 0;
|
||||
force_10ms = ui->radioButtonLargerFrames->isChecked() ? 1 : 0;
|
||||
|
||||
int64_t temp_mem_size;
|
||||
if (machine_get_ram_granularity(machine) < 1024)
|
||||
@@ -359,3 +363,15 @@ void SettingsMachine::on_checkBoxFPUSoftfloat_stateChanged(int state) {
|
||||
ui->softFloatWarningText->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsMachine::on_radioButtonSmallerFrames_clicked()
|
||||
{
|
||||
ui->radioButtonLargerFrames->setChecked(false);
|
||||
}
|
||||
|
||||
|
||||
void SettingsMachine::on_radioButtonLargerFrames_clicked()
|
||||
{
|
||||
ui->radioButtonSmallerFrames->setChecked(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ private slots:
|
||||
void on_comboBoxMachineType_currentIndexChanged(int index);
|
||||
void on_checkBoxFPUSoftfloat_stateChanged(int state);
|
||||
|
||||
void on_radioButtonSmallerFrames_clicked();
|
||||
|
||||
void on_radioButtonLargerFrames_clicked();
|
||||
|
||||
private:
|
||||
Ui::SettingsMachine *ui;
|
||||
};
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxMachineType">
|
||||
<property name="maxVisibleItems">
|
||||
@@ -49,7 +48,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
@@ -57,7 +55,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
@@ -65,7 +62,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxFPU">
|
||||
<property name="maxVisibleItems">
|
||||
@@ -73,7 +69,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxRAM">
|
||||
<property name="sizePolicy">
|
||||
@@ -84,7 +79,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@@ -92,7 +86,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
@@ -100,7 +93,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
@@ -129,18 +121,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Frequency:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBoxSpeed">
|
||||
<property name="sizePolicy">
|
||||
@@ -157,7 +147,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
@@ -165,7 +154,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
@@ -173,7 +161,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@@ -196,7 +183,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonConfigure">
|
||||
<property name="sizePolicy">
|
||||
@@ -213,7 +199,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="4" column="1">
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
@@ -268,7 +253,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="dynamicRecompilerLayout">
|
||||
<item>
|
||||
@@ -286,7 +270,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="softFloatLayout">
|
||||
<item>
|
||||
@@ -302,7 +285,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<widget class="QLabel" name="softFloatWarningIcon">
|
||||
<property name="text">
|
||||
@@ -310,7 +292,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<widget class="QLabel" name="softFloatWarningText">
|
||||
<property name="text">
|
||||
@@ -321,7 +302,7 @@
|
||||
<item>
|
||||
<spacer name="softFloatHorizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -333,39 +314,102 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Time synchronization</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonDisabled">
|
||||
<property name="text">
|
||||
<string>Disabled</string>
|
||||
<widget class="QFrame" name="horizontalFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Time synchronization</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radioButtonDisabled">
|
||||
<property name="text">
|
||||
<string>Disabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radioButtonUTC">
|
||||
<property name="text">
|
||||
<string>Enabled (UTC)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radioButtonLocalTime">
|
||||
<property name="text">
|
||||
<string>Enabled (local time)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonLocalTime">
|
||||
<property name="text">
|
||||
<string>Enabled (local time)</string>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>CPU frame size</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonLargerFrames">
|
||||
<property name="text">
|
||||
<string>Larger frames (less smooth)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonSmallerFrames">
|
||||
<property name="text">
|
||||
<string>Smaller frames (smoother)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonUTC">
|
||||
<property name="text">
|
||||
<string>Enabled (UTC)</string>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -373,7 +417,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
||||
Reference in New Issue
Block a user