Added support for launching the Album applet via albumLa.

This commit is contained in:
yellows8 2019-09-09 11:10:33 -04:00
parent 76e86a9a80
commit b89191c435
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
3 changed files with 63 additions and 0 deletions

View File

@ -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"

View File

@ -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);

View File

@ -0,0 +1,31 @@
#include <string.h>
#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);
}