mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-09-17 20:52:38 +02:00
Add support for custom BMP icons and custom NDS banners for games and folders. Closes #53 and Closes #62
This commit is contained in:
49
arm9/source/romBrowser/RepositoryBase.cpp
Normal file
49
arm9/source/romBrowser/RepositoryBase.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "common.h"
|
||||
#include <string.h>
|
||||
#include "core/StringUtil.h"
|
||||
#include "FileType/NullFileTypeProvider.h"
|
||||
#include "SdFolderFactory.h"
|
||||
#include "RepositoryBase.h"
|
||||
|
||||
void RepositoryBase::InitializeFolders(const char* basePath)
|
||||
{
|
||||
NullFileTypeProvider fileTypeProvider;
|
||||
SdFolderFactory folderFactory(&fileTypeProvider);
|
||||
char path[64];
|
||||
|
||||
u32 len = StringUtil::Copy(path, basePath, sizeof(path));
|
||||
|
||||
StringUtil::Copy(path + len, "nds", sizeof(path) - len);
|
||||
_ndsFolder = folderFactory.CreateFromPath(path);
|
||||
if (_ndsFolder)
|
||||
{
|
||||
_ndsFolder->SortByNameInPlace();
|
||||
}
|
||||
|
||||
StringUtil::Copy(path + len, "gba", sizeof(path) - len);
|
||||
_gbaFolder = folderFactory.CreateFromPath(path);
|
||||
if (_gbaFolder)
|
||||
{
|
||||
_gbaFolder->SortByNameInPlace();
|
||||
}
|
||||
|
||||
StringUtil::Copy(path + len, "user", sizeof(path) - len);
|
||||
_userFolder = folderFactory.CreateFromPath(path);
|
||||
if (_userFolder)
|
||||
{
|
||||
_userFolder->SortByNameInPlace();
|
||||
}
|
||||
}
|
||||
|
||||
const SdFolder* RepositoryBase::GetFileTypeFolder(const char* shortName) const
|
||||
{
|
||||
if (!strcmp(shortName, "nds"))
|
||||
{
|
||||
return _ndsFolder.get();
|
||||
}
|
||||
if (!strcmp(shortName, "gba"))
|
||||
{
|
||||
return _gbaFolder.get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user