From 525a0f1e50380b2f7599893c210c4b0997535547 Mon Sep 17 00:00:00 2001 From: lorol Date: Wed, 1 Apr 2020 12:33:56 -0400 Subject: [PATCH] Added tool to help embedding htm file to code with one click See in /extras + improvement of rehg.c / exe and typo corrections in Readme --- extras/Readme | 6 +++--- extras/rehg.c | 9 +++------ extras/rehg.exe | Bin 2560 -> 2560 bytes src/edit.htm.gz.h | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/extras/Readme b/extras/Readme index 7c3ebfd..80ae784 100644 --- a/extras/Readme +++ b/extras/Readme @@ -1,8 +1,8 @@ ehg.c (ehg.exe): Tool to generate C-code array from file' bytes -Based on https://github.com/TheLivingOne/bin2array/ and compiled on TynyCC +Based on https://github.com/TheLivingOne/bin2array/ and compiled with TynyCC -rehg.c (rehg.exe): Tool to generate C-code array from file' bytes -Based on https://github.com/birkett/cbintools/tree/master/bin2c and compiled on TynyCC +rehg.c (rehg.exe): Tool to reverse C-code array generated by ehg.exe back to a file +Based on https://github.com/birkett/cbintools/tree/master/c2bin and compiled with TynyCC Tools used (on Win 10): diff --git a/extras/rehg.c b/extras/rehg.c index c72af51..8886b51 100644 --- a/extras/rehg.c +++ b/extras/rehg.c @@ -24,7 +24,7 @@ /* * rehg.c (rehg.exe): Tool to reverse C-code array to file converted by ehg.exe - * Based on https://github.com/birkett/cbintools/tree/master/bin2c + * Based on https://github.com/birkett/cbintools/tree/master/c2bin * and compiled with TynyCC https://bellard.org/tcc/ */ @@ -32,7 +32,7 @@ #include #include -#define BUFFER_SIZE 80 +#define BUFFER_SIZE 500 int main(int argc, char *argv[]) { @@ -92,10 +92,7 @@ int main(int argc, char *argv[]) pch = strtok(sBuffer, ","); while (pch != NULL) { - // Use atoi() to convert from decimal to a char. - //fprintf(outputFile, "%c", atoi(pch)); // decimal - fprintf(outputFile, "%c", strtol(pch, NULL, 16)); // hex - //printf("%s\n", pch); + fprintf(outputFile, "%c", strtol(pch, NULL, 0)); // autodetect pch = strtok(NULL, ","); } } diff --git a/extras/rehg.exe b/extras/rehg.exe index 06cfe4a03486b1d7662578683f05d88c3f6c7a1a..6e8e6f69b12b14702af34a64bb2ba956bda086f1 100644 GIT binary patch delta 536 zcmZn=X%LyPg3)2(N`0nZaT9MXV@#Ob$k@Wf!!((l$wFx@GXq2O5rG|y3=9k}Uo$c= zbi492A7I(3tl+>9*v%36V#?%1CT*nzureNqvUxCN96LQ>%G@WfW74h{MphQc$iT3J zfq{Xcv-Qj0|NpzeWb+Ru{$4|nWr7S03=px-gANcSuWxs|{t4Leg^__FptqIf-~ays zFD@{F9LV$f3Z~Rnh*a|r2L6`&3=9lA>bV$@bj}A$b9A=;0ox8D!Ag0-7K6AuL9XlI z*innDEd!?Q2Ur`31Z!gjIlAKi|NlGk6&w)mbA%~p`1im5e|IaxzyJTi>b*cN0$C6M z4uk-RRKN>Kum+xh9fcrcx?O(+yx@Zf?I;0>KvchY#R&2@M<>|8*UMl2|M&ktSnA|q z1_p-E&ZmuUR2Uc-CiJ?#2zZeMR?IS4j-`rGXYx#zbjBl-8CmmL>x3N`CQmM9Rp#6v U?7-0J%Clq1=7p^4Op7>}0C+&#wEzGB delta 461 zcmZn=X%LyPf{|n5N`0mniHWzCF=|Y1WNcx|V3^F#WT8~b%)romL|_La0|Ud$t&9u| z-L5>%2UvD0D>yI&c5?*2h?$(oq^+a@R>lKSmH|`7vC|W#jDPYvChhv$Od!*s%A^?? z7rogn)=ICj*+)doV< zy3Xl#odZ_N3Ubqg|NsB*$X9THI>H#HYDu^260j;4kd*=;W59k2=yqKa@InNvj3;16 zAxLMpf$NWe7n~5W9VH+kh}suV8A0K~(doM6^@f*fAge&`I(c}qJ