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

@@ -23,7 +23,7 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
project(86Box
VERSION 3.0
DESCRIPTION "Emulator of x86-based systems"
HOMEPAGE_URL "https://86box.github.io/"
HOMEPAGE_URL "https://86box.net"
LANGUAGES C CXX)
# Detect the target architecture by trying to compile `src/arch_detect.c`

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);

View File

@@ -434,7 +434,7 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
hinstance = hInst;
/* Set the application version ID string. */
sprintf(emu_version, "%s v%s", EMU_NAME, EMU_VERSION);
sprintf(emu_version, "%s v%s", EMU_NAME, EMU_VERSION_FULL);
/* First, set our (default) language. */
set_language(0x0409);

View File

@@ -39,17 +39,23 @@ AboutDialogCreate(HWND hwnd)
int i;
TASKDIALOGCONFIG tdconfig = {0};
TASKDIALOG_BUTTON tdbuttons[] = {
{IDOK, EMU_SITE},
{IDCANCEL, MAKEINTRESOURCE(IDS_2127)}
{IDOK, EMU_SITE},
{IDCANCEL, MAKEINTRESOURCE(IDS_2127)}
};
wchar_t emu_version[256];
i = swprintf(emu_version, sizeof(emu_version), L"%ls v%ls", EMU_NAME_W, EMU_VERSION_FULL_W);
#ifdef EMU_GIT_HASH
swprintf(&emu_version[i], sizeof(emu_version) - i, L" [%ls]", EMU_GIT_HASH_W);
#endif
tdconfig.cbSize = sizeof(tdconfig);
tdconfig.hwndParent = hwnd;
tdconfig.hInstance = hinstance;
tdconfig.dwCommonButtons = 0;
tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_2124);
tdconfig.pszMainIcon = (PCWSTR) 10;
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2125);
tdconfig.pszMainInstruction = emu_version;
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2126);
tdconfig.cButtons = ARRAYSIZE(tdbuttons);
tdconfig.pButtons = tdbuttons;
@@ -57,5 +63,5 @@ AboutDialogCreate(HWND hwnd)
TaskDialogIndirect(&tdconfig, &i, NULL, NULL);
if (i == IDOK)
ShellExecute(hwnd, L"open", L"https://" EMU_SITE, NULL, NULL, SW_SHOW);
ShellExecute(hwnd, L"open", L"https://" EMU_SITE, NULL, NULL, SW_SHOW);
}