[client/obs] update to use new LGMP init api

This commit is contained in:
Geoffrey McRae 2020-05-21 09:28:41 +10:00
parent a6d6a49f82
commit 3b47a4113f
4 changed files with 43 additions and 34 deletions

View File

@ -1 +1 @@
B1-200-gf8ff3faf78+1
B1-201-ga6d6a49f82+1

View File

@ -1451,43 +1451,49 @@ static int lg_run()
lgWaitEvent(e_startup, TIMEOUT_INFINITE);
LGMP_STATUS status;
uint32_t udataSize;
KVMFR *udata;
int waitCount = 0;
while(state.running)
{
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp,
&udataSize, (uint8_t **)&udata)) == LGMP_OK)
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp)) == LGMP_OK)
break;
if (status == LGMP_ERR_INVALID_SESSION || status == LGMP_ERR_INVALID_MAGIC)
{
if (waitCount++ == 0)
{
DEBUG_BREAK();
DEBUG_INFO("The host application seems to not be running");
DEBUG_INFO("Waiting for the host application to start...");
}
if (waitCount == 30)
{
DEBUG_BREAK();
DEBUG_INFO("Please check the host application is running and is the correct version");
DEBUG_INFO("Check the host log in your guest at %%TEMP%%\\looking-glass-host.txt");
DEBUG_INFO("Continuing to wait...");
}
if (status == LGMP_ERR_INVALID_SESSION)
SDL_WaitEventTimeout(NULL, 1000);
continue;
}
DEBUG_ERROR("lgmpClientInit Failed: %s", lgmpStatusString(status));
return -1;
}
uint32_t udataSize;
KVMFR *udata;
int waitCount = 0;
while(state.running)
{
if ((status = lgmpClientSessionInit(state.lgmp, &udataSize, (uint8_t **)&udata)) == LGMP_OK)
break;
if (status != LGMP_ERR_INVALID_SESSION && status != LGMP_ERR_INVALID_MAGIC)
{
DEBUG_ERROR("lgmpClientSessionInit Failed: %s", lgmpStatusString(status));
return -1;
}
if (waitCount++ == 0)
{
DEBUG_BREAK();
DEBUG_INFO("The host application seems to not be running");
DEBUG_INFO("Waiting for the host application to start...");
}
if (waitCount == 30)
{
DEBUG_BREAK();
DEBUG_INFO("Please check the host application is running and is the correct version");
DEBUG_INFO("Check the host log in your guest at %%TEMP%%\\looking-glass-host.txt");
DEBUG_INFO("Continuing to wait...");
}
SDL_WaitEventTimeout(NULL, 1000);
}
if (!state.running)
return -1;
@ -1519,13 +1525,12 @@ static int lg_run()
while(state.running)
{
SDL_WaitEventTimeout(NULL, 1000);
if (!lgmpClientSessionValid(state.lgmp))
{
DEBUG_WARN("Session is invalid, has the host shutdown?");
break;
}
SDL_WaitEventTimeout(NULL, 1000);
}
return 0;

View File

@ -171,8 +171,12 @@ static void lgUpdate(void * data, obs_data_t * settings)
uint32_t udataSize;
KVMFR * udata;
if (lgmpClientInit(this->shmDev.mem, this->shmDev.size, &this->lgmp,
&udataSize, (uint8_t **)&udata) != LGMP_OK)
if (lgmpClientInit(this->shmDev.mem, this->shmDev.size, &this->lgmp)
!= LGMP_OK)
return;
if (lgmpClientSessionInit(this->lgmp, &udataSize, (uint8_t **)&udata)
!= LGMP_OK)
return;
if (udataSize != sizeof(KVMFR) ||

@ -1 +1 @@
Subproject commit 520350a8af533a8ef307da13fa95a19d5ae78762
Subproject commit 19efde39f6f2d50799aabec55ca8260360711a42