commit f3a3c103385a6c965e85c6282a0dc05321eca898
parent 5732247749ef6e17790e580d4c569c0da5599780
Author: anon <anon@example.com>
Date: Fri, 6 Nov 2026 07:26:09 +0000
Use SDL browser cursors and restore AO artwork on pointer re-entry
Diffstat:
7 files changed, 303 insertions(+), 5 deletions(-)
diff --git a/DEVELOPERS.md b/DEVELOPERS.md
@@ -566,6 +566,10 @@ Door actors (type51016) expose `door.flags`, `latched`, `duration` and `time`.
These read the existing native object and animation frame without advancing it.
`TestBrowserCityDoors` checks shared approach, opening, withdrawal, reconnect and
passage on the selected city/shop routes; see [city doors](docs/city-doors.md).
+The snapshot's `cursor` records the native shape, visibility, hotspot and drawn
+size. `node --test tests/e2e/cursor.test.mjs` checks the browser pointer through
+low-FPS input, canvas re-entry, contextual selection, camera controls, inventory transfers,
+resizing and mobile touch input using the isolated test server.
Short key/click helpers release on the fresh consumed SDL event, then read the
next full snapshot. Reading a large snapshot while holding a skill button can
trigger native autorepeat and buy more points than intended.
diff --git a/TODO.md b/TODO.md
@@ -373,16 +373,21 @@ rewriting this document does not close them.
selection of individual buttons at narrow widths. Opt now follows the strip
attached to the current screen edge. Native hover/click checks pass through
seven sizes from 320x480 to 1600x900; see [resize verification](docs/browser-accounts.md#options-after-resizing).
-- [ ] **Use a browser-native mouse cursor independent of game FPS.**
+- [x] **Use a browser-native mouse cursor independent of game FPS.**
Replace the WebGL-rendered pointer while preserving AO's context-sensitive
cursor artwork and hotspots, visibility during right-button camera control,
and inventory drag behavior. Existing mobile software-cursor suppression and
SDL custom browser-cursor support provide a starting point. Check dragged-item
icons separately: replacing the pointer may leave those frame-bound.
- Investigation found no architectural blocker; no implementation changes have
- been made. Completion: smooth cursor motion at low FPS, correct cursor shapes
+ Completion: smooth cursor motion at low FPS, correct cursor shapes
and click alignment, and no regressions in camera controls, item dragging or
touch input.
+ November 5: SDL now owns a custom browser cursor made from AO's artwork and
+ hotspots. Re-entry restores the gray arrow without requiring a shape change.
+ Focused browser checks pass for input between one-second game frames, target
+ clicks, right-button camera control, resize/Retina scaling, inventory dragging
+ and touch. Dragged-item icons use a separate native renderer and remain
+ frame-bound.
- [x] **Use external assets by default; make single-executable bundling opt-in.**
The assets directory currently occupies about 1.2 GB and is unconditionally
embedded into the server/test build. Default development builds should read
diff --git a/client/game/ccr.dll/lifted-0008.c b/client/game/ccr.dll/lifted-0008.c
@@ -7,6 +7,7 @@
#ifdef __EMSCRIPTEN__
extern int browser_cursor_hidden(void);
+extern void browser_cursor_update(uint32_t owner);
#endif
void sub_27016810(void) {
@@ -976,8 +977,10 @@ L_27016F41:
ecx = eax + eax * 4; /* 0x27016F44: lea ecx, [eax + eax*4] */
ecx = MEM32(ecx * 4 + 0x270485F0); /* 0x27016F47: mov ecx, dword ptr [ecx*4 + 0x270485f0] */
edx = MEM32(ecx); /* 0x27016F4E: mov edx, dword ptr [ecx] */
+#ifndef __EMSCRIPTEN__
RECOMP_ICALL(MEM32(edx + 0x8)); /* 0x27016F50: call dword ptr [edx + 8] */
RECOMP_FLAGS_IN();
+#endif
SET_LO8(eax, MEM8(esi + 0x11)); /* 0x27016F53: mov al, byte ptr [esi + 0x11] */
/* test LO8(eax), LO8(eax) */ /* 0x27016F56: test al, al */
_flag_a = (uint32_t)(LO8(eax)) << 24; _flag_b = (uint32_t)(LO8(eax)) << 24;
@@ -1066,12 +1069,18 @@ L_2701700E:
MEM32(ebp + (-0xC)) = edx; /* 0x27017028: mov dword ptr [ebp - 0xc], edx */
RECOMP_ICALL(0x27016E80u); /* 0x2701702B: call 0x27016e80 */ /* not lifted */
RECOMP_FLAGS_IN();
+#ifdef __EMSCRIPTEN__
+ browser_cursor_update(esi);
+#endif
MEM32(esi + 0xC) = 0; /* 0x27017030: mov dword ptr [esi + 0xc], 0 */
esi = POP32_VAL(esp); /* 0x27017037: pop esi */
esp = ebp; /* 0x27017038: mov esp, ebp */
ebp = POP32_VAL(esp); /* 0x2701703A: pop ebp */
RECOMP_FLAGS_OUT(); esp += 4; { RECOMP_REGS_OUT(); return; } /* 0x2701703B: ret */
L_2701703C:
+#ifdef __EMSCRIPTEN__
+ browser_cursor_update(esi);
+#endif
esi = MEM32(esi + 0x8); /* 0x2701703C: mov esi, dword ptr [esi + 8] */
ecx = esi + esi * 4; /* 0x2701703F: lea ecx, [esi + esi*4] */
ecx = MEM32(ecx * 4 + 0x270485F0); /* 0x27017042: mov ecx, dword ptr [ecx*4 + 0x270485f0] */
@@ -1386,8 +1395,10 @@ L_27016EA0:
eax = eax + eax * 4; /* 0x27016EA3: lea eax, [eax + eax*4] */
ecx = MEM32(eax * 4 + 0x270485F0); /* 0x27016EA6: mov ecx, dword ptr [eax*4 + 0x270485f0] */
edx = MEM32(ecx); /* 0x27016EAD: mov edx, dword ptr [ecx] */
+#ifndef __EMSCRIPTEN__
RECOMP_ICALL(MEM32(edx + 0x8)); /* 0x27016EAF: call dword ptr [edx + 8] */
RECOMP_FLAGS_IN();
+#endif
L_27016EB2:
eax = MEM32(edi); /* 0x27016EB2: mov eax, dword ptr [edi] */
MEM32(esi) = eax; /* 0x27016EB4: mov dword ptr [esi], eax */
@@ -1483,8 +1494,10 @@ L_27016F41:
ecx = eax + eax * 4; /* 0x27016F44: lea ecx, [eax + eax*4] */
ecx = MEM32(ecx * 4 + 0x270485F0); /* 0x27016F47: mov ecx, dword ptr [ecx*4 + 0x270485f0] */
edx = MEM32(ecx); /* 0x27016F4E: mov edx, dword ptr [ecx] */
+#ifndef __EMSCRIPTEN__
RECOMP_ICALL(MEM32(edx + 0x8)); /* 0x27016F50: call dword ptr [edx + 8] */
RECOMP_FLAGS_IN();
+#endif
SET_LO8(eax, MEM8(esi + 0x11)); /* 0x27016F53: mov al, byte ptr [esi + 0x11] */
/* test LO8(eax), LO8(eax) */ /* 0x27016F56: test al, al */
_flag_a = (uint32_t)(LO8(eax)) << 24; _flag_b = (uint32_t)(LO8(eax)) << 24;
@@ -1573,12 +1586,18 @@ L_2701700E:
MEM32(ebp + (-0xC)) = edx; /* 0x27017028: mov dword ptr [ebp - 0xc], edx */
RECOMP_ICALL(0x27016E80u); /* 0x2701702B: call 0x27016e80 */ /* not lifted */
RECOMP_FLAGS_IN();
+#ifdef __EMSCRIPTEN__
+ browser_cursor_update(esi);
+#endif
MEM32(esi + 0xC) = 0; /* 0x27017030: mov dword ptr [esi + 0xc], 0 */
esi = POP32_VAL(esp); /* 0x27017037: pop esi */
esp = ebp; /* 0x27017038: mov esp, ebp */
ebp = POP32_VAL(esp); /* 0x2701703A: pop ebp */
RECOMP_FLAGS_OUT(); esp += 4; { RECOMP_REGS_OUT(); return; } /* 0x2701703B: ret */
L_2701703C:
+#ifdef __EMSCRIPTEN__
+ browser_cursor_update(esi);
+#endif
esi = MEM32(esi + 0x8); /* 0x2701703C: mov esi, dword ptr [esi + 8] */
ecx = esi + esi * 4; /* 0x2701703F: lea ecx, [esi + esi*4] */
ecx = MEM32(ecx * 4 + 0x270485F0); /* 0x27017042: mov ecx, dword ptr [ecx*4 + 0x270485f0] */
@@ -1614,6 +1633,9 @@ L_2701700E:
MEM32(ebp + (-0xC)) = edx; /* 0x27017028: mov dword ptr [ebp - 0xc], edx */
RECOMP_ICALL(0x27016E80u); /* 0x2701702B: call 0x27016e80 */ /* not lifted */
RECOMP_FLAGS_IN();
+#ifdef __EMSCRIPTEN__
+ browser_cursor_update(esi);
+#endif
MEM32(esi + 0xC) = 0; /* 0x27017030: mov dword ptr [esi + 0xc], 0 */
esi = POP32_VAL(esp); /* 0x27017037: pop esi */
esp = ebp; /* 0x27017038: mov esp, ebp */
diff --git a/client/runtime/browser_testing.c b/client/runtime/browser_testing.c
@@ -270,6 +270,19 @@ void browser_test_frame(void)
commands ? MEM32(commands + 0x70) : 0, commands ? MEM32(commands + 0x74) : 0,
dragged ? MEM32(dragged + 0x54) : 0, dragged ? MEM32(dragged + 0x58) : 0);
+ /* CCR's pointer owner and artwork table expose the native click hotspot. */
+ uint32_t cursor = MEM32(0x27048bb4);
+ fputs("\"cursor\":", output);
+ if (cursor) {
+ uint32_t entry = 0x270485e0 + MEM32(cursor + 8) * 20;
+ uint32_t sprite = MEM32(entry + 16);
+ fprintf(output, "{\"shape\":%u,\"visible\":%s,\"hotspot\":[%u,%u],\"drawSize\":",
+ MEM32(cursor + 8), MEM8(cursor + 0x10) ? "true" : "false", MEM32(entry), MEM32(entry + 4));
+ vector(output, sprite + 0x3c, 2);
+ fputc('}', output);
+ } else fputs("null", output);
+ fputc(',', output);
+
uint32_t scene = MEM32(0x3806ec04), camera = scene ? MEM32(scene + 0x80) : 0;
fputs("\"camera\":", output);
if (camera) {
diff --git a/client/runtime/linux_window.c b/client/runtime/linux_window.c
@@ -5,7 +5,9 @@
#include <strings.h>
#include <pthread.h>
#ifdef __EMSCRIPTEN__
+#include <assert.h>
#include <emscripten.h>
+#include <emscripten/html5.h>
void ao_test_input(int stage, int type, int a, int b, int c, int d);
#endif
@@ -48,6 +50,55 @@ static SDL_Keymod queued_modifiers, keyboard_modifiers;
/* Browsers cannot warp the physical pointer; camera recentering is virtual. */
static int cursor_x, cursor_y, cursor_warped;
static int browser_mouse, browser_mouse_x, browser_mouse_y;
+static SDL_Cursor *browser_cursor;
+int browser_cursor_hidden(void);
+
+void browser_cursor_update(uint32_t owner)
+{
+ /* ccr.dll:sub_27016E80 supplies the artwork and unscaled click hotspot. */
+ uint32_t entry = 0x270485e0 + MEM32(owner + 8) * 20;
+ uint32_t sprite = MEM32(entry + 16), image = MEM32(sprite + 0x28);
+ /* bbr.dll:sub_250AF2C0 selects format 8 (ARGB1555) for cursor sprites. */
+ assert(MEM32(image + 0x28) == 8 && MEM32(image + 0x24) == 2);
+ /* The SDL window exists before CCR initializes its screen-size globals. */
+ int window_width, window_height;
+ SDL_GetWindowSize(linux_graphics_window(), &window_width, &window_height);
+ uint32_t state[] = {(uint32_t)(uintptr_t)ADDR(MEM32(image)),
+ MEM32(image + 0xc), MEM32(image + 8), MEM32(image + 0x20),
+ MEM32(sprite + 0x3c), MEM32(sprite + 0x40), MEM32(entry), MEM32(entry + 4),
+ window_width, window_height, MEM8(owner + 0x10) && !browser_cursor_hidden()};
+ static uint32_t previous[11];
+ if (browser_cursor && !memcmp(previous, state, sizeof(state))) return;
+
+ /* SDL owns the custom cursor so mouse-focus changes restore it as well. */
+ if (!browser_cursor || memcmp(previous, state, 10 * sizeof(uint32_t))) {
+ double width, height;
+ if (emscripten_get_element_css_size("#canvas", &width, &height) != EMSCRIPTEN_RESULT_SUCCESS) {
+ fprintf(stderr, "Cannot read browser cursor surface size\n");
+ abort();
+ }
+ double scale_x = width / state[8], scale_y = height / state[9];
+ SDL_Surface *source = SDL_CreateRGBSurfaceWithFormatFrom((void *)ADDR(MEM32(image)),
+ state[1], state[2], 16, state[3], SDL_PIXELFORMAT_ARGB1555);
+ SDL_Surface *scaled = SDL_CreateRGBSurfaceWithFormat(0,
+ lround(MEMF(sprite + 0x3c) * scale_x), lround(MEMF(sprite + 0x40) * scale_y),
+ 32, SDL_PIXELFORMAT_ARGB8888);
+ if (!source || !scaled) { fprintf(stderr, "%s\n", SDL_GetError()); abort(); }
+ if (SDL_SetSurfaceBlendMode(source, SDL_BLENDMODE_NONE) || SDL_BlitScaled(source, NULL, scaled, NULL)) {
+ fprintf(stderr, "%s\n", SDL_GetError());
+ abort();
+ }
+ SDL_Cursor *cursor = SDL_CreateColorCursor(scaled, lround(state[6] * scale_x), lround(state[7] * scale_y));
+ SDL_FreeSurface(scaled);
+ SDL_FreeSurface(source);
+ if (!cursor) { fprintf(stderr, "%s\n", SDL_GetError()); abort(); }
+ SDL_SetCursor(cursor);
+ SDL_FreeCursor(browser_cursor);
+ browser_cursor = cursor;
+ }
+ if (SDL_ShowCursor(state[10] ? SDL_ENABLE : SDL_DISABLE) < 0) abort();
+ memcpy(previous, state, sizeof(state));
+}
#endif
/* The SDL default cursor has a guest handle; native pointers never enter guest state. */
static uint32_t current_cursor = 0xf4500000u;
@@ -797,8 +848,14 @@ static void set_cursor(void)
{
uint32_t cursor = MEM32(g_esp + 4);
if (cursor && cursor != 0xf4500000u) unsupported("cursor handle", cursor);
- if (cursor) SDL_SetCursor(SDL_GetDefaultCursor());
- if (SDL_ShowCursor(cursor ? SDL_ENABLE : SDL_DISABLE) < 0) abort();
+#ifdef __EMSCRIPTEN__
+ if (!browser_cursor) {
+#endif
+ if (cursor) SDL_SetCursor(SDL_GetDefaultCursor());
+ if (SDL_ShowCursor(cursor ? SDL_ENABLE : SDL_DISABLE) < 0) abort();
+#ifdef __EMSCRIPTEN__
+ }
+#endif
g_eax = current_cursor;
current_cursor = cursor;
g_esp += 8;
diff --git a/client/tests/browser_testing.c b/client/tests/browser_testing.c
@@ -390,6 +390,26 @@ static void snapshots_observe_door_animation_without_mutation(void)
assert(g_eax == 123 && g_esp == 456);
}
+static void snapshots_observe_cursor_artwork_without_mutation(void)
+{
+ /* The current shape owns both its hotspot and scaled sprite dimensions. */
+ MEM32(0x27048bb4) = 0x5000f000;
+ MEM32(0x5000f008) = 4;
+ MEM8(0x5000f010) = 1;
+ MEM32(0x27048630) = 12;
+ MEM32(0x27048634) = 25;
+ MEM32(0x27048640) = 0x5000f100;
+ MEMF(0x5000f13c) = 48;
+ MEMF(0x5000f140) = 48;
+
+ browser_test_request();
+ browser_test_frame();
+
+ assert(strstr(snapshot, "\"cursor\":{\"shape\":4,\"visible\":true,\"hotspot\":[12,25],\"drawSize\":[48,48]}"));
+ assert(MEM32(0x5000f008) == 4 && MEM8(0x5000f010) == 1);
+ assert(g_eax == 123 && g_esp == 456);
+}
+
int main(void)
{
snapshot_copies_native_state_without_changing_guest_registers();
@@ -404,6 +424,7 @@ int main(void)
snapshots_record_uploaded_mission_identities_without_mutation();
snapshots_distinguish_raw_and_effective_armor_without_mutation();
snapshots_observe_door_animation_without_mutation();
+ snapshots_observe_cursor_artwork_without_mutation();
free(snapshot);
puts("PASS: frame snapshots, native inventory, directory clearing and guest state preservation");
}
diff --git a/tests/e2e/cursor.test.mjs b/tests/e2e/cursor.test.mjs
@@ -0,0 +1,176 @@
+import assert from 'node:assert/strict';
+import fs from 'node:fs/promises';
+import {before, test} from 'node:test';
+import {buildServer, withFixture} from './fixture.mjs';
+
+before(buildServer);
+
+test('browser cursor preserves native shapes, camera controls and item dragging', {timeout: 180_000}, async () => {
+ await withFixture('cursor', async fixture => {
+ const context = await fixture.browser.newContext({viewport: {width: 1024, height: 768}, deviceScaleFactor: 2});
+ const response = await context.request.post(fixture.url + '/browser-launch');
+ assert.equal(response.status(), 200);
+ await fixture.setup(context, 'position', {playfield: 705, position: [960, 16.5, 510], rotation: [0, 0, 0, 1]});
+ await fixture.setup(context, 'grant-item', {template: 121567});
+ const items = (await fixture.state(context)).items;
+ const target = await fixture.setup(context, 'leet', {position: [960, 16.5, 498]});
+ const game = await fixture.game(context);
+ const page = game.page;
+ const style = () => page.locator('canvas').evaluate(canvas => getComputedStyle(canvas).cursor);
+ const records = [];
+ const inspect = async name => {
+ await game.snapshot();
+ const css = await style();
+ records.push({name, cursor: game.state.cursor, css, camera: game.state.camera});
+ await fs.writeFile(fixture.output + '/cursor.json', JSON.stringify(records, null, 2));
+ if (!game.state.cursor.visible) {
+ assert.equal(css, 'none');
+ return;
+ }
+ assert.match(css, /^url\("data:image\/png;base64,/);
+ await fs.writeFile(fixture.output + '/' + name + '.png', Buffer.from(css.match(/base64,([^\"]+)/)[1], 'base64'));
+ const bounds = await page.locator('canvas').boundingBox();
+ const [hotX, hotY] = game.state.cursor.hotspot;
+ const hotspot = css.match(/\)(?: (\d+) (\d+))?, auto$/);
+ assert(hotspot);
+ assert.deepEqual([Number(hotspot[1] || 0), Number(hotspot[2] || 0)],
+ [Math.round(hotX * bounds.width / game.state.screen[0]), Math.round(hotY * bounds.height / game.state.screen[1])]);
+ };
+
+ await page.mouse.move(500, 300);
+ await inspect('world');
+ const restingCursor = await style();
+ await page.evaluate(() => {
+ window.cursorExits = 0;
+ document.querySelector('canvas').addEventListener('mouseleave', () => ++window.cursorExits);
+ });
+ await page.mouse.move(-20, 300);
+ await game.snapshot();
+ assert.equal(await page.evaluate(() => window.cursorExits), 1);
+ await page.mouse.move(500, 300);
+ await game.snapshot();
+ assert.equal(game.state.cursor.shape, 0);
+ assert.equal(await style(), restingCursor, 'Re-entry must restore the game arrow without a shape change');
+ await inspect('reentered');
+ await game.key('i');
+ const source = game.state.grids.flatMap(grid => grid.cells).find(cell =>
+ cell.identity[0] === 104 && cell.identity[1] === 48);
+ assert(source && !source.dummy);
+ await game.click((source.bounds[0] + source.bounds[2]) / 2, (source.bounds[1] + source.bounds[3]) / 2);
+ await game.wait('native item pickup', state => state.dragged[0] !== 0);
+ await page.mouse.move(450, 300);
+ await inspect('dragged');
+ await game.save(fixture.output + '/dragged');
+
+ // Throttle only the game worker; browser pointer delivery keeps running.
+ const running = await Promise.all(page.workers().map(async candidate => {
+ const active = await Promise.race([
+ candidate.evaluate(() => typeof AOTest !== 'undefined' && AOTest.frame > 0).catch(() => false),
+ new Promise(resolve => setTimeout(() => resolve(false), 2000)),
+ ]);
+ return active ? candidate : null;
+ }));
+ const worker = running.find(candidate => candidate);
+ assert(worker, 'The running game worker must be observable');
+ await worker.evaluate(() => {
+ self.cursorTestRAF = requestAnimationFrame;
+ self.requestAnimationFrame = callback => setTimeout(() => callback(performance.now()), 1000);
+ });
+ try {
+ await game.snapshot();
+ const frame = await worker.evaluate(() => AOTest.frame);
+ const css = await style();
+ await page.evaluate(() => {
+ window.cursorTestMoves = [];
+ window.cursorTestListener = event => window.cursorTestMoves.push([event.clientX, event.clientY]);
+ document.querySelector('canvas').addEventListener('mousemove', window.cursorTestListener);
+ });
+ await page.mouse.move(600, 300, {steps: 8});
+ assert.equal(await worker.evaluate(() => AOTest.frame), frame, 'Pointer input must arrive between game frames');
+ assert.equal(await page.evaluate(() => window.cursorTestMoves.length), 8);
+ assert.equal(await style(), css, 'The browser retains its native cursor between game frames');
+ await page.evaluate(() => document.querySelector('canvas').removeEventListener('mousemove', window.cursorTestListener));
+ } finally {
+ await worker.evaluate(() => { self.requestAnimationFrame = self.cursorTestRAF; });
+ }
+
+ const destination = game.state.grids[0].cells.find(cell => cell.index === 1);
+ assert(destination);
+ await game.click((destination.bounds[0] + destination.bounds[2]) / 2, (destination.bounds[1] + destination.bounds[3]) / 2);
+ await game.wait('native item drop', state => state.dragged[0] === 0 && state.grids[0].cells.some(cell =>
+ cell.index === 1 && cell.identity[0] === 104 && cell.identity[1] === 48 && !cell.dummy));
+ assert.deepEqual((await fixture.state(context)).items, items);
+ await game.key('i');
+
+ // The visible target cursor and click must agree on the same native pixel.
+ if (!game.state.camera.firstPerson) await game.key('F8');
+ await game.hold('KeyD', 'facing the target', state => Math.abs(game.local(state).rotation[3]) < 0.05);
+ const [x, y] = await game.pick(50000, target.id);
+ await game.wait('context-sensitive target cursor', state => state.cursor.shape !== 0);
+ await inspect('target');
+ await game.click(x, y);
+ await game.wait('aligned target selection', state => state.selected[0] === 50000 && state.selected[1] === target.id);
+
+ await page.mouse.move(500, 300);
+ await game.snapshot();
+ const projected = state => state.actors.find(actor => actor.type === 50000 && actor.id === target.id).screenPosition;
+ const before = projected(game.state);
+ let sequence = game.sequence;
+ await page.mouse.down({button: 'right'});
+ try {
+ await game.waitInput(sequence, 1025);
+ await game.wait('camera control active', state => !state.cursor.visible);
+ await page.mouse.move(560, 450, {steps: 12});
+ await game.wait('camera rotation', state =>
+ projected(state)?.some((value, index) => index < 2 && Math.abs(value - before[index]) > 5));
+ assert.equal(game.state.cursor.visible, false);
+ await inspect('camera-held');
+ } finally {
+ sequence = game.sequence;
+ await page.mouse.up({button: 'right'});
+ await game.waitInput(sequence, 1026);
+ }
+ await game.wait('pointer restored after camera control', state => state.cursor.visible);
+ await inspect('camera-released');
+ await page.setViewportSize({width: 800, height: 600});
+ await game.wait('resized render surface', state => state.screen[0] === 800 && state.screen[1] === 600);
+ await inspect('resized');
+ await page.keyboard.press('Control+Alt+m');
+ await page.locator('#pixel-mode').selectOption('retina');
+ await page.locator('#player-menu').getByRole('button', {name: 'Close', exact: true}).click();
+ await game.wait('retina render surface', state => state.screen[0] === 1600 && state.screen[1] === 1200);
+ await inspect('retina');
+ assert.deepEqual(game.errors, []);
+ });
+});
+
+test('mobile cursor stays suppressed while touch transfers an inventory item', {timeout: 120_000}, async () => {
+ await withFixture('cursor-touch', async fixture => {
+ const context = await fixture.browser.newContext({viewport: {width: 1024, height: 768},
+ userAgent: 'Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 Chrome/130.0.0.0 Mobile Safari/537.36',
+ hasTouch: true, isMobile: true});
+ const response = await context.request.post(fixture.url + '/browser-launch');
+ assert.equal(response.status(), 200);
+ await fixture.setup(context, 'grant-item', {template: 121567});
+ const items = (await fixture.state(context)).items;
+ const game = await fixture.game(context);
+ await game.key('i');
+ const tap = async index => {
+ const cell = game.state.grids.flatMap(grid => grid.cells).find(cell =>
+ cell.index === index);
+ assert(cell);
+ const point = await game.point((cell.bounds[0] + cell.bounds[2]) / 2, (cell.bounds[1] + cell.bounds[3]) / 2);
+ await game.page.touchscreen.tap(point.x, point.y);
+ };
+
+ await tap(0);
+ await game.wait('touch pickup', state => state.dragged[0] !== 0);
+ await tap(1);
+ await game.wait('touch drop', state => state.dragged[0] === 0 && state.grids[0].cells.some(cell =>
+ cell.index === 1 && cell.identity[0] === 104 && cell.identity[1] === 48 && !cell.dummy));
+
+ assert.equal(await game.page.locator('canvas').evaluate(canvas => getComputedStyle(canvas).cursor), 'none');
+ assert.deepEqual((await fixture.state(context)).items, items);
+ assert.deepEqual(game.errors, []);
+ });
+});