Ok, Back at it!
First lets clean up/replace our do/loop in our main dba file
main dba file
do
//Key Descriptions
text 0,20,"F1: Display Header"
text 0,40,"F2: Display Root Frame (Code 1 )"
text 0,60,"F3: Display Frame Name (Code 101)"
text 0,80,"F4: Display Frame Matrix (Code 102)"
//Special Keys and Text
if keystate(2)=1 then hide object 1 //hide the object so we can see our text easier
if keystate(3)=1 then show object 1 //show the object
if keystate(59)=1 then DisplayHeader() //F1 Key
if keystate(60)=1 then DisplayRootFrameInfo() //F2 Key
if keystate(61)=1 then DisplayFrameNameInfo() //F3 Key
if keystate(62)=1 then DisplayFrameMatrix() //F4 Key
text 0,445,"Counter: "+str$(counter - 1)+" --- CodeIndex: "+str$(CodeIndex) //show our various counters
text 0,460,"Keys: 1 Hide Object : 2 Show Object" //press 1 to hide or 2 to show the object
sync
DoSleep(1)
loop
Let's add these functions to display our text
functions.dba
function DisplayHeader()
//Display the File Size and DBO Header
texty = 50
while spacekey()=0
text 0,0,"Viewing The DBO File Size and Header - Press Space Bar to return"
//text 0,30,"File Size and DBO Header:"
//Part 1: Display The Basic File Info
text 0,30,"DBO File size (+1): "+str$(filesize)
//Part 2: The Header
text 0,70,"DBO Header Information:"
text 0,90,"(dword) HeaderString Length: "+str$(HdStringLen)
text 0,110,"(string) HD$: "+(HD$)
text 0,130,"(dword) HdVersion: "+str$(HdVersion)
text 0,150,"(dword) Hd Res 1: "+str$(HdRes1)
text 0,170,"(dword) Hd Res 2: "+str$(HdRes2)
//End Part 2: The Header
text 0,445,"Counter: "+str$(counter - 1)+" --- CodeIndex: "+str$(CodeIndex) //show our various counters
sync
endwhile
endfunction
function DisplayRootFrameInfo()
while spacekey()=0
//Part 3 Data Blocks
text 0,0,"Viewing The Root Frame Information - Press Space Bar to return"
text 0,30,"Get the Root Frame (code 1) and it's Code Size"
text 0,50,"(dword) Code: "+str$(DbCode)+" (Code 1 - The Root Frame)"
text 0,70,"(dword) Code Size: "+str$(DbCodeSize)+" (Code Size of the Root Frame)"
text 0,445,"Counter: "+str$(counter - 1)+" --- CodeIndex: "+str$(CodeIndex) //show our various counters
sync
endwhile
endfunction
function DisplayFrameNameInfo()
//Get The Frame Name code, length and string
while spacekey()=0
text 0,0,"Viewing The Frame Name Information - Press Space Bar to return"
text 0,30,"Get the Frame Name (code 101)"
text 0,50,"(dword) Frame Name Code: "+str$(DbFrameCode)
text 0,70,"(dword) Frame Name Length of string block: "+str$(DbFrameStringLength)
text 0,90,"(string) Frame Name : "+DbFrameName$
text 0,445,"Counter: "+str$(counter - 1)+" --- CodeIndex: "+str$(CodeIndex) //show our various counters
//End Get The Frame Name
sync
endwhile
endfunction
And let's replace our DisplayFrameMatrix() function with this:
functions.dba
function DisplayFrameMatrix()
//Display the Frame Matrix
texty = 50
while spacekey()=0
text 0,0,"Viewing The Frame Matrix Array of Floats - Press Space Bar to return"
text 0,30,"Frame Matrix (Code 102):"
text 0,50,"(floats) Index 1 (16 bytes = 4 floats): "
text 0,70,"(floats) Index 2 (16 bytes = 4 floats): "
text 0,90,"(floats) Index 3 (16 bytes = 4 floats): "
text 0,110,"(floats) Index 4 (16 bytes = 4 floats): "
text 0,320,"Get the Frame Matrix (code 102)"
text 0,340, "(dword) Frame Matrix Code: "+str$(DbFrameMatrixCode)
text 0,360, "(dword) Frame Matrix Size: "+str$(DbFrameMatrixSize)
for x = 1 to 4
textx = 0
for y = 1 to 4
text textx+340,texty,str$(DbFrameMatrix(x,y))+" "
textx=textx+20
next
texty=texty+20
next
if texty > 110 then texty=50
text 0,445,"Counter: "+str$(counter - 1)+" --- CodeIndex: "+str$(CodeIndex) //show our various counters
sync
endwhile
endfunction
And finally, so our new text functions display correctly, let's add some global vars.
At the bottom of our "//Header Info" section
globals.dba
global HdStringLen = 0
global HD$ = ""
global HdVersion = 0
global HdRes1 = 0
global HdRes2 = 0
And at the bottom of our "//Data Blocks" section.
globals.dba
global DbFrameMatrixCode = 0
global DbFrameMatrixSize = 0
Press the various named F keys to see that Data Block. (Currently F1 thru F4)
That's it for today! We'll decode the next Data Block (The Frame Mesh: 103) tomorrow!.