Update framebuffer layout when closing the settings

Fixes an issue where the default layout gets applied when closing the settings, which is noticable if you swap screens before changing the layout.
This commit is contained in:
SutandoTsukai181 2020-06-10 13:53:18 +03:00 committed by xperia64
parent d7c5727b01
commit 2b655b2e7e
2 changed files with 9 additions and 1 deletions

View File

@ -15,9 +15,11 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.citra.citra_emu.NativeLibrary;
import org.citra.citra_emu.R;
import org.citra.citra_emu.utils.DirectoryInitialization;
import org.citra.citra_emu.utils.DirectoryStateReceiver;
import org.citra.citra_emu.utils.EmulationMenuSettings;
public final class SettingsActivity extends AppCompatActivity implements SettingsActivityView {
private static final String ARG_MENU_TAG = "menu_tag";
@ -88,6 +90,10 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
super.onStop();
mPresenter.onStop(isFinishing());
// Update framebuffer layout when closing the settings
NativeLibrary.NotifyOrientationChange(EmulationMenuSettings.getLandscapeScreenLayout(),
getWindowManager().getDefaultDisplay().getRotation());
}
@Override

View File

@ -237,7 +237,9 @@ void Java_org_citra_citra_1emu_NativeLibrary_NotifyOrientationChange(JNIEnv* env
jint layout_option,
jint rotation) {
Settings::values.layout_option = static_cast<Settings::LayoutOption>(layout_option);
VideoCore::g_renderer->UpdateCurrentFramebufferLayout(!(rotation % 2));
if (VideoCore::g_renderer) {
VideoCore::g_renderer->UpdateCurrentFramebufferLayout(!(rotation % 2));
}
InputManager::screen_rotation = rotation;
Camera::NDK::g_rotation = rotation;
}