Page 2 of 3

Posted: Tue Aug 19, 2003 6:15 pm
by Max.
@ LJ

My program basically does nothing more than extracting the included PAK archive to a temp location & extracting the included files to their final destination and has basically nothing in common with Thinstall.

It was meant as reference for my observation of the "memory issue".

Same effect as in this small code:

Code: Select all

Result = CatchImage(0, ?small) 

If OpenWindow(0, 218, 39, 530, 434,  #PB_Window_SystemMenu | #PB_Window_TitleBar , "")
  If CreateGadgetList(WindowID())
    ImageGadget(0, 10,10,100,100,UseImage(0))
    ButtonGadget(1,10, 10, 50, 20, "Click me") 
  EndIf
EndIf

Repeat 
  Select WaitWindowEvent() 
    Case  #PB_EventGadget 
      Select EventGadgetID()
        Case 1
          Result = CatchImage(1, ?large) 
      EndSelect
    Case  #PB_EventCloseWindow 
      End 
  EndSelect 
ForEver
 
Test1: IncludeBinary "c:\small.bmp"
Test2: IncludeBinary "c:\large.bmp"
where

small.bmp is 1.37 MB and
large.bmp is 25.7 MB of size.

When _I_ run it, the programe consumes 3.2 MB memory RAM, until I click the button and the CatchImage loads the large bitmap, making the program to consume ~29 MB.

I don't know if this behaviour is the same on any platform (I'm using Win 2K/SP4) and to which extent one can include ressources without consuming too much (unused) memory in RAM or to which extent the god of volantile memories watches over reasonable usage...

...but, hey, it's an interesting topic and...
I think I've showed that the IncludeBinary command is only a solution for a very limited number of resources and then lacks some functionality
... - no offense meant - by my observations, IncludeBinary (upped with individually encrypted data probably?) seems to be a well solution for protecting own software to a certain extent.

Maybe now it's time to ask the god of volantile memories... Fred? Fred? Can you hear me? :wink:

-

Posted: Tue Aug 19, 2003 6:25 pm
by Karbon
I should have gone and read up more on thinstall before I shot my mouth off!

It is very different than IncludeBinary for sure.. It's using a virtual OS and filesystem to accomplish it's tasks.. Very cool if you can afford it!

Ah..

Posted: Tue Aug 19, 2003 9:00 pm
by LJ
@Karbon,

Ahh.. but now that you've done research on Thininstall you know more than some posting in this thread and certainly as much as I.

I'm sure there is a way we can duplicate the virtual functionality and compacting of many files into a single .exe. For one, we have compressing features in Purebasic so that's easy. Getting many files into an .exe, now that is possible with Purebasic's file handling commands. But how to index them, and how to control what program in the compressed .exe runs first, that is the challenge. I was thinking that maybe it's like Max's program. Maybe the only executable .exe is the one you specify, and everything else is appended to this .exe compressed in .pak format. If this is true, then how do you create an index telling the .exe that runs to load files from this .pak, maybe with the IncludePath command?

Have you looked at Terabit's DataPak free program for Blitz users? This guy made this program for Blitz that does precisely what we are talking about, and then he gave it away free. I'm sure there is a way to convert this over to Purebasic, just not sure how and where to start.

His method is that in the program you write, you include the statement Include "<i forgot file name>.bb" We have this same Include command in Purebasic. Now this is where I get lost. If you look at this Include file, it's pretty intense coding. Then, I think it calls a .DLL that has to be in the program's directory?--not sure about this.

If you have Blitz and have a chance to check this code out, I'm interested in your thoughts on if we can come up with a similar solution for Purebasic users.

Lj

Posted: Tue Aug 19, 2003 11:08 pm
by Max.
@ Karbon, LJ

I start to become curious... what I found now are these three links:

http://www.collakesoftware.com for a software called "PEBundle" (not tried yet)
http://win32assembly.online.fr/pe-tut1.html for something that calls itself "PE Tutorial"
http://www.windowsitlibrary.com/Content/356/11/1.html

-

Posted: Tue Aug 19, 2003 11:09 pm
by Karbon
Yeah, I've used Lee's packer before. I still play in Blitz some..I don't think it's open source but I don't know for sure..

This sounds like a project that we should all start and give back to the PB community! I'm afraid I don't know where to start either though!

*stares blankly at a new document in japbe*

Posted: Wed Aug 20, 2003 12:33 am
by Manne
I've used PEBundle for several times.
UPX has definetly the better compression algo.

Manne

Ohh

Posted: Wed Aug 20, 2003 5:32 am
by LJ
Argghhh... PEBundle ALMOST worked. It started throwing fatal errors after running for about 8 minutes compressing my sprawling 263 files 50 meg project. Darn, so close. It also didn't allow me to select all the files in the folder, it took only about 15 files at a time so I had to keep clicking on Add module and selecting the next 15 files.

Unfortunately it seems PEBundle is not robust enough to handle the number of files I'm looking for. The $30 price tag is fantastic, I wish this would have worked because I would have purchased it in a second.

I'm with you guys on this one, don't know where to start. It seems right to create a .pak file and then append the file to the end of the .exe that does 4 things: 1) extracts the contents to a temp or hidden folder somewhere and 2) re-writes all the .exe's file locations to point to the temp folder, and 3) terminates itself and then executes the first file in the .exe to start running the program, and 4) when the program is terminated, erase the temp folder it created and all the contents.

Posted: Wed Aug 20, 2003 7:28 am
by Paul
@LJ

Take a look at these files...
http://www.reelmediaproductions.com/test/PurePAK.zip

One file will PAK a complete folder (just put all your files into a single folder). The other will show how you can list the contents of the PAK file and easily extract any file at will.

This is just to demonstrate how you can easily create your own PAK system using PB, and if you take it a few steps further you can easily attach the PAK file to your application/game and you could even 'catch' files right from memory without even having to extract them to your harddrive.


Of course I still say your app/game will be faster and more efficient if you use 'Catch' with 'IncludeBinary'. No matter what you are going to be using memory at some point.

Posted: Wed Aug 20, 2003 7:59 am
by Rings
take a look at the free tool from me called 'Xtract3' .
It bundles different files(and directorys) to one single executable EXE
and does the job very well for me.
download here:
XTRACT-3

Posted: Wed Aug 20, 2003 2:43 pm
by Karbon
Who develops Xtract3? I'm interesting in viewing the license for it (if it has one)..

Thanks!

Posted: Wed Aug 20, 2003 3:24 pm
by Rings
Karbon wrote:Who develops Xtract3? I'm interesting in viewing the license for it (if it has one)..

Thanks!
me.
this version is free
the pro-version is still under development

Posted: Wed Aug 20, 2003 3:34 pm
by Karbon
Oh! Well let us know when it's finished!

Thanks!!!!

You did it!

Posted: Wed Aug 20, 2003 4:02 pm
by LJ
You did it Rings! Wow, it works great! Compacted my 50 meg application with 160+ files into a single .exe of 28 megs, just like Thinstall!

I notice that when I first click on the .exe my hard drive runs a bit before executing. I'm hoping this is because it's setting up a temp file. But I do have a question. My test platform is 512 megs of RAM computer. I want someone with 64 megs of RAM to be able to run this. What I need to know, any developer does, is it still loading my files individually as the program is designed to do rather than loading everything into memory all at once? For example, I have about 120+ jpg files that are viewed in certain chapters. When the chapter is closed, the jpg file(s) and the sound files in that chapter are freed from memory and the next chapter with jpgs is loaded into memory and displayed. In some chapters that are very small, only a single jpg is loaded, and then destoyed when closed. Does Xtract 3 perserve this module memory efficient design of my program? I do not want Xtract 3 to load all my resources in at once. That's okay on my 512Meg super computer, but on a 64meg computer I fear it would bring it to its knees.

Posted: Wed Aug 20, 2003 6:12 pm
by Rings
one generally problem with the Windows-loader:

Windows loads completly every EXE into memory!
Completly!

So if you want save memory, you have to go for the PAK-way with an extra files contains all datas to xtract.That is not a problem for xtract of course to handle that.i think about it too.....

Alright.

Posted: Thu Aug 21, 2003 1:54 am
by LJ
I loaded Task Manager and watched what happened with the processes and it works great. It only loads in each file as it needs it, and then the resources are freed when the program is closed. The jpg's also are only loaded in when the program needs to display them, and then freed when closed, just like I designed the program to do. So your program is the exact solution I am looking for.

I like the GUI also, very nice colors and Windows.

Out of appreciation I would like to purchase your program when you set the e-commerce stuff up. Let me know when I can swipe the credit card. :D Please add my name to your list of future customers so you don't forget to message me when you are ready to sell the full version.

Thanks again.
Lj