Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Efficient binary objects embedding in AHK code - ASCII 85


  • Please log in to reply
25 replies to this topic
Azerty
  • Members
  • 72 posts
  • Last active: Jan 16 2009 10:08 AM
  • Joined: 19 Dec 2006
Hi all

So here it is at last... Please read full (huge) post before asking...

With the library Ascii85, you can embed binary data into your AHK code at lower cost in size, and with the high speed of native assembly programming, thus allowing you to not use external references for eg icons, bitmaps, or any other ressource you might imagine. Explanation of ASCII85 code is there.

/*
    AHK Ascii 85 encoder/decoder - v1.0
    Recommanded fileName : Ascii85.ahk
    Author : LHdx 2008/03
    Permission is granted to use copy for commercial or non commercial use provided credit to author is explicitely given.

    USE AT YOUR OWN RISKS !

    Base reference : http://www.autohotkey.com/forum/viewtopic.php?t=21172

    Usage :
    1) Preliminary : needs MCode.ahk (see http://www.autohotkey.com/forum/viewtopic.php?p=180448#180448)
    2) To encode, either directly call Encoder() or call AhkEncoder()
    3) To decode, if you know the source you want to encode, you can call directly Decoder() but in this procedure there is strictly
       no check to protect from crash ! Or you can call DecodeSize() first to help you identify needed memory allocation and validity of
       source ASCII85 code, then allocate accordingly and finally call Decoder(). Or forget all this stuff and call AhkDecoder().
    4) Complements :
        * The low level code is BY DESIGN not Adobe compliant. To make it adobe-compliant for Encoder(), you must either prepend "<~" and
          append "~>" to text after calling Encoder(), or use high level AhkEncode(). If you wish to decode adobe-compliant ASCII85, you
          muse either remove manually <~~> *before* calling DecoderSize()/Decoder(). Failure to do so results in ASCII85 code
          not being decoded (since ~ is invalid in ASCII85).
        * This code does not support v4.2 extesion ('y' token to replace a 4 spaces block). You can have a workaround by replacing
          every "y" by "+<VdL" which is the encoding for 4 spaces using StringReplace.
        * The DecoderSize() and Decoder() both accept spaces in source ASCII85 buffer, where spaces are ' ', CR, LF. 
        * Low level functions are not fully AHK-ready to enable their use not only to embed code, but to be able to use ASCII85
          for other general purposes.
*/

; -=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-
;  High level functions
; -=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-

/*
  Ascii85_AhkEncoder(ByRef SourceText, SourceSize, ByRef DestinationMemory, NbBytesPerLine=70, UseAdobeEncoding=0)
  Input :
    SourceText : variable containing binary data to encode (must be a variable)
    SourceSize : number of bytes to encode
    DestinationMemory : variable where encoded data will be stored. (Re-)Allocation is automatic
    NbBytesPerLine : will specify how many bytes to store in each line, lines will be separated by CR/LF. you may specify 0xFFFFFFFF to
      have no line break in output buffer.
    UseAdobeEncoding (optional) : specifies, if not 0, that we want the Adobe ASCII85 prefix and suffix in encoded data.
      In this case, for 1st and last lines of ASCII85 encoded data might be slightly larger than NbBytesPerLine.
  Output :
    Returns the number of bytes really stored into DestinationMemory
  Comments :
    This function should be safe
*/

Ascii85_AhkEncoder(ByRef SourceText, SourceSize, ByRef DestinationMemory, NbBytesPerLine=70, UseAdobeEncoding=0)
{
    Delta:=0 ; Dunno why this one is needed here, but is missing, bad results !
    MemNeeded := ((SourceSize + 3) // 4) * 5
    If (NbBytesPerLine)
        MemNeeded += (MemNeeded + NbBytesPerLine - 1) // NbBytesPerLine * 2 + 1 ; add 1 for trailing '\0'
    If (UseAdobeEncoding) {
        MemNeeded += 4
        Delta := 2
    }
    VarSetCapacity(DestinationMemory, MemNeeded)
    TotalBytes:=Ascii85_Encoder(&SourceText, SourceSize, &DestinationMemory + Delta, NbBytesPerLine)
    If (UseAdobeEncoding) {
        NumPut(0x7E3C, DestinationMemory, 0, "UShort")
        NumPut(0x3E7E, DestinationMemory, TotalBytes+Delta, "UShort")
    }
    NumPut(0, DestinationMemory, TotalBytes + Delta * 2, "UChar")
    VarSetCapacity(DestinationMemory, -1)
    Return TotalBytes + Delta * 2
}

/*
  Ascii85_AhkEmbedParser(ByRef SourceText, ByRef DestinationMemory)
  Input :
    SourceText : variable containing ASCII 85 encoded data
    SourceSize : number of bytes to encode
    DestinationMemory : variable where parsed data will be stored
  Output :
    none
  Comments :
    Use this function on data you just encoded to be able to copy/paste it into your AHK code
    This is mandatory to avoid AHK (tested : v1.0.47.5) complaining about mismatched '%', excessive ',' or invalid text after ')' in
    a continuation section.
*/
Ascii85_AhkEmbedParser(ByRef SourceText, ByRef DestinationMemory)
{
    StringReplace, DestinationMemory, SourceText, ``, ````, All
    StringReplace, DestinationMemory, DestinationMemory, `%, ```%, All
    StringReplace, DestinationMemory, DestinationMemory, `), ```), All
}

; -=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-

/*
  Ascii85_AhkDecoder(ByRef SourceText, ByRef DestinationMemory, SourceSize, NbBytesPerLine=70, UseAdobeEncoding=0)
  Input :
    SourceText : variable containing ASCI85 data to decode (must be a variable)
    DestinationMemory : variable where binary data will be stored. (Re-)Allocation is automatic
    SourceSize (optional) : number of bytes to decode. If missing, SourceText *must* be zero-terminated
  Output :
    Returns the number of bytes really stored into DestinationMemory
  Comments :
    This function should be safe
*/

Ascii85_AhkDecoder(ByRef SourceText, ByRef DestinationMemory, SourceSize=0xFFFFFFFF)
{
    BaseAddress := &SourceText
    If (NumGet(SourceText, 0, "UShort") = 0x7E3C) {
        ; We must check size if we don't have it : decoder doesn't recognize Adobe's pre/post-fixes so we'll remove them now
        If (SourceSize = 0xFFFFFFFF)
            SourceSize := StrLen(SourceText)
        If (NumGet(SourceText, SourceSize - 2, "UShort") = 0x3E7E) {
            BaseAddress += 2
            SourceSize -= 4
        }
    }
    Result := Ascii85_DecoderSize(BaseAddress, SourceSize)
    If (Result = 0 || Result >= 0xFFFFFFFE)
        Return Result
    VarSetCapacity(DestinationMemory, Result)
    Return % Ascii85_Decoder(BaseAddress, SourceSize, &DestinationMemory)
}

; -=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-
;  Low level functions
; -=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-

/*
  Ascii85_Encoder(SourceText, SourceSize, DestinationMemory, NbBytesPerLine)
  Input :
    SourceText : pointer to memory containing binary data to encode
    SourceSize : number of bytes to encode
    DestinationMemory : pointer to memory where encoded data will be put (must be pre-allocated with VarSetCapacity, for instance)
    NbBytesPerLine : will specify how many bytes to store in each line, lines will be separated by CR/LF. you may specify 0xFFFFFFFF to
      have no line break in output buffer.
  Output :
    Returns the number of bytes really stored into DestinationMemory
  Comments :
    WARNING : no capacity check is made on Output, so be sure memory buffer is large enough. For S source size reserve at least
    M0=I((S+3)/4)*5) where I means integral part (drop comma) [note : let x,n integers, (x+n-1)/n <=> x/n rounded up].
    To add line breaks every N chars, reserve (total) M0+I((M0+N-1)/N)*2
    If you whish to add C trailing '\0', reserve one more.
    If you wish to inject data into Adobe format, reserve 4 bytes more for header "<~" and trailer "~>", and add 2 to &DestinationMemory
    during Encoder() call.
*/

Ascii85_Encoder(SourceText, SourceSize, DestinationMemory, NbBytesPerLine)
{
    Static lMcode
    if (!lMcode) {
        lHcode := "60e81a0000000100000055000000391c0000ed5e0900b1841c030203041810085b89e583c51c83ec048b45148945e0fc8b75088b7d108b4d0c09c9745d83f904"
        lHcode := lHcode . "7231ad0fc809c0750cb07ae86a000000e9190000005131c9b10583c31483eb0431d2f733e84f00000089d0e2f05983e904ebc651c1e008ace2fa59518a4c0b16"
        lHcode := lHcode . "d3e0598a4c0b1383c31483eb0431d2f733e82200000089d0e2f08b451483f8ff740b3b45e0740666b80d0a66ab2b7d10897d0083c40461c30421aa8b45e083e8"
        lHcode := lHcode . "01750966b80d0a66ab8b45148945e0c3"
        MCode(lMcode, lHcode)
    }
    Return DllCall(&lMcode, "UInt", SourceText, "UInt", SourceSize, "UInt", DestinationMemory, "UInt", NbBytesPerLine, "cdecl UInt")
}

; -=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-

/*
  Ascii85_DecoderSize(SourceText, SourceSize)
  Input :
    SourceText : ASCII data to bring back to binary
    SourceSize : number of ASCII char to decode
  Output :
    -2 if the code is not pure ASCII85
    -1 if there is a problem while decoding (incomplete last block, for instance)
    >=0 is the size of memory buffer needed to decode the source file given.
  Comments :
    Call this function if unsure of decoded result size or validity. If you trust the source (you made the encoding yourself), you can
    skip this function and directly call Decoder() using the right data and rightly allocated memory buffer for destination.
*/

Ascii85_DecoderSize(SourceText, SourceSize)
{
    Static lMcode
    if (!lMcode) {
        lHcode := "608b6c240c83ed0431d231c9fc8b750809f6744b8b5d0ce84d00000074353c7a750583c204ebf0b1053c2172123c75770ee833000000e0f1740f83c204ebdfbafeffffffe9"
        lHcode := lHcode . "1b00000080f904741183c20429ca09db740d8b5d0c83fbff7405baffffffff89550061c309db7416ac4b08c074103c2074f23c0974ee3c0d74ea3c0a74e6c3"
        MCode(lMcode, lHcode)
    }
    Return DllCall(&lMcode, "UInt", SourceText, "UInt", SourceSize, "cdecl UInt")
}

; -=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-

/*
  Ascii85_Decoder(SourceText, SourceSize, DestinationMemory)
  Input :
    SourceText : ASCII data to bring back to binary
    SourceSize : number of ASCII char to decode
    DestinationMemory : pointer to memory where decoded binary data will be put (must be pre-allocated with VarSetCapacity, for instance)
  Output :
    The number of bytes written in DestinationMemory.
  Comments :
    Call this function using a large enough buffer for MemoryDestination - use DecoderSize if you're unsure of the buffer capacity needed.
    Decoder() does no check and can therefor crash AHK if misused (invalid input buffer or insufficient allocation for DestinationMemory).
    The functions have been separated only for those who know exactly what they do to be able to achieve higher decoding speed.
*/

Ascii85_Decoder(SourceText, SourceSize, DestinationMemory)
{
    Static lMcode
    if (!lMcode) {
        lHcode := "608b6c240c83ed0431d231c9fc8b75088b7d108b5d0c31c0e84f00000074453c7a750531c0abebeeb1042c2189c231c0e83700000074132c215031c0b055f7e25a01d0e2"
        lHcode := lHcode . "e70fc8abebcc5131c0b055f7e283c05489c2e2f359f7d983c104c1c008aae2fa2b7d10897d0061c309db7416ac4b08c074103c2074f23c0974ee3c0d74ea3c0a74e6c3"
        MCode(lMcode, lHcode)
    }
    Return DllCall(&lMcode, "UInt", SourceText, "UInt", SourceSize, "UInt", DestinationMemory, "cdecl UInt")
}

To run this library, you'll need the MCode library (here's mine ASM coded, or the original AHK one posted by Lazslo there).

To achieve the highest possible efficency, use "low level" functions. To simplify your code at most without needing to worry, use "high level" functions.

There are samples both for encoding and for decoding, using either low level or high level. For full documentation, read inside source code.

Low level encoding :
; Find it here...
#include Ascii85.ahk

; Find it at http://www.autohotkey.com/forum/viewtopic.php?p=44718#44718
#include BinReadWrite.ahk

; Here starts the sample
; We need the following "standard" libraries :
;  - MCode : http://www.autohotkey.com/forum/viewtopic.php?p=180448#180448 or http://www.autohotkey.com/forum/viewtopic.php?p=135302#135302
;  - PhilLo's binary files routines : http://www.autohotkey.com/forum/viewtopic.php?p=44718#44718
;  - (of course) Ascii85

LineLength=70

; read PNG
VarSetCapacity(Input, 100000)
h:=OpenFileForRead("AutoHotkey_logo.png") ; file taken at http://www.autohotkey.com/docs/images/AutoHotkey_logo.gif
BinarySize:=ReadFromFile(h, Input, 0, FILE_BEGIN)
CloseFile(h)

; compute converted size
neededmemory := (BinarySize+3)/4*5 ; Cost of BIN->ASCII85 conversion
neededmemory += (neededmemory + LineLength - 1) / LineLength * 2 ; Cost of adding CR/LF if wanted
neededmemory += 5 ; if you want to add Adobe 'prefix "<~" and postfix "~>" and string ending \0

; allocate memory
VarSetCapacity(Output,neededmemory)

; convert PNG to ASCII85
OutputSize:=Ascii85_Encoder(&Input, BinarySize, &Output, LineLength)

; append '\0' and inform AHK of text size
NumPut(0, Output, OutputSize, "char")
VarSetCapacity(Output, -1)

; convert to enable AHK inlining
Ascii85_AhkEmbedParser(Output, Output)

; Write ASCII85 conversion of png
FileDelete, logo.asc
FileAppend, %Output%, logo.asc

High level encoding :
; Find it here...
#include Ascii85.ahk

; Find it at http://www.autohotkey.com/forum/viewtopic.php?p=44718#44718
#include BinReadWrite.ahk

; Here starts the sample
; We need the following libraries :
;  - MCode : http://www.autohotkey.com/forum/viewtopic.php?p=180448#180448 or http://www.autohotkey.com/forum/viewtopic.php?p=135302#135302
;  - PhilLo's binary files routines : http://www.autohotkey.com/forum/viewtopic.php?p=44718#44718
;  - (of course) Ascii85

LineLength=70

; read PNG
VarSetCapacity(Input, 100000)
h:=OpenFileForRead("AutoHotkey_logo.png") ; file taken at http://www.autohotkey.com/docs/images/AutoHotkey_logo.gif
BinarySize:=ReadFromFile(h, Input, 0, FILE_BEGIN)
CloseFile(h)

; convert it
OutputSize:=Ascii85_AhkEncoder(Input, BinarySize, Output, LineLength)

; convert to enable AHK inlining
Ascii85_AhkEmbedParser(Output, Output)

; Write ASCII85 conversion of png
FileDelete, logo.asc
FileAppend, %Output%, logo.asc

Low level decoding and use :
#include Ascii85.ahk

; This one is AHK's, snapshoted out of forum main page - Hope Chris won't fire me out of forum :-)
Logo =
(
	M,6r;`%14!\!!!!.8Ou6I!!!#[!!!"Q#Qk&,!.5rc5QCcd!`)Q?g75ct\<26sqdF_p2``ocaT
	EP0\6CMT$amtQ(n^<"B;ZFn?5k+&0<6^4[nda6/(pTqos<`%[email protected]>&703N0^!-UrfX<
	XH/CRFaJJC\@-e`)[email protected]>YVBs8Um7jT#8\zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
	zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
	zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz!2h:Q#64
	``($#iF<ErZ1J&c_n>&cpG:If'0G`)K/285u``*!m9L*0UH#GOG\`%.58P*2("6':[bGul0``ho
	/[email protected]/Yq.SU\Gm`)(_s\Y^Y:0E"OO[FHs0$sSWjt!`)IXLY"[email protected]/$JnHj
	\*aD1,Lha$sk_77<E2V>b\,T3O>Af-'[email protected][[email protected]`)^t#j*"DE1I7sSt_dfVBlTd
	pej'[[email protected]+3;0k1.&`)7"V+;5!e``eacqYbCF<_*`)W0GCZd_oB``"bW!07h`%(,Cb<IGgD2`%Q
	,<cNdTi1W3\B5hgH!>_LW?opDQGcmf!.O;/_5+aD8Qpj+?m0F>lGJh4Y(P^b7*C;lD;rJa
	3!B(TpP>gEF]W!'$bq.Fph`%fD/+X*`%0LGU=9"-ncm9^?#\E'@W*jRn":m_a`)'>*RF43"_`%
	[HrFEFl2J5uu*p:YD&K$nO5`%:*J#\;Jn2!q7D$(nUh(a[6Mi[[email protected]\HUR!OMD`%28k!!rkX
	m"`%$36^VZnWGhr]2GRZ14=1GM_#,<&.JB]pO!jmNGbp>3`%VdKDdnb+Ol([U;Qr[+>T!3?n
	kN,W$(S4:VUF-ci=Q]GH/SY4'H$gh=0b4XV108,Uh_G"P4/``=k[c`%:6db`%[email protected]@jFEu>Oc[
	ePNXS_c8l3Z"2XH[hZd(8D-pF4``[email protected]<DWUnUi\]i&V76ZL6i`)C,hNd$b
	T+;pSIL:"92nH`%`%?d.QAQ7jU-7=SMuc``[email protected]>3\!E?l=CqL^l<m:N":VF:@nRHKof``#;
	][email protected]&n!#O;03_(X.Cq!>,#sQTf(@.A5X`%`)'1d!0*/V,Xl.`)Z5RqH?PH(.V[UJ8m$+C
	jam>heW4[*F``W*^#2;0Ll1KA;b(f(hQb3A-Lp=omk"_DiXgNj.jWiThOk!#]6Kn,#UMq`%H
	'2!KGBThY>$Hg5Kk7\tPXNH&Q6b6!tKlpWcBSn$FK.frQL,,E$i^&G\=/0``sI;+P[.<>^``
	p+lV0](ZftDd*1/[email protected]"A4+KZ0`)D6E(_tQnU3Cdj$?:nc"eT2&PV:B./fT6>`%k2ca\]
	5TfsMhGP7(lF!"tur#7X=>LTHP^+/Aj4OL3":3==qNT.SN?8tmpq?LJ^PXcFLOb8^qTPan
	3!2M^u,+6a<h&Bjijk4J,[JKG'[email protected]^pu2:UC1.!Z+AN`%!LV1HYq52J'P^Kg;A
	!q,GpHgF#4gFq=dY["$fme#[email protected]"`%[email protected]"PlTb'[k+o1dR?<(
	B8HOsd!?\8O:GN$>]K`%r\/R]7dSG`%h3$V85jjPUh<d8:T^6QK7'>a^iP0;lAsoa!^X5B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018;^ptF&4MHjY^?R3=[^7oS6hpY(9I2Zf:7*[email protected]`)7q4j=l`%!L6OBV"l-sok=`%,
	9KM.W9ubLW&N3eh/hkC8M\d9s*FngTOd\-:'63^O+]Ngr(p26p`%ladEW6S&:_&TN9=qPli
	a:mZVjI>JG1tE&uO>F"NGu#bK?m\^uR9-\jm.f!`%[email protected]`)69+Hp`)O=u``*[Qc4-Ah9>
	sAT\LJGE[#&ZMXGfGniXh:N#B7E.HLkp\b2e2gZ_$n1sdQ0QK9JeM]eQ?RP,tnb(4qFGAi
	n^(``5a,.`%q[[email protected]$enp>[&6:gEg<<;gh175Eeajfd3?iK40&0N--Tqh035;ck(q0lG0[PuG
	`%G1.m-<(j/G;KLr*k-Dsu0JORp>-qDc!`)fjdTK152ib-+jMEd"F]Bh8B4n>4*&\@9A":=O
	fVS_d7fUrgX<R[ic\GCWoT-ROsM-!R+8F.s>r/!C7`)3dI0`).$7k'.A#f]j*.*!m$oc#M:e
	Ne-&Q+lCXY^jks^e<1iG#@&635h/eqNd+NML1`)9BE-n``W#7c5T=>YYZqt>j!O=W+8mb6Vj
	406CnAEE,N&Mnr/='SFSeaOb2-"=]ZLg2:Y[tnQa$*!+ZtN"/d\p.8BqUO:!_U5IntH``]W
	@ub``f?54=$+Rc,J!Ej8M!^2YbVFnC&<RE3pL$j4H2``Q/a9&'0gL``4i1!laMs5`%G&+$QoIS
	V5V*d0oFH]\*#q\Y^8r^`)\`)X1&M+[HjG8Ng+aH5gpK]sm6Yd<Jc\T5P^X`%S\``55'^lQ:C3
	[email protected]#`)gNc</0JTD/cdj(&3#F\&W&[OO>s*1"`%Ghd51kHO2&4_&P7RINaUo2#[email protected][email protected]'G7e``
	l/3D[G#i?p/c998VB!``Kt]gLLA:VF5pZYh#[email protected]'qAQf2jbi>a-?R(J`)``Jc/X16/;[email protected]
	S!8``$u`%`%3RH$XsUJVeg1!mehY$'8JtmA/[email protected],[email protected]?hqf5t_p<H.9$9.&u+,mB(^/6
	^'Yr"al,?Jc7((/[email protected]:LCjp.8#7a?Wmi1i1/XQK:O;I``#_T4!UX;[email protected]&
	cD'ULYq,<def0l?,[email protected]^>[email protected]`)jUn+E8j``kner<a[U;YJu
	eDj\E!oBGU#kJ`)f[iAk\XS,-=9`%NAuTredgIfEBo8E3[',nRNW``d"``QCXC``[email protected]"s4
	nl<*PLa&e``<+N=VE'E_DORbtN6S-PCQH/5W``/`%Ra?Sk(8!c`%NX4O``B``BL!?PDkm,rOP*XN
	`)2e`)/!Y8#7a1<[email protected]@G724<+JA0A!\LT/As!?4e\[S]7^[$B,mj>\Ih"+6jYgN\
	\``o=SiE#JrioQE<Y,18jqE#2XN]B27\]l/&B(@5W.UH?NdmXH:,i>PVncai#Rl<[email protected]*-j"B
	`%u!4bf;12f"c6q`)U/4<uNRnB`)P^GFHIp!mB=kI`%XP&Y\T9R5\Y1\_r0a7;[[Gan!b2#E]+
	arSincTXUbMXJDJAphq"af?eDCg5?+Q``b8*7>M$C``&H->7NG-5-F+T$/o+aM4.2]uMo(Kk
	G(0hg50a8l6o=MUWcQ([email protected]$jglbaD9]si#8!^GOu0CXEW\^cr5C,$10GR/PQ&e3#0qRk
	Rkam:+=`%+BmbL##!<7c2L&7=^&q#GIdAFe.]``I]_jK]n.8R&e``U5h<:n^et7CFr>[?-Zni
	N*p/Jlja7.(Y,dVK!'KKMaiO>ZDlk5>8d+_D!`)>l0N`)F'L`)h+G_qoJaJ4XJLNtUsZ6AS]6
	9c[4F8;b+#q[H'l,!7t[nCDK(!?b5\!&B;n^IKU<8^bc7SA4/PlL#\&He`)XW`%Lqj!pMH/>
	'el0K8DKE4;[email protected]@='XR1p29:j4F]A4dmS(Q446-a^5'4+#ZNCfhdQtf:f+X\$U4eD0YPe9
	T>[email protected](LS\l-6UW+U96pK&jI7Z\EN#qAo:d4t-<Xg^^/W6pgD="M&A`)e1"]lNLgQ44
	GE`)fFDooZbgI\(X*EepL.H*rq]m4.mO.Ynbu#[email protected]"aeLlk4GG[J
	bod8BIU.D="[email protected]?+KL&P?L[AUh-FIphHJ`)aCU9#-]+`%6/?MUjGepNBX`%\oO9^C06K55#
	>"(85Hsqt5:M(eY4!GC\^VJ"ELseo0`)*[UjSV+/i!'1/[email protected]#(BFbLIWcn=`%F0J_C&
	`%SRjEIs'[[email protected]@[:cCt&!O63sX4XtiG6`)\[-4mqN;lTTkq!7'M>KRp_arGa+efu(ehrZL
	&gS3BbfZE9\^*Yi;:Q$;SN"83gZ5\r?7p]0g\*Ul?d6*@4Q`%IM5"G?[.->Zu[[email protected]/$YR=
	r\o3m/1L`%>4'KJ+Eih9VB$,bA1spm>Ps7\][email protected]![T```%4ogW+7([email protected]``A<1
	AM&5Np,p-']ugMd!V1E^.ZT'$l`)5#!``8D/mAWLZatQ>r`%N/Qp*4GJTA>uN1D_?S0I\[email protected]
	0``B*]i(5R.Pl=U(=]`%-7=-A4AIp`)^M:VqX$MF5Me$7!'eB7hd&"!'s[qpK#Qtl1QFe*RK<
	<&o,PZ.jG/eIXE"FAGjt<W9"nj\?\kXZ``o+KM'VEk!RGRdY`%9K9r?=lJ&_e6cGPoO>(j<\
	[email protected]+MkhGUT3+K\JVdY<V#=NP*3rl#9+Rp3^f8`%&ef^K*Vos+fB#28`)X'Zl8Ab[Z
	!"#1XUj1VqmC.65J;hpUT'HaP-kdG;5/p0sE!<cPS(O$;Lf21kYKppfB-.l258C:=m`)<p9
	(]0``'@_\EVLU][email protected]/He\/psfN=[BePf``OREhMWsQmo^,+'X/*5>XKFcs"[email protected]?n=
	C$m200rUMiloc'Y3c<uc'=_(EDU!,i9r"8Y4m+."!=]L<#$Nl*BfnC"9ZNt6I_\[email protected]
	L*Y;=,nCI4CaQMoB$48:?/Wc.N$Vp=d(0"sD+pg4hhrp-lI,e?e`)p"=,h(d2m``7e56&4oG
	CQR`%IXW+PUngq4J18h3>I6?V*[email protected]=#CKA`)JK0Dl(OrW`).e[T<Q!EA4<fb#-lp7d4HW<
	AX:+:BX6fR9-q9qR&lp4Zad!'9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US7'8jaJc
)

NeededBytes:=Ascii85_DecoderSize(&Logo, 0xFFFFFFFF) ; here : 0xFFFFFFFF (aka (unsigned long) -1) says to use terminating '\0' as end of input
VarSetCapacity(BinLogo, NeededBytes)
DecodedBytes:=Ascii85_Decoder(&Logo, 0xFFFFFFFF, &BinLogo)
/*
  --------- code by Sean & SKAN taken from http://www.autohotkey.com/forum/topic27410.html ------------- and adapted :-) ------------------
*/
;http://www.autohotkey.com/forum/viewtopic.php?p=148231#148231 

Gui -Caption
Gui, Margin, 0, 0
Gui, Add, Text, x0 y0 w228 h133 +0xE hWndPic1 ; +0xE is SS_BITMAP

hData := DllCall("GlobalAlloc", UInt,2, UInt, DecodedBytes )
pData := DllCall("GlobalLock",  UInt,hData )
DllCall( "RtlMoveMemory", UInt,pData, UInt,&BinLogo, UInt,DecodedBytes )
DllCall( "GlobalUnlock", UInt,hData )
DllCall( "ole32\CreateStreamOnHGlobal", UInt,hData, Int,True, UIntP,pStream )

DllCall( "LoadLibrary", Str,"gdiplus" )
VarSetCapacity(si, 16, 0), si := Chr(1)
DllCall( "gdiplus\GdiplusStartup", UIntP,pToken, UInt,&si, UInt,0 )

DllCall( "gdiplus\GdipCreateBitmapFromStream", UInt,pStream, UIntP,pBitmap )
DllCall( "gdiplus\GdipCreateHBITMAPFromBitmap", UInt,pBitmap, UIntP,hBitmap, UInt,0 )

SendMessage, (STM_SETIMAGE:=0x172), (IMAGE_BITMAP:=0x0), hBitmap,, ahk_id %Pic1%
SoundPlay, *16, 1
Gui, Show,, Just for fun

DllCall( "gdiplus\GdipDisposeImage", UInt,pBitmap )
DllCall( "gdiplus\GdiplusShutdown", UInt,pToken )
DllCall( NumGet(NumGet(1*pStream)+8 ), UInt,pStream )

Return                                                    ; // End of Auto-Execute section

GuiEscape:
  ExitApp

High level decoding and use :
#include Ascii85.ahk

; This one is AHK's, snapshoted out of forum main page - Hope Chris won't fire me out of forum :-)
Logo =
(
	M,6r;`%14!\!!!!.8Ou6I!!!#[!!!"Q#Qk&,!.5rc5QCcd!`)Q?g75ct\<26sqdF_p2``ocaT
	EP0\6CMT$amtQ(n^<"B;ZFn?5k+&0<6^4[nda6/(pTqos<`%[email protected]>&703N0^!-UrfX<
	XH/CRFaJJC\@-e`)[email protected]>YVBs8Um7jT#8\zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
	zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
	zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz!2h:Q#64
	``($#iF<ErZ1J&c_n>&cpG:If'0G`)K/285u``*!m9L*0UH#GOG\`%.58P*2("6':[bGul0``ho
	/[email protected]/Yq.SU\Gm`)(_s\Y^Y:0E"OO[FHs0$sSWjt!`)IXLY"[email protected]/$JnHj
	\*aD1,Lha$sk_77<E2V>b\,T3O>Af-'[email protected][[email protected]`)^t#j*"DE1I7sSt_dfVBlTd
	pej'[[email protected]+3;0k1.&`)7"V+;5!e``eacqYbCF<_*`)W0GCZd_oB``"bW!07h`%(,Cb<IGgD2`%Q
	,<cNdTi1W3\B5hgH!>_LW?opDQGcmf!.O;/_5+aD8Qpj+?m0F>lGJh4Y(P^b7*C;lD;rJa
	3!B(TpP>gEF]W!'$bq.Fph`%fD/+X*`%0LGU=9"-ncm9^?#\E'@W*jRn":m_a`)'>*RF43"_`%
	[HrFEFl2J5uu*p:YD&K$nO5`%:*J#\;Jn2!q7D$(nUh(a[6Mi[[email protected]\HUR!OMD`%28k!!rkX
	m"`%$36^VZnWGhr]2GRZ14=1GM_#,<&.JB]pO!jmNGbp>3`%VdKDdnb+Ol([U;Qr[+>T!3?n
	kN,W$(S4:VUF-ci=Q]GH/SY4'H$gh=0b4XV108,Uh_G"P4/``=k[c`%:6db`%[email protected]@jFEu>Oc[
	ePNXS_c8l3Z"2XH[hZd(8D-pF4``[email protected]<DWUnUi\]i&V76ZL6i`)C,hNd$b
	T+;pSIL:"92nH`%`%?d.QAQ7jU-7=SMuc``[email protected]>3\!E?l=CqL^l<m:N":VF:@nRHKof``#;
	][email protected]&n!#O;03_(X.Cq!>,#sQTf(@.A5X`%`)'1d!0*/V,Xl.`)Z5RqH?PH(.V[UJ8m$+C
	jam>heW4[*F``W*^#2;0Ll1KA;b(f(hQb3A-Lp=omk"_DiXgNj.jWiThOk!#]6Kn,#UMq`%H
	'2!KGBThY>$Hg5Kk7\tPXNH&Q6b6!tKlpWcBSn$FK.frQL,,E$i^&G\=/0``sI;+P[.<>^``
	p+lV0](ZftDd*1/[email protected]"A4+KZ0`)D6E(_tQnU3Cdj$?:nc"eT2&PV:B./fT6>`%k2ca\]
	5TfsMhGP7(lF!"tur#7X=>LTHP^+/Aj4OL3":3==qNT.SN?8tmpq?LJ^PXcFLOb8^qTPan
	3!2M^u,+6a<h&Bjijk4J,[JKG'[email protected]^pu2:UC1.!Z+AN`%!LV1HYq52J'P^Kg;A
	!q,GpHgF#4gFq=dY["$fme#[email protected]"`%[email protected]"PlTb'[k+o1dR?<(
	B8HOsd!?\8O:GN$>]K`%r\/R]7dSG`%h3$V85jjPUh<d8:T^6QK7'>a^iP0;lAsoa!^X5B=0
	SYb>NLJ`%V.G(]bM``e=\AYNRZ>PFP\^UNC="`)n9aoN[L<(Y#EfHu*",0*WTYUY=bVRsp<OR
	+oIg<9;`%S5$Tg#S7QlA`%QEapJQg'#AgoU+#``GW`%cHIP]u`)R:PlR?[0J//kff0.Cr3gq_LY
	L8>\AqaGQr9(a*?0o.SN/e(E6`)0rcGk``JoQND1<Cis1e-q-.N'(AF^aP]YnFZleSJ+ggd!
	33oKDen!p$3CXrs`)9G?JU=X*V:Oo>`)_qWQM_..Up-/Ts0&4_epP+,``UMP0OUK[pHlRlHBB
	i.Q$`)R``M:&O*'pX2,n1g#kbC#:*i,pYgC(T6-d``S">[email protected]"3uKA6AP5!PG.9E``MeTji0`%=
	j2*Aan*=VkW7f4u=T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!`)fjdTK152ib-+jMEd"F]Bh8B4n>4*&\@9A":=O
	fVS_d7fUrgX<R[ic\GCWoT-ROsM-!R+8F.s>r/!C7`)3dI0`).$7k'.A#f]j*.*!m$oc#M:e
	Ne-&Q+lCXY^jks^e<1iG#@&635h/eqNd+NML1`)9BE-n``W#7c5T=>YYZqt>j!O=W+8mb6Vj
	406CnAEE,N&Mnr/='SFSeaOb2-"=]ZLg2:Y[tnQa$*!+ZtN"/d\p.8BqUO:!_U5IntH``]W
	@ub``f?54=$+Rc,J!Ej8M!^2YbVFnC&<RE3pL$j4H2``Q/a9&'0gL``4i1!laMs5`%G&+$QoIS
	V5V*d0oFH]\*#q\Y^8r^`)\`)X1&M+[HjG8Ng+aH5gpK]sm6Yd<Jc\T5P^X`%S\``55'^lQ:C3
	[email protected]#`)gNc</0JTD/cdj(&3#F\&W&[OO>s*1"`%Ghd51kHO2&4_&P7RINaUo2#[email protected][email protected]'G7e``
	l/3D[G#i?p/c998VB!``Kt]gLLA:VF5pZYh#[email protected]'qAQf2jbi>a-?R(J`)``Jc/X16/;[email protected]
	S!8``$u`%`%3RH$XsUJVeg1!mehY$'8JtmA/[email protected],[email protected]?hqf5t_p<H.9$9.&u+,mB(^/6
	^'Yr"al,?Jc7((/[email protected]:LCjp.8#7a?Wmi1i1/XQK:O;I``#_T4!UX;[email protected]&
	cD'ULYq,<def0l?,[email protected]^>[email protected]`)jUn+E8j``kner<a[U;YJu
	eDj\E!oBGU#kJ`)f[iAk\XS,-=9`%NAuTredgIfEBo8E3[',nRNW``d"``QCXC``[email protected]"s4
	nl<*PLa&e``<+N=VE'E_DORbtN6S-PCQH/5W``/`%Ra?Sk(8!c`%NX4O``B``BL!?PDkm,rOP*XN
	`)2e`)/!Y8#7a1<[email protected]@G724<+JA0A!\LT/As!?4e\[S]7^[$B,mj>\Ih"+6jYgN\
	\``o=SiE#JrioQE<Y,18jqE#2XN]B27\]l/&B(@5W.UH?NdmXH:,i>PVncai#Rl<[email protected]*-j"B
	`%u!4bf;12f"c6q`)U/4<uNRnB`)P^GFHIp!mB=kI`%XP&Y\T9R5\Y1\_r0a7;[[Gan!b2#E]+
	arSincTXUbMXJDJAphq"af?eDCg5?+Q``b8*7>M$C``&H->7NG-5-F+T$/o+aM4.2]uMo(Kk
	G(0hg50a8l6o=MUWcQ([email protected]$jglbaD9]si#8!^GOu0CXEW\^cr5C,$10GR/PQ&e3#0qRk
	Rkam:+=`%+BmbL##!<7c2L&7=^&q#GIdAFe.]``I]_jK]n.8R&e``U5h<:n^et7CFr>[?-Zni
	N*p/Jlja7.(Y,dVK!'KKMaiO>ZDlk5>8d+_D!`)>l0N`)F'L`)h+G_qoJaJ4XJLNtUsZ6AS]6
	9c[4F8;b+#q[H'l,!7t[nCDK(!?b5\!&B;n^IKU<8^bc7SA4/PlL#\&He`)XW`%Lqj!pMH/>
	'el0K8DKE4;[email protected]@='XR1p29:j4F]A4dmS(Q446-a^5'4+#ZNCfhdQtf:f+X\$U4eD0YPe9
	T>[email protected](LS\l-6UW+U96pK&jI7Z\EN#qAo:d4t-<Xg^^/W6pgD="M&A`)e1"]lNLgQ44
	GE`)fFDooZbgI\(X*EepL.H*rq]m4.mO.Ynbu#[email protected]"aeLlk4GG[J
	bod8BIU.D="[email protected]?+KL&P?L[AUh-FIphHJ`)aCU9#-]+`%6/?MUjGepNBX`%\oO9^C06K55#
	>"(85Hsqt5:M(eY4!GC\^VJ"ELseo0`)*[UjSV+/i!'1/[email protected]#(BFbLIWcn=`%F0J_C&
	`%SRjEIs'[[email protected]@[:cCt&!O63sX4XtiG6`)\[-4mqN;lTTkq!7'M>KRp_arGa+efu(ehrZL
	&gS3BbfZE9\^*Yi;:Q$;SN"83gZ5\r?7p]0g\*Ul?d6*@4Q`%IM5"G?[.->Zu[[email protected]/$YR=
	r\o3m/1L`%>4'KJ+Eih9VB$,bA1spm>Ps7\][email protected]![T```%4ogW+7([email protected]``A<1
	AM&5Np,p-']ugMd!V1E^.ZT'$l`)5#!``8D/mAW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,``VHYk<dA5s'AVnm!RT[e?r1TK
	ZEI$f5$oT][email protected]!"ruL``d#R8dC<D.of/D'eY'dD[(^&gZEUeRqU4+qR\K\@=ZnTog``aQb`%4
	,PL9?T<e`)9Y(``XMkUdN?E(<[email protected]_GD[h"8R0*ALM"DhOc>k.XM,-/@Wkq
	ie`)gr*2hJs!/iKGL[ieqe8`%$Ic3oJ-D<J(MSA*BLi!o]`%(7!Lhbo``2i>:XaG$^=ASX383i
	mSqYD4'BU*+f!TIY[aTG<(`)?,W2ZG!_XXuj3O[i5IZ#O1k9bnr_:iQm`%eESp-c9i``^a>I2
	&qUuS4[$IT7`%`%Vd4'Lq,G30G?G=^u9Huqe5q:pBK+:VS8IL[(":b"ltP6I0-5-UZ<P-;fu
	V;1[F0]Mbe45$25DL;f<^@H+4`)RXp=(-]h^\4EB"SV\\[email protected]`)J(EN``u,MK32tZ<T9b35*,
	aqq.'Is2FN.<LC>I+CPIljU<W]_85Y"&J.?L:[email protected][email protected]_\p(8`%HL+s11KaiY2D
	'_``pnp$3(QJDZU0or/`%Z"IeAgcb&s/[email protected]:=jDQI/'*C:C/NaU#-R\ojnbeVlqa?\C'p+
	fjD1:L=N9G1/rt?OT`%gbs'3H7l\kl:\``!(fUS7'8jaJc
)

DecodedBytes:=Ascii85_AhkDecoder(Logo, BinLogo)
/*
  --------- code by Sean & SKAN taken from http://www.autohotkey.com/forum/topic27410.html ------------- and adapted :-) ------------------
*/

Gui -Caption
Gui, Margin, 0, 0
Gui, Add, Text, x0 y0 w228 h133 +0xE hWndPic1 ; +0xE is SS_BITMAP

hData := DllCall("GlobalAlloc", UInt,2, UInt, DecodedBytes )
pData := DllCall("GlobalLock",  UInt,hData )
DllCall( "RtlMoveMemory", UInt,pData, UInt,&BinLogo, UInt,DecodedBytes )
DllCall( "GlobalUnlock", UInt,hData )
DllCall( "ole32\CreateStreamOnHGlobal", UInt,hData, Int,True, UIntP,pStream )

DllCall( "LoadLibrary", Str,"gdiplus" )
VarSetCapacity(si, 16, 0), si := Chr(1)
DllCall( "gdiplus\GdiplusStartup", UIntP,pToken, UInt,&si, UInt,0 )

DllCall( "gdiplus\GdipCreateBitmapFromStream", UInt,pStream, UIntP,pBitmap )
DllCall( "gdiplus\GdipCreateHBITMAPFromBitmap", UInt,pBitmap, UIntP,hBitmap, UInt,0 )

SendMessage, (STM_SETIMAGE:=0x172), (IMAGE_BITMAP:=0x0), hBitmap,, ahk_id %Pic1%
SoundPlay, *16, 1
Gui, Show,, Just for fun

DllCall( "gdiplus\GdipDisposeImage", UInt,pBitmap )
DllCall( "gdiplus\GdiplusShutdown", UInt,pToken )
DllCall( NumGet(NumGet(1*pStream)+8 ), UInt,pStream )

Return                                                    ; // End of Auto-Execute section

GuiEscape:
  ExitApp

Thanks go to Lazslo for idea and Sean/Skan for the code I borrowed in the samples. I hope I forgot no one in credits.

Comments are welcome. Please, be constructive while criticizing :wink: .

Edit : corrected URL to ASCII85 specs, which was missing.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
Thx.
Posted Image

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Dear Azerty, :)

First of all: Many thanks for developing this solution. I have been waiting for this.

I need one clarification.
After calling the encoder function, the ASCII 85 byte stream ( DestinationMemory ) seems to contain linefeeds and carriage returns. Is this alright ?

Please confirm.

:)

Azerty
  • Members
  • 72 posts
  • Last active: Jan 16 2009 10:08 AM
  • Joined: 19 Dec 2006
Hi.

1st, you're both welcome :)

Wow... 130 reads, 2 replies...

After calling the encoder function, the ASCII 85 byte stream ( DestinationMemory ) seems to have linefeeds and carriage returns. Is this alright ?


Yes : in either high level or low level function, you can pass the NbBytesPerLine parameter with either ((unsigned) -1) meaning you want no CR/LF, or another value specifying the expected ascii bytes per line (defaults to 70 in high level function, no default in low level). This has been made to facilitate embeding in AHK source without having to manually split lines.

Please note that if you want to be "adobe compatible" (i.e. with <~ and ~> delimiters) in high level function, these are not counted, so first and last line might be, by design, slightly longer. I judged it was not worth the computing cost to readjust line lengths in this case.

You may also notice that using low level function to encode may lead to ascii code that's not directly embedable into AHK source code because of AHK syntax parser (that's taken into account in the high level interface only, since I wanted low level ASM code function to be usable outside of AHK or with "neutral" external ASCII85 files in AHK that would be compatible with some unknown other app, just in case...).

Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006
interesting stuff..

in case helpful to anyone, offer this. (code adopted, ie. mostly not my work). may even be reasons why the simplification is bad. anyhow
MCode(ByRef bin, hex = "") { ;  MCode(Function)
   Static fun
	  if hex =
		hex := bin 
	If (fun = "") {
      h:="568b74240c8a164684d2743b578b7c240c538ac2c0e806b109f6e98ac802cac0e104880f8"
       . "a164684d2741a8ac2c0e806b309f6eb80e20f02c20ac188078a16474684d275cd5b5f5ec3"
      VarSetCapacity(fun,StrLen(h)//2)
      Loop % StrLen(h)//2
         NumPut("0x" . SubStr(h,2*A_Index-1,2), fun, A_Index-1, "Char")
   }
   VarSetCapacity(bin,StrLen(hex)//2)
   dllcall(&fun, "uint",&bin, "Str",hex, "cdecl")
}


; result := Ascii85_Encode( Bin_Var_to_Encode)

Ascii85_Encode( SourceText, NbBytesPerLine = "", SourceSize = "" ) { ; returns binary encoded as ascii85,  include size if not same as setcapacity of source text...
    Static lMcode
    if (!lMcode) {
        lMcode := "60e81a0000000100000055000000391c0000ed5e0900b1841c030203041810085b89e583c51c83ec048b45148945e0fc8b75088b7d108b4d0c09c9745d83f904" 
	. "7231ad0fc809c0750cb07ae86a000000e9190000005131c9b10583c31483eb0431d2f733e84f00000089d0e2f05983e904ebc651c1e008ace2fa59518a4c0b16"
	. "d3e0598a4c0b1383c31483eb0431d2f733e82200000089d0e2f08b451483f8ff740b3b45e0740666b80d0a66ab2b7d10897d0083c40461c30421aa8b45e083e8"
		. "01750966b80d0a66ab8b45148945e0c3"
		
        MCode(lMcode)
    }
    
    if !SourceSize
	SourceSize := varsetcapacity( SourceText ) 
    varsetcapacity(DestinationMemory, SourceSize *2,0)
    
 DllCall(&lMcode, "UInt", &SourceText, "UInt", SourceSize, "STR", DestinationMemory, "UInt", NbBytesPerLine, "cdecl UInt")

	
    VarsetCapacity(DestinationMemory, -1)
    return regexreplace(DestinationMemory,"z","!!!!!")
    
}

; size_of_return := Ascii85_Decode( The_stuff )
; The_Stuff is converted from ascii 85 to bin

Ascii85_Decode(byref SourceText) {  ; Converts ascii85 string to it's binary & returns binary length
    Static lMcode
    if (!lMcode) {
        lMcode := "608b6c240c83ed0431d231c9fc8b75088b7d108b5d0c31c0e84f00000074453c7a750531c0abebeeb1042c2189c231c0e83700000074132c215031c0b055f7e25a01d0e2"
        . "e70fc8abebcc5131c0b055f7e283c05489c2e2f359f7d983c104c1c008aae2fa2b7d10897d0061c309db7416ac4b08c074103c2074f23c0974ee3c0d74ea3c0a74e6c3"
        MCode(lMcode)
    }
    
    SourceTemp := SourceText
    return DllCall(&lMcode, "STR", SourceTemp, "UInt", strlen(SourceTemp) , "UInt", &SourceText, "cdecl UInt")
	
	
}


here is the basic concept:
/********************
* ASCII-85 Encoding *
********************/

For example:
---------------------------------
H	72  x 256^3
e	101 x 256^2
l	108 x 256^1
l     + 108 x 256^0 = 1214606444

floor(1214606444/85^4)	= 23		+ 33 = 56	8
1214606444 - (85^4*23)	= 13992069
floor(13992069  /85^3)	= 22		+ 33 = 55	7
13992069   - (85^3*22)	= 481319
floor(481319    /85^2)	= 66		+ 33 = 99	c
481319     - (85^2*66)	= 4469
floor(4469      /85^1)	= 52		+ 33 = 85	U
4469       - (85^1*52)	= 49
---
floor(49        /85^0)	= 49		+ 33 = 82	R
49         - (85^1*49)  = 0

NOTE: 4 <NULL>'s = !!!!! which is translated into 'z'




/********************
* ASCII-85 Decoding *
********************/

"6nMhf"
---------------------------------
6	54	- 33 =   21 x 85^4
n	110	- 33 =   77 x 85^3
M	77	- 33 =   44 x 85^2
h	104	- 33 =   71 x 85^1
f       102	- 33 = + 69 x 85^0 = 1143824754

floor(1143824754/256^3) = 68		D
11438247540-(256^3*68) = 2974066
floor(2974066/256^2) = 45		-
24946-(256^2*45) = 24946
floor(24946/256^1) = 97			a
24946-(256^1*97) = 114
floor(114/256^0) = 114			r
114-(256^1*114)  = 0

Joyce Jamce

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
I also support your ideas to merge this and MCode, and eventualy other similar functions you may make in the meantime. Some formal method of documentation would be more appropriate.
Posted Image

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

using low level function to encode may lead to ascii code that's not directly embedable into AHK source code because of AHK syntax parser


True.. :(
I have been trying to write an error-free auto-ascii85-script-generator for past 20 hours .. in vain.
With continuation sections, my script is not even able to handle 5mb of binary data... Executables are the worst to handle ...

I wish we had a simple facility like:

[color=black]var=
( TEXT JOIN
sadsadsadsdlaskdllkiweooeiqwoeoqwoeiowqe
qweowqeiowiqe
qwekfjdf8ud83erpojtiuhidsfkosdf
sdifgu8urtewooksofusdlfkdlskf
op9wr998efkoldkf
dfoisdofofsdi90989erioweri9w0ei9rwie9ri
ENDTEXT )[/color]

Anyways! I will be posting my script shortly since it works fine with image files .. Many thanks for the clarifications, Azerty!

:)

Edit: Done!

Crazy Scripting : BinToAHK 45L [ using Azerty's ASCII-85 ] posted by SKAN

Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006

I wish we had a simple facility like:

[color=black]var=
( TEXT JOIN
sadsadsadsdlaskdllkiweooeiqwoeoqwoeiowqe
qweowqeiowiqe
qwekfjdf8ud83erpojtiuhidsfkosdf
sdifgu8urtewooksofusdlfkdlskf
op9wr998efkoldkf
dfoisdofofsdi90989erioweri9w0ei9rwie9ri
ENDTEXT )[/color]


here...

AutoUnJoiner:

	controlgettext,SText, Scintilla1,ahk_class SciTEWindow
;_autoJoined = %_autoJoined%`n
;( %`
	SText :=regexreplace(SText,"s)\Q" .  "_autoJoined =  " . "\E"  
						. "|\Q" . "`n_autoJoined = %_autoJoined%``n`n( %```n" . "\E"
						. "|\Q`n)`n\E","")
	
	controlsettext, Scintilla1, %SText%,ahk_class SciTEWindow

return
AutoJoiner:
	controlgettext,SText, Scintilla1,ahk_class SciTEWindow

	SText := "_autoJoined =  " 	regexreplace(SText,"s)(.{1,16000}(\n|$))","`n_autoJoined = %_autoJoined%``n`n( %```n$1`n)`n")
	controlsettext, Scintilla1, %SText%,ahk_class SciTEWindow

return

Joyce Jamce

Sarah
  • Members
  • 103 posts
  • Last active: Oct 12 2009 05:42 PM
  • Joined: 12 Jul 2007

... or any other resource you might imagine. Explanation of ASCII85 code is there.


Azerty, those demos are very neat!

.....but how about making ASCII85 work on this slice?

see: <!-- m -->http://www.filecrunch.com/file/~5yunad<!-- m -->

It is actually the binary version of this code,

Msgbox, Hello


.... or maybe you can get something on your end to work like this :)

FileRead, BinData, RUNTHISDATA.BIN

; .. then integrated run under ASCII85? :)



majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
I suggest creting utility that will let you add files (and maybe entire folder structure) to be encoded into single Resource.ahk file together with functions needed to use files in the resource or unpack them to HD.

Then everybody would be able just to include Resource.ahk or even create set of different resources (kind of themes) and use it in uniformed manner.

After this work, creating such utility isn't difficult and will make entire operation standardized and more useful to everybody.
Posted Image

Azerty
  • Members
  • 72 posts
  • Last active: Jan 16 2009 10:08 AM
  • Joined: 19 Dec 2006
majkinetor : looks like it's exactly the purpose of skan's AxC : Pack and Unpack Binary files which offers the following functionnality :

AxC_UnPackToMem( packfile, filename, byref bin )
loads a single file available in an AxC file into AutoHotkey memory.



Azerty
  • Members
  • 72 posts
  • Last active: Jan 16 2009 10:08 AM
  • Joined: 19 Dec 2006
sarah : see above : you may use skan's lib with

AxC_UnPack( packfile, destination )
Unpacks a single file available in an AxC file.


In fact, ASCII85's purpose is not to embed multiple files/binary resources into a separate "cabinet" file (zip libs would be better for it, they compress instead of expanding size, and are natively supported by OS) but to embed the resources into an AHK source file, then to use them directly from memory.

If you want to regenerate the exe when it's extracted from AHK, you may use ASCII85 in conjunction with PhilLo's BinReadWrite.ahk functions.

As for the resource you give a link to, it seems to be a standalone .EXE/.DLL (which I've not binary reencoded) by the MZ signature in the first two bytes. Exe/Dll cannot be used from memory because of the way relocation is done (I explained a little bit this matter here. Relocation is done through tables which are stored into a specific par of exe/dll but never fully loaded into memory. To learn more about it, google "PE relocation table" where PE stands for "Portable Executable".

Sarah
  • Members
  • 103 posts
  • Last active: Oct 12 2009 05:42 PM
  • Joined: 12 Jul 2007

majkinetor : looks like it's exactly the purpose of skan's AxC : Pack and Unpack Binary files which offers the following functionnality :

AxC_UnPackToMem( packfile, filename, byref bin )
loads a single file available in an AxC file into AutoHotkey memory.


I'm loving it! :) Can this be used this way? >> I see how to regenerate, but can I pack a file and use it this way::

AXC_UnPackToMem("hello.axc","hello.exe", [color=red]byref bin[/color])


Not sure how to interpret that last part... suggestions? :D

Azerty
  • Members
  • 72 posts
  • Last active: Jan 16 2009 10:08 AM
  • Joined: 19 Dec 2006
:idea: Sarah : I suggest you move your questions about AXC lib to Skan's Topic, not to confuse this one. Thanx.

I can't respond to you directly since I've not had time to dig into Skan's lib. Sorry :(

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

majkinetor : looks like it's exactly the purpose of skan's AxC : Pack and Unpack Binary files which offers the following functionnality :

Not in the manner I proposed. Its completely different project, looking similar at first glance
Posted Image