Dreamcast: Reduce error spam and fix some long error messages being cutoff

This commit is contained in:
UnknownShadow200 2024-01-26 18:49:58 +11:00
parent 57bba753f6
commit b8a7305bb1
2 changed files with 16 additions and 5 deletions

View file

@ -17,10 +17,12 @@ static cc_bool renderingDisabled;
*#########################################################################################################################*/
void Gfx_Create(void) {
if (!Gfx.Created) glKosInit();
// NOTE: technically 1024 is supported by hardware
Gfx.MaxTexWidth = 512;
Gfx.MaxTexHeight = 512;
Gfx.MaxTexWidth = 1024;
Gfx.MaxTexHeight = 1024;
Gfx.MaxTexSize = 512 * 512; // reasonable cap as Dreamcast only has 8MB VRAM
Gfx.Created = true;
Gfx_RestoreState();
}

View file

@ -108,6 +108,9 @@ cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCall
cc_string path; char pathBuffer[FILENAME_SIZE];
char str[NATIVE_STR_LEN];
int res;
// CD filesystem loader doesn't usually set errno
// when it can't find the requested file
errno = 0;
GetNativePath(str, dirPath);
int fd = fs_open(str, O_DIR | O_RDONLY);
@ -147,10 +150,16 @@ cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCall
static cc_result File_Do(cc_file* file, const cc_string* path, int mode) {
char str[NATIVE_STR_LEN];
GetNativePath(str, path);
// CD filesystem loader doesn't usually set errno
// when it can't find the requested file
errno = 0;
int res = fs_open(str, mode);
*file = res;
return res == -1 ? errno : 0;
int err = res == -1 ? errno : 0;
if (res == -1 && err == 0) err = ENOENT;
return err;
}
cc_result File_Open(cc_file* file, const cc_string* path) {