Updated Linux/UNIX port to use XDG_CONFIG_HOME for storing settings

file.  For most people, that means the files are now stored in
'~/.config/stella' instead of '~/.stella'.  Manually moving the directory
will be necessary if you wish to keep the old settings.
This commit is contained in:
Stephen Anthony 2017-01-28 19:14:11 -03:30
parent 94e77d3b94
commit d99f83580f
3 changed files with 54 additions and 34 deletions

View File

@ -14,6 +14,17 @@
4.7.3 to 5.0: (xxx. xx, 2017) 4.7.3 to 5.0: (xxx. xx, 2017)
* For the Linux/UNIX port:
- The settings directory now uses the XDG Base Directory Specification.
In most cases, this means that your files will now be stored in
'~/.config/stella' instead of '~/.stella'. To keep your old settings,
run the following commands from the terminal:
cd ~
mv .stella .config/stella
You will probably need to edit '~/.config/stella/stellarc' and change
some paths accordingly.
* For the OSX port: * For the OSX port:
- Always use the built-in zlib library instead of the system version. - Always use the built-in zlib library instead of the system version.
@ -23,6 +34,7 @@
cd ~/Library/Preferences cd ~/Library/Preferences
mv net.sourceforge.Stella.plist Stella-emu.plist mv net.sourceforge.Stella.plist Stella-emu.plist
* Updated included PNG and ZLIB libraries to latest stable version.
-Have fun! -Have fun!
@ -392,7 +404,7 @@
* Added bankswitch schemes BF, BFSC, DF, DFSC and 4KSC, thanks to * Added bankswitch schemes BF, BFSC, DF, DFSC and 4KSC, thanks to
RevEng and CPUWIZ of AtariAge. RevEng and CPUWIZ of AtariAge.
* Updated ROM properties for several ROMs, thanks to Omegamatrix of * Updated ROM properties for several ROMs, thanks to Omegamatrix of
AtariAge. AtariAge.
@ -958,7 +970,7 @@
be activated by setting this argument to 'auto'. Related to this, be activated by setting this argument to 'auto'. Related to this,
removed redundant 'usemouse' argument. removed redundant 'usemouse' argument.
* Huge restructuring of the OpenGL code, making it compatible with * Huge restructuring of the OpenGL code, making it compatible with
OpenGL 2.x+ features (such as vertex buffer objects), while at the OpenGL 2.x+ features (such as vertex buffer objects), while at the
same time keeping compatibility with OpenGL 1.5 / OpenGL ES. same time keeping compatibility with OpenGL 1.5 / OpenGL ES.
Because of the required changes, TV effects were removed (they will Because of the required changes, TV effects were removed (they will
@ -2338,7 +2350,7 @@
environment variable 'STELLA_BASEDIR'. This must be done each time before environment variable 'STELLA_BASEDIR'. This must be done each time before
Stella starts. Stella starts.
* Added '-fastscbios' commandline argument, which speeds up loading of * Added '-fastscbios' commandline argument, which speeds up loading of
vertical bars in Supercharger ROMs, and made it the default. vertical bars in Supercharger ROMs, and made it the default.
* Added '-autoslot' commandline argument, which automatically switches * Added '-autoslot' commandline argument, which automatically switches
@ -2650,22 +2662,22 @@
* Updated the sound system. All popping and cracking sounds that previously * Updated the sound system. All popping and cracking sounds that previously
occurred at program start/stop and when entering/exiting menu or pause occurred at program start/stop and when entering/exiting menu or pause
mode have been eliminated. mode have been eliminated.
* Fixed the gl_fsmax argument to mean "switch to desktop resolution on * Fixed the gl_fsmax argument to mean "switch to desktop resolution on
fullscreen OpenGL", instead of to the maximum possible resolution (the two fullscreen OpenGL", instead of to the maximum possible resolution (the two
are not always the same). are not always the same).
* Added Alt [ and Alt ] keys to dynamically adjust the sound volume during * Added Alt [ and Alt ] keys to dynamically adjust the sound volume during
emulation. emulation.
* Added Control 0, Control 1, Control 2, Control 3 keys to dynamically change * Added Control 0, Control 1, Control 2, Control 3 keys to dynamically change
which paddle the mouse should emulate. which paddle the mouse should emulate.
* Added video_driver argument. This accepts the different options that can be * Added video_driver argument. This accepts the different options that can be
specified for SDL_VIDEODRIVER (see SDL homepage for more information). specified for SDL_VIDEODRIVER (see SDL homepage for more information).
Basically, it eliminates the need to set the SDL_VIDEODRIVER environment Basically, it eliminates the need to set the SDL_VIDEODRIVER environment
variable. variable.
* Made sure screen is refreshed before taking a snapshot. This eliminates * Made sure screen is refreshed before taking a snapshot. This eliminates
the problem with new snapshots containing the text "Snapshot saved". the problem with new snapshots containing the text "Snapshot saved".
@ -2702,7 +2714,7 @@
* For the OSX port; added preference to allow user to select the directory * For the OSX port; added preference to allow user to select the directory
in which ROM images are stored. This sets the default directory to start in which ROM images are stored. This sets the default directory to start
the browsing for a ROM in, and doesn't preclude the user from selecting a the browsing for a ROM in, and doesn't preclude the user from selecting a
file outside that directory. file outside that directory.
* For the OSX port; fixed preferences bug where Preferences changed before * For the OSX port; fixed preferences bug where Preferences changed before
@ -2818,7 +2830,7 @@
* Added 3F bankswitching auto-detection routine so that homebrews and * Added 3F bankswitching auto-detection routine so that homebrews and
demos work without a stella.pro entry demos work without a stella.pro entry
* Updated the TIA message boxes so they look a little nicer * Updated the TIA message boxes so they look a little nicer
* Latest stella.pro file included in distribution * Latest stella.pro file included in distribution
@ -2829,7 +2841,7 @@
stella.pro file; X11 and SDL versions supported for now (compile option) stella.pro file; X11 and SDL versions supported for now (compile option)
* External sound server for the X11 and SDL versions no longer required, as * External sound server for the X11 and SDL versions no longer required, as
all sound code is now integrated into the core all sound code is now integrated into the core
* Changed locations of the user's config files for the X11 and SDL versions; * Changed locations of the user's config files for the X11 and SDL versions;
the user's stellarc file is now located in $HOME/.stella/stellarc, state the user's stellarc file is now located in $HOME/.stella/stellarc, state
@ -2850,7 +2862,7 @@
* Added the developer command line options to the X11 and SDL versions, * Added the developer command line options to the X11 and SDL versions,
which are only activated in developer builds: -Dformat, -Dwidth, which are only activated in developer builds: -Dformat, -Dwidth,
-Dheight, -Dxstart, -Dystart, -Dmerge -Dheight, -Dxstart, -Dystart, -Dmerge
* Fixed window resize bug in the X11 port * Fixed window resize bug in the X11 port
@ -2868,15 +2880,15 @@
* DOS port is using a new Sound Blaster driver created by Matt Conte which * DOS port is using a new Sound Blaster driver created by Matt Conte which
supports auto-detection of sound cards. supports auto-detection of sound cards.
* DOS port supports a STELLA_HOME environment variable that defines * DOS port supports a STELLA_HOME environment variable that defines
the location of config files. the location of config files.
* In the DOS port the stella.pro file is searched for first in the * In the DOS port the stella.pro file is searched for first in the
current working director and then in the $STELLA_HOME directory current working director and then in the $STELLA_HOME directory
* In the DOS port the ROM image is searched for first using the * In the DOS port the ROM image is searched for first using the
specified path, then in $STELLA_HOME/ROMS, and finally in $STELLA_HOME specified path, then in $STELLA_HOME/ROMS, and finally in $STELLA_HOME
Cyberstella 1.2.1 (May 16, 2002) Cyberstella 1.2.1 (May 16, 2002)
@ -2929,26 +2941,26 @@ DOS 1.2 to DOS 1.2.1: (April 28, 2002)
* Basic message support added to the TIA emulation. This allows a short * Basic message support added to the TIA emulation. This allows a short
message to overlay the TIA frame. Currently, it's used when switching message to overlay the TIA frame. Currently, it's used when switching
color modes and difficulty settings. color modes and difficulty settings.
* The internal data structure for the stella.pro file was changed from * The internal data structure for the stella.pro file was changed from
a resizable array to a binary search tree. This results in quicker a resizable array to a binary search tree. This results in quicker
startup times. startup times.
* An SDL port of Stella is available (requires SDL 1.2.0 or greater) * An SDL port of Stella is available (requires SDL 1.2.0 or greater)
* Added option to not load in the whole stella.pro file when starting * Added option to not load in the whole stella.pro file when starting
Stella. This option is enabled on the X11, SDL, and DOS versions. Win32 Stella. This option is enabled on the X11, SDL, and DOS versions. Win32
version is left alone since it's needed for loading multiple games from version is left alone since it's needed for loading multiple games from
the UI. Saves on memory usage. the UI. Saves on memory usage.
* Added INI file option to the X11 and SDL versions. Options can be * Added INI file option to the X11 and SDL versions. Options can be
specified in this file instead of entering them on the commandline. Any specified in this file instead of entering them on the commandline. Any
options entered on the commandline override options in the INI file. options entered on the commandline override options in the INI file.
File is called stellarc. For the X11 and SDL versions, it can be in File is called stellarc. For the X11 and SDL versions, it can be in
either $HOME (as $HOME/.stellarc) or in /etc (as /etc/stellarc). The either $HOME (as $HOME/.stellarc) or in /etc (as /etc/stellarc). The
one in $HOME has higher priority than the one in /etc. one in $HOME has higher priority than the one in /etc.
* Added snapshot support to the X11 and SDL versions. Pressing F12 saves * Added snapshot support to the X11 and SDL versions. Pressing F12 saves
the current screen in PNG format. Requires PNG library. the current screen in PNG format. Requires PNG library.
* Removed stella.pro file from the binary, resulting in large space * Removed stella.pro file from the binary, resulting in large space
@ -2964,7 +2976,7 @@ DOS 1.2 to DOS 1.2.1: (April 28, 2002)
1.0 to 1.1: (February 26, 1999) 1.0 to 1.1: (February 26, 1999)
* DOS and Linux versions support real Atari 2600 paddles using a * DOS and Linux versions support real Atari 2600 paddles using a
special PC game port adaptor special PC game port adaptor
* Linux version uses the new 1.2.x joystick driver API * Linux version uses the new 1.2.x joystick driver API
@ -2981,7 +2993,7 @@ DOS 1.2 to DOS 1.2.1: (April 28, 2002)
- All Supercharger games load and execute at this point - All Supercharger games load and execute at this point
* Added a small hack to the TIA code to fix a display problem in "Escape * Added a small hack to the TIA code to fix a display problem in "Escape
from the Mindmaster" from the Mindmaster"
* Improved TIA emulation to support the RESPx multi-sprite trick * Improved TIA emulation to support the RESPx multi-sprite trick
@ -2991,11 +3003,11 @@ DOS 1.2 to DOS 1.2.1: (April 28, 2002)
* DOS version supports 320x200 and 320x240 graphics modes * DOS version supports 320x200 and 320x240 graphics modes
* Several portability issues have been resolved * Several portability issues have been resolved
* Preliminary support for Chris Wilkson's Megacart bank-switching scheme * Preliminary support for Chris Wilkson's Megacart bank-switching scheme
* BSDI target included in makefile * BSDI target included in makefile
* Improved Users Manual in several "popular" formats * Improved Users Manual in several "popular" formats
@ -3060,7 +3072,7 @@ DOS 1.2 to DOS 1.2.1: (April 28, 2002)
* Changed TIA peeking so lower nibble of byte read is the same * Changed TIA peeking so lower nibble of byte read is the same
as the TIA address being accessed (Warlords now works) as the TIA address being accessed (Warlords now works)
0.5 to 0.6: (January 18, 1997) 0.5 to 0.6: (January 18, 1997)

View File

@ -2963,7 +2963,7 @@
<p><table cellpadding="5" border="1"> <p><table cellpadding="5" border="1">
<tr> <tr>
<td><b>Linux/Unix</b></td> <td><b>Linux/Unix</b></td>
<td><i>$HOME/.stella/stellarc</i></td> <td><i>$HOME/.config/stella/stellarc</i></td>
</tr> </tr>
<tr> <tr>
<td><b>Macintosh</b></td> <td><b>Macintosh</b></td>
@ -3062,7 +3062,7 @@ Ms Pac-Man (Stella extended codes):
<p><table cellpadding="5" border="1"> <p><table cellpadding="5" border="1">
<tr> <tr>
<td><b>Linux/Unix</b></td> <td><b>Linux/Unix</b></td>
<td><i>$HOME/.stella/stella.cht</i></td> <td><i>$HOME/.config/stella/stella.cht</i></td>
</tr> </tr>
<tr> <tr>
<td><b>Macintosh</b></td> <td><b>Macintosh</b></td>
@ -3396,7 +3396,7 @@ Ms Pac-Man (Stella extended codes):
<p><table cellpadding="5" border="1"> <p><table cellpadding="5" border="1">
<tr> <tr>
<td><b>Linux/Unix</b></td> <td><b>Linux/Unix</b></td>
<td><i>$HOME/.stella/stella.pro</i></td> <td><i>$HOME/.config/stella/stella.pro</i></td>
</tr> </tr>
<tr> <tr>
<td><b>Macintosh</b></td> <td><b>Macintosh</b></td>
@ -3461,7 +3461,7 @@ Ms Pac-Man (Stella extended codes):
<p><table cellpadding="5" border="1"> <p><table cellpadding="5" border="1">
<tr> <tr>
<td><b>Linux/Unix</b></td> <td><b>Linux/Unix</b></td>
<td><i>$HOME/.stella/stella.pal</i></td> <td><i>$HOME/.config/stella/stella.pal</i></td>
</tr> </tr>
<tr> <tr>
<td><b>Macintosh</b></td> <td><b>Macintosh</b></td>

View File

@ -15,6 +15,8 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================ //============================================================================
#include <cstdlib>
#include "OSystemUNIX.hxx" #include "OSystemUNIX.hxx"
/** /**
@ -31,6 +33,12 @@
OSystemUNIX::OSystemUNIX() OSystemUNIX::OSystemUNIX()
: OSystem() : OSystem()
{ {
setBaseDir("~/.stella"); // Use XDG_CONFIG_HOME if defined, otherwise use the default
setConfigFile("~/.stella/stellarc"); const char* configDir = getenv("XDG_CONFIG_HOME");
if(configDir == NULL) configDir = "~/.config";
string stellaDir = string(configDir) + "/stella";
setBaseDir(stellaDir);
setConfigFile(stellaDir + "/stellarc");
} }