forked from Mirror/GodMode9
Faster PNG compression, enabled separate data and function sections.
This commit is contained in:
parent
c6e3c0ee30
commit
8c121ae1d3
2
Makefile
2
Makefile
@ -32,7 +32,7 @@ export ASFLAGS := -g -x assembler-with-cpp $(INCLUDE)
|
|||||||
export CFLAGS := -DDBUILTS="\"$(DBUILTS)\"" -DDBUILTL="\"$(DBUILTL)\"" -DVERSION="\"$(VERSION)\"" -DFLAVOR="\"$(FLAVOR)\"" \
|
export CFLAGS := -DDBUILTS="\"$(DBUILTS)\"" -DDBUILTL="\"$(DBUILTL)\"" -DVERSION="\"$(VERSION)\"" -DFLAVOR="\"$(FLAVOR)\"" \
|
||||||
-g -O2 -Wall -Wextra -Wpedantic -Wcast-align -Wno-main \
|
-g -O2 -Wall -Wextra -Wpedantic -Wcast-align -Wno-main \
|
||||||
-fomit-frame-pointer -ffast-math -std=gnu11 \
|
-fomit-frame-pointer -ffast-math -std=gnu11 \
|
||||||
-Wno-unused-function $(INCLUDE)
|
-Wno-unused-function $(INCLUDE) -ffunction-sections -fdata-sections
|
||||||
export LDFLAGS := -Tlink.ld -nostartfiles -Wl,--gc-sections,-z,max-page-size=512
|
export LDFLAGS := -Tlink.ld -nostartfiles -Wl,--gc-sections,-z,max-page-size=512
|
||||||
ELF := arm9/arm9.elf arm11/arm11.elf
|
ELF := arm9/arm9.elf arm11/arm11.elf
|
||||||
|
|
||||||
|
@ -45,18 +45,18 @@ void CreateScreenshot() {
|
|||||||
|
|
||||||
png_data = PNG_Compress(buffer, snap_width, snap_height, &png_size);
|
png_data = PNG_Compress(buffer, snap_width, snap_height, &png_size);
|
||||||
|
|
||||||
if (png_data && png_size)
|
if (png_data && png_size) {
|
||||||
fvx_qwrite(filename, png_data, 0, png_size, NULL);
|
fvx_qwrite(filename, png_data, 0, png_size, NULL);
|
||||||
else
|
|
||||||
ShowPrompt(false, "Failed to write screenshot!");
|
|
||||||
|
|
||||||
// "snap effect"
|
// "snap effect"
|
||||||
memcpy(buffer_b, BOT_SCREEN, SCREEN_SIZE_BOT);
|
memcpy(buffer_b, BOT_SCREEN, SCREEN_SIZE_BOT);
|
||||||
memcpy(buffer_t, TOP_SCREEN, SCREEN_SIZE_TOP);
|
memcpy(buffer_t, TOP_SCREEN, SCREEN_SIZE_TOP);
|
||||||
memset(BOT_SCREEN, 0, SCREEN_SIZE_BOT);
|
memset(BOT_SCREEN, 0, SCREEN_SIZE_BOT);
|
||||||
memset(TOP_SCREEN, 0, SCREEN_SIZE_TOP);
|
memset(TOP_SCREEN, 0, SCREEN_SIZE_TOP);
|
||||||
memcpy(BOT_SCREEN, buffer_b, SCREEN_SIZE_BOT);
|
memcpy(BOT_SCREEN, buffer_b, SCREEN_SIZE_BOT);
|
||||||
memcpy(TOP_SCREEN, buffer_t, SCREEN_SIZE_TOP);
|
memcpy(TOP_SCREEN, buffer_t, SCREEN_SIZE_TOP);
|
||||||
|
}
|
||||||
|
// what to do on error...?
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if (png_data) free(png_data);
|
if (png_data) free(png_data);
|
||||||
|
@ -23,6 +23,10 @@ freely, subject to the following restrictions:
|
|||||||
distribution.
|
distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modified version by Wolfvak for github.com/d0k3/GodMode9 (changed encoder default settings)
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The manual and changelog are in the header file "lodepng.h"
|
The manual and changelog are in the header file "lodepng.h"
|
||||||
Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for C.
|
Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for C.
|
||||||
@ -2268,7 +2272,7 @@ static unsigned zlib_compress(unsigned char** out, size_t* outsize, const unsign
|
|||||||
#ifdef LODEPNG_COMPILE_ENCODER
|
#ifdef LODEPNG_COMPILE_ENCODER
|
||||||
|
|
||||||
/*this is a good tradeoff between speed and compression ratio*/
|
/*this is a good tradeoff between speed and compression ratio*/
|
||||||
#define DEFAULT_WINDOWSIZE 2048
|
#define DEFAULT_WINDOWSIZE 64
|
||||||
|
|
||||||
void lodepng_compress_settings_init(LodePNGCompressSettings* settings)
|
void lodepng_compress_settings_init(LodePNGCompressSettings* settings)
|
||||||
{
|
{
|
||||||
@ -2276,16 +2280,16 @@ void lodepng_compress_settings_init(LodePNGCompressSettings* settings)
|
|||||||
settings->btype = 2;
|
settings->btype = 2;
|
||||||
settings->use_lz77 = 1;
|
settings->use_lz77 = 1;
|
||||||
settings->windowsize = DEFAULT_WINDOWSIZE;
|
settings->windowsize = DEFAULT_WINDOWSIZE;
|
||||||
settings->minmatch = 3;
|
settings->minmatch = 6;
|
||||||
settings->nicematch = 128;
|
settings->nicematch = 32;
|
||||||
settings->lazymatching = 1;
|
settings->lazymatching = 0;
|
||||||
|
|
||||||
settings->custom_zlib = 0;
|
settings->custom_zlib = 0;
|
||||||
settings->custom_deflate = 0;
|
settings->custom_deflate = 0;
|
||||||
settings->custom_context = 0;
|
settings->custom_context = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 3, 128, 1, 0, 0, 0};
|
const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 6, 32, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
|
||||||
#endif /*LODEPNG_COMPILE_ENCODER*/
|
#endif /*LODEPNG_COMPILE_ENCODER*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user