diff --git a/nx/include/switch.h b/nx/include/switch.h index 72a09075..d2839b48 100644 --- a/nx/include/switch.h +++ b/nx/include/switch.h @@ -112,6 +112,7 @@ extern "C" { #include "switch/audio/driver.h" #include "switch/applets/libapplet.h" +#include "switch/applets/album_la.h" #include "switch/applets/pctlauth.h" #include "switch/applets/error.h" #include "switch/applets/swkbd.h" diff --git a/nx/include/switch/applets/album_la.h b/nx/include/switch/applets/album_la.h new file mode 100644 index 00000000..89204b46 --- /dev/null +++ b/nx/include/switch/applets/album_la.h @@ -0,0 +1,31 @@ +/** + * @file album_la.h + * @brief Wrapper for using the Album LibraryApplet. + * @author yellows8 + * @copyright libnx Authors + */ +#pragma once +#include "../types.h" + +/// Arg type values pushed for the applet input storage, stored as an u8. +typedef enum { + AlbumLaArg_ShowAlbumFiles = 0, ///< ShowAlbumFiles. Only displays AlbumFiles associated with the title which launched the Album applet, with the filter button disabled. + AlbumLaArg_ShowAllAlbumFiles = 1, ///< ShowAllAlbumFiles. Displays all AlbumFiles, with filtering allowed. + AlbumLaArg_ShowAllAlbumFilesForHomeMenu = 2, ///< ShowAllAlbumFilesForHomeMenu. Similar to ::AlbumLaArg_ShowAllAlbumFiles. +} AlbumLaArg; + +/** + * @brief Launches the applet with ::AlbumLaArg_ShowAlbumFiles and playStartupSound=false. + */ +Result albumLaShowAlbumFiles(void); + +/** + * @brief Launches the applet with ::AlbumLaArg_ShowAllAlbumFiles and playStartupSound=false. + */ +Result albumLaShowAllAlbumFiles(void); + +/** + * @brief Launches the applet with ::AlbumLaArg_ShowAllAlbumFilesForHomeMenu and playStartupSound=true. + */ +Result albumLaShowAllAlbumFilesForHomeMenu(void); + diff --git a/nx/source/applets/album_la.c b/nx/source/applets/album_la.c new file mode 100644 index 00000000..64fef72d --- /dev/null +++ b/nx/source/applets/album_la.c @@ -0,0 +1,31 @@ +#include +#include "types.h" +#include "result.h" +#include "services/applet.h" +#include "applets/libapplet.h" +#include "applets/album_la.h" + +static Result _albumLaShow(u8 arg, bool playStartupSound) { + Result rc=0; + LibAppletArgs commonargs; + + libappletArgsCreate(&commonargs, 0x10000); + libappletArgsSetPlayStartupSound(&commonargs, playStartupSound); + + rc = libappletLaunch(AppletId_photoViewer, &commonargs, &arg, sizeof(arg), NULL, 0, NULL); + + return rc; +} + +Result albumLaShowAlbumFiles(void) { + return _albumLaShow(AlbumLaArg_ShowAlbumFiles, false); +} + +Result albumLaShowAllAlbumFiles(void) { + return _albumLaShow(AlbumLaArg_ShowAllAlbumFiles, false); +} + +Result albumLaShowAllAlbumFilesForHomeMenu(void) { + return _albumLaShow(AlbumLaArg_ShowAllAlbumFilesForHomeMenu, true); +} +