mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 10:49:58 -04:00
Redraw the in-game menu with the game's own interface textures, and bring in the launcher's save import and faster builds.
In-game menu: the settings window, its tabs, rows, buttons and cursor, the performance overlay and the Preparing shaders box are drawn with the game's interface textures where the RomFS holds them (runtime/ui/menu_skin.cpp, perf_panel.cpp; plain shapes until they are decoded). Restart joins Continue and Quit, each behind a confirmation; VSync is an on/off switch; DLSS is listed only on NVIDIA GPUs; the menu sounds are quieter; Picture shape is gone and the setting descriptions are shorter; edge cases of input, layout and fonts are fixed. tools/menu_preview.py draws the menu without the game. Launcher: Import Saves takes a save from the game folder's saves/ folder or one the player picks; downloads fall back to Windows' own certificate check when Python's refuses a server; updates are faster; the title bar is drawn in the window and Navi is every icon. tools/make_game.py builds with CLANG64's clang where the launcher installed it, packs the RomFS beside the lift and the compile, takes a prebuilt runtime, and compiles the game's resources without cmd.exe, so a user folder with a space in its name builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <shellapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <shobjidl.h>
|
||||
#include <propsys.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
@@ -15,6 +16,12 @@
|
||||
#define PATHN 1024
|
||||
#define APP_NAME L"NX2navi"
|
||||
#define UNINSTALL_KEY L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\NX2navi"
|
||||
/* The launcher window's taskbar identity (launcher/winsys.py app_id): a shortcut that carries it is the one the
|
||||
taskbar groups and pins the window under, with the shortcut's icon. */
|
||||
#define APP_USER_MODEL_ID L"NX2navi.Launcher"
|
||||
static const PROPERTYKEY NX_PKEY_AppUserModel_ID = {
|
||||
{0x9F4C2855, 0x9F79, 0x4B39, {0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3}}, 5};
|
||||
static const IID NX_IID_IPropertyStore = {0x886d8eeb, 0x8cf2, 0x4446, {0x8d, 0x02, 0xcd, 0xba, 0x1d, 0xbd, 0xcf, 0x99}};
|
||||
|
||||
static inline void exe_dir(wchar_t *out, size_t n)
|
||||
{
|
||||
@@ -105,6 +112,16 @@ static inline int make_shortcut(const wchar_t *lnk, const wchar_t *target, const
|
||||
IShellLinkW_SetWorkingDirectory(sl, workdir);
|
||||
IShellLinkW_SetIconLocation(sl, target, 0);
|
||||
IShellLinkW_SetDescription(sl, desc);
|
||||
IPropertyStore *ps = NULL;
|
||||
if (SUCCEEDED(IShellLinkW_QueryInterface(sl, &NX_IID_IPropertyStore, (void **)&ps))) {
|
||||
PROPVARIANT pv;
|
||||
memset(&pv, 0, sizeof pv);
|
||||
pv.vt = VT_LPWSTR;
|
||||
pv.pwszVal = (LPWSTR)APP_USER_MODEL_ID;
|
||||
IPropertyStore_SetValue(ps, &NX_PKEY_AppUserModel_ID, &pv);
|
||||
IPropertyStore_Commit(ps);
|
||||
IPropertyStore_Release(ps);
|
||||
}
|
||||
if (SUCCEEDED(IShellLinkW_QueryInterface(sl, &IID_IPersistFile, (void **)&pf))) {
|
||||
ok = SUCCEEDED(IPersistFile_Save(pf, lnk, TRUE));
|
||||
IPersistFile_Release(pf);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* The icon (the Triforce, written by tools/make_launcher.py from launcher/ui/art.py triforce_ico into the build
|
||||
folder, found through -I) and the manifest of NX2navi.exe and NX2navi-Setup.exe. */
|
||||
/* The icon (Navi, written by tools/make_launcher.py from launcher/ui/art.py navi_ico into the build folder,
|
||||
found through -I) and the manifest of NX2navi.exe and NX2navi-Setup.exe. */
|
||||
1 ICON "nx2navi.ico"
|
||||
1 24 "app.manifest"
|
||||
|
||||
@@ -32,6 +32,16 @@ typedef struct {
|
||||
static Setup S;
|
||||
static HWND g_wnd;
|
||||
|
||||
/* Navi as launcher/ui/art.py NAVI draws it: W white, g grey, K black, B and L blue, '.' transparent. */
|
||||
static const char *const NAVI[21] = {
|
||||
"WWWW..............WWWW", "WggWW............WWggW", "WgggWW..........WWgggW", "WgWggWW........WWggWgW",
|
||||
"WggWggW........WggWggW", "WgWgWgWW......WWgWgWgW", "WggggWgWKKKKKKWgWggggW", "WWggWggKBBBBBBKggWggWW",
|
||||
".WggggKKBBLLBBKKggggW.", ".WWggKKBBLLLLBBKKggWW.", "..WWgKBBLLWWLLBBKgWW..", "...WWKBBLWWWWLBBKWW...",
|
||||
".....KBBLLWWLLBBK.....", ".....KBBBLLLLBBBK.....", ".....WKKBBBBBBKKW.....", "....WWgKKBBBBKKgWW....",
|
||||
"...WWgggKKKKKKgggWW...", "...WggWgW....WgWggW...", "...WgWggW....WggWgW...", "...WWggWW....WWggWW...",
|
||||
"....WWWW......WWWW....",
|
||||
};
|
||||
|
||||
static void fail_msg(const wchar_t *fmt, const wchar_t *arg)
|
||||
{
|
||||
swprintf(S.error, 512, fmt, arg ? arg : L"");
|
||||
@@ -258,35 +268,37 @@ static LRESULT CALLBACK wndproc(HWND w, UINT m, WPARAM wp, LPARAM lp)
|
||||
FillRect(dc, &r, edge);
|
||||
RECT in = {r.left + 2, r.top + 2, r.right - 2, r.bottom - 2};
|
||||
FillRect(dc, &in, bg);
|
||||
/* the Triforce: three gold triangles */
|
||||
HBRUSH gold = CreateSolidBrush(RGB(0xe8, 0xaf, 0x3d));
|
||||
HPEN none = CreatePen(PS_NULL, 0, 0);
|
||||
HGDIOBJ ob = SelectObject(dc, gold), op = SelectObject(dc, none);
|
||||
int cx = 52, top = 28, s = 44;
|
||||
POINT t1[3] = {{cx, top}, {cx + s / 4, top + s * 433 / 1000}, {cx - s / 4, top + s * 433 / 1000}};
|
||||
POINT t2[3] = {{cx - s / 4, top + s * 433 / 1000 + 1}, {cx, top + s * 866 / 1000}, {cx - s / 2, top + s * 866 / 1000}};
|
||||
POINT t3[3] = {{cx + s / 4, top + s * 433 / 1000 + 1}, {cx + s / 2, top + s * 866 / 1000}, {cx, top + s * 866 / 1000}};
|
||||
Polygon(dc, t1, 3);
|
||||
Polygon(dc, t2, 3);
|
||||
Polygon(dc, t3, 3);
|
||||
SelectObject(dc, ob);
|
||||
SelectObject(dc, op);
|
||||
/* Navi, the launcher's emblem: the artwork's 22 x 21 pixels, 4 x 4 screen pixels each */
|
||||
for (int y = 0; y < 21; y++)
|
||||
for (int x = 0; x < 22; x++) {
|
||||
COLORREF col;
|
||||
switch (NAVI[y][x]) {
|
||||
case 'W': col = RGB(255, 255, 255); break;
|
||||
case 'g': col = RGB(207, 216, 220); break;
|
||||
case 'K': col = RGB(0, 0, 0); break;
|
||||
case 'B': col = RGB(2, 136, 209); break;
|
||||
case 'L': col = RGB(79, 195, 247); break;
|
||||
default: continue;
|
||||
}
|
||||
HBRUSH b = CreateSolidBrush(col);
|
||||
RECT px = {16 + 4 * x, 18 + 4 * y, 20 + 4 * x, 22 + 4 * y};
|
||||
FillRect(dc, &px, b);
|
||||
DeleteObject(b);
|
||||
}
|
||||
HFONT big = CreateFontW(-26, 0, 0, 0, FW_SEMIBOLD, 0, 0, 0, DEFAULT_CHARSET, 0, 0, CLEARTYPE_QUALITY, 0, L"Segoe UI");
|
||||
HFONT small = CreateFontW(-16, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, 0, 0, CLEARTYPE_QUALITY, 0, L"Segoe UI");
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
SetTextColor(dc, RGB(0xf3, 0xec, 0xdc));
|
||||
HGDIOBJ of = SelectObject(dc, big);
|
||||
TextOutW(dc, 96, 30, APP_NAME, (int)wcslen(APP_NAME));
|
||||
TextOutW(dc, 120, 30, APP_NAME, (int)wcslen(APP_NAME));
|
||||
SelectObject(dc, small);
|
||||
SetTextColor(dc, RGB(0xe9, 0xdc, 0xc0));
|
||||
wchar_t line[96];
|
||||
swprintf(line, 96, L"Installing version %ls\x2026 %llu MB", S.version, (unsigned long long)(S.written >> 20));
|
||||
TextOutW(dc, 96, 66, line, (int)wcslen(line));
|
||||
TextOutW(dc, 120, 66, line, (int)wcslen(line));
|
||||
SelectObject(dc, of);
|
||||
DeleteObject(big);
|
||||
DeleteObject(small);
|
||||
DeleteObject(gold);
|
||||
DeleteObject(none);
|
||||
DeleteObject(bg);
|
||||
DeleteObject(edge);
|
||||
EndPaint(w, &ps);
|
||||
|
||||
Reference in New Issue
Block a user