RenderD7 0.8.2

This commit is contained in:
2022-11-18 20:57:05 +01:00
parent bbbfd60bb7
commit 6b48ba070c
9 changed files with 150 additions and 430 deletions

View File

@ -4,102 +4,14 @@
#include <string>
#include <vector>
#include <physfs.h>
#define RD7_FSYS_GETINFO(path) \
({ \
RenderD7::FileSystem::Info inf; \
RenderD7::FileSystem::GetInfo(path, inf); \
inf; \
})
namespace RenderD7 {
namespace FileSystem {
static constexpr auto MAX_STAMP = 0x20000000000000LL;
enum FileMode { FileMode_Open, FileMode_Read, FileMode_Write, FileMode_Closed };
enum FileType {
FileType_File,
FileType_Directory,
FileType_SymLink,
FileType_Other
struct Entry {
std::string path;
std::string name;
bool dir = false;
};
struct File {
PHYSFS_file *handle;
FileMode mode;
File() {
this->handle = nullptr;
this->mode = FileMode_Closed;
}
int64_t GetSize() {
if (this->handle == nullptr)
return 0;
return (int64_t)PHYSFS_fileLength(this->handle);
}
};
struct Info {
int64_t size;
int64_t mod_time;
FileType type;
};
int Init(const char *argv);
void Initialize();
/*
** mounts a specific directory for physfs to search in
** this is typically a main directory
*/
bool SetSource(const char *source);
/*
** mounts a specific directory as a "save" directory
** if appended, it will be added to the search path
*/
bool SetIdentity(const char *name, bool append);
static std::string savePath;
/* gets the last physfs error */
const char *GetPhysfsError();
/* strips any duplicate slashes */
std::string Normalize(const std::string &input);
/* gets the user directory from physfs */
std::string GetUserDirectory();
/* gets the save directory */
std::string GetSaveDirectory();
/* sets up the writing directory for physfs */
bool SetupWriteDirectory();
/* gets a list of files in a directory */
void GetDirectoryItems(const char *directory, std::vector<std::string> &items);
/* gets the size, mod_time, and type of a file */
bool GetInfo(const char *filename, Info &info);
/* creates a new directory */
bool CreateDirectory(const char *name);
bool CloseFile(File &file);
/* creates a new file */
bool OpenFile(File &file, const char *name, FileMode mode);
/* writes to a file */
bool WriteFile(File &file, const void *data, int64_t size);
/* reads a file's content */
int64_t ReadFile(File &file, void *destination, int64_t size);
std::vector<RenderD7::FileSystem::Entry> GetDirContent(std::string path);
} // namespace FileSystem
} // namespace RenderD7

View File

@ -27,6 +27,7 @@ public:
/// \param buffer the frame buffer
void LoadPFromBuffer(const std::vector<u8> &buffer);
void LoadFromBitmap(BMP bitmap);
void LoadJpg(std::string path);
/// Draw the Image directly
/// \param x The x position
/// \param y the y position

View File

@ -46,9 +46,10 @@ extern "C" {
#include <renderd7/external/fs.h>
}
#define RENDERD7VSTRING "0.8.1"
#define RENDERD7VSTRING "0.8.2"
#define CHANGELOG \
"0.8.1: Add abillity to Get Stdout as string to render it to the " \
"0.8.2: Fix a lot of Stuff and add c++17 based filesystem class.\n0.8.1: " \
"Add abillity to Get Stdout as string to render it to the " \
"screen.\n0.8.0: Implement BitmapPrinter\n0.7.3: Implement Over Render " \
"Overlay " \
"Framework\n0.7.2: Implement MT to csv file saving. Add RGB2HEX. \n0.7.1: " \