Multifile asset usage coding help

Hi,

I am trying to use multify to store encrypted assets,
then later use thes encrypted assets in a game.

I am receiving the error:

:pnmimage(error): seek error for offset 2560

This is the H:\Panda3D-1.6.2\samples\Chessboard example.

I have made a copy of the contents of the contents of the

H:\Panda3D-1.6.2\samples\Chessboard folder.

I have placed these in the directory

H:\Panda3D-1.6.2\products\Chessboard

I am encrpypting the models directory

H:\Panda3D-1.6.2\products\Chessboard>multify -c -f models.mf -ep “mypass” -v models

models/bishop.egg.pz
models/cmss12.egg.pz
models/king.egg.pz
models/knight.egg.pz
models/maps/cmss12.rgb
models/models.mf
models/pawn.egg.pz
models/queen.egg.pz
models/rook.egg.pz
models/square.egg.pz

I have made the multifile

H:\Panda3D-1.6.2\products\Chessboard>dir


09/01/2009 10:02 PM 420,209 models.mf

I am verifying the contents of the mulifile

H:\Panda3D-1.6.2\products\Chessboard>multify -t -f models.mf -ep “mypass” -v
OR JUST
H:\Panda3D-1.6.2\products\Chessboard>multify -tvf models.mf -p “mypass”

10 subfiles:
57523 e Apr 14 2006 models/bishop.egg.pz
6823 e May 14 11:52 models/cmss12.egg.pz
69724 e Apr 14 2006 models/king.egg.pz
63930 e Apr 14 2006 models/knight.egg.pz
35394 e May 14 11:02 models/maps/cmss12.rgb
18 e Sep 01 22:00 models/models.mf
43581 e Apr 14 2006 models/pawn.egg.pz
66585 e Apr 14 2006 models/queen.egg.pz
75695 e Apr 14 2006 models/rook.egg.pz
230 e Apr 14 2006 models/square.egg.pz
Last modification Sep 01 22:02

I have moved the old models directory safely out of the way

H:\Panda3D-1.6.2\products\Chessboard>move models Xmodels

I have created a copy of the shortcut “Run Chessboard.lnk”
I have changed its target path from Tut-Chessboard.py to test.py
I have named the link “Run_test.lnk”

I have made a test file that is a copy of the Tut-Chessboard.py
I have named it test.py

I have added the following code to test.py (Tut-Chessboard.py)
These additions are just beneath

import sys

from pandac.PandaModules import Multifile
mf = Multifile()
mf.openRead("models.mf")
mf.setEncryptionFlag(True)
mf.setEncryptionPassword("mypass")

from pandac.PandaModules import VirtualFileSystem
vfs = VirtualFileSystem.getGlobalPtr()
if vfs.mount(mf, ".", VirtualFileSystem.MFReadOnly):
  print 'mounted'

I ran the game.

H:\Panda3D-1.6.2\products\Chessboard>Run_test.lnk

I recieved back the response


mounted
:pnmimage(error): seek error for offset 2560

Next, the game just dies.

Any ideas?

Thank you.

You’ll need to change the texture format to jpg or png. The rgb format requires seeking forward and backward through the file in order to decode the image, which means it can’t be stored encrypted or compressed within a multifile (because the real-type decryption and decompression algorithms are stream-based, and don’t support random seeking).

David

The flipside being, of course, that you can keep your format if you don’t compress and encrypt your multifile.

Thanks,

I really appreciate the ideas and direction.

I ended up taking the easy way out.
I found an original ttf file: arial.ttf.
I replaced cmss12.rgb with arial.ttf.
I multified my ‘model’ directory into model.mf.
Next, I changed my code to read

font = loader.loadFont("models/arial.ttf")

I ran the game. I the game runs. I can see the arial font.

Andre_Mikulec