std::string ekara_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { if (hook.image_file()) { const char *slot_string; uint32_t len = hook.image_file()->size(); std::vector<uint8_t> rom(len); int type; hook.image_file()->read(&rom[0], len); type = get_cart_type(&rom[0], len); slot_string = ekara_get_slot(type); printf("type: %s\n", slot_string); return std::string(slot_string); } return software_get_default_slot("plain"); }
// descrambling information from razoola void cthd_prot_device::fix_do(UINT8* sprrom, UINT32 sprrom_size, int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift) { int tilesize = 128; dynamic_buffer rom(16 * tilesize); // 16 tiles buffer UINT8* realrom = sprrom + start * tilesize; for (int i = 0; i < (end-start)/16; i++) { for (int j = 0; j < 16; j++) { int offset = (BIT(j, 0) << bit0shift) + (BIT(j, 1) << bit1shift) + (BIT(j, 2) << bit2shift) + (BIT(j, 3) << bit3shift); memcpy(&rom[j * tilesize], realrom + offset * tilesize, tilesize); } memcpy(realrom, &rom[0], tilesize * 16); realrom += 16 * tilesize; } }
void vcs_cart_slot_device::get_default_card_software(astring &result) { if (open_image_file(mconfig().options())) { const char *slot_string = "a26_4k"; UINT32 len = core_fsize(m_file); dynamic_buffer rom(len); int type; core_fread(m_file, rom, len); type = identify_cart_type(rom, len); slot_string = vcs_get_slot(type); clear(); result.cpy(slot_string); } else software_get_default_slot(result, "a26_4k"); }
std::string vcs_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { const char *slot_string; UINT32 len = m_file->size(); dynamic_buffer rom(len); int type; m_file->read(&rom[0], len); type = identify_cart_type(&rom[0], len); slot_string = vcs_get_slot(type); clear(); return std::string(slot_string); } else return software_get_default_slot("a26_4k"); }
std::string scv_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { const char *slot_string; UINT32 len = m_file->size(); dynamic_buffer rom(len); int type; m_file->read(&rom[0], len); type = get_cart_type(&rom[0], len); slot_string = scv_get_slot(type); //printf("type: %s\n", slot_string); clear(); return std::string(slot_string); } return software_get_default_slot("rom8k"); }
// TODO: Add GameBoy Advanced loading support/detection bool Game::load(std::string& file) { std::ifstream rom(file, std::ios::binary); if (!rom) { log(ERROR, "Failed to open ROM file. (%s)", file.c_str()); return false; } rom.seekg(0, std::ios::end); length = rom.tellg(); rom.seekg(0, std::ios::beg); if (length > 131072) { log(DEBUG, "Unsupported length: %d", length); } for (u64 i = 0; i < length; i++) { data[i] = rom.get(); } if (data[0x143] == 0x80) // TODO: Might be wrong { game_type = GAMEBOY_COLOR; } else { game_type = GAMEBOY; } cartridge_type = (CartridgeType)data[0x147]; log(DEBUG, "Cartridge Type: %X", cartridge_type); rom.close(); return true; }
int main(int argc, char** argv) { namespace po = boost::program_options; po::options_description desc("Options"); desc.add_options() ("help", "Print help messages") ("pcd_filename", po::value<std::string>()->required(), "pcd filename") ("max_update_rate", po::value<double>()->default_value(10.0), "max update rate") ("frame_id", po::value<std::string>()->default_value("odom"), "target frame_id"); po::variables_map vm; try { po::store(po::parse_command_line(argc, argv, desc), vm); if (vm.count("help")) { std::cout << "Basic Command Line Parameter App" << std::endl << desc << std::endl; return 0; } po::notify(vm); } catch(po::error& e) { std::cerr << "ERROR: " << e.what() << std::endl << std::endl; std::cerr << desc << std::endl; return -1; } std::string pcd_filename = vm["pcd_filename"].as<std::string>(); double max_update_rate = vm["max_update_rate"].as<double>(); std::string frame_id = vm["frame_id"].as<std::string>(); ros::init(argc, argv, "removeoutliersmap"); ros::Time::init(); RemoveOutliersMap rom(max_update_rate); rom.run(pcd_filename, frame_id); ros::spin(); return 0; }
bool SuperFamicomCartridge::load(const char* filename, SuperFamicomCartridge** result) { ifstream stream(filename, ios::binary | ios::in | ios::ate); ifstream::pos_type length = stream.tellg(); vector<char> rom(length); stream.seekg(0, ios::beg); stream.read(&rom[0], length); *result = nullptr; if (test(rom, 0x0000)) { *result = new Boards::LOROM(); } if (test(rom, 0x8000)) { *result = new Boards::HIROM(); } if ((*result) != nullptr) { (*result)->rom = rom; (*result)->ram = vector<char>(0x2000); return true; } return false; }
void gba_cart_slot_device::get_default_card_software(std::string &result) { if (open_image_file(mconfig().options())) { const char *slot_string = "gba_rom"; UINT32 len = core_fsize(m_file); dynamic_buffer rom(len); int type; core_fread(m_file, &rom[0], len); type = get_cart_type(&rom[0], len); slot_string = gba_get_slot(type); //printf("type: %s\n", slot_string); clear(); result.assign(slot_string); return; } software_get_default_slot(result, "gba_rom"); }
std::string sega8_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { if (hook.image_file()) { const char *slot_string; uint32_t len = hook.image_file()->size(), offset = 0; std::vector<uint8_t> rom(len); int type; hook.image_file()->read(&rom[0], len); if ((len % 0x4000) == 512) offset = 512; type = get_cart_type(&rom[offset], len - offset); slot_string = sega8_get_slot(type); //printf("type: %s\n", slot_string); return std::string(slot_string); } return software_get_default_slot("rom"); }
void eqnbox(int p1, int p2, int lu) { #ifndef NEQN float b, h; #else /* NEQN */ int b, h; #endif /* NEQN */ const char *sh; yyval.token = p1; b = max(ebase[p1], ebase[p2]); eht[yyval.token] = h = b + max(eht[p1]-ebase[p1], eht[p2]-ebase[p2]); ebase[yyval.token] = b; #ifndef NEQN if(dbg)printf(".\te:eb: S%d <- S%d S%d; b=%g, h=%g\n", yyval.token, p1, p2, b, h); #else /* NEQN */ if(dbg)printf(".\te:eb: S%d <- S%d S%d; b=%d, h=%d\n", yyval.token, p1, p2, b, h); #endif /* NEQN */ if (ital(rfont[p1]) && rom(lfont[p2])) { if (op(lfont[p2])) sh = "\\|"; else sh = "\\^"; } else sh = ""; if (lu) { printf(".nr %d \\w'\\s%s\\*(%d%s'\n", p1, tsize(ps), p1, sh); printf(".ds %d \\h'|\\n(97u-\\n(%du'\\*(%d\n", p1, p1, p1); } printf(".as %d \"%s\\*(%d\n", yyval.token, sh, p2); rfont[p1] = rfont[p2]; ofree(p2); }
void msx_slot_cartridge_device::get_default_card_software(std::string &result) { if (open_image_file(mconfig().options())) { const char *slot_string = "nomapper"; UINT32 length = core_fsize(m_file); dynamic_buffer rom(length); int type = NOMAPPER; // Check if there's some mapper related information in the hashfiles std::string extrainfo; if (hashfile_extrainfo(*this, extrainfo)) { int extrainfo_type = -1; if (1 == sscanf(extrainfo.c_str(), "%d", &extrainfo_type)) { static const struct { int extrainfo; int mapper; } extrainfo_map[] = { //{ 0, NOMAPPER }, { 1, MSXDOS2 }, { 2, KONAMI_SCC }, { 3, KONAMI }, { 4, ASCII8 }, { 5, ASCII16 }, { 6, GAMEMASTER2 }, { 7, ASCII8_SRAM }, { 8, ASCII16_SRAM }, { 9, RTYPE }, { 10, MAJUTSUSHI }, { 11, FMPAC }, { 12, SUPERLODERUNNER }, { 13, SYNTHESIZER }, { 14, CROSSBLAIM }, { 15, DISK_ROM }, { 16, KOREAN_80IN1 }, { 17, KOREAN_126IN1 } }; for (int i = 0; i < ARRAY_LENGTH(extrainfo_map); i++) { if (extrainfo_map[i].extrainfo == extrainfo_type) { type = extrainfo_map[i].mapper; } } } } if (type == NOMAPPER) { // Not identified through hashfile, try automatic detection type = get_cart_type(&rom[0], length); } if (type > NOMAPPER) { slot_string = msx_cart_get_slot_option(type); } result.assign(slot_string); return; } software_get_default_slot(result, "nomapper"); }
/** * Sega CD: Update Boot ROM file status. * @param txtRomFile ROM file textbox. * @param region_code Expected ROM region code. (bitmask) * @return Updated ROM status. */ QString GeneralConfigWindowPrivate::mcdUpdateRomFileStatus(GensLineEdit *txtRomFile, int region_code) { // ROM data buffer. uint8_t *rom_data = nullptr; int data_len; uint32_t rom_crc32; McdRomDB::McdBootRomInfo boot_rom_info; int boot_rom_region_code; McdRomDB::MCD_RomStatus_t boot_rom_status; // Line break string. static const QString sLineBreak = QLatin1String("<br/>\n"); // Check if the file exists. Q_Q(GeneralConfigWindow); QString filename = txtRomFile->text(); if (!QFile::exists(filename)) { // File doesn't exist. // NOTE: KDE 4's Oxygen theme doesn't have a question icon. // SP_MessageBoxQuestion is redirected to SP_MessageBoxInformation on KDE 4. // TODO: Set ROM file notes. txtRomFile->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxQuestion)); if (filename.isEmpty()) return GeneralConfigWindow::tr("No ROM filename specified."); else return GeneralConfigWindow::tr("The specified ROM file was not found."); } // Check the ROM file. // TODO: Decompressor support. QStyle::StandardPixmap filename_icon = QStyle::SP_DialogYesButton; QString rom_id = GeneralConfigWindow::tr("Unknown"); QString rom_notes; QString rom_size_warning; // Open the ROM file using LibGens::Rom. QScopedPointer<LibGens::Rom> rom(new LibGens::Rom(filename.toUtf8().constData())); if (!rom->isOpen()) { // Error opening ROM file. txtRomFile->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxQuestion)); return GeneralConfigWindow::tr("Error opening ROM file."); } // Multi-file ROM archives are not supported for Sega CD Boot ROMs. if (rom->isMultiFile()) { txtRomFile->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxWarning)); return (sLineBreak + sWarning + GeneralConfigWindow::tr("This archive has multiple files.") + sLineBreak + GeneralConfigWindow::tr("Multi-file ROM archives are not currently supported for Sega CD Boot ROMs.")); } // Check the ROM filesize. // Valid boot ROMs are 128 KB. // Smaller ROMs will not work; larger ROMs may work, but warn anyway. if (rom->romSize() != MCD_ROM_FILESIZE) { // Wrong ROM size. filename_icon = QStyle::SP_MessageBoxWarning; rom_size_warning = sWarning + GeneralConfigWindow::tr("ROM size is incorrect.") + sLineBreak + GeneralConfigWindow::tr("(expected %L1 bytes; found %L2 bytes)") .arg(MCD_ROM_FILESIZE).arg(rom->romSize()); // Identify the ROM even if it's too big. // (Some copies of the TMSS ROM are overdumped.) // Also, don't check ridiculously large Sega CD boot ROMs. if (rom->romSize() < MCD_ROM_FILESIZE || rom->romSize() > 1048576) { // ROM is too small, so it's guaranteed to not match anything in the database. goto rom_identified; } } // Load the ROM data and calculate the CRC32.. // TODO: LibGens::Rom::loadRom() fails if the ROM buffer isn't >= the ROM size. rom_data = (uint8_t*)malloc(rom->romSize()); data_len = rom->loadRom(rom_data, rom->romSize()); if (data_len != rom->romSize()) { // Error reading data from the file. rom_notes = GeneralConfigWindow::tr("Error reading file.") + sLineBreak + GeneralConfigWindow::tr("(expected %L1 bytes; read %L2 bytes)") .arg(MCD_ROM_FILESIZE).arg(data_len); goto rom_identified; } // Fix up the ROM's Initial SP and Initial HINT vectors. memcpy(&rom_data[0x00], McdRomDB::InitSP, sizeof(McdRomDB::InitSP)); memcpy(&rom_data[0x70], McdRomDB::InitHINT, sizeof(McdRomDB::InitHINT)); // Calculate the CRC32 using zlib. // NOTE: rom->rom_crc32() will be incorrect if the ROM is too big. rom_crc32 = crc32(0, rom_data, MCD_ROM_FILESIZE); // Look up the CRC32 in the Sega CD Boot ROM database. boot_rom_info = McdRomDB::findByCrc32(rom_crc32); if (!boot_rom_info.isValid()) { // Boot ROM was not found in the database. filename_icon = QStyle::SP_MessageBoxWarning; goto rom_identified; } // ROM found. Get the description and other information. rom_id = boot_rom_info.description(); // Check the region code. boot_rom_region_code = boot_rom_info.region(); if ((boot_rom_region_code & region_code) == 0) { // ROM doesn't support this region. int boot_rom_region_primary = boot_rom_info.primaryRegion(); QString expected_region = McdRomDB::regionCodeString(region_code); QString boot_rom_region = McdRomDB::regionCodeString(boot_rom_region_primary); rom_notes += sWarning + GeneralConfigWindow::tr("Region code is incorrect.") + sLineBreak + GeneralConfigWindow::tr("(expected %1; found %2)") .arg(expected_region).arg(boot_rom_region) + sLineBreak; // Set the icon to warning. filename_icon = QStyle::SP_MessageBoxWarning; } // Check the ROM's support status. boot_rom_status = boot_rom_info.supportStatus(); switch (boot_rom_status) { case McdRomDB::RomStatus_Recommended: case McdRomDB::RomStatus_Supported: // ROM is either recommended or supported. // TODO: Make a distinction between the two? break; case McdRomDB::RomStatus_Unsupported: default: // ROM is unsupported. rom_notes += sWarning + GeneralConfigWindow::tr("This Boot ROM is not supported by Gens/GS II.") + sLineBreak; filename_icon = QStyle::SP_MessageBoxWarning; break; case McdRomDB::RomStatus_Broken: // ROM is known to be broken. rom_notes += sWarning + GeneralConfigWindow::tr("This Boot ROM is known to be broken on all emulators.") + sLineBreak; filename_icon = QStyle::SP_MessageBoxCritical; break; } // Get the ROM's notes. rom_notes += boot_rom_info.notes().replace(QChar(L'\n'), sLineBreak); rom_identified: // Free the ROM data buffer if it was allocated. free(rom_data); // Set the Boot ROM filename textbox icon. txtRomFile->setIcon(q->style()->standardIcon(filename_icon)); // Set the Boot ROM description. QString s_ret; s_ret = GeneralConfigWindow::tr("ROM identified as: %1").arg(rom_id); if (!rom_notes.isEmpty()) s_ret += sLineBreak + sLineBreak + rom_notes; if (!rom_size_warning.isEmpty()) s_ret += sLineBreak + sLineBreak + rom_size_warning; return QString(s_ret); }
/** * Sega Genesis: Update TMSS ROM file status. * @param txtRomFile ROM file textbox. * @return Updated ROM status. */ QString GeneralConfigWindowPrivate::mdUpdateTmssRomFileStatus(GensLineEdit *txtRomFile) { // ROM data. uint8_t *rom_data = nullptr; z_crc_t rom_crc32; int data_len; bool is_overdump = false; // Line break string. static const QString sLineBreak = QLatin1String("<br/>\n"); // Check if the file exists. Q_Q(GeneralConfigWindow); QString filename = txtRomFile->text(); if (!QFile::exists(filename)) { // File doesn't exist. // NOTE: KDE 4's Oxygen theme doesn't have a question icon. // SP_MessageBoxQuestion is redirected to SP_MessageBoxInformation on KDE 4. // TODO: Set ROM file notes. txtRomFile->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxQuestion)); if (filename.isEmpty()) { return GeneralConfigWindow::tr("No ROM filename specified."); } else { return GeneralConfigWindow::tr("The specified ROM file was not found."); } } // Check the ROM file. // TODO: Decompressor support. QStyle::StandardPixmap filename_icon = QStyle::SP_DialogYesButton; QString rom_id = GeneralConfigWindow::tr("Unknown"); QString rom_notes; // Open the ROM file using LibGens::Rom. QScopedPointer<LibGens::Rom> rom(new LibGens::Rom(filename.toUtf8().constData())); if (!rom->isOpen()) { // Error opening ROM file. txtRomFile->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxQuestion)); return GeneralConfigWindow::tr("Error opening ROM file."); } // Multi-file ROM archives are not supported for TMSS ROMs. if (rom->isMultiFile()) { txtRomFile->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxWarning)); return (sWarning + GeneralConfigWindow::tr("This archive has multiple files.") + sLineBreak + GeneralConfigWindow::tr("Multi-file ROM archives are not currently supported for the TMSS ROM.")); } // Check the ROM filesize. // Valid TMSS ROMs are 2 KB. static const int TMSS_ROM_FILESIZE = 2048; if (rom->romSize() != TMSS_ROM_FILESIZE) { // Wrong ROM size. // Identify the ROM even if it's too big. // (Some copies of the TMSS ROM are overdumped.) // Also, don't check ridiculously large TMSS ROMs. if (rom->romSize() < TMSS_ROM_FILESIZE || rom->romSize() > 524288) { // ROM is too small, so it's guaranteed to not match anything in the database. // Also, our TMSS implementation has a maximum size of 512 KB. goto rom_identified; } } // Load the ROM data and calculate the CRC32.. // TODO: LibGens::Rom::loadRom() fails if the ROM buffer isn't >= the ROM size. rom_data = (uint8_t*)malloc(rom->romSize()); data_len = rom->loadRom(rom_data, rom->romSize()); if (data_len != rom->romSize()) { // Error reading data from the file. rom_notes = GeneralConfigWindow::tr("Error reading file.") + sLineBreak + GeneralConfigWindow::tr("(expected %L1 bytes; read %L2 bytes)") .arg(rom->romSize()).arg(data_len); goto rom_identified; } // Calculate the CRC32 of the first 2 KB using zlib. static const z_crc_t TMSS_ROM_CRC32 = 0x3F888CF4; rom_crc32 = crc32(0, rom_data, TMSS_ROM_FILESIZE); // Check if this is an overdump. // TMSS ROM is 2 KB, but may be overdumped to 4 KB with the // second half as open-bus. (usually 0x00 or 0xFF) // NOTE: If the TMSS ROM filesize isn't divisible by 2 KB, // don't bother checking for overdumps. if (data_len > TMSS_ROM_FILESIZE && (data_len % TMSS_ROM_FILESIZE == 0)) { // TMSS ROM is larger than 2KB, and is a multiple of 2 KB. // - Check all 2 KB blocks for 0x00 or 0xFF. // - Also check even 2 KB blocks for the TMSS CRC32. [This overrides the 0x00/0xFF check.] // TODO: Optimize this. is_overdump = true; for (int i = TMSS_ROM_FILESIZE; i < data_len; i += TMSS_ROM_FILESIZE) { const uint8_t *ptr = &rom_data[i]; // Check for all 0x00 or all 0xFF. const uint8_t first_byte = *ptr++; if (first_byte != 0x00 && first_byte != 0xFF) { // Not an overdump. is_overdump = false; } else { for (int j = TMSS_ROM_FILESIZE-1; j > 0; j--, ptr++) { if (*ptr != first_byte) { // Not an overdump. is_overdump = false; break; } } } if (!is_overdump) { // Block is not all 0x00 or 0xFF. if ((i % (TMSS_ROM_FILESIZE*2)) == 0) { // Even block. Check for TMSS CRC32. is_overdump = true; const z_crc_t overdump_crc32 = crc32(0, &rom_data[i], TMSS_ROM_FILESIZE); if (overdump_crc32 != TMSS_ROM_CRC32) { // Wrong CRC32. is_overdump = false; break; } } else { // Odd block. Not an overdump. break; } } } } else { // TMSS ROM is too small, or is not a multiple of 2 KB. is_overdump = false; } // Check what ROM this is. switch (rom_crc32) { case TMSS_ROM_CRC32: // Standard TMSS ROM. rom_id = GeneralConfigWindow::tr("Genesis TMSS ROM"); rom_notes = GeneralConfigWindow::tr("This is a known good dump of the Genesis TMSS ROM."); break; default: // Unknown TMSS ROM. // TODO: Add more variants. filename_icon = QStyle::SP_MessageBoxQuestion; rom_notes = GeneralConfigWindow::tr("Unknown ROM image. May not work properly for TMSS."); break; } rom_identified: // Free the ROM data if it was allocated. free(rom_data); // Set the Boot ROM description. QString s_ret = GeneralConfigWindow::tr("ROM identified as: %1").arg(rom_id); if (!rom_notes.isEmpty()) { s_ret += sLineBreak + sLineBreak + rom_notes; } // Check if the ROM is the right size. if (rom->romSize() != TMSS_ROM_FILESIZE) { // Wrong ROM size. QString rom_size_warning; if (is_overdump) { // Overdump. This ROM is okay. // TODO: Convert bytes to KB, MB, etc. rom_size_warning = GeneralConfigWindow::tr("This ROM is larger than the expected size of the TMSS ROM.") + sLineBreak + GeneralConfigWindow::tr("(expected %L1 bytes; found %L2 bytes)") .arg(TMSS_ROM_FILESIZE).arg(rom->romSize()) + sLineBreak + sLineBreak + GeneralConfigWindow::tr("The extra data is either empty space or extra copies of the " "TMSS ROM, so it will work correctly."); } else { // Not an overdump. filename_icon = QStyle::SP_MessageBoxWarning; rom_size_warning = sWarning + GeneralConfigWindow::tr("ROM size is incorrect.") + sLineBreak + GeneralConfigWindow::tr("(expected %L1 bytes; found %L2 bytes)") .arg(TMSS_ROM_FILESIZE).arg(rom->romSize()); } s_ret += sLineBreak + sLineBreak + rom_size_warning; } // Set the Boot ROM filename textbox icon. txtRomFile->setIcon(q->style()->standardIcon(filename_icon)); return s_ret; }
/** * Timed events */ void CPS2emu::timerEvent(QTimerEvent *event){ bool romOK = false; char buf[80]; qint64 lineTam; //Try detect PS3 SIXAXIS/DS3 controller... QFileInfo js("/dev/input/js0"); if(js.exists()){ ui->controllerLabel->setText("PS3 controller found! All keys remapped!"); } else{ ui->controllerLabel->setText("Using N900 keyboard!"); } //Check running process if(running){ if(cps2run->atEnd()){ ui->runButton->setEnabled(true); ui->romButton->setEnabled(true); ui->txt->setText("CPS2emu ready!"); } } /* * Check if romcnv still working! * It not working with atEnd like cps2run sorry ... */ if(romcnv == true){ if(++i%2){ ui->txt->setText("Caching ROM file, Please... (" + QString::number(i) + "s)"); } else{ ui->txt->setText("Caching ROM file, Wait!.... (" + QString::number(i) + "s)"); } //Read process line lineTam = cps2cache->readLine(buf, sizeof(buf)); if (lineTam != -1) { //looks for complete text on dump! if(tr(buf).contains("complete")){ romOK = true; cps2cache->close(); i = 0; } else if(tr(buf).contains("ERROR")){ romOK = false; cps2cache->close(); i = 0; } } QFileInfo rom(path); if(!cps2cache->isOpen()){ if(romOK){ ui->romButton->setText( rom.fileName() + ", cached!" ); //Enable buttons ui->runButton->setEnabled(true); ui->romButton->setEnabled(true); QMessageBox::warning(this,"CPS2emu romcnv!", "ROM file " + rom.baseName() + ", cached!", QMessageBox::Ok); romcnv = false; i = 0; ui->romButton->setText("ROM file " + rom.baseName() + ", cached!"); } else{ //On cache error, because invalid ROMs ui->romButton->setText( rom.fileName() + ", cache error!" ); //Enable buttons ui->runButton->setEnabled(false); ui->romButton->setEnabled(true); QMessageBox::critical(this,"CPS2emu romcnv!", "ROM file " + rom.baseName() + ", cache error!", QMessageBox::Ok); romcnv = false; } } } }
void CPS2emu::on_romButton_clicked() { //Default location, load at constructor if(path == NULL){ path = ""; } QFileInfo recent(path); QString openPath = QFileDialog::getOpenFileName(this, "Select a ROM...", recent.dir().path(), "ROM files (*.zip)"); //After change path is recentPath if(openPath != NULL){ path = openPath; QFileInfo rom(path); //Check hi and nvram folders checkHiScore(); checkNVRAM(); //Check cache file if(checkCache()){ ui->runButton->setEnabled(true); ui->romButton->setText( rom.fileName() ); } else{ QMessageBox msgBox; QPushButton *createBt = msgBox.addButton(tr("Create"), QMessageBox::AcceptRole); msgBox.addButton(QMessageBox::Abort); msgBox.setWindowTitle("CPS2emu - cache"); msgBox.setText("Cache file not found!"); msgBox.setInformativeText("Create cache file now?"); msgBox.exec(); if(msgBox.clickedButton() == createBt){ cps2cache = new QProcess; //cps2cache->setTextModeEnabled(true); //cps2cache->setReadChannelMode(QProcess::MergedChannels); cps2cache->setWorkingDirectory(rom.dir().path()); cps2cache->start("/usr/bin/cps2romcnv ./" + rom.fileName()); //romcnv running... romcnv = true; //startTimer(300); ui->txt->setText("Caching ROM file... Please Wait!"); ui->romButton->setText( rom.fileName() + ", caching!"); //Disable buttons ui->runButton->setEnabled(false); ui->romButton->setEnabled(false); } else{ ui->romButton->setText( rom.fileName() + ", not cached!"); ui->runButton->setEnabled(false); } } } }
bool Nes::Create(const char* romPath, IAudioProvider* audioProvider, Nes** nes) { NPtr<StdStreamRomFile> rom(new StdStreamRomFile(romPath)); return Nes::Create(static_cast<IRomFile*>(rom), audioProvider, nes); }