mirror of https://github.com/stella-emu/stella.git
We don't need to check for directory, since we're using FSNode::ListMode::FilesOnly.
This commit is contained in:
parent
8f8efafd98
commit
477c800d0e
|
@ -89,9 +89,9 @@ void RomImageWidget::parseProperties(const FSNode& node, bool complete)
|
||||||
FBSurface::Attributes& attr = myNavSurface->attributes();
|
FBSurface::Attributes& attr = myNavSurface->attributes();
|
||||||
|
|
||||||
attr.blending = true;
|
attr.blending = true;
|
||||||
attr.blendalpha = 60;
|
attr.blendalpha = 60;
|
||||||
myNavSurface->applyAttributes();
|
myNavSurface->applyAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a surface has ever been created; if so, we use it
|
// Check if a surface has ever been created; if so, we use it
|
||||||
// The surface will always be the maximum size, but sometimes we'll
|
// The surface will always be the maximum size, but sometimes we'll
|
||||||
|
@ -122,7 +122,7 @@ void RomImageWidget::parseProperties(const FSNode& node, bool complete)
|
||||||
// Get a valid filename representing a snapshot file for this rom and load the snapshot
|
// Get a valid filename representing a snapshot file for this rom and load the snapshot
|
||||||
myImageList.clear();
|
myImageList.clear();
|
||||||
myImageIdx = 0;
|
myImageIdx = 0;
|
||||||
|
|
||||||
if(complete)
|
if(complete)
|
||||||
{
|
{
|
||||||
// Try to load snapshots by property name and ROM file name
|
// Try to load snapshots by property name and ROM file name
|
||||||
|
@ -187,10 +187,12 @@ bool RomImageWidget::getImageList(const string& propname, const string& filename
|
||||||
FSNode::NameFilter filter = ([&](const FSNode& node)
|
FSNode::NameFilter filter = ([&](const FSNode& node)
|
||||||
{
|
{
|
||||||
const string& nodeName = node.getName();
|
const string& nodeName = node.getName();
|
||||||
return (!node.isDirectory() &&
|
return
|
||||||
(nodeName == pngPropName || nodeName == pngFileName ||
|
(nodeName == pngPropName || nodeName == pngFileName ||
|
||||||
(nodeName.find(propname + " #") == 0 && nodeName.find(".png") == nodeName.length() - 4) ||
|
(nodeName.find(propname + " #") == 0 &&
|
||||||
(nodeName.find(filename + " #") == 0 && nodeName.find(".png") == nodeName.length() - 4)));
|
nodeName.find(".png") == nodeName.length() - 4) ||
|
||||||
|
(nodeName.find(filename + " #") == 0 &&
|
||||||
|
nodeName.find(".png") == nodeName.length() - 4));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -198,7 +200,8 @@ bool RomImageWidget::getImageList(const string& propname, const string& filename
|
||||||
FSNode node(instance().snapshotLoadDir().getPath());
|
FSNode node(instance().snapshotLoadDir().getPath());
|
||||||
node.getChildren(myImageList, FSNode::ListMode::FilesOnly, filter, false, false);
|
node.getChildren(myImageList, FSNode::ListMode::FilesOnly, filter, false, false);
|
||||||
|
|
||||||
// Sort again, not considering extensions, else <filename.png> would be at the end of the list
|
// Sort again, not considering extensions, else <filename.png> would be at
|
||||||
|
// the end of the list
|
||||||
std::sort(myImageList.begin(), myImageList.end(),
|
std::sort(myImageList.begin(), myImageList.end(),
|
||||||
[](const FSNode& node1, const FSNode& node2)
|
[](const FSNode& node1, const FSNode& node2)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +224,7 @@ bool RomImageWidget::loadPng(const string& filename)
|
||||||
const float scale = std::min(float(_w) / src.w(), float(myImageHeight) / src.h()) *
|
const float scale = std::min(float(_w) / src.w(), float(myImageHeight) / src.h()) *
|
||||||
instance().frameBuffer().hidpiScaleFactor();
|
instance().frameBuffer().hidpiScaleFactor();
|
||||||
mySurface->setDstSize(static_cast<uInt32>(src.w() * scale), static_cast<uInt32>(src.h() * scale));
|
mySurface->setDstSize(static_cast<uInt32>(src.w() * scale), static_cast<uInt32>(src.h() * scale));
|
||||||
|
|
||||||
// Retrieve label for loaded image
|
// Retrieve label for loaded image
|
||||||
myLabel = "";
|
myLabel = "";
|
||||||
for(auto comment = comments.begin(); comment != comments.end(); ++comment)
|
for(auto comment = comments.begin(); comment != comments.end(); ++comment)
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include "TimerManager.hxx"
|
||||||
|
|
||||||
#if defined(RETRON77)
|
#if defined(RETRON77)
|
||||||
#define ROOT_DIR "/mnt/games/"
|
#define ROOT_DIR "/mnt/games/"
|
||||||
#else
|
#else
|
||||||
|
@ -101,7 +103,10 @@ bool FSNodePOSIX::hasParent() const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
{
|
{
|
||||||
assert(_isDirectory);
|
uInt64 T = TimerManager::getTicks();
|
||||||
|
|
||||||
|
if (!_isDirectory)
|
||||||
|
return false;
|
||||||
|
|
||||||
DIR* dirp = opendir(_path.c_str());
|
DIR* dirp = opendir(_path.c_str());
|
||||||
if (dirp == nullptr)
|
if (dirp == nullptr)
|
||||||
|
@ -122,16 +127,6 @@ bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
|
|
||||||
FSNodePOSIX entry(newPath, false);
|
FSNodePOSIX entry(newPath, false);
|
||||||
|
|
||||||
#if defined(SYSTEM_NOT_SUPPORTING_D_TYPE)
|
|
||||||
/* TODO: d_type is not part of POSIX, so it might not be supported
|
|
||||||
* on some of our targets. For those systems where it isn't supported,
|
|
||||||
* add this #elif case, which tries to use stat() instead.
|
|
||||||
*
|
|
||||||
* The d_type method is used to avoid costly recurrent stat() calls in big
|
|
||||||
* directories.
|
|
||||||
*/
|
|
||||||
entry.setFlags();
|
|
||||||
#else
|
|
||||||
if (dp->d_type == DT_UNKNOWN)
|
if (dp->d_type == DT_UNKNOWN)
|
||||||
{
|
{
|
||||||
// Fall back to stat()
|
// Fall back to stat()
|
||||||
|
@ -161,7 +156,6 @@ bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
|
|
||||||
entry._isValid = true;
|
entry._isValid = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Skip files that are invalid for some reason (e.g. because we couldn't
|
// Skip files that are invalid for some reason (e.g. because we couldn't
|
||||||
// properly stat them).
|
// properly stat them).
|
||||||
|
@ -177,6 +171,7 @@ bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
|
||||||
|
cerr << (TimerManager::getTicks() - T) << endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue