Compressing a MOD. | developer.brewmp.com Compressing a MOD. | developer.brewmp.com

Developer

Compressing a MOD.

Forums:

Hi guys,
I've been thinking and I was wondering if anyone else has thought of this or tried implementing it?

My Idea
----------
Writing a small stub decompressor that will decompress and restore the application data (MOD and BAR) that has been recieved from OTA installation. In other words having a stub MOD and a ZIP file that when first runs will decompress resources and the correct MOD file into the same directory so that I can have a larger application than 300kb. But is 300kb or less when being downloaded.

Anyone?
- Skavenger

Hi
I don't think this is possible, as BREW won't execute any BREW file which is not signed, and I am not sure whether an application can replace its own .mod file.
Theoretically it should be possible to have a partially compressed mod file which would uncompress on the fly. In fact BREW doesn't prevent execution of the code on the heap, so theoretically it should be even possible to keep parts of the code in resource files, decompress them on the heap and execute them there, but that sounds like quite complicated task.
Anyway, I think someone is already doing something similar:
http://www.s-cradle.com/english/products/bcompress/readme.html
Zim

Hi
I don't think this is possible, as BREW won't execute any BREW file which is not signed, and I am not sure whether an application can replace its own .mod file.
Theoretically it should be possible to have a partially compressed mod file which would uncompress on the fly. In fact BREW doesn't prevent execution of the code on the heap, so theoretically it should be even possible to keep parts of the code in resource files, decompress them on the heap and execute them there, but that sounds like quite complicated task.
Anyway, I think someone is already doing something similar:
http://www.s-cradle.com/english/products/bcompress/readme.html
Zim

I'd have thought at least Brew would have been able to load and run another MOD file from inside another.
There are ways round not being able to load another MOD i suppose, I could use the stub to dynamically link another .MOD (or equivalant) after it has been uncompressed onto the heap. A bit of work I know but as MOD files get bigger and bigger it may be worthwhile exploring.
- Skavenger.

I'd have thought at least Brew would have been able to load and run another MOD file from inside another.
There are ways round not being able to load another MOD i suppose, I could use the stub to dynamically link another .MOD (or equivalant) after it has been uncompressed onto the heap. A bit of work I know but as MOD files get bigger and bigger it may be worthwhile exploring.
- Skavenger.

Well, BREW can do that via BREW extensions mechanism. BREW extensions are separate mod files, but the problem is they must be signed as well, and they are not stored in your application directory so you can't modify them. So extensions are not a solution.
However, as I said, you can skip BREW entirely and load any file into RAM yourself and execute it. There are no physical restrictions at the moment.
Zim

Well, BREW can do that via BREW extensions mechanism. BREW extensions are separate mod files, but the problem is they must be signed as well, and they are not stored in your application directory so you can't modify them. So extensions are not a solution.
However, as I said, you can skip BREW entirely and load any file into RAM yourself and execute it. There are no physical restrictions at the moment.
Zim