gui mod

Nov 6, 2010 at 5:50 PM
Edited Nov 6, 2010 at 10:02 PM

Hi,

 

While integrating pcsx reloaded into my mythtv setup, the following changes made things much easier (just a quick hack -- perhaps it would be better to add new options etc. to enhance the functionality rather than change it; perhaps -hidegui or something like that):

 

Change in the behavior of the -nogui flag:

It first starts the game with gui hidden based on the -cdfile setting. Note that the original nogui mode is not that useful since it is notpossible change iso image etc. without the gui.

 

Change in the behavior of the -cdfile flag:

Once this is specified, the menu item Run CD will start this image specifiedby -cdfile.

For example: pcsx -cdfile file.img -nogui    now allows to start the game directly (in full screen)   and I can still use esc to get back to the gui (perhaps to switch   iso image, save, etc.). I know that there are keyboard shortcuts for   saving etc. but the UI is much nicer + there is no keyboard shortcut for   switching the iso image.It is now much easier to integrate pcsx into mythtv, for example.

 

 

 

*** Gtk2Gui.c	2010-11-05 02:05:24.000000000 -0700
--- ../../../pcsxr/gui/Gtk2Gui.c	      2010-11-05 23:21:29.982378171 -0700
***************
*** 492,498 ****
  
	destroy_main_window();
  
!	SetIsoFile(NULL);
  	LoadPlugins();
  	NetOpened = FALSE;
  
--- 492,498 ----
  
	destroy_main_window();
  
!	// No longer clear iso file here
  	LoadPlugins();
  	NetOpened = FALSE;
  
*** LnxMain.c	2010-11-05 02:05:24.000000000 -0700
--- ../../../pcsxr/gui/LnxMain.c	      2010-11-05 23:27:06.832502157 -0700
***************
*** 288,293 ****
--- 288,296 ----
    // it may be redefined by -cfg on the command line
    strcpy(cfgfile_basename, "pcsx.cfg");
  
+	/* iso file defaults to NULL */
+ 	SetIsoFile(NULL);
+ 
	// read command line options
  	for (i = 1; i < argc; i++) {
  	    if (!strcmp(argv[i], "-runcd")) runcd = RUN_CD;
***************
*** 350,356 ****
    memset(&Config, 0, sizeof(PcsxConfig));
    strcpy(Config.Net, "Disabled");
  
!	if (UseGui) gtk_init(NULL, NULL);
  
	CheckSubDir();
  	ScanAllPlugins();
--- 353,361 ----
    memset(&Config, 0, sizeof(PcsxConfig));
    strcpy(Config.Net, "Disabled");
  
!	// initialized even if -nogui specified
! 	// as pressing esc will go back to gui.
! 	gtk_init(NULL, NULL);
  
	CheckSubDir();
  	ScanAllPlugins();
***************
*** 406,413 ****
    chdir(plugin_default_dir);
    g_free(plugin_default_dir);
  
-	if (UseGui) SetIsoFile(NULL);
- 
	if (SysInit() == -1) return 1;
  
	if (UseGui) {
--- 411,416 ----

 

Dec 13, 2010 at 2:22 AM

Hi again,

The following small change will add -hidegui option (which should be used with -cdfile) so that one can start a given game nicely from the command line.

For example, from the command line: pcsx -hidegui -cdfile file.bin   will start the game in file.bin directly but it is still possible to use the gui by pressing esc.

It should not change any existing functionality so I wonder if it could be added in the current code base?

 


*** LnxMain.c	2010-12-12 17:51:09.439231935 -0800
--- LnxMain.c.orig	2010-12-12 17:27:06.696887576 -0800
***************
*** 47,53 ****
  	RUN_CD,
  };
  
! gboolean UseGui = TRUE, HideGui = FALSE;
  
  static void CreateMemcard(char *filename, char *conf_mcd) {
  	gchar *mcd;
--- 47,53 ----
  	RUN_CD,
  };
  
! gboolean UseGui = TRUE;
  
  static void CreateMemcard(char *filename, char *conf_mcd) {
  	gchar *mcd;
***************
*** 292,298 ****
  	for (i = 1; i < argc; i++) {
  		if (!strcmp(argv[i], "-runcd")) runcd = RUN_CD;
  		else if (!strcmp(argv[i], "-nogui")) UseGui = FALSE;
- 		else if (!strcmp(argv[i], "-hidegui")) HideGui = TRUE;
  		else if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
  		else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
  		else if (!strcmp(argv[i], "-cfg")) {
--- 292,297 ----
***************
*** 316,325 ****
  			}
  
  			SetIsoFile(isofilename);
! 			if(!HideGui) {
! 			  runcd = RUN_CD;
! 			  UseGui = FALSE;
! 			}
  		}
  		else if (!strcmp(argv[i], "-h") ||
  			 !strcmp(argv[i], "-help") ||
--- 315,322 ----
  			}
  
  			SetIsoFile(isofilename);
! 			runcd = RUN_CD;
!             UseGui = FALSE;
  		}
  		else if (!strcmp(argv[i], "-h") ||
  			 !strcmp(argv[i], "-help") ||
***************
*** 331,337 ****
  							"\t-runcd\t\tRuns CD-ROM\n"
  							"\t-cdfile FILE\tRuns a CD image file\n"
  							"\t-nogui\t\tDon't open the GTK GUI\n"
- 							"\t-hidegui\tHide the GUI initially\n"
  							"\t-cfg FILE\tLoads desired configuration file (default: ~/.pcsx/pcsx.cfg)\n"
  							"\t-psxout\t\tEnable PSX output\n"
  							"\t-load STATENUM\tLoads savestate STATENUM (1-9)\n"
--- 328,333 ----
***************
*** 411,421 ****
  	chdir(plugin_default_dir);
  	g_free(plugin_default_dir);
  
! 	if (UseGui && !HideGui) SetIsoFile(NULL);
  
  	if (SysInit() == -1) return 1;
  
! 	if (UseGui && !HideGui) {
  		StartGui();
  	} else {
  		// the following only occurs if the gui isn't started
--- 407,417 ----
  	chdir(plugin_default_dir);
  	g_free(plugin_default_dir);
  
! 	if (UseGui) SetIsoFile(NULL);
  
  	if (SysInit() == -1) return 1;
  
! 	if (UseGui) {
  		StartGui();
  	} else {
  		// the following only occurs if the gui isn't started
***************

Jun 1, 2011 at 8:01 PM

I'd also like a way to change isos/discs when launched without the gui.  This trick doesn't quite work for me, though, as I want to be able to exit without having to close the gui window after gameplay.  I'd like to see a key combo to bring up the load dialog which works within the game.

Jun 24, 2011 at 2:54 AM

I'm having the same problem XBMC and Windows.  It's impossible to really integrate PCSXR into anything else when there are no basic hotkeys for things like swapping disc dialog and no method to simply hide the gui instead of disabling it altogether.