예제 #1
0
int Init_CD_Driver(void)
{
#ifdef DEBUG_CD
	debug_SCD_file = fopen("SCD.log", "w");
#endif

	// ASPI support
	
	ASPI_Init();

//	if (ASPI_Init() == 0)
//	{
//		MessageBox(NULL, "No CD Drive or ASPI not correctly initialised\nTry to upgrade your ASPI drivers", "Warning", MB_ICONWARNING); 
//	}

	// FILE ISO support
	
	FILE_Init();

	return 0;
}
/**
 * SelCD_Save(): Save the settings.
 * @return 1 if settings were saved; 0 on error.
 */
int SelCD_Save(void)
{
	// Save settings.
	int tmpDrive;
	bool restartCD = false;
	
	// CD-ROM drive
	tmpDrive = ComboBox_GetCurSel(SelCD_cdromDropdownBox);
	
	// Check if the drive ID was changed.
	if (tmpDrive == cdromDeviceID)
	{
		// Drive ID wasn't changed. Don't do anything.
		return 1;
	}
	
	// Drive ID was changed.
	// This will cause a reset of the ASPI subsystem.
	if (SegaCD_Started && (CD_Load_System == CDROM_))
	{
		// ASPI is currently in use. Ask the user if they want to restart emulation.
		GensUI::MsgBox_Response response;
		response = GensUI::msgBox(
			"The CD-ROM drive is currently in use.\n"
			"Chanigng the CD-ROM drive will force the emulator to reset.\n"
			"Are you sure you want to do this?",
			"CD-ROM Drive in Use",
			GensUI::MSGBOX_ICON_WARNING | GensUI::MSGBOX_BUTTONS_YES_NO,
			select_cdrom_window);
		
		if (response == GensUI::MSGBOX_RESPONSE_NO)
		{
			// Don't change anything.
			return 0;
		}
		
		// Stop SegaCD emulation.
		// TODO: Don't allow this if Netplay is enabled.
		restartCD = true;
		ROM::freeROM(Game);
	}
	
	// Stop ASPI.
	ASPI_End();
	
	cdromDeviceID = tmpDrive;
	
	// TODO: Drive speed (maybe)
	
	// Restart ASPI.
	ASPI_Init();
	
	if (restartCD)
	{
		// Restart SegaCD emulation.
		SegaCD_Started = Init_SegaCD(NULL);
		Sync_Gens_Window();
	}
	
	// Settings saved.
	return 1;
}