mirror of https://github.com/stella-emu/stella.git
The default snapshot dir is much saner, defaulting to the users'
desktop on OSX and Windows, and the home directory in Linux. The associated commandline has been changed to 'snapdir'. Added 'GL VBO' toggle button to the Video Settings UI, and in general cleaned up its interface. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2282 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
8e868823d9
commit
e8776a79d6
|
@ -41,6 +41,10 @@
|
|||
error and continue. This should normally always be enabled, but
|
||||
can be disabled by developers for testing reasons.
|
||||
|
||||
* Updated default snapshot directory to be much saner and easier to
|
||||
find. For most systems, it now defaults to the users 'Desktop.
|
||||
Note that the commandline argument has changed to 'snapdir'.
|
||||
|
||||
* The debugger 'print' command now indicates "special" addresses if they
|
||||
are read-only (R), write-only (W) or read-write (R/W).
|
||||
|
||||
|
|
|
@ -1850,7 +1850,7 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-ssdir <path></pre></td>
|
||||
<td><pre>-snapdir <path></pre></td>
|
||||
<td>The directory to save snapshot files to.</td>
|
||||
</tr>
|
||||
|
||||
|
@ -2290,7 +2290,7 @@
|
|||
<tr><td>Cheat file</td><td>specifies location of cheatfile database</td><td>-cheatfile</td></tr>
|
||||
<tr><td>Palette file</td><td>specifies location of user palette</td><td>-palettefile</td></tr>
|
||||
<tr><td>Properties file </td><td>specifies location of external stella.pro database</td><td>-propsfile</td></tr>
|
||||
<tr><td>Snapshot path</td><td>specifies where to load/save snapshots</td><td>-ssdir</td></tr>
|
||||
<tr><td>Snapshot path</td><td>specifies where to load/save snapshots</td><td>-snapdir</td></tr>
|
||||
<tr><td>EEPROM path</td><td>specifies location of EEPROM files</td><td>-eepromdir</td></tr>
|
||||
<tr><td>Overwrite snapshots</td><td>whether to overwrite old snapshots</td><td>-sssingle</td></tr>
|
||||
<tr><td>Snapshot in 1x mode</td><td>save snapshot in 1x mode, without filtering</td><td>-ss1x</td></tr>
|
||||
|
|
|
@ -316,13 +316,10 @@ void OSystem::setConfigPaths()
|
|||
FilesystemNode node;
|
||||
string s;
|
||||
|
||||
validatePath("statedir", "state", myStateDir);
|
||||
|
||||
validatePath("ssdir", "snapshots", mySnapshotDir);
|
||||
|
||||
validatePath("eepromdir", "", myEEPROMDir);
|
||||
|
||||
validatePath("cfgdir", "cfg", myCfgDir);
|
||||
validatePath(myStateDir, "statedir", myBaseDir + "statedir");
|
||||
validatePath(mySnapshotDir, "snapdir", defaultSnapDir());
|
||||
validatePath(myEEPROMDir, "eepromdir", myBaseDir);
|
||||
validatePath(myCfgDir, "cfgdir", myBaseDir + "cfg");
|
||||
|
||||
s = mySettings->getString("cheatfile");
|
||||
if(s == "") s = myBaseDir + "stella.cht";
|
||||
|
@ -872,18 +869,18 @@ void OSystem::resetLoopTiming()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::validatePath(const string& setting, const string& partialpath,
|
||||
string& fullpath)
|
||||
void OSystem::validatePath(string& path, const string& setting,
|
||||
const string& defaultpath)
|
||||
{
|
||||
const string& s = mySettings->getString(setting) != "" ?
|
||||
mySettings->getString(setting) : myBaseDir + partialpath;
|
||||
const string& s = mySettings->getString(setting) == "" ? defaultpath :
|
||||
mySettings->getString(setting);
|
||||
FilesystemNode node(s);
|
||||
if(!node.isDirectory())
|
||||
{
|
||||
AbstractFilesystemNode::makeDir(s);
|
||||
node = FilesystemNode(node.getPath());
|
||||
}
|
||||
fullpath = node.getPath();
|
||||
path = node.getPath();
|
||||
mySettings->setString(setting, node.getPath(false));
|
||||
}
|
||||
|
||||
|
|
|
@ -462,6 +462,15 @@ class OSystem
|
|||
*/
|
||||
virtual void stateChanged(EventHandler::State state);
|
||||
|
||||
/**
|
||||
Returns the default path for the snapshot directory.
|
||||
Since this varies greatly among different systems and is the one
|
||||
directory that most end-users care about (vs. config file stuff
|
||||
that usually isn't user-modifiable), we create a special method
|
||||
for it.
|
||||
*/
|
||||
virtual string defaultSnapDir() { return "~"; }
|
||||
|
||||
/**
|
||||
Set the position of the application window, generally using
|
||||
platform-specific code. Note that this method is only ever
|
||||
|
@ -660,9 +669,13 @@ class OSystem
|
|||
Validate the directory name, and create it if necessary.
|
||||
Also, update the settings with the new name. For now, validation
|
||||
means that the path must always end with the appropriate separator.
|
||||
|
||||
@param path The actual path being accessed and created
|
||||
@param setting The setting corresponding to the path being considered
|
||||
@param defaultpath The default path to use if the settings don't exist
|
||||
*/
|
||||
void validatePath(const string& setting, const string& partialpath,
|
||||
string& fullpath);
|
||||
void validatePath(string& path, const string& setting,
|
||||
const string& defaultpath);
|
||||
|
||||
// Copy constructor isn't supported by this class so make it private
|
||||
OSystem(const OSystem&);
|
||||
|
|
|
@ -92,7 +92,7 @@ Settings::Settings(OSystem* osystem)
|
|||
setInternal("ctrlcombo", "true");
|
||||
|
||||
// Snapshot options
|
||||
setInternal("ssdir", "");
|
||||
setInternal("snapdir", "");
|
||||
setInternal("sssingle", "false");
|
||||
setInternal("ss1x", "false");
|
||||
setInternal("ssinterval", "2");
|
||||
|
@ -411,7 +411,7 @@ void Settings::usage()
|
|||
<< " -stats <1|0> Overlay console info during emulation\n"
|
||||
<< " -audiofirst <1|0> Initial audio before video (required for some ATI video cards)\n"
|
||||
<< " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\n"
|
||||
<< " -ssdir <path> The directory to save snapshot files to\n"
|
||||
<< " -snapdir <path> The directory to save snapshot files to\n"
|
||||
<< " -sssingle <1|0> Generate single snapshot instead of many\n"
|
||||
<< " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore scaling/effects)\n"
|
||||
<< " -ssinterval <number Number of seconds between snapshots in continuous snapshot mode\n"
|
||||
|
|
|
@ -66,15 +66,15 @@ FileSnapDialog::FileSnapDialog(
|
|||
_w - xpos - 10, lineHeight, "");
|
||||
wid.push_back(myRomPath);
|
||||
|
||||
// State directory
|
||||
// Snapshot path
|
||||
xpos = vBorder; ypos += romButton->getHeight() + 3;
|
||||
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
"State path:", kChooseStateDirCmd);
|
||||
"Snapshot path:", kChooseSnapDirCmd);
|
||||
wid.push_back(b);
|
||||
xpos += buttonWidth + 10;
|
||||
myStatePath = new EditTextWidget(this, font, xpos, ypos + 2,
|
||||
_w - xpos - 10, lineHeight, "");
|
||||
wid.push_back(myStatePath);
|
||||
mySnapPath = new EditTextWidget(this, font, xpos, ypos + 2,
|
||||
_w - xpos - 10, lineHeight, "");
|
||||
wid.push_back(mySnapPath);
|
||||
|
||||
// Cheat file
|
||||
xpos = vBorder; ypos += b->getHeight() + 3;
|
||||
|
@ -106,15 +106,15 @@ FileSnapDialog::FileSnapDialog(
|
|||
_w - xpos - 10, lineHeight, "");
|
||||
wid.push_back(myPropsFile);
|
||||
|
||||
// Snapshot path
|
||||
// State directory
|
||||
xpos = vBorder; ypos += b->getHeight() + 3;
|
||||
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
"Snapshot path:", kChooseSnapDirCmd);
|
||||
"State path:", kChooseStateDirCmd);
|
||||
wid.push_back(b);
|
||||
xpos += buttonWidth + 10;
|
||||
mySnapPath = new EditTextWidget(this, font, xpos, ypos + 2,
|
||||
_w - xpos - 10, lineHeight, "");
|
||||
wid.push_back(mySnapPath);
|
||||
myStatePath = new EditTextWidget(this, font, xpos, ypos + 2,
|
||||
_w - xpos - 10, lineHeight, "");
|
||||
wid.push_back(myStatePath);
|
||||
|
||||
// EEPROM directory
|
||||
xpos = vBorder; ypos += b->getHeight() + 3;
|
||||
|
@ -188,12 +188,12 @@ void FileSnapDialog::loadConfig()
|
|||
{
|
||||
const Settings& settings = instance().settings();
|
||||
myRomPath->setEditString(settings.getString("romdir"));
|
||||
myStatePath->setEditString(settings.getString("statedir"));
|
||||
mySnapPath->setEditString(settings.getString("snapdir"));
|
||||
myCheatFile->setEditString(settings.getString("cheatfile"));
|
||||
myPaletteFile->setEditString(settings.getString("palettefile"));
|
||||
myPropsFile->setEditString(settings.getString("propsfile"));
|
||||
mySnapPath->setEditString(settings.getString("ssdir"));
|
||||
myEEPROMPath->setEditString(settings.getString("eepromdir"));
|
||||
myStatePath->setEditString(settings.getString("statedir"));
|
||||
mySnapSingle->setState(settings.getBool("sssingle"));
|
||||
mySnap1x->setState(settings.getBool("ss1x"));
|
||||
mySnapInterval->setSelected(instance().settings().getString("ssinterval"), "2");
|
||||
|
@ -203,11 +203,11 @@ void FileSnapDialog::loadConfig()
|
|||
void FileSnapDialog::saveConfig()
|
||||
{
|
||||
instance().settings().setString("romdir", myRomPath->getEditString());
|
||||
instance().settings().setString("statedir", myStatePath->getEditString());
|
||||
instance().settings().setString("snapdir", mySnapPath->getEditString());
|
||||
instance().settings().setString("cheatfile", myCheatFile->getEditString());
|
||||
instance().settings().setString("palettefile", myPaletteFile->getEditString());
|
||||
instance().settings().setString("propsfile", myPropsFile->getEditString());
|
||||
instance().settings().setString("ssdir", mySnapPath->getEditString());
|
||||
instance().settings().setString("statedir", myStatePath->getEditString());
|
||||
instance().settings().setString("eepromdir", myEEPROMPath->getEditString());
|
||||
instance().settings().setBool("sssingle", mySnapSingle->getState());
|
||||
instance().settings().setBool("ss1x", mySnap1x->getState());
|
||||
|
@ -227,10 +227,8 @@ void FileSnapDialog::setDefaults()
|
|||
node = FilesystemNode("~");
|
||||
myRomPath->setEditString(node.getPath(false));
|
||||
|
||||
const string& statedir = basedir + "state";
|
||||
node = FilesystemNode(statedir);
|
||||
myStatePath->setEditString(node.getPath(false));
|
||||
|
||||
mySnapPath->setEditString(instance().defaultSnapDir());
|
||||
|
||||
const string& cheatfile = basedir + "stella.cht";
|
||||
node = FilesystemNode(cheatfile);
|
||||
myCheatFile->setEditString(node.getPath(false));
|
||||
|
@ -247,9 +245,9 @@ void FileSnapDialog::setDefaults()
|
|||
node = FilesystemNode(eepromdir);
|
||||
myEEPROMPath->setEditString(node.getPath(false));
|
||||
|
||||
const string& ssdir = basedir + "snapshots";
|
||||
node = FilesystemNode(ssdir);
|
||||
mySnapPath->setEditString(node.getPath(false));
|
||||
const string& statedir = basedir + "state";
|
||||
node = FilesystemNode(statedir);
|
||||
myStatePath->setEditString(node.getPath(false));
|
||||
|
||||
mySnapSingle->setState(false);
|
||||
mySnap1x->setState(false);
|
||||
|
@ -278,9 +276,9 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
FilesystemNode::kListDirectoriesOnly, kRomDirChosenCmd);
|
||||
break;
|
||||
|
||||
case kChooseStateDirCmd:
|
||||
myBrowser->show("Select state directory:", myStatePath->getEditString(),
|
||||
FilesystemNode::kListDirectoriesOnly, kStateDirChosenCmd);
|
||||
case kChooseSnapDirCmd:
|
||||
myBrowser->show("Select snapshot directory:", mySnapPath->getEditString(),
|
||||
FilesystemNode::kListDirectoriesOnly, kSnapDirChosenCmd);
|
||||
break;
|
||||
|
||||
case kChooseCheatFileCmd:
|
||||
|
@ -298,16 +296,16 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
FilesystemNode::kListAll, kPropsFileChosenCmd);
|
||||
break;
|
||||
|
||||
case kChooseSnapDirCmd:
|
||||
myBrowser->show("Select snapshot directory:", mySnapPath->getEditString(),
|
||||
FilesystemNode::kListDirectoriesOnly, kSnapDirChosenCmd);
|
||||
break;
|
||||
|
||||
case kChooseEEPROMDirCmd:
|
||||
myBrowser->show("Select EEPROM directory:", myEEPROMPath->getEditString(),
|
||||
FilesystemNode::kListDirectoriesOnly, kEEPROMDirChosenCmd);
|
||||
break;
|
||||
|
||||
case kChooseStateDirCmd:
|
||||
myBrowser->show("Select state directory:", myStatePath->getEditString(),
|
||||
FilesystemNode::kListDirectoriesOnly, kStateDirChosenCmd);
|
||||
break;
|
||||
|
||||
case kRomDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
|
@ -315,10 +313,10 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
}
|
||||
|
||||
case kStateDirChosenCmd:
|
||||
case kSnapDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
myStatePath->setEditString(dir.getPath(false));
|
||||
mySnapPath->setEditString(dir.getPath(false));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -343,13 +341,6 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
}
|
||||
|
||||
case kSnapDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
mySnapPath->setEditString(dir.getPath(false));
|
||||
break;
|
||||
}
|
||||
|
||||
case kEEPROMDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
|
@ -357,6 +348,13 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
}
|
||||
|
||||
case kStateDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
myStatePath->setEditString(dir.getPath(false));
|
||||
break;
|
||||
}
|
||||
|
||||
case kReloadRomDirCmd:
|
||||
sendCommand(kReloadRomDirCmd, 0, 0);
|
||||
break;
|
||||
|
|
|
@ -113,7 +113,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
items.push_back(instance().supportedResolutions()[i].name,
|
||||
instance().supportedResolutions()[i].name);
|
||||
myFSResPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
|
||||
lineHeight, items, "FS Res: ", lwidth);
|
||||
lineHeight, items, "Fullscrn Res: ", lwidth);
|
||||
wid.push_back(myFSResPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
|
@ -195,24 +195,39 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
wid.push_back(myFullscreenPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// PAL color-loss effect
|
||||
myColorLossCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"PAL color-loss");
|
||||
wid.push_back(myColorLossCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// GL FS stretch
|
||||
myGLStretchCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"GL FS Stretch");
|
||||
wid.push_back(myGLStretchCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Use VBO in OpenGL
|
||||
myUseVBOCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"GL VBO");
|
||||
wid.push_back(myUseVBOCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Use sync to vblank in OpenGL
|
||||
myUseVSyncCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"GL VSync");
|
||||
wid.push_back(myUseVSyncCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
ypos += lineHeight;
|
||||
|
||||
// PAL color-loss effect
|
||||
myColorLossCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"PAL color-loss");
|
||||
wid.push_back(myColorLossCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Skip progress load bars for SuperCharger ROMs
|
||||
// Doesn't really belong here, but I couldn't find a better place for it
|
||||
myFastSCBiosCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Fast SC/AR BIOS");
|
||||
wid.push_back(myFastSCBiosCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Show UI messages onscreen
|
||||
myUIMessagesCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Show UI messages");
|
||||
|
@ -225,16 +240,10 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
wid.push_back(myCenterCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Skip progress load bars for SuperCharger ROMs
|
||||
// Doesn't really belong here, but I couldn't find a better place for it
|
||||
myFastSCBiosCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Fast SC/AR BIOS");
|
||||
wid.push_back(myFastSCBiosCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Add items for tab 0
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
#if 0
|
||||
//////////////////////////////////////////////////////////
|
||||
// 2) TV effects options
|
||||
wid.clear();
|
||||
|
@ -244,6 +253,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
|
||||
// Add items for tab 2
|
||||
addToFocusList(wid, tabID);
|
||||
#endif
|
||||
|
||||
// Activate the first tab
|
||||
myTab->setActiveTab(0);
|
||||
|
@ -265,6 +275,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
myPAspectRatioSlider->clearFlags(WIDGET_ENABLED);
|
||||
myPAspectRatioLabel->clearFlags(WIDGET_ENABLED);
|
||||
myGLStretchCheckbox->clearFlags(WIDGET_ENABLED);
|
||||
myUseVBOCheckbox->clearFlags(WIDGET_ENABLED);
|
||||
myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED);
|
||||
#endif
|
||||
#ifndef WINDOWED_SUPPORT
|
||||
|
@ -345,6 +356,10 @@ void VideoDialog::loadConfig()
|
|||
myGLStretchCheckbox->setState(instance().settings().getBool("gl_fsmax"));
|
||||
myGLStretchCheckbox->setEnabled(gl);
|
||||
|
||||
// Use VBO (GL mode only)
|
||||
myUseVBOCheckbox->setState(instance().settings().getBool("gl_vbo"));
|
||||
myUseVBOCheckbox->setEnabled(gl);
|
||||
|
||||
// Use sync to vertical blank (GL mode only)
|
||||
myUseVSyncCheckbox->setState(instance().settings().getBool("gl_vsync"));
|
||||
myUseVSyncCheckbox->setEnabled(gl);
|
||||
|
@ -405,6 +420,9 @@ void VideoDialog::saveConfig()
|
|||
// GL stretch setting
|
||||
instance().settings().setBool("gl_fsmax", myGLStretchCheckbox->getState());
|
||||
|
||||
// Use VBO (GL mode only)
|
||||
instance().settings().setBool("gl_vbo", myUseVBOCheckbox->getState());
|
||||
|
||||
// Use sync to vertical blank (GL mode only)
|
||||
instance().settings().setBool("gl_vsync", myUseVSyncCheckbox->getState());
|
||||
|
||||
|
@ -441,6 +459,7 @@ void VideoDialog::setDefaults()
|
|||
myFullscreenPopup->setSelected("0", "");
|
||||
myColorLossCheckbox->setState(false);
|
||||
myGLStretchCheckbox->setState(false);
|
||||
myUseVBOCheckbox->setState(true);
|
||||
myUseVSyncCheckbox->setState(true);
|
||||
myUIMessagesCheckbox->setState(true);
|
||||
myCenterCheckbox->setState(false);
|
||||
|
|
|
@ -72,6 +72,7 @@ class VideoDialog : public Dialog
|
|||
PopUpWidget* myFullscreenPopup;
|
||||
CheckboxWidget* myColorLossCheckbox;
|
||||
CheckboxWidget* myGLStretchCheckbox;
|
||||
CheckboxWidget* myUseVBOCheckbox;
|
||||
CheckboxWidget* myUseVSyncCheckbox;
|
||||
CheckboxWidget* myUIMessagesCheckbox;
|
||||
CheckboxWidget* myCenterCheckbox;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#include "FSNode.hxx"
|
||||
#include "OSystemMACOSX.hxx"
|
||||
|
||||
/**
|
||||
|
@ -43,3 +44,10 @@ OSystemMACOSX::OSystemMACOSX()
|
|||
OSystemMACOSX::~OSystemMACOSX()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string OSystemMACOSX::defaultSnapDir()
|
||||
{
|
||||
FilesystemNode desktop("~/Desktop");
|
||||
return desktop.isDirectory() ? desktop.getPath(false) : "~";
|
||||
}
|
||||
|
|
|
@ -40,6 +40,11 @@ class OSystemMACOSX : public OSystem
|
|||
Destructor
|
||||
*/
|
||||
virtual ~OSystemMACOSX();
|
||||
|
||||
/**
|
||||
Returns the default path for the snapshot directory.
|
||||
*/
|
||||
string defaultSnapDir();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <shlobj.h>
|
||||
|
||||
/*
|
||||
* Used to determine the location of the 'HOME' and 'APPDATA' folders.
|
||||
* Used to determine the location of the various Win32 user/system folders.
|
||||
*
|
||||
* Win98 and earlier don't have SHGetFolderPath in shell32.dll.
|
||||
* Microsoft recommend that we load shfolder.dll at run time and
|
||||
|
@ -74,6 +74,18 @@ class HomeFinder
|
|||
return (result == 0) ? folder_path : "";
|
||||
}
|
||||
|
||||
/** Wrapper for SHGetFolderPathA, returning the 'DESKTOPDIRECTORY' folder
|
||||
(or an empty string if the folder couldn't be determined. */
|
||||
string getDesktopPath() const
|
||||
{
|
||||
if(!myFolderPathFunc) return "";
|
||||
char folder_path[MAX_PATH];
|
||||
HRESULT const result = (myFolderPathFunc)
|
||||
(NULL, CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL, 0, folder_path);
|
||||
|
||||
return (result == 0) ? folder_path : "";
|
||||
}
|
||||
|
||||
private:
|
||||
typedef HRESULT (__stdcall * function_pointer)(HWND, int, HANDLE, DWORD, LPCSTR);
|
||||
|
||||
|
|
|
@ -90,6 +90,14 @@ OSystemWin32::~OSystemWin32()
|
|||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string OSystemWin32::defaultSnapDir()
|
||||
{
|
||||
HomeFinder homefinder;
|
||||
FilesystemNode desktop(homefinder.getDesktopPath());
|
||||
return desktop.isDirectory() ? desktop.getPath(false) : "~";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystemWin32::setAppWindowPos(int x, int y, int w, int h)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,11 @@ class OSystemWin32 : public OSystem
|
|||
virtual ~OSystemWin32();
|
||||
|
||||
public:
|
||||
/**
|
||||
Returns the default path for the snapshot directory.
|
||||
*/
|
||||
string defaultSnapDir();
|
||||
|
||||
/**
|
||||
Move window to given position. The width and height are also
|
||||
required for the underlying function, but the window size itself
|
||||
|
|
Loading…
Reference in New Issue