From af8b1d58eedfafa822981c62229884b01b805af8 Mon Sep 17 00:00:00 2001 From: xhp-creations Date: Wed, 4 Jan 2017 13:52:38 -0500 Subject: [PATCH] Change to unembedded data Change to unembedded data --- {data/sounds => channel/content}/bgMusic.ogg | Bin .../content}/button_click.mp3 | Bin channel/content/dummy | 1 - {data/fonts => channel/content}/font.ttf | Bin filelist.sh | 15 +++-------- src/main.cpp | 2 +- src/resources/filelist.h | 25 ++++++------------ 7 files changed, 12 insertions(+), 31 deletions(-) rename {data/sounds => channel/content}/bgMusic.ogg (100%) rename {data/sounds => channel/content}/button_click.mp3 (100%) delete mode 100644 channel/content/dummy rename {data/fonts => channel/content}/font.ttf (100%) diff --git a/data/sounds/bgMusic.ogg b/channel/content/bgMusic.ogg similarity index 100% rename from data/sounds/bgMusic.ogg rename to channel/content/bgMusic.ogg diff --git a/data/sounds/button_click.mp3 b/channel/content/button_click.mp3 similarity index 100% rename from data/sounds/button_click.mp3 rename to channel/content/button_click.mp3 diff --git a/channel/content/dummy b/channel/content/dummy deleted file mode 100644 index 2f259b7..0000000 --- a/channel/content/dummy +++ /dev/null @@ -1 +0,0 @@ -s \ No newline at end of file diff --git a/data/fonts/font.ttf b/channel/content/font.ttf similarity index 100% rename from data/fonts/font.ttf rename to channel/content/font.ttf diff --git a/filelist.sh b/filelist.sh index 15addd3..cbf65a3 100644 --- a/filelist.sh +++ b/filelist.sh @@ -10,7 +10,7 @@ count=0 if [[ $OSTYPE == darwin* ]]; then -for i in $(gfind ./data/images/ ./data/sounds/ ./data/fonts/ -maxdepth 1 -type f \( ! -printf "%f\n" \) | sort -f) +for i in $(gfind ./channel/content -maxdepth 1 -type f \( ! -printf "%f\n" \) | sort -f) do files[count]=$i count=$((count+1)) @@ -18,7 +18,7 @@ done else -for i in $(find ./data/images/ ./data/sounds/ ./data/fonts/ -maxdepth 1 -type f \( ! -printf "%f\n" \) | sort -f) +for i in $(find ./channel/content -maxdepth 1 -type f \( ! -printf "%f\n" \) | sort -f) do files[count]=$i count=$((count+1)) @@ -53,15 +53,6 @@ typedef struct _RecourceFile EOF -for i in ${files[@]} -do - filename=${i%.*} - extension=${i##*.} - echo 'extern const unsigned char '$filename'_'$extension'[];' >> $outFile - echo 'extern const unsigned int '$filename'_'$extension'_size;' >> $outFile - echo '' >> $outFile -done - echo 'static RecourceFile RecourceList[] =' >> $outFile echo '{' >> $outFile @@ -69,7 +60,7 @@ for i in ${files[@]} do filename=${i%.*} extension=${i##*.} - echo -e '\t{"'$i'", '$filename'_'$extension', '$filename'_'$extension'_size, NULL, 0},' >> $outFile + echo -e '\t{"'$i'", NULL, 0, NULL, 0},' >> $outFile done echo -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile diff --git a/src/main.cpp b/src/main.cpp index 59b0fc5..723499d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,7 @@ #include "utils/logger.h" #include "utils/utils.h" #include "common/common.h" - +#include "resources/Resources.h" #include "main.h" /* Entry point */ diff --git a/src/resources/filelist.h b/src/resources/filelist.h index c0f27fb..0c03516 100644 --- a/src/resources/filelist.h +++ b/src/resources/filelist.h @@ -11,27 +11,18 @@ typedef struct _RecourceFile { - const char *filename; - const u8 *DefaultFile; - const u32 &DefaultFileSize; - u8 *CustomFile; - u32 CustomFileSize; + const char *filename; + const unsigned char *DefaultFile; + const unsigned int &DefaultFileSize; + unsigned char *CustomFile; + unsigned int CustomFileSize; } RecourceFile; -extern const u8 bgMusic_ogg[]; -extern const u32 bgMusic_ogg_size; - -extern const u8 button_click_mp3[]; -extern const u32 button_click_mp3_size; - -extern const u8 font_ttf[]; -extern const u32 font_ttf_size; - static RecourceFile RecourceList[] = { - {"bgMusic.ogg", bgMusic_ogg, bgMusic_ogg_size, NULL, 0}, - {"button_click.mp3", button_click_mp3, button_click_mp3_size, NULL, 0}, - {"font.ttf", font_ttf, font_ttf_size, NULL, 0}, + {"bgMusic.ogg", NULL, 0, NULL, 0}, + {"button_click.mp3", NULL, 0, NULL, 0}, + {"font.ttf", NULL, 0, NULL, 0}, {NULL, NULL, 0, NULL, 0} };