mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Android: Just like on Windows, prompt to restart when changing graphics backend.
This commit is contained in:
parent
3e76863b8a
commit
01635a5cd6
6 changed files with 35 additions and 13 deletions
|
@ -1071,7 +1071,6 @@ void GlobalSettingsScreen::CreateViews() {
|
|||
}*/
|
||||
|
||||
void GameSettingsScreen::CallbackRenderingBackend(bool yes) {
|
||||
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
|
||||
// If the user ends up deciding not to restart, set the config back to the current backend
|
||||
// so it doesn't get switched by accident.
|
||||
if (yes) {
|
||||
|
@ -1079,11 +1078,9 @@ void GameSettingsScreen::CallbackRenderingBackend(bool yes) {
|
|||
} else {
|
||||
g_Config.iGPUBackend = (int)GetGPUBackend();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnRenderingBackend(UI::EventParams &e) {
|
||||
#if defined(_WIN32)
|
||||
I18NCategory *di = GetI18NCategory("Dialog");
|
||||
|
||||
// It only makes sense to show the restart prompt if the backend was actually changed.
|
||||
|
@ -1091,12 +1088,11 @@ UI::EventReturn GameSettingsScreen::OnRenderingBackend(UI::EventParams &e) {
|
|||
screenManager()->push(new PromptScreen(di->T("ChangingGPUBackends", "Changing GPU backends requires PPSSPP to restart. Restart now?"), di->T("Yes"), di->T("No"),
|
||||
std::bind(&GameSettingsScreen::CallbackRenderingBackend, this, std::placeholders::_1)));
|
||||
}
|
||||
#endif
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) {
|
||||
#if defined(_WIN32) || defined(USING_QT_UI)
|
||||
#if PPSSPP_PLATFORM(WINDOWS) || defined(USING_QT_UI)
|
||||
const size_t name_len = 256;
|
||||
|
||||
char name[name_len];
|
||||
|
@ -1112,7 +1108,7 @@ UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) {
|
|||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnChangeproAdhocServerAddress(UI::EventParams &e) {
|
||||
#if defined(_WIN32) || defined(USING_QT_UI)
|
||||
#if PPSSPP_PLATFORM(WINDOWS) || defined(USING_QT_UI)
|
||||
if (!g_Config.bFullScreen) {
|
||||
const size_t name_len = 256;
|
||||
|
||||
|
|
|
@ -916,6 +916,7 @@ void NativeUpdate() {
|
|||
}
|
||||
|
||||
void NativeDeviceLost() {
|
||||
ILOG("NativeDeviceLost");
|
||||
// We start by calling gl_lost - this lets objects zero their native GL objects
|
||||
// so they then don't try to delete them as well.
|
||||
if (GetGPUBackend() == GPUBackend::OPENGL) {
|
||||
|
@ -927,6 +928,7 @@ void NativeDeviceLost() {
|
|||
}
|
||||
|
||||
void NativeDeviceRestore() {
|
||||
ILOG("NativeDeviceRestore");
|
||||
if (GetGPUBackend() == GPUBackend::OPENGL) {
|
||||
gl_restore();
|
||||
}
|
||||
|
@ -1109,12 +1111,8 @@ void NativeShutdown() {
|
|||
|
||||
net::Shutdown();
|
||||
|
||||
// This means that the activity has been completely destroyed. PPSSPP does not
|
||||
// boot up correctly with "dirty" global variables currently, so we hack around that
|
||||
// by simply exiting.
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
exit(0);
|
||||
#endif
|
||||
// Previously we did exit() here on Android but that makes it hard to do things like restart on backend change.
|
||||
// I think we handle most globals correctly or correct-enough now.
|
||||
}
|
||||
|
||||
void NativePermissionStatus(SystemPermission permission, PermissionStatus status) {
|
||||
|
|
|
@ -139,6 +139,7 @@ void AndroidEGLGraphicsContext::Shutdown() {
|
|||
gl->Shutdown();
|
||||
delete gl;
|
||||
ANativeWindow_release(wnd_);
|
||||
finalize_glslang();
|
||||
}
|
||||
|
||||
void AndroidEGLGraphicsContext::SwapBuffers() {
|
||||
|
@ -155,7 +156,13 @@ public:
|
|||
~AndroidJavaEGLGraphicsContext() {
|
||||
delete draw_;
|
||||
}
|
||||
void Shutdown() override {}
|
||||
void Shutdown() override {
|
||||
ILOG("AndroidJavaEGLGraphicsContext::Shutdown");
|
||||
delete draw_;
|
||||
draw_ = nullptr;
|
||||
NativeShutdownGraphics();
|
||||
finalize_glslang();
|
||||
}
|
||||
void SwapBuffers() override {}
|
||||
void SwapInterval(int interval) override {}
|
||||
void Resize() override {}
|
||||
|
@ -295,6 +302,7 @@ bool AndroidVulkanContext::Init(ANativeWindow *wnd, int desiredBackbufferSizeX,
|
|||
}
|
||||
|
||||
void AndroidVulkanContext::Shutdown() {
|
||||
ILOG("AndroidVulkanContext::Shutdown");
|
||||
delete draw_;
|
||||
draw_ = nullptr;
|
||||
NativeShutdownGraphics();
|
||||
|
@ -627,14 +635,19 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_pause(JNIEnv *, jclass) {
|
|||
extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) {
|
||||
ILOG("NativeApp.shutdown() -- begin");
|
||||
if (renderer_inited) {
|
||||
ILOG("Shutting down renderer");
|
||||
graphicsContext->Shutdown();
|
||||
delete graphicsContext;
|
||||
graphicsContext = nullptr;
|
||||
renderer_inited = false;
|
||||
} else {
|
||||
ILOG("Not shutting down renderer - not initialized");
|
||||
}
|
||||
|
||||
NativeShutdown();
|
||||
VFSShutdown();
|
||||
while (frameCommands.size())
|
||||
frameCommands.pop();
|
||||
ILOG("NativeApp.shutdown() -- end");
|
||||
}
|
||||
|
||||
|
|
|
@ -601,6 +601,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
|
|||
}
|
||||
if (shuttingDown || isFinishing()) {
|
||||
NativeApp.shutdown();
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1160,6 +1161,10 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
|
|||
}
|
||||
} else if (command.equals("recreate")) {
|
||||
recreate();
|
||||
} else if (command.equals("graphics_restart")) {
|
||||
Log.i(TAG, "graphics_restart");
|
||||
shuttingDown = true;
|
||||
recreate();
|
||||
} else if (command.equals("ask_permission") && params.equals("storage")) {
|
||||
askForStoragePermission();
|
||||
}
|
||||
|
|
|
@ -120,6 +120,10 @@ void gl_lost_manager_shutdown() {
|
|||
FLOG("Lost manager already shutdown");
|
||||
} else if (holders->size() > 0) {
|
||||
ELOG("Lost manager shutdown with %i objects still registered", (int)holders->size());
|
||||
for (size_t i = 0; i < holders->size(); i++) {
|
||||
ELOG(" (%d / %d, %s, prio %d)", (int)(i + 1), (int)holders->size(),
|
||||
(*holders)[i].desc, (*holders)[i].priority);
|
||||
}
|
||||
}
|
||||
|
||||
delete holders;
|
||||
|
|
|
@ -65,8 +65,14 @@ Draw::InputLayout *DrawBuffer::CreateInputLayout(Draw::DrawContext *t3d) {
|
|||
void DrawBuffer::Shutdown() {
|
||||
if (vbuf_) {
|
||||
vbuf_->Release();
|
||||
vbuf_ = nullptr;
|
||||
}
|
||||
inited_ = false;
|
||||
alphaStack_.clear();
|
||||
drawMatrixStack_.clear();
|
||||
pipeline_ = nullptr;
|
||||
draw_ = nullptr;
|
||||
count_ = 0;
|
||||
}
|
||||
|
||||
void DrawBuffer::Begin(Draw::Pipeline *program) {
|
||||
|
|
Loading…
Add table
Reference in a new issue