diff --git a/nx/source/gfx/gfx.c b/nx/source/gfx/gfx.c index 52b6cc65..373233f1 100644 --- a/nx/source/gfx/gfx.c +++ b/nx/source/gfx/gfx.c @@ -15,6 +15,7 @@ static bool g_gfx_ProducerConnected = 0; static bool g_gfx_ProducerSlotsRequested[2] = {0, 0}; static u8 *g_gfxFramebuf; static size_t g_gfxFramebufSize; +static bufferProducerFence g_gfx_DequeueBuffer_fence; static bool g_gfxDoubleBuf = 1; @@ -289,7 +290,7 @@ void gfxSwapBuffers() { rc = _gfxQueueBuffer(g_gfxCurrentProducerBuffer); - if (R_SUCCEEDED(rc)) rc = _gfxDequeueBuffer(NULL); + if (R_SUCCEEDED(rc)) rc = _gfxDequeueBuffer(&g_gfx_DequeueBuffer_fence); if (R_FAILED(rc)) fatalSimple(rc); } diff --git a/nx/source/gfx/parcel.c b/nx/source/gfx/parcel.c index 4a03361a..498b66b1 100644 --- a/nx/source/gfx/parcel.c +++ b/nx/source/gfx/parcel.c @@ -83,7 +83,7 @@ void* parcelWriteData(Parcel *ctx, void* data, size_t data_size) void* parcelReadData(Parcel *ctx, void* data, size_t data_size) { - void* ptr = ctx->payload; + void* ptr = &ctx->payload[ctx->pos]; size_t aligned_data_size; if(data_size & BIT(31)) @@ -95,7 +95,7 @@ void* parcelReadData(Parcel *ctx, void* data, size_t data_size) return NULL; if(data) - memcpy(data, &ctx->payload[ctx->pos], data_size); + memcpy(data, ptr, data_size); ctx->pos += aligned_data_size; return ptr;