| View previous topic :: View next topic |
| Author |
Message |
gfetgkh Newbie cheater
Reputation: 0
Joined: 06 Apr 2018 Posts: 22
|
Posted: Sun Dec 22, 2019 4:51 am Post subject: How do I load pictures from zip into the image control? |
|
|
Zip is added to TableFile, How do I load pictures from zip into the image control?
| Description: |
|
| Filesize: |
291.59 KB |
| Viewed: |
4571 Time(s) |

|
|
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3329
|
Posted: Sun Dec 22, 2019 4:56 am Post subject: |
|
|
I am curious: why'd you ZIP a JPG?
JPGs are already compressed.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25820 Location: The netherlands
|
Posted: Sun Dec 22, 2019 5:01 am Post subject: |
|
|
extract the contents of the .zip and then add that to the cheat table
or write your own unzip code in lua
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Sun Dec 22, 2019 5:28 am Post subject: |
|
|
| Dark Byte wrote: | extract the contents of the .zip and then add that to the cheat table
or write your own unzip code in lua | Do you have any codes or examples related to Lua unpacking
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun Dec 22, 2019 10:26 am Post subject: |
|
|
Files added to the CT file are already compressed with zlib.
Of course when you save to CT file, compressed stream (inside memory stream) is serialized and converted to text ( binary-to-text encoding - my implementation of Ascii85 encoding)
and overhead is 25%
For example you added 100KB file and zlib can compress it to 60%, final size in the CT file will be:
100KB * 60% * 125% = 75KB
EDIT:
| Csimbi wrote: | I am curious: why'd you ZIP a JPG?
JPGs are already compressed. |
It got me thinking. Maybe he wants to add few hundreds of files.
I've just written a simple "CE Tape Archiver" (CETAR) implementation.
Creating CETAR:
| Code: | testArchive = getCETapeArchive('bigBuckBunny.cetar', true) -- getCETapeArchive(name, OPTIONAL reset default false)
filepath = [[C:\Users\mgrinzPlayer\Desktop\big buck bunny\]]
for i=1,300 do
local fileName = string.format('image%04d.jpg',i)
testArchive.addFile(fileName, filepath..fileName)
end |
List all files from CETAR:
| Code: | testArchive = getCETapeArchive('bigBuckBunny.cetar') -- getCETapeArchive(name, OPTIONAL reset=false)
print( testArchive.listContent() ) |
Using CETAR:
| Code: | testArchive = getCETapeArchive('bigBuckBunny.cetar') -- getCETapeArchive(name, OPTIONAL reset=false)
form = createForm()
image = createImage(form)
image.Proportional = true
image.Align = 'alClient'
imageNumber = 0
timer = createTimer(form)
timer.Interval = 1
timer.OnTimer = function ()
local fileName = string.format('image%04d.jpg',imageNumber + 1)
local fileMemoryStream = testArchive.findFile(fileName)
image.Picture.Jpeg.loadFromStream(fileMemoryStream)
fileMemoryStream.destroy()
form.Caption = imageNumber
imageNumber = (imageNumber + 1) % 300
end |
Demo files (zipped CT files):
1. "CE Tape Archiver" demo
2. Traditional way
3846KB versus 4053KB
3. cetrainer versions
_________________
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sun Dec 22, 2019 7:43 pm Post subject: |
|
|
mgr.inz.Player CETAR tool is very useful. Thanks.
Before use mgr.inz.Player CETAR tool, I am using vbs script to unzip files.
unzip.vbs :
| Code: | 'The location of the zip file.
ZipFile="E:\Capture.Zip"
'The folder the contents should be extracted to.
ExtractTo="E:\Capture\"
'If the extraction location does not exist create it.
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(ExtractTo) Then
fso.CreateFolder(ExtractTo)
End If
'Extract the contants of the zip file.
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing
|
example use with CE (zip contain single image file)
| Code: | f = createForm()
img = createImage(f)
img.Align = 'alClient'
img.Stretch = true
path = TrainerOrigin or getMainForm()
pic_zip = findTableFile('Capture1.zip')
pic_zip.saveToFile(path..'//Capture.zip')
os.execute('unzip.vbs')
file = path..'//Capture//'
img.Picture.loadFromFile(file..'Capture1.jpg')
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3329
|
Posted: Mon Dec 23, 2019 1:13 pm Post subject: |
|
|
| mgr.inz.Player wrote: |
It got me thinking. Maybe he wants to add few hundreds of files.
I've just written a simple "CE Tape Archiver" (CETAR) implementation.
|
Nice!
|
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Wed Dec 25, 2019 9:49 am Post subject: |
|
|
| mgr.inz.Player wrote: |
| Code: | | testArchive = getCETapeArchive('bigBuckBunny.cetar', true |
| Do you have to use it from the form,I wonder if I can use it from my local disk | Code: | | testArchive.listContent() | How to get its total
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Wed Dec 25, 2019 1:46 pm Post subject: |
|
|
| .lua wrote: | | Do you have to use it from the form. I wonder if I can use it from my local disk |
Yes you can (needs some modifications). But, what's the point?
| .lua wrote: | | How to get its total |
File count? Archive byte size?
| Code: | | sizeInBytes = testArchive.stream.Size |
_________________
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Dec 25, 2019 9:48 pm Post subject: |
|
|
Do you have to use it from the form,I wonder if I can use it from my local disk[[/quote]
I did it before in the traditional way.
Demo :
https://youtu.be/FCgWobo9NjI
Source code:
https://mega.nz/#!74EG0IBQ!gBciG45nzn2y0CJn6J5Qe6RqBIZfg8ObIzEBCGqsfN8
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Thu Dec 26, 2019 12:00 am Post subject: |
|
|
| mgr.inz.Player wrote: | | File count? | Yes, get file count
|
|
| Back to top |
|
 |
|