From ed8b32775b3a5b1f7eeda299ff61d924deb762a5 Mon Sep 17 00:00:00 2001 From: xfangfang <2553041586@qq.com> Date: Sat, 5 Aug 2023 01:06:42 +0800 Subject: [PATCH 4/5] support psv --- CMakeLists.txt | 6 +++++- mongoose.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git CMakeLists.txt CMakeLists.txt index cb8c8722..db53ea00 100644 --- CMakeLists.txt +++ CMakeLists.txt @@ -4,6 +4,10 @@ add_library(mongoose STATIC ${CMAKE_CURRENT_SOURCE_DIR}/mongoose.c) if (__SWITCH__) target_compile_options(mongoose PRIVATE -DMG_ARCH=10086) -endif() +endif () + +if (VITASDK) + target_compile_options(mongoose PRIVATE -DMG_ARCH=10010) +endif () target_include_directories(mongoose PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git mongoose.h mongoose.h index b9d8162b..14ea8e35 100644 --- mongoose.h +++ mongoose.h @@ -44,6 +44,7 @@ #define MG_ARCH_RTTHREAD 14 // RT-Thread RTOS #define MG_ARCH_ARMCGT 15 // Texas Semi ARM-CGT #define MG_ARCH_CUBE 16 // STM32Cube environment +#define MG_ARCH_VITA 10010 // PSVita #define MG_ARCH_NX 10086 // Nintendo Switch #define MG_ARCH_NEWLIB MG_ARCH_ARMGCC // Alias, deprecate in 2025 @@ -55,6 +56,8 @@ #define MG_ARCH MG_ARCH_WIN32 #elif defined(__SWITCH__) #define MG_ARCH MG_ARCH_NX +#elif defined(__PSV__) +#define MG_ARCH MG_ARCH_PSV #endif #endif // !defined(MG_ARCH) @@ -270,6 +273,45 @@ #endif +#if MG_ARCH == MG_ARCH_VITA +#ifndef _POSIX_TIMERS +#define _POSIX_TIMERS +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MG_PATH_MAX 100 + +#define MG_ENABLE_POLL 1 +#define MG_ENABLE_SOCKET 1 +#define MG_ENABLE_DIRLIST 0 + +#endif #if MG_ARCH == MG_ARCH_FREERTOS