void CPS2VM::CDROM0_Mount(const char* path) { //TODO: Check if there's an m_cdrom0 already //TODO: Check if files are linked to this m_cdrom0 too and do something with them size_t pathLength = strlen(path); if(pathLength != 0) { try { m_cdrom0 = DiskUtils::CreateDiskImageFromPath(path); SetIopCdImage(m_cdrom0.get()); } catch(const std::exception& Exception) { printf("PS2VM: Error mounting cdrom0 device: %s\r\n", Exception.what()); } } CAppConfig::GetInstance().SetPreferenceString(PS2VM_CDROM0PATH, path); }
void CPS2VM::CDROM0_Destroy() { SetIopCdImage(nullptr); m_cdrom0.reset(); }
void CPS2VM::CDROM0_Destroy() { SetIopCdImage(NULL); DELETEPTR(m_pCDROM0); }
void CPS2VM::CDROM0_Mount(const char* path) { //Check if there's an m_pCDROM0 already //Check if files are linked to this m_pCDROM0 too and do something with them size_t pathLength = strlen(path); if(pathLength != 0) { try { Framework::CStream* stream = nullptr; const char* extension = ""; if(pathLength >= 4) { extension = path + pathLength - 4; } //Gotta think of something better than that... if(!stricmp(extension, ".isz")) { stream = new CIszImageStream(new Framework::CStdStream(path, "rb")); } else if(!stricmp(extension, ".cso")) { stream = new CCsoImageStream(new Framework::CStdStream(path, "rb")); } #ifdef WIN32 else if(path[0] == '\\') { stream = new Framework::Win32::CVolumeStream(path[4]); } #elif !defined(__ANDROID__) else { try { stream = new Framework::Posix::CVolumeStream(path); } catch(...) { //Ok if it fails here, might be a standard ISO image file //which will be handled below } } #endif //If it's null after all that, just feed it to a StdStream if(stream == nullptr) { stream = new Framework::CStdStream(path, "rb"); } m_pCDROM0 = new CISO9660(stream); SetIopCdImage(m_pCDROM0); } catch(const std::exception& Exception) { printf("PS2VM: Error mounting cdrom0 device: %s\r\n", Exception.what()); } } CAppConfig::GetInstance().SetPreferenceString(PS2VM_CDROM0PATH, path); }