Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BASFILE - Converts small files to BAS code.
#20
Yeah, large sources really bog down here for me.  I would only be using this for a few smaller files, but testing on large ones.   I better properly format the output, that's another good suggestion.

EDIT: Got the new BASFILE with the speed change working.  Output function decodes a 3.8MB file in .43 secs.  Using the MID$ calls instead of A$=A+  added a lot to the output size, so I had to increase the line length of the data to compensate and decrease.  The code is uglier but loads faster.  Perhaps 160 character length is too long.  I'm going to post a sample here to show what it outputs, and also to say hi to you guys...

- Dav

Code: (Select All)
Screen _NewImage(700, 600, 32)
hi& = _LoadImage(BASFILE$, 32, "memory")
_PutImage (0, 0)-(_Width, _Height), hi&

Function BASFILE$ ()
    'Returns decoded file as BASFILE$
    A$ = Space$(7346): a& = 1
    Mid$(A$, a&, 160) = "0stPC'{<7A='?'v6>VkBh'CL6q'H(<WzzC*T'.3jG*:*vM*:G.L*s9VT0(h]n+pI<j/H{g82\reP2\j2u71is*6Q2:R3Y\[8:bX7y>V}?BAN{fwC.?]g==ex<*UZ'I'\o'w,OTvU'<(uB'CC0H'CL9/''00*''''": a& = a& + 160
    Mid$(A$, a&, 160) = "''CC0((\(w5)ufjFhBf8W'(kVC'{>X0([vt5''LL4'P_|R(?>U01]Myr-0fh^1x]VYQTPxb2=.'0-}G4H2s68bQwaC].KcEi2wY_C4:FWr8KuCG9e[5a=Yef:>sKXKChU0|E*:{5HvESgJ8+FwN-4vQOFribS:|B": a& = a& + 160
    Mid$(A$, a&, 160) = ";TTc4LX-GQyYG-E2\vibX^8OTpbi3\7d*qeVgYlAnht;u<j5yhMmf^-zo(Dx3r;[+VsUAumvhwI,x+=sOyD{f_'>GQS''001t8_*RsKdOU9'2F*/0k/(d7{q1*G97+wV0wF7=qoCcQpm+]o7*L06co46tnv_hsjM": a& = a& + 160
    Mid$(A$, a&, 160) = "=x*QZHo>8[dciYC3i0O57Z;i8J?mq/=h^8NWhHlzo.wBD<Qa=6R=|O<EJ4Jw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K\'Qkf)FLwSvmJlmR5EZhAQ2e8wcKC": a& = a& + 160
    Mid$(A$, a&, 160) = "Dq;puy0?ZiGigiKw]|FvW8'+lcv,wZ69;xNFVW?:LoK.<UsFUkX'C<'xyb3_I)QwGRmpvELz_HlEee+Bqs0A5nZUXh?n1NxXKXh]UpXc\jpmy9.ui?2A=a9N?>taZ0W1/V1WT\HhshvF]loYGw1qWDXGixsVY^MM": a& = a& + 160
    Mid$(A$, a&, 160) = "SO8_iB3QlM_';rCxJS*CgG1hXFAi*?B]nb6^3NHAROpi[snkfGy8hx}in_<K9<^:nl.hs?oqa9x.Jr+(I2W'-3NkRx.u:Y;9*)5efL]yc),E9G=>Jh\>7q(yT3t4,)U2EB;;]WpGW)>Ka_p.U_K5ntGUawo>n>/U": a& = a& + 160
    Mid$(A$, a&, 160) = "]t=}8de|xb<0]LFcS0MG8MH;d0RUjOf)'T3+^ta0_w'ohWuPC5h,zOECLF(.-ujgcR;OVK>n8p\):HMboO,{A)Z[4me0eeVEr{\<6*[fTi*06Xe<9zSV-[h]^2DrgZzh'q(aBLP3_q:IS<N0yN=xSAJfhFBe1Plw": a& = a& + 160
    Mid$(A$, a&, 160) = "x'W'368EK^uf(,|1VtiYSmO_?.)efzU1ZUtnmdP</0Z/qclmha}Xy60oq/Ys)^/^=D{8mGj01VV(KPiaj/AxA4pB^{SSH3ox,9pymK3)\kClnr;l?2X/TML3c\;[ME0va<-P|))(3Tpxaf'4B(;z2Sc7C^-Hvqq4": a& = a& + 160
    Mid$(A$, a&, 160) = "M0w.h8ORG'x^1le<3/(X'B^M5oU^gw5Yl5VGt/HHkBll[^<v7C9;YT'pi/se9TPZcn[I(s-z_unsm]D.dhw5}Hy:L5P'C>>aP>q-rXw*oA-cR4TJ1up[LQO=WkeX(<bz-Si]-F;8s27V.>a>}2<>=W]w1Nr6XwxU": a& = a& + 160
    Mid$(A$, a&, 160) = "}Ty.(IPYMn0'R-qykwUx4mTaJSvU[6il{utU?Ift9;O>*y,.+F?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=mFTS29": a& = a& + 160
    Mid$(A$, a&, 160) = "um51MzPzHetjT*9}2y2>}6sJ)FpySK>F7*yy/j+E(1|Do5L<XV_81dmoh-iDDM8V1}b)bUQlzC^CC_(Z-[ec9<tM=vztLVWQ-y)X)EG9U85;yqC*pNez'+8>CecO,49sZWNNI?cbWwW_LO<LAKh]/>En.XAv;toy": a& = a& + 160
    Mid$(A$, a&, 160) = "Vzymw7wTrskTjc^D??3>PczscPHXq;zQ|qsc52^G,xnkDSurbd0NLQ]ABO:m(){LNyVeU-z\q:o7:O6pF;}.YA^FYII*Jc66/;]'22dXC\M0i0h\idTvL*T7{8IVhwL7;98;u-4_]41=)j|rPgaKsK*[GJ[w,Iyb": a& = a& + 160
    Mid$(A$, a&, 160) = ">(Sz5wtkBH9')O2?2Q6Sa0Mp|T,-j\nn;_^;yR0o\N<da?kz79jR<0ibm-Sg;440ReeNfMlzaun(9?1oK^TxLvBSe3;EvX/NNLN)Ls{;EDkvjcV+PJ6D'cx{bdt9M(^'Cm,P>O\74Hc1Trcvy=+3:2<7;c{{WBFz": a& = a& + 160
    Mid$(A$, a&, 160) = "K9mJ(\kNC+TC1OpcI/v;t'GRL;6NZsne3'xop/4,p9VtyEr3d(sL8=9MdK?t'UwZWyA=U:V^4},|:asCb];]MQ.u}/i9,(\<,E:?HXdT.Uc1+?'HL;j1(9(1\B_tLILE:AuWIvv2o,Q>M-bX0"
    o$ = Space$(5876): oc& = 1
    For i = 39 To 125
        If i <> 64 And i <> 96 Then c$ = c$ + Chr$(i)
    Next: Dim v As _Unsigned Long
    a = Val(Mid$(A$, 1, 1))
    For i& = 2 To Len(A$) Step 5: v = 0
        For j& = 0 To 4: p& = 85 ^ (4 - j&)
            c& = InStr(c$, Mid$(A$, i& + j&, 1)) - 1
        v = v + c& * p&: Next: Mid$(o$, oc&, 4) = MKL$(v)
        oc& = oc& + 4
    Next: btemp$ = Mid$(o$, 1, Len(o$) - a + 1)
    BASFILE$ = _Inflate$(btemp$, 5865)
End Function

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
RE: BASFILE - Converts small files to BAS code. - by Dav - 09-28-2023, 11:05 AM



Users browsing this thread: 1 Guest(s)