From: Nishi Date: Sun, 29 Sep 2024 07:13:35 +0000 (+0000) Subject: just generate pkg containing the config X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e31a5664cba1cc47b57077ade38114da6349a8aa;p=tewi.git just generate pkg containing the config git-svn-id: file:///raid/svn-personal/tewi/trunk@197 8739d7e6-ffea-ec47-b151-bdff447c6205 --- diff --git a/Makefile b/Makefile index 4e10966..deea9d3 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ FLAGS = PWD=$(PWD) PLATFORM=$(PLATFORM) PREFIX=$(PREFIX) .PHONY: all format clean ./Server ./Common ./Module get-version -all: ./Server $(MODULE) ./Tool/genconf ./Tool/itworks +all: ./Server $(MODULE) ./Tool/option: ./Tool/option.c config.h cc -o $@ ./Tool/option.c @@ -22,7 +22,7 @@ all: ./Server $(MODULE) ./Tool/genconf ./Tool/itworks ./Tool/itworks: ./Tool/itworks.c config.h cc -o $@ ./Tool/itworks.c -./Server:: ./Common ./Tool/option +./Server:: ./Common ./Tool/option ./Tool/genconf ./Tool/itworks $(MAKE) -C $@ $(FLAGS) EXTOBJS="`./Tool/option objs ../`" EXTLIBS="`./Tool/option libs ../`" EXTCFLAGS="`./Tool/option cflags ../`" EXTLDFLAGS="`./Tool/option ldflags ../`" ./Module:: ./Common diff --git a/Platform/ps3.mk b/Platform/ps3.mk index ba0e58a..55ebc8e 100644 --- a/Platform/ps3.mk +++ b/Platform/ps3.mk @@ -4,9 +4,9 @@ PREFIX = /dev_hdd0/game/TEWI_00-0/USRDIR CC = ppu-gcc AR = ppu-ar -CFLAGS = -g -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -I /usr/local/ps3dev/ppu/include -LDFLAGS = -L /usr/local/ps3dev/ppu/lib -LIBS = -lnet -lsysmodule -lsysutil -lrt -llv2 -lrsx -lgcm_sys +CFLAGS = -g -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -I /usr/local/ps3dev/ppu/include -I /usr/local/ps3dev/portlibs/ppu/include +LDFLAGS = -L /usr/local/ps3dev/ppu/lib -L /usr/local/ps3dev/portlibs/ppu/lib +LIBS = -lnet -lsysmodule -lsysutil -lrt -llv2 -lrsx -lgcm_sys -lpng -lm -lz EXEC = .elf LIB = .so MODULE = diff --git a/Server/Makefile b/Server/Makefile index fe49d7e..b726d4a 100644 --- a/Server/Makefile +++ b/Server/Makefile @@ -27,8 +27,13 @@ tewi.self: tewi_strip$(EXEC) fself tewi_strip$(EXEC) tewi.fake.self tewi.pkg: tewi.self - mkdir -p pkg/USRDIR + mkdir -p pkg/USRDIR/etc + mkdir -p pkg/USRDIR/www cp ../Binary/ps3.png pkg/ICON0.PNG + ../Tool/genconf /dev_hdd0/game/TEWI_00-0/USRDIR lib/tewi so > pkg/USRDIR/etc/tewi.conf + cp ../Binary/pbtewi.gif pkg/USRDIR/www/ + convert '../Binary/pbtewi.gif[0]' pkg/USRDIR/pbtewi.png + ../Tool/itworks > pkg/USRDIR/www/index.html make_self_npdrm tewi_strip$(EXEC) pkg/USRDIR/EBOOT.BIN UP0001-TEWI_00-0000000000000000 sfo.py --title "Tewi HTTPd" --appid "TEWI" -f /usr/local/ps3dev/bin/sfo.xml pkg/PARAM.SFO pkg.py --contentid UP0001-TEWI_00-0000000000000000 pkg/ $@ diff --git a/Server/main.c b/Server/main.c index 3af5b8d..75ae059 100644 --- a/Server/main.c +++ b/Server/main.c @@ -53,6 +53,7 @@ PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); #include #include #include +#include #define printf(...) tt_printf(__VA_ARGS__) #define STDERR_LOG(...) tt_printf(__VA_ARGS__) @@ -329,7 +330,7 @@ void tt_putstr(const char* str) { } } for(x = 0; x < tt_width; x++) { - tvram[(tt_height - 1) * tt_width + x] = 0; + tvram[(tt_height - 1) * tt_width + x] = 0x20; } } } @@ -337,17 +338,18 @@ void tt_putstr(const char* str) { void tt_putchar(struct rsx_buffer* buffer, int x, int y, uint8_t c) { int i, j; + if(c == 0) return; if(c < 0x20) c = 0x20; if(c >= 0x7f) c = 0x20; - for(i = 0; i < 7; i++) { - uint8_t l = font[(c - 0x20) * 8 + i]; - for(j = 0; j < 5; j++) { - uint32_t c = 0; + for(i = 0; i < 8; i++) { + uint8_t l = i == 7 ? 0 : font[(c - 0x20) * 8 + i]; + for(j = 0; j < 6; j++) { + uint32_t col = 0; if(l & (1 << 7)) { - c = 0xffffff; + col = 0xffffff; } l = l << 1; - buffer->ptr[(y * 8 + i) * buffer->width + x * 6 + j] = c; + buffer->ptr[(y * 8 + i) * buffer->width + x * 6 + j] = col; } } } @@ -362,7 +364,7 @@ void draw(struct rsx_buffer* buffer, int current) { } } -#define BUFFERS 2 +#define BUFFERS 1 gcmContextData* ctx; struct rsx_buffer buffers[BUFFERS]; @@ -413,6 +415,66 @@ void tt_printf(const char* tmpl, ...) { tt_putstr(log); } +void show_png(void) { + FILE* f = fopen(PREFIX "/pbtewi.png", "rb"); + if(f == NULL) { + f = fopen(PREFIX "/../ICON0.PNG", "rb"); + } + if(f == NULL) return; + png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_infop info = png_create_info_struct(png); + if(setjmp(png_jmpbuf(png))) { + png_destroy_read_struct(&png, &info, NULL); + fclose(f); + return; + } + + png_init_io(png, f); + png_read_info(png, info); + + int width = png_get_image_width(png, info); + int height = png_get_image_height(png, info); + int depth = png_get_bit_depth(png, info); + int type = png_get_color_type(png, info); + + if(depth == 16) png_set_strip_16(png); + if(type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png); + if(type == PNG_COLOR_TYPE_GRAY && depth < 8) png_set_expand_gray_1_2_4_to_8(png); + if(png_get_valid(png, info, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png); + if(type == PNG_COLOR_TYPE_RGB || type == PNG_COLOR_TYPE_GRAY || type == PNG_COLOR_TYPE_PALETTE) png_set_filler(png, 0xFF, PNG_FILLER_AFTER); + if(type == PNG_COLOR_TYPE_GRAY || type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png); + png_read_update_info(png, info); + png_bytep* rows = (png_bytep*)malloc(sizeof(*rows) * (height)); + + int i; + + for(i = 0; i < height; i++) { + rows[i] = (png_byte*)malloc(png_get_rowbytes(png, info)); + } + + png_read_image(png, rows); + + for(i = 0; i < height; i++) { + int j; + for(j = 0; j < width; j++) { + png_bytep byte = &(rows[i][j * 4]); + uint32_t col = (byte[0] << 16) | (byte[1] << 8) | (byte[2]); + int k; + for(k = 0; k < BUFFERS; k++) { + buffers[k].ptr[buffers[k].width * i - width + j] = col; + } + } + } + + png_destroy_read_struct(&png, &info, NULL); + fclose(f); + + for(i = 0; i < height; i++) { + free(rows[i]); + } + free(rows); +} + #endif int main(int argc, char** argv) { @@ -560,6 +622,7 @@ int main(int argc, char** argv) { sys_ppu_thread_t id; sysThreadCreate(&id, text_thread, NULL, 1500, 0x1000, THREAD_JOINABLE, "TextThread"); printf("PS3 Bootstrap, Tewi/%s\n", tw_get_version()); + show_png(); netInitialize(); #elif defined(__ps2sdk__) SifInitRpc(0); diff --git a/ps3.sh b/ps3.sh deleted file mode 100755 index b9a89cc..0000000 --- a/ps3.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $Id$ -export PS3DEV="/usr/local/ps3dev" -export PSL1GHT=$PS3DEV -export PATH=$PATH:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin -cat config.h.tmpl | sed -E 's/#undef (NO_SSL)/#define \1/g' > config.h -rm -rf TEWI_00-0 -make PLATFORM=ps3 DESTDIR=TEWI_00-0/ install || exit 1 -mkdir -p TEWI_00-0/USRDIR -mv TEWI_00-0/dev_hdd0/game/TEWI_00-0/USRDIR/* TEWI_00-0/USRDIR/ -rm -rf TEWI_00-0/USRDIR/lib TEWI_00-0/USRDIR/bin -rm -rf TEWI_00-0/dev_hdd0 -make_self_npdrm Server/tewi_strip.elf TEWI_00-0/USRDIR/EBOOT.BIN UP0001-TEWI_00-0000000000000000 -sfo.py --title "Tewi HTTPd" --appid "TEWI" -f /usr/local/ps3dev/bin/sfo.xml TEWI_00-0/PARAM.SFO -cp Binary/ps3.png TEWI_00-0/ICON0.PNG -echo "Tewi HTTPd $(make get-version) for PS3" > TEWI_00-0/README -echo "========================" >> TEWI_00-0/README -echo "To install, just copy this \`TEWI_00-0' folder into your /game of PS3 HDD0." >> TEWI_00-0/README -cat TEWI_00-0/README -rm -f tewidist.zip -zip -rv tewidist.zip TEWI_00-0 -rm -rf TEWI_00-0