From 8d6005f3ab1bdd7e3e84cc12c60ea3568af6cfbf Mon Sep 17 00:00:00 2001 From: julesgrc0 Date: Fri, 1 Mar 2024 14:39:55 +0100 Subject: [PATCH] add resource pack path and update resource handling --- CMakeLists.txt | 20 ++++++++++++-------- src/resource.h | 22 +++++++--------------- src/resource.rc | 3 +++ src/ressource.aps | Bin 2832 -> 0 bytes src/ressource.rc | Bin 3748 -> 0 bytes src/unpack/unpack.c | 3 +++ src/unpack/unpack.h | 3 +++ 7 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 src/resource.rc delete mode 100644 src/ressource.aps delete mode 100644 src/ressource.rc diff --git a/CMakeLists.txt b/CMakeLists.txt index c32d003..98175ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ set(SKIP_INSTALL_ALL ON CACHE BOOL "" FORCE) set(DOXYGEN_FOUND OFF CACHE BOOL "" FORCE) set(BUILD_TESTING OFF CACHE BOOL "" FORCE) +set(RESOURCE_PACK ${CMAKE_SOURCE_DIR}/tools/resource.pack) if(ANDROID) # change project name to main for libmain @@ -39,10 +40,6 @@ if(ANDROID) elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-835769") endif() - -elseif(UNIX) - # change resource output path - set(RESOURCE_FILE ${CMAKE_SOURCE_DIR}/out/resource.pack) endif() option(W_BUILD_MINSIZE "Build a smaller executable (Wispy)" OFF) @@ -67,7 +64,14 @@ endif() # add sources file(GLOB_RECURSE SOURCES "src/*.c") if(MSVC) - list(APPEND SOURCES "src/ressource.rc") + list(APPEND SOURCES "src/resource.rc") +elseif(UNIX) + add_custom_target(link_resource + COMMAND objcopy --input binary --output elf32-i386 --binary-architecture i386 ${RESOURCE_PACK} ${CMAKE_SOURCE_DIR}/src/resource.o + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + add_dependencies(${PROJECT_NAME} link_resource) + list(APPEND SOURCES "src/resource.o") endif() # add definitions @@ -107,10 +111,10 @@ if(W_BUILD_MINSIZE) endif() # copy resource.pack to output directory -if(UNIX OR ANDROID) - if(EXISTS ${CMAKE_SOURCE_DIR}/tools/resource.pack) +if(ANDROID) + if(EXISTS ${RESOURCE_PACK}) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/resource.pack ${RESOURCE_FILE} + COMMAND ${CMAKE_COMMAND} -E copy ${RESOURCE_PACK} ${RESOURCE_FILE} ) else() message(WARNING "resource.pack file not found. Skipping copying.") diff --git a/src/resource.h b/src/resource.h index 91c00eb..ea1811b 100644 --- a/src/resource.h +++ b/src/resource.h @@ -1,16 +1,8 @@ -//{{NO_DEPENDENCIES}} -// fichier Include Microsoft Visual C++. -// Utilisé par ressource.rc -// -#define IDR_ASSETS_PACK1 101 +#define IDR_ASSETS_PACK1 101 -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +#if defined(APSTUDIO_INVOKED) && !defined(APSTUDIO_READONLY_SYMBOLS) + #define _APS_NEXT_RESOURCE_VALUE 102 + #define _APS_NEXT_COMMAND_VALUE 40001 + #define _APS_NEXT_CONTROL_VALUE 1001 + #define _APS_NEXT_SYMED_VALUE 101 +#endif // APSTUDIO_INVOKED diff --git a/src/resource.rc b/src/resource.rc new file mode 100644 index 0000000..37bedd8 --- /dev/null +++ b/src/resource.rc @@ -0,0 +1,3 @@ +#include "resource.h" + +IDR_ASSETS_PACK1 RCDATA "..\\tools\\resource.pack" \ No newline at end of file diff --git a/src/ressource.aps b/src/ressource.aps deleted file mode 100644 index 85a1c1f436be01b73d0b46c89a383c990396883b..0000000000000000000000000000000000000000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pBijkL0jlokh3HYgj~zDlrM~I0B}wXWEwW>572v5s#gEI$iu}e@tN` zl5macRe#LeT46FLsiR6mDTvg#ODE*?^Pgj~*oVipFTK0OC#vpxsuG~9Z4rLQx>Rp$ zhOS_=k z?`wPHjf~~?;miI-W_Y#ogL2lD26c=Y(0>jnD!G!?zcmPATsJEp! zI@*x!=GBnh;RNfJ1IRRIio*wcs8?L7r+PRN7R)8y*DtPhAvyp9Fs@XFE5Vscq>vdz zvONVD10{eV+SxLwG#eVx7VI`O)&qtBBi*N@?SU8TeEAgaba{Mgr5YSqj1M|ru(AYT z1?a#RumKPD2;cxe5DB6I6L6u74o87d8V>l-9ZQPfN_&Y`f{ubX791M^m>%#>ohw*b zTj{(`P|E@Suw{Z!pb6~ZY#~xhO|Top01IFS^x&*+P#y+X!GZn|h$F%ONI0Uyo#S9j zgjyD~jFPT&PHF@-MgR{#Ggyt`Sb~g#e&$vkCfxxtzp_qVP`{K*B>YnWPuw5j9|`A(SG8GK|KdAN w!W;+XR`auxTO_;^4s90qyud4q^GeQEy8Kei!r5BHNOEIRVJT)IHx@Df0p;nXUH||9 diff --git a/src/ressource.rc b/src/ressource.rc deleted file mode 100644 index a92ff1965f4146742922743579f2a8327589f952..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3748 zcmdUy+in^$5QhKjN_~ed+%#$hJv;%24MHJl#6r|ckr0B=qNWgWP;dIaRbQg%H{MJL z*`)`#*~&8Zj>q=QKL-!DKdY)L(y68zX`#86^odr`E}$*7)=<}cHS~fO>7%YRqc5PZ z7{|~SjJ9vhY{Wd`%TAl>2A+zZ>It`0!&rtoWAz&Dao{aw_E+>trNC`F%Ykna_SxAr zohwmKeKpnAI}OxT47JJpOdWlIlJI+~I+PA`zu#miUUTVujMM^`#~4pQX|6BmzXBb@ zp@-J*`E8?h13e9o82TIfV~hOR244fd>Ar3Ji-(v?lzPV+tjv=p=)IqBIP!jOu|}6J z!p>Jj%_>+o(sSZq$UH*(A80=eYezZOUp|PXX~5~(R!ogKtEOYTDUGFsxakvB4g6_< zS9NH1?l+p{MkTl8;s_Bf-9?+%bN4&Hba?(IN7gWhLs1rK$KbN1L*RVXvZs_D*3)iTPrd`(axnG0KcFX76 z=6U#4A`e$|Nn4Re=H%aH_{wIA8$4;G&s!PT^3fQZTa2a6^gYxg9kb$%ZWXs;@gy{f zT)IQ;VCUGoY}WnXGefG!?)Si6%M0?`2@%=6N3huT-Pk$*&G&U1ty{Lp=ZwO79o<`@ zZZK|-==?hDQm^hZK@4&!Vz$ewjD7CNtN%*MRv#s@(}F&`yL}_&E{WdmDbc^)Q|8^v z&xYCRBkOI3-R={P(Rs+}-}$xb+g^F6S!KQZbuXp|dzLb-y{8fSyP7SFTCufrEp0rs edN(i5zR8B2-{LqH8