[Core/CD] fixed CHD data initialization (fixes potential crashes when loading non-CHD CD image files after 10MB ROM file)

This commit is contained in:
EkeEke 2018-06-27 01:42:03 +02:00
parent ae28f87402
commit 724015c5a5
5 changed files with 8 additions and 4 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

View File

@ -2,7 +2,7 @@
* Genesis Plus
* CD drive processor & CD-DA fader
*
* Copyright (C) 2012-2017 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2018 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -1169,7 +1169,6 @@ void cdd_unload(void)
chd_close(cdd.chd.file);
if (cdd.chd.hunk)
free(cdd.chd.hunk);
memset(&cdd.chd, 0x00, sizeof(cdd.chd));
#endif
/* close CD tracks */
@ -1209,7 +1208,12 @@ void cdd_unload(void)
/* reset TOC */
memset(&cdd.toc, 0x00, sizeof(cdd.toc));
#if defined(USE_LIBCHDR)
/* reset CHD data */
memset(&cdd.chd, 0x00, sizeof(cdd.chd));
#endif
/* no CD-ROM track */
cdd.sectorSize = 0;
}

View File

@ -2,7 +2,7 @@
* Genesis Plus
* CD drive processor & CD-DA fader
*
* Copyright (C) 2012-2017 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2018 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: