mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-28 03:16:23 +02:00
android - add hack to fix orientation issue
This commit is contained in:
parent
cc8d44139a
commit
64b21a4578
3 changed files with 14 additions and 2 deletions
|
@ -185,6 +185,8 @@ void setProgressInfo(char* info, float progressValue) {
|
|||
progress = progressValue;
|
||||
}
|
||||
|
||||
bool isInitialOrientationFlipped = true;
|
||||
|
||||
extern "C"
|
||||
void setCurrentTransform(long native_window, int transform){
|
||||
if(native_window == 0 || native_window == -1)
|
||||
|
@ -204,7 +206,7 @@ void setCurrentTransform(long native_window, int transform){
|
|||
nativeTransform = ANativeWindowTransform::ANATIVEWINDOW_TRANSFORM_ROTATE_90;
|
||||
break;
|
||||
case 0x4:
|
||||
nativeTransform = ANativeWindowTransform::ANATIVEWINDOW_TRANSFORM_ROTATE_180;
|
||||
nativeTransform = isInitialOrientationFlipped ? ANativeWindowTransform::ANATIVEWINDOW_TRANSFORM_IDENTITY : ANativeWindowTransform::ANATIVEWINDOW_TRANSFORM_ROTATE_180;
|
||||
break;
|
||||
case 0x8:
|
||||
nativeTransform = ANativeWindowTransform::ANATIVEWINDOW_TRANSFORM_ROTATE_270;
|
||||
|
@ -337,3 +339,10 @@ JNIEXPORT jstring JNICALL
|
|||
Java_org_ryujinx_android_NativeHelpers_getStringJava(JNIEnv *env, jobject thiz, jlong id) {
|
||||
return createStringFromStdString(env, str_helper.get_stored(id));
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_ryujinx_android_NativeHelpers_setIsInitialOrientationFlipped(JNIEnv *env, jobject thiz,
|
||||
jboolean is_flipped) {
|
||||
isInitialOrientationFlipped = is_flipped;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,8 @@ class GameHost(context: Context?, private val mainViewModel: MainViewModel) : Su
|
|||
surfaceHolder.surfaceFrame.height()
|
||||
)
|
||||
|
||||
NativeHelpers.instance.setIsInitialOrientationFlipped(mainViewModel.activity.display?.rotation == 3)
|
||||
|
||||
_guestThread = thread(start = true) {
|
||||
runGame()
|
||||
}
|
||||
|
|
|
@ -31,4 +31,5 @@ class NativeHelpers {
|
|||
external fun getProgressValue() : Float
|
||||
external fun storeStringJava(string: String) : Long
|
||||
external fun getStringJava(id: Long) : String
|
||||
external fun setIsInitialOrientationFlipped(isFlipped: Boolean)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue