Skip to content

Commit

Permalink
rg_storage: Fixed miniz build outside esp-idf
Browse files Browse the repository at this point in the history
  • Loading branch information
ducalex committed Dec 18, 2024
1 parent ae1c0d3 commit 9d68956
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 1 addition & 3 deletions components/retro-go/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@
#endif
#endif

#ifdef ESP_PLATFORM
#ifndef RG_ZIP_SUPPORT
#define RG_ZIP_SUPPORT 1
#else
#define RG_ZIP_SUPPORT 0
#endif

#ifndef RG_SCREEN_PARTIAL_UPDATES
Expand Down
10 changes: 8 additions & 2 deletions components/retro-go/rg_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,11 @@ bool rg_storage_write_file(const char *path, const void *data_ptr, size_t data_l
* to do some testing to determine if the increased executable size is acceptable...
*/
#if RG_ZIP_SUPPORT

#ifdef ESP_PLATFORM
#include <rom/miniz.h>
#else
#include <miniz.h>
#endif

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

bool rg_storage_unzip_file(const char *zip_path, const char *filter, void **data_out, size_t *data_len, uint32_t flags)
{
#if RG_ZIP_SUPPORT
RG_ASSERT_ARG(data_out && data_len);
CHECK_PATH(zip_path);

Expand Down Expand Up @@ -636,8 +639,11 @@ bool rg_storage_unzip_file(const char *zip_path, const char *filter, void **data
free(decomp);
fclose(fp);
return false;
}
#else
bool rg_storage_unzip_file(const char *zip_path, const char *filter, void **data_out, size_t *data_len, uint32_t flags)
{
RG_LOGE("ZIP support hasn't been enabled!");
return false;
#endif
}
#endif
2 changes: 1 addition & 1 deletion components/retro-go/rg_surface.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "rg_system.h"
#include "rg_surface.h"
#include "lodepng.h"

#include <lodepng.h>
#include <stdlib.h>
#include <math.h>

Expand Down
4 changes: 2 additions & 2 deletions tools/build_sdl2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
CC="gcc"
# BUILD_INFO="RG:$(git describe) / SDL:$(sdl2-config --version)"
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)"
INCLUDES="-Icomponents/retro-go -Icomponents/retro-go/libs/cJSON -Icomponents/retro-go/libs/lodepng"
INCLUDES="-Icomponents/retro-go -Icomponents/retro-go/libs/cJSON -Icomponents/retro-go/libs/lodepng -Icomponents/retro-go/libs/miniz"
SRCFILES="components/retro-go/*.c components/retro-go/drivers/audio/*.c components/retro-go/fonts/*.c
components/retro-go/libs/cJSON/*.c components/retro-go/libs/lodepng/*.c"
components/retro-go/libs/cJSON/*.c components/retro-go/libs/lodepng/*.c components/retro-go/libs/miniz/*.c"
LIBS="$(sdl2-config --libs) -lstdc++"

echo "Cleaning..."
Expand Down

0 comments on commit 9d68956

Please sign in to comment.