From b4c30b7122d82e7c96cd7c91bebc5486d30feb58 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 6 Dec 2023 21:17:30 +1100 Subject: [PATCH] Vita: Try to fix insta crash on real hardware --- misc/ps2/Makefile | 3 +++ src/Platform_PS2.c | 1 + src/Platform_PSVita.c | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/misc/ps2/Makefile b/misc/ps2/Makefile index d27f8f84c..40006ab91 100644 --- a/misc/ps2/Makefile +++ b/misc/ps2/Makefile @@ -1,3 +1,6 @@ +ifeq ($(strip $(PS2SDK)),) +$(error "PS2SDK must be set in your environment") +endif BUILD_DIR = build-ps2 CFILES := $(wildcard src/*.c) diff --git a/src/Platform_PS2.c b/src/Platform_PS2.c index b3f9d627f..dd69f39d3 100644 --- a/src/Platform_PS2.c +++ b/src/Platform_PS2.c @@ -463,6 +463,7 @@ static void Networking_LoadIOPModules(void) { union SocketAddress { struct sockaddr raw; struct sockaddr_in v4; + struct sockaddr_storage total; // matches size of addr returned by getaddrinfo }; static int ParseHost(union SocketAddress* addr, const char* host) { diff --git a/src/Platform_PSVita.c b/src/Platform_PSVita.c index 3bf32072b..76a07db1d 100644 --- a/src/Platform_PSVita.c +++ b/src/Platform_PSVita.c @@ -387,9 +387,22 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) { /*########################################################################################################################* *--------------------------------------------------------Platform---------------------------------------------------------* *#########################################################################################################################*/ +static char net_memory[256 * 1024]; // TOD: 512 * 1024 ? + +static void InitNetworking(void) { + SceNetInitParam param; + + param.memory = net_memory; + param.size = sizeof(net_memory); + param.flags = 0; + + int ret = sceNetInit(¶m); + if (ret < 0) Platform_Log1("Network init failed: %i", &ret); +} + void Platform_Init(void) { /*pspDebugSioInit();*/ - // TODO: sceNetInit(); + InitNetworking(); epoll_id = sceNetEpollCreate("CC poll", 0); } void Platform_Free(void) { }