mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
If user resumes APK after server shutdown, restart cmdthread.
Also make sure ANativeActivity_finish/DetachCurrentThread are called.
This commit is contained in:
committed by
Baldur Karlsson
parent
b9be6a70e3
commit
89eb933be5
@@ -356,18 +356,17 @@ vector<string> getRenderdoccmdArgs()
|
||||
(jstring)env->CallObjectMethod(intent, gseid, env->NewStringUTF("renderdoccmd"));
|
||||
|
||||
vector<string> ret;
|
||||
if(!jsParam1)
|
||||
return ret; // No arg value found
|
||||
|
||||
ret.push_back("renderdoccmd");
|
||||
|
||||
const char *param1 = env->GetStringUTFChars(jsParam1, 0);
|
||||
istringstream iss(param1);
|
||||
while(iss)
|
||||
if(jsParam1) // Check if arg value found
|
||||
{
|
||||
string sub;
|
||||
iss >> sub;
|
||||
ret.push_back(sub);
|
||||
ret.push_back("renderdoccmd");
|
||||
const char *param1 = env->GetStringUTFChars(jsParam1, 0);
|
||||
istringstream iss(param1);
|
||||
while(iss)
|
||||
{
|
||||
string sub;
|
||||
iss >> sub;
|
||||
ret.push_back(sub);
|
||||
}
|
||||
}
|
||||
android_state->activity->vm->DetachCurrentThread();
|
||||
|
||||
@@ -377,10 +376,8 @@ vector<string> getRenderdoccmdArgs()
|
||||
void *cmdthread(void *)
|
||||
{
|
||||
vector<string> args = getRenderdoccmdArgs();
|
||||
if(!args.size())
|
||||
return NULL; // Nothing for APK to do.
|
||||
|
||||
renderdoccmd(GlobalEnvironment(), args);
|
||||
if(args.size())
|
||||
renderdoccmd(GlobalEnvironment(), args);
|
||||
|
||||
// activity is done and should be closed
|
||||
ANativeActivity_finish(android_state->activity);
|
||||
@@ -394,9 +391,11 @@ void handle_cmd(android_app *app, int32_t cmd)
|
||||
{
|
||||
case APP_CMD_INIT_WINDOW:
|
||||
{
|
||||
if(cmdthread_handle == 0)
|
||||
pthread_create(&cmdthread_handle, NULL, cmdthread, NULL);
|
||||
if(cmdthread_handle != 0)
|
||||
// If user resumes APK after server shutdown, restart the thread.
|
||||
pthread_join(cmdthread_handle, NULL);
|
||||
|
||||
pthread_create(&cmdthread_handle, NULL, cmdthread, NULL);
|
||||
break;
|
||||
}
|
||||
case APP_CMD_WINDOW_REDRAW_NEEDED:
|
||||
|
||||
Reference in New Issue
Block a user