Skip to content

Make the Xenoblade Chronicles: Definitive Edition profile work on Android (3/3): fps_limit 30, core_preempt lock - #642

Open
tapionallanaire wants to merge 2 commits into
igawa6:mainfrom
tapionallanaire:pr/xcde-android
Open

tapionallanaire wants to merge 2 commits into
igawa6:mainfrom
tapionallanaire:pr/xcde-android

Conversation

@tapionallanaire

@tapionallanaire tapionallanaire commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Android support: together with #640 and #641, this PR makes the Xenoblade Chronicles: Definitive Edition (0100FF500E34A000, 1.1.2) profile work on Android: prologue → Shulk in Colony 9, no glitches, 30 fps, 0 of 60 boots crashed (AYN Thor).

What

The Xenoblade Chronicles: Definitive Edition 1.1.2 profile on Android:

  • fps_limit 30;
  • core_preempt lock;
  • a README section for the Android run.

Depends on #641 (core_preempt lock): this branch includes that commit, so please merge #641 first. The README also describes the Colony 9 road fix in #640.

Why

Tested

AYN Thor (Adreno 740, Turnip v27.0.0-R1). The route was New Game → Sword Valley prologue (the Mechon M82 boss) → Colony 9: Shulk's first fights, the arrival event, the Commercial District from day to night, and save / load.

Open: save thumbnails are black (the README says why).

Proof (AYN Thor)

Colony 9, day Evening Night

Present times of 5 min of Colony 9: xcde-surfaceflinger-presents.tsv (9,026 of 9,026 frames at four refreshes).

On Horizon two threads of one core never run at the same moment: a running
thread gives its core up only where it blocks, sleeps or yields, or when a
higher-priority thread of the core preempts it. The host runs every guest
thread on its own pthread, so threads of one core run side by side.

Xenoblade Chronicles: Definitive Edition corrupts its heap at boot when
they do: about one boot in four crashed 1-4 s into nnMain at changing sites
(a memset of a size read from a resource block's footer, null and wild
pointers in the heap's free-list walk), with or without a save. Not changed
by core_preempt on, a barrier after file reads, DM_SPIN=0, DM_AUDIO=0 or
DM_VK_WORKER=0; the whole process on one CPU with taskset made it worse
(6 of 12), so it is the interleaving, not parallelism.

core_preempt lock (profile) / DM_CORE_LOCK (switch): a guest thread whose
affinity is one core holds that core's lock, a first-come ticket lock,
while it runs guest code, and gives it up at each SVC and native HLE wait.
A waiter of higher priority preempts the holder in guest code (SIGURG; in
host code it is not stopped and the waiter signals again). Threads that may
run on several cores, and host-owned guest threads, run free.

It applies for the first DM_CORE_LOCK_SECS seconds (default 20; 0 = for
good): held for good it cost Xenoblade 2-3 hitches of 70-100 ms in five
minutes of play (a thread running 100 ms in guest code while the main
thread waited for core 0). DM_CORE_SLICE_US adds a time slice for waiters
of equal priority (default off; 4000 gave more hitches, not fewer).

0 of 60 boots crashed with it, on an AYN Thor (Snapdragon 8 Gen 2).
…re_preempt lock

The game times its own 30 fps (33.23 ms a frame) and presents at
interval 1, which beat against a 117.84 Hz panel: about one frame in
seven stayed five refreshes. fps_limit 30 ticks in whole panel
refreshes: 10,809 of 10,809 frames at exactly four refreshes over six
minutes of Colony 9 (AYN Thor, SurfaceFlinger present times).

About one boot in four crashed on a corrupt heap; core_preempt lock
(previous commit) keeps two threads of one core from running at the
same moment for the first 20 s: 0 of 60 boots crashed.

README: the Android run (prologue to Colony 9), the Colony 9 road fix
in the Vulkan replay, the pacing and the boot crash; save thumbnails
black (open).
@tapionallanaire tapionallanaire changed the title Xenoblade Chronicles: Definitive Edition on Android: fps_limit 30, core_preempt lock Make the Xenoblade Chronicles: Definitive Edition profile work on Android (3/3): fps_limit 30, core_preempt lock Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant