Problems using "Right" in Blitz3D 1.100
Archives Forums/Blitz3D Bug Reports/Problems using "Right" in Blitz3D 1.100
| ||
Function StripPath$(file$) If Len(file$)>0 For i=Len(file$) To 1 Step -1 mi$=Mid$(file$,i,1) If mi$="\" Or mi$="/" Then Return name$ Else name$=mi$+name$ Next EndIf Return name$ End Function One alternate function that supposedly does the same, but has the exact same issues: Function isolatename$(wha$) For t=Len(wha$) To 1 Step -1 If Mid$(wha$,t,1)="\" Or Mid$(wha$,t,1)="/" Then Return Right$(wha$,Len(wha$)-t) EndIf Next Return wha$ End Function Last one from Terabit Data Packer. These examples (first one is even found in the code samples) no longer works in 1.100. Gives me a "Memory Access Violation" and it used to work before on 1.99, though now that I tested it separately, it appears to work. I have no clue why it just stopped working on my project after using 1.100. I rolled back to 1.99 to see if the update was the problem, and the functions once again work. I believe the problem comes from the Terabit library, specially the "pak()" function: Function pak$(pkf$) ; Get Filename to retrieve If Left$(pkf$,1)="\" Or Left$(pkf$,1)="/" Then pkf$=Right$(pkf$,Len(pkf$)-1) Local IsoName Local cnt Local item Local Pack Local Output Local Block Local filecnt Local Hold Local Ext$ Local Ex2$ Local outf$ If Instr(pkf$,"\")=0 And Instr(pkf$,"/")=0 Then IsoName = True Else CreateDirTree IsoPath(pkf$) EndIf For cnt=1 To PackCount ; Count through Archive list If IsoName = True Then If isolatename(Upper$(pakfiles$(cnt)))=Upper$(pkf$) Then ; If it exists in Archive item = cnt ; then set item to it's index Exit ; and break out of the loop EndIf Else If Upper$(pakfiles$(cnt))=Upper$(pkf$) Then ; If it exists in Archive item = cnt ; then set item to it's index Exit ; and break out of the loop EndIf EndIf Next If item = 0 Then ; If no items were found Return pkf$ ; Exit the subroutine EndIf LastPak$ = IsoPath(pkf$)+pakAPND$+isolatename(pkf$) For lpk.unpackedfiles = Each UnpackedFiles If Upper$(lpk\file$) = Upper$(LastPak$) Then exists = 1 : Exit Next If exists=0 Then lpk.UnpackedFiles = New UnpackedFiles lpk\file$ = LastPak$ EndIf If FileType(IsoPath(pkf$)+pakAPND$+isolatename(pkf$))=0 Or PakBulkOverwrite = True Then ; Does the File Already Exist? Pack = ReadFile(Packname$) ; Open the Archive SeekFile(Pack,paklocate(item)) ; Locate the Data in the store Output = WriteFile(IsoPath(pkf$)+pakAPND$+isolatename(pkf$)) ; Open the output File Block = CreateBank(PakSize(item)+4) ReadBytes Block,Pack,0,PakSize(item) If key<>0 Then For filecnt=1 To PakSize(item) Step 4 Hold=PeekInt(Block,filecnt-1) Hold = Hold Xor key PokeInt Block,filecnt-1,Hold Next EndIf WriteBytes Block,Output,0,PakSize(item) CloseFile(Output) CloseFile(Pack) EndIf Ext$ = Upper$(Right$(pkf$,4)) Ex2$ = Upper$(Right$(pkf$,2)) FreeBank Block If Ext$=".3DS" Or Ex2$=".X" Or Ext$="MD2" Then texcheck(IsoPath(pkf$)+pakAPND$+isolatename(pkf$)) If Ext$=".B3D" Then ParseB3D(IsoPath(pkf$)+pakAPND$+isolatename(pkf$)) Return IsoPath(pkf$)+pakAPND$+isolatename(pkf$) ; Return the Filename End Function PS Please excuse the incorrect title... Can't edit it. |