Use integer instead of float for percentage calculations
This commit is contained in:
12
src/86box.c
12
src/86box.c
@@ -1593,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"%%.1lf%%%% - %ls",
|
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%%i.%%i%%%% - %ls",
|
||||||
plat_get_string(STRING_MOUSE_CAPTURE));
|
plat_get_string(STRING_MOUSE_CAPTURE));
|
||||||
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%%.1lf%%%% - %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));
|
(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 - %%.1lf%%%% - %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,
|
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 - %%.1lf%%%% - %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,
|
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 - %%.1lf%%%% - %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);
|
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1737,7 +1737,7 @@ pc_run(void)
|
|||||||
|
|
||||||
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], (double)fps / (force_10ms ? 1. : 10.));
|
swprintf(temp, sizeof_w(temp), mouse_msg[mouse_msg_idx], fps / (force_10ms ? 1 : 10), force_10ms ? 0 : (fps % 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);
|
||||||
|
|||||||
Reference in New Issue
Block a user