FastColor/RemoveFPSCheat/LLVM-Style

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

View File

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

View File

@ -26,6 +26,6 @@ public:
uint8_t m_r, m_g, m_b, m_a;
};
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 RenderD7

View File

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

View File

@ -2,7 +2,6 @@
#include <sstream>
#include <string>
namespace RenderD7 {
class StealConsole {
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_CloseArchive(FS_Archive archive);
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_CreateFile(FS_Archive archive, const char *path, u64 size);
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_RemoveDir(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_RenameDir(FS_Archive archive, const char *old_dirname, const char *new_dirname);
Result FS_RenameFile(FS_Archive archive, const char *old_filename,
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_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);
Result makeDirs(const char * path);
Result openFile(Handle* fileHandle, const char * path, bool write);
Result makeDirs(const char *path);
Result openFile(Handle *fileHandle, const char *path, bool write);

View File

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

View File

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