Dragonsbrethren Industries Archive
June 23, 2017, 05:10:35 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Remember, this is just an archive of the Dbi Forum.
 
   Index   Return to Slick Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Visual Basic 6 Question  (Read 1893 times)
JCE3000GT
Guest


Email
« on: October 30, 2007, 09:58:52 PM »

So I'm working out how to dump data from a ROM that uses a pointer for a varying size of data.  In this case, SPC sequences...so take a guess on which program I'm working on. 

Anyway, my problem is this, I can easily read the pointer info and convert it to a data type that I can easily work with.  And with this I can get the complete size of the SPC sequence--my problem is dumping the data into a file.  You have to use the String data type--and specifiy a size.  That's my problem...observe my rudimentary code:

Code:
Sub Export()
Dim Byte1 As Byte, Byte2 As Byte, Byte3 As Byte
Dim Offset, SongSize As Integer, SizeValue, SizeValue2, SizeValueTotal
Dim LSTIndex, ROMIName As String * 21

Close #50

LSTIndex = SongIndexCBO.ListIndex * 3 + 1

'On Error GoTo ErrHandler

Offset = &H54096

Get #1, Offset + LSTIndex + 0, Byte1
Get #1, Offset + LSTIndex + 1, Byte2
Get #1, Offset + LSTIndex + 2, Byte3
Get #1, 65984 + 1, ROMIName

Open App.Path & "/" & ROMIName & " - " & SongIndexCBO & ".spc700" For Binary Access Write Lock Read As #50

SizeValue = Hex(Byte3) + Hex(Byte2) + Hex(Byte1)
SizeValue = HextoDec("&h" & SizeValue) - 12582912
SizeValue2 = Hex(SizeValue)

Get #1, ("&h" + SizeValue2) + 512 + 1, SongSize

SizeValueTotal = SongSize + 2

SongSizeLBL = SizeValueTotal

Dim SPCSeq As String * SizeValueTotal

Get #1, ("&h" + SizeValue2) + 512 + 1, SPCSeq
Put #50, 0 + 1, CStr(SPCSeq)

Close #50

Exit Sub

ErrHandler:
Err.Clear
Exit Sub
End Sub

Everything seems to works perfectly, except my problem is with this line:
Dim SPCSeq As String * SizeValueTotal

For some reason you have to use an actual number and not a stored value.  Anyone have a better solution?

*note*
If need be I can comment some of this code if you don't know what it does.
Logged
Lenophis
Guest


Email
« Reply #1 on: October 30, 2007, 10:11:30 PM »

I'll just paste it.

Quote
[22:06:32] [Lenophis] inter, you are well versed with VB6, yes?
[22:06:46] [interdpth] Yep
[22:06:49] [Lenophis] http://dragonsbrethren.elazulspad.net/forum/index.php/topic,314.0.html
[22:07:54] [interdpth] That code is ugly o_O
[22:08:07] [Lenophis] =\
[22:08:25] [interdpth] My solution is
[22:08:28] [interdpth] Don't use a fucking string
[22:08:29] [interdpth] o-O
[22:08:39] [interdpth] dim spcseq() as byte
[22:08:45] [Lenophis] o_O
[22:08:51] [interdpth] redim spcseq(0 to SizeValueTotal-1) as byte

He says to tell you that.

Quote
[22:11:02] [interdpth] And tell him if he wants to write a string to a text file
[22:11:07] [interdpth] It's print filenumber, string.
[22:11:29] [interdpth] like
[22:11:33] [interdpth] Print #4, thisstring
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!