FastColor/RemoveFPSCheat/LLVM-Style

This commit is contained in:
tobid7 2023-03-07 18:09:48 +01:00
parent 2f7a266dc5
commit 66a35f28e6
22 changed files with 18350 additions and 15235 deletions

11
.vscode/settings.json vendored
View File

@ -88,6 +88,15 @@
"xtree": "cpp", "xtree": "cpp",
"xutility": "cpp", "xutility": "cpp",
"queue": "cpp", "queue": "cpp",
"semaphore": "cpp" "semaphore": "cpp",
"hash_map": "cpp",
"set": "cpp",
"unordered_set": "cpp",
"source_location": "cpp",
"future": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"variant": "cpp"
} }
} }

7
cformat.sh Executable file
View File

@ -0,0 +1,7 @@
find . -type f \( -name '*.h' -o -name '*.hpp' -o -name '*.hh' -o -name '*.ino' -o -name '*.cpp' -o -name '*.c' -o -name '*.cxx' -o -name '*.inl' \) -and -not -path './build/*' -not -path './base/external/*' -not -path './DPP/*' | while read file; do
if [[ "$file" != *"json.hpp" ]]; then
echo "Formatting $file..."
clang-format -i --style=LLVM $file
fi
done

File diff suppressed because it is too large Load Diff

481
external/source/fs.c vendored
View File

@ -3,384 +3,421 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include <stdlib.h>
#define WORKING_DIR "/" #define WORKING_DIR "/"
void Utils_U8_To_U16(u16 *buf, const u8 *input, size_t bufsize) { void Utils_U8_To_U16(u16 *buf, const u8 *input, size_t bufsize) {
ssize_t units = utf8_to_utf16(buf, input, bufsize); ssize_t units = utf8_to_utf16(buf, input, bufsize);
if (units < 0) if (units < 0)
units = 0; units = 0;
buf[units] = 0; buf[units] = 0;
} }
FS_Archive archive, sdmc_archive, nand_archive; FS_Archive archive, sdmc_archive, nand_archive;
Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID archiveID) { Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID archiveID) {
Result ret = 0; Result ret = 0;
if (R_FAILED(ret = FSUSER_OpenArchive(archive, archiveID, fsMakePath(PATH_EMPTY, "")))) if (R_FAILED(ret = FSUSER_OpenArchive(archive, archiveID,
return ret; fsMakePath(PATH_EMPTY, ""))))
return ret;
return 0; return 0;
} }
Result FS_CloseArchive(FS_Archive archive) { Result FS_CloseArchive(FS_Archive archive) {
Result ret = 0; Result ret = 0;
if (R_FAILED(ret = FSUSER_CloseArchive(archive))) if (R_FAILED(ret = FSUSER_CloseArchive(archive)))
return ret; return ret;
return 0; return 0;
} }
Result FS_OpenDir(Handle *handle, FS_Archive archive, const char *path) { Result FS_OpenDir(Handle *handle, FS_Archive archive, const char *path) {
Result ret = 0; Result ret = 0;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_OpenDirectory(handle, archive, fsMakePath(PATH_UTF16, path_u16)))) if (R_FAILED(ret = FSUSER_OpenDirectory(handle, archive,
return ret; fsMakePath(PATH_UTF16, path_u16))))
return ret;
return 0; return 0;
} }
Result FS_OpenFile(Handle *handle, FS_Archive archive, const char *path, u32 flags, u32 attributes) { Result FS_OpenFile(Handle *handle, FS_Archive archive, const char *path,
Result ret = 0; u32 flags, u32 attributes) {
Result ret = 0;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_OpenFile(handle, archive, fsMakePath(PATH_UTF16, path_u16), flags, attributes))) if (R_FAILED(ret = FSUSER_OpenFile(handle, archive,
return ret; fsMakePath(PATH_UTF16, path_u16), flags,
attributes)))
return ret;
return 0; return 0;
} }
Result FS_MakeDir(FS_Archive archive, const char *path) { Result FS_MakeDir(FS_Archive archive, const char *path) {
Result ret = 0; Result ret = 0;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_CreateDirectory(archive, fsMakePath(PATH_UTF16, path_u16), 0))) if (R_FAILED(ret = FSUSER_CreateDirectory(
return ret; archive, fsMakePath(PATH_UTF16, path_u16), 0)))
return ret;
return 0; return 0;
} }
Result FS_CreateFile(FS_Archive archive, const char *path, u64 size) { Result FS_CreateFile(FS_Archive archive, const char *path, u64 size) {
Result ret = 0; Result ret = 0;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_CreateFile(archive, fsMakePath(PATH_UTF16, path_u16), 0, size))) if (R_FAILED(ret = FSUSER_CreateFile(
return ret; archive, fsMakePath(PATH_UTF16, path_u16), 0, size)))
return ret;
return 0; return 0;
} }
Result FS_RecursiveMakeDir(FS_Archive archive, const char *path) { Result FS_RecursiveMakeDir(FS_Archive archive, const char *path) {
Result ret = 0; Result ret = 0;
char buf[256]; char buf[256];
char *p = NULL; char *p = NULL;
size_t len; size_t len;
snprintf(buf, sizeof(buf), "%s", path); snprintf(buf, sizeof(buf), "%s", path);
len = strlen(buf); len = strlen(buf);
if (buf[len - 1] == '/') if (buf[len - 1] == '/')
buf[len - 1] = 0; buf[len - 1] = 0;
for (p = buf + 1; *p; p++) { for (p = buf + 1; *p; p++) {
if (*p == '/') { if (*p == '/') {
*p = 0; *p = 0;
if (!FS_DirExists(archive, buf)) if (!FS_DirExists(archive, buf))
ret = FS_MakeDir(archive, buf); ret = FS_MakeDir(archive, buf);
*p = '/'; *p = '/';
} }
if (!FS_DirExists(archive, buf)) if (!FS_DirExists(archive, buf))
ret = FS_MakeDir(archive, buf); ret = FS_MakeDir(archive, buf);
} }
return ret; return ret;
} }
bool FS_FileExists(FS_Archive archive, const char *path) { bool FS_FileExists(FS_Archive archive, const char *path) {
Handle handle; Handle handle;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_READ, 0))) if (R_FAILED(FSUSER_OpenFile(
return false; &handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_READ, 0)))
return false;
if (R_FAILED(FSFILE_Close(handle))) if (R_FAILED(FSFILE_Close(handle)))
return false; return false;
return true; return true;
} }
bool FS_DirExists(FS_Archive archive, const char *path) { bool FS_DirExists(FS_Archive archive, const char *path) {
Handle handle; Handle handle;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(FSUSER_OpenDirectory(&handle, archive, fsMakePath(PATH_UTF16, path_u16)))) if (R_FAILED(FSUSER_OpenDirectory(&handle, archive,
return false; fsMakePath(PATH_UTF16, path_u16))))
return false;
if (R_FAILED(FSDIR_Close(handle))) if (R_FAILED(FSDIR_Close(handle)))
return false; return false;
return true; return true;
} }
Result FS_GetFileSize(FS_Archive archive, const char *path, u64 *size) { Result FS_GetFileSize(FS_Archive archive, const char *path, u64 *size) {
Result ret = 0; Result ret = 0;
Handle handle; Handle handle;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_READ, 0))) if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive,
return ret; fsMakePath(PATH_UTF16, path_u16),
FS_OPEN_READ, 0)))
return ret;
if (R_FAILED(ret = FSFILE_GetSize(handle, size))) { if (R_FAILED(ret = FSFILE_GetSize(handle, size))) {
FSFILE_Close(handle); FSFILE_Close(handle);
return ret; return ret;
} }
if (R_FAILED(ret = FSFILE_Close(handle))) if (R_FAILED(ret = FSFILE_Close(handle)))
return ret; return ret;
return 0; return 0;
} }
u64 FS_GetFreeStorage(FS_SystemMediaType media_type) { u64 FS_GetFreeStorage(FS_SystemMediaType media_type) {
FS_ArchiveResource resource = {0}; FS_ArchiveResource resource = {0};
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, media_type))) if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, media_type)))
return (((u64)resource.freeClusters * (u64)resource.clusterSize)); return (((u64)resource.freeClusters * (u64)resource.clusterSize));
return 0; return 0;
} }
u64 FS_GetTotalStorage(FS_SystemMediaType media_type) { u64 FS_GetTotalStorage(FS_SystemMediaType media_type) {
FS_ArchiveResource resource = {0}; FS_ArchiveResource resource = {0};
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, media_type))) if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, media_type)))
return (((u64)resource.totalClusters * (u64)resource.clusterSize)); return (((u64)resource.totalClusters * (u64)resource.clusterSize));
return 0; return 0;
} }
u64 FS_GetUsedStorage(FS_SystemMediaType media_type) { u64 FS_GetUsedStorage(FS_SystemMediaType media_type) {
return 0;//(FS_GetTotalStorage(media_type) - FS_GetUsedStorage(media_type)); return 0; //(FS_GetTotalStorage(media_type) - FS_GetUsedStorage(media_type));
} }
Result FS_RemoveFile(FS_Archive archive, const char *path) { Result FS_RemoveFile(FS_Archive archive, const char *path) {
Result ret = 0; Result ret = 0;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_DeleteFile(archive, fsMakePath(PATH_UTF16, path_u16)))) if (R_FAILED(
return ret; ret = FSUSER_DeleteFile(archive, fsMakePath(PATH_UTF16, path_u16))))
return ret;
return 0; return 0;
} }
Result FS_RemoveDir(FS_Archive archive, const char *path) { Result FS_RemoveDir(FS_Archive archive, const char *path) {
Result ret = 0; Result ret = 0;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_DeleteDirectory(archive, fsMakePath(PATH_UTF16, path_u16)))) if (R_FAILED(ret = FSUSER_DeleteDirectory(archive,
return ret; fsMakePath(PATH_UTF16, path_u16))))
return ret;
return 0; return 0;
} }
Result FS_RemoveDirRecursive(FS_Archive archive, const char *path) { Result FS_RemoveDirRecursive(FS_Archive archive, const char *path) {
Result ret = 0; Result ret = 0;
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_DeleteDirectoryRecursively(archive, fsMakePath(PATH_UTF16, path_u16)))) if (R_FAILED(ret = FSUSER_DeleteDirectoryRecursively(
return ret; archive, fsMakePath(PATH_UTF16, path_u16))))
return ret;
return 0; return 0;
} }
Result FS_RenameFile(FS_Archive archive, const char *old_filename, const char *new_filename) { Result FS_RenameFile(FS_Archive archive, const char *old_filename,
Result ret = 0; const char *new_filename) {
Result ret = 0;
u16 old_filename_u16[strlen(old_filename) + 1]; u16 old_filename_u16[strlen(old_filename) + 1];
Utils_U8_To_U16(old_filename_u16, (const u8 *)old_filename, strlen(old_filename) + 1); Utils_U8_To_U16(old_filename_u16, (const u8 *)old_filename,
strlen(old_filename) + 1);
u16 new_filename_u16[strlen(new_filename) + 1]; u16 new_filename_u16[strlen(new_filename) + 1];
Utils_U8_To_U16(new_filename_u16, (const u8 *)new_filename, strlen(new_filename) + 1); Utils_U8_To_U16(new_filename_u16, (const u8 *)new_filename,
strlen(new_filename) + 1);
if (R_FAILED(ret = FSUSER_RenameFile(archive, fsMakePath(PATH_UTF16, old_filename_u16), archive, fsMakePath(PATH_UTF16, new_filename_u16)))) if (R_FAILED(ret = FSUSER_RenameFile(
return ret; archive, fsMakePath(PATH_UTF16, old_filename_u16), archive,
fsMakePath(PATH_UTF16, new_filename_u16))))
return ret;
return 0; return 0;
} }
Result FS_RenameDir(FS_Archive archive, const char *old_dirname, const char *new_dirname) { Result FS_RenameDir(FS_Archive archive, const char *old_dirname,
Result ret = 0; const char *new_dirname) {
Result ret = 0;
u16 old_dirname_u16[strlen(old_dirname) + 1]; u16 old_dirname_u16[strlen(old_dirname) + 1];
Utils_U8_To_U16(old_dirname_u16, (const u8 *)old_dirname, strlen(old_dirname) + 1); Utils_U8_To_U16(old_dirname_u16, (const u8 *)old_dirname,
strlen(old_dirname) + 1);
u16 new_dirname_u16[strlen(new_dirname) + 1]; u16 new_dirname_u16[strlen(new_dirname) + 1];
Utils_U8_To_U16(new_dirname_u16, (const u8 *)new_dirname, strlen(new_dirname) + 1); Utils_U8_To_U16(new_dirname_u16, (const u8 *)new_dirname,
strlen(new_dirname) + 1);
if (R_FAILED(ret = FSUSER_RenameDirectory(archive, fsMakePath(PATH_UTF16, old_dirname_u16), archive, fsMakePath(PATH_UTF16, new_dirname_u16)))) if (R_FAILED(ret = FSUSER_RenameDirectory(
return ret; archive, fsMakePath(PATH_UTF16, old_dirname_u16), archive,
fsMakePath(PATH_UTF16, new_dirname_u16))))
return ret;
return 0; return 0;
} }
Result FS_Read(FS_Archive archive, const char *path, u64 size, void *buf) { Result FS_Read(FS_Archive archive, const char *path, u64 size, void *buf) {
Result ret = 0; Result ret = 0;
Handle handle; Handle handle;
u32 bytes_read = 0; u32 bytes_read = 0;
if (R_FAILED(ret = FS_OpenFile(&handle, archive, path, FS_OPEN_READ, 0))) if (R_FAILED(ret = FS_OpenFile(&handle, archive, path, FS_OPEN_READ, 0)))
return ret; return ret;
if (R_FAILED(ret = FSFILE_Read(handle, &bytes_read, 0, buf, size))) { if (R_FAILED(ret = FSFILE_Read(handle, &bytes_read, 0, buf, size))) {
FSFILE_Close(handle); FSFILE_Close(handle);
return ret; return ret;
} }
if (R_FAILED(ret = FSFILE_Close(handle))) if (R_FAILED(ret = FSFILE_Close(handle)))
return ret; return ret;
return 0; return 0;
} }
Result FS_Write(FS_Archive archive, const char *path, const void *buf, u32 size) { Result FS_Write(FS_Archive archive, const char *path, const void *buf,
Result ret = 0; u32 size) {
Handle handle; Result ret = 0;
u32 bytes_written = 0; Handle handle;
u32 bytes_written = 0;
if (FS_FileExists(archive, path)) if (FS_FileExists(archive, path))
FS_RemoveFile(archive, path); FS_RemoveFile(archive, path);
u16 path_u16[strlen(path) + 1]; u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1); Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_CreateFile(archive, fsMakePath(PATH_UTF16, path_u16), 0, size))) if (R_FAILED(ret = FSUSER_CreateFile(
return ret; archive, fsMakePath(PATH_UTF16, path_u16), 0, size)))
return ret;
if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_WRITE, 0))) if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive,
return ret; fsMakePath(PATH_UTF16, path_u16),
FS_OPEN_WRITE, 0)))
return ret;
if (R_FAILED(ret = FSFILE_Write(handle, &bytes_written, 0, buf, size, FS_WRITE_FLUSH))) { if (R_FAILED(ret = FSFILE_Write(handle, &bytes_written, 0, buf, size,
FSFILE_Close(handle); FS_WRITE_FLUSH))) {
return ret; FSFILE_Close(handle);
} return ret;
}
if (R_FAILED(ret = FSFILE_Close(handle))) if (R_FAILED(ret = FSFILE_Close(handle)))
return ret; return ret;
return 0; return 0;
} }
char *FS_GetFileTimestamp(const char *path) { char *FS_GetFileTimestamp(const char *path) {
static char timeStr[60]; static char timeStr[60];
u64 mtime = 0; u64 mtime = 0;
if (R_SUCCEEDED(archive_getmtime(path, &mtime))) { if (R_SUCCEEDED(archive_getmtime(path, &mtime))) {
time_t mt = mtime; time_t mt = mtime;
struct tm *timeStruct = gmtime(&mt); struct tm *timeStruct = gmtime(&mt);
int hours = timeStruct->tm_hour; int hours = timeStruct->tm_hour;
int minutes = timeStruct->tm_min; int minutes = timeStruct->tm_min;
int day = timeStruct->tm_mday; int day = timeStruct->tm_mday;
int month = timeStruct->tm_mon + 1; // January being 0 int month = timeStruct->tm_mon + 1; // January being 0
int year = timeStruct->tm_year + 1900; int year = timeStruct->tm_year + 1900;
snprintf(timeStr, 60, "%d/%d/%d %2i:%02i", year, month, day, hours, minutes); snprintf(timeStr, 60, "%d/%d/%d %2i:%02i", year, month, day, hours,
} minutes);
else } else
return NULL; return NULL;
return timeStr; return timeStr;
} }
FS_Path getPathInfo(const char * path, FS_ArchiveID * archive) { FS_Path getPathInfo(const char *path, FS_ArchiveID *archive) {
*archive = ARCHIVE_SDMC; *archive = ARCHIVE_SDMC;
FS_Path filePath = {0}; FS_Path filePath = {0};
unsigned int prefixlen = 0; unsigned int prefixlen = 0;
if (!strncmp(path, "sdmc:/", 6)) { if (!strncmp(path, "sdmc:/", 6)) {
prefixlen = 5; prefixlen = 5;
} else if (*path != '/') { } else if (*path != '/') {
//if the path is local (doesnt start with a slash), it needs to be appended to the working dir to be valid // if the path is local (doesnt start with a slash), it needs to be appended
char * actualPath = NULL; // to the working dir to be valid
asprintf(&actualPath, "%s%s", WORKING_DIR, path); char *actualPath = NULL;
filePath = fsMakePath(PATH_ASCII, actualPath); asprintf(&actualPath, "%s%s", WORKING_DIR, path);
free(actualPath); filePath = fsMakePath(PATH_ASCII, actualPath);
} free(actualPath);
}
//if the filePath wasnt set above, set it // if the filePath wasnt set above, set it
if (filePath.size == 0) { if (filePath.size == 0) {
filePath = fsMakePath(PATH_ASCII, path+prefixlen); filePath = fsMakePath(PATH_ASCII, path + prefixlen);
} }
return filePath; return filePath;
} }
Result makeDirs(const char * path) { Result makeDirs(const char *path) {
Result ret = 0; Result ret = 0;
FS_ArchiveID archiveID; FS_ArchiveID archiveID;
FS_Path filePath = getPathInfo(path, &archiveID); FS_Path filePath = getPathInfo(path, &archiveID);
FS_Archive archive; FS_Archive archive;
ret = FSUSER_OpenArchive(&archive, archiveID, fsMakePath(PATH_EMPTY, "")); ret = FSUSER_OpenArchive(&archive, archiveID, fsMakePath(PATH_EMPTY, ""));
for (char * slashpos = strchr(path+1, '/'); slashpos != NULL; slashpos = strchr(slashpos+1, '/')) { for (char *slashpos = strchr(path + 1, '/'); slashpos != NULL;
char bak = *(slashpos); slashpos = strchr(slashpos + 1, '/')) {
*(slashpos) = '\0'; char bak = *(slashpos);
Handle dirHandle; *(slashpos) = '\0';
Handle dirHandle;
ret = FSUSER_OpenDirectory(&dirHandle, archive, filePath); ret = FSUSER_OpenDirectory(&dirHandle, archive, filePath);
if (R_SUCCEEDED(ret)) FSDIR_Close(dirHandle); if (R_SUCCEEDED(ret))
else ret = FSUSER_CreateDirectory(archive, filePath, FS_ATTRIBUTE_DIRECTORY); FSDIR_Close(dirHandle);
else
ret = FSUSER_CreateDirectory(archive, filePath, FS_ATTRIBUTE_DIRECTORY);
*(slashpos) = bak; *(slashpos) = bak;
} }
FSUSER_CloseArchive(archive); FSUSER_CloseArchive(archive);
return ret; return ret;
} }
Result openFile(Handle* fileHandle, const char * path, bool write) { Result openFile(Handle *fileHandle, const char *path, bool write) {
FS_ArchiveID archive; FS_ArchiveID archive;
FS_Path filePath = getPathInfo(path, &archive); FS_Path filePath = getPathInfo(path, &archive);
u32 flags = (write ? (FS_OPEN_CREATE | FS_OPEN_WRITE) : FS_OPEN_READ); u32 flags = (write ? (FS_OPEN_CREATE | FS_OPEN_WRITE) : FS_OPEN_READ);
Result ret = 0; Result ret = 0;
ret = makeDirs(strdup(path)); ret = makeDirs(strdup(path));
ret = FSUSER_OpenFileDirectly(fileHandle, archive, fsMakePath(PATH_EMPTY, ""), filePath, flags, 0); ret = FSUSER_OpenFileDirectly(fileHandle, archive, fsMakePath(PATH_EMPTY, ""),
if (write) ret = FSFILE_SetSize(*fileHandle, 0); //truncate the file to remove previous contents before writing filePath, flags, 0);
if (write)
ret = FSFILE_SetSize(
*fileHandle,
0); // truncate the file to remove previous contents before writing
return ret; return ret;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include <renderd7/StealConsole.hpp>
#include <renderd7/bmp.hpp> #include <renderd7/bmp.hpp>
#include <renderd7/renderd7.hpp> #include <renderd7/renderd7.hpp>
#include <renderd7/StealConsole.hpp>

View File

@ -26,6 +26,6 @@ public:
uint8_t m_r, m_g, m_b, m_a; uint8_t m_r, m_g, m_b, m_a;
}; };
std::string RGB2Hex(int r, int g, int b); std::string RGB2Hex(int r, int g, int b);
uint32_t Hex(const std::string color, uint8_t a = 255); uint32_t Hex(const std::string &color, uint8_t a = 255);
} // namespace Color } // namespace Color
} // namespace RenderD7 } // namespace RenderD7

View File

@ -1,27 +1,25 @@
#pragma once #pragma once
#include <string>
#include <3ds.h> #include <3ds.h>
#include <string>
namespace RenderD7 namespace RenderD7 {
{ class ResultDecoder {
class ResultDecoder public:
{ ResultDecoder() {}
public: ~ResultDecoder() {}
ResultDecoder(){} void Load(Result rescode);
~ResultDecoder(){} void Load(std::string rescode);
void Load(Result rescode); std::string GetCode();
void Load(std::string rescode); std::string GetLevel();
std::string GetCode(); int GetLevelInt();
std::string GetLevel(); std::string GetModule();
int GetLevelInt(); int GetModuleInt();
std::string GetModule(); std::string GetDescription();
int GetModuleInt(); int GetDescriptionInt();
std::string GetDescription(); std::string GetSummary();
int GetDescriptionInt(); int GetSummaryInt();
std::string GetSummary();
int GetSummaryInt();
private: private:
Result m_rescode; Result m_rescode;
}; };
} } // namespace RenderD7

View File

@ -2,7 +2,6 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
namespace RenderD7 { namespace RenderD7 {
class StealConsole { class StealConsole {
public: public:

View File

@ -7,7 +7,8 @@ extern FS_Archive archive, sdmc_archive, nand_archive;
Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID id); Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID id);
Result FS_CloseArchive(FS_Archive archive); Result FS_CloseArchive(FS_Archive archive);
Result FS_OpenDir(Handle *handle, FS_Archive archive, const char *path); Result FS_OpenDir(Handle *handle, FS_Archive archive, const char *path);
Result FS_OpenFile(Handle *handle, FS_Archive archive, const char *path, u32 flags, u32 attributes); Result FS_OpenFile(Handle *handle, FS_Archive archive, const char *path,
u32 flags, u32 attributes);
Result FS_MakeDir(FS_Archive archive, const char *path); Result FS_MakeDir(FS_Archive archive, const char *path);
Result FS_CreateFile(FS_Archive archive, const char *path, u64 size); Result FS_CreateFile(FS_Archive archive, const char *path, u64 size);
Result FS_RecursiveMakeDir(FS_Archive archive, const char *path); Result FS_RecursiveMakeDir(FS_Archive archive, const char *path);
@ -20,10 +21,13 @@ u64 FS_GetUsedStorage(FS_SystemMediaType media_type);
Result FS_RemoveFile(FS_Archive archive, const char *path); Result FS_RemoveFile(FS_Archive archive, const char *path);
Result FS_RemoveDir(FS_Archive archive, const char *path); Result FS_RemoveDir(FS_Archive archive, const char *path);
Result FS_RemoveDirRecursive(FS_Archive archive, const char *path); Result FS_RemoveDirRecursive(FS_Archive archive, const char *path);
Result FS_RenameFile(FS_Archive archive, const char *old_filename, const char *new_filename); Result FS_RenameFile(FS_Archive archive, const char *old_filename,
Result FS_RenameDir(FS_Archive archive, const char *old_dirname, const char *new_dirname); const char *new_filename);
Result FS_RenameDir(FS_Archive archive, const char *old_dirname,
const char *new_dirname);
Result FS_Read(FS_Archive archive, const char *path, u64 size, void *buf); Result FS_Read(FS_Archive archive, const char *path, u64 size, void *buf);
Result FS_Write(FS_Archive archive, const char *path, const void *buf, u32 size); Result FS_Write(FS_Archive archive, const char *path, const void *buf,
u32 size);
char *FS_GetFileTimestamp(const char *path); char *FS_GetFileTimestamp(const char *path);
Result makeDirs(const char * path); Result makeDirs(const char *path);
Result openFile(Handle* fileHandle, const char * path, bool write); Result openFile(Handle *fileHandle, const char *path, bool write);

View File

@ -16,129 +16,130 @@
#define libnsbmp_h_ #define libnsbmp_h_
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
/* bmp flags */ /* bmp flags */
#define BMP_NEW 0 #define BMP_NEW 0
/** image is opaque (as opposed to having an alpha mask) */ /** image is opaque (as opposed to having an alpha mask) */
#define BMP_OPAQUE (1 << 0) #define BMP_OPAQUE (1 << 0)
/** memory should be wiped */ /** memory should be wiped */
#define BMP_CLEAR_MEMORY (1 << 1) #define BMP_CLEAR_MEMORY (1 << 1)
/** /**
* error return values * error return values
*/ */
typedef enum { typedef enum {
BMP_OK = 0, BMP_OK = 0,
BMP_INSUFFICIENT_MEMORY = 1, BMP_INSUFFICIENT_MEMORY = 1,
BMP_INSUFFICIENT_DATA = 2, BMP_INSUFFICIENT_DATA = 2,
BMP_DATA_ERROR = 3 BMP_DATA_ERROR = 3
} bmp_result; } bmp_result;
/** /**
* encoding types * encoding types
*/ */
typedef enum { typedef enum {
BMP_ENCODING_RGB = 0, BMP_ENCODING_RGB = 0,
BMP_ENCODING_RLE8 = 1, BMP_ENCODING_RLE8 = 1,
BMP_ENCODING_RLE4 = 2, BMP_ENCODING_RLE4 = 2,
BMP_ENCODING_BITFIELDS = 3 BMP_ENCODING_BITFIELDS = 3
} bmp_encoding; } bmp_encoding;
/* API for Bitmap callbacks */ /* API for Bitmap callbacks */
typedef void* (*bmp_bitmap_cb_create)(int width, int height, unsigned int state); typedef void *(*bmp_bitmap_cb_create)(int width, int height,
unsigned int state);
typedef void (*bmp_bitmap_cb_destroy)(void *bitmap); typedef void (*bmp_bitmap_cb_destroy)(void *bitmap);
typedef unsigned char* (*bmp_bitmap_cb_get_buffer)(void *bitmap); typedef unsigned char *(*bmp_bitmap_cb_get_buffer)(void *bitmap);
typedef size_t (*bmp_bitmap_cb_get_bpp)(void *bitmap); typedef size_t (*bmp_bitmap_cb_get_bpp)(void *bitmap);
/** /**
* The Bitmap callbacks function table * The Bitmap callbacks function table
*/ */
typedef struct bmp_bitmap_callback_vt_s { typedef struct bmp_bitmap_callback_vt_s {
/** Callback to allocate bitmap storage. */ /** Callback to allocate bitmap storage. */
bmp_bitmap_cb_create bitmap_create; bmp_bitmap_cb_create bitmap_create;
/** Called to free bitmap storage. */ /** Called to free bitmap storage. */
bmp_bitmap_cb_destroy bitmap_destroy; bmp_bitmap_cb_destroy bitmap_destroy;
/** Return a pointer to the pixel data in a bitmap. */ /** Return a pointer to the pixel data in a bitmap. */
bmp_bitmap_cb_get_buffer bitmap_get_buffer; bmp_bitmap_cb_get_buffer bitmap_get_buffer;
/** Find the width of a pixel row in bytes. */ /** Find the width of a pixel row in bytes. */
bmp_bitmap_cb_get_bpp bitmap_get_bpp; bmp_bitmap_cb_get_bpp bitmap_get_bpp;
} bmp_bitmap_callback_vt; } bmp_bitmap_callback_vt;
/** /**
* bitmap image * bitmap image
*/ */
typedef struct bmp_image { typedef struct bmp_image {
/** callbacks for bitmap functions */ /** callbacks for bitmap functions */
bmp_bitmap_callback_vt bitmap_callbacks; bmp_bitmap_callback_vt bitmap_callbacks;
/** pointer to BMP data */ /** pointer to BMP data */
uint8_t *bmp_data; uint8_t *bmp_data;
/** width of BMP (valid after _analyse) */ /** width of BMP (valid after _analyse) */
uint32_t width; uint32_t width;
/** heigth of BMP (valid after _analyse) */ /** heigth of BMP (valid after _analyse) */
uint32_t height; uint32_t height;
/** whether the image has been decoded */ /** whether the image has been decoded */
bool decoded; bool decoded;
/** decoded image */ /** decoded image */
void *bitmap; void *bitmap;
/* Internal members are listed below */ /* Internal members are listed below */
/** total number of bytes of BMP data available */ /** total number of bytes of BMP data available */
uint32_t buffer_size; uint32_t buffer_size;
/** pixel encoding type */ /** pixel encoding type */
bmp_encoding encoding; bmp_encoding encoding;
/** offset of bitmap data */ /** offset of bitmap data */
uint32_t bitmap_offset; uint32_t bitmap_offset;
/** bits per pixel */ /** bits per pixel */
uint16_t bpp; uint16_t bpp;
/** number of colours */ /** number of colours */
uint32_t colours; uint32_t colours;
/** colour table */ /** colour table */
uint32_t *colour_table; uint32_t *colour_table;
/** whether to use bmp's limited transparency */ /** whether to use bmp's limited transparency */
bool limited_trans; bool limited_trans;
/** colour to display for "transparent" pixels when using limited /** colour to display for "transparent" pixels when using limited
* transparency * transparency
*/ */
uint32_t trans_colour; uint32_t trans_colour;
/** scanlines are top to bottom */ /** scanlines are top to bottom */
bool reversed; bool reversed;
/** image is part of an ICO, mask follows */ /** image is part of an ICO, mask follows */
bool ico; bool ico;
/** true if the bitmap does not contain an alpha channel */ /** true if the bitmap does not contain an alpha channel */
bool opaque; bool opaque;
/** four bitwise mask */ /** four bitwise mask */
uint32_t mask[4]; uint32_t mask[4];
/** four bitwise shifts */ /** four bitwise shifts */
int32_t shift[4]; int32_t shift[4];
/** colour representing "transparency" in the bitmap */ /** colour representing "transparency" in the bitmap */
uint32_t transparent_index; uint32_t transparent_index;
} bmp_image; } bmp_image;
typedef struct ico_image { typedef struct ico_image {
bmp_image bmp; bmp_image bmp;
struct ico_image *next; struct ico_image *next;
} ico_image; } ico_image;
/** /**
* icon image collection * icon image collection
*/ */
typedef struct ico_collection { typedef struct ico_collection {
/** callbacks for bitmap functions */ /** callbacks for bitmap functions */
bmp_bitmap_callback_vt bitmap_callbacks; bmp_bitmap_callback_vt bitmap_callbacks;
/** width of largest BMP */ /** width of largest BMP */
uint16_t width; uint16_t width;
/** heigth of largest BMP */ /** heigth of largest BMP */
uint16_t height; uint16_t height;
/* Internal members are listed below */ /* Internal members are listed below */
/** pointer to ICO data */ /** pointer to ICO data */
uint8_t *ico_data; uint8_t *ico_data;
/** total number of bytes of ICO data available */ /** total number of bytes of ICO data available */
uint32_t buffer_size; uint32_t buffer_size;
/** root of linked list of images */ /** root of linked list of images */
ico_image *first; ico_image *first;
} ico_collection; } ico_collection;
/** /**

View File

@ -13,15 +13,21 @@
#define _LIBNSBMP_LOG_H_ #define _LIBNSBMP_LOG_H_
#ifdef NDEBUG #ifdef NDEBUG
# define LOG(x) ((void) 0) #define LOG(x) ((void)0)
#else #else
# ifdef __GNUC__ #ifdef __GNUC__
# define LOG(x) do { printf x, fputc('\n', stdout)); } while (0) #define LOG(x) \
# elif defined(__CC_NORCROFT) do { printf x, fputc('\n', stdout)); \
# define LOG(x) do { printf x, fputc('\n', stdout)); } while (0) } while (0)
# else #elif defined(__CC_NORCROFT)
# define LOG(x) do { printf x, fputc('\n', stdout)); } while (0) #define LOG(x) \
# endif do { printf x, fputc('\n', stdout)); \
} while (0)
#else
#define LOG(x) \
do { printf x, fputc('\n', stdout)); \
} while (0)
#endif
#endif #endif
#endif #endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,40 @@
#include <renderd7/Color.hpp> #include <renderd7/Color.hpp>
#include <map>
#define RGBA8(r, g, b, a) \ #define RGBA8(r, g, b, a) \
((((r)&0xFF) << 0) | (((g)&0xFF) << 8) | (((b)&0xFF) << 16) | \ ((((r)&0xFF) << 0) | (((g)&0xFF) << 8) | (((b)&0xFF) << 16) | \
(((a)&0xFF) << 24)) (((a)&0xFF) << 24))
uint32_t RenderD7::Color::Hex(const std::string color, uint8_t a) { // uint32_t RenderD7::Color::Hex(const std::string &color, uint8_t a) {
// if (color.length() < 7 ||
// std::regex_search(color.substr(1),
// std::regex("[^0-9A-Fa-f]"))) { // invalid color.
// return RenderD7::Color::Hex("#000000", 0);
// }
// int r = std::stoi(color.substr(1, 2), nullptr, 16);
// int g = std::stoi(color.substr(3, 2), nullptr, 16);
// int b = std::stoi(color.substr(5, 2), nullptr, 16);
// return RGBA8(r, g, b, a);
// }
// Lookup-Table für Hex-to-Dez-Konvertierung
static const std::map<char, int> HEX_TO_DEC = {
{'0', 0}, {'1', 1}, {'2', 2}, {'3', 3}, {'4', 4}, {'5', 5},
{'6', 6}, {'7', 7}, {'8', 8}, {'9', 9}, {'a', 10}, {'b', 11},
{'c', 12}, {'d', 13}, {'e', 14}, {'f', 15}, {'A', 10}, {'B', 11},
{'C', 12}, {'D', 13}, {'E', 14}, {'F', 15}};
uint32_t RenderD7::Color::Hex(const std::string &color, uint8_t a) {
if (color.length() < 7 || if (color.length() < 7 ||
std::regex_search(color.substr(1), std::find_if(color.begin() + 1, color.end(),
std::regex("[^0-9A-Fa-f]"))) { // invalid color. [](char c) { return !std::isxdigit(c); }) != color.end()) {
return RenderD7::Color::Hex("#000000", 0); return RenderD7::Color::Hex("#000000", 0);
} }
int r = std::stoi(color.substr(1, 2), nullptr, 16);
int g = std::stoi(color.substr(3, 2), nullptr, 16); int r = HEX_TO_DEC.at(color[1]) * 16 + HEX_TO_DEC.at(color[2]);
int b = std::stoi(color.substr(5, 2), nullptr, 16); int g = HEX_TO_DEC.at(color[3]) * 16 + HEX_TO_DEC.at(color[4]);
int b = HEX_TO_DEC.at(color[5]) * 16 + HEX_TO_DEC.at(color[6]);
return RGBA8(r, g, b, a); return RGBA8(r, g, b, a);
} }

View File

@ -9,12 +9,13 @@
#include <filesystem> #include <filesystem>
std::vector<RenderD7::FileSystem::Entry> RenderD7::FileSystem::GetDirContent(std::string path) std::vector<RenderD7::FileSystem::Entry>
{ RenderD7::FileSystem::GetDirContent(std::string path) {
std::vector<RenderD7::FileSystem::Entry> res; std::vector<RenderD7::FileSystem::Entry> res;
for(const auto& entry : std::filesystem::directory_iterator(std::filesystem::path(path))) for (const auto &entry :
{ std::filesystem::directory_iterator(std::filesystem::path(path))) {
res.push_back({entry.path().string(), GetFileName(entry.path().string()), entry.is_directory()}); res.push_back({entry.path().string(), GetFileName(entry.path().string()),
entry.is_directory()});
} }
return res; return res;
} }

View File

@ -77,76 +77,82 @@ static bool C3DTexToC2DImage(C2D_Image *texture, u32 width, u32 height,
return false; return false;
} }
static void OLD_C3DTexToC2DImage(C3D_Tex *tex, Tex3DS_SubTexture *subtex, u8 *buf, u32 size, u32 width, u32 height, GPU_TEXCOLOR format) { static void OLD_C3DTexToC2DImage(C3D_Tex *tex, Tex3DS_SubTexture *subtex,
// RGBA -> ABGR u8 *buf, u32 size, u32 width, u32 height,
for (u32 row = 0; row < width; row++) { GPU_TEXCOLOR format) {
for (u32 col = 0; col < height; col++) { // RGBA -> ABGR
u32 z = (row + col * width) * 4; for (u32 row = 0; row < width; row++) {
for (u32 col = 0; col < height; col++) {
u32 z = (row + col * width) * 4;
u8 r = *(u8 *)(buf + z); u8 r = *(u8 *)(buf + z);
u8 g = *(u8 *)(buf + z + 1); u8 g = *(u8 *)(buf + z + 1);
u8 b = *(u8 *)(buf + z + 2); u8 b = *(u8 *)(buf + z + 2);
u8 a = *(u8 *)(buf + z + 3); u8 a = *(u8 *)(buf + z + 3);
*(buf + z) = a; *(buf + z) = a;
*(buf + z + 1) = b; *(buf + z + 1) = b;
*(buf + z + 2) = g; *(buf + z + 2) = g;
*(buf + z + 3) = r; *(buf + z + 3) = r;
} }
} }
u32 w_pow2 = GetNextPowerOf2(width); u32 w_pow2 = GetNextPowerOf2(width);
u32 h_pow2 = GetNextPowerOf2(height); u32 h_pow2 = GetNextPowerOf2(height);
subtex->width = (u16)width; subtex->width = (u16)width;
subtex->height = (u16)height; subtex->height = (u16)height;
subtex->left = 0.0f; subtex->left = 0.0f;
subtex->top = 1.0f; subtex->top = 1.0f;
subtex->right = (width / (float)w_pow2); subtex->right = (width / (float)w_pow2);
subtex->bottom = 1.0 - (height / (float)h_pow2); subtex->bottom = 1.0 - (height / (float)h_pow2);
C3D_TexInit(tex, (u16)w_pow2, (u16)h_pow2, format); C3D_TexInit(tex, (u16)w_pow2, (u16)h_pow2, format);
C3D_TexSetFilter(tex, GPU_NEAREST, GPU_NEAREST); C3D_TexSetFilter(tex, GPU_NEAREST, GPU_NEAREST);
u32 pixel_size = (size / width / height); u32 pixel_size = (size / width / height);
memset(tex->data, 0, tex->size); memset(tex->data, 0, tex->size);
for (u32 x = 0; x < width; x++) { for (u32 x = 0; x < width; x++) {
for (u32 y = 0; y < height; y++) { for (u32 y = 0; y < height; y++) {
u32 dst_pos = ((((y >> 3) * (w_pow2 >> 3) + (x >> 3)) << 6) + ((x & 1) | ((y & 1) << 1) | ((x & 2) << 1) | ((y & 2) << 2) | ((x & 4) << 2) | ((y & 4) << 3))) * pixel_size; u32 dst_pos = ((((y >> 3) * (w_pow2 >> 3) + (x >> 3)) << 6) +
u32 src_pos = (y * width + x) * pixel_size; ((x & 1) | ((y & 1) << 1) | ((x & 2) << 1) |
((y & 2) << 2) | ((x & 4) << 2) | ((y & 4) << 3))) *
pixel_size;
u32 src_pos = (y * width + x) * pixel_size;
memcpy(&((u8*)tex->data)[dst_pos], &((u8*)buf)[src_pos], pixel_size); memcpy(&((u8 *)tex->data)[dst_pos], &((u8 *)buf)[src_pos], pixel_size);
} }
} }
C3D_TexFlush(tex); C3D_TexFlush(tex);
tex->border = 0x00000000; tex->border = 0x00000000;
C3D_TexSetWrap(tex, GPU_CLAMP_TO_BORDER, GPU_CLAMP_TO_BORDER); C3D_TexSetWrap(tex, GPU_CLAMP_TO_BORDER, GPU_CLAMP_TO_BORDER);
linearFree(buf); linearFree(buf);
} }
bool IMG_LoadImageFile(C2D_Image *texture, const char *path) { bool IMG_LoadImageFile(C2D_Image *texture, const char *path) {
stbi_uc *image = NULL; stbi_uc *image = NULL;
int width = 0, height = 0; int width = 0, height = 0;
int nc; int nc;
image = stbi_load(path, &width, &height, &nc, 4); image = stbi_load(path, &width, &height, &nc, 4);
if (width > 1024 || height > 1024) { if (width > 1024 || height > 1024) {
stbi_image_free(image); stbi_image_free(image);
return false; return false;
} }
C3D_Tex *tex = new C3D_Tex; C3D_Tex *tex = new C3D_Tex;
Tex3DS_SubTexture *subtex = new Tex3DS_SubTexture; Tex3DS_SubTexture *subtex = new Tex3DS_SubTexture;
OLD_C3DTexToC2DImage(tex, subtex, image, (u32)(width * height * 4), (u32)width, (u32)height, GPU_RGBA8); OLD_C3DTexToC2DImage(tex, subtex, image, (u32)(width * height * 4),
texture->tex = tex; (u32)width, (u32)height, GPU_RGBA8);
texture->subtex = subtex; texture->tex = tex;
stbi_image_free(image); texture->subtex = subtex;
return true; stbi_image_free(image);
return true;
} }
extern "C" { extern "C" {

View File

@ -162,7 +162,7 @@ static std::map<int, std::string> descos = {
{47, "Invalid command header."}, {47, "Invalid command header."},
}; };
//Need to Fix The Range based Values // Need to Fix The Range based Values
static std::map<int, std::string> descfs = { static std::map<int, std::string> descfs = {
{101, "Archive not mounted or mount-point not found."}, {101, "Archive not mounted or mount-point not found."},
{120, "Title or object not found."}, {120, "Title or object not found."},
@ -262,9 +262,9 @@ static std::map<int, std::string> descmvd = {
static std::map<int, std::string> descqtm = { static std::map<int, std::string> descqtm = {
{8, "Camera is already in use or busy."}, {8, "Camera is already in use or busy."},
}; };
//Need to Fix The Range based Values // Need to Fix The Range based Values
static std::map<int, std::string> descapplication = { static std::map<int, std::string> descapplication = {
{0, "The application raised an error. Please consult the application's " {0, "The application raised an error. Please consult the application's "
"source code or ask the author for assistance with it."}, "source code or ask the author for assistance with it."},

View File

@ -432,7 +432,7 @@ Result RenderD7::Init::Main(std::string app_name) {
cfgfile = std::make_unique<INI::INIFile>(cfgpath + "/config.ini"); cfgfile = std::make_unique<INI::INIFile>(cfgpath + "/config.ini");
cfgfile->read(cfgstruct); cfgfile->read(cfgstruct);
std::string Fps = cfgstruct["settings"]["forceFrameRate"]; std::string Fps = cfgstruct["settings"]["forceFrameRate"];
C3D_FrameRate(RenderD7::Convert::StringtoFloat(Fps)); ////C3D_FrameRate(RenderD7::Convert::StringtoFloat(Fps));
metrikd = RenderD7::Convert::FloatToBool(RenderD7::Convert::StringtoFloat( metrikd = RenderD7::Convert::FloatToBool(RenderD7::Convert::StringtoFloat(
cfgstruct["metrik-settings"]["enableoverlay"])); cfgstruct["metrik-settings"]["enableoverlay"]));
mt_txtcolor = mt_txtcolor =
@ -547,7 +547,7 @@ Result RenderD7::Init::Minimal(std::string app_name) {
cfgfile = std::make_unique<INI::INIFile>(cfgpath + "/config.ini"); cfgfile = std::make_unique<INI::INIFile>(cfgpath + "/config.ini");
cfgfile->read(cfgstruct); cfgfile->read(cfgstruct);
std::string Fps = cfgstruct["settings"]["forceFrameRate"]; std::string Fps = cfgstruct["settings"]["forceFrameRate"];
C3D_FrameRate(RenderD7::Convert::StringtoFloat(Fps)); //C3D_FrameRate(RenderD7::Convert::StringtoFloat(Fps));
metrikd = RenderD7::Convert::FloatToBool(RenderD7::Convert::StringtoFloat( metrikd = RenderD7::Convert::FloatToBool(RenderD7::Convert::StringtoFloat(
cfgstruct["metrik-settings"]["enableoverlay"])); cfgstruct["metrik-settings"]["enableoverlay"]));
mt_txtcolor = mt_txtcolor =
@ -1020,9 +1020,8 @@ void RenderD7::RSettings::Draw(void) const {
RenderD7::OnScreen(Top); RenderD7::OnScreen(Top);
RenderD7::Draw::Rect(0, 21, 400, 220, RenderD7::Color::Hex("#eeeeee")); RenderD7::Draw::Rect(0, 21, 400, 220, RenderD7::Color::Hex("#eeeeee"));
RenderD7::Draw::Text(5, 30, 0.7f, DSEVENBLACK, RenderD7::Draw::Text(5, 30, 0.7f, DSEVENBLACK, std::string(CHANGELOG));
std::string(CHANGELOG));
RenderD7::Draw::Rect(0, 0, 400, 21, RenderD7::Color::Hex("#111111")); RenderD7::Draw::Rect(0, 0, 400, 21, RenderD7::Color::Hex("#111111"));
RenderD7::Draw::Text(0, 0, 0.7f, DSEVENWHITE, "RenderD7->Changelog"); RenderD7::Draw::Text(0, 0, 0.7f, DSEVENWHITE, "RenderD7->Changelog");
RenderD7::Draw::TextRight(400, 0, 0.7f, RenderD7::Color::Hex("#ffffff"), RenderD7::Draw::TextRight(400, 0, 0.7f, RenderD7::Color::Hex("#ffffff"),
@ -1030,7 +1029,8 @@ void RenderD7::RSettings::Draw(void) const {
RenderD7::OnScreen(Bottom); RenderD7::OnScreen(Bottom);
RenderD7::Draw::Rect(0, 0, 320, 240, RenderD7::Color::Hex("#eeeeee")); RenderD7::Draw::Rect(0, 0, 320, 240, RenderD7::Color::Hex("#eeeeee"));
RenderD7::Draw::Text(0, 0, 0.7f, RenderD7::Color::Hex("#111111"), RenderD7::Draw::Text(0, 0, 0.7f, RenderD7::Color::Hex("#111111"),
"Press B to Get back!\ntxty: " + std::to_string(txtposy)); "Press B to Get back!\ntxty: " +
std::to_string(txtposy));
} else if (m_state == RINFO) { } else if (m_state == RINFO) {
std::string rd7ver = RENDERD7VSTRING; std::string rd7ver = RENDERD7VSTRING;
@ -1103,8 +1103,8 @@ void RenderD7::RSettings::Logic(u32 hDown, u32 hHeld, u32 hUp,
if (d7_hDown & KEY_TOUCH && RenderD7::touchTObj(d7_touch, buttons[3]) && if (d7_hDown & KEY_TOUCH && RenderD7::touchTObj(d7_touch, buttons[3]) &&
!metrikd) { !metrikd) {
cfgstruct["settings"]["forceFrameRate"] = Kbd(2, SWKBD_TYPE_NUMPAD); cfgstruct["settings"]["forceFrameRate"] = Kbd(2, SWKBD_TYPE_NUMPAD);
C3D_FrameRate(RenderD7::Convert::StringtoFloat( //C3D_FrameRate(RenderD7::Convert::StringtoFloat(
cfgstruct["settings"]["forceFrameRate"])); //cfgstruct["settings"]["forceFrameRate"]));
} }
if (d7_hDown & KEY_TOUCH && RenderD7::touchTObj(d7_touch, buttons[4])) { if (d7_hDown & KEY_TOUCH && RenderD7::touchTObj(d7_touch, buttons[4])) {
mt_screen = mt_screen ? 0 : 1; mt_screen = mt_screen ? 0 : 1;

View File

@ -1,11 +1,10 @@
//rd7cc // rd7cc
#include <iostream>
#include <fstream> #include <fstream>
int main(int argc, char* argv[]) #include <iostream>
{ int main(int argc, char *argv[]) {
std::ofstream result ("result.hpp"); std::ofstream result("result.hpp");
result << "//Result" << std::endl; result << "//Result" << std::endl;
result.close(); result.close();
} }