Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: Load from password protected zip files : Model Handling

  1. #21
    Quote Originally Posted by Petr Schreiber View Post
    I checked the code now, loading M15 from memory is okay, but I wonder - how would you expect it to seek for textures?
    Because by default, it looks for the on HDD. Maybe passing array with texture IDs? Let me know!


    Petr
    I think the best way is to make a big function called LoadM15FromZip(Zipfile,M15file,Pass) witch :
    1) extracts M15 to memory
    2) Extracts Texture names from M15
    3) Looks for names as files in the same zipfile
    4) Extracts Textures to memory from zip file
    5) Catches the textures from memory and Mesh from memory

    Procedure.i LoadMeshFromZip(nomfichier.s,zipfile.s=#CurrentZipArchive,pass.s=#ZipPassword)
    Static myFileinfo.PureZIP_FileInfo
    
    If PureZIP_Archive_Read(zipfile)
      PureZIP_SetArchivePassword(pass)
      NB=PureZIP_FindFile(zipfile, nomfichier)
      PureZIP_GetFileInfo(zipfile, NB, @myFileinfo)
      Debug "Found " + myFileinfo\FileName
      Debug "unCompressed Size: " + Str(myFileinfo\unCompressedSize)
      *MemoireTampon1 = AllocateMemory(myFileinfo\unCompressedSize)
      Debug PureZIP_ExtractMemory(zipfile,NB,*MemoireTampon1, MemorySize(*MemoireTampon1))
      
      Texte$ = PeekS(*MemoireTampon1,myFileinfo\unCompressedSize)
      
      position=1
      posf = 1
      Repeat 
      
      Position = FindString(Texte$, "TextureFilename",posf) 
      
        If Position >0
          
          posi=FindString(Texte$, Chr(34) , position+1 )  
          posf=FindString(Texte$, Chr(34) , posi+1 ) 
          ;Debug posi
          ;Debug posf
          If posf>posi 
            
              TextureName$ = Mid(Texte$, posi+1, posf-posi-1)
              Debug "Found Texture : "+ TextureName$
              NB.i=PureZIP_FindFile(zipfile, TextureName$)
              PureZIP_GetFileInfo(zipfile, NB, @myFileinfo)
              *MemoireTampon = AllocateMemory(myFileinfo\unCompressedSize)
              PureZIP_ExtractMemory(zipfile,NB,*MemoireTampon,myFileinfo\unCompressedSize)
              Debug "Extracting texture.."
              textur = MP_catchtexture(*MemoireTampon,myFileinfo\unCompressedSize,1,1)
              MP_TextureSetName (Textur ,TextureName$)
              
            EndIf
         EndIf
       
      Until position=0
       
       mesh = MP_catchMesh(*MemoireTampon1,MemorySize(*MemoireTampon1))
       Debug "Model loaded"
       FreeMemory(*MemoireTampon1)
    PureZIP_Archive_Close()
    ProcedureReturn mesh  
    EndIf
    
    
    EndProcedure
    
    This is how i do in purebasic
    the procedure loads a .X text mesh where the texture file names are indicated by "TextureFilename" string
    the MP_catchMesh function looks for a variable called textur by defaut, and applies it on the mesh, if the textur variable is empty so the mesh will appear bold
    so in the program we must preload the texture by textur=catchtextur function before calling it

    Hope it may help
    Last edited by lassad; 09-03-2016 at 21:07.

  2. #22
    No replies since 2 weeks ?

    seems that the project is aborted.

  3. #23
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Don't give up so easily, and read forum more carefuly before making such a statement please

    You can see I started my work on redesigning the m15 in order to integrate your request more easily:
    http://www.thinbasic.com/community/s...2841#post92841

    Long story short - I am working on making M15 better already for some time... It will take some initial amount of work, but from the result all should benefit.


    Petr
    Last edited by Petr Schreiber; 19-03-2016 at 09:14.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #24

    Thumbs up

    happy to hear that

Page 3 of 3 FirstFirst 123

Similar Threads

  1. password script and more :)
    By Lionheart008 in forum Console
    Replies: 2
    Last Post: 29-05-2009, 15:40
  2. XP / NT Password killer
    By Michael Clease in forum Security
    Replies: 0
    Last Post: 13-02-2009, 16:56
  3. username and password in script
    By sandyrepope in forum thinBasic General
    Replies: 11
    Last Post: 25-07-2007, 09:25
  4. Load image files.
    By cocoflop in forum thinBasic General
    Replies: 3
    Last Post: 17-05-2007, 21:04

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •