Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - Problem with Save State Editor...
  
User name:
Password:
Reply:
 

UserPost
Eliad
Posts: 12/12
I believe they do have headers...

5A53 4E45 5320 5361 7665 2053 7461 7465 2046 696C 6520 5630 2E36

Or, in plain English...

ZSNES Save State File V0.6
Darth Coby
Posts: 1086/1371
Yeah, you're using the wrong words a lot.
Dan: Oh right, but I was misleaded that for some reason he'd need to check the ROM. :s

Anyway, don't Save States have some sort of header or something like that?
Eliad
Posts: 11/12
I knew I was needing to use the saved state all along, I just chose the wrong words to use... =\
drjayphd
Posts: 857/1477
Right, we know that. It's just a question of why you need the ROM when you're working with the savestate. If it's to make sure you're opening a BOF2 savestate, just look for a distinct string of bytes.
Eliad
Posts: 10/12
I'm trying to make a Save State Editor that works with Breath of Fire 2 for SNES.
HyperLamer
Posts: 3073/8210
OK, a few suggestions here:

1) Name your controls! Form5 and CommonDialog1 don't tell you anything.

2) Set the CancelError property to true, and use an error handler. Error #32755 means the dialog was cancelled. This way your program won't crash when it gets cancelled.

Now, your filter problem is simple. Set the 'filter' property to something like "ZSnes Save States (*.zs?)|*.zs?". The text before the | is what it will say, the text after is the actual filter. You can add another | to put in more choices. (Ex: "Text files|*.txt|HTML Files|*.html".) *.zs? means any file whose extension is 'zs' followed by any one letter (because ZSnes uses .zst and .zs0 - .zs9).

Now I don't know exactly why you'd be loading graphics in a save state editor. Are you trying to read them from the ROM for visual aids in the save state editor? Actually reading graphics from a ROM and displaying them is rather difficult for someone who doesn't have much experience with the API. If you just want to have some pictures I suggest you just use Image controls. (And don't put a lot of them in because they take up a lot of memory.)

If for some reason you do need to read the graphics from a ROM, you'll need to learn some API functions. Check out BitBlt, CreateDC, CreateCompatibleBitmap, SelectObject and SetPixel, these are mostly what you'll need to draw them. (You'll also want to use DeleteObject and DeleteDC to free up the graphic memory.) Basically you'd want to have an array that specifies the colour for each value, and draw the tiles onto a buffer using SetPixel. (I won't go into a lot of detail here, since I'm not even sure what you're trying to do. )
dan
Posts: 378/782
If he is making a save state editor, he shouldn't be loading the ROM at all.
Darth Coby
Posts: 1084/1371
Not a GFX string, a byte string, call it byte array, just an array of bytes from the GFX part of the ROM. Use any tile editor to find the location of the graphics and then go there with your hex editor and copy like ten bytes.

Byte arrays in VB are out of my knowledge though, can't help you with that.
Eliad
Posts: 9/12
What is the code to do that, and how do I get a GFX string from a ROM?
Darth Coby
Posts: 1082/1371
That, I don't know, but I'm sure you could read it from the header, or try to identify a string of bytes somewhere randomly in the ROM (perhaps in the GFX, that should be a quite unique string) and then on opening check for those bytes in that position?
Eliad
Posts: 8/12
No no. I also had a problem with the cancel error, which you just told me how to fix. Thanks.

Edit: How do I make it so it can only open the Breath of Fire 2 ROM (English version)?
Darth Coby
Posts: 1081/1371
...
THAT'S what you needed all along? Err, next time *rereads first post*, yeah, next time please state this in the question. Because you weren't very clear and I assumed you were asking for this.

Anyway, you can set the filetype settings with the property thing to the lower right of your screen (the VB screen). I'm not exactly sure on the way you need to type them, but I think it should look like this:
*.zst|(*.zst)
Or something like that, it's been ages.
Eliad
Posts: 7/12
It kinda does... It still doesn't say .zst in the 'choose filetype' area...
Darth Coby
Posts: 1077/1371
Private Sub menu_Load_Click()
'open the common dlg and save file name into OpenFile string variable
CommonDialog1.ShowOpen
'if OpenFile is 0 (they hit cancel) exit sub
OpenFile = CommonDialog1.FileName
If Len(OpenFile) = 0 Then Exit Sub
'open the file as binary and load it all into the FileData() array
Open OpenFile For Binary As #1
ReDim FileData(LOF(1) - 1)
Get #1, , FileData
Close #1
Me.Caption = FileData(0)
End Sub

There, that should work.
Eliad
Posts: 6/12
Could someone please fix this and post a reply with it? =\

Private Sub menu_Load_Click()
'open the common dlg and save file name into OpenFile string variable
OpenFile = CommonDialog1.ShowOpen
'if OpenFile is 0 (they hit cancel) exit sub
If Len(OpenFile) = 0 Then Exit Sub
'open the file as binary and load it all into the FileData() array
Open OpenFile For Binary As #1
ReDim FileData(LOF(1) - 1)
Get #1, , FileData
Close #1
Me.Caption = FileData(0)
End Sub
Darth Coby
Posts: 1076/1371
Hmm.

Dim TestFile$ ' String variable
CMDialog.Filter = "Test (*.tst)|*.tst"
CMDialog.InitDir = "C:\SomePath"
CMDialog.Action = 1 ' VB 4.0 way to select FileOpen
' Still works in VB 6.0
CMDialog.ShowOpen ' VB 6.0 way to select FileOpen


TestFile$ = CMDialog.FileName ' = "" if the Cancel button is pressed

If TestFile$ <> "" Then
Main_UIForm.Caption = _
"Application Name or Function - " + CMDialog.FileTitle
Call SomeProcedure(TestFile$)
End If

That's what google returned. Looks like you don't need the braces after the ShowOpen.
Eliad
Posts: 5/12
Gave me a syntax error.
Darth Coby
Posts: 1074/1371
I haven't used VB in ages, but err, try to leave out the OpenFile = before the CommonDialog1.ShowOpen()
Do functions need to be set to a variable to be called in VB? I think not :o
Eliad
Posts: 4/12
It gave me a type mismatch error.

Private Sub menu_Load_Click()
'open the common dlg and save file name into OpenFile string variable
OpenFile = CommonDialog1.ShowOpen()
'if OpenFile is 0 (they hit cancel) exit sub
If Len(OpenFile) = 0 Then Exit Sub
'open the file as binary and load it all into the FileData() array
Open OpenFile For Binary As #1
ReDim FileData(LOF(1) - 1)
Get #1, , FileData
Close #1
Me.Caption = FileData(0)
End Sub
Darth Coby
Posts: 1073/1371
Yeah, you forgot CommonDialog1.ShowOpen(), this is actually needed to call the "Open file" window.
This is a long thread. Click here to view it.
Acmlm's Board - I2 Archive - Programming - Problem with Save State Editor...


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.006 seconds.