Skip to content

Commit

Permalink
dhry2, accept anonumous results
Browse files Browse the repository at this point in the history
  • Loading branch information
caiiiycuk committed Jan 30, 2025
1 parent 318569c commit 1392408
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
2 changes: 2 additions & 0 deletions src/host/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface ISystemInfo {
gpu: string;
deviceModel: string;
cpu: string;
emscripten: string;
}


Expand Down Expand Up @@ -166,6 +167,7 @@ export function systemInfo(ctx: WebGLRenderingContext): ISystemInfo {
{ width: screenWidth, height: screenHeight },
),
cpu: (cores || 0).toString(),
emscripten: "3.1.68",
};
}

Expand Down
54 changes: 26 additions & 28 deletions src/window/dos/dos-dhry2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,28 @@ export function Dhry2Results(props: { ci: CommandInterface }) {
pc: getComparablePc(vaxRating),
});

if (token) {
(async () => {
const gl = nonSerializableStore.gl;
if (gl) {
const payload = {
token,
test: "dhry2",
jsdos: JSDOS_VERSION,
emu: emuVersion,
backend,
worker,
hardware: hardware ?? false,
result: Math.round(vaxRating * 100) / 100,
...systemInfo(gl),
};
await fetch(apiEndpoint + "/perf/set", {
method: "POST",
body: JSON.stringify(payload),
});
}
})()
.catch(console.error)
.finally(() => setSubmited(true));
}
(async () => {
const gl = nonSerializableStore.gl;
if (gl) {
const payload = {
token: token ?? "",
test: "dhry2",
jsdos: JSDOS_VERSION,
emu: emuVersion,
backend,
worker,
hardware: hardware ?? false,
result: Math.round(vaxRating * 100) / 100,
...systemInfo(gl),
};
await fetch(apiEndpoint + "/perf/set", {
method: "POST",
body: JSON.stringify(payload),
});
}
})()
.catch(console.error)
.finally(() => setSubmited(true));
} else {
setResults({
runs,
Expand Down Expand Up @@ -138,11 +136,11 @@ export function Dhry2Results(props: { ci: CommandInterface }) {
<div>{results.runs}</div>
<div>Time:</div>
<div>{results.time} <span>ms</span></div>
{results.pc !== null && <div>PC:</div>}
{results.pc !== null && <div>{results.pc ?? "..."}</div>}
{submited && results.pc !== null && <div>PC:</div>}
{submited && results.pc !== null && <div>{results.pc ?? "..."}</div>}
</div>
{token && !submited && <div class="mt-14 text-yellow-500">Please wait until this message disappears</div>}
{!token && <div class="mt-14 text-yellow-500">Please enter your key to submit results</div>}
{!submited && <div class="mt-14 text-yellow-500">Please wait until this message disappears</div>}
{!submited && !token && <div class="mt-14 text-yellow-500">Please enter your key to submit results</div>}
</div>;
}

Expand Down

0 comments on commit 1392408

Please sign in to comment.