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... | |
Pages: 1 2Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Eliad

Micro-Goomba
Level: 6

Posts: 1/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-28-05 10:57 PM Link | Quote
I'm making a Save State Editor, and I can't seem to get the 'Load ROM' thing right. Here's my code for Form1:

Private FileData() As Byte 'create an array to hold the bytes of the save file
Private OpenFile As String 'the name of the loaded file
Private Sub menu_About_Click()
Form5.Show
Form1.Hide
End Sub
Private Sub menu_Characters_Click()
Form3.Show
Form1.Hide
End Sub
Private Sub menu_Items_Click()
Form4.Show
Form1.Hide
End Sub
Private Sub menu_Load_Click()
'open the common dlg and save file name into OpenFile string variable
OpenFile = CommonDialog1.FileName
'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
Private Sub menu_Quit_Click()
End
End Sub

Any help would be much appreciated, thanks.
Synneth Relmn

Paratroopa
Level: 20

Posts: 40/144
EXP: 36477
For next: 5962

Since: 08-13-04

Since last post: 16 days
Last activity: 7 days
Posted on 01-29-05 01:16 AM Link | Quote
you'd have to use CommonDialog1.ShowOpen() to show the common dialog box in the first place, right?


(edited by Synneth Relmn on 01-28-05 04:16 PM)
(edited by Synneth Relmn on 01-28-05 04:17 PM)
Darth Coby

Vire
Dacht je nou echt dat het over was?
Dacht je nou echt dat ik gebroken was? Nee toch?
Nou kijk eens goed op uit je ogen gast.
zonder clic heb je geen kloten tjap... bitch
Level: 55

Posts: 1073/1371
EXP: 1240774
For next: 73415

Since: 03-15-04
From: Belgium

Since last post: 2 days
Last activity: 9 hours
Posted on 01-29-05 02:07 AM Link | Quote
Yeah, you forgot CommonDialog1.ShowOpen(), this is actually needed to call the "Open file" window.
Eliad

Micro-Goomba
Level: 6

Posts: 4/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-29-05 02:11 AM Link | Quote
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

Vire
Dacht je nou echt dat het over was?
Dacht je nou echt dat ik gebroken was? Nee toch?
Nou kijk eens goed op uit je ogen gast.
zonder clic heb je geen kloten tjap... bitch
Level: 55

Posts: 1074/1371
EXP: 1240774
For next: 73415

Since: 03-15-04
From: Belgium

Since last post: 2 days
Last activity: 9 hours
Posted on 01-29-05 02:27 AM Link | Quote
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

Micro-Goomba
Level: 6

Posts: 5/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-29-05 02:29 AM Link | Quote
Gave me a syntax error.
Darth Coby

Vire
Dacht je nou echt dat het over was?
Dacht je nou echt dat ik gebroken was? Nee toch?
Nou kijk eens goed op uit je ogen gast.
zonder clic heb je geen kloten tjap... bitch
Level: 55

Posts: 1076/1371
EXP: 1240774
For next: 73415

Since: 03-15-04
From: Belgium

Since last post: 2 days
Last activity: 9 hours
Posted on 01-29-05 02:40 AM Link | Quote
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

Micro-Goomba
Level: 6

Posts: 6/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-29-05 03:27 AM Link | Quote
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

Vire
Dacht je nou echt dat het over was?
Dacht je nou echt dat ik gebroken was? Nee toch?
Nou kijk eens goed op uit je ogen gast.
zonder clic heb je geen kloten tjap... bitch
Level: 55

Posts: 1077/1371
EXP: 1240774
For next: 73415

Since: 03-15-04
From: Belgium

Since last post: 2 days
Last activity: 9 hours
Posted on 01-29-05 08:29 PM Link | Quote
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

Micro-Goomba
Level: 6

Posts: 7/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-30-05 02:24 AM Link | Quote
It kinda does... It still doesn't say .zst in the 'choose filetype' area...
Darth Coby

Vire
Dacht je nou echt dat het over was?
Dacht je nou echt dat ik gebroken was? Nee toch?
Nou kijk eens goed op uit je ogen gast.
zonder clic heb je geen kloten tjap... bitch
Level: 55

Posts: 1081/1371
EXP: 1240774
For next: 73415

Since: 03-15-04
From: Belgium

Since last post: 2 days
Last activity: 9 hours
Posted on 01-30-05 02:32 AM Link | Quote
...
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

Micro-Goomba
Level: 6

Posts: 8/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-30-05 02:36 AM Link | Quote
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)?


(edited by Eliad on 01-29-05 11:00 PM)
Darth Coby

Vire
Dacht je nou echt dat het over was?
Dacht je nou echt dat ik gebroken was? Nee toch?
Nou kijk eens goed op uit je ogen gast.
zonder clic heb je geen kloten tjap... bitch
Level: 55

Posts: 1082/1371
EXP: 1240774
For next: 73415

Since: 03-15-04
From: Belgium

Since last post: 2 days
Last activity: 9 hours
Posted on 01-30-05 03:03 AM Link | Quote
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

Micro-Goomba
Level: 6

Posts: 9/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-30-05 03:12 AM Link | Quote
What is the code to do that, and how do I get a GFX string from a ROM?
Darth Coby

Vire
Dacht je nou echt dat het over was?
Dacht je nou echt dat ik gebroken was? Nee toch?
Nou kijk eens goed op uit je ogen gast.
zonder clic heb je geen kloten tjap... bitch
Level: 55

Posts: 1084/1371
EXP: 1240774
For next: 73415

Since: 03-15-04
From: Belgium

Since last post: 2 days
Last activity: 9 hours
Posted on 01-30-05 03:20 AM Link | Quote
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.
dan

Snap Dragon
Level: 43

Posts: 378/782
EXP: 534516
For next: 30530

Since: 03-15-04

Since last post: 20 hours
Last activity: 14 hours
Posted on 01-30-05 03:24 AM Link | Quote
If he is making a save state editor, he shouldn't be loading the ROM at all.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3073/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 01-30-05 05:56 AM Link | Quote
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. )
Eliad

Micro-Goomba
Level: 6

Posts: 10/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-30-05 08:28 AM Link | Quote
I'm trying to make a Save State Editor that works with Breath of Fire 2 for SNES.
drjayphd

Beamos
What's that spell?




pimp!
Level: 56

Posts: 857/1477
EXP: 1387410
For next: 10766

Since: 03-15-04
From: CT

Since last post: 2 hours
Last activity: 2 hours
Posted on 01-30-05 09:31 AM Link | Quote
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

Micro-Goomba
Level: 6

Posts: 11/12
EXP: 692
For next: 215

Since: 01-28-05

Since last post: 275 days
Last activity: 273 days
Posted on 01-30-05 09:58 AM Link | Quote
I knew I was needing to use the saved state all along, I just chose the wrong words to use... =\
Pages: 1 2Add to favorites | "RSS" Feed | Next newer thread | Next older thread
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.012 seconds.