Windows Emulation Module
Overview
This doc covers the patch layer for the app's Windows/Wine emulation feature: patches/smali_classes4__com__xj__winemu__WineActivity.smali.diff, WinEmu environment and imported-game dialogs under patches/smali_classes5__com__xj__winemu__*.diff, and the WinEmu-specific dialog layouts under patches/res__layout__winemu_*.diff, patches/res__layout__wiemu_*.diff, and patches/res__layout__env_params_input_dialog_layout.xml.diff.
The main runtime entrypoint is patches/smali_classes4__com__xj__winemu__WineActivity.smali.diff. The patched WineActivity.onCreate front-loads device/performance setup before the normal Wine UI initialization: it raises the current thread priority via Process.setThreadPriority(-8), enables sustained performance mode on Android N+ windows, forces window brightness to 1.0f, suppresses the pending transition, probes thermal headroom on Android R+, and creates a PerformanceHintManager.Session on Android S+ for the current thread. After that, the existing activity flow continues through binding inflation, WineActivityData inspection, WineInGameSettings creation keyed by game/environment data, game logo population through IWinEmuService.p(String) when available, drawer setup, WinUIBridge listener registration, WinUIBridge.P(Activity), attaching the bridge to layoutXContainer, grabbing the GamepadManager, and applying saved FPS/setting state back into WinUIBridge.h0(int). The same patch also removes a guard around q2(), so that method is invoked even when WinUIBridge.V() is false; this makes the Wine activity perform that setup/cleanup path unconditionally instead of only behind the bridge capability check.
Environment selection/editing is represented by patches/smali_classes5__com__xj__winemu__ui__env_setting__WinEmuEnvListFragment.smali.diff. Its relevant patch is small but routeable: fragment arguments still read the environment tab object from the bundle key already held in v0, but the typed helper call through com/google/android/play/core/integrity/a0.a(Bundle, String, Class) is replaced with the platform Bundle.getParcelable(String). The value is still consumed as the environment tab parcelable, so changes to how EnvTabEntity is placed into arguments must stay compatible with ordinary Parcelable retrieval.
Imported-game editing is represented by patches/smali_classes5__com__xj__winemu__ui__dialog__EditImportedGameInfoDialog.smali.diff. The dialog reads ImportedGameEntity from dialog arguments under key_info; the patch removes the Android 13+ typed-parcelable branch and always uses Bundle.getParcelable("key_info"), followed by an instance-of ImportedGameEntity guard. If the entity is absent or of the wrong type, the dialog dismisses with dismissAllowingStateLoss(). When the entity is valid, it installs a dialog key listener, initializes binding via Y0(), stores the entity in field k, reads key_is_new_import, and splits behavior by new-vs-existing import: new imports call ImportGameViewModel.m(filePath) using the entity file path, while existing imports populate/edit UI through d1(ImportedGameEntity) and f1(binding, ImportedGameEntity). The dialog then wires the view model and floating menu controls used by the import editor.
WinEmu dialog resources are patched mostly for visual and close-control behavior. patches/res__layout__winemu_reinstall_dep_dialog.xml.diff defines the dependency reinstall dialog, keeping the title/description/action structure but changing the root dark background from #ff191a1c to #ff111827 and replacing the close image source with @android:color/transparent. patches/res__layout__winemu_promotional_dialog.xml.diff keeps the promotional dialog's Chinese/English background images, title area, button area, and recycler view, but makes @id/closeImage transparent. patches/res__layout__winemu_dialog_game_circle_qr.xml.diff keeps the full-screen dimmed QR dialog, centered QR image, and save button, but makes @id/ivClose transparent. patches/res__layout__winemu_dialog_confirm_dialog.xml.diff changes the generic WinEmu confirm dialog background to #ff111827 while leaving the visible close icon @drawable/common_verify_dialog_close and title/body/actions intact. patches/res__layout__wiemu_dialog_game_pad_manager.xml.diff is the gamepad manager dialog used from the Wine activity's GamepadManager path; it keeps the gamepad and banned-gamepad recycler views plus ban controls, but makes its close image background transparent. patches/res__layout__env_params_input_dialog_layout.xml.diff is the environment-variable input dialog: it remains a full-screen dim overlay containing a centered edit dialog and @id/et_content, with only the backing shape color changed to #ff111827.
Route changes about Wine launch, in-game settings, WinUIBridge attachment, FPS limit application, or gamepad manager hookup should route to patches/smali_classes4__com__xj__winemu__WineActivity.smali.diff. Route changes about environment tab argument parsing to patches/smali_classes5__com__xj__winemu__ui__env_setting__WinEmuEnvListFragment.smali.diff. Route changes about imported game metadata editing/import initialization to patches/smali_classes5__com__xj__winemu__ui__dialog__EditImportedGameInfoDialog.smali.diff. Route visual changes to reinstall dependency, promotional, game-circle QR, confirm, gamepad manager, or environment-parameter dialogs to their corresponding patches/res__layout__*.diff files listed above.
Coupling
- If
WineActivityDataorWineInGameSettingschanges the meaning of the game/environment identifiers, verifypatches/smali_classes4__com__xj__winemu__WineActivity.smali.diff:WineActivity.onCreateconstructsWineInGameSettingsfromWineActivityData.e(), reads logo data throughWineActivityData.d()/IWinEmuService.p(String), and applies saved FPS state throughWinUIBridge.h0(int)without schema validation in this patch. - If
WinUIBridge.V()is intended to gateWineActivity.q2(), verifypatches/smali_classes4__com__xj__winemu__WineActivity.smali.diff: the patch deliberately removes that branch and makesq2()run regardless of the bridge capability result. - If dialog argument writers move to Android 13 typed parcelable APIs only, verify
patches/smali_classes5__com__xj__winemu__ui__env_setting__WinEmuEnvListFragment.smali.diffandpatches/smali_classes5__com__xj__winemu__ui__dialog__EditImportedGameInfoDialog.smali.diff: both readers were changed back toBundle.getParcelable(String), and the imported-game dialog depends on a runtimeinstance-of ImportedGameEntitycheck underkey_info. - If any close button behavior depends on visible drawable bounds or hit feedback, verify the matching layouts:
patches/res__layout__winemu_reinstall_dep_dialog.xml.diff,patches/res__layout__winemu_promotional_dialog.xml.diff,patches/res__layout__winemu_dialog_game_circle_qr.xml.diff, andpatches/res__layout__wiemu_dialog_game_pad_manager.xml.diffkeep the close views in place but make their image/background transparent.
Risks
patches/smali_classes4__com__xj__winemu__WineActivity.smali.diffcalls newer Android performance APIs fromonCreatebefore the rest of Wine initialization. If an API-level guard or null check is edited incorrectly, activity startup can fail beforeWinUIBridge.P(Activity)attaches the emulator view tolayoutXContainer; the current patch protects sustained performance, thermal headroom, andPerformanceHintManagerby SDK checks and a null session check.patches/smali_classes5__com__xj__winemu__ui__dialog__EditImportedGameInfoDialog.smali.diffdismisses immediately whenkey_infois missing or not anImportedGameEntity. If the caller changes the bundle key or passes a different wrapper type, both new imports and existing imported-game edits will close without showing the editor.