Skip to content

Commit 18ef9f4

Browse files
committed
Screenshots fix, Genesis Plus core updated
1 parent cb8a48d commit 18ef9f4

File tree

7 files changed

+58
-9
lines changed

7 files changed

+58
-9
lines changed
Binary file not shown.

core_modules/genesis_plus_gx.hmod/etc/libretro/info/genesis_plus_gx_libretro.info

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ systemname = "Sega 8/16-bit (Various)"
88
database = "Sega - Game Gear|Sega - Master System - Mark III|Sega - Mega Drive - Genesis|Sega - PICO|Sega - SG-1000"
99
license = "Non-commercial"
1010
permissions = ""
11-
display_version = "v1.7.4"
11+
display_version = "v1.7.5"
1212
supports_no_game = "false"
1313
firmware_count = 11
1414
firmware0_desc = "bios_CD_E.bin (MegaCD EU BIOS)"

fbgrab-1.3/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
### modular. So this is a simple gnu Makefile...
44
###
55

6-
NES_ROOT = /home/cluster/nesmini
7-
LIBPNG = ../../libpng.arm
6+
NES_ROOT = /home/cluster/nesmini-root
7+
LIBPNG = ../../libpng
88
ZLIB = ../../zlib
99

1010
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

fbgrab-1.3/fbgrab.c

+43-2
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,41 @@ static void convert8888to32(int width, int height,
295295
static void convert8888to32_crop(int width, int height, int* outWidth, int* outHeight,
296296
unsigned char *inbuffer,
297297
unsigned char *outbuffer)
298+
{
299+
unsigned int i;
300+
int minX = 160 + 32;
301+
int maxX = 1119 - 32;
302+
int minY = 0 + 24;
303+
int maxY = 719 - 24;
304+
int pixels = 0;
305+
306+
for (i=0; i < (unsigned int) height*width; i++)
307+
{
308+
int x = i%width;
309+
int y = i/width;
310+
if ((minX >= 0 && x >= minX) && (maxX < 0 || x <= maxX) && (minY >= 0 && y >= minY) && (maxY < 0 || y <= maxY))
311+
{
312+
/* BLUE = 0 */
313+
outbuffer[(pixels<<2)+Blue] = inbuffer[i*4+srcBlue];
314+
/* GREEN = 1 */
315+
outbuffer[(pixels<<2)+Green] = inbuffer[i*4+srcGreen];
316+
/* RED = 2 */
317+
outbuffer[(pixels<<2)+Red] = inbuffer[i*4+srcRed];
318+
/* ALPHA */
319+
outbuffer[(pixels<<2)+Alpha] = /*srcAlpha >= 0 ? inbuffer[i*4+srcAlpha] :*/ 0;
320+
pixels++;
321+
}
322+
}
323+
324+
*outWidth = maxX - minX + 1;
325+
*outHeight = maxY - minY + 1;
326+
fprintf(stderr, "minx=%d maxx=%d miny=%d maxy=%d\n", minX, maxX, minY, maxY);
327+
fprintf(stderr, "width=%d height=%d\n", *outWidth, *outHeight);
328+
}
329+
330+
static void convert8888to32_crop_auto(int width, int height, int* outWidth, int* outHeight,
331+
unsigned char *inbuffer,
332+
unsigned char *outbuffer)
298333
{
299334
unsigned int i;
300335
int minX = -1;
@@ -339,8 +374,14 @@ static void convert8888to32_crop(int width, int height, int* outWidth, int* outH
339374
*outHeight = maxY - minY + 1;
340375
fprintf(stderr, "minx=%d maxx=%d miny=%d maxy=%d\n", minX, maxX, minY, maxY);
341376
fprintf(stderr, "width=%d height=%d\n", *outWidth, *outHeight);
377+
if (*outWidth <= 2 || *outHeight <= 2)
378+
{
379+
fprintf(stderr, "invalid size, trying other cropping mode\n");
380+
convert8888to32_crop(width, height, outWidth, outHeight, inbuffer, outbuffer);
381+
}
342382
}
343383

384+
344385
static void write_PNG(unsigned char *outbuffer, char *filename,
345386
int width, int height, int interlace, int compression)
346387
{
@@ -381,7 +422,7 @@ static void write_PNG(unsigned char *outbuffer, char *filename,
381422

382423
png_init_io(png_ptr, outfile);
383424

384-
png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
425+
png_set_compression_level(png_ptr, compression);
385426

386427
bit_depth = 8;
387428
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
@@ -440,7 +481,7 @@ static void convert_and_write(unsigned char *inbuffer, char *filename,
440481
break;
441482
case 32:
442483
// convert8888to32(width, height, inbuffer, outbuffer);
443-
convert8888to32_crop(width, height, &outWidth, &outHeight, inbuffer, outbuffer);
484+
convert8888to32_crop_auto(width, height, &outWidth, &outHeight, inbuffer, outbuffer);
444485
write_PNG(outbuffer, filename, outWidth, outHeight, interlace, compression);
445486
break;
446487
default:

retroarch.hmod/bin/fbgrab

4.33 KB
Binary file not shown.

retroarch.hmod/bin/retroarch-clover-child

+11-3
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,29 @@ while [ true ]; do
126126
tp=$((ts2 - ts))
127127
[ "$tp" -ge "$demo_time" ] && break
128128
fi
129+
usleep 200000
129130
done
130131

132+
# Screenshot! It's not so fast, doing it in a background...
133+
if [ ! -z "$screenshot" ] && [ -z "$nosaves" ]; then
134+
fbgrab -z 0 "$screenshot" &
135+
sshot_pid=$!
136+
fi
137+
131138
kill $rpid 2> /dev/null
132139
kill -KILL $reset_pid 2> /dev/null
133140
kill -KILL $power_pid 2> /dev/null
134141
[ ! -z "$anybutton1_pid" ] && kill -KILL $anybutton1_pid 2> /dev/null
135142
[ ! -z "$anybutton2_pid" ] && kill -KILL $anybutton2_pid 2> /dev/null
136143

144+
if [ ! -z "$sshot_pid" ]; then
145+
wait $sshot_pid
146+
fi
147+
137148
[ ! -z "$save" ] && mkdir -p $(dirname "$save")
138149
[ ! -z "$sram" ] && mkdir -p $(dirname "$sram")
139150
[ ! -z "$screenshot" ] && mkdir -p $(dirname "$screenshot")
140151

141-
# Screenshot! It's not so fast...
142-
[ -z "$screenshot" ] || [ -z "$nosaves" ] && fbgrab -z 0 "$screenshot"
143-
144152
# Saves!
145153
[ ! -z "$save" ] && [ -f "$autosave" ] && [ -z "$nosaves" ] && gzip -f "$autosave" && mv -f "$autosave.gz" "$save"
146154
if [ "$corename" == "nestopia" ] && [ "$extension" == "fds" ]; then

retroarch.hmod/readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=== RetroArch module for hakchi ===
2-
version 0.9
2+
version 0.9c
33

44
This is a hakchi/hakchi2 module which adds libretro cores and RetroArch frontend to your NES/SNES Mini.
55

0 commit comments

Comments
 (0)