Remove and forget this idea
This commit is contained in:
parent
b03633e010
commit
3b4e541d0e
122
renderd7.cpp
122
renderd7.cpp
@ -2,8 +2,6 @@
|
||||
#include "log.hpp"
|
||||
#include <regex>
|
||||
|
||||
FS_Archive archive, sdmc_archive, nand_archive;
|
||||
|
||||
#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 0) | (((g) & 0xFF) << 8) | (((b) & 0xFF) << 16) | (((a) & 0xFF) << 24))
|
||||
#define D7_NOTHING C2D_Color32(0, 0, 0, 0)
|
||||
#define CFGVER "1"
|
||||
@ -1057,123 +1055,3 @@ bool RenderD7::Console::Update()
|
||||
return dr_sc;
|
||||
}
|
||||
*/
|
||||
//FS2
|
||||
Result RenderD7::FS2::OpenArchive(FS_Archive *archive, FS_ArchiveID id)
|
||||
{
|
||||
Result ret = 0;
|
||||
if (R_FAILED(ret = FSUSER_OpenArchive(archive, id, fsMakePath(PATH_EMPTY, ""))))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result RenderD7::FS2::CloseArchive(FS_Archive archive)
|
||||
{
|
||||
Result ret = 0;
|
||||
|
||||
if (R_FAILED(ret = FSUSER_CloseArchive(archive)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool RenderD7::FS2::DirExists(FS_Archive archive, const std::string &path)
|
||||
{
|
||||
Handle handle;
|
||||
std::u16string path_u16 = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(path.data());
|
||||
if (R_FAILED(FSUSER_OpenDirectory(&handle, archive, fsMakePath(PATH_UTF16, path_u16.c_str()))))
|
||||
return false;
|
||||
|
||||
if (R_FAILED(FSDIR_Close(handle)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
u64 RenderD7::FS2::GetTotalStorage(FS_SystemMediaType mediatype) {
|
||||
Result ret = 0;
|
||||
FS_ArchiveResource resource = { 0 };
|
||||
if (R_FAILED(ret = FSUSER_GetArchiveResource(&resource, mediatype)))
|
||||
{
|
||||
|
||||
return ret;
|
||||
}
|
||||
return (static_cast<u64>(resource.totalClusters) * static_cast<u64>(resource.clusterSize));
|
||||
}
|
||||
|
||||
u64 RenderD7::FS2::GetUsedStorage(FS_SystemMediaType mediatype)
|
||||
{
|
||||
Result ret = 0;
|
||||
FS_ArchiveResource resource = { 0 };
|
||||
if (R_FAILED(ret = FSUSER_GetArchiveResource(&resource, mediatype)))
|
||||
{
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ((static_cast<u64>(resource.totalClusters) * static_cast<u64>(resource.clusterSize)) -
|
||||
(static_cast<u64>(resource.freeClusters) * static_cast<u64>(resource.clusterSize)));
|
||||
}
|
||||
|
||||
static bool Sort(const FS_DirectoryEntry &entryA, const FS_DirectoryEntry &entryB) {
|
||||
if ((entryA.attributes & FS_ATTRIBUTE_DIRECTORY) && !(entryB.attributes & FS_ATTRIBUTE_DIRECTORY))
|
||||
return true;
|
||||
else if (!(entryA.attributes & FS_ATTRIBUTE_DIRECTORY) && (entryB.attributes & FS_ATTRIBUTE_DIRECTORY))
|
||||
return false;
|
||||
else {
|
||||
std::u16string entryA_name = reinterpret_cast<const char16_t *>(entryA.name);
|
||||
std::u16string entryB_name = reinterpret_cast<const char16_t *>(entryB.name);
|
||||
std::transform(entryA_name.begin(), entryA_name.end(), entryA_name.begin(), [](unsigned char c){ return std::tolower(c); });
|
||||
std::transform(entryB_name.begin(), entryB_name.end(), entryB_name.begin(), [](unsigned char c){ return std::tolower(c); });
|
||||
|
||||
if (entryA_name.compare(entryB_name) < 0)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Result RenderD7::FS2::GetDirList(const std::string &path, std::vector<FS_DirectoryEntry> &entries)
|
||||
{
|
||||
if (!entries.empty())
|
||||
entries.clear();
|
||||
Result ret = 0;
|
||||
Handle dir = 0;
|
||||
std::u16string path_u16 = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(path.data());
|
||||
if (R_FAILED(ret = FSUSER_OpenDirectory(&dir, archive, fsMakePath(PATH_UTF16, path_u16.c_str())))) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
u32 entry_count = 0;
|
||||
do {
|
||||
FS_DirectoryEntry entry;
|
||||
if (R_FAILED(ret = FSDIR_Read(dir, &entry_count, 1, &entry))) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
if (entry_count == 1)
|
||||
entries.push_back(entry);
|
||||
} while(entry_count > 0);
|
||||
std::sort(entries.begin(), entries.end(), Sort);
|
||||
if (R_FAILED(ret = FSDIR_Close(dir))) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RenderD7::FS2::Convert(std::vector<FS_DirectoryEntry> &entries, std::vector<RenderD7::DirContent> &converted)
|
||||
{
|
||||
RenderD7::DirContent temp;
|
||||
for (int i = 0; i < (int)entries.size(); i++)
|
||||
{
|
||||
const std::u16string entry_name_utf16 = reinterpret_cast<const char16_t *>(entries[i].name);
|
||||
const std::string filename = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(entry_name_utf16.data());
|
||||
temp.name = filename;
|
||||
if ((entryA.attributes & FS_ATTRIBUTE_DIRECTORY)) temp.isDir = true;
|
||||
converted.push_back(temp);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderD7::FS2::GetContents(std::string path, std::vector<RenderD7::DirContent> &converted)
|
||||
{
|
||||
|
||||
}
|
14
renderd7.hpp
14
renderd7.hpp
@ -28,8 +28,6 @@
|
||||
#include "stringtool.hpp"
|
||||
#include "Clock.hpp"
|
||||
|
||||
extern FS_Archive archive, sdmc_archive, nand_archive;
|
||||
|
||||
#define RENDERD7VSTRING "0.7.0"
|
||||
#define CHANGELOG "0.6.2: \n0.6.10: rewrite Threadsystem, Improve framerate\n0.6.02: Fix Code in lang.hpp\nadd Draw Text Left Function.\nadd changelog\n0.6.01: add Threading system."
|
||||
#define DEFAULT_CENTER 0.5f
|
||||
@ -243,17 +241,7 @@ namespace RenderD7
|
||||
{
|
||||
bool FileExist(const std::string& path);
|
||||
}
|
||||
namespace FS2
|
||||
{
|
||||
Result OpenArchive(FS_Archive *archive, FS_ArchiveID id);
|
||||
Result CloseArchive(FS_Archive archive);
|
||||
bool DirExists(FS_Archive archive, const std::string &path);
|
||||
u64 GetTotalStorage(FS_SystemMediaType mediatype);
|
||||
u64 GetUsedStorage(FS_SystemMediaType mediatype);
|
||||
Result GetDirList(const std::string &path, std::vector<FS_DirectoryEntry> &entries);
|
||||
void Convert(std::vector<FS_DirectoryEntry> &entries, std::vector<RenderD7::DirContent> &converted);
|
||||
void GetContents(std::string path, std::vector<RenderD7::DirContent> &converted);
|
||||
}
|
||||
|
||||
bool IsNdspInit();
|
||||
void SetupLog(void);
|
||||
std::string GetFramerate();
|
||||
|
Loading…
Reference in New Issue
Block a user