Adding set frame callback.

This commit is contained in:
sergiotarxz 2023-03-12 20:24:14 +01:00
parent 0c6847a76c
commit 0aaf6079b0
1 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,17 @@ msPacketHelloDestroy(struct msPacketHello **hello) {
*hello = NULL;
}
void
msThreadCallbackSetFrame(struct mCoreThread *threadContext) {
struct msClientConnectionData *data = (struct msClientConnectionData *)threadContext->userData;
unsigned int stride = data->coreController->stride;
int client_fd = data->clientFd;
color_t *outputBuffer = data->coreController->outputBuffer;
unsigned width, height;
data->coreController->threadContext.core->desiredVideoDimensions(data->coreController->threadContext.core, &width, &height);
}
bool
msPacketHelloHandle(const struct msPacket *packet, struct msPacketHello *hello,
struct msClientConnectionData *const data) {
@ -25,6 +36,7 @@ msPacketHelloHandle(const struct msPacket *packet, struct msPacketHello *hello,
}
printf("Loading game and save for client_fd %d\n", data->clientFd);
data->coreController = msCoreControllerLoadGame(hello->rom, hello->size_rom, hello->savestate, hello->size_savestate, data);
msCoreControllerSetFrameCallback(data->coreController, &msThreadCallbackSetFrame);
msCoreControllerThreadStart(data->coreController);
result = true;
return_ms_packet_hello_handle: