Пример #1
0
/**
 * Show and process the joystick dialog.
 */
void Dialog_JoyDlg(void)
{
	int but;

	SDLGui_CenterDlg(joydlg);

	joydlg[DLGJOY_MSJY].state &= ~SG_SELECTED;
	joydlg[DLGJOY_JYJY].state &= ~SG_SELECTED;
	joydlg[DLGJOY_MSMS].state &= ~SG_SELECTED;

	int j0 = currprefs.jports[0].id/ JSEM_JOYS; 
	int j1 = currprefs.jports[1].id/ JSEM_JOYS;

	if (j0 == 2 && j1 == 1) { //mouse & joy-1
		joydlg[DLGJOY_MSJY].state |= SG_SELECTED;
	}
	else if (j0 == 1 && j1 == 1) { //joy-2 & joy-1
		joydlg[DLGJOY_JYJY].state |= SG_SELECTED;
	}
	else {
		joydlg[DLGJOY_MSMS].state |= SG_SELECTED;
	}

	do
	{
    		but = SDLGui_DoDialog(joydlg, NULL);

 		gui_poll_events();
	}
	while (but != DLGJOY_EXIT && but != SDLGUI_QUIT
	       && but != SDLGUI_ERROR && !bQuitProgram);
	

	if(joydlg[DLGJOY_MSJY].state & SG_SELECTED){
		changed_prefs.jports[0].id = JSEM_MICE;
		changed_prefs.jports[1].id = JSEM_JOYS;
		changed_prefs.mouse_settings[1]->enabled = 0;
	}
	else if(joydlg[DLGJOY_JYJY].state & SG_SELECTED){
		changed_prefs.jports[0].id = JSEM_JOYS + 1;
		changed_prefs.jports[1].id = JSEM_JOYS;
		changed_prefs.mouse_settings[1]->enabled = 0;
	}
	else if(joydlg[DLGJOY_MSMS].state & SG_SELECTED){
		changed_prefs.jports[0].id = JSEM_MICE;
		changed_prefs.jports[1].id = JSEM_MICE + 1;
		changed_prefs.mouse_settings[1]->enabled = 1;
	}

	inputdevice_config_change();
	check_prefs_changed_custom();


}
Пример #2
0
/**
 * Show the "about" dialog:
 */
void Dialog_AboutDlg(void)
{
   int but;
   /* Center PROG_NAME title string */
   aboutdlg[1].x = (aboutdlg[0].w - strlen(PROG_NAME)) / 2;

   SDLGui_CenterDlg(aboutdlg);

   do
   {
      but=SDLGui_DoDialog(aboutdlg, NULL);
      gui_poll_events();

   }
   while (but != DLGABOUT_EXIT && but != SDLGUI_QUIT
         && but != SDLGUI_ERROR && !bQuitProgram);
}
Пример #3
0
/**
 * Show the "alert" dialog. Return true if user pressed "OK".
 */
static int DlgAlert_ShowDlg(const char *text)
{
	static int maxlen = sizeof(dlglines[0])-1;
	char *t = (char *)malloc(strlen(text)+1);
	char *orig_t = t;
	int lines, i, len, offset;
	bool bOldMouseVisibility;
	int nOldMouseX, nOldMouseY;

	strcpy(t, text);
	lines = DlgAlert_FormatTextToBox(t, maxlen, &len);
	offset = (maxlen-len)/2;

	for(i=0; i<MAX_LINES; i++)
	{
		if (i < lines)
		{
			/* center text to current dlgline */
			memset(dlglines[i], ' ', offset);
			strcpy(dlglines[i] + offset, t);
			t += strlen(t)+1;
		}
		else
		{
			dlglines[i][0] = '\0';
		}
	}

	free(orig_t);

	if (SDLGui_SetScreen(/*sdlscrn*/))
		return false;
	SDLGui_CenterDlg(alertdlg);

        do
	{
	       i = SDLGui_DoDialog(alertdlg, NULL);
               gui_poll_events();

	}
	while (i != DLGALERT_OK && i != DLGALERT_CANCEL && i != SDLGUI_QUIT
	        && i != SDLGUI_ERROR && !bQuitProgram);

	return (i == DLGALERT_OK);
}
Пример #4
0
/**
 * Show and process the ROM dialog.
 */
void DlgRom_Main(void)
{
	char szDlgTosName[47];
	char szDlgCartName[47];
	int32_t but;

	SDLGui_CenterDlg(romdlg);

	File_ShrinkName(szDlgTosName, szTosImageFileName, sizeof(szDlgTosName)-1);
	romdlg[DLGROM_TOSNAME].txt = szDlgTosName;

	do
	{
		but = SDLGui_DoDialog(romdlg, NULL);
		switch (but)
		{
		 case DLGROM_TOSBROWSE:
			/* Show and process the file selection dlg */
			SDLGui_FileConfSelect(szDlgTosName,
					      szTosImageFileName,
					      sizeof(szDlgTosName)-1,
					      false);
			break;

		}

                gui_poll_events();

	}
	while (but != DLGROM_EXIT && but != SDLGUI_QUIT
	       && but != SDLGUI_ERROR && !bQuitProgram);

	if(szTosImageFileName!=NULL && strcmp(szTosImageFileName,"")!=0 && strcmp(szTosImageFileName,"./")!=0 ){
		printf("rom:(%s)\n",szTosImageFileName);
		strcpy(changed_prefs.romfile,szTosImageFileName );
		MUSTRESET=1;
	}

}
Пример #5
0
/**
 * Ask whether new disk should be inserted to A: or B: and if yes, insert.
 */
static void DlgFloppy_QueryInsert(char *namea, int ida, char *nameb, int idb, const char *path)
{
	const char *realname;
	int diskid, dlgid;
	char *dlgname;

	SDLGui_CenterDlg(alertdlg);

int but;

do{        
	but=SDLGui_DoDialog(alertdlg, NULL);

	{
		if(but== DLGMOUNT_A){
			dlgname = namea;
			dlgid = ida;
			diskid = 0;
                }
		else if(but == DLGMOUNT_B){
			dlgname = nameb;
			dlgid = idb;
			diskid = 1;
                }
		
	}
        gui_poll_events();
}
while (but != DLGMOUNT_CANCEL && but != DLGMOUNT_A  && but != DLGMOUNT_B && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram);


	realname = Floppy_SetDiskFileName(diskid, path, NULL);
	if (realname)
		File_ShrinkName(dlgname, realname, floppydlg[dlgid].w);
}
Пример #6
0
/**
 * Show and process the sound dialog.
 */
void Dialog_SoundDlg(void)
{
	int but, i;

	SDLGui_CenterDlg(sounddlg);

	/* Set up dialog from actual values: */

	if (ConfigureParams.Sound.bEnableSound)
		sounddlg[DLGSOUND_ENABLE].state |= SG_SELECTED;
	else
		sounddlg[DLGSOUND_ENABLE].state &= ~SG_SELECTED;

	if (ConfigureParams.Sound.bEnableSoundSync)
		sounddlg[DLGSOUND_SYNC].state |= SG_SELECTED;
	else
		sounddlg[DLGSOUND_SYNC].state &= ~SG_SELECTED;

	for (i = DLGSOUND_11KHZ; i <= DLGSOUND_50KHZ; i++)
		sounddlg[i].state &= ~SG_SELECTED;

	for (i = 0; i <= DLGSOUND_50KHZ-DLGSOUND_11KHZ; i++)
	{
		if (ConfigureParams.Sound.nPlaybackFreq > nSoundFreqs[i]-500
		    && ConfigureParams.Sound.nPlaybackFreq < nSoundFreqs[i]+500)
		{
			sounddlg[DLGSOUND_11KHZ + i].state |= SG_SELECTED;
			break;
		}
	}

	sounddlg[DLGSOUND_MODEL].state &= ~SG_SELECTED;
	sounddlg[DLGSOUND_TABLE].state &= ~SG_SELECTED;
	sounddlg[DLGSOUND_LINEAR].state &= ~SG_SELECTED;
	if (ConfigureParams.Sound.YmVolumeMixing == YM_MODEL_MIXING)
		sounddlg[DLGSOUND_MODEL].state |= SG_SELECTED;
	else
	if (ConfigureParams.Sound.YmVolumeMixing == YM_TABLE_MIXING)
		sounddlg[DLGSOUND_TABLE].state |= SG_SELECTED;
	else
		sounddlg[DLGSOUND_LINEAR].state |= SG_SELECTED;

	File_ShrinkName(dlgRecordName, ConfigureParams.Sound.szYMCaptureFileName, sounddlg[DLGSOUND_RECNAME].w);

	if ( Sound_AreWeRecording() )
		sounddlg[DLGSOUND_RECORD].txt = "Stop recording";
	else
		sounddlg[DLGSOUND_RECORD].txt = "Record sound";

	/* The sound dialog main loop */
	do
	{
		but = SDLGui_DoDialog(sounddlg, NULL);
		switch (but)
		{
		 case DLGSOUND_RECBROWSE:                    /* Choose a new record file */
			SDLGui_FileConfSelect(dlgRecordName,
			                      ConfigureParams.Sound.szYMCaptureFileName,
			                      sounddlg[DLGSOUND_RECNAME].w,
			                      true);
			break;
		 case  DLGSOUND_RECORD:
			if (Sound_AreWeRecording())
			{
				sounddlg[DLGSOUND_RECORD].txt = "Record sound";
				Sound_EndRecording();
			}
			else
			{
				/* make sure that we have a valid file name... */
				if (strlen(ConfigureParams.Sound.szYMCaptureFileName) < 4)
				{
					strcpy(ConfigureParams.Sound.szYMCaptureFileName, "./hatari.wav");
				}
				sounddlg[DLGSOUND_RECORD].txt = "Stop recording";
				Sound_BeginRecording(ConfigureParams.Sound.szYMCaptureFileName);
			}
			break;
		}
                gui_poll_events();
	}
	while (but != DLGSOUND_EXIT && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram );

	/* Read values from dialog */
	ConfigureParams.Sound.bEnableSound = (sounddlg[DLGSOUND_ENABLE].state & SG_SELECTED);

	ConfigureParams.Sound.bEnableSoundSync = (sounddlg[DLGSOUND_SYNC].state & SG_SELECTED);

	for (i = DLGSOUND_11KHZ; i <= DLGSOUND_50KHZ; i++)
	{
		if (sounddlg[i].state & SG_SELECTED)
		{
			ConfigureParams.Sound.nPlaybackFreq = nSoundFreqs[i-DLGSOUND_11KHZ];
			break;
		}
	}

	if (sounddlg[DLGSOUND_MODEL].state & SG_SELECTED)
		ConfigureParams.Sound.YmVolumeMixing = YM_MODEL_MIXING;
	else
	if (sounddlg[DLGSOUND_TABLE].state & SG_SELECTED)
		ConfigureParams.Sound.YmVolumeMixing = YM_TABLE_MIXING;
	else
		ConfigureParams.Sound.YmVolumeMixing = YM_LINEAR_MIXING;
}
Пример #7
0
/**
 * Show and process a file selection dialog.
 * Returns path/name user selected or NULL if user canceled
 * input: zip_path = pointer's pointer to buffer to contain file path
 * within a selected zip file, or NULL if browsing zip files is disallowed.
 * bAllowNew: true if the user is allowed to insert new file names.
 */
char* SDLGui_FileSelect(const char *path_and_name, char **zip_path, bool bAllowNew)
{
	struct dirent **files = NULL;
	char *pStringMem;
	char *retpath = NULL;
	const char *home;
	char *path, *fname;                 /* The actual file and path names */
	bool reloaddir = true;              /* Do we have to reload the directory file list? */
	int retbut;
	bool bOldMouseVisibility;
	int selection;                      /* The selection index */
	char *zipfilename;                  /* Filename in zip file */
	char *zipdir;
	bool browsingzip = false;           /* Are we browsing an archive? */
	zip_dir *zipfiles = NULL;
	SDL_Event sdlEvent;
	int yScrollbar_size;                 /* Size of the vertical scrollbar */

	/* If this is the first call to SDLGui_FileSelect, we reset scrollbar_Ypos and ypos */
	/* Else, we keep the previous value of scrollbar_Ypos and update ypos below, to open */
	/* the fileselector at the same position it was used */
	if ( ypos < 0 )
	{
		scrollbar_Ypos = 0.0;
		ypos = 0;
	}

	refreshentries = true;
	entries = 0;

	/* Allocate memory for the file and path name strings: */
	pStringMem = malloc(4 * FILENAME_MAX);
	path = pStringMem;
	fname = pStringMem + FILENAME_MAX;
	zipdir = pStringMem + 2 * FILENAME_MAX;
	zipfilename = pStringMem + 3 * FILENAME_MAX;
	zipfilename[0] = 0;
	fname[0] = 0;
	path[0] = 0;

	/* Save mouse state and enable cursor */
	bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY);
	SDL_ShowCursor(SDL_ENABLE);

	SDLGui_CenterDlg(fsdlg);
	if (bAllowNew)
	{
		fsdlg[SGFSDLG_FILENAME].type = SGEDITFIELD;
		fsdlg[SGFSDLG_FILENAME].flags |= SG_EXIT;
	}
	else
	{
		fsdlg[SGFSDLG_FILENAME].type = SGTEXT;
		fsdlg[SGFSDLG_FILENAME].flags &= ~SG_EXIT;
	}

	/* Prepare the path and filename variables */
	if (path_and_name && path_and_name[0])
	{
		strncpy(path, path_and_name, FILENAME_MAX);
		path[FILENAME_MAX-1] = '\0';
	}
	if (!File_DirExists(path))
	{
		File_SplitPath(path, path, fname, NULL);
		if (!(File_DirExists(path) || getcwd(path, FILENAME_MAX)))
		{
			perror("SDLGui_FileSelect: non-existing path and CWD failed");
			goto clean_exit;
		}
	}

	File_MakeAbsoluteName(path);
	File_MakeValidPathName(path);
	File_ShrinkName(dlgpath, path, DLGPATH_SIZE);
	File_ShrinkName(dlgfname, fname, DLGFNAME_SIZE);

	do
	{
		if (reloaddir)
		{
			files = files_free(files);

			if (browsingzip)
			{
				files = ZIP_GetFilesDir(zipfiles, zipdir, &entries);
				if(!files)
				{
					fprintf(stderr, "SDLGui_FileSelect: ZIP_GetFilesDir error!\n");
					goto clean_exit;
				}
			}
			else
			{
				/* Load directory entries: */
				entries = scandir(path, &files, 0, alphasort);
			}
			
			/* Remove hidden files from the list if necessary: */
			if (!(fsdlg[SGFSDLG_SHOWHIDDEN].state & SG_SELECTED))
			{
				DlgFileSelect_RemoveHiddenFiles(files);
			}

			if (entries < 0)
			{
				fprintf(stderr, "SDLGui_FileSelect: Path not found.\n");
				goto clean_exit;
			}

			/* reload always implies refresh */
			reloaddir = false;
			refreshentries = true;
		}/* reloaddir */

		/* Refresh scrollbar size */
 		if (entries <= SGFS_NUMENTRIES)
			yScrollbar_size = (SGFS_NUMENTRIES-2) * sdlgui_fontheight;
		else
		{
			yScrollbar_size = (int)((SGFS_NUMENTRIES-2) / ((float)entries/(float)SGFS_NUMENTRIES) * sdlgui_fontheight);
			if ( yScrollbar_size < SCROLLBAR_MIN_HEIGHT )		/* Value could be 0 for very large directory */
				yScrollbar_size = SCROLLBAR_MIN_HEIGHT;
		}
		fsdlg[SGFSDLG_SCROLLBAR].w = yScrollbar_size;

		/* Refresh scrolbar pos */
		ypos = (int) (scrollbar_Ypos * ((float)entries/(float)(SGFS_NUMENTRIES-2)) + 0.5);

		if (ypos+SGFS_NUMENTRIES >= entries) {			/* Ensure Y pos is in the correct boundaries */
			ypos = entries - SGFS_NUMENTRIES;
			if ( ypos < 0 )
				ypos = 0;
			DlgFileSelect_Convert_ypos_to_scrollbar_Ypos();
		}
		fsdlg[SGFSDLG_SCROLLBAR].h = (int) (scrollbar_Ypos * sdlgui_fontheight);

		/* Update the file name strings in the dialog? */
		if (refreshentries)
		{
			if (!DlgFileSelect_RefreshEntries(files, path, browsingzip))
			{
				goto clean_exit;
			}
			refreshentries = false;
		}

		/* Show dialog: */
		retbut = SDLGui_DoDialog(fsdlg, &sdlEvent);

		/* Has the user clicked on a file or folder? */
		if (retbut>=SGFSDLG_ENTRYFIRST && retbut<=SGFSDLG_ENTRYLAST && retbut-SGFSDLG_ENTRYFIRST+ypos<entries)
		{
			char *tempstr;
			
			tempstr = malloc(FILENAME_MAX);
			if (!tempstr)
			{
				perror("Error while allocating temporary memory in SDLGui_FileSelect()");
				goto clean_exit;
			}

			if (browsingzip == true)
			{
				if (!strcat_maxlen(tempstr, FILENAME_MAX,
						   zipdir, files[retbut-SGFSDLG_ENTRYFIRST+ypos]->d_name))
				{
					fprintf(stderr, "SDLGui_FileSelect: Path name too long!\n");
					goto clean_exit;
				}
				/* directory? */
				if (File_DoesFileNameEndWithSlash(tempstr))
				{
					/* handle the ../ directory */
					if (strcmp(files[retbut-SGFSDLG_ENTRYFIRST+ypos]->d_name, "../") == 0)
					{
						/* close the zip file */
						if (strcmp(tempstr, "../") == 0)
						{
							/* free zip file entries */
							ZIP_FreeZipDir(zipfiles);
							zipfiles = NULL;
							/* Copy the path name to the dialog */
							File_ShrinkName(dlgpath, path, DLGPATH_SIZE);
							browsingzip = false;
						}
						else
						{
							/* remove "../" and previous dir from path */
							File_PathShorten(tempstr, 2);
							correct_zip_root(tempstr);
							strcpy(zipdir, tempstr);
							File_ShrinkName(dlgpath, zipdir, DLGPATH_SIZE);
						}
					}
					else /* not the "../" directory */
					{
						strcpy(zipdir, tempstr);
						File_ShrinkName(dlgpath, zipdir, DLGPATH_SIZE);
					}
					reloaddir = true;
					/* Copy the path name to the dialog */
					zipfilename[0] = '\0';
					dlgfname[0] = 0;
					ypos = 0;
					scrollbar_Ypos = 0.0;
				}
				else
				{
					/* not dir, select a file in the zip */
					selection = retbut-SGFSDLG_ENTRYFIRST+ypos;
					strcpy(zipfilename, files[selection]->d_name);
					File_ShrinkName(dlgfname, zipfilename, DLGFNAME_SIZE);
				}

			}
			else /* not browsingzip */
			{
				if (!strcat_maxlen(tempstr, FILENAME_MAX,
						   path, files[retbut-SGFSDLG_ENTRYFIRST+ypos]->d_name))
				{
					fprintf(stderr, "SDLGui_FileSelect: Path name too long!\n");
					goto clean_exit;
				}
				if (File_DirExists(tempstr))
				{
					File_HandleDotDirs(tempstr);
					File_AddSlashToEndFileName(tempstr);
					/* Copy the path name to the dialog */
					File_ShrinkName(dlgpath, tempstr, DLGPATH_SIZE);
					strcpy(path, tempstr);
					reloaddir = true;
					dlgfname[0] = 0;
					ypos = 0;
					scrollbar_Ypos = 0.0;
				}
				else if (ZIP_FileNameIsZIP(tempstr) && zip_path != NULL)
				{
					/* open a zip file */
					zipfiles = ZIP_GetFiles(tempstr);
					if (zipfiles != NULL && browsingzip == false)
					{
						selection = retbut-SGFSDLG_ENTRYFIRST+ypos;
						strcpy(fname, files[selection]->d_name);
						File_ShrinkName(dlgfname, fname, DLGFNAME_SIZE);
						browsingzip = true;
						zipdir[0] = '\0'; /* zip root */
						File_ShrinkName(dlgpath, zipdir, DLGPATH_SIZE);
						reloaddir = true;
						ypos = 0;
						scrollbar_Ypos = 0.0;
					}

				}
				else
				{
					/* Select a file */
					selection = retbut-SGFSDLG_ENTRYFIRST+ypos;
					strcpy(fname, files[selection]->d_name);
					File_ShrinkName(dlgfname, fname, DLGFNAME_SIZE);
				}

			} /* not browsingzip */

			free(tempstr);
		}
		else    /* Has the user clicked on another button? */
		{
			switch(retbut)
			{
			case SGFSDLG_UPDIR:                 /* Change path to parent directory */
				if (browsingzip)
				{
					/* close the zip file? */
					if (!zipdir[0])
					{
						/* free zip file entries */
						ZIP_FreeZipDir(zipfiles);
						browsingzip = false;
						zipfiles = NULL;
						File_ShrinkName(dlgpath, path, DLGPATH_SIZE);
					}
					else
					{
						/* remove last dir from zipdir path */
						File_PathShorten(zipdir, 1);
						correct_zip_root(zipdir);
						File_ShrinkName(dlgpath, zipdir, DLGPATH_SIZE);
						zipfilename[0] = '\0';
					}
				}  /* not a zip file: */
				else
				{
					File_PathShorten(path, 1);
					File_ShrinkName(dlgpath, path, DLGPATH_SIZE);
				}
				reloaddir = true;
				break;

			case SGFSDLG_HOMEDIR:               /* Change to home directory */
			case SGFSDLG_CWD:                   /* Change to current work directory */
				if (retbut == SGFSDLG_CWD)
					home = Paths_GetWorkingDir();
				else
					home = Paths_GetUserHome();
				if (home == NULL || !*home)
					break;
				if (browsingzip)
				{
					/* free zip file entries */
					ZIP_FreeZipDir(zipfiles);
					zipfiles = NULL;
					browsingzip = false;
				}
				strcpy(path, home);
				File_AddSlashToEndFileName(path);
				File_ShrinkName(dlgpath, path, DLGPATH_SIZE);
				reloaddir = true;
				break;

			case SGFSDLG_ROOTDIR:               /* Change to root directory */
				if (browsingzip)
				{
					/* free zip file entries */
					ZIP_FreeZipDir(zipfiles);
					zipfiles = NULL;
					browsingzip = false;
				}
				path[0] = PATHSEP; path[1] = '\0';
				strcpy(dlgpath, path);
				reloaddir = true;
				break;
			case SGFSDLG_UP:                    /* Scroll up */
				DlgFileSelect_ScrollUp();
				SDL_Delay(10);
				break;
			case SGFSDLG_DOWN:                  /* Scroll down */
				DlgFileSelect_ScrollDown();
				SDL_Delay(10);
				break;
			case SGFSDLG_SCROLLBAR:             /* Scrollbar selected */
				DlgFileSelect_ManageScrollbar();
				SDL_Delay(10);
				break;
			case SGFSDLG_FILENAME:              /* User entered new filename */
				strcpy(fname, dlgfname);
				break;
			case SGFSDLG_SHOWHIDDEN:            /* Show/hide hidden files */
				reloaddir = true;
				ypos = 0;
				scrollbar_Ypos = 0.0;
				break;
			case SDLGUI_UNKNOWNEVENT:
				DlgFileSelect_HandleSdlEvents(&sdlEvent);
				break;
			} /* switch */
      
			if (reloaddir)
			{
				/* Remove old selection */
				fname[0] = 0;
				dlgfname[0] = 0;
				ypos = 0;
				scrollbar_Ypos = 0.0;
			}
		} /* other button code */
                gui_poll_events();

	} /* do */
	while (retbut!=SGFSDLG_OKAY && retbut!=SGFSDLG_CANCEL
	       && retbut!=SDLGUI_QUIT && retbut != SDLGUI_ERROR && !bQuitProgram);

	files_free(files);

	if (browsingzip)
	{
		/* free zip file entries */
		ZIP_FreeZipDir(zipfiles);
		zipfiles = NULL;
	}

	if (retbut == SGFSDLG_OKAY)
	{
		if (zip_path)
			*zip_path = zip_get_path(zipdir, zipfilename, browsingzip);
		retpath = File_MakePath(path, fname, NULL);
	}
	else
		retpath = NULL;
clean_exit:
	SDL_ShowCursor(bOldMouseVisibility);
	free(pStringMem);
	return retpath;
}
Пример #8
0
/**
 * Show and process the floppy disk image dialog.
 */
void DlgFloppy_Main(void)
{
	int but, i;
	char *newdisk;
	char dlgname[MAX_FLOPPYDRIVES][64], dlgdiskdir[64];

	SDLGui_CenterDlg(floppydlg);

	/* Set up dialog to actual values: */
 const char *name;

 floppydlg[FLOPPYDLG_ATTACH2FLIPLIST].state &= ~SG_SELECTED;

 name = file_system_get_disk_name(8); /* Filename */
 if (!name)dlgname[0][0] = '\0';
 else File_ShrinkName(dlgname[0], name,floppydlg[FLOPPYDLG_DISKA].w);
 floppydlg[FLOPPYDLG_DISKA].txt = dlgname[0];

 name = file_system_get_disk_name(9); /* Filename */
 if (!name)dlgname[1][0] = '\0';
 else File_ShrinkName(dlgname[1], name,floppydlg[FLOPPYDLG_DISKB].w);
 floppydlg[FLOPPYDLG_DISKB].txt = dlgname[1];

 name = file_system_get_disk_name(10); /* Filename */
 if (!name)dlgname[2][0] = '\0';
 else File_ShrinkName(dlgname[2], name,floppydlg[FLOPPYDLG_DISK2].w);
 floppydlg[FLOPPYDLG_DISK2].txt = dlgname[2];

 name = file_system_get_disk_name(11); /* Filename */
 if (!name)dlgname[3][0] = '\0';
 else File_ShrinkName(dlgname[3], name,floppydlg[FLOPPYDLG_DISK3].w);
 floppydlg[FLOPPYDLG_DISK3].txt = dlgname[3];

	/* Default image directory: */
	File_ShrinkName(dlgdiskdir,szDiskImageDirectory,
	                floppydlg[FLOPPYDLG_IMGDIR].w);
	floppydlg[FLOPPYDLG_IMGDIR].txt = dlgdiskdir;


	/* Draw and process the dialog */
	do
	{       
		but = SDLGui_DoDialog(floppydlg, NULL);
		switch (but)
		{
		 case FLOPPYDLG_EJECTA:                         /* Eject disk in drive A: */
			Floppy_SetDiskFileNameNone(0);
			dlgname[0][0] = '\0';
			file_system_detach_disk(GET_DRIVE(8));

			break;
		 case FLOPPYDLG_BROWSEA:                        /* Choose a new disk A: */
			DlgDisk_BrowseDisk(dlgname[0], 0, FLOPPYDLG_DISKA);

			if (strlen(szDiskFileName[0]) > 0){

			int drivetype;

			printf("load (%s)-",szDiskFileName[0]);
			resources_get_int_sprintf("Drive%iType", &drivetype, GET_DRIVE(8));
			printf("(Drive%iType)\n",drivetype);

			cartridge_detach_image(-1);
			tape_image_detach(1);
//			file_system_detach_disk(GET_DRIVE(8));

			if(File_DoesFileExtensionMatch(szDiskFileName[0],"CRT"))
				cartridge_attach_image(CARTRIDGE_CRT, szDiskFileName[0]);
			else {
//FIXME
/*
				if(File_DoesFileExtensionMatch(szDiskFileName[0],"D81") && drivetype!=1581)
						resources_set_int_sprintf("Drive%iType", 1581,  GET_DRIVE(8));
				else if (drivetype!=1542 && !File_DoesFileExtensionMatch(szDiskFileName[0],"D81"))
						resources_set_int_sprintf("Drive%iType", 1542,  GET_DRIVE(8));
*/			

				if (floppydlg[FLOPPYDLG_ATTACH2FLIPLIST].state & SG_SELECTED){
					file_system_detach_disk(GET_DRIVE(8));
					printf("Attach to flip list\n");
					file_system_attach_disk(8, szDiskFileName[0]);
					fliplist_add_image(8)	;
				}
				else {
					printf("autostart\n");
					autostart_autodetect(szDiskFileName[0], NULL, 0, AUTOSTART_MODE_RUN);
				}

			}

			}

			break;
		 case FLOPPYDLG_EJECTB:                         /* Eject disk in drive B: */
			Floppy_SetDiskFileNameNone(1);
			dlgname[1][0] = '\0';
			file_system_detach_disk(GET_DRIVE(9));

			break;
		case FLOPPYDLG_BROWSEB:                         /* Choose a new disk B: */
			DlgDisk_BrowseDisk(dlgname[1], 1, FLOPPYDLG_DISKB);

			if (strlen(szDiskFileName[1]) > 0){
				
			file_system_detach_disk(GET_DRIVE(9));
     		file_system_attach_disk(9, szDiskFileName[1]);
	
			}

		 case FLOPPYDLG_EJECT2:                         /* Eject disk in drive A: */
			Floppy_SetDiskFileNameNone(2);
			dlgname[2][0] = '\0';
			file_system_detach_disk(GET_DRIVE(10));
			break;
		 case FLOPPYDLG_BROWSE2:                        /* Choose a new disk A: */
			DlgDisk_BrowseDisk(dlgname[2], 0, FLOPPYDLG_DISK2);

			if (strlen(szDiskFileName[2]) > 0){
					//strcpy(prefs->DrivePath[2], szDiskFileName[2]);
			}

			break;
		 case FLOPPYDLG_EJECT3:                         /* Eject disk in drive B: */
			Floppy_SetDiskFileNameNone(3);
			dlgname[3][0] = '\0';
			file_system_detach_disk(GET_DRIVE(11));
			break;
		case FLOPPYDLG_BROWSE3:                         /* Choose a new disk B: */
			DlgDisk_BrowseDisk(dlgname[3], 1, FLOPPYDLG_DISKB);

			if (strlen(szDiskFileName[3]) > 0){

//					strcpy(prefs->DrivePath[3], szDiskFileName[3]);
			}

			break;
		 case FLOPPYDLG_BROWSEIMG:
			DlgDisk_BrowseDir(dlgdiskdir,szDiskImageDirectory,floppydlg[FLOPPYDLG_IMGDIR].w);
			break;
/*
		 case FLOPPYDLG_CREATEIMG:
			newdisk = DlgNewDisk_Main();
			if (newdisk)
			{
				DlgFloppy_QueryInsert(dlgname[0], FLOPPYDLG_DISKA,
						      dlgname[1], FLOPPYDLG_DISKB,
						      newdisk);
				free(newdisk);
			}
			break;
*/
		}
                gui_poll_events();
	}
	while (but != FLOPPYDLG_EXIT && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram);

/*
	if (floppydlg[FLOPPYDLG_AUTOSTART].state & SG_SELECTED){

			if(!ThePrefs.Emul1541Proc){
					prefs->Emul1541Proc = !prefs->Emul1541Proc;
			}
	}
	else {
			if(ThePrefs.Emul1541Proc){
					prefs->Emul1541Proc = !prefs->Emul1541Proc;
			}	

	}
*/

}
Пример #9
0
/**
 * Show and process the "System" dialog (specific to winUAE cpu).
 */
void Dialog_SystemDlg(void)
{
	int32_t i;
	//MACHINETYPE	mti;

//printf("0cpu:%d curr:%d\n",changed_prefs.cpu_model,currprefs.cpu_model);

	SDLGui_CenterDlg(systemdlg);

	/* Set up dialog from actual values: */

	for (i = DLGSYS_68000; i <= DLGSYS_68060; i++)
	{
		systemdlg[i].state &= ~SG_SELECTED;
	}
	systemdlg[DLGSYS_68000+/*ConfigureParams.System.*/nCpuLevel].state |= SG_SELECTED;
#if 0
	for (i = DLGSYS_ST; i <= DLGSYS_FALCON; i++)
	{
		systemdlg[i].state &= ~SG_SELECTED;
	}
	systemdlg[DLGSYS_ST + ConfigureParams.System.nMachineType].state |= SG_SELECTED;

	/* CPU frequency: */
	for (i = DLGSYS_8MHZ; i <= DLGSYS_16MHZ; i++)
	{
		systemdlg[i].state &= ~SG_SELECTED;
	}
	if (ConfigureParams.System.nCpuFreq == 32)
		systemdlg[DLGSYS_32MHZ].state |= SG_SELECTED;
	else if (ConfigureParams.System.nCpuFreq == 16)
		systemdlg[DLGSYS_16MHZ].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_8MHZ].state |= SG_SELECTED;

	/* DSP mode: */
	for (i = DLGSYS_DSPOFF; i <= DLGSYS_DSPON; i++)
	{
		systemdlg[i].state &= ~SG_SELECTED;
	}
	if (ConfigureParams.System.nDSPType == DSP_TYPE_NONE)
		systemdlg[DLGSYS_DSPOFF].state |= SG_SELECTED;
	else if (ConfigureParams.System.nDSPType == DSP_TYPE_DUMMY)
		systemdlg[DLGSYS_DSPDUMMY].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_DSPON].state |= SG_SELECTED;
#endif
	/* More compatible CPU, Prefetch mode */
	if (/*ConfigureParams.System.*/bCompatibleCpu)
		systemdlg[DLGSYS_PREFETCH].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_PREFETCH].state &= ~SG_SELECTED;
#if 0
	/* Emulate Blitter */
	if (ConfigureParams.System.bBlitter)
		systemdlg[DLGSYS_BLITTER].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_BLITTER].state &= ~SG_SELECTED;

	/* Real time clock CPU */
	if (ConfigureParams.System.bRealTimeClock)
		systemdlg[DLGSYS_RTC].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_RTC].state &= ~SG_SELECTED;

	/* Patch timer D */
	if (ConfigureParams.System.bPatchTimerD)
		systemdlg[DLGSYS_TIMERD].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_TIMERD].state &= ~SG_SELECTED;

	/* Adress space 24 bits */
	if (ConfigureParams.System.bAddressSpace24)
		systemdlg[DLGSYS_24BITS].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_24BITS].state &= ~SG_SELECTED;
#endif
	/* Cycle exact CPU */
	if (/*ConfigureParams.System.*/bCycleExactCpu)
		systemdlg[DLGSYS_CYC_EXACT].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_CYC_EXACT].state &= ~SG_SELECTED;
#if 0
	/* FPU emulation */
	for (i = DLGSYS_FPU_NONE; i <= DLGSYS_FPU_CPU_IN; i++)
	{
		systemdlg[i].state &= ~SG_SELECTED;
	}
	if (ConfigureParams.System.n_FPUType == FPU_NONE)
		systemdlg[DLGSYS_FPU_NONE].state |= SG_SELECTED;
	else if (ConfigureParams.System.n_FPUType == FPU_68881)
		systemdlg[DLGSYS_FPU_68881].state |= SG_SELECTED;
	else if (ConfigureParams.System.n_FPUType == FPU_68882)
		systemdlg[DLGSYS_FPU_68882].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_FPU_CPU_IN].state |= SG_SELECTED;

	/* More compatible FPU */
	if (ConfigureParams.System.bCompatibleFPU)
		systemdlg[DLGSYS_FPU_COMPAT].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_FPU_COMPAT].state &= ~SG_SELECTED;

	/* MMU Emulation */
	if (ConfigureParams.System.bMMU)
		systemdlg[DLGSYS_MMU_EMUL].state |= SG_SELECTED;
	else
		systemdlg[DLGSYS_MMU_EMUL].state &= ~SG_SELECTED;
#endif
int32_t but;
do
{
	/* Show the dialog: */
	but=SDLGui_DoDialog(systemdlg, NULL);
        gui_poll_events();
}
while (but != DLGSYS_EXIT && but != SDLGUI_QUIT
	       && but != SDLGUI_ERROR && !bQuitProgram);

	/* Read values from dialog: */

	for (i = DLGSYS_68000; i <= DLGSYS_68060; i++)
	{
		if (systemdlg[i].state&SG_SELECTED)
		{
			/*ConfigureParams.System.*/nCpuLevel = i-DLGSYS_68000;
			break;
		}
	}

	int32_t index = nCpuLevel;
	if(index==5)index=6;

	changed_prefs.cpu_model=68000+index*10;

//currprefs.cpu_model=68000;
//printf("1cpu:%d curr:%d\n",changed_prefs.cpu_model,currprefs.cpu_model);

	if (changed_prefs.cpu_model <= 68020)changed_prefs.address_space_24=1;


/*
	for (mti = MACHINE_ST; mti <= MACHINE_FALCON; mti++)
	{
		if (systemdlg[mti + DLGSYS_ST].state&SG_SELECTED)
		{
			ConfigureParams.System.nMachineType = mti;
			break;
		}
	}
*/
/*
	if (systemdlg[DLGSYS_32MHZ].state & SG_SELECTED)
		ConfigureParams.System.nCpuFreq = 32;
	else if (systemdlg[DLGSYS_16MHZ].state & SG_SELECTED)
		ConfigureParams.System.nCpuFreq = 16;
	else
		ConfigureParams.System.nCpuFreq = 8;

	if (systemdlg[DLGSYS_DSPOFF].state & SG_SELECTED)
		ConfigureParams.System.nDSPType = DSP_TYPE_NONE;
	else if (systemdlg[DLGSYS_DSPDUMMY].state & SG_SELECTED)
		ConfigureParams.System.nDSPType = DSP_TYPE_DUMMY;
	else
		ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
*/
	/*ConfigureParams.System.*/bCompatibleCpu = (systemdlg[DLGSYS_PREFETCH].state & SG_SELECTED);

changed_prefs.cpu_compatible =bCompatibleCpu;
	if (changed_prefs.cpu_compatible && currprefs.cpu_cycle_exact) {
				changed_prefs.cpu_cycle_exact = 0;
	}
/*
	ConfigureParams.System.bBlitter = (systemdlg[DLGSYS_BLITTER].state & SG_SELECTED);
	ConfigureParams.System.bRealTimeClock = (systemdlg[DLGSYS_RTC].state & SG_SELECTED);
	ConfigureParams.System.bPatchTimerD = (systemdlg[DLGSYS_TIMERD].state & SG_SELECTED);
	ConfigureParams.System.bAddressSpace24 = (systemdlg[DLGSYS_24BITS].state & SG_SELECTED);
*/
	/*ConfigureParams.System.*/bCycleExactCpu = (systemdlg[DLGSYS_CYC_EXACT].state & SG_SELECTED);

	changed_prefs.cpu_cycle_exact = bCycleExactCpu;
	if (changed_prefs.cpu_cycle_exact && currprefs.cpu_compatible) {
				changed_prefs.cpu_compatible = 0;
	}

	config_changed = 1;
	check_prefs_changed_cpu();
	/* FPU emulation */
/*
	if (systemdlg[DLGSYS_FPU_NONE].state & SG_SELECTED)
		ConfigureParams.System.n_FPUType = FPU_NONE;
	else if (systemdlg[DLGSYS_FPU_68881].state & SG_SELECTED)
		ConfigureParams.System.n_FPUType = FPU_68881;
	else if (systemdlg[DLGSYS_FPU_68882].state & SG_SELECTED)
		ConfigureParams.System.n_FPUType = FPU_68882;
	else
		ConfigureParams.System.n_FPUType = FPU_CPU;

	ConfigureParams.System.bCompatibleFPU = (systemdlg[DLGSYS_FPU_COMPAT].state & SG_SELECTED);
	ConfigureParams.System.bMMU = (systemdlg[DLGSYS_MMU_EMUL].state & SG_SELECTED);
*/
}
Пример #10
0
/**
 * Show and process the floppy disk image dialog.
 */
void DlgFloppy_Main(void)
{
	int but, i;
	char *newdisk;
	char dlgname[MAX_FLOPPYDRIVES][64], dlgdiskdir[64];

	SDLGui_CenterDlg(floppydlg);

	/* Set up dialog to actual values: */
 const char *name;

 floppydlg[FLOPPYDLG_AUTORUN].state &= ~SG_SELECTED;

 name = DISKA_NAME; /* Filename */
 if (!name)dlgname[0][0] = '\0';
 else File_ShrinkName(dlgname[0], name,floppydlg[FLOPPYDLG_DISKA].w);
 floppydlg[FLOPPYDLG_DISKA].txt = dlgname[0];

 name = DISKB_NAME; /* Filename */
 if (!name)dlgname[1][0] = '\0';
 else File_ShrinkName(dlgname[1], name,floppydlg[FLOPPYDLG_DISKB].w);
 floppydlg[FLOPPYDLG_DISKB].txt = dlgname[1];

 name = TAPE_NAME; /* Filename */
 if (!name)dlgname[2][0] = '\0';
 else File_ShrinkName(dlgname[2], name,floppydlg[FLOPPYDLG_DISK2].w);
 floppydlg[FLOPPYDLG_DISK2].txt = dlgname[2];

 name = CART_NAME; /* Filename */
 if (!name)dlgname[3][0] = '\0';
 else File_ShrinkName(dlgname[3], name,floppydlg[FLOPPYDLG_DISK3].w);
 floppydlg[FLOPPYDLG_DISK3].txt = dlgname[3];

	/* Default image directory: */
	File_ShrinkName(dlgdiskdir,szDiskImageDirectory,
	                floppydlg[FLOPPYDLG_IMGDIR].w);
	floppydlg[FLOPPYDLG_IMGDIR].txt = dlgdiskdir;


	/* Draw and process the dialog */
	do
	{       
		but = SDLGui_DoDialog(floppydlg, NULL);
		switch (but)
		{
		 case FLOPPYDLG_EJECTA:                         /* Eject disk in drive A: */
			Floppy_SetDiskFileNameNone(0);
			dlgname[0][0] = '\0';
			DiskImage_RemoveDisk(0);

			break;
		 case FLOPPYDLG_BROWSEA:                        /* Choose a new disk A: */
			DlgDisk_BrowseDisk(dlgname[0], 0, FLOPPYDLG_DISKA);

			if (strlen(szDiskFileName[0]) > 0){

				if (GenericInterface_InsertDiskImage(0, szDiskFileName[0])) {
					printf("Error loading drivea:%s\n", szDiskFileName[0]);
				}	
				else {

					if(floppydlg[FLOPPYDLG_AUTORUN].state & SG_SELECTED){
	
						char AutoType_String[256];	
						char *pBuffer = malloc(512*5);
						int nAutoRunResult = AMSDOS_GenerateAutorunCommand(pBuffer,AutoType_String);

						if(nAutoRunResult==0){
							printf("auto(%s)\n",AutoType_String);
							AutoType_SetString(AutoType_String, TRUE, TRUE);
						}
						else printf("error auto(%d)\n",nAutoRunResult);
						free(pBuffer);
					}

					sprintf(DISKA_NAME,"%s",szDiskFileName[0]);
				}

			}

			break;
		 case FLOPPYDLG_EJECTB:                         /* Eject disk in drive B: */
			Floppy_SetDiskFileNameNone(1);
			dlgname[1][0] = '\0';
			DiskImage_RemoveDisk(1);

			break;
		case FLOPPYDLG_BROWSEB:                         /* Choose a new disk B: */
			DlgDisk_BrowseDisk(dlgname[1], 1, FLOPPYDLG_DISKB);

			if (strlen(szDiskFileName[1]) > 0){

				if (GenericInterface_InsertDiskImage(1, szDiskFileName[1])) {
					printf("Error loading driveb:%s\n", szDiskFileName[1]);
				}	
				else sprintf(DISKB_NAME,"%s",szDiskFileName[1]);
				
			}

		 case FLOPPYDLG_EJECT2:                         /* Eject tape  */
			Floppy_SetDiskFileNameNone(2);
			dlgname[2][0] = '\0';
			Tape_Remove();
 			sprintf(TAPE_NAME,"\0");

			break;
		 case FLOPPYDLG_BROWSE2:                        /* Choose a new tape */
			DlgDisk_BrowseDisk(dlgname[2], 2, FLOPPYDLG_DISK2);

			if (strlen(szDiskFileName[2]) > 0){

				if (GenericInterface_InsertTape(szDiskFileName[2])) {
					printf("Error loading Tape:%s\n", szDiskFileName[2]);
				}
				else {
					sprintf(TAPE_NAME,"%s",szDiskFileName[2]);
					AutoType_SetString( "|TAPE\nRUN\"\n\n", TRUE, TRUE);
				}

			}

			break;

		 case FLOPPYDLG_EJECT3:                         /* Eject cart  */
			Floppy_SetDiskFileNameNone(3);
			dlgname[3][0] = '\0';
			GenericInterface_RemoveCartridge();
 			sprintf(CART_NAME,"\0");
			break;
		case FLOPPYDLG_BROWSE3:                         /* Choose a new cart */
			DlgDisk_BrowseDisk(dlgname[3], 3, FLOPPYDLG_DISK3);

			if (strlen(szDiskFileName[3]) > 0){

				if(strcmp (szDiskFileName[3],"/home/tech/Bureau/GIT/arnold/roms/parados.rom") == 0){

					GenericInterface_LoadRom(7, szDiskFileName[3]);
					CPC_Reset();
					break;
				}

				if (GenericInterface_InsertCartridge(szDiskFileName[3])) {
					printf("Error loading cart:%s\n",szDiskFileName[3]);
				}	
				else sprintf(CART_NAME,"%s",szDiskFileName[3]);

//					strcpy(prefs->DrivePath[3], szDiskFileName[3]);
			}

			break;

		 case FLOPPYDLG_BROWSEIMG:
			DlgDisk_BrowseDir(dlgdiskdir,szDiskImageDirectory,floppydlg[FLOPPYDLG_IMGDIR].w);
			break;
/*
		 case FLOPPYDLG_CREATEIMG:
			newdisk = DlgNewDisk_Main();
			if (newdisk)
			{
				DlgFloppy_QueryInsert(dlgname[0], FLOPPYDLG_DISKA,
						      dlgname[1], FLOPPYDLG_DISKB,
						      newdisk);
				free(newdisk);
			}
			break;
*/
		}
                gui_poll_events();
	}
	while (but != FLOPPYDLG_EXIT && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram);


}
Пример #11
0
/**
 * Show and process the floppy disk image dialog.
 */
void DlgFloppy_Main(void)
{
	int32_t but, i;
	char *newdisk;
	char dlgname[MAX_FLOPPYDRIVES][64], dlgdiskdir[64];

	SDLGui_CenterDlg(floppydlg);

	/* Set up dialog to actual values: */

	/* Disk name 0: */
	if(currprefs.floppyslots[1 - 1].df!=NULL)
		File_ShrinkName(dlgname[0], currprefs.floppyslots[0].df,floppydlg[FLOPPYDLG_DISKA].w);
	else
		dlgname[0][0] = '\0';

	floppydlg[FLOPPYDLG_DISKA].txt = dlgname[0];

	/* Disk name 1: */
	if(currprefs.floppyslots[2 - 1].df!=NULL)
		File_ShrinkName(dlgname[1], currprefs.floppyslots[1].df,floppydlg[FLOPPYDLG_DISKB].w);
	else
		dlgname[1][0] = '\0';
	floppydlg[FLOPPYDLG_DISKB].txt = dlgname[1];


	/* Disk name 2: */
	if(currprefs.floppyslots[3 - 1].df!=NULL)
		File_ShrinkName(dlgname[2], currprefs.floppyslots[2].df,floppydlg[FLOPPYDLG_DISK2].w);
	else
		dlgname[0][0] = '\0';

	floppydlg[FLOPPYDLG_DISK2].txt = dlgname[2];

	/* Disk name 3: */
	if(currprefs.floppyslots[4 - 1].df!=NULL)
		File_ShrinkName(dlgname[3],currprefs.floppyslots[3].df,floppydlg[FLOPPYDLG_DISK3].w);
	else
		dlgname[1][0] = '\0';
	floppydlg[FLOPPYDLG_DISK3].txt = dlgname[3];


	/* Default image directory: */
	File_ShrinkName(dlgdiskdir,szDiskImageDirectory,
	                floppydlg[FLOPPYDLG_IMGDIR].w);
	floppydlg[FLOPPYDLG_IMGDIR].txt = dlgdiskdir;


	/* Draw and process the dialog */
	do
	{
		but = SDLGui_DoDialog(floppydlg, NULL);
		switch (but)
		{
		 case FLOPPYDLG_EJECTA:                         /* Eject disk in drive A: */
			Floppy_SetDiskFileNameNone(0);
			dlgname[0][0] = '\0';

				changed_prefs.floppyslots[0].df[0] = 0;
				DISK_check_change();
				disk_eject(0);
			break;
		 case FLOPPYDLG_BROWSEA:                        /* Choose a new disk A: */
			DlgDisk_BrowseDisk(dlgname[0], 0, FLOPPYDLG_DISKA);

			if (strlen(szDiskFileName[0]) > 0){

					if (currprefs.nr_floppies-1 < 0 ) {
						currprefs.nr_floppies = 0  + 1;
					}

					//check whether drive is enabled
					if (currprefs.floppyslots[0].dfxtype < 0) {
						changed_prefs.floppyslots[0 ].dfxtype = 0;
						DISK_check_change();
					}
					strcpy (changed_prefs.floppyslots[0 ].df,szDiskFileName[0]);

					DISK_check_change();
					//disk_eject(0);
					//disk_insert (0, changed_prefs.floppyslots[0 ].df, false);

			}

			break;
		 case FLOPPYDLG_EJECTB:                         /* Eject disk in drive B: */
			Floppy_SetDiskFileNameNone(1);
			dlgname[1][0] = '\0';

				changed_prefs.floppyslots[1].df[0] = 0;
				DISK_check_change();
				disk_eject(1);

			break;
		case FLOPPYDLG_BROWSEB:                         /* Choose a new disk B: */
			DlgDisk_BrowseDisk(dlgname[1], 1, FLOPPYDLG_DISKB);
			if (strlen(szDiskFileName[1]) > 0){

					if (currprefs.nr_floppies-1 < 1 ) {
						currprefs.nr_floppies = 1  + 1;
					}

					//check whether drive is enabled
					if (currprefs.floppyslots[1].dfxtype < 0) {
						changed_prefs.floppyslots[1 ].dfxtype = 0;
						DISK_check_change();
					}
					strcpy (changed_prefs.floppyslots[1 ].df,szDiskFileName[1]);
					DISK_check_change();
			}


		 case FLOPPYDLG_EJECT2:                         /* Eject disk in drive A: */
			Floppy_SetDiskFileNameNone(2);
			dlgname[2][0] = '\0';

				changed_prefs.floppyslots[2].df[0] = 0;
				DISK_check_change();
				disk_eject(2);
			break;
		 case FLOPPYDLG_BROWSE2:                        /* Choose a new disk A: */
			DlgDisk_BrowseDisk(dlgname[2], 0, FLOPPYDLG_DISK2);

			if (strlen(szDiskFileName[2]) > 0){

					if (currprefs.nr_floppies-1 < 2 ) {
						currprefs.nr_floppies = 2  + 1;
					}

					//check whether drive is enabled
					if (currprefs.floppyslots[2].dfxtype < 0) {
						changed_prefs.floppyslots[2 ].dfxtype = 0;
						DISK_check_change();
					}
					strcpy (changed_prefs.floppyslots[2 ].df,szDiskFileName[2]);

					DISK_check_change();
					//disk_eject(0);
					//disk_insert (0, changed_prefs.floppyslots[0 ].df, false);

			}

			break;
		 case FLOPPYDLG_EJECT3:                         /* Eject disk in drive B: */
			Floppy_SetDiskFileNameNone(3);
			dlgname[3][0] = '\0';

				changed_prefs.floppyslots[3].df[0] = 0;
				DISK_check_change();
				disk_eject(3);

			break;
		case FLOPPYDLG_BROWSE3:                         /* Choose a new disk B: */
			DlgDisk_BrowseDisk(dlgname[3], 1, FLOPPYDLG_DISKB);
			if (strlen(szDiskFileName[3]) > 0){

					if (currprefs.nr_floppies-1 < 3 ) {
						currprefs.nr_floppies = 3  + 1;
					}

					//check whether drive is enabled
					if (currprefs.floppyslots[3].dfxtype < 0) {
						changed_prefs.floppyslots[3 ].dfxtype = 0;
						DISK_check_change();
					}
					strcpy (changed_prefs.floppyslots[3 ].df,szDiskFileName[3]);
					DISK_check_change();
			}

			break;
		 case FLOPPYDLG_BROWSEIMG:
			DlgDisk_BrowseDir(dlgdiskdir,
			                 /*ConfigureParams.DiskImage.*/szDiskImageDirectory,
			                 floppydlg[FLOPPYDLG_IMGDIR].w);
			break;
/*
		 case FLOPPYDLG_CREATEIMG:
			newdisk = DlgNewDisk_Main();
			if (newdisk)
			{
				DlgFloppy_QueryInsert(dlgname[0], FLOPPYDLG_DISKA,
						      dlgname[1], FLOPPYDLG_DISKB,
						      newdisk);
				free(newdisk);
			}
			break;
*/
		}
                gui_poll_events();
	}
	while (but != FLOPPYDLG_EXIT && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram);



}
Пример #12
0
/**
 * Show and process the hard disk dialog.
 */
void DlgHardDisk_Main(void)
{
	int but, i;
	char dlgname_gdos[64], dlgname_acsi[64];
	char dlgname_ide_master[64], dlgname_ide_slave[64];

	SDLGui_CenterDlg(diskdlg);

	/* Set up dialog to actual values: */
printf("skip: %d\n", ConfigureParams.HardDisk.nHardDiskDrive);
	/* Skip ACSI/IDE partitions? */
	if (ConfigureParams.HardDisk.nHardDiskDrive == DRIVE_SKIP)
		diskdlg[DISKDLG_DRIVESKIP].state |= SG_SELECTED;
	else
		diskdlg[DISKDLG_DRIVESKIP].state &= ~SG_SELECTED;

	/* Boot from harddisk? */
	if (ConfigureParams.HardDisk.bBootFromHardDisk)
		diskdlg[DISKDLG_BOOTHD].state |= SG_SELECTED;
	else
		diskdlg[DISKDLG_BOOTHD].state &= ~SG_SELECTED;

	/* ACSI hard disk image: */
	if (ConfigureParams.Acsi[0].bUseDevice)
		File_ShrinkName(dlgname_acsi, ConfigureParams.Acsi[0].sDeviceFile,
		                diskdlg[DISKDLG_ACSINAME].w);
	else
		dlgname_acsi[0] = '\0';
	diskdlg[DISKDLG_ACSINAME].txt = dlgname_acsi;

	/* IDE master hard disk image: */
	if (ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage)
		File_ShrinkName(dlgname_ide_master, ConfigureParams.HardDisk.szIdeMasterHardDiskImage,
		                diskdlg[DISKDLG_IDEMASTERNAME].w);
	else
		dlgname_ide_master[0] = '\0';
	diskdlg[DISKDLG_IDEMASTERNAME].txt = dlgname_ide_master;

	/* IDE slave hard disk image: */
	if (ConfigureParams.HardDisk.bUseIdeSlaveHardDiskImage)
		File_ShrinkName(dlgname_ide_slave, ConfigureParams.HardDisk.szIdeSlaveHardDiskImage,
		                diskdlg[DISKDLG_IDESLAVENAME].w);
	else
		dlgname_ide_slave[0] = '\0';
	diskdlg[DISKDLG_IDESLAVENAME].txt = dlgname_ide_slave;

	/* GEMDOS hard disk directory: */
	if (ConfigureParams.HardDisk.bUseHardDiskDirectories)
		File_ShrinkName(dlgname_gdos, ConfigureParams.HardDisk.szHardDiskDirectories[0],
		                diskdlg[DISKDLG_GEMDOSNAME].w);
	else
		dlgname_gdos[0] = '\0';
	diskdlg[DISKDLG_GEMDOSNAME].txt = dlgname_gdos;

	/* Write protection */
	for (i = DISKDLG_PROTOFF; i <= DISKDLG_PROTAUTO; i++)
	{
		diskdlg[i].state &= ~SG_SELECTED;
	}
	diskdlg[DISKDLG_PROTOFF+ConfigureParams.HardDisk.nWriteProtection].state |= SG_SELECTED;

	/* Draw and process the dialog */
	do
	{
		but = SDLGui_DoDialog(diskdlg, NULL);
		switch (but)
		{
		 case DISKDLG_ACSIEJECT:
			ConfigureParams.Acsi[0].bUseDevice = false;
			dlgname_acsi[0] = '\0';
			break;
		 case DISKDLG_ACSIBROWSE:
			if (SDLGui_FileConfSelect("NULL",dlgname_acsi,
			                          ConfigureParams.Acsi[0].sDeviceFile,
			                          diskdlg[DISKDLG_ACSINAME].w, false))
				ConfigureParams.Acsi[0].bUseDevice = true;
			break;
		 case DISKDLG_IDEMASTEREJECT:
			ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage = false;
			dlgname_ide_master[0] = '\0';
			break;
		 case DISKDLG_IDEMASTERBROWSE:
			if (SDLGui_FileConfSelect("NULL",dlgname_ide_master,
			                          ConfigureParams.HardDisk.szIdeMasterHardDiskImage,
			                          diskdlg[DISKDLG_IDEMASTERNAME].w, false))
				ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage = true;
			break;
		 case DISKDLG_IDESLAVEEJECT:
			ConfigureParams.HardDisk.bUseIdeSlaveHardDiskImage = false;
			dlgname_ide_slave[0] = '\0';
			break;
		 case DISKDLG_IDESLAVEBROWSE:
			if (SDLGui_FileConfSelect("NULL",dlgname_ide_slave,
			                          ConfigureParams.HardDisk.szIdeSlaveHardDiskImage,
			                          diskdlg[DISKDLG_IDESLAVENAME].w, false))
				ConfigureParams.HardDisk.bUseIdeSlaveHardDiskImage = true;
			break;
		 case DISKDLG_GEMDOSEJECT:
			ConfigureParams.HardDisk.bUseHardDiskDirectories = false;
			dlgname_gdos[0] = '\0';
			break;
		 case DISKDLG_GEMDOSBROWSE:
			if (DlgDisk_BrowseDir(dlgname_gdos,
			                     ConfigureParams.HardDisk.szHardDiskDirectories[0],
			                     diskdlg[DISKDLG_GEMDOSNAME].w))
				ConfigureParams.HardDisk.bUseHardDiskDirectories = true;
			break;
		}
                gui_poll_events();
	}
	while (but != DISKDLG_EXIT && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram);

	/* Read values from dialog: */
	for (i = DISKDLG_PROTOFF; i <= DISKDLG_PROTAUTO; i++)
	{
		if (diskdlg[i].state & SG_SELECTED)
		{
			ConfigureParams.HardDisk.nWriteProtection = i-DISKDLG_PROTOFF;
			break;
		}
	}
	ConfigureParams.HardDisk.bBootFromHardDisk = (diskdlg[DISKDLG_BOOTHD].state & SG_SELECTED);

	if (diskdlg[DISKDLG_DRIVESKIP].state & SG_SELECTED)
		ConfigureParams.HardDisk.nHardDiskDrive = DRIVE_SKIP;
	else if (ConfigureParams.HardDisk.nHardDiskDrive == DRIVE_SKIP)
		ConfigureParams.HardDisk.nHardDiskDrive = DRIVE_C;
}
Пример #13
0
/**
 * Show the "about" dialog:
 */
void Dialog_MiscDlg(void)
{ 
        int i,but;

	SDLGui_CenterDlg(miscdlg);

	miscdlg[DLGMISC_LIMSPEED].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_FASTRESET].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_CIAHACK].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_MAPSLSH].state &= ~SG_SELECTED;

	miscdlg[DLGMISC_REUNONE].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_REU128K].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_REU256K].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_REU512K].state &= ~SG_SELECTED;
/*
	switch (ThePrefs.REUSize)
	{
		case REU_NONE:
			miscdlg[DLGMISC_REUNONE].state |= SG_SELECTED;	
			break;
		case REU_128K:
			miscdlg[DLGMISC_REU128K].state |= SG_SELECTED;
			break;
		case REU_256K:
			miscdlg[DLGMISC_REU256K].state |= SG_SELECTED;
			break;
		case REU_512K:
			miscdlg[DLGMISC_REU512K].state |= SG_SELECTED;
			break;		
	}

	if (ThePrefs.LimitSpeed) { 
		miscdlg[DLGMISC_LIMSPEED].state |= SG_SELECTED;
	}
	if (ThePrefs.FastReset) { 
		miscdlg[DLGMISC_FASTRESET].state |= SG_SELECTED;
	}
	if (ThePrefs.CIAIRQHack) { 
		miscdlg[DLGMISC_CIAHACK].state |= SG_SELECTED;
	}
	if (ThePrefs.MapSlash) { 
		miscdlg[DLGMISC_MAPSLSH].state |= SG_SELECTED;
	}

	sprintf(mcycle[0], "%3i", ThePrefs.NormalCycles);
	valcycle[0]=ThePrefs.NormalCycles;
	sprintf(mcycle[1], "%3i", ThePrefs.BadLineCycles);
	valcycle[1]=ThePrefs.BadLineCycles;
	sprintf(mcycle[2], "%3i", ThePrefs.CIACycles);
	valcycle[2]=ThePrefs.CIACycles;
	sprintf(mcycle[3], "%3i", ThePrefs.FloppyCycles);
	valcycle[3]=ThePrefs.FloppyCycles;
*/
    do
	{
        but=SDLGui_DoDialog(miscdlg, NULL);

	 	for(i=0;i<4;i++){
			if(but==DLGMISC_INC[i]){
				valcycle[i]++;//if(valcycle[i]>100)valcycle[i]=100;
				sprintf(mcycle[i], "%3i", valcycle[i]);
			}
			else if(but== DLGMISC_DEC[i]){
				valcycle[i]--;//if(valcycle[i]<1)valcycle[i]=1;
				sprintf(mcycle[i], "%3i", valcycle[i]);
			}
		}

        gui_poll_events();

     }
     while (but != DLGMISC_EXIT && but != SDLGUI_QUIT
	       && but != SDLGUI_ERROR && !bQuitProgram);
/*
	if(miscdlg[DLGMISC_LIMSPEED].state & SG_SELECTED){
		if(!ThePrefs.LimitSpeed)
			prefs->	LimitSpeed=true;
	}		
	else if(ThePrefs.LimitSpeed)
			prefs->	LimitSpeed=false;	
	
	if(miscdlg[DLGMISC_FASTRESET].state & SG_SELECTED){
		if(!ThePrefs.FastReset)
			prefs->FastReset	=true;	
	}
	else if(ThePrefs.FastReset)
			prefs->FastReset	=false;
	
	if(miscdlg[DLGMISC_CIAHACK].state & SG_SELECTED){
		if(!ThePrefs.CIAIRQHack)
			prefs->CIAIRQHack	=true;
	}
	else if(ThePrefs.CIAIRQHack)
			prefs->CIAIRQHack	=false;

	if(miscdlg[DLGMISC_MAPSLSH].state & SG_SELECTED){
		if(!ThePrefs.MapSlash)		
			prefs->MapSlash	=true;
	}
	else if(ThePrefs.MapSlash)
			prefs->MapSlash	=false;

	prefs->NormalCycles=valcycle[0];
	prefs->BadLineCycles=valcycle[1];
	prefs->CIACycles=valcycle[2];
	prefs->FloppyCycles=valcycle[3];

	for(i=0;i<4;i++)
		if(miscdlg[DLGMISC_REUNONE+i].state & SG_SELECTED)
			prefs->REUSize=i;
*/
}
Пример #14
0
/**
 * This functions sets up the actual font and then displays the main dialog.
 */
int Dialog_MainDlg(bool *bReset, bool *bLoadedSnapshot)
{
	int retbut=0;
	bool bOldMouseVisibility;
	int nOldMouseX, nOldMouseY;
	char *psNewCfg;

	*bReset = false;
	*bLoadedSnapshot = false;

	if (SDLGui_SetScreen(/*sdlscrn*/))
		return false;

	SDLGui_CenterDlg(maindlg);

	maindlg[MAINDLG_NORESET].state |= SG_SELECTED;
	maindlg[MAINDLG_RESET].state &= ~SG_SELECTED;

	do
	{
		retbut = SDLGui_DoDialog(maindlg, NULL);
		switch (retbut)
		{
		 case MAINDLG_ABOUT:
			Dialog_AboutDlg();
			break;

		 case MAINDLG_FLOPPYS:
			DlgFloppy_Main();
			break;

		 case MAINDLG_HARDDISK:
			DlgHardDisk_Main();
			break;

		 case MAINDLG_ROM:
			DlgRom_Main();
			break;

		 case MAINDLG_VIDEO:
			Dialog_VideoDlg();
			break;

		 case MAINDLG_SYSTEM:
			Dialog_SystemDlg();
			break;

		 case MAINDLG_MEMORY:
			if (Dialog_MemDlg())
			{
				/* Memory snapshot has been loaded - leave GUI immediately */
				*bLoadedSnapshot = true;
				//Main_WarpMouse(nOldMouseX, nOldMouseY);
				return true;
			}
			break;

		 case MAINDLG_MISC:
			Dialog_MiscDlg();
			break;

		 case MAINDLG_JOYSTICK:
			Dialog_JoyDlg();
			break;

		 case MAINDLG_SOUND:
			Dialog_SoundDlg();
			break;

		 case MAINDLG_LOADCFG:
			strcpy(sConfigFileName, ".uaerc");
			psNewCfg = SDLGui_FileSelect(sConfigFileName, NULL, false);
			if (psNewCfg)
			{
					default_prefs(& changed_prefs, 0);
					changed_prefs.chipmem_size = 0;
					changed_prefs.bogomem_size = 0;
					unmount_all_hdfs();
					int ret = cfgfile_load (& changed_prefs, psNewCfg, NULL,1,0);
					if (ret) {

						check_prefs_changed_cpu();
						check_prefs_changed_audio();
						check_prefs_changed_custom();

						MUSTRESET_CFG=1;
					}


				strcpy(sConfigFileName, psNewCfg);

			}
			break;

		 case MAINDLG_QUIT:
			bQuitProgram = true;
			break;
		}
                gui_poll_events();
	}
	while (retbut != MAINDLG_OK && retbut != MAINDLG_CANCEL && retbut != SDLGUI_QUIT
	        && retbut != SDLGUI_ERROR && !bQuitProgram);


	if (maindlg[MAINDLG_RESET].state & SG_SELECTED)
		*bReset = true;

	return (retbut == MAINDLG_OK);
}
Пример #15
0
/**
 * Show and process the hard disk dialog.
 */
void DlgHardDisk_Main(void)
{
	int but, i;
	char dlgname_gdos[64], dlgname_acsi[64];
	char dlgname_ide_master[64], dlgname_ide_slave[64];

	SDLGui_CenterDlg(diskdlg);

	/* Set up dialog to actual values: */

	/* Boot from harddisk? */

	/* ACSI hard disk image: */
	if (bUseHardDiskImage[0])
		File_ShrinkName(dlgname_acsi, szHardDiskImage[0],
		                diskdlg[DISKDLG_ACSINAME].w);
	else
		dlgname_acsi[0] = '\0';
	diskdlg[DISKDLG_ACSINAME].txt = dlgname_acsi;


	/* IDE master hard disk image: */
	if (bUseHardDiskImage[1])
		File_ShrinkName(dlgname_ide_master, szHardDiskImage[1],
		                diskdlg[DISKDLG_IDEMASTERNAME].w);
	else
		dlgname_ide_master[0] = '\0';
	diskdlg[DISKDLG_IDEMASTERNAME].txt = dlgname_ide_master;

	/* IDE slave hard disk image: */
	if (bUseHardDiskImage[2])
		File_ShrinkName(dlgname_ide_slave, szHardDiskImage[2],
		                diskdlg[DISKDLG_IDESLAVENAME].w);
	else
		dlgname_ide_slave[0] = '\0';
	diskdlg[DISKDLG_IDESLAVENAME].txt = dlgname_ide_slave;

	/* GEMDOS hard disk directory: */
	if (bUseHardDiskImage[3])
		File_ShrinkName(dlgname_gdos, szHardDiskImage[4],
		                diskdlg[DISKDLG_GEMDOSNAME].w);
	else
		dlgname_gdos[0] = '\0';
	diskdlg[DISKDLG_GEMDOSNAME].txt = dlgname_gdos;


	/* Draw and process the dialog */
	do
	{
		but = SDLGui_DoDialog(diskdlg, NULL);
		switch (but)
		{
		 case DISKDLG_HD0EJECT:
			bUseHardDiskImage[0] = false;
			dlgname_acsi[0] = '\0';

			if(szHardDiskImage[0]!=0)
			kill_filesys_unitconfig (&currprefs, 0);
			break;
		 case DISKDLG_HD0BROWSE:
			if (SDLGui_FileConfSelect(dlgname_acsi,
			                          szHardDiskImage[0],
			                          diskdlg[DISKDLG_ACSINAME].w, false)){

				bUseHardDiskImage[0] = true;
				mount_hdf(0,szHardDiskImage[0]);
				}
			break;

		 case DISKDLG_HD1EJECT:
			bUseHardDiskImage[1] = false;
			dlgname_ide_master[0] = '\0';

			if(szHardDiskImage[1]!=0)
			kill_filesys_unitconfig (&currprefs, 1);

			break;
		 case DISKDLG_HD1BROWSE:
			if (SDLGui_FileConfSelect(dlgname_ide_master,
			                          szHardDiskImage[1],
			                          diskdlg[DISKDLG_IDEMASTERNAME].w, false)){
				bUseHardDiskImage[1] = true;
				mount_hdf(1,szHardDiskImage[1]);}
			break;

		 case DISKDLG_HD2EJECT:
			bUseHardDiskImage[2]= false;
			dlgname_ide_slave[0] = '\0';
			if(szHardDiskImage[2]!=0)
			kill_filesys_unitconfig (&currprefs, 2);

			break;
		 case DISKDLG_HD2BROWSE:
			if (SDLGui_FileConfSelect(dlgname_ide_slave,
			                          szHardDiskImage[2],
			                          diskdlg[DISKDLG_IDESLAVENAME].w, false)){
				bUseHardDiskImage[2] = true;
				mount_hdf(2,szHardDiskImage[2]);}
			break;
		 case DISKDLG_HD3EJECT:
			bUseHardDiskImage[3]= false;
			dlgname_gdos[0] = '\0';
			if(szHardDiskImage[3]!=0)
			kill_filesys_unitconfig (&currprefs, 3);
			break;

		 case DISKDLG_HD3BROWSE:
			if (DlgDisk_BrowseDir(dlgname_gdos,
			                     szHardDiskImage[3],
			                     diskdlg[DISKDLG_GEMDOSNAME].w)){
				bUseHardDiskImage[3]= true;
				mount_hdf(3,szHardDiskImage[3]);}
			break;


		}
                gui_poll_events();
	}
	while (but != DISKDLG_EXIT && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram);

}
Пример #16
0
/**
 * Show and process the memory dialog.
 * @return  true if a memory snapshot has been loaded, false otherwise
 */
bool Dialog_MemDlg(void)
{
	int32_t i;
	int32_t but;

	SDLGui_CenterDlg(memorydlg);

	for (i = DLGMEMC_512KB; i <= DLGMEMC_8MB; i++)
	{
		memorydlg[i].state &= ~SG_SELECTED;
	}

	for (i = DLGMEMB_512KB; i <= DLGMEMB_1MB; i++)
	{
		memorydlg[i].state &= ~SG_SELECTED;
	}

	for (i = DLGMEMF_512KB; i <= DLGMEMF_8MB; i++)
	{
		memorydlg[i].state &= ~SG_SELECTED;
	}

printf("chip:%x fast:%x bogo:%x \n",currprefs.chipmem_size,currprefs.fastmem_size,currprefs.bogomem_size);

switch (currprefs.chipmem_size){

	case 0x80000:memorydlg[DLGMEMC_512KB].state |= SG_SELECTED;
		break;
	case 0x100000:memorydlg[DLGMEMC_1MB].state |= SG_SELECTED;
		break;
	case 0x200000:memorydlg[DLGMEMC_2MB].state |= SG_SELECTED;
		break;
	case 0x300000:memorydlg[DLGMEMC_3MB].state |= SG_SELECTED;
		break;
	case 0x400000:memorydlg[DLGMEMC_4MB].state |= SG_SELECTED;
		break;
	case 0x500000:memorydlg[DLGMEMC_5MB].state |= SG_SELECTED;
		break;
	case 0x600000:memorydlg[DLGMEMC_6MB].state |= SG_SELECTED;
		break;
	case 0x700000:memorydlg[DLGMEMC_7MB].state |= SG_SELECTED;
		break;
	default:
		memorydlg[DLGMEMC_8MB].state |= SG_SELECTED;
		break;
}

switch (currprefs.fastmem_size){

	case 0: break;
	case 0x80000:memorydlg[DLGMEMF_512KB].state |= SG_SELECTED;
		break;
	case 0x100000:memorydlg[DLGMEMF_1MB].state |= SG_SELECTED;
		break;
	case 0x200000:memorydlg[DLGMEMF_2MB].state |= SG_SELECTED;
		break;
	case 0x300000:memorydlg[DLGMEMF_3MB].state |= SG_SELECTED;
		break;
	case 0x400000:memorydlg[DLGMEMF_4MB].state |= SG_SELECTED;
		break;
	case 0x500000:memorydlg[DLGMEMF_5MB].state |= SG_SELECTED;
		break;
	case 0x600000:memorydlg[DLGMEMF_6MB].state |= SG_SELECTED;
		break;
	case 0x700000:memorydlg[DLGMEMF_7MB].state |= SG_SELECTED;
		break;
	default:
		memorydlg[DLGMEMF_8MB].state |= SG_SELECTED;
		break;
}

switch (currprefs.bogomem_size){

	case 0x80000:memorydlg[DLGMEMB_512KB].state |= SG_SELECTED;
		break;
	default:memorydlg[DLGMEMB_1MB].state |= SG_SELECTED;
		break;
}

	do
	{
		but = SDLGui_DoDialog(memorydlg, NULL);

		switch (but)
		{


		}

                gui_poll_events();
	}
	while (but != DLGMEM_EXIT && but != SDLGUI_QUIT
	        && but != SDLGUI_ERROR && !bQuitProgram );


	for (i = DLGMEMC_512KB; i <= DLGMEMC_8MB; i++)
	{
		if(memorydlg[i].state & SG_SELECTED){

			changed_prefs.chipmem_size=chipm[i-DLGMEMC_512KB];

			if (currprefs.fastmem_size != 0 && changed_prefs.chipmem_size > 0x200000)
				changed_prefs.chipmem_size=0x200000;

			if(changed_prefs.chipmem_size!=currprefs.chipmem_size)memory_reset();
			break;
		}
	}

	for (i = DLGMEMB_512KB; i <= DLGMEMB_1MB; i++)
	{
		if(memorydlg[i].state & SG_SELECTED){

			changed_prefs.bogomem_size=chipm[i-DLGMEMB_512KB];
			if(changed_prefs.bogomem_size!=currprefs.bogomem_size)memory_reset();
			break;
		}
	}

	for (i = DLGMEMF_512KB; i <= DLGMEMF_8MB; i++)
	{

		if(memorydlg[i].state & SG_SELECTED){

			changed_prefs.fastmem_size=chipm[i-DLGMEMF_512KB];

			if(changed_prefs.fastmem_size!=currprefs.fastmem_size){

				if (changed_prefs.fastmem_size > 0 && currprefs.chipmem_size > 0x200000)
					changed_prefs.chipmem_size = 0x200000;

				expamem_reset();
				memory_reset();
			}
			break;
		}
	}


	return false;
}
Пример #17
0
/**
 * This functions sets up the actual font and then displays the main dialog.
 */
int Dialog_MainDlg(bool *bReset, bool *bLoadedSnapshot)
{
	int retbut;
	bool bOldMouseVisibility;
	int nOldMouseX, nOldMouseY;
	char *psNewCfg;

	*bReset = false;
	*bLoadedSnapshot = false;

	if (SDLGui_SetScreen(sdlscrn))
		return false;

	SDL_GetMouseState(&nOldMouseX, &nOldMouseY);
	bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY);
	SDL_ShowCursor(SDL_ENABLE);

	SDLGui_CenterDlg(maindlg);

	maindlg[MAINDLG_NORESET].state |= SG_SELECTED;
	maindlg[MAINDLG_RESET].state &= ~SG_SELECTED;

	do
	{
		retbut = SDLGui_DoDialog(maindlg, NULL);
		switch (retbut)
		{
		 case MAINDLG_ABOUT:
			Dialog_AboutDlg();
			break;
		 case MAINDLG_FLOPPYS:
			DlgFloppy_Main();
			break;
		 case MAINDLG_HARDDISK:
			DlgHardDisk_Main();
			break;
		 case MAINDLG_ROM:
			DlgRom_Main();
			break;
		 case MAINDLG_MONITOR:
			Dialog_MonitorDlg();
			break;
		 case MAINDLG_WINDOW:
			Dialog_WindowDlg();
			break;
		 case MAINDLG_SYSTEM:
			Dialog_SystemDlg();
			break;
		 case MAINDLG_MEMORY:
			if (Dialog_MemDlg())
			{
				/* Memory snapshot has been loaded - leave GUI immediately */
				*bLoadedSnapshot = true;
				SDL_ShowCursor(bOldMouseVisibility);
				Main_WarpMouse(nOldMouseX, nOldMouseY);
				return true;
			}
			break;
		 case MAINDLG_JOY:
			Dialog_JoyDlg();
			break;
		 case MAINDLG_KEYBD:
			Dialog_KeyboardDlg();
			break;
		 case MAINDLG_DEVICES:
			Dialog_DeviceDlg();
			break;
		 case MAINDLG_SOUND:
			Dialog_SoundDlg();
			break;
		 case MAINDLG_LOADCFG:
			psNewCfg = SDLGui_FileSelect(sConfigFileName, NULL, false);
			if (psNewCfg)
			{
				strcpy(sConfigFileName, psNewCfg);
				Configuration_Load(NULL);
				free(psNewCfg);
			}
			break;
		 case MAINDLG_SAVECFG:
			psNewCfg = SDLGui_FileSelect(sConfigFileName, NULL, true);
			if (psNewCfg)
			{
				strcpy(sConfigFileName, psNewCfg);
				Configuration_Save();
				free(psNewCfg);
			}
			break;
		 case MAINDLG_QUIT:
			bQuitProgram = true;
			break;
		}
                gui_poll_events();

	}
	while (retbut != MAINDLG_OK && retbut != MAINDLG_CANCEL && retbut != SDLGUI_QUIT
	        && retbut != SDLGUI_ERROR && !bQuitProgram);


	if (maindlg[MAINDLG_RESET].state & SG_SELECTED)
		*bReset = true;

	SDL_ShowCursor(bOldMouseVisibility);
	Main_WarpMouse(nOldMouseX, nOldMouseY);

	return (retbut == MAINDLG_OK);
}
Пример #18
0
/**
 * Show and process the "Device" dialog.
 */
void Dialog_DeviceDlg(void)
{
    int but;

    SDLGui_CenterDlg(devicedlg);

    /* Set up dialog from actual values: */

    if (ConfigureParams.Printer.bEnablePrinting)
        devicedlg[DEVDLG_PRNENABLE].state |= SG_SELECTED;
    else
        devicedlg[DEVDLG_PRNENABLE].state &= ~SG_SELECTED;
    File_ShrinkName(dlgPrinterName, ConfigureParams.Printer.szPrintToFileName, devicedlg[DEVDLG_PRNFILENAME].w);

    if (ConfigureParams.RS232.bEnableRS232)
        devicedlg[DEVDLG_RS232ENABLE].state |= SG_SELECTED;
    else
        devicedlg[DEVDLG_RS232ENABLE].state &= ~SG_SELECTED;
    File_ShrinkName(dlgRs232OutName, ConfigureParams.RS232.szOutFileName, devicedlg[DEVDLG_RS232OUTNAME].w);
    File_ShrinkName(dlgRs232InName, ConfigureParams.RS232.szInFileName, devicedlg[DEVDLG_RS232INNAME].w);

    if (ConfigureParams.Midi.bEnableMidi)
        devicedlg[DEVDLG_MIDIENABLE].state |= SG_SELECTED;
    else
        devicedlg[DEVDLG_MIDIENABLE].state &= ~SG_SELECTED;
    File_ShrinkName(dlgMidiInName, ConfigureParams.Midi.sMidiInFileName, devicedlg[DEVDLG_MIDIINNAME].w);
    File_ShrinkName(dlgMidiOutName, ConfigureParams.Midi.sMidiOutFileName, devicedlg[DEVDLG_MIDIOUTNAME].w);

    /* The devices dialog main loop */
    do
    {
        but = SDLGui_DoDialog(devicedlg, NULL);

        switch(but)
        {
        case DEVDLG_PRNBROWSE:                 /* Choose a new printer file */
            SDLGui_FileConfSelect("NULL",dlgPrinterName,
                                  ConfigureParams.Printer.szPrintToFileName,
                                  devicedlg[DEVDLG_PRNFILENAME].w,
                                  true);
            break;
        case DEVDLG_RS232OUTBROWSE:            /* Choose a new RS232 output file */
            SDLGui_FileConfSelect("NULL",dlgRs232OutName,
                                  ConfigureParams.RS232.szOutFileName,
                                  devicedlg[DEVDLG_RS232OUTNAME].w,
                                  true);
            break;
        case DEVDLG_RS232INBROWSE:             /* Choose a new RS232 input file */
            SDLGui_FileConfSelect("NULL",dlgRs232InName,
                                  ConfigureParams.RS232.szInFileName,
                                  devicedlg[DEVDLG_RS232INNAME].w,
                                  true);
            break;
        case DEVDLG_MIDIINBROWSE:              /* Choose a new MIDI file */
            SDLGui_FileConfSelect("NULL",dlgMidiInName,
                                  ConfigureParams.Midi.sMidiInFileName,
                                  devicedlg[DEVDLG_MIDIINNAME].w,
                                  true);
            break;
        case DEVDLG_MIDIOUTBROWSE:             /* Choose a new MIDI file */
            SDLGui_FileConfSelect("NULL",dlgMidiOutName,
                                  ConfigureParams.Midi.sMidiOutFileName,
                                  devicedlg[DEVDLG_MIDIOUTNAME].w,
                                  true);
            break;
        }
        gui_poll_events();
    }
    while (but != DEVDLG_EXIT && but != SDLGUI_QUIT
            && but != SDLGUI_ERROR && !bQuitProgram);

    /* Read values from dialog */
    ConfigureParams.Printer.bEnablePrinting = (devicedlg[DEVDLG_PRNENABLE].state & SG_SELECTED);
    ConfigureParams.RS232.bEnableRS232 = (devicedlg[DEVDLG_RS232ENABLE].state & SG_SELECTED);
    ConfigureParams.Midi.bEnableMidi = (devicedlg[DEVDLG_MIDIENABLE].state & SG_SELECTED);
}
Пример #19
0
/**
 * This functions sets up the actual font and then displays the main dialog.
 */
int Dialog_MainDlg(bool *bReset, bool *bLoadedSnapshot)
{
    int retbut=0;
    bool bOldMouseVisibility;
    int nOldMouseX, nOldMouseY;
    char *psNewCfg;

    *bReset = false;
    *bLoadedSnapshot = false;

    if (SDLGui_SetScreen())
        return false;

    SDLGui_CenterDlg(maindlg);

    maindlg[MAINDLG_NORESET].state |= SG_SELECTED;
    maindlg[MAINDLG_RESET].state &= ~SG_SELECTED;

//	prefs = new Prefs(ThePrefs);

    do
    {
        retbut = SDLGui_DoDialog(maindlg, NULL);
        switch (retbut)
        {
        case MAINDLG_ABOUT:
            Dialog_AboutDlg();
            break;

        case MAINDLG_FLOPPYS:
            DlgFloppy_Main();
            break;

        case MAINDLG_VIDEO:
            Dialog_VideoDlg();
            break;

        case MAINDLG_MISC:
            Dialog_MiscDlg();
            break;

        case MAINDLG_JOYSTICK:
            Dialog_JoyDlg();
            break;

        case MAINDLG_SOUND:
            Dialog_SoundDlg();
            break;

        case MAINDLG_LOADCFG:
            /*
            			strcpy(sConfigFileName, ".frodorc");
            			psNewCfg = SDLGui_FileSelect(sConfigFileName, NULL, false);

            			if (psNewCfg)
            			{
            				prefs->Load(psNewCfg);
                         	TheC64->NewPrefs(prefs);
                         	ThePrefs = *prefs;

            				strcpy(sConfigFileName, psNewCfg);
            				free(psNewCfg);
            			}
            */
            break;

        case MAINDLG_SAVECFG:
            /*
            			strcpy(sConfigFileName, ".frodorc");
            			psNewCfg = SDLGui_FileSelect(sConfigFileName, NULL, true);

            			if (psNewCfg)
            			{
            				strcpy(sConfigFileName, psNewCfg);
            				prefs->Save(sConfigFileName);
            				free(psNewCfg);
            			}
            */
            break;

        case MAINDLG_SNAPSHOT:
            Dialog_SnapshotDlg();
            break;

        case MAINDLG_QUIT:
            bQuitProgram = true;
            break;
        }
        /*
        		if(ThePrefs!=*prefs){
        			printf("pref change \n");
        			TheC64->NewPrefs(prefs);
        			ThePrefs = *prefs;
        		}
        */
        gui_poll_events();

    }
    while (retbut != MAINDLG_OK && retbut != MAINDLG_CANCEL && retbut != SDLGUI_QUIT
            && retbut != SDLGUI_ERROR && !bQuitProgram);


    if (maindlg[MAINDLG_RESET].state & SG_SELECTED)
        *bReset = true;

    //delete prefs;

    return (retbut == MAINDLG_OK);
}
Пример #20
0
/**
 * Show the "about" dialog:
 */
void Dialog_MiscDlg(void)
{ 
        int but;

	SDLGui_CenterDlg(miscdlg);

	if(currprefs.leds_on_screen==1){
		miscdlg[DLGMISC_LEDON].state |= SG_SELECTED;
		miscdlg[DLGMISC_LEDOFF].state &= ~SG_SELECTED;
	}
	else {
		miscdlg[DLGMISC_LEDON].state &= ~SG_SELECTED;
		miscdlg[DLGMISC_LEDOFF].state |= SG_SELECTED;
	}

	miscdlg[DLGMISC_SPEED100].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_SPEED200].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_SPEED400].state &= ~SG_SELECTED;
	miscdlg[DLGMISC_SPEED800].state &= ~SG_SELECTED;

	switch(currprefs.floppy_speed){

		case 100:miscdlg[DLGMISC_SPEED100].state |= SG_SELECTED;
		break;
		case 200:miscdlg[DLGMISC_SPEED200].state |= SG_SELECTED;
		break;
		case 400:miscdlg[DLGMISC_SPEED400].state |= SG_SELECTED;
		break;
		case 800:miscdlg[DLGMISC_SPEED800].state |= SG_SELECTED;
		break;
	}

	sprintf(sMaxSlot, "%3i", stateSlot);

        do
	{

		
                but=SDLGui_DoDialog(miscdlg, NULL);

		sprintf(thumbPath, "%sstate%03d.img\0", SAVE_PATH, stateSlot);
 		loadthumb(thumbPath,256,300);

		switch(but){

		 case DLGMISC_INC:
				stateSlot++;if(stateSlot>100)stateSlot=1;
				sprintf(sMaxSlot, "%3i", stateSlot);
			break;
		 case DLGMISC_DEC:
				stateSlot--;if(stateSlot<1)stateSlot=100;
				sprintf(sMaxSlot, "%3i", stateSlot);
			break;

		 case DLGMISC_LOAD:

				sprintf(tmpPath, "%sstate%03d.asf\0", SAVE_PATH, stateSlot);
				if (fsel_file_exists(tmpPath)) {
					savestate_initsave (tmpPath, 0, 0, 0);
					//savestate_initsave (tmpPath, 1,1,1);
					savestate_state = STATE_DORESTORE;

					return;
				}

			break;
		 case DLGMISC_SAVE:

				sprintf(tmpPath, "%sstate%03d.asf\0", SAVE_PATH, stateSlot);
				sprintf(thumbPath, "%sstate%03d.img\0", SAVE_PATH, stateSlot);
				dothumb(thumbPath,640,480,128,96);

				if (!fsel_file_exists(tmpPath)) {
					fsel_file_create(tmpPath);
				}
				savestate_initsave (tmpPath, 0, 0, 0);
				save_state (tmpPath, "puae");
				//savestate_initsave (tmpPath, 1);
				//save_state (tmpPath, "p-uae");

			break;


		}

                gui_poll_events();

        }
        while (but != DLGMISC_EXIT && but != SDLGUI_QUIT
	       && but != SDLGUI_ERROR && !bQuitProgram);


	if(miscdlg[DLGMISC_LEDON].state& SG_SELECTED){
		currprefs.leds_on_screen = 1;
	}
	else if(miscdlg[DLGMISC_LEDOFF].state& SG_SELECTED){
		currprefs.leds_on_screen = 0;
		clean_led_area();
	}

	if(miscdlg[DLGMISC_SPEED100].state & SG_SELECTED)changed_prefs.floppy_speed=100;
	else if(miscdlg[DLGMISC_SPEED200].state & SG_SELECTED)changed_prefs.floppy_speed=200;
	else if(miscdlg[DLGMISC_SPEED400].state & SG_SELECTED)changed_prefs.floppy_speed=400;
	else if(miscdlg[DLGMISC_SPEED800].state & SG_SELECTED)changed_prefs.floppy_speed=800;
	DISK_check_change();

}