Esempio n. 1
0
static void HDOptions (void)
{
    char *buff;
    char tmp[256];
    char mountvol[256];
    char mountdir[256];
    int c = 0;

    for (;;){

	tui_selwin(0);
	print_configuration();

	c = tui_menubrowse (hdmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
	if (c == -1)
	    break;
	else switch (c) {
	 case 0:
	    tui_wgets (mountvol, "Enter mounted volume name", 10);
	    if (strlen (mountvol) == 0)
		break;
	    if (mountvol[strlen(mountvol)-1]==':')
		mountvol[strlen(mountvol)-1] = 0;
	    tui_wgets (mountdir, "Enter mounted volume path", 78);
	    add_filesys_unit (currprefs.mountinfo, "", mountvol, mountdir, 0, 0, 0, 0, 0, 0, 0);
	    break;
	 case 1:
	    tui_wgets (mountvol, "Enter mounted volume name", 10);
	    if (strlen (mountvol) == 0)
		break;
	    if (mountvol[strlen (mountvol)-1]==':')
		mountvol[strlen (mountvol)-1] = 0;
	    tui_wgets (mountdir, "Enter mounted volume path", 78);
	    add_filesys_unit (currprefs.mountinfo, "", mountvol, mountdir, 1, 0, 0, 0, 0, 0, 0);
	    break;
	 case 2:
	    buff = tui_filereq("*", "", "Select the hardfile to be mounted");
	    if (buff == NULL)
		break;
	    strcpy (mountvol, buff);
	    tui_wgets (mountdir, "Enter number of sectors per track", 4);
	    tui_wgets (mountdir + 10, "Enter number of heads", 4);
	    tui_wgets (mountdir + 20, "Enter number of reserved blocks", 3);
	    tui_wgets (mountdir + 30, "Enter block size", 4);
	    buff = add_filesys_unit (currprefs.mountinfo, "", 0, mountvol, 1,
				     atoi (mountdir), atoi (mountdir + 10),
				     atoi (mountdir + 20), atoi (mountdir + 30), 0, 0);
	    if (buff)
		tui_errorbox (buff);
	    break;
	 case 3:
	    tui_wgets (mountvol, "Enter number of volume to be removed (0 for UAE0:, etc.)", 2);
	    if (kill_filesys_unit (currprefs.mountinfo, atoi (mountvol)) == -1)
		tui_errorbox ("Volume does not exist");
	    break;
	}
    }
}
Esempio n. 2
0
void filesys_addexternals (void)
{
	int drive, drivetype;
	UINT errormode;
	DWORD dwDriveMask;
	int drvnum = 0;
	int cnt = 0;

	if (!currprefs.win32_automount_cddrives && !currprefs.win32_automount_netdrives
		&& !currprefs.win32_automount_drives && !currprefs.win32_automount_removabledrives)
		return;
	errormode = SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
	dwDriveMask = GetLogicalDrives ();
	dwDriveMask >>= 2; // Skip A and B drives...

	for(drive = 'C'; drive <= 'Z'; ++drive) {
		struct uaedev_config_info ci = { 0 };
		_stprintf (ci.rootdir, _T("%c:\\"), drive);
		/* Is this drive-letter valid (it used to check for media in drive) */
		if(dwDriveMask & 1) {
			bool inserted = CheckRM (ci.rootdir) != 0; /* Is there a disk inserted? */
			int nok = FALSE;
			int rw = 1;

			drivetype = GetDriveType (ci.rootdir);
			if (inserted && drivetype != DRIVE_NO_ROOT_DIR && drivetype != DRIVE_UNKNOWN) {
				if (hfdcheck (drive)) {
					write_log (_T("Drive %c:\\ ignored, was configured as a harddrive\n"), drive);
					continue;
				}
			}
			for (;;) {
				if (!inserted) {
					nok = TRUE;
					break;
				}
				if (drivetype == DRIVE_REMOTE && currprefs.win32_automount_netdrives)
					break;
				if (drivetype == DRIVE_FIXED && currprefs.win32_automount_drives)
					break;
				if (drivetype == DRIVE_REMOVABLE && currprefs.win32_automount_removabledrives)
					break;
				nok = TRUE;
				break;
			}
			if (nok)
				continue;
			if (inserted) {
				target_get_volume_name (&mountinfo, &ci, inserted, true, cnt++);
				if (!ci.volname[0])
					_stprintf (ci.volname, _T("WinUNK_%c"), drive);
			}
			if (drivetype == DRIVE_REMOTE)
				_tcscat (ci.rootdir, _T("."));
			else
				_tcscat (ci.rootdir, _T(".."));
#if 0
			if (currprefs.win32_automount_drives > 1) {
				devname[0] = drive;
				devname[1] = 0;
			}
#endif
			ci.readonly = !rw;
			ci.bootpri = -20 - drvnum;
			//write_log (_T("Drive type %d: '%s' '%s'\n"), drivetype, volumepath, volumename);
			add_filesys_unit (&ci);
			drvnum++;
		} /* if drivemask */
		dwDriveMask >>= 1;
	}
	SetErrorMode (errormode);
}
Esempio n. 3
0
extern "C" void
JAVA_EXPORT_NAME(DemoActivity_setPrefs) ( JNIEnv*  env, jobject  thiz, jstring rom, jstring romkey, jstring hddir, jstring hdfile, jstring floppy1, jstring floppy2, jstring floppy3, jstring floppy4, jint frameskip, jint floppyspeed, jint cpu_model, jint chip_mem, jint slow_mem, jint fast_mem, jint chipset, jint cpu_speed, jint change_sound, jint sound, jint change_disk, jint reset, jint drive_status, jint ntsc ) {
    if (rom)
    {
        const char *srom = (env)->GetStringUTFChars(rom, 0);
        strcpy(romfile, srom);
        (env)->ReleaseStringUTFChars(rom, srom);
    }
    
    if (romkey)
    {
        const char *sromkey = (env)->GetStringUTFChars(romkey, 0);
        strcpy(romkeyfile, sromkey);
        (env)->ReleaseStringUTFChars(romkey, sromkey);
    }

    if (change_disk)
    {
        savestate_state = 0;
    }
    default_prefs_uae (&currprefs);
    default_prefs();
    
    mainMenu_floppyspeed = floppyspeed;
    mainMenu_CPU_model = cpu_model; // m68020
    mainMenu_chipMemory = chip_mem; // 2MB
    mainMenu_slowMemory = slow_mem;
    mainMenu_fastMemory = fast_mem;
    mainMenu_chipset = chipset; // aga
    mainMenu_CPU_speed = cpu_speed; // 500/5T/a1200/12T/12T2

    __android_log_print(ANDROID_LOG_INFO, "UAE", "floppyspeed= %d, cpu_model= %d, chip_mem= %d, slow_mem= %d, fast_mem= %d, chipset= %d, cpu_speed= %d", floppyspeed, cpu_model, chip_mem, slow_mem, fast_mem, chipset, cpu_speed);

    UpdateCPUModelSettings(&changed_prefs);
    UpdateMemorySettings(&changed_prefs);
    UpdateChipsetSettings(&changed_prefs);
    if (change_disk && uae4all_hard_dir[0] != '\0' && currprefs.mountinfo) {
        __android_log_print(ANDROID_LOG_INFO, "UAE", "kill_filesys_unit hd dir: %s", uae4all_hard_dir);
        kill_filesys_unit(currprefs.mountinfo, 0);
        mainMenu_filesysUnits--;
        hd_dir_unit_nr = -1;
        uae4all_hard_dir[0] = '\0';
    }
    if (hddir && currprefs.mountinfo)
    {            
        const char *hddir1 = (env)->GetStringUTFChars(hddir, 0);
        strcpy(uae4all_hard_dir, hddir1);
        (env)->ReleaseStringUTFChars(hddir, hddir1);

        __android_log_print(ANDROID_LOG_INFO, "UAE", "add_filesys_unit hd dir: %s", uae4all_hard_dir);
        char *s2 = add_filesys_unit (currprefs.mountinfo, "HD0", uae4all_hard_dir, 1, 0, 0, 0, 0);
        if (s2)
            __android_log_print(ANDROID_LOG_ERROR, "UAE", "%s\n", s2);
        hd_dir_unit_nr = mainMenu_filesysUnits++;
    }
    if (change_disk && uae4all_hard_file[0] != '\0' && currprefs.mountinfo) {
        __android_log_print(ANDROID_LOG_INFO, "UAE", "kill_filesys_unit hd file: %s", uae4all_hard_file);
        kill_filesys_unit(currprefs.mountinfo, 0);
        mainMenu_filesysUnits--;
        hd_file_unit_nr = -1;
        uae4all_hard_file[0] = '\0';
    } 
    if (hdfile && currprefs.mountinfo)
    {
        const char *hdfile1 = (env)->GetStringUTFChars(hdfile, 0);
        strcpy(uae4all_hard_file, hdfile1);
        (env)->ReleaseStringUTFChars(hdfile, hdfile1);
        __android_log_print(ANDROID_LOG_INFO, "UAE", "add_filesys_unit hd file: %s", uae4all_hard_file);
        char *s2 = add_filesys_unit (currprefs.mountinfo, 0, uae4all_hard_file, 0, 32, 1, 2, 512);
        if (s2)
            __android_log_print(ANDROID_LOG_ERROR, "UAE", "%s\n", s2);
        hd_file_unit_nr = mainMenu_filesysUnits++;
    }
    if (floppy1)
    {
        const char *sfloppy1 = (env)->GetStringUTFChars(floppy1, 0);
        
        if (change_disk) {
            strcpy(changed_df[0], sfloppy1);
            real_changed_df[0]=1;
            __android_log_print(ANDROID_LOG_INFO, "UAE", "change floppy1: %s", changed_df[0]);
        } else
            strcpy(prefs_df[0], sfloppy1);
        (env)->ReleaseStringUTFChars(floppy1, sfloppy1);
        
    } else
        strcpy (prefs_df[0], "/sdcard/df0.adf");
    if (floppy2)
    {
        const char *sfloppy2 = (env)->GetStringUTFChars(floppy2, 0);
        
        if (change_disk) {
            strcpy(changed_df[1], sfloppy2);
            real_changed_df[1]=1;
        } else
            strcpy(prefs_df[1], sfloppy2);
        (env)->ReleaseStringUTFChars(floppy2, sfloppy2);
        //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]);
    } else
        strcpy (prefs_df[1], "/sdcard/df1.adf");

    if (floppy3)
    {
        const char *sfloppy3 = (env)->GetStringUTFChars(floppy3, 0);
        
        if (change_disk) {
            strcpy(changed_df[2], sfloppy3);
            real_changed_df[2]=1;
        } else
            strcpy(prefs_df[2], sfloppy3);
        (env)->ReleaseStringUTFChars(floppy3, sfloppy3);
        //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]);
    } else
        strcpy (prefs_df[2], "/sdcard/df2.adf");

    if (floppy4)
    {
        const char *sfloppy4 = (env)->GetStringUTFChars(floppy4, 0);
        
        if (change_disk) {
            strcpy(changed_df[3], sfloppy4);
            real_changed_df[3]=1;
        } else
            strcpy(prefs_df[3], sfloppy4);
        (env)->ReleaseStringUTFChars(floppy4, sfloppy4);
        //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]);
    } else
        strcpy (prefs_df[3], "/sdcard/df3.adf");

    mainMenu_showStatus = drive_status;
    mainMenu_ntsc = ntsc;

    if (change_sound)
        changed_produce_sound = sound;
    else {
        produce_sound = sound;
        changed_produce_sound = sound;
    }

    if (frameskip >= 100)   
        prefs_gfx_framerate = -1;
    else
        prefs_gfx_framerate = frameskip;
    changed_gfx_framerate = prefs_gfx_framerate;
    __android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_gfx_framerate: %d", prefs_gfx_framerate);
    m68k_speed = 0;
    check_prefs_changed_cpu();
    check_prefs_changed_audio();
    //DISK_init();



    //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[0]: %s", prefs_df[0]);
    //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]);
    //__android_log_print(ANDROID_LOG_INFO, "UAE", "m68k_speed: %d / timeslice_mode: %d", m68k_speed, timeslice_mode);

    if (reset) {

        uae_reset();
    }
}