Repository navigation
feat(android): add Oniimai controller, lighting and external-display support - #331
Draft
kyarameru0 wants to merge 4 commits into
Draft
kyarameru0 wants to merge 4 commits into
kyarameru0 wants to merge 4 commits into
Conversation
Add Oniimai 0.2.18 to the published MajdataPlay Nightly 20260925 base. Integrate USB touch and IO4 input, button/ring/speaker lighting, rotated external output, configurable 60/120fps rendering, and the phone dashboard. Include in-game setup, saved settings, result retention, Android build tools, and regression checks. Android version: 2.0.3-oniimai.22 (version code 22). Validation: Android ARM64 IL2CPP APK build, 9,060 Java/HID checks, 186 frame-merge checks, 225 statistics-retention checks, upstream renderer validation, APK signature and ZIP integrity. Physical-device testing of this updated snapshot remains pending.
Document the build setup, core implementation paths, input and LED flows, external-display lifecycle, dashboard statistics, and 60/120fps rationale. Include architecture and sequence diagrams, code examples, validation evidence, and a checklist for transferring the change to an upstream PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds native Oniimai controller support to the Android game. USB touch and IO4 button input feed the existing game input path, game lighting drives the controller's RGB outputs, and an external display can show the game while the phone displays statistics and controller status.
The implementation runs inside MajdataPlay and does not require root, LSPosed, or NPatch. Settings are available in-game.
Included behavior
Implementation
flowchart LR USB[Oniimai controller] <--> Bridge[Android USB bridge] Bridge <--> Game[Unity input and lighting] Game --> Display[External game surface] Game --> Stats[Native phone dashboard]Java owns USB communication, Android lifecycle, settings and display surfaces. Unity reads atomic input snapshots through JNI and merges them with the existing input path, including the existing C1/C2 center-zone handling. Diagnostics read a separate snapshot so they do not consume gameplay press edges.
Lighting work stays off the UI thread. External surface teardown detaches Unity before releasing the surface. Dashboard updates are throttled, and final statistics are captured before gameplay objects are destroyed.
The main review entry points are
OniimaiController.cs,OniimaiFrame.cs,InputSnapshot.java,LedOutput.java,OniimaiDisplay.java, andOniimaiStatsRetention.cs. The developer guide includes source paths, sequence diagrams and build instructions.Why the frame-rate option is included
Without a fixed rendering target, frame drops and uneven motion were observed on the external display in the tested setup, even when the phone display appeared smooth. This integration defaults to 60fps and offers 120fps for a compatible setup.
The render target and actual display refresh rate are reported separately. A requested 120Hz display mode can fall back to 60Hz when it cannot be applied. Working 120Hz output has not been verified. The setting is a workaround for the observed hardware setup, not a guarantee of uniform frame timing on every device. Unity's Android optimized frame pacing remains disabled in the Oniimai build configuration.
Validation
Validation applies to Oniimai 0.2.18, based on upstream Nightly commit
5e9c2aa9d0aec133c5dcfca9e0dbcc228d39416b.RawSpriteDrawModeValidationpassed; no rendered-image comparisonThe 0.2.18 APK and checksum are available for reproduction. The APK uses a separate application ID,
net.majdata.majdataplay.oniimai, and retains the test build's debug signing certificate.Limits and areas for maintainer review
The current implementation is primarily tailored to Oniimai controller setups and is not yet sufficiently isolated for general Android users. Oniimai-specific features and defaults may also take effect for users who do not use an Oniimai controller. Additional changes are needed before upstream integration to make activation explicit, gate controller-specific behavior appropriately, and preserve the existing experience for users without the controller.
License and authorship
The upstream GPL-3.0 license and existing dependency and asset notices are retained. The native UI uses artwork and fonts from the MajdataPlay source tree, documented in the asset provenance note.
The Oniimai additions were generated and iterated with OpenAI Codex (AI-generated code) under human direction, with automated checks and maintainer device testing. This disclosure does not describe the authorship of upstream MajdataPlay or third-party dependencies.