Skip to content

Commit

Permalink
enhancement: support Savestates as a parameter (fixes #1522)
Browse files Browse the repository at this point in the history
- We can now pass a savestate file (.uss) as a direct parameter to the Amiberry executable, and it will recognize and handle it, without having to use --statefile <filename>
- Added mimetype for savestate files
  • Loading branch information
midwan committed Dec 5, 2024
1 parent 95e54b5 commit 631be7d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packaging/linux/mime/amiberry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,13 @@
<glob-deleteall/>
<glob pattern="*.lha"/>
</mime-type>
<mime-type type="application/x-UAE-savestate-file">
<comment>UAE SaveState file</comment>
<generic-icon name="amiberry"/>
<magic-deleteall/>
<magic priority="60">
<match type="string" value="UAE" offset="16:18"/>
</magic>
<glob pattern="*.uss"/>
</mime-type>
</mime-info>
15 changes: 15 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,21 @@ static void parse_cmdline (int argc, TCHAR **argv)
whdload_auto_prefs(&currprefs, txt);
SetLastActiveConfig(txt);
}
else if (_tcscmp(txt2.c_str(), ".uss") == 0)
{
write_log("Statefile... %s\n", txt);
if (my_existsfile2(txt))
{
savestate_state = STATE_DORESTORE;
_tcscpy(savestate_fname, txt);
}
else
{
get_savestate_path(savestate_fname, MAX_DPATH - 1);
strncat(savestate_fname, txt, MAX_DPATH - 1);
savestate_state = STATE_DORESTORE;
}
}
else if (_tcscmp(txt2.c_str(), ".cue") == 0
|| _tcscmp(txt2.c_str(), ".iso") == 0
|| _tcscmp(txt2.c_str(), ".chd") == 0)
Expand Down

1 comment on commit 631be7d

@giantclambake
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add application/x-UAE-savestate-file to the packaging/linux/Amiberry.desktop file ;)

Please sign in to comment.