Skip to content

Commit 9d68956

Browse files
committed
rg_storage: Fixed miniz build outside esp-idf
1 parent ae1c0d3 commit 9d68956

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

components/retro-go/config.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,8 @@
135135
#endif
136136
#endif
137137

138-
#ifdef ESP_PLATFORM
138+
#ifndef RG_ZIP_SUPPORT
139139
#define RG_ZIP_SUPPORT 1
140-
#else
141-
#define RG_ZIP_SUPPORT 0
142140
#endif
143141

144142
#ifndef RG_SCREEN_PARTIAL_UPDATES

components/retro-go/rg_storage.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,11 @@ bool rg_storage_write_file(const char *path, const void *data_ptr, size_t data_l
506506
* to do some testing to determine if the increased executable size is acceptable...
507507
*/
508508
#if RG_ZIP_SUPPORT
509+
510+
#ifdef ESP_PLATFORM
509511
#include <rom/miniz.h>
512+
#else
513+
#include <miniz.h>
510514
#endif
511515

512516
#define ZIP_MAGIC 0x04034b50
@@ -530,7 +534,6 @@ typedef struct __attribute__((packed))
530534

531535
bool rg_storage_unzip_file(const char *zip_path, const char *filter, void **data_out, size_t *data_len, uint32_t flags)
532536
{
533-
#if RG_ZIP_SUPPORT
534537
RG_ASSERT_ARG(data_out && data_len);
535538
CHECK_PATH(zip_path);
536539

@@ -636,8 +639,11 @@ bool rg_storage_unzip_file(const char *zip_path, const char *filter, void **data
636639
free(decomp);
637640
fclose(fp);
638641
return false;
642+
}
639643
#else
644+
bool rg_storage_unzip_file(const char *zip_path, const char *filter, void **data_out, size_t *data_len, uint32_t flags)
645+
{
640646
RG_LOGE("ZIP support hasn't been enabled!");
641647
return false;
642-
#endif
643648
}
649+
#endif

components/retro-go/rg_surface.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "rg_system.h"
22
#include "rg_surface.h"
3-
#include "lodepng.h"
43

4+
#include <lodepng.h>
55
#include <stdlib.h>
66
#include <math.h>
77

tools/build_sdl2.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
CC="gcc"
77
# BUILD_INFO="RG:$(git describe) / SDL:$(sdl2-config --version)"
88
CFLAGS="-no-pie -DRG_TARGET_SDL2 -DRETRO_GO -DCJSON_HIDE_SYMBOLS -DSDL_MAIN_HANDLED=1 -DRG_BUILD_INFO=\"SDL2\" -Dapp_main=SDL_Main $(sdl2-config --cflags)"
9-
INCLUDES="-Icomponents/retro-go -Icomponents/retro-go/libs/cJSON -Icomponents/retro-go/libs/lodepng"
9+
INCLUDES="-Icomponents/retro-go -Icomponents/retro-go/libs/cJSON -Icomponents/retro-go/libs/lodepng -Icomponents/retro-go/libs/miniz"
1010
SRCFILES="components/retro-go/*.c components/retro-go/drivers/audio/*.c components/retro-go/fonts/*.c
11-
components/retro-go/libs/cJSON/*.c components/retro-go/libs/lodepng/*.c"
11+
components/retro-go/libs/cJSON/*.c components/retro-go/libs/lodepng/*.c components/retro-go/libs/miniz/*.c"
1212
LIBS="$(sdl2-config --libs) -lstdc++"
1313

1414
echo "Cleaning..."

0 commit comments

Comments
 (0)