From 18ef9f49782136111fa398e220cfd5a029ea564f Mon Sep 17 00:00:00 2001 From: Alexey 'Cluster' Avdyukhin Date: Wed, 11 Oct 2017 06:05:13 +0300 Subject: Screenshots fix, Genesis Plus core updated --- .../etc/libretro/core/genesis_plus_gx_libretro.so | Bin 2846836 -> 2702616 bytes .../libretro/info/genesis_plus_gx_libretro.info | 2 +- fbgrab-1.3/Makefile | 4 +- fbgrab-1.3/fbgrab.c | 45 ++++++++++++++++++++- retroarch.hmod/bin/fbgrab | Bin 27221 -> 31652 bytes retroarch.hmod/bin/retroarch-clover-child | 14 +++++-- retroarch.hmod/readme.txt | 2 +- 7 files changed, 58 insertions(+), 9 deletions(-) diff --git a/core_modules/genesis_plus_gx.hmod/etc/libretro/core/genesis_plus_gx_libretro.so b/core_modules/genesis_plus_gx.hmod/etc/libretro/core/genesis_plus_gx_libretro.so index acd5f64..df189af 100644 Binary files a/core_modules/genesis_plus_gx.hmod/etc/libretro/core/genesis_plus_gx_libretro.so and b/core_modules/genesis_plus_gx.hmod/etc/libretro/core/genesis_plus_gx_libretro.so differ diff --git a/core_modules/genesis_plus_gx.hmod/etc/libretro/info/genesis_plus_gx_libretro.info b/core_modules/genesis_plus_gx.hmod/etc/libretro/info/genesis_plus_gx_libretro.info index bade3cd..b84d7c6 100644 --- a/core_modules/genesis_plus_gx.hmod/etc/libretro/info/genesis_plus_gx_libretro.info +++ b/core_modules/genesis_plus_gx.hmod/etc/libretro/info/genesis_plus_gx_libretro.info @@ -8,7 +8,7 @@ systemname = "Sega 8/16-bit (Various)" database = "Sega - Game Gear|Sega - Master System - Mark III|Sega - Mega Drive - Genesis|Sega - PICO|Sega - SG-1000" license = "Non-commercial" permissions = "" -display_version = "v1.7.4" +display_version = "v1.7.5" supports_no_game = "false" firmware_count = 11 firmware0_desc = "bios_CD_E.bin (MegaCD EU BIOS)" diff --git a/fbgrab-1.3/Makefile b/fbgrab-1.3/Makefile index 4b90ac3..d81b4ad 100644 --- a/fbgrab-1.3/Makefile +++ b/fbgrab-1.3/Makefile @@ -3,8 +3,8 @@ ### modular. So this is a simple gnu Makefile... ### -NES_ROOT = /home/cluster/nesmini -LIBPNG = ../../libpng.arm +NES_ROOT = /home/cluster/nesmini-root +LIBPNG = ../../libpng ZLIB = ../../zlib CFLAGS-NES += -L$(NES_ROOT)/lib -L$(NES_ROOT)/usr/lib -I$(LIBPNG) -I$(ZLIB) -Wno-unused-function -Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3,-sysroot=$(NES_ROOT),-rpath,-nostartfiles diff --git a/fbgrab-1.3/fbgrab.c b/fbgrab-1.3/fbgrab.c index 5e4dd89..9badfad 100644 --- a/fbgrab-1.3/fbgrab.c +++ b/fbgrab-1.3/fbgrab.c @@ -295,6 +295,41 @@ static void convert8888to32(int width, int height, static void convert8888to32_crop(int width, int height, int* outWidth, int* outHeight, unsigned char *inbuffer, unsigned char *outbuffer) +{ + unsigned int i; + int minX = 160 + 32; + int maxX = 1119 - 32; + int minY = 0 + 24; + int maxY = 719 - 24; + int pixels = 0; + + for (i=0; i < (unsigned int) height*width; i++) + { + int x = i%width; + int y = i/width; + if ((minX >= 0 && x >= minX) && (maxX < 0 || x <= maxX) && (minY >= 0 && y >= minY) && (maxY < 0 || y <= maxY)) + { + /* BLUE = 0 */ + outbuffer[(pixels<<2)+Blue] = inbuffer[i*4+srcBlue]; + /* GREEN = 1 */ + outbuffer[(pixels<<2)+Green] = inbuffer[i*4+srcGreen]; + /* RED = 2 */ + outbuffer[(pixels<<2)+Red] = inbuffer[i*4+srcRed]; + /* ALPHA */ + outbuffer[(pixels<<2)+Alpha] = /*srcAlpha >= 0 ? inbuffer[i*4+srcAlpha] :*/ 0; + pixels++; + } + } + + *outWidth = maxX - minX + 1; + *outHeight = maxY - minY + 1; + fprintf(stderr, "minx=%d maxx=%d miny=%d maxy=%d\n", minX, maxX, minY, maxY); + fprintf(stderr, "width=%d height=%d\n", *outWidth, *outHeight); +} + +static void convert8888to32_crop_auto(int width, int height, int* outWidth, int* outHeight, + unsigned char *inbuffer, + unsigned char *outbuffer) { unsigned int i; int minX = -1; @@ -339,8 +374,14 @@ static void convert8888to32_crop(int width, int height, int* outWidth, int* outH *outHeight = maxY - minY + 1; fprintf(stderr, "minx=%d maxx=%d miny=%d maxy=%d\n", minX, maxX, minY, maxY); fprintf(stderr, "width=%d height=%d\n", *outWidth, *outHeight); + if (*outWidth <= 2 || *outHeight <= 2) + { + fprintf(stderr, "invalid size, trying other cropping mode\n"); + convert8888to32_crop(width, height, outWidth, outHeight, inbuffer, outbuffer); + } } + static void write_PNG(unsigned char *outbuffer, char *filename, int width, int height, int interlace, int compression) { @@ -381,7 +422,7 @@ static void write_PNG(unsigned char *outbuffer, char *filename, png_init_io(png_ptr, outfile); - png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); + png_set_compression_level(png_ptr, compression); bit_depth = 8; color_type = PNG_COLOR_TYPE_RGB_ALPHA; @@ -440,7 +481,7 @@ static void convert_and_write(unsigned char *inbuffer, char *filename, break; case 32: // convert8888to32(width, height, inbuffer, outbuffer); - convert8888to32_crop(width, height, &outWidth, &outHeight, inbuffer, outbuffer); + convert8888to32_crop_auto(width, height, &outWidth, &outHeight, inbuffer, outbuffer); write_PNG(outbuffer, filename, outWidth, outHeight, interlace, compression); break; default: diff --git a/retroarch.hmod/bin/fbgrab b/retroarch.hmod/bin/fbgrab index 8cd1883..a6fabff 100755 Binary files a/retroarch.hmod/bin/fbgrab and b/retroarch.hmod/bin/fbgrab differ diff --git a/retroarch.hmod/bin/retroarch-clover-child b/retroarch.hmod/bin/retroarch-clover-child index 11a87d6..0dd0e62 100755 --- a/retroarch.hmod/bin/retroarch-clover-child +++ b/retroarch.hmod/bin/retroarch-clover-child @@ -126,21 +126,29 @@ while [ true ]; do tp=$((ts2 - ts)) [ "$tp" -ge "$demo_time" ] && break fi + usleep 200000 done +# Screenshot! It's not so fast, doing it in a background... +if [ ! -z "$screenshot" ] && [ -z "$nosaves" ]; then + fbgrab -z 0 "$screenshot" & + sshot_pid=$! +fi + kill $rpid 2> /dev/null kill -KILL $reset_pid 2> /dev/null kill -KILL $power_pid 2> /dev/null [ ! -z "$anybutton1_pid" ] && kill -KILL $anybutton1_pid 2> /dev/null [ ! -z "$anybutton2_pid" ] && kill -KILL $anybutton2_pid 2> /dev/null +if [ ! -z "$sshot_pid" ]; then + wait $sshot_pid +fi + [ ! -z "$save" ] && mkdir -p $(dirname "$save") [ ! -z "$sram" ] && mkdir -p $(dirname "$sram") [ ! -z "$screenshot" ] && mkdir -p $(dirname "$screenshot") -# Screenshot! It's not so fast... -[ -z "$screenshot" ] || [ -z "$nosaves" ] && fbgrab -z 0 "$screenshot" - # Saves! [ ! -z "$save" ] && [ -f "$autosave" ] && [ -z "$nosaves" ] && gzip -f "$autosave" && mv -f "$autosave.gz" "$save" if [ "$corename" == "nestopia" ] && [ "$extension" == "fds" ]; then diff --git a/retroarch.hmod/readme.txt b/retroarch.hmod/readme.txt index 55a5924..e8aa0ef 100644 --- a/retroarch.hmod/readme.txt +++ b/retroarch.hmod/readme.txt @@ -1,5 +1,5 @@ === RetroArch module for hakchi === -version 0.9 +version 0.9c This is a hakchi/hakchi2 module which adds libretro cores and RetroArch frontend to your NES/SNES Mini. -- cgit v1.2.3