Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Mar 01, 2002 12:52 am Post subject: Resource compiler |
|
|
This proggie uses VDSINOUT.DLL
(http://www.vdsworld.com/index.php?page=download&fileid=10) to create a single
resource file for all the files associated with your VDS program (not
VDSINOUT.DLL, though).
In contrast with the VDS resource compiler, it will take ANY type of file,
such as text files or binary files. I have tested with dll, exe, hlp, wav, txt,
bmp etc. and so far no problems detected.
The resource compiler creates a single resource file from a list of input
files. It also makes a map file with file offsets - written in a format that
can be pasted right into a VDS file to extract the files from the resource file.
| Code: |
title Resource compiler
dialog CREATE,Dr. Dread's Resource compiler,-1,0,394,318,SAVEPOS,DRAGDROP
dialog ADD,TEXT,T1,7,10,,,Output file name:
dialog ADD,EDIT,Outfile,5,100,150,
dialog ADD,TEXT,T2,36,10,,,Files:
dialog ADD,TEXT,T3,36,270,,,(drag&&drop files here)
dialog ADD,LIST,LB,55,10,366,160
dialog ADD,BUTTON,Reprieve,228,10,100,,Remove from list
dialog ADD,BUTTON,Compile,228,150,100,,Compile now
dialog ADD,BUTTON,Quit,228,300,,,Close
dialog ADD,STATUS,SP
dialog ADD,TEXT,T4,270,10,,,Status:
dialog ADD,PROGRESS,PROGRESS1,268,50,267,18,0
dialog ADD,TEXT,T5,270,320,,,100%
option DECIMALSEP,.
%h = @sendmsg(@winexists(~LB),1045,1000,0)
dialog SHOW
:evloop
dialog set,SP,@count(LB) files selected
wait event
goto @event()
:dragdrop
list DROPFILES,LB
goto evloop
:ReprieveBUTTON
dialog CLEARSEL,LB
goto evloop
:CompileBUTTON
%%resfile = @dlgtext(Outfile)
list create,9
%a = @count(LB)
%b = @div(100,%A)
%i = 0
list seek,LB,0
rem Create resource file from list of files
repeat
%f = @item(LB)
if @not(@null(%F))
%%app = @IO(APPND,%%resfile,%F)
gosub logger
list delete,LB
%i = @fadd(%I,%B)
dialog set,progress1,%I
end
until @null(%F)
dialog clear,LB
dialog set,progress1,100
dialog cursor
list savefile,9,mapfile.txt
list close,9
shell OPEN,mapfile.txt
goto evloop
:QuitButton
:CLOSE
exit
rem SUBS
:logger
rem Create map file in a format appropriate for extraction by VDSINOUT
wait 0.1
%%size = @file(%%resfile,Z)
%%start = @succ(@fsub(%%size,%%app))
%%file = @NAME(%F).@EXT(%F)
list add,9,"%%xtract = @IO(XTRCT,"%%resfile","%%start","%%size","%%file)
rem *** inconsistent @ character, opening bracket and closing bracket count on previous line ***
exit
|
One more comment. The compiled resource file can be used directly from
VDS as concerns TXT, BMP, and ICO files.
For instance:
| Code: | | DIALOG SET,BITMAP1,resfile.dsr|123 |
However the byte offset should be set one lower as compared to using
VDSINOUT for extraction. And VDSINOUT still has to be used to extract
any other type of files
If you want to disguise your resources from nosy users, create a new
directory somewhere, extract the files there, and delete them again when
the program is closed.
Keep on trucking!
Dread
 _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|