From 9b26057adbd45e2df5c0f2fabb9cdf84d87cc1fa Mon Sep 17 00:00:00 2001 From: Nishi Date: Sun, 29 Sep 2024 00:37:00 +0000 Subject: [PATCH] will try to fix ps2 later git-svn-id: file:///raid/svn-personal/tewi/trunk@189 8739d7e6-ffea-ec47-b151-bdff447c6205 --- Platform/ps2.mk | 13 +++++++++++++ Server/Makefile | 4 ++-- Server/config.c | 2 ++ Server/main.c | 13 +++++++++++++ Server/module.c | 2 +- Server/server.c | 4 ++-- Server/strptime.h | 2 +- config.h.tmpl | 16 ++++++++-------- 8 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 Platform/ps2.mk diff --git a/Platform/ps2.mk b/Platform/ps2.mk new file mode 100644 index 0000000..ba5843c --- /dev/null +++ b/Platform/ps2.mk @@ -0,0 +1,13 @@ +# $Id$ + +PREFIX = /dev_hdd0/httpd + +CC = mips64r5900el-ps2-elf-gcc +AR = mips64r5900el-ps2-elf-ar +CFLAGS = -O2 -D_EE -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -I /usr/local/ps2dev/ps2sdk/ee/include -I /usr/local/ps2dev/ps2sdk/common/include +LDFLAGS = -T/usr/local/ps2dev/ps2sdk/ee/startup/linkfile -L /usr/local/ps2dev/ps2sdk/ee/lib -O2 +LIBS = -ldebug -lsocket +EXEC = .elf +LIB = .so +MODULE = +SERVADD = mips64r5900el-ps2-elf-strip tewi.elf -o tewi_strip.elf diff --git a/Server/Makefile b/Server/Makefile index 306be72..2b1ba83 100644 --- a/Server/Makefile +++ b/Server/Makefile @@ -5,14 +5,14 @@ include $(PWD)/Platform/$(PLATFORM).mk .PHONY: all clean .SUFFIXES: .c .o -OBJS = version.o main.o config.o server.o http.o module.o strptime.o $(EXTOBJS) $(PREOBJS) +OBJS = main.o version.o config.o server.o http.o module.o strptime.o $(EXTOBJS) $(PREOBJS) all: tewi$(EXEC) $(TARGET) tewi_strip$(EXEC): tewi$(EXEC) tewi$(EXEC): $(OBJS) ../Common/common.a - $(CC) $(LDFLAGS) $(EXTLDFLAGS) -o $@ $(OBJS) $(EXTLIBS) $(LIBS) ../Common/common.a + $(CC) $(LDFLAGS) $(EXTLDFLAGS) -o $@ $(OBJS) $(EXTLIBS) ../Common/common.a $(LIBS) $(SERVADD) tewi.pbp: tewi_strip$(EXEC) param.sfo diff --git a/Server/config.c b/Server/config.c index a76cd1a..627c6a9 100644 --- a/Server/config.c +++ b/Server/config.c @@ -105,6 +105,8 @@ void tw_config_init(void) { strcpy(config.hostname, "psp"); #elif defined(__PPU__) strcpy(config.hostname, "ps3"); +#elif defined(__ps2sdk__) + strcpy(config.hostname, "ps2"); #else gethostname(config.hostname, 1024); #endif diff --git a/Server/main.c b/Server/main.c index 9e902e8..1d18039 100644 --- a/Server/main.c +++ b/Server/main.c @@ -4,6 +4,7 @@ #include "../config.h" +#include #include #include #include @@ -39,6 +40,12 @@ PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); #define printf(...) pspDebugScreenPrintf(__VA_ARGS__) #define STDERR_LOG(...) pspDebugScreenPrintf(__VA_ARGS__) +#elif defined(__ps2sdk__) +#include +#include + +#define printf(...) scr_printf(__VA_ARGS__) +#define STDERR_LOG(...) scr_printf(__VA_ARGS__) #else #define STDERR_LOG(...) fprintf(stderr, __VA_ARGS__) #endif @@ -243,6 +250,12 @@ int main(int argc, char** argv) { #elif defined(__PPU__) printf("PS3 Bootstrap, Tewi/%s\n", tw_get_version()); netInitialize(); +#elif defined(__ps2sdk__) + SifInitRpc(0); + init_scr(); + scr_printf("PS2 Bootstrap, Tewi/%s\n", tw_get_version()); + while(1) + ; #endif int st = startup(argc, argv); if(st != -1) { diff --git a/Server/module.c b/Server/module.c index f5eb5e6..f4292f1 100644 --- a/Server/module.c +++ b/Server/module.c @@ -15,7 +15,7 @@ extern struct tw_config config; -#if defined(_PSP) || defined(__PPU__) +#if defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) void* tw_module_load(const char* path) { return NULL; } void* tw_module_symbol(void* mod, const char* sym) { return NULL; } diff --git a/Server/server.c b/Server/server.c index 193bf42..865cf28 100644 --- a/Server/server.c +++ b/Server/server.c @@ -61,7 +61,7 @@ #endif #endif -#ifdef _PSP +#if defined(_PSP) || defined(__ps2sdk__) #include "strptime.h" #endif @@ -521,7 +521,7 @@ int tw_server_pass(void* ptr) { } else if(cm_strcaseequ(req.headers[i], "If-Modified-Since")) { struct tm tm; strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm); -#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) +#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) time_t t = 0; struct tm* btm = localtime(&t); cmtime = mktime(&tm); diff --git a/Server/strptime.h b/Server/strptime.h index a26974b..e792cf1 100644 --- a/Server/strptime.h +++ b/Server/strptime.h @@ -7,7 +7,7 @@ extern "C" { #include -#if defined(_WIN32) || defined(_PSP) +#if defined(_WIN32) || defined(_PSP) || defined(__ps2sdk__) char* strptime(const char *buf, const char *fmt, struct tm *tm); #endif diff --git a/config.h.tmpl b/config.h.tmpl index ac30b97..35baaca 100644 --- a/config.h.tmpl +++ b/config.h.tmpl @@ -27,24 +27,24 @@ /* Windows should not have chroot */ #endif -#if (defined(_PSP) || defined(__PPU__)) && !defined(NO_IPV6) +#if (defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__)) && !defined(NO_IPV6) #define NO_IPV6 -/* PSP/PS3 does not have IPv6 */ +/* PSP/PS2/PS3 does not have IPv6 */ #endif -#if (defined(_PSP)) && defined(USE_POLL) +#if (defined(_PSP) || defined(__ps2sdk__)) && defined(USE_POLL) #undef USE_POLL -/* Force select(2) for PSP */ +/* Force select(2) for PSP/PS2 */ #endif -#if (defined(_PSP) || defined(__PPU__)) && defined(HAS_CHROOT) +#if (defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__)) && defined(HAS_CHROOT) #undef HAS_CHROOT -/* PSP/PS3 should not have chroot */ +/* PSP/PS2/PS3 should not have chroot */ #endif -#if (defined(_PSP) || defined(__PPU__)) && !defined(NO_GETADDRINFO) +#if (defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__)) && !defined(NO_GETADDRINFO) #define NO_GETADDRINFO -/* PSP/PS3 should not have getaddrinfo */ +/* PSP/PS2/PS3 should not have getaddrinfo */ #endif #endif -- 2.43.0