mirror of
https://github.com/jhaizhou-ops/d2r-mobile
synced 2026-11-26 13:57:52 +08:00
- Android (#113, @yyan160; graphics engine and shader-bundle packer from @biglawine's HarmonyOS port): an Android app (dm/android) with a JNI host, a touch overlay on the shared touch state machine, Vulkan presentation and AAudio sound; an NVN-to-Vulkan replay engine (dm/gfx/vulkan) behind the same backend interface as Metal; the shared host now builds for Apple and Android, and the module rewriter has an Android target (DM_TARGET=android; Apple output unchanged). Measured by the authors at a median 60 fps on a Redmi K50 Ultra. - Android install with your own game files: the release APK (dm/android/tools/shell_apk.sh) contains no game content; dm/tools/d2rm_android.py makes an import pack (rewritten program, Vulkan shader bundles, touch overlay, data tables) that the App imports from Download/S2X/D2R Mobile/android with a progress screen. The shader export step (dm/gfx/tools/dmsh_vk.py) makes the 6,927 game shader bundles byte-for-byte identical to the tested set. - Android rewriter fix (#113, @yyan160): rewrite blocks no longer stash registers below sp (Android has no red zone); equiv.py checks Android outputs, structck.py recognizes the Android block shapes. Apple output unchanged. - Android touch controls drawn as on iOS (sockets, silver skill silhouettes, joystick), no map key in game state, no virtual pad buttons over panels; dm/android/tools/art_compare.sh compares the two drawings pixel by pixel. - HarmonyOS (#114, @biglawine): a HarmonyOS NEXT app (dm/harmony, ArkTS shell + N-API library) on the same shared host and Vulkan engine as Android; shared changes are behind __OHOS__ or opt-in switches (adaptive present tier, fence waits woken on completion, OHAudio, HiTrace markers, a byte-identical BC fast path). - HarmonyOS install with your own game files (@biglawine, 0.19.4 / code122): the release HAP is unsigned and contains no game content; players re-sign it with their own debug certificate and import a pack made with dm/tools/d2rm_android.py --target ohos. The registering stand-ins read the tables only when dm_derived_reload() is called (on __OHOS__); first import creates the target folders; outside a game a map toggle request is dropped before the AutoMap exists. Run by the author on a Mate 90 Pro Max: re-sign, install, import, in game, save and exit. - Vulkan: NaN-ignoring min / max / clamp as on Maxwell (#113, @yyan160), fixing one-frame black tiles on the OnePlus 13. - Xbox controllers (from #110, @rrroy5640): recognized automatically and given the PC / Xbox layout (bottom confirms, right goes back) with the game's Xbox button icons; other controllers are unchanged. The Mac-only keyboard prompt switch became a three-way prompt style (Switch / keyboard / Xbox) on every platform. - Separate base and update packages (#106, @PowerBeef): setup.sh and extract_game.sh take both packages and read the title keys from their tickets. - Mac App (#108, #109, @PowerBeef): the project's icon by default; the pointer hides after resting 3 s. - run.sh install no longer goes through the test-device battery gate (#107, @PowerBeef). - Chinese wording (#101, @zzz6519003): 「旧接口版」 and 「默认构建」 throughout. - Dynamic 3D resolution (from #113): a run of dropped frames counts only its first 3 frames unless it lasts 1 s, so one-off stalls no longer lower the resolution. - In-game Korean (#118, @soulsakura): a 한국어 column for all our UI text, a fifth option in the language row (each checkbox now sits before its name), Korean touch wording and map name plates, Korean voice when the game files carry it; a Korean system language picks Korean on first install. - iPhone Duo: in full screen the output size follows the window when the phone is unfolded or folded, up to the size the game started with; needs Xcode 27.1 for the inner screen to be filled. Test switches DM_TEST_FOLD and DM_TEST_SCREEN simulate the two screens with the iOS package on a Mac. - README: Android and HarmonyOS sections, device table and credits in all three languages; dependency list for Android. Every change was ported into the internal tree with its authors credited. For the shared files, the code changes match the pull requests' after stripping comments. Host / graphics / iOS unit tests, the full acceptance gate and the Mac smoke test passed; the rewriter's rule sets were rebuilt and passed the equivalence regression; an iOS build of this code was played on an iPhone; the Android APK with an import pack made from our own game files was played on a vivo X200 Ultra. Exported from main 8055e5212. Co-authored-by: Yuechuan Yang <22333122+yyan160@users.noreply.github.com> Co-authored-by: biglawine <26263820+biglawine@users.noreply.github.com> Co-authored-by: rrroy <hly5640@gmail.com> Co-authored-by: Patrice Déry <109446870+PowerBeef@users.noreply.github.com> Co-authored-by: Sam Snowman(赵正中) <zhengzhongzhao@gmail.com> Co-authored-by: soulsakura <74704744+soulsakura@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
3.8 KiB
C
26 lines
3.8 KiB
C
// 实体手柄四个面键 → 游戏键:系统(GameController)给的 buttonA/B/X/Y 直接对应游戏的 A/B/X/Y,不认手柄类型、不做位置翻译。纯函数,前端 dm_gamepad.m 用,宿主单测 tests/t_padmap.c 核。
|
|
// 系统对印字母的手柄按键帽字母给:任天堂手柄(Switch Pro、Joy-Con 一对)印 A 的右键走 buttonA、印 B 的下键走 buttonB——与 Switch 原样一致,右 A 确认;
|
|
// Xbox 手柄字母与位置本来一致(下 A、右 B、左 X、上 Y)。键帽没字母的(PS 等)按系统的菱形位置给:下方键 = buttonA = 确认。
|
|
// 依据:公开日志(iPadOS 27 + Switch Pro:已认出任天堂、按位置再翻译一次后 A/B、X/Y 全反);SDL 的苹果手柄实现把任天堂手柄的 buttonA 当右键。
|
|
// (先前按 GCExtendedGamepad.h 的菱形约定当 buttonA = 下方键,任天堂手柄再换成右 A 下 B,等于换了两次。头文件的菱形对任天堂手柄不成立。)
|
|
// Physical controller face buttons → game buttons: the system (GameController) buttonA/B/X/Y map directly to the game's A/B/X/Y, regardless of controller type, with no positional translation. Pure function, used by the front end dm_gamepad.m, checked by the host unit test tests/t_padmap.c.
|
|
// For controllers with printed letters the system reports by keycap letter: on Nintendo controllers (Switch Pro, a Joy-Con pair) the right button printed A is buttonA and the bottom button printed B is buttonB — identical to the Switch, right A confirms;
|
|
// on Xbox controllers letters and positions already agree (bottom A, right B, left X, top Y). For controllers without letters (PS etc.) the system reports by diamond position: bottom button = buttonA = confirm.
|
|
// Evidence: a public log (iPadOS 27 + Switch Pro: recognized as Nintendo, translated by position once more, and A/B, X/Y were all swapped); SDL's Apple controller code treats a Nintendo controller's buttonA as the right button.
|
|
// (Previously buttonA was taken as the bottom button per the diamond convention in GCExtendedGamepad.h and Nintendo controllers were swapped again to right A / bottom B, i.e. swapped twice. The header's diamond does not hold for Nintendo controllers.)
|
|
#pragma once
|
|
#include <stdint.h>
|
|
#include "dm_input.h"
|
|
static inline uint64_t dm_padmap_face(int a, int b, int x, int y) { // 四个参数 = 系统 buttonA / B / X / Y 按着没有 | The four parameters = whether the system's buttonA / B / X / Y are pressed
|
|
return (a ? DM_BTN_A : 0) | (b ? DM_BTN_B : 0) | (x ? DM_BTN_X : 0) | (y ? DM_BTN_Y : 0);
|
|
}
|
|
// Xbox 键位(dm_gamepad.m 认出 Xbox 手柄时自动用):按物理位置排,与 PC / Xbox 版同位置同功能——下 = A 确认、右 = B 返回、上 = X(放进堆叠仓库)、左 = Y。
|
|
// 任天堂手柄(及切到 Switch 模式、被系统认成 Switch Pro 的第三方手柄)系统按 Switch 字母给:右 = buttonA、下 = buttonB、上 = buttonX、左 = buttonY → 只换 A/B。
|
|
// 其余手柄系统按菱形位置给:下 = buttonA、右 = buttonB、左 = buttonX、上 = buttonY → 只换 X/Y。
|
|
// Xbox layout (used automatically when dm_gamepad.m recognizes an Xbox controller): by physical position, same position = same function as the PC / Xbox version -- bottom = A confirm, right = B back, top = X (into the stack stash), left = Y.
|
|
// Nintendo controllers (and third-party ones in Switch mode, recognized as Switch Pro) are reported by Switch letters: right = buttonA, bottom = buttonB, top = buttonX, left = buttonY -> only A/B swap.
|
|
// Every other controller is reported by diamond position: bottom = buttonA, right = buttonB, left = buttonX, top = buttonY -> only X/Y swap.
|
|
static inline uint64_t dm_padmap_face_xbox(int a, int b, int x, int y, int nintendo) {
|
|
return nintendo ? dm_padmap_face(b, a, x, y) : dm_padmap_face(a, b, y, x);
|
|
}
|