What's new

[delphi, nes emu] - opening a ROM

MisterE

New member
I'm now trying to open a ROM image,as he do, but it gives sometimes a error (winnes too btw).
I/O error 6.
Alright, i know it probably a stupid question so don't laugh....
I think a PS2 emulator is ready tomorrow, which runs GTA3 perfectly :p

Or is it better to use a 'Stream'?, i have only experience with normal textfiles.
Hope someone can help me with this, thanks.


type
TRomHeader = record
RomType : array[1..3] of char;
Ctrl,
PRGROM,
CHRRAM,
ROMctrl1,
ROMctrl2 : char;
Expansion : array[0..7] of char;
end;


procedure TfrmNES.Button1Click(Sender: TObject);
var
F : File;
i : Integer;
RomHeader : TRomHeader;
begin
AssignFile(F, OpenDialog1.FileName);

if OpenDialog1.Execute then
begin

Reset(F, 1);

i := SizeOf(ROMHeader);
BlockRead(F, ROMHeader, SizeOf(ROMHeader), i);
edit9.Text := inttostr(SizeOf(ROMHeader));
edit10.Text := inttostr(i);

edit1.Text := RomHeader.RomType;
edit2.Text := RomHeader.Ctrl;
edit3.Text := RomHeader.PRGROM;
edit4.Text := RomHeader.CHRRAM;
edit5.Text := RomHeader.ROMctrl1;
edit6.Text := RomHeader.ROMctrl2;
edit7.Text := RomHeader.Expansion;

CloseFile(F);

end;
end;
 
OP
M

MisterE

New member
well if found the solution.
i try to open the file before assigning the variable...

i know stupid !!!

You can close thsi thread...
 

Top