Hello all,
as the title says, I would like to develop an application module able to package (and of course to unpack...) the resources into a single file, in the same way that Hollywood does, with the preprocessors commands, when it creates the executable file. This is almost an essential feature for my work.
The resource file should be like a small-compact-simplified file system, divided into two main areas:
- Index table
- Data segment
The most useful functions, for that purpose, seem to be the "memory block functions", specifically: WriteMem() and ReadMem(), but I did not understand if there is a way (maybe not) to convert these blocks of memory in other types of objects like brushes, samples or simply a text buffer. On the other hand could be equally helpful to have a loadBrush function able to read from any file (not only a graphics file) at any position for any amount of bytes. As a simple explanation this is what I would like to code for the resource-load side:
Code: Select all
function loadResource(resourceId, resourceName$)
local fileId = 1
openFile(fileId, "resource.wad", #MODE_READ)
local indexElement = loadIndexElementByName(fileId, resourceName$)
if (getType(indexElement) <> #NIL)
seek(fileId, indexElement.entryPoint)
switch (indexElement.type)
case #BRUSH:
loadBrush(resourceId, fileId, indexElement.bufferSize, {Transparency = $FF00FF})
...
...
endswitch
else
; Resource does not exists!
endif
closeFile(fileId)
endfunction
Code: Select all
seek(fileId, indexElement.entryPoint)
switch (indexElement.type)
case #BRUSH:
readMem(fileId, blockId, indexElement.bufferSize)
createBrushFromMemory(resourceId, blockId, {Transparency = $FF00FF})
...
...
endswitch
Thanks! Paolo.