mirror of
https://github.com/izzy2lost/perfect_dark.git
synced 2026-10-26 20:45:25 -07:00
On-screen controls * port/src/touch.c holds a virtual pad written by the Android UI thread and read by inputReadController() on the SDL thread, so state is kept in atomics and sticks in fixed point. * inputReadController() folds it into player 1 before the gamepad section, so a physical pad still fills in whatever the overlay is not deflecting. * TouchControls is a transparent full-screen view above SDLSurface. It only consumes a pointer that lands on a control and returns everything else to the view below, so SDL still sees taps as mouse input in menus. * Buttons are hit-tested ahead of the look area, so a press near a button never spins the camera. * Layout is normalised to the viewport and editable in place: tap the toggle to hide/show, hold it to drag and pinch controls around. Saved per device. * The overlay hides itself, and stops consuming touches, while a physical controller is attached. Mods * Mods live in <externalFilesDir>/mods/<name>/ and the selected one is passed as --moddir, which the port overlays on the ROM's files. * The launcher imports a mod from a .zip, guarding against Zip Slip and absurd unpacked sizes, and hoists a single wrapper folder if there is one. Netplay * INTERNET/ACCESS_NETWORK_STATE for enet. * Keep the in-game console on Android: it is how netplay reports and chats, and SDL raises the soft keyboard when the game asks for text. * Predictive back is disabled for the game activity, since SDL routes Back through the legacy onBackPressed() path. Also removes GameView.java, which drove a GLSurfaceView path the port never used, along with the no-op JNI stubs it called into. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
24 lines
1022 B
C
24 lines
1022 B
C
#ifndef ANDROID_SYSTEM_H
|
|
#define ANDROID_SYSTEM_H
|
|
|
|
#ifdef ANDROID
|
|
|
|
#include <jni.h>
|
|
#include <android/log.h>
|
|
|
|
// Path handed to us by MainActivity.nativeInit(); this is where the ROM and saves live.
|
|
const char* sysGetDataPath(void);
|
|
|
|
// port/src/main.c -- startup handshake with MainActivity
|
|
JNIEXPORT void JNICALL Java_com_perfectdark_port_MainActivity_nativeInit(JNIEnv* env, jobject thiz, jstring dataPath);
|
|
JNIEXPORT void JNICALL Java_com_perfectdark_port_MainActivity_nativeDestroy(JNIEnv* env, jobject thiz);
|
|
|
|
// port/src/touch.c -- on-screen controller; see touch.h for the state it feeds
|
|
JNIEXPORT void JNICALL Java_com_perfectdark_port_TouchControls_nativeSetButtons(JNIEnv* env, jclass cls, jint contMask);
|
|
JNIEXPORT void JNICALL Java_com_perfectdark_port_TouchControls_nativeSetStick(JNIEnv* env, jclass cls, jint stick, jfloat x, jfloat y);
|
|
JNIEXPORT void JNICALL Java_com_perfectdark_port_TouchControls_nativeSetActive(JNIEnv* env, jclass cls, jboolean active);
|
|
|
|
#endif // ANDROID
|
|
|
|
#endif // ANDROID_SYSTEM_H
|