[Tool] PureLibrary Explorer

Share your advanced PureBasic knowledge/code with the community.
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: [New tool] PureLibrary Explorer

Post by idle »

Nice work and I'm sure it'll be very handy.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: [New tool] PureLibrary Explorer

Post by RSBasic »

Very nice, thanks for sharing :!:
Image
Image
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: [New tool] PureLibrary Explorer

Post by Lunasole »

impresses, seems you learned PB internals very well. Though I'm a bit disappointed there are no any hidden functions inside :)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: [New tool] PureLibrary Explorer

Post by Keya »

Lunasole wrote:impresses, seems you learned PB internals very well.
just trying to get my stupid head around things lol. The file formats i just figured them out with a hex editor, theyre not obfuscated or compressed or anything so it was straight forwad
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [Tool] PureLibrary Explorer

Post by infratec »

If the procedure GetPurelibType(file$)

is replaced by:

Code: Select all

Procedure.s GetPurelibType(file$)       
  Protected hFile.i, *sMagicBuffer, sMagic.s, sType.s, sInternal.s
  hFile = ReadFile(#PB_Any, file$, #PB_File_SharedRead)
  If hFile
    
    *sMagicBuffer = AllocateMemory(5)
    If *sMagicBuffer
      
      ReadData(hFile, *sMagicBuffer, 4)
      sMagic = PeekS(*sMagicBuffer, 4, #PB_Ascii)
      If sMagic = "ERUP"
        FileSeek(hFile,4)
        ReadData(hFile, *sMagicBuffer, 4)
        If PeekL(*sMagicBuffer) = 'EDLL'
          sType = "EDL"
          FileSeek(hFile,$0D)
        ElseIf PeekL(*sMagicBuffer) = 'LSO1'
          sType = "LSO"
          FileSeek(hFile,$0D)
        Else
          FileSeek(hFile,8)  
          ReadData(hFile, *sMagicBuffer, 4)
          sType = Chr(PeekA(*sMagicBuffer+3)) + Chr(PeekA(*sMagicBuffer+2)) + Chr(PeekA(*sMagicBuffer+1))
          FileSeek(hFile,$14)
        EndIf
        sInternal = ReadString(hFile,#PB_Ascii)
        CloseFile(hFile)
        ProcedureReturn sType + "|" + sInternal
      EndIf
      
      FreeMemory(*sMagicBuffer)
    EndIf
    
  EndIf
EndProcedure
replace SetReturns(sTxt.s) with:

Code: Select all

Procedure.s SetReturns(sTxt.s)
  Protected offset.i, *pchar.Character = @sTxt + StringByteLength(sTxt) - SizeOf(Character)
  Repeat
    *pchar - SizeOf(Character)
  Until *pchar\c = ' '
  offset = (*pchar - @sTxt) / SizeOf(Character)
  ProcedureReturn Left(sTxt, offset) + " retn " + Right(sTxt, Len(sTxt) - offset - 1)
EndProcedure

You can remove or comment the following lines in AppMain:

Code: Select all

  ;   If SizeOf(Character) = 2
  ;     MessageRequester("Compile Error","My bad, Unicode not supported - please use Ascii compile"):
  ;     End
  ;   EndIf  
Then it works with PB 5.73 :mrgreen:
mpz
Enthusiast
Enthusiast
Posts: 494
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: [Tool] PureLibrary Explorer

Post by mpz »

Hello Infratec,

a nice tool. I test it put it looks that "deepscan" doesnt work on my win 10 pc. I klick on a lib and then the deepscan button, but the deep scan windows is empty...

Do you have a solution?

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: [Tool] PureLibrary Explorer

Post by chi »

If you start PureLibrary Explorer with the IDE (Tools), you could change the line

Code: Select all

sPurelibsPath = #PB_Compiler_Home + "purelibraries"
to

Code: Select all

sPurelibsPath = GetPathPart(GetEnvironmentVariable("PB_TOOL_IDE")) + "PureLibraries"
so you don't need to recompile on ever new release and you're able to inspect the libraries of the current PB version you are working with.

Btw. thanks for sharing, Keya 8)
Et cetera is my worst enemy
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: [Tool] PureLibrary Explorer

Post by chi »

mpz wrote: Fri Oct 29, 2021 9:52 pm I test it put it looks that "deepscan" doesnt work on my win 10 pc. I klick on a lib and then the deepscan button, but the deep scan windows is empty...

Do you have a solution?
Did you put some text into the Find: stringgadget? Like Find: window + DeepScan
Et cetera is my worst enemy
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [Tool] PureLibrary Explorer

Post by infratec »

It's not written by me 8)

I only modified it that it works with newer PB versions.

But yes, you have to insert a word like 'window' in the search field.
mpz
Enthusiast
Enthusiast
Posts: 494
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: [Tool] PureLibrary Explorer

Post by mpz »

thanks for the help,

i think it was a problem of the missing help file...


:D

Greeting
Michael
Working on - MP3D Library - PB 5.73 version ready for download
Post Reply