mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[client/obs] update to use new LGMP init api
This commit is contained in:
@@ -1451,18 +1451,31 @@ static int lg_run()
|
|||||||
lgWaitEvent(e_startup, TIMEOUT_INFINITE);
|
lgWaitEvent(e_startup, TIMEOUT_INFINITE);
|
||||||
|
|
||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
uint32_t udataSize;
|
|
||||||
KVMFR *udata;
|
|
||||||
int waitCount = 0;
|
|
||||||
|
|
||||||
while(state.running)
|
while(state.running)
|
||||||
{
|
{
|
||||||
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp,
|
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp)) == LGMP_OK)
|
||||||
&udataSize, (uint8_t **)&udata)) == LGMP_OK)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (status == LGMP_ERR_INVALID_SESSION || status == LGMP_ERR_INVALID_MAGIC)
|
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)
|
if (waitCount++ == 0)
|
||||||
{
|
{
|
||||||
DEBUG_BREAK();
|
DEBUG_BREAK();
|
||||||
@@ -1478,14 +1491,7 @@ static int lg_run()
|
|||||||
DEBUG_INFO("Continuing to wait...");
|
DEBUG_INFO("Continuing to wait...");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == LGMP_ERR_INVALID_SESSION)
|
|
||||||
SDL_WaitEventTimeout(NULL, 1000);
|
SDL_WaitEventTimeout(NULL, 1000);
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_ERROR("lgmpClientInit Failed: %s", lgmpStatusString(status));
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!state.running)
|
if (!state.running)
|
||||||
@@ -1519,13 +1525,12 @@ static int lg_run()
|
|||||||
|
|
||||||
while(state.running)
|
while(state.running)
|
||||||
{
|
{
|
||||||
SDL_WaitEventTimeout(NULL, 1000);
|
|
||||||
|
|
||||||
if (!lgmpClientSessionValid(state.lgmp))
|
if (!lgmpClientSessionValid(state.lgmp))
|
||||||
{
|
{
|
||||||
DEBUG_WARN("Session is invalid, has the host shutdown?");
|
DEBUG_WARN("Session is invalid, has the host shutdown?");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
SDL_WaitEventTimeout(NULL, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
8
obs/lg.c
8
obs/lg.c
@@ -171,8 +171,12 @@ static void lgUpdate(void * data, obs_data_t * settings)
|
|||||||
uint32_t udataSize;
|
uint32_t udataSize;
|
||||||
KVMFR * udata;
|
KVMFR * udata;
|
||||||
|
|
||||||
if (lgmpClientInit(this->shmDev.mem, this->shmDev.size, &this->lgmp,
|
if (lgmpClientInit(this->shmDev.mem, this->shmDev.size, &this->lgmp)
|
||||||
&udataSize, (uint8_t **)&udata) != LGMP_OK)
|
!= LGMP_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (lgmpClientSessionInit(this->lgmp, &udataSize, (uint8_t **)&udata)
|
||||||
|
!= LGMP_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (udataSize != sizeof(KVMFR) ||
|
if (udataSize != sizeof(KVMFR) ||
|
||||||
|
Submodule repos/LGMP updated: 520350a8af...19efde39f6
Reference in New Issue
Block a user