DS: Fix UI sort of to work

This commit is contained in:
UnknownShadow200 2024-03-22 23:55:17 +11:00
parent 6d8a0fb933
commit 526bd40646
2 changed files with 22 additions and 9 deletions

View File

@ -27,6 +27,8 @@ void Gfx_Create(void) {
glViewport(0, 0, 255, 191); glViewport(0, 0, 255, 191);
vramSetBankA(VRAM_A_TEXTURE); vramSetBankA(VRAM_A_TEXTURE);
vramSetBankB(VRAM_B_TEXTURE);
vramSetBankC(VRAM_C_TEXTURE);
// setup memory for textures // setup memory for textures
glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
@ -168,6 +170,8 @@ void Gfx_CalcOrthoMatrix(struct Matrix* matrix, float width, float height, float
/* Transposed, source https://learn.microsoft.com/en-us/windows/win32/opengl/glortho */ /* Transposed, source https://learn.microsoft.com/en-us/windows/win32/opengl/glortho */
/* The simplified calculation below uses: L = 0, R = width, T = 0, B = height */ /* The simplified calculation below uses: L = 0, R = width, T = 0, B = height */
*matrix = Matrix_Identity; *matrix = Matrix_Identity;
width /= 32.0f;
height /= 32.0f;
matrix->row1.x = 2.0f / width; matrix->row1.x = 2.0f / width;
matrix->row2.y = -2.0f / height; matrix->row2.y = -2.0f / height;
@ -224,9 +228,9 @@ static void PreprocessTexturedVertices(void) {
for (int i = 0; i < buf_count; i++, src++, dst++) for (int i = 0; i < buf_count; i++, src++, dst++)
{ {
struct VertexTextured v = *src; struct VertexTextured v = *src;
dst->x = floattov16(v.x / 16.0f); dst->x = floattov16(v.x / 32.0f);
dst->y = floattov16(v.y / 16.0f); dst->y = floattov16(v.y / 32.0f);
dst->z = floattov16(v.z / 16.0f); dst->z = floattov16(v.z / 32.0f);
dst->u = v.U; dst->u = v.U;
dst->v = v.V; dst->v = v.V;
dst->r = PackedCol_R(v.Col); dst->r = PackedCol_R(v.Col);
@ -242,9 +246,9 @@ static void PreprocessColouredVertices(void) {
for (int i = 0; i < buf_count; i++, src++, dst++) for (int i = 0; i < buf_count; i++, src++, dst++)
{ {
struct VertexColoured v = *src; struct VertexColoured v = *src;
dst->x = floattov16(v.x / 16.0f); dst->x = floattov16(v.x / 32.0f);
dst->y = floattov16(v.y / 16.0f); dst->y = floattov16(v.y / 32.0f);
dst->z = floattov16(v.z / 16.0f); dst->z = floattov16(v.z / 32.0f);
dst->r = PackedCol_R(v.Col); dst->r = PackedCol_R(v.Col);
dst->g = PackedCol_G(v.Col); dst->g = PackedCol_G(v.Col);
dst->b = PackedCol_B(v.Col); dst->b = PackedCol_B(v.Col);
@ -355,7 +359,7 @@ void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) {
// That's way too small to be useful, so counteract that by scaling down // That's way too small to be useful, so counteract that by scaling down
// vertices and then scaling up the matrix multiplication // vertices and then scaling up the matrix multiplication
if (type == MATRIX_VIEW) if (type == MATRIX_VIEW)
glScalef32(floattof32(16.0f), floattof32(16.0f), floattof32(16.0f)); glScalef32(floattof32(32.0f), floattof32(32.0f), floattof32(32.0f));
} }
void Gfx_LoadIdentityMatrix(MatrixType type) { void Gfx_LoadIdentityMatrix(MatrixType type) {

View File

@ -94,11 +94,20 @@ static void GetNativePath(char* str, const cc_string* path) {
} }
cc_result Directory_Create(const cc_string* path) { cc_result Directory_Create(const cc_string* path) {
return ERR_NOT_SUPPORTED; if (!fat_available) return ENOSYS;
char str[NATIVE_STR_LEN];
GetNativePath(str, path);
return mkdir(str, 0) == -1 ? errno : 0;
} }
int File_Exists(const cc_string* path) { int File_Exists(const cc_string* path) {
return false; if (!fat_available) return false;
char str[NATIVE_STR_LEN];
struct stat sb;
GetNativePath(str, path);
return stat(str, &sb) == 0 && S_ISREG(sb.st_mode);
} }
cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCallback callback) { cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCallback callback) {