From 5a4827f034800d87ce6732a884461d3849b332c9 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 3 Sep 2023 11:38:32 +1000 Subject: [PATCH] Vita: Connecting to multiplayer works probably --- src/Graphics_PSP.c | 3 ++- src/Platform_PSVita.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Graphics_PSP.c b/src/Graphics_PSP.c index 79ca35d98..f92245e16 100644 --- a/src/Graphics_PSP.c +++ b/src/Graphics_PSP.c @@ -61,7 +61,7 @@ static void guInit(void) { sceGuScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); sceGuDisable(GU_SCISSOR_TEST); - sceGuEnable(GU_CLIP_PLANES); + sceGuEnable(GU_CLIP_PLANES); // TODO: swap near/far instead of this? sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); sceGuFinish(); @@ -217,6 +217,7 @@ void Gfx_CalcPerspectiveMatrix(struct Matrix* matrix, float fov, float aspect, f matrix->row3.W = -1.0f; matrix->row4.Z = -(2.0f * zFar * zNear) / (zFar - zNear); matrix->row4.W = 0.0f; + // TODO: should direct3d9 one be used insted with clip range from -1,1 ? } diff --git a/src/Platform_PSVita.c b/src/Platform_PSVita.c index d88578465..47175909c 100644 --- a/src/Platform_PSVita.c +++ b/src/Platform_PSVita.c @@ -354,15 +354,16 @@ static cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) { SceNetEpollEvent ev = { 0 }; // to match select, closed socket still counts as readable int flags = mode == SOCKET_POLL_READ ? (SCE_NET_EPOLLIN | SCE_NET_EPOLLHUP) : SCE_NET_EPOLLOUT; - int res; - + int res, num_events; ev.data.fd = s; ev.events = flags; - if ((res = sceNetEpollControl(epoll_id, SCE_NET_EPOLL_CTL_ADD, s, &ev))) return res; - res = sceNetEpollWait(epoll_id, &ev, 1, 0); + if ((res = sceNetEpollControl(epoll_id, SCE_NET_EPOLL_CTL_ADD, s, &ev))) return res; + num_events = sceNetEpollWait(epoll_id, &ev, 1, 0); sceNetEpollControl(epoll_id, SCE_NET_EPOLL_CTL_DEL, s, NULL); - if (res) return res; + + if (num_events < 0) return num_events; + if (num_events == 0) return ERR_NOT_SUPPORTED; // TODO when can this ever happen? *success = (ev.events & flags) != 0; return 0;