mirror of
https://github.com/encounter/Decrypt9.git
synced 2026-03-30 11:06:30 -07:00
0d7b5c92aa
debugfs.c is a wrapper to some fs.c functions, that includes error checking and output messages.
45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
#include "fs.h"
|
|
#include "draw.h"
|
|
|
|
bool DebugFileOpen(const char* path) {
|
|
Debug("Opening %s ...", path);
|
|
if (!FileOpen(path)) {
|
|
Debug("Could not open %s!", path);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool DebugFileCreate(const char* path, bool truncate) {
|
|
Debug("Creating %s ...", path);
|
|
if (!FileCreate(path, truncate)) {
|
|
Debug("Could not create %s!", path);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool DebugFileRead(void* buf, size_t size, size_t foffset) {
|
|
size_t bytesRead = FileRead(buf, size, foffset);
|
|
if(bytesRead != size) {
|
|
Debug("ERROR, file is too small!");
|
|
FileClose(); // <- need to keep this in mind!
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool DebugFileWrite(void* buf, size_t size, size_t foffset) {
|
|
size_t bytesWritten = FileWrite(buf, size, foffset);
|
|
if(bytesWritten != size) {
|
|
Debug("ERROR, SD card may be full!");
|
|
FileClose(); // <- need to keep this in mind!
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|