mirror of
https://github.com/holub/mame
synced 2025-05-11 08:38:47 +03:00
frees the buffer after a quickload (nw)
This commit is contained in:
parent
2582fa1897
commit
f0e4777b1e
@ -172,6 +172,7 @@ QUICKLOAD_LOAD_MEMBER( cd2650_state, cd2650 )
|
|||||||
int quick_length;
|
int quick_length;
|
||||||
UINT8 *quick_data;
|
UINT8 *quick_data;
|
||||||
int read_;
|
int read_;
|
||||||
|
int result = IMAGE_INIT_FAIL;
|
||||||
|
|
||||||
quick_length = image.length();
|
quick_length = image.length();
|
||||||
quick_data = (UINT8*)malloc(quick_length);
|
quick_data = (UINT8*)malloc(quick_length);
|
||||||
@ -179,47 +180,41 @@ QUICKLOAD_LOAD_MEMBER( cd2650_state, cd2650 )
|
|||||||
{
|
{
|
||||||
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
|
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
|
||||||
image.message(" Cannot open file");
|
image.message(" Cannot open file");
|
||||||
return IMAGE_INIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
read_ = image.fread( quick_data, quick_length);
|
read_ = image.fread( quick_data, quick_length);
|
||||||
if (read_ != quick_length)
|
if (read_ != quick_length)
|
||||||
{
|
{
|
||||||
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file");
|
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file");
|
||||||
image.message(" Cannot read the file");
|
image.message(" Cannot read the file");
|
||||||
return IMAGE_INIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
else if (quick_data[0] != 0x40)
|
||||||
if (quick_data[0] != 0x40)
|
|
||||||
{
|
{
|
||||||
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header");
|
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header");
|
||||||
image.message(" Invalid header");
|
image.message(" Invalid header");
|
||||||
return IMAGE_INIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
exec_addr = quick_data[1] * 256 + quick_data[2];
|
exec_addr = quick_data[1] * 256 + quick_data[2];
|
||||||
|
|
||||||
if (exec_addr >= quick_length)
|
if (exec_addr >= quick_length)
|
||||||
{
|
{
|
||||||
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file");
|
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file");
|
||||||
image.message(" Exec address beyond end of file");
|
image.message(" Exec address beyond end of file");
|
||||||
return IMAGE_INIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
else if (quick_length < 0x0444)
|
||||||
if (quick_length < 0x0444)
|
|
||||||
{
|
{
|
||||||
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short");
|
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short");
|
||||||
image.message(" File too short");
|
image.message(" File too short");
|
||||||
return IMAGE_INIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
else if (quick_length > 0x8000)
|
||||||
if (quick_length > 0x8000)
|
|
||||||
{
|
{
|
||||||
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long");
|
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long");
|
||||||
image.message(" File too long");
|
image.message(" File too long");
|
||||||
return IMAGE_INIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
read_ = 0x1000;
|
read_ = 0x1000;
|
||||||
if (quick_length < 0x1000)
|
if (quick_length < 0x1000)
|
||||||
read_ = quick_length;
|
read_ = quick_length;
|
||||||
@ -244,7 +239,15 @@ QUICKLOAD_LOAD_MEMBER( cd2650_state, cd2650 )
|
|||||||
|
|
||||||
// Start the quickload
|
// Start the quickload
|
||||||
m_maincpu->set_pc(exec_addr);
|
m_maincpu->set_pc(exec_addr);
|
||||||
return IMAGE_INIT_PASS;
|
|
||||||
|
result = IMAGE_INIT_PASS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free( quick_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MACHINE_CONFIG_START( cd2650, cd2650_state )
|
static MACHINE_CONFIG_START( cd2650, cd2650_state )
|
||||||
|
Loading…
Reference in New Issue
Block a user