Allow inserting of build number and git hash through CMake, while also porting the mouse capture title fix from the CLI branch

This commit is contained in:
RichardG867
2021-11-05 21:49:00 -03:00
parent f48c3a299e
commit 06ab671d32
4 changed files with 20 additions and 10 deletions

View File

@@ -196,7 +196,7 @@ int unscaled_size_y = SCREEN_RES_Y; /* current unscaled size Y */
int efscrnsz_y = SCREEN_RES_Y;
static wchar_t mouse_msg[2][200];
static wchar_t mouse_msg[3][200];
#ifndef RELEASE_BUILD
@@ -1010,11 +1010,13 @@ pc_reset_hard_init(void)
*(wcp - 1) = L'\0';
mbstowcs(wcpu, cpu_s->name, strlen(cpu_s->name)+1);
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls",
EMU_NAME_W, EMU_VERSION_W, wmachine, wcpufamily, wcpu,
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,
plat_get_string(IDS_2077));
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls",
EMU_NAME_W, EMU_VERSION_W, wmachine, wcpufamily, wcpu,
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,
(mouse_get_buttons() > 2) ? plat_get_string(IDS_2078) : plat_get_string(IDS_2079));
swprintf(mouse_msg[2], sizeof_w(mouse_msg[2]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls",
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu);
}
@@ -1101,6 +1103,7 @@ static void _ui_window_title(void *s)
void
pc_run(void)
{
int mouse_msg_idx;
wchar_t temp[200];
/* Trigger a hard reset if one is pending. */
@@ -1125,7 +1128,8 @@ pc_run(void)
}
if (title_update) {
swprintf(temp, sizeof_w(temp), mouse_msg[!!mouse_capture], fps);
mouse_msg_idx = (mouse_type == MOUSE_TYPE_NONE) ? 2 : !!mouse_capture;
swprintf(temp, sizeof_w(temp), mouse_msg[mouse_msg_idx], fps);
#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);