Changeset 197 in Main for trunk/Server
- Timestamp:
- Sep 29, 2024, 4:13:35 PM (7 weeks ago)
- Location:
- trunk/Server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/Makefile
r195 r197 28 28 29 29 tewi.pkg: tewi.self 30 mkdir -p pkg/USRDIR 30 mkdir -p pkg/USRDIR/etc 31 mkdir -p pkg/USRDIR/www 31 32 cp ../Binary/ps3.png pkg/ICON0.PNG 33 ../Tool/genconf /dev_hdd0/game/TEWI_00-0/USRDIR lib/tewi so > pkg/USRDIR/etc/tewi.conf 34 cp ../Binary/pbtewi.gif pkg/USRDIR/www/ 35 convert '../Binary/pbtewi.gif[0]' pkg/USRDIR/pbtewi.png 36 ../Tool/itworks > pkg/USRDIR/www/index.html 32 37 make_self_npdrm tewi_strip$(EXEC) pkg/USRDIR/EBOOT.BIN UP0001-TEWI_00-0000000000000000 33 38 sfo.py --title "Tewi HTTPd" --appid "TEWI" -f /usr/local/ps3dev/bin/sfo.xml pkg/PARAM.SFO -
trunk/Server/main.c
r193 r197 54 54 #include <sys/thread.h> 55 55 #include <stdarg.h> 56 #include <png.h> 56 57 57 58 #define printf(...) tt_printf(__VA_ARGS__) … … 330 331 } 331 332 for(x = 0; x < tt_width; x++) { 332 tvram[(tt_height - 1) * tt_width + x] = 0 ;333 tvram[(tt_height - 1) * tt_width + x] = 0x20; 333 334 } 334 335 } … … 338 339 void tt_putchar(struct rsx_buffer* buffer, int x, int y, uint8_t c) { 339 340 int i, j; 341 if(c == 0) return; 340 342 if(c < 0x20) c = 0x20; 341 343 if(c >= 0x7f) c = 0x20; 342 for(i = 0; i < 7; i++) {343 uint8_t l = font[(c - 0x20) * 8 + i];344 for(j = 0; j < 5; j++) {345 uint32_t c = 0;344 for(i = 0; i < 8; i++) { 345 uint8_t l = i == 7 ? 0 : font[(c - 0x20) * 8 + i]; 346 for(j = 0; j < 6; j++) { 347 uint32_t col = 0; 346 348 if(l & (1 << 7)) { 347 c = 0xffffff;349 col = 0xffffff; 348 350 } 349 351 l = l << 1; 350 buffer->ptr[(y * 8 + i) * buffer->width + x * 6 + j] = c ;352 buffer->ptr[(y * 8 + i) * buffer->width + x * 6 + j] = col; 351 353 } 352 354 } … … 363 365 } 364 366 365 #define BUFFERS 2367 #define BUFFERS 1 366 368 gcmContextData* ctx; 367 369 struct rsx_buffer buffers[BUFFERS]; … … 414 416 } 415 417 418 void show_png(void) { 419 FILE* f = fopen(PREFIX "/pbtewi.png", "rb"); 420 if(f == NULL) { 421 f = fopen(PREFIX "/../ICON0.PNG", "rb"); 422 } 423 if(f == NULL) return; 424 png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 425 png_infop info = png_create_info_struct(png); 426 if(setjmp(png_jmpbuf(png))) { 427 png_destroy_read_struct(&png, &info, NULL); 428 fclose(f); 429 return; 430 } 431 432 png_init_io(png, f); 433 png_read_info(png, info); 434 435 int width = png_get_image_width(png, info); 436 int height = png_get_image_height(png, info); 437 int depth = png_get_bit_depth(png, info); 438 int type = png_get_color_type(png, info); 439 440 if(depth == 16) png_set_strip_16(png); 441 if(type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png); 442 if(type == PNG_COLOR_TYPE_GRAY && depth < 8) png_set_expand_gray_1_2_4_to_8(png); 443 if(png_get_valid(png, info, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png); 444 if(type == PNG_COLOR_TYPE_RGB || type == PNG_COLOR_TYPE_GRAY || type == PNG_COLOR_TYPE_PALETTE) png_set_filler(png, 0xFF, PNG_FILLER_AFTER); 445 if(type == PNG_COLOR_TYPE_GRAY || type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png); 446 png_read_update_info(png, info); 447 png_bytep* rows = (png_bytep*)malloc(sizeof(*rows) * (height)); 448 449 int i; 450 451 for(i = 0; i < height; i++) { 452 rows[i] = (png_byte*)malloc(png_get_rowbytes(png, info)); 453 } 454 455 png_read_image(png, rows); 456 457 for(i = 0; i < height; i++) { 458 int j; 459 for(j = 0; j < width; j++) { 460 png_bytep byte = &(rows[i][j * 4]); 461 uint32_t col = (byte[0] << 16) | (byte[1] << 8) | (byte[2]); 462 int k; 463 for(k = 0; k < BUFFERS; k++) { 464 buffers[k].ptr[buffers[k].width * i - width + j] = col; 465 } 466 } 467 } 468 469 png_destroy_read_struct(&png, &info, NULL); 470 fclose(f); 471 472 for(i = 0; i < height; i++) { 473 free(rows[i]); 474 } 475 free(rows); 476 } 477 416 478 #endif 417 479 … … 561 623 sysThreadCreate(&id, text_thread, NULL, 1500, 0x1000, THREAD_JOINABLE, "TextThread"); 562 624 printf("PS3 Bootstrap, Tewi/%s\n", tw_get_version()); 625 show_png(); 563 626 netInitialize(); 564 627 #elif defined(__ps2sdk__)
Note:
See TracChangeset
for help on using the changeset viewer.