megacd: reset drive without ejecting a disk

* megacd: fix sgets()

* megacd: reset drive without ejecting a disk
This commit is contained in:
Sergey Dvodnenko
2019-12-03 21:48:47 +02:00
committed by sorgelig
parent 38ce10b205
commit 3c2a19b745
5 changed files with 30 additions and 7 deletions

View File

@@ -760,7 +760,6 @@ static void vga_nag()
OsdWrite(n++, " or enable scaler on VGA:");
OsdWrite(n++, " vga_scaler=1");
for (; n < OsdGetSize(); n++) OsdWrite(n);
OsdUpdate();
OsdEnable(0);
EnableOsd_on(OSD_HDMI);
}
@@ -1575,7 +1574,7 @@ void HandleUI(void)
}
else
{
if (mask == 1 && is_megacd_core()) mcd_set_image(0, "");
if (mask == 1 && is_megacd_core()) mcd_reset();
uint32_t status = user_io_8bit_set_status(0, 0, ex);

View File

@@ -14,9 +14,7 @@ cdd_t cdd;
uint32_t frame = 0;
cdd_t::cdd_t() {
cycles = 0;
latency = 10;
type = 0;
loaded = 0;
index = 0;
lba = 0;
@@ -306,6 +304,28 @@ void cdd_t::Unload()
this->sectorSize = 0;
}
void cdd_t::Reset() {
latency = 10;
index = 0;
lba = 0;
scanOffset = 0;
isData = 1;
status = CD_STAT_STOP;
audioLength = 0;
audioOffset = 0;
stat[0] = 0x0;
stat[1] = 0x0;
stat[2] = 0x0;
stat[3] = 0x0;
stat[4] = 0x0;
stat[5] = 0x0;
stat[6] = 0x0;
stat[7] = 0x0;
stat[8] = 0x0;
stat[9] = 0xF;
}
void cdd_t::Update() {
if (this->status == CD_STAT_STOP || this->status == CD_STAT_TRAY || this->status == CD_STAT_OPEN)
{

View File

@@ -93,6 +93,10 @@ void mcd_set_image(int num, const char *filename)
}
}
void mcd_reset() {
cdd.Reset();
}
int cdd_t::SectorSend(uint8_t* header)
{

View File

@@ -70,6 +70,7 @@ public:
cdd_t();
int Load(const char *filename);
void Unload();
void Reset();
void Update();
void CommandExec();
int SectorSend(uint8_t* header);
@@ -82,8 +83,6 @@ private:
toc_t toc;
int index;
int lba;
uint32_t cycles;
int type;
uint16_t sectorSize;
int scanOffset;
int audioLength;
@@ -116,5 +115,6 @@ extern uint32_t frame;
void mcd_poll();
void mcd_set_image(int num, const char *filename);
void mcd_reset();
#endif

View File

@@ -1828,7 +1828,7 @@ void user_io_send_buttons(char force)
{
if (is_archie()) fpga_load_rbf(name[0] ? name : "Archie.rbf");
if (is_minimig()) minimig_reset();
if (is_megacd_core()) mcd_set_image(0, "");
if (is_megacd_core()) mcd_reset();
}
key_map = map;