Skip to content

Commit b6a8b46

Browse files
committed
For Qt GUI, added feature that allows save state files to be loaded via window drag n drop from a file dialog.
1 parent 46654ed commit b6a8b46

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/drivers/Qt/ConsoleWindow.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -786,9 +786,21 @@ void consoleWin_t::dropEvent(QDropEvent *event)
786786
QFileInfo fi( filename );
787787
QString suffix = fi.suffix();
788788

789+
bool isStateSaveFile = (suffix.size() == 3) &&
790+
(suffix[0] == 'f') && (suffix[1] == 'c') &&
791+
( (suffix[2] == 's') || suffix[2].isDigit() );
792+
789793
//printf("DragNDrop Suffix: %s\n", suffix.toStdString().c_str() );
790794

791-
if ( suffix.compare("lua", Qt::CaseInsensitive) == 0 )
795+
if (isStateSaveFile)
796+
{
797+
FCEU_WRAPPER_LOCK();
798+
FCEUI_LoadState( filename.toStdString().c_str() );
799+
FCEU_WRAPPER_UNLOCK();
800+
801+
event->accept();
802+
}
803+
else if ( suffix.compare("lua", Qt::CaseInsensitive) == 0 )
792804
{
793805
int luaLoadSuccess;
794806

0 commit comments

Comments
 (0)