Add 10ms interval option (not exposed yet to UI)
Fix percentage counter
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 */
|
char uuid[MAX_UUID_LEN] = { '\0' }; /* (C) UUID or machine identifier */
|
||||||
int sound_muted = 0; /* (C) Is sound muted? */
|
int sound_muted = 0; /* (C) Is sound muted? */
|
||||||
int inhibit_multimedia_keys; /* (C) Inhibit multimedia keys on Windows. */
|
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
|
int other_ide_present = 0; /* IDE controllers from non-IDE cards are
|
||||||
present */
|
present */
|
||||||
@@ -1592,19 +1593,19 @@ update_mouse_msg(void)
|
|||||||
*(wcp - 1) = L'\0';
|
*(wcp - 1) = L'\0';
|
||||||
mbstowcs(wcpu, cpu_s->name, strlen(cpu_s->name) + 1);
|
mbstowcs(wcpu, cpu_s->name, strlen(cpu_s->name) + 1);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%%i%%%% - %ls",
|
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%%.1lf%%%% - %ls",
|
||||||
plat_get_string(STRING_MOUSE_CAPTURE));
|
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"%%.1lf%%%% - %ls",
|
||||||
(mouse_get_buttons() > 2) ? plat_get_string(STRING_MOUSE_RELEASE) : plat_get_string(STRING_MOUSE_RELEASE_MMB));
|
(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]));
|
wcsncpy(mouse_msg[2], L"%i%%", sizeof_w(mouse_msg[2]));
|
||||||
#else
|
#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 - %%.1lf%%%% - %ls - %ls/%ls - %ls",
|
||||||
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,
|
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,
|
||||||
plat_get_string(STRING_MOUSE_CAPTURE));
|
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 - %%.1lf%%%% - %ls - %ls/%ls - %ls",
|
||||||
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,
|
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));
|
(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 - %%.1lf%%%% - %ls - %ls/%ls",
|
||||||
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu);
|
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1714,7 +1715,7 @@ pc_run(void)
|
|||||||
|
|
||||||
/* Run a block of code. */
|
/* Run a block of code. */
|
||||||
startblit();
|
startblit();
|
||||||
cpu_exec((int32_t) cpu_s->rspeed / 1000);
|
cpu_exec((int32_t) cpu_s->rspeed / (force_10ms ? 100 : 1000));
|
||||||
ack_pause();
|
ack_pause();
|
||||||
#ifdef USE_GDBSTUB /* avoid a KBC FIFO overflow when CPU emulation is stalled */
|
#ifdef USE_GDBSTUB /* avoid a KBC FIFO overflow when CPU emulation is stalled */
|
||||||
if (gdbstub_step == GDBSTUB_EXEC) {
|
if (gdbstub_step == GDBSTUB_EXEC) {
|
||||||
@@ -1729,14 +1730,14 @@ pc_run(void)
|
|||||||
|
|
||||||
/* Done with this frame, update statistics. */
|
/* Done with this frame, update statistics. */
|
||||||
framecount++;
|
framecount++;
|
||||||
if (++framecountx >= 1000) {
|
if (++framecountx >= (force_10ms ? 100 : 1000)) {
|
||||||
framecountx = 0;
|
framecountx = 0;
|
||||||
frames = 0;
|
frames = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title_update) {
|
if (title_update) {
|
||||||
mouse_msg_idx = ((mouse_type == MOUSE_TYPE_NONE) || (mouse_input_mode >= 1)) ? 2 : !!mouse_capture;
|
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], (double)fps / (force_10ms ? 1. : 10.));
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
/* Needed due to modifying the UI on the non-main thread is a big no-no. */
|
/* 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);
|
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_grayscale = ini_section_get_int(cat, "video_grayscale", 0);
|
||||||
video_graytype = ini_section_get_int(cat, "video_graytype", 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);
|
rctrl_is_lalt = ini_section_get_int(cat, "rctrl_is_lalt", 0);
|
||||||
update_icons = ini_section_get_int(cat, "update_icons", 1);
|
update_icons = ini_section_get_int(cat, "update_icons", 1);
|
||||||
|
|
||||||
@@ -1947,6 +1949,10 @@ save_general(void)
|
|||||||
|
|
||||||
const char *va_name;
|
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);
|
ini_section_set_int(cat, "inhibit_multimedia_keys", inhibit_multimedia_keys);
|
||||||
if (inhibit_multimedia_keys == 0)
|
if (inhibit_multimedia_keys == 0)
|
||||||
ini_section_delete_var(cat, "inhibit_multimedia_keys");
|
ini_section_delete_var(cat, "inhibit_multimedia_keys");
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ exec386_dynarec(int32_t cycs)
|
|||||||
uint64_t oldtsc;
|
uint64_t oldtsc;
|
||||||
uint64_t delta;
|
uint64_t delta;
|
||||||
|
|
||||||
int32_t cyc_period = cycs / 200; /*5us*/
|
int32_t cyc_period = cycs / (force_10ms ? 2000 : 200); /*5us*/
|
||||||
|
|
||||||
# ifdef USE_ACYCS
|
# ifdef USE_ACYCS
|
||||||
acycs = 0;
|
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_exit; /* (C) enable exit confirmation */
|
||||||
extern int confirm_save; /* (C) enable save confirmation */
|
extern int confirm_save; /* (C) enable save confirmation */
|
||||||
extern int enable_discord; /* (C) enable Discord integration */
|
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_ide_present; /* IDE controllers from non-IDE cards are present */
|
||||||
extern int other_scsi_present; /* SCSI controllers from non-SCSI cards are present */
|
extern int other_scsi_present; /* SCSI controllers from non-SCSI cards are present */
|
||||||
|
|
||||||
|
|||||||
@@ -448,14 +448,14 @@ main_thread_fn()
|
|||||||
const uint64_t new_time = elapsed_timer.elapsed();
|
const uint64_t new_time = elapsed_timer.elapsed();
|
||||||
#ifdef USE_GDBSTUB
|
#ifdef USE_GDBSTUB
|
||||||
if (gdbstub_next_asap && (drawits <= 0))
|
if (gdbstub_next_asap && (drawits <= 0))
|
||||||
drawits = 1;
|
drawits = force_10ms ? 10 : 1;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
drawits += static_cast<int>(new_time - old_time);
|
drawits += static_cast<int>(new_time - old_time);
|
||||||
old_time = new_time;
|
old_time = new_time;
|
||||||
if (drawits > 0 && !dopause) {
|
if (drawits > 0 && !dopause) {
|
||||||
/* Yes, so do one frame now. */
|
/* Yes, so do one frame now. */
|
||||||
drawits -= 1;
|
drawits -= force_10ms ? 10 : 1;
|
||||||
if (drawits > 50)
|
if (drawits > 50)
|
||||||
drawits = 0;
|
drawits = 0;
|
||||||
|
|
||||||
@@ -474,8 +474,8 @@ main_thread_fn()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Every 200 frames we save the machine status. */
|
/* Every 2 emulated seconds we save the machine status. */
|
||||||
if (++frames >= 2000 && nvr_dosave) {
|
if (++frames >= (force_10ms ? 200 : 2000) && nvr_dosave) {
|
||||||
qt_nvr_save();
|
qt_nvr_save();
|
||||||
nvr_dosave = 0;
|
nvr_dosave = 0;
|
||||||
frames = 0;
|
frames = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user