diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-09-08 14:56:45 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-09-08 14:56:45 +0000 |
| commit | 1777549e90132ef18bce339efd6a000441eb6060 (patch) | |
| tree | 4fd07393a1d0f0a07f475ea1969ff3e244b8dcdb /gui | |
| parent | 52afb9f8afbb17597461a96199941c62c6e7c634 (diff) | |
| download | pcsxr-1777549e90132ef18bce339efd6a000441eb6060.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@29266 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/Gtk2Gui.c | 10 | ||||
| -rw-r--r-- | gui/LnxMain.c | 68 | ||||
| -rw-r--r-- | gui/Makefile.am | 1 | ||||
| -rw-r--r-- | gui/Makefile.in | 1 |
4 files changed, 63 insertions, 17 deletions
diff --git a/gui/Gtk2Gui.c b/gui/Gtk2Gui.c index 8f58bdf2..6de91ba9 100644 --- a/gui/Gtk2Gui.c +++ b/gui/Gtk2Gui.c @@ -1852,8 +1852,6 @@ void OnBiosPath_Changed(GtkWidget *wdg, gpointer data) { foldername = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (wdg)); strcpy(Config.BiosDir, foldername); -// printf("BIOS directory is now %s\n", foldername); - UpdatePluginsBIOS(); UpdatePluginsBIOS_UpdateGUI(data); @@ -2018,8 +2016,6 @@ void scan_bios_dir (gchar *dirname) { struct dirent *ent; gchar *filename; -// printf("Scanning bios dir %s\n", dirname); - dir = opendir(dirname); if (dir == NULL) { SysMessage(_("Could not open BIOS directory: '%s'\n"), dirname); @@ -2033,8 +2029,6 @@ void scan_bios_dir (gchar *dirname) { g_free(filename); } closedir(dir); - -// printf("Finished scanning bios dir %s\n", dirname); } void UpdatePluginsBIOS() { @@ -2115,10 +2109,10 @@ void UpdatePluginsBIOS() { } closedir(dir); + scan_bios_dir(Config.BiosDir); + /* The BIOS list always contains the PCSX internal BIOS */ add_bios_to_list(_("Internal HLE Bios"), "HLE"); - - scan_bios_dir(Config.BiosDir); } void UpdatePluginsBIOS_UpdateGUI(GladeXML *xml) { diff --git a/gui/LnxMain.c b/gui/LnxMain.c index 202f8928..9223e636 100644 --- a/gui/LnxMain.c +++ b/gui/LnxMain.c @@ -92,7 +92,7 @@ static void CheckSubDir() { CreateHomeConfigDir(CHEATS_DIR); } -void ScanPlugins(gchar* scandir) { +static void ScanPlugins(gchar* scandir) { // scan for plugins and configuration tools DIR *dir; struct dirent *ent; @@ -101,12 +101,8 @@ void ScanPlugins(gchar* scandir) { gchar *filename; /* Any plugins found will be symlinked to the following directory */ - dir = opendir(scandir); - if (dir == NULL) { -// printf(_("Could not open plugins directory: '%s'\n"), scandir); - } else { -// printf("Scanning %s for plugins\n", scandir); + if (dir != NULL) { while ((ent = readdir(dir)) != NULL) { filename = g_build_filename (scandir, ent->d_name, NULL); @@ -117,14 +113,12 @@ void ScanPlugins(gchar* scandir) { } else { /* Create a symlink from this file to the directory ~/.pcsx/plugin */ linkname = g_build_filename (getenv("HOME"), PLUGINS_DIR, ent->d_name, NULL); -// printf(" Plugin file symlink: %s -> %s\n", filename, linkname); symlink(filename, linkname); /* If it's a config tool, make one in the cfg dir as well. This allows plugins with retarded cfg finding to work :- ) */ if (match(filename, "cfg.*") == 1) { linkname = g_build_filename (getenv("HOME"), PLUGINS_CFG_DIR, ent->d_name, NULL); -// printf(" Config file symlink: %s -> %s\n", filename, linkname); symlink(filename, linkname); } g_free (linkname); @@ -135,6 +129,36 @@ void ScanPlugins(gchar* scandir) { } } +static void ScanBios(gchar* scandir) { + // scan for bioses + DIR *dir; + struct dirent *ent; + + gchar *linkname; + gchar *filename; + + /* Any bioses found will be symlinked to the following directory */ + dir = opendir(scandir); + if (dir != NULL) { + while ((ent = readdir(dir)) != NULL) { + filename = g_build_filename (scandir, ent->d_name, NULL); + + if (match(filename, ".*\\.bin$") == 0 && + match(filename, ".*\\.BIN$") == 0) { + continue; /* Skip this file */ + } else { + /* Create a symlink from this file to the directory ~/.pcsx/plugin */ + linkname = g_build_filename (getenv("HOME"), BIOS_DIR, ent->d_name, NULL); + symlink(filename, linkname); + + g_free (linkname); + } + g_free (filename); + } + closedir(dir); + } +} + static void CheckSymlinksInPath (char* dotdir) { DIR *dir; struct dirent *ent; @@ -154,7 +178,6 @@ static void CheckSymlinksInPath (char* dotdir) { if (stat(linkname, &stbuf) == -1) { /* File link is bad, remove it */ -// printf("unlink: %s\n", linkname); unlink(linkname); } g_free (linkname); @@ -183,6 +206,28 @@ static void ScanAllPlugins (void) { ScanPlugins(DEF_PLUGIN_DIR "/lib64"); ScanPlugins(DEF_PLUGIN_DIR "/config"); + // scan some default locations to find bioses + ScanBios("/usr/lib/games/psemu"); + ScanBios("/usr/lib/games/psemu/bios"); + ScanBios("/usr/lib64/games/psemu"); + ScanBios("/usr/lib64/games/psemu/bios"); + ScanBios("/usr/share/psemu"); + ScanBios("/usr/share/psemu/bios"); + ScanBios("/usr/share/pcsx"); + ScanBios("/usr/share/pcsx/bios"); + ScanBios("/usr/local/lib/games/psemu"); + ScanBios("/usr/local/lib/games/psemu/bios"); + ScanBios("/usr/local/lib64/games/psemu"); + ScanBios("/usr/local/lib64/games/psemu/bios"); + ScanBios("/usr/local/share/psemu"); + ScanBios("/usr/local/share/psemu/bios"); + ScanBios("/usr/local/share/pcsx"); + ScanBios("/usr/local/share/pcsx/bios"); + ScanBios(PACKAGE_DATA_DIR); + ScanBios(PSEMU_DATA_DIR); + ScanBios(PACKAGE_DATA_DIR "/bios"); + ScanBios(PSEMU_DATA_DIR "/bios"); + currentdir = g_strconcat (getenv("HOME"), "/.psemu-plugins/", NULL); ScanPlugins(currentdir); g_free (currentdir); @@ -200,6 +245,11 @@ static void ScanAllPlugins (void) { currentdir = g_build_filename (getenv("HOME"), PLUGINS_CFG_DIR, NULL); CheckSymlinksInPath (currentdir); g_free (currentdir); + + /* Check for bad links in ~/.pcsx/bios */ + currentdir = g_build_filename (getenv("HOME"), BIOS_DIR, NULL); + CheckSymlinksInPath (currentdir); + g_free (currentdir); } /* Set the default plugin name */ diff --git a/gui/Makefile.am b/gui/Makefile.am index b9744092..ee62fa66 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -3,6 +3,7 @@ INCLUDES = -DPACKAGE_DATA_DIR=\"${datadir}/pcsx/\" \ -DLOCALE_DIR=\"${datadir}/locale/\" \ $(GTK2_CFLAGS) $(GLADE2_CFLAGS) \ -I$(top_srcdir)/libpcsxcore -I$(top_srcdir)/include \ + -DPSEMU_DATA_DIR=\"${datadir}/psemu\" \ -DDEF_PLUGIN_DIR=\"${libdir}/games/psemu\" bin_PROGRAMS = pcsx diff --git a/gui/Makefile.in b/gui/Makefile.in index db10da70..6a61653e 100644 --- a/gui/Makefile.in +++ b/gui/Makefile.in @@ -220,6 +220,7 @@ INCLUDES = -DPACKAGE_DATA_DIR=\"${datadir}/pcsx/\" \ -DLOCALE_DIR=\"${datadir}/locale/\" \ $(GTK2_CFLAGS) $(GLADE2_CFLAGS) \ -I$(top_srcdir)/libpcsxcore -I$(top_srcdir)/include \ + -DPSEMU_DATA_DIR=\"${datadir}/psemu\" \ -DDEF_PLUGIN_DIR=\"${libdir}/games/psemu\" pcsx_SOURCES = \ |
