static void parse_boot(struct uae_prefs *p, xmlNode *node) { for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) { if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("boot")) == 0) { xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type")); if(attr != NULL) { if(strcmp((const char *) attr, "hdf") == 0) { // Build-in hdf required xmlChar *content = xmlNodeGetContent(curr_node); if(content != NULL) { char target_file[MAX_DPATH]; fetch_rp9path(target_file, MAX_DPATH); strncat(target_file, "workbench-", MAX_DPATH); strncat(target_file, (const char *)content, MAX_DPATH); strncat(target_file, ".hdf", MAX_DPATH); FILE *f = fopen(target_file, "rb"); if(f != NULL) { char dhx[8]; struct uaedev_config_info *uci; int readonly = 0; fclose(f); xmlChar *ro = xmlGetProp(curr_node, (const xmlChar *) _T("readonly")); if(ro != NULL) { if(strcmp((const char *) ro, "true") == 0) readonly = 1; xmlFree(ro); } sprintf(dhx, "DH%d", add_HDF_DHnum); ++add_HDF_DHnum; if(hardfile_testrdb (target_file)) uci = add_filesys_config(p, -1, dhx, 0, target_file, readonly, 0, 0, 0, 512, 127, 0, 0, 0); else uci = add_filesys_config(p, -1, dhx, 0, target_file, readonly, 32, 1, 2, 512, 127, 0, 0, 0); if (uci) hardfile_do_disk_change (uci, 1); gui_force_rtarea_hdchange(); } xmlFree(content); } } xmlFree(attr); } } } }
void consolehook_config (struct uae_prefs *p) { int roms[] = { 15, 31, 16, 46, -1 }; default_prefs (p, 0); //p->headless = 1; p->produce_sound = 0; p->gfx_resolution = 0; p->gfx_vresolution = 0; p->gfx_scanlines = false; p->gfx_framerate = 10; p->immediate_blits = 1; p->collision_level = 0; configure_rom (p, roms, 0); p->cpu_model = 68020; p->fpu_model = 68882; p->m68k_speed = -1; p->cachesize = 8192; p->cpu_compatible = 0; p->address_space_24 = 0; p->chipmem_size = 0x00200000; p->fastmem_size = 0x00800000; p->bogomem_size = 0; p->nr_floppies = 1; p->floppyslots[1].dfxtype = DRV_NONE; p->floppy_speed = 0; p->start_gui = 0; p->gfx_size_win.width = 320; p->gfx_size_win.height = 256; p->turbo_emulation = 0; //p->win32_automount_drives = 2; //p->win32_automount_cddrives = 2; add_filesys_config (p, -1, L"DH0", L"CLIBOOT", L".", 1, 0, 0, 0, 0, 15, NULL, 0, 0); }
bool EditFilesysVirtual(int unit_no) { struct mountedinfo mi; struct uaedev_config_info *uci; std::string strdevname, strvolname, strroot; char tmp[32]; dialogResult = false; dialogFinished = false; InitEditFilesysVirtual(); if(unit_no >= 0) { uci = &changed_prefs.mountconfig[unit_no]; get_filesys_unitconfig(&changed_prefs, unit_no, &mi); strdevname.assign(uci->devname); txtDevice->setText(strdevname); strvolname.assign(uci->volname); txtVolume->setText(strvolname); strroot.assign(uci->rootdir); txtPath->setText(strroot); chkReadWrite->setSelected(!uci->readonly); chkAutoboot->setSelected(uci->bootpri != -128); snprintf(tmp, 32, "%d", uci->bootpri >= -127 ? uci->bootpri : -127); txtBootPri->setText(tmp); } else { CreateDefaultDevicename(tmp); txtDevice->setText(tmp); txtVolume->setText(tmp); strroot.assign(currentDir); txtPath->setText(strroot); chkReadWrite->setSelected(true); txtBootPri->setText("0"); } EditFilesysVirtualLoop(); ExitEditFilesysVirtual(); if(dialogResult) { int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0); extractPath((char *) txtPath->getText().c_str(), currentDir); uci = add_filesys_config(&changed_prefs, unit_no, (char *) txtDevice->getText().c_str(), (char *) txtVolume->getText().c_str(), (char *) txtPath->getText().c_str(), !chkReadWrite->isSelected(), 0, 0, 0, 0, bp, 0, 0, 0); if (uci) filesys_media_change (uci->rootdir, 1, uci); } return dialogResult; }
void consolehook_config (struct uae_prefs *p) { struct uaedev_config_info ci = { 0 }; int32_t roms[] = { 15, 31, 16, 46, -1 }; default_prefs (p, 0); //p->headless = 1; p->produce_sound = 0; p->gfx_resolution = 0; p->gfx_vresolution = 0; p->gfx_iscanlines = 0; p->gfx_pscanlines = 0; p->gfx_framerate = 10; p->immediate_blits = 1; p->collision_level = 0; configure_rom (p, roms, 0); p->cpu_model = 68020; p->fpu_model = 68882; p->m68k_speed = -1; #ifdef JIT p->cachesize = 8192; #endif p->cpu_compatible = 0; p->address_space_24 = 0; p->chipmem_size = 0x00200000; p->fastmem_size = 0x00800000; p->bogomem_size = 0; p->nr_floppies = 1; p->floppyslots[1].dfxtype = DRV_NONE; p->floppy_speed = 0; p->start_gui = 0; p->gfx_size_win.width = 320; p->gfx_size_win.height = 256; p->turbo_emulation = false; _tcscpy (ci.rootdir, _T(".")); _tcscpy (ci.volname, _T("CLIBOOT")); _tcscpy (ci.devname, _T("DH0")); ci.bootpri = 15; ci.type = UAEDEV_DIR; #ifdef FILESYS add_filesys_config (p, -1, &ci); #endif }
static void extract_media(struct uae_prefs *p, unzFile uz, xmlNode *node) { xmlNode *tmp = get_node(node, "media"); if(tmp != NULL) { for(xmlNode *curr_node = tmp; curr_node; curr_node = curr_node->next) { int mediatype = -1; if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("floppy")) == 0) mediatype = 0; else if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("harddrive")) == 0) mediatype = 1; if(mediatype >= 0) { xmlChar *content = xmlNodeGetContent(curr_node); if(content != NULL) { int priority = 0; xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("priority")); if(attr != NULL) { priority = atoi((const char *)attr); xmlFree(attr); } if (unzLocateFile (uz, (char *)content, 1) == UNZ_OK) { unz_file_info file_info; if (unzGetCurrentFileInfo (uz, &file_info, NULL, 0, NULL, 0, NULL, 0) == UNZ_OK) { void *buffer = malloc(file_info.uncompressed_size); if(buffer != NULL) { if (unzOpenCurrentFile (uz) == UNZ_OK) { int readsize = unzReadCurrentFile(uz, buffer, file_info.uncompressed_size); unzCloseCurrentFile(uz); if(readsize == file_info.uncompressed_size) { char target_file[MAX_DPATH]; snprintf(target_file, MAX_DPATH, "%s%s", rp9tmp_path, content); FILE *f = fopen(target_file, "wb"); if(f != NULL) { fwrite(buffer, 1, readsize, f); fclose(f); if(mediatype == 0) { // Add floppy if(priority < 2) { strncpy(p->floppyslots[0].df, target_file, sizeof(p->floppyslots[0].df)); disk_insert(0, p->floppyslots[0].df); } else if(priority == 2 && p->nr_floppies > 1) { strncpy(p->floppyslots[1].df, target_file, sizeof(p->floppyslots[1].df)); disk_insert(1, p->floppyslots[1].df); } else if(priority == 3 && p->nr_floppies > 2) { strncpy(p->floppyslots[2].df, target_file, sizeof(p->floppyslots[2].df)); disk_insert(2, p->floppyslots[2].df); } else if(priority == 4 && p->nr_floppies > 3) { strncpy(p->floppyslots[3].df, target_file, sizeof(p->floppyslots[3].df)); disk_insert(3, p->floppyslots[3].df); } AddFileToDiskList(target_file, 1); } else { // Add hardfile struct uaedev_config_info *uci; char dhx[8]; sprintf(dhx, "DH%d", add_HDF_DHnum); ++add_HDF_DHnum; if(hardfile_testrdb (target_file)) uci = add_filesys_config(p, -1, dhx, 0, target_file, 0, 0, 0, 0, 512, 0, 0, 0, 0); else uci = add_filesys_config(p, -1, dhx, 0, target_file, 0, 32, 1, 2, 512, 0, 0, 0, 0); if (uci) hardfile_do_disk_change (uci, 1); gui_force_rtarea_hdchange(); } lstTmpRP9Files.push_back(target_file); } } } free(buffer); } } } xmlFree(content); } } } } }