create-pixi-vn 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template-lib/package.json +3 -0
- package/template-nqtr-react-vite-muijoy/package.json +2 -2
- package/template-nqtr-react-vite-muijoy/src/assets/index.ts +2 -11
- package/template-nqtr-react-vite-muijoy/src/assets/manifest.gen.json +2 -7
- package/template-nqtr-react-vite-muijoy/src/components/menus/settings/index.tsx +15 -6
- package/template-nqtr-react-vite-muijoy/src/components/menus/settings/menus/diagnostics.tsx +266 -0
- package/template-nqtr-react-vite-muijoy/src/components/menus/settings/quick-menus.tsx +25 -1
- package/template-nqtr-react-vite-muijoy/src/lib/hooks/device-diagnostics-hooks.ts +68 -0
- package/template-nqtr-react-vite-muijoy/src/lib/hooks/hotkeys-hooks.ts +16 -0
- package/template-nqtr-react-vite-muijoy/src/lib/utils/device-diagnostics-utility.ts +382 -0
- package/template-nqtr-react-vite-muijoy/src/locales/en.json +50 -0
- package/template-nqtr-react-vite-muijoy/src/pixi-vn.keys.gen.ts +4 -7
- package/template-nqtr-react-vite-muijoy-ink/package.json +3 -3
- package/template-nqtr-react-vite-muijoy-ink/src/assets/index.ts +2 -11
- package/template-nqtr-react-vite-muijoy-ink/src/assets/manifest.gen.json +2 -7
- package/template-nqtr-react-vite-muijoy-ink/src/components/menus/settings/index.tsx +15 -6
- package/template-nqtr-react-vite-muijoy-ink/src/components/menus/settings/menus/diagnostics.tsx +266 -0
- package/template-nqtr-react-vite-muijoy-ink/src/components/menus/settings/quick-menus.tsx +25 -1
- package/template-nqtr-react-vite-muijoy-ink/src/lib/hooks/device-diagnostics-hooks.ts +68 -0
- package/template-nqtr-react-vite-muijoy-ink/src/lib/hooks/hotkeys-hooks.ts +16 -0
- package/template-nqtr-react-vite-muijoy-ink/src/lib/utils/device-diagnostics-utility.ts +382 -0
- package/template-nqtr-react-vite-muijoy-ink/src/locales/en.json +50 -0
- package/template-nqtr-react-vite-muijoy-ink/src/pixi-vn.keys.gen.ts +4 -7
- package/template-nqtr-react-vite-muijoy-ink-tauri/.vscode/launch.json +1 -1
- package/template-nqtr-react-vite-muijoy-ink-tauri/.vscode/tasks.json +1 -35
- package/template-nqtr-react-vite-muijoy-ink-tauri/_github/workflows/mobile.yml +76 -13
- package/template-nqtr-react-vite-muijoy-ink-tauri/package.json +3 -3
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/assets/index.ts +2 -11
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/assets/manifest.gen.json +2 -7
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/components/menus/settings/index.tsx +15 -6
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/components/menus/settings/menus/diagnostics.tsx +332 -0
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/components/menus/settings/quick-menus.tsx +32 -1
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/content/ink/hashtag-commands.ts +17 -0
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/lib/hooks/device-diagnostics-hooks.ts +96 -0
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/lib/hooks/hotkeys-hooks.ts +16 -0
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/lib/system-info.ts +54 -0
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/lib/utils/device-diagnostics-utility.ts +511 -0
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/locales/en.json +66 -0
- package/template-nqtr-react-vite-muijoy-ink-tauri/src/pixi-vn.keys.gen.ts +4 -7
- package/template-nqtr-react-vite-muijoy-ink-tauri/src-tauri/Cargo.toml +1 -0
- package/template-nqtr-react-vite-muijoy-ink-tauri/src-tauri/src/lib.rs +34 -22
- package/template-nqtr-react-vite-muijoy-ink-tauri/src-tauri/src/system_info.rs +33 -0
- package/template-nqtr-react-vite-muijoy-tauri/.vscode/launch.json +1 -1
- package/template-nqtr-react-vite-muijoy-tauri/.vscode/tasks.json +1 -35
- package/template-nqtr-react-vite-muijoy-tauri/_github/workflows/mobile.yml +76 -13
- package/template-nqtr-react-vite-muijoy-tauri/package.json +2 -2
- package/template-nqtr-react-vite-muijoy-tauri/src/assets/index.ts +2 -11
- package/template-nqtr-react-vite-muijoy-tauri/src/assets/manifest.gen.json +2 -7
- package/template-nqtr-react-vite-muijoy-tauri/src/components/menus/settings/index.tsx +15 -6
- package/template-nqtr-react-vite-muijoy-tauri/src/components/menus/settings/menus/diagnostics.tsx +332 -0
- package/template-nqtr-react-vite-muijoy-tauri/src/components/menus/settings/quick-menus.tsx +32 -1
- package/template-nqtr-react-vite-muijoy-tauri/src/lib/hooks/device-diagnostics-hooks.ts +96 -0
- package/template-nqtr-react-vite-muijoy-tauri/src/lib/hooks/hotkeys-hooks.ts +16 -0
- package/template-nqtr-react-vite-muijoy-tauri/src/lib/system-info.ts +54 -0
- package/template-nqtr-react-vite-muijoy-tauri/src/lib/utils/device-diagnostics-utility.ts +511 -0
- package/template-nqtr-react-vite-muijoy-tauri/src/locales/en.json +66 -0
- package/template-nqtr-react-vite-muijoy-tauri/src/pixi-vn.keys.gen.ts +4 -7
- package/template-nqtr-react-vite-muijoy-tauri/src-tauri/Cargo.toml +1 -0
- package/template-nqtr-react-vite-muijoy-tauri/src-tauri/src/lib.rs +32 -20
- package/template-nqtr-react-vite-muijoy-tauri/src-tauri/src/system_info.rs +33 -0
- package/template-react-vite-muijoy/package.json +1 -1
- package/template-react-vite-muijoy/src/assets/index.ts +55 -55
- package/template-react-vite-muijoy/src/assets/manifest.gen.json +2 -7
- package/template-react-vite-muijoy/src/components/menus/settings/index.tsx +15 -6
- package/template-react-vite-muijoy/src/components/menus/settings/menus/diagnostics.tsx +266 -0
- package/template-react-vite-muijoy/src/components/menus/settings/quick-menus.tsx +25 -1
- package/template-react-vite-muijoy/src/lib/hooks/device-diagnostics-hooks.ts +68 -0
- package/template-react-vite-muijoy/src/lib/hooks/hotkeys-hooks.ts +16 -0
- package/template-react-vite-muijoy/src/lib/utils/device-diagnostics-utility.ts +382 -0
- package/template-react-vite-muijoy/src/locales/en.json +50 -0
- package/template-react-vite-muijoy/src/pixi-vn.keys.gen.ts +2 -3
- package/template-react-vite-muijoy-ink/ink/second_part.ink +0 -1
- package/template-react-vite-muijoy-ink/ink/start.ink +4 -6
- package/template-react-vite-muijoy-ink/package.json +2 -2
- package/template-react-vite-muijoy-ink/src/assets/index.ts +55 -55
- package/template-react-vite-muijoy-ink/src/assets/manifest.gen.json +2 -7
- package/template-react-vite-muijoy-ink/src/components/menus/settings/index.tsx +15 -6
- package/template-react-vite-muijoy-ink/src/components/menus/settings/menus/diagnostics.tsx +266 -0
- package/template-react-vite-muijoy-ink/src/components/menus/settings/quick-menus.tsx +25 -1
- package/template-react-vite-muijoy-ink/src/lib/hooks/device-diagnostics-hooks.ts +68 -0
- package/template-react-vite-muijoy-ink/src/lib/hooks/hotkeys-hooks.ts +16 -0
- package/template-react-vite-muijoy-ink/src/lib/utils/device-diagnostics-utility.ts +382 -0
- package/template-react-vite-muijoy-ink/src/locales/en.json +50 -0
- package/template-react-vite-muijoy-ink/src/pixi-vn.keys.gen.ts +2 -3
- package/template-react-vite-muijoy-ink-tauri/.vscode/launch.json +1 -1
- package/template-react-vite-muijoy-ink-tauri/.vscode/tasks.json +1 -35
- package/template-react-vite-muijoy-ink-tauri/_github/workflows/mobile.yml +76 -13
- package/template-react-vite-muijoy-ink-tauri/ink/second_part.ink +0 -1
- package/template-react-vite-muijoy-ink-tauri/ink/start.ink +4 -6
- package/template-react-vite-muijoy-ink-tauri/package-lock.json +12 -12
- package/template-react-vite-muijoy-ink-tauri/package.json +2 -2
- package/template-react-vite-muijoy-ink-tauri/src/assets/index.ts +55 -55
- package/template-react-vite-muijoy-ink-tauri/src/assets/manifest.gen.json +2 -7
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/settings/index.tsx +15 -6
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/settings/menus/diagnostics.tsx +332 -0
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/settings/quick-menus.tsx +32 -1
- package/template-react-vite-muijoy-ink-tauri/src/lib/hooks/device-diagnostics-hooks.ts +96 -0
- package/template-react-vite-muijoy-ink-tauri/src/lib/hooks/hotkeys-hooks.ts +16 -0
- package/template-react-vite-muijoy-ink-tauri/src/lib/system-info.ts +54 -0
- package/template-react-vite-muijoy-ink-tauri/src/lib/utils/device-diagnostics-utility.ts +511 -0
- package/template-react-vite-muijoy-ink-tauri/src/locales/en.json +66 -0
- package/template-react-vite-muijoy-ink-tauri/src/pixi-vn.keys.gen.ts +2 -3
- package/template-react-vite-muijoy-ink-tauri/src-tauri/Cargo.toml +1 -0
- package/template-react-vite-muijoy-ink-tauri/src-tauri/src/lib.rs +32 -20
- package/template-react-vite-muijoy-ink-tauri/src-tauri/src/system_info.rs +33 -0
- package/template-react-vite-muijoy-tauri/.vscode/launch.json +1 -1
- package/template-react-vite-muijoy-tauri/.vscode/tasks.json +1 -35
- package/template-react-vite-muijoy-tauri/_github/workflows/mobile.yml +76 -13
- package/template-react-vite-muijoy-tauri/package.json +1 -1
- package/template-react-vite-muijoy-tauri/src/assets/index.ts +55 -55
- package/template-react-vite-muijoy-tauri/src/assets/manifest.gen.json +2 -7
- package/template-react-vite-muijoy-tauri/src/components/menus/settings/index.tsx +15 -6
- package/template-react-vite-muijoy-tauri/src/components/menus/settings/menus/diagnostics.tsx +332 -0
- package/template-react-vite-muijoy-tauri/src/components/menus/settings/quick-menus.tsx +32 -1
- package/template-react-vite-muijoy-tauri/src/lib/hooks/device-diagnostics-hooks.ts +96 -0
- package/template-react-vite-muijoy-tauri/src/lib/hooks/hotkeys-hooks.ts +16 -0
- package/template-react-vite-muijoy-tauri/src/lib/system-info.ts +54 -0
- package/template-react-vite-muijoy-tauri/src/lib/utils/device-diagnostics-utility.ts +511 -0
- package/template-react-vite-muijoy-tauri/src/locales/en.json +66 -0
- package/template-react-vite-muijoy-tauri/src/pixi-vn.keys.gen.ts +2 -3
- package/template-react-vite-muijoy-tauri/src-tauri/Cargo.toml +1 -0
- package/template-react-vite-muijoy-tauri/src-tauri/src/lib.rs +32 -20
- package/template-react-vite-muijoy-tauri/src-tauri/src/system_info.rs +33 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { Button } from "@/components/ui/button";
|
|
2
|
+
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
3
|
+
import { useDeviceDiagnostics } from "@/lib/hooks/device-diagnostics-hooks";
|
|
4
|
+
import {
|
|
5
|
+
buildDiagnosticsReportText,
|
|
6
|
+
downloadDiagnosticsReportJson,
|
|
7
|
+
} from "@/lib/utils/device-diagnostics-utility";
|
|
8
|
+
import { AlertTriangleIcon, CheckIcon, ClipboardCopyIcon, DownloadIcon, XIcon } from "lucide-react";
|
|
9
|
+
import type { ReactNode } from "react";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
import { toast } from "sonner";
|
|
12
|
+
|
|
13
|
+
function DiagnosticsSection({ title, children }: { title: string; children: ReactNode }) {
|
|
14
|
+
return (
|
|
15
|
+
<div className="flex flex-col gap-2">
|
|
16
|
+
<h3 className="text-sm font-semibold uppercase tracking-wide text-muted-foreground">
|
|
17
|
+
{title}
|
|
18
|
+
</h3>
|
|
19
|
+
<div className="flex flex-col gap-1 rounded-lg border bg-card/80 p-3">{children}</div>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function DiagnosticRow({ label, value }: { label: string; value: ReactNode }) {
|
|
25
|
+
return (
|
|
26
|
+
<div className="flex items-start justify-between gap-4 text-sm">
|
|
27
|
+
<span className="text-muted-foreground">{label}</span>
|
|
28
|
+
<span className="text-right font-medium break-all">{value}</span>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function CapabilityRow({
|
|
34
|
+
label,
|
|
35
|
+
supported,
|
|
36
|
+
hint,
|
|
37
|
+
}: {
|
|
38
|
+
label: string;
|
|
39
|
+
supported: boolean | null;
|
|
40
|
+
hint?: string;
|
|
41
|
+
}) {
|
|
42
|
+
const { t } = useTranslation(["ui"]);
|
|
43
|
+
return (
|
|
44
|
+
<div className="flex items-center justify-between gap-4 text-sm">
|
|
45
|
+
<div>
|
|
46
|
+
<p className="font-medium">{label}</p>
|
|
47
|
+
{hint && <p className="text-xs text-muted-foreground">{hint}</p>}
|
|
48
|
+
</div>
|
|
49
|
+
{supported === null ? (
|
|
50
|
+
<span className="shrink-0 text-xs text-muted-foreground">
|
|
51
|
+
{t("diagnostics_unknown")}
|
|
52
|
+
</span>
|
|
53
|
+
) : supported ? (
|
|
54
|
+
<CheckIcon className="size-4 shrink-0 text-green-600 dark:text-green-400" />
|
|
55
|
+
) : (
|
|
56
|
+
<XIcon className="size-4 shrink-0 text-red-600 dark:text-red-400" />
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function DiagnosticsSettingsPage() {
|
|
63
|
+
const diagnostics = useDeviceDiagnostics();
|
|
64
|
+
const { t } = useTranslation(["ui"]);
|
|
65
|
+
const { webgl, capabilities, resolution, memory, fps } = diagnostics;
|
|
66
|
+
const yesNo = (value: boolean | null) =>
|
|
67
|
+
value === null
|
|
68
|
+
? t("diagnostics_unknown")
|
|
69
|
+
: value
|
|
70
|
+
? t("diagnostics_yes")
|
|
71
|
+
: t("diagnostics_no");
|
|
72
|
+
|
|
73
|
+
const handleCopyReport = async () => {
|
|
74
|
+
try {
|
|
75
|
+
await navigator.clipboard.writeText(buildDiagnosticsReportText(diagnostics));
|
|
76
|
+
toast.success(t("diagnostics_report_copied"));
|
|
77
|
+
} catch {
|
|
78
|
+
toast.error(t("diagnostics_report_copy_failed"));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const handleDownloadReport = () => {
|
|
83
|
+
downloadDiagnosticsReportJson(diagnostics);
|
|
84
|
+
toast.success(t("diagnostics_report_downloaded"));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<ScrollArea className="flex-1 min-h-0">
|
|
89
|
+
<div className="mx-auto flex max-w-3xl flex-col gap-4 p-4">
|
|
90
|
+
<div className="flex justify-end gap-2">
|
|
91
|
+
<Button variant="outline" onClick={handleDownloadReport}>
|
|
92
|
+
<DownloadIcon />
|
|
93
|
+
{t("diagnostics_download_report")}
|
|
94
|
+
</Button>
|
|
95
|
+
<Button onClick={handleCopyReport}>
|
|
96
|
+
<ClipboardCopyIcon />
|
|
97
|
+
{t("diagnostics_copy_report")}
|
|
98
|
+
</Button>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
{!webgl.webgl2Supported && (
|
|
102
|
+
<div className="flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive">
|
|
103
|
+
<AlertTriangleIcon className="mt-0.5 size-5 shrink-0" />
|
|
104
|
+
<p>{t("diagnostics_webgl2_missing_message")}</p>
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
|
|
108
|
+
<DiagnosticsSection title={t("diagnostics_section_engine")}>
|
|
109
|
+
<DiagnosticRow
|
|
110
|
+
label={t("diagnostics_game_version")}
|
|
111
|
+
value={diagnostics.gameVersion}
|
|
112
|
+
/>
|
|
113
|
+
<DiagnosticRow
|
|
114
|
+
label={t("diagnostics_pixijs_version")}
|
|
115
|
+
value={diagnostics.pixiJsVersion}
|
|
116
|
+
/>
|
|
117
|
+
<DiagnosticRow
|
|
118
|
+
label={t("diagnostics_pixivn_version")}
|
|
119
|
+
value={diagnostics.pixiVnVersion}
|
|
120
|
+
/>
|
|
121
|
+
<DiagnosticRow
|
|
122
|
+
label={t("diagnostics_tonejs_version")}
|
|
123
|
+
value={diagnostics.toneJsVersion}
|
|
124
|
+
/>
|
|
125
|
+
<DiagnosticRow
|
|
126
|
+
label={t("diagnostics_motion_version")}
|
|
127
|
+
value={diagnostics.motionVersion}
|
|
128
|
+
/>
|
|
129
|
+
</DiagnosticsSection>
|
|
130
|
+
|
|
131
|
+
<DiagnosticsSection title={t("diagnostics_section_device")}>
|
|
132
|
+
<DiagnosticRow label={t("diagnostics_platform")} value={diagnostics.platform} />
|
|
133
|
+
<DiagnosticRow
|
|
134
|
+
label={t("diagnostics_browser_engine")}
|
|
135
|
+
value={diagnostics.browserEngine}
|
|
136
|
+
/>
|
|
137
|
+
<DiagnosticRow
|
|
138
|
+
label={t("diagnostics_user_agent")}
|
|
139
|
+
value={diagnostics.userAgent}
|
|
140
|
+
/>
|
|
141
|
+
</DiagnosticsSection>
|
|
142
|
+
|
|
143
|
+
<DiagnosticsSection title={t("diagnostics_section_graphics")}>
|
|
144
|
+
<DiagnosticRow
|
|
145
|
+
label={t("diagnostics_webgl1")}
|
|
146
|
+
value={yesNo(webgl.webgl1Supported)}
|
|
147
|
+
/>
|
|
148
|
+
<DiagnosticRow
|
|
149
|
+
label={t("diagnostics_webgl2")}
|
|
150
|
+
value={yesNo(webgl.webgl2Supported)}
|
|
151
|
+
/>
|
|
152
|
+
<DiagnosticRow
|
|
153
|
+
label={t("diagnostics_hardware_acceleration")}
|
|
154
|
+
value={yesNo(webgl.hardwareAccelerated)}
|
|
155
|
+
/>
|
|
156
|
+
<DiagnosticRow
|
|
157
|
+
label={t("diagnostics_gpu_vendor")}
|
|
158
|
+
value={webgl.unmaskedVendor ?? webgl.vendor ?? t("diagnostics_unknown")}
|
|
159
|
+
/>
|
|
160
|
+
<DiagnosticRow
|
|
161
|
+
label={t("diagnostics_gpu_renderer")}
|
|
162
|
+
value={webgl.unmaskedRenderer ?? webgl.renderer ?? t("diagnostics_unknown")}
|
|
163
|
+
/>
|
|
164
|
+
<DiagnosticRow
|
|
165
|
+
label={t("diagnostics_max_texture_size")}
|
|
166
|
+
value={webgl.maxTextureSize ?? t("diagnostics_unknown")}
|
|
167
|
+
/>
|
|
168
|
+
</DiagnosticsSection>
|
|
169
|
+
|
|
170
|
+
<DiagnosticsSection title={t("diagnostics_section_display")}>
|
|
171
|
+
<DiagnosticRow
|
|
172
|
+
label={t("diagnostics_resolution")}
|
|
173
|
+
value={`${resolution.innerWidth}x${resolution.innerHeight}`}
|
|
174
|
+
/>
|
|
175
|
+
<DiagnosticRow
|
|
176
|
+
label={t("diagnostics_device_pixel_ratio")}
|
|
177
|
+
value={resolution.devicePixelRatio}
|
|
178
|
+
/>
|
|
179
|
+
<DiagnosticRow
|
|
180
|
+
label={t("diagnostics_fps")}
|
|
181
|
+
value={fps ?? t("diagnostics_unknown")}
|
|
182
|
+
/>
|
|
183
|
+
</DiagnosticsSection>
|
|
184
|
+
|
|
185
|
+
<DiagnosticsSection title={t("diagnostics_section_memory")}>
|
|
186
|
+
{memory ? (
|
|
187
|
+
<DiagnosticRow
|
|
188
|
+
label={t("diagnostics_js_heap")}
|
|
189
|
+
value={`${(memory.usedJSHeapSize / 1024 / 1024).toFixed(1)} / ${(
|
|
190
|
+
memory.totalJSHeapSize / 1024 / 1024
|
|
191
|
+
).toFixed(1)} MB`}
|
|
192
|
+
/>
|
|
193
|
+
) : (
|
|
194
|
+
<p className="text-sm text-muted-foreground">
|
|
195
|
+
{t("diagnostics_js_heap_unavailable")}
|
|
196
|
+
</p>
|
|
197
|
+
)}
|
|
198
|
+
</DiagnosticsSection>
|
|
199
|
+
|
|
200
|
+
<DiagnosticsSection title={t("diagnostics_section_capabilities")}>
|
|
201
|
+
<CapabilityRow
|
|
202
|
+
label={t("diagnostics_webgl2")}
|
|
203
|
+
supported={webgl.webgl2Supported}
|
|
204
|
+
/>
|
|
205
|
+
<CapabilityRow
|
|
206
|
+
label={t("diagnostics_hardware_acceleration")}
|
|
207
|
+
supported={webgl.hardwareAccelerated}
|
|
208
|
+
/>
|
|
209
|
+
<CapabilityRow
|
|
210
|
+
label={t("diagnostics_gpu_supported")}
|
|
211
|
+
supported={webgl.webgl1Supported || webgl.webgl2Supported}
|
|
212
|
+
/>
|
|
213
|
+
<CapabilityRow
|
|
214
|
+
label={t("diagnostics_max_texture_size_check")}
|
|
215
|
+
supported={(webgl.maxTextureSize ?? 0) >= 8192}
|
|
216
|
+
/>
|
|
217
|
+
<CapabilityRow
|
|
218
|
+
label={t("diagnostics_float_textures")}
|
|
219
|
+
supported={webgl.floatTexturesSupported}
|
|
220
|
+
/>
|
|
221
|
+
<CapabilityRow label={t("diagnostics_msaa")} supported={webgl.msaaSupported} />
|
|
222
|
+
<CapabilityRow
|
|
223
|
+
label={t("diagnostics_shaders_compile")}
|
|
224
|
+
supported={webgl.shadersCompile}
|
|
225
|
+
/>
|
|
226
|
+
<CapabilityRow label={t("diagnostics_audio")} supported={capabilities.audio} />
|
|
227
|
+
<CapabilityRow
|
|
228
|
+
label={t("diagnostics_gamepad")}
|
|
229
|
+
supported={capabilities.gamepad}
|
|
230
|
+
/>
|
|
231
|
+
<CapabilityRow
|
|
232
|
+
label={t("diagnostics_clipboard")}
|
|
233
|
+
supported={capabilities.clipboard}
|
|
234
|
+
/>
|
|
235
|
+
<CapabilityRow
|
|
236
|
+
label={t("diagnostics_fullscreen")}
|
|
237
|
+
supported={capabilities.fullscreen}
|
|
238
|
+
/>
|
|
239
|
+
<CapabilityRow
|
|
240
|
+
label={t("diagnostics_local_storage")}
|
|
241
|
+
supported={capabilities.localStorage}
|
|
242
|
+
/>
|
|
243
|
+
<CapabilityRow
|
|
244
|
+
label={t("diagnostics_indexed_db")}
|
|
245
|
+
supported={capabilities.indexedDb}
|
|
246
|
+
/>
|
|
247
|
+
<CapabilityRow
|
|
248
|
+
label={t("diagnostics_steam_overlay")}
|
|
249
|
+
supported={capabilities.steamOverlayDetected}
|
|
250
|
+
hint={t("diagnostics_steam_overlay_hint")}
|
|
251
|
+
/>
|
|
252
|
+
</DiagnosticsSection>
|
|
253
|
+
|
|
254
|
+
<DiagnosticsSection title={t("diagnostics_section_extensions")}>
|
|
255
|
+
{webgl.keyExtensions.map((extension) => (
|
|
256
|
+
<CapabilityRow
|
|
257
|
+
key={extension.name}
|
|
258
|
+
label={extension.name}
|
|
259
|
+
supported={extension.supported}
|
|
260
|
+
/>
|
|
261
|
+
))}
|
|
262
|
+
</DiagnosticsSection>
|
|
263
|
+
</div>
|
|
264
|
+
</ScrollArea>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
@@ -5,7 +5,7 @@ import { Separator } from "@/components/ui/separator";
|
|
|
5
5
|
import { useSetSearchParamState } from "@/lib/hooks/navigation-hooks";
|
|
6
6
|
import { Game } from "@drincs/pixi-vn";
|
|
7
7
|
import { useLocation, useNavigate } from "@tanstack/react-router";
|
|
8
|
-
import { Gamepad2Icon, HistoryIcon, LogOutIcon, SaveIcon } from "lucide-react";
|
|
8
|
+
import { Gamepad2Icon, HistoryIcon, LogOutIcon, SaveIcon, StethoscopeIcon } from "lucide-react";
|
|
9
9
|
import { useTranslation } from "react-i18next";
|
|
10
10
|
|
|
11
11
|
export function QuickMenus() {
|
|
@@ -18,6 +18,7 @@ export function QuickMenus() {
|
|
|
18
18
|
{isInGame && <OpenHistorySettingButton />}
|
|
19
19
|
<SaveLoadMenuButton />
|
|
20
20
|
<OpenControlsListSettingButton />
|
|
21
|
+
<OpenDiagnosticsSettingButton />
|
|
21
22
|
</div>
|
|
22
23
|
{isInGame && <Separator />}
|
|
23
24
|
{isInGame && <ReturnMainMenuButton />}
|
|
@@ -49,6 +50,29 @@ export function OpenControlsListSettingButton() {
|
|
|
49
50
|
);
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
export function OpenDiagnosticsSettingButton() {
|
|
54
|
+
const { t } = useTranslation(["ui"]);
|
|
55
|
+
const setSettingsOpen = useSetSearchParamState<boolean>("settings");
|
|
56
|
+
const setSettingsTab = useSetSearchParamState<string>("settings_tab");
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Button
|
|
60
|
+
variant="outline"
|
|
61
|
+
className="w-full justify-start"
|
|
62
|
+
onClick={() => {
|
|
63
|
+
setSettingsOpen(true);
|
|
64
|
+
setSettingsTab("menus/diagnostics");
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<StethoscopeIcon />
|
|
68
|
+
{t("diagnostics")}
|
|
69
|
+
<KbdGroup className="ml-auto">
|
|
70
|
+
<Kbd>F8</Kbd>
|
|
71
|
+
</KbdGroup>
|
|
72
|
+
</Button>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
52
76
|
export function ReturnMainMenuButton() {
|
|
53
77
|
const navigate = useNavigate();
|
|
54
78
|
const { t } = useTranslation(["ui"]);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type DeviceDiagnosticsSnapshot,
|
|
3
|
+
detectBrowserEngine,
|
|
4
|
+
detectPlatform,
|
|
5
|
+
getBrowserCapabilities,
|
|
6
|
+
getCurrentFps,
|
|
7
|
+
getGameVersion,
|
|
8
|
+
getJsMemoryInfo,
|
|
9
|
+
getMotionVersion,
|
|
10
|
+
getPixiJsVersion,
|
|
11
|
+
getPixiVnVersion,
|
|
12
|
+
getResolutionInfo,
|
|
13
|
+
getToneJsVersion,
|
|
14
|
+
getWebglDiagnostics,
|
|
15
|
+
} from "@/lib/utils/device-diagnostics-utility";
|
|
16
|
+
import { useEffect, useMemo, useState } from "react";
|
|
17
|
+
|
|
18
|
+
const LIVE_REFRESH_INTERVAL_MS = 1000;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WebGL support, browser capabilities, UA, platform and engine don't change during a session,
|
|
22
|
+
* so they're probed once. FPS, resolution and JS memory are polled since they change live.
|
|
23
|
+
*/
|
|
24
|
+
export function useDeviceDiagnostics(): DeviceDiagnosticsSnapshot {
|
|
25
|
+
const webgl = useMemo(() => getWebglDiagnostics(), []);
|
|
26
|
+
const capabilities = useMemo(() => getBrowserCapabilities(), []);
|
|
27
|
+
const platform = useMemo(() => detectPlatform(), []);
|
|
28
|
+
const browserEngine = useMemo(() => detectBrowserEngine(), []);
|
|
29
|
+
const gameVersion = useMemo(() => getGameVersion(), []);
|
|
30
|
+
const pixiJsVersion = useMemo(() => getPixiJsVersion(), []);
|
|
31
|
+
const pixiVnVersion = useMemo(() => getPixiVnVersion(), []);
|
|
32
|
+
const toneJsVersion = useMemo(() => getToneJsVersion(), []);
|
|
33
|
+
const motionVersion = useMemo(() => getMotionVersion(), []);
|
|
34
|
+
|
|
35
|
+
const [resolution, setResolution] = useState(() => getResolutionInfo());
|
|
36
|
+
const [memory, setMemory] = useState(() => getJsMemoryInfo());
|
|
37
|
+
const [fps, setFps] = useState<number | null>(() => getCurrentFps());
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const onResize = () => setResolution(getResolutionInfo());
|
|
41
|
+
window.addEventListener("resize", onResize);
|
|
42
|
+
return () => window.removeEventListener("resize", onResize);
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const interval = setInterval(() => {
|
|
47
|
+
setFps(getCurrentFps());
|
|
48
|
+
setMemory(getJsMemoryInfo());
|
|
49
|
+
}, LIVE_REFRESH_INTERVAL_MS);
|
|
50
|
+
return () => clearInterval(interval);
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
webgl,
|
|
55
|
+
capabilities,
|
|
56
|
+
resolution,
|
|
57
|
+
memory,
|
|
58
|
+
fps,
|
|
59
|
+
userAgent: navigator.userAgent,
|
|
60
|
+
platform,
|
|
61
|
+
browserEngine,
|
|
62
|
+
gameVersion,
|
|
63
|
+
pixiJsVersion,
|
|
64
|
+
pixiVnVersion,
|
|
65
|
+
toneJsVersion,
|
|
66
|
+
motionVersion,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -169,6 +169,11 @@ export function useSettingsHotkeys(): null {
|
|
|
169
169
|
setSettingsTab("menus/controls");
|
|
170
170
|
}, [setSettingsOpen, setSettingsTab]);
|
|
171
171
|
|
|
172
|
+
const openDiagnosticsPage = useCallback(() => {
|
|
173
|
+
setSettingsOpen(true);
|
|
174
|
+
setSettingsTab("menus/diagnostics");
|
|
175
|
+
}, [setSettingsOpen, setSettingsTab]);
|
|
176
|
+
|
|
172
177
|
useHotkeys([
|
|
173
178
|
{
|
|
174
179
|
hotkey: "Escape",
|
|
@@ -191,6 +196,17 @@ export function useSettingsHotkeys(): null {
|
|
|
191
196
|
},
|
|
192
197
|
},
|
|
193
198
|
},
|
|
199
|
+
{
|
|
200
|
+
hotkey: "F8",
|
|
201
|
+
callback: openDiagnosticsPage,
|
|
202
|
+
options: {
|
|
203
|
+
enabled: !isAnyMenuOrDialogOpen,
|
|
204
|
+
meta: {
|
|
205
|
+
name: t("diagnostics"),
|
|
206
|
+
description: t("diagnostics_hotkey_description"),
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
194
210
|
]);
|
|
195
211
|
|
|
196
212
|
return null;
|