Skip to content

Commit

Permalink
Don't take MD+ capable carts for a real SegaCD
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Aug 6, 2023
1 parent 3878591 commit 2741a6c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 2 additions & 3 deletions marshw.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,9 @@ void Mars_Init(void)

Mars_UpdateCD();

if (mars_cd_ok && !(mars_cd_ok & 0x2))
if (mars_cd_ok & 0x1)
{
/* if the CD is present and it's */
/* not an MD+, give it seconds to init */
/* if the CD is present, give it seconds to init */
Mars_WaitTicks(180);
}
}
Expand Down
2 changes: 1 addition & 1 deletion marssound.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void S_Init(void)
sfxchannels[i].data = NULL;

// check if CD is available, reset the driver option if not
mcd_avail = S_CDAvailable();
mcd_avail = S_CDAvailable() & 0x1;
if (!mcd_avail && sfxdriver > 1)
sfxdriver = 0;

Expand Down
11 changes: 8 additions & 3 deletions o_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ void O_DrawControl(void)

void O_Init (void)
{
int cd_avail;

/* cache all needed graphics */
o_cursor1 = W_CheckNumForName("M_SKULL1");
o_cursor2 = W_CheckNumForName("M_SKULL2");
Expand Down Expand Up @@ -254,10 +256,13 @@ void O_Init (void)
D_memcpy(menuscreen[ms_audio].name, "Audio", 7);
menuscreen[ms_audio].firstitem = mi_soundvol;
menuscreen[ms_audio].numitems = mi_music - mi_soundvol + 1;
if (S_CDAvailable()) /* MD+ */

cd_avail = S_CDAvailable();
if (cd_avail) /* CDA or MD+ */
{
menuscreen[ms_audio].numitems++;
menuscreen[ms_audio].numitems++;
if (cd_avail & 0x1) /* CD, not MD+ */
menuscreen[ms_audio].numitems++;
}

D_memcpy(menuscreen[ms_video].name, "Video", 7);
Expand Down Expand Up @@ -572,7 +577,7 @@ void O_Control (player_t *player)
case mi_music:
if (++o_musictype > mustype_cd)
o_musictype = mustype_cd;
if (o_musictype == mustype_cd && !S_CDAvailable())
if (o_musictype == mustype_cd)
o_musictype = mustype_fm;
break;
case mi_sfxdriver:
Expand Down
1 change: 1 addition & 0 deletions src-md/crt0.s
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ read_cdstate:
move.w megasd_num_cdtracks,d0
lsl.l #2,d0
or.w megasd_ok,d0
or.w cd_ok,d0

move.w d0,0xA15122
move.w #0,0xA15120 /* done */
Expand Down
2 changes: 1 addition & 1 deletion src-md/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ uint16_t InitCD(void)

scd_init_pcm();

return 1; // CD ready to go!
return 0x1; // CD ready to go!
}

int main(void)
Expand Down
2 changes: 1 addition & 1 deletion src-md/megasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static uint16_t ProtectedInitMegaSD(void)
MEGASD_CTRL_PORT = MEGASD_CMD_GET_NUMTRKS;
MEGASD_WAIT_CMD_RSLT(timeout);
megasd_num_cdtracks = MEGASD_RSLT_PORT;
return 0x0003; // MD+, CD OK
return 0x0002; // MD+, CD OK
}

#undef MEGASD_WAIT_CMD_RSLT
Expand Down

0 comments on commit 2741a6c

Please sign in to comment.