mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 17:12:25 -05:00
DS: Show message if can't mount filesystem
This commit is contained in:
parent
3e2b0ea9d4
commit
f5b7e1b891
6 changed files with 68 additions and 80 deletions
|
@ -18,16 +18,16 @@
|
|||
! FR10 = invT
|
||||
! FR11 = t
|
||||
|
||||
#define TM1 r0
|
||||
#define TM2 r4
|
||||
#define CLO r5
|
||||
#define TM1 r0 // CLOBBERED, temp register 1
|
||||
#define TM2 r4 // PRESERVED, temp register 2
|
||||
#define CLO r5 // PRESERVED, output colour
|
||||
|
||||
#define IN1 r1
|
||||
#define IN2 r2
|
||||
#define OUT r3
|
||||
#define IN1 r1 // CLOBBERED, input vertex 1
|
||||
#define IN2 r2 // CLOBBERED, input vertex 2
|
||||
#define OUT r3 // CLOBBERED, output vertex
|
||||
|
||||
#define CL1 r1
|
||||
#define CL2 r2
|
||||
#define CL1 r1 // CLOBBERED, input colour 1
|
||||
#define CL2 r2 // CLOBBERED, input colour 2
|
||||
|
||||
! Calculates the near plane intersection point between two points:
|
||||
! float t = fabsf(v1->z) / fabsf(v2->z - v1->z)
|
||||
|
@ -127,7 +127,7 @@ _ClipLine:
|
|||
cmp/eq CL1,CL2 ! MT, T = ACOLOR == BCOLOR
|
||||
bt.s 1f ! BR, if (T) goto 1;
|
||||
mov CL1,CLO ! MT, OUTCOLOR = ACOLOR (branch delay instruction)
|
||||
|
||||
! Interpolate B
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.b
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
|
@ -139,7 +139,7 @@ _ClipLine:
|
|||
ftrc fr3,fpul ! FE, FPUL = int(lerp)
|
||||
shlr8 CL2 ! EX, BCOLOR >>= 8
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
|
||||
! Interpolate G
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.g
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
|
@ -153,22 +153,7 @@ _ClipLine:
|
|||
mov TM2,CLO ! MT, OUTCOLOR.b = tmp
|
||||
shlr8 CL2 ! EX, BCOLOR >>= 8
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.b
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
extu.b CL2,TM1 ! EX, val = BCOLOR.b
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr3 ! EX, fr3 = float(FPUL)
|
||||
fipr fv8, fv0 ! FE, LERP(A1, B1)
|
||||
shlr8 CL1 ! EX, ACOLOR >>= 8
|
||||
ftrc fr3,fpul ! FE, FPUL = int(lerp)
|
||||
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
|
||||
shll8 TM2 ! EX, tmp <<= 8
|
||||
or TM2,CLO ! EX, OUTCOLOR.r |= tmp
|
||||
shlr8 CL2 ! EX, BCOLOR >>= 8
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
|
||||
! Interpolate R
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.r
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
|
@ -176,10 +161,25 @@ _ClipLine:
|
|||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr3 ! EX, fr3 = float(FPUL)
|
||||
fipr fv8, fv0 ! FE, LERP(A1, B1)
|
||||
shlr8 CL1 ! EX, ACOLOR >>= 8
|
||||
ftrc fr3,fpul ! FE, FPUL = int(lerp)
|
||||
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
|
||||
shll8 TM2 ! EX, tmp <<= 8
|
||||
or TM2,CLO ! EX, OUTCOLOR.g |= tmp
|
||||
shlr8 CL2 ! EX, BCOLOR >>= 8
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
! Interpolate A
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.a
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
extu.b CL2,TM1 ! EX, val = BCOLOR.a
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr3 ! EX, fr3 = float(FPUL)
|
||||
fipr fv8, fv0 ! FE, LERP(A1, B1)
|
||||
ftrc fr3,fpul ! FE, FPUL = int(lerp)
|
||||
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
|
||||
shll16 TM2 ! EX, tmp <<= 16
|
||||
or TM2,CLO ! EX, OUTCOLOR.g |= tmp
|
||||
or TM2,CLO ! EX, OUTCOLOR.r |= tmp
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
|
||||
shll16 TM2 ! EX, tmp <<= 16
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
! r1 CLOBBERS
|
||||
! r3 CLOBBERS
|
||||
! r7 CLOBBERS
|
||||
! r4 = v1
|
||||
! r5 = v2
|
||||
! r6 = OUT
|
||||
|
||||
! FR0 = 0
|
||||
! FR1 = 0
|
||||
! FR2 = A.1
|
||||
|
@ -18,16 +11,16 @@
|
|||
! FR10 = invT
|
||||
! FR11 = t
|
||||
|
||||
#define TM1 r1
|
||||
#define TM2 r3
|
||||
#define TM1 r1 // temp register 1
|
||||
#define TM2 r3 // temp register 2
|
||||
|
||||
#define IN1 r4
|
||||
#define IN2 r5
|
||||
#define OUT r6
|
||||
#define IN1 r4 // input vertex 1
|
||||
#define IN2 r5 // input vertex 2
|
||||
#define OUT r6 // output vertex
|
||||
|
||||
#define CL1 r4
|
||||
#define CL2 r5
|
||||
#define CLO r7
|
||||
#define CL1 r4 // input colour 1
|
||||
#define CL2 r5 // input colour 2
|
||||
#define CLO r7 // output colour
|
||||
|
||||
! Calculates the near plane intersection point between two points:
|
||||
! float t = fabsf(v1->z) / fabsf(v2->z - v1->z)
|
||||
|
@ -121,11 +114,11 @@ _ClipEdge:
|
|||
|
||||
mov.l @IN1,CL1 ! LS, ACOLOR = v1->bgra
|
||||
mov.l @IN2,CL2 ! LS, BCOLOR = v2->bgra
|
||||
! Bypass interpolation if unnecessary
|
||||
! Bypass RGBA interpolation if unnecessary
|
||||
cmp/eq CL1,CL2 ! MT, T = ACOLOR == BCOLOR
|
||||
bt.s 1f ! BR, if (T) goto 1;
|
||||
mov CL1,CLO ! MT, OUTCOLOR = ACOLOR (branch delay instruction)
|
||||
|
||||
! Interpolate B
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.b
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
|
@ -137,7 +130,7 @@ _ClipEdge:
|
|||
ftrc fr3,fpul ! FE, FPUL = int(lerp)
|
||||
shlr8 CL2 ! EX, BCOLOR >>= 8
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
|
||||
! Interpolate G
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.g
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
|
@ -151,22 +144,7 @@ _ClipEdge:
|
|||
mov TM2,CLO ! MT, OUTCOLOR.b = tmp
|
||||
shlr8 CL2 ! EX, BCOLOR >>= 8
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.b
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
extu.b CL2,TM1 ! EX, val = BCOLOR.b
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr3 ! EX, fr3 = float(FPUL)
|
||||
fipr fv8, fv0 ! FE, LERP(A1, B1)
|
||||
shlr8 CL1 ! EX, ACOLOR >>= 8
|
||||
ftrc fr3,fpul ! FE, FPUL = int(lerp)
|
||||
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
|
||||
shll8 TM2 ! EX, tmp <<= 8
|
||||
or TM2,CLO ! EX, OUTCOLOR.r |= tmp
|
||||
shlr8 CL2 ! EX, BCOLOR >>= 8
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
|
||||
! Interpolate R
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.r
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
|
@ -174,10 +152,25 @@ _ClipEdge:
|
|||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr3 ! EX, fr3 = float(FPUL)
|
||||
fipr fv8, fv0 ! FE, LERP(A1, B1)
|
||||
shlr8 CL1 ! EX, ACOLOR >>= 8
|
||||
ftrc fr3,fpul ! FE, FPUL = int(lerp)
|
||||
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
|
||||
shll8 TM2 ! EX, tmp <<= 8
|
||||
or TM2,CLO ! EX, OUTCOLOR.g |= tmp
|
||||
shlr8 CL2 ! EX, BCOLOR >>= 8
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
|
||||
extu.b CL1,TM1 ! EX, val = ACOLOR.a
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr2 ! EX, fr2 = float(FPUL)
|
||||
extu.b CL2,TM1 ! EX, val = BCOLOR.a
|
||||
lds TM1,fpul ! CO, FPUL = val
|
||||
float fpul,fr3 ! EX, fr3 = float(FPUL)
|
||||
fipr fv8, fv0 ! FE, LERP(A1, B1)
|
||||
ftrc fr3,fpul ! FE, FPUL = int(lerp)
|
||||
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
|
||||
shll16 TM2 ! EX, tmp <<= 16
|
||||
or TM2,CLO ! EX, OUTCOLOR.g |= tmp
|
||||
or TM2,CLO ! EX, OUTCOLOR.r |= tmp
|
||||
sts fpul,TM2 ! CO, tmp = FPUL
|
||||
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
|
||||
shll16 TM2 ! EX, tmp <<= 16
|
||||
|
|
|
@ -111,6 +111,7 @@ void DateTime_CurrentLocal(struct DateTime* t) {
|
|||
*#########################################################################################################################*/
|
||||
static cc_string root_path = String_FromConst("fat:/"); // may be overriden in InitFilesystem
|
||||
static bool fat_available;
|
||||
static int fat_error;
|
||||
|
||||
void Platform_EncodePath(cc_filepath* dst, const cc_string* path) {
|
||||
char* str = dst->buffer;
|
||||
|
@ -225,7 +226,9 @@ cc_result File_Length(cc_file file, cc_uint32* len) {
|
|||
}
|
||||
|
||||
static int LoadFatFilesystem(void* arg) {
|
||||
errno = 0;
|
||||
fat_available = fatInitDefault();
|
||||
fat_error = errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -254,7 +257,10 @@ static void InitFilesystem(void) {
|
|||
root_path.buffer = dir;
|
||||
root_path.length = String_Length(dir);
|
||||
}
|
||||
|
||||
Platform_ReadonlyFilesystem = !fat_available;
|
||||
if (fat_available) return;
|
||||
Platform_Log1("** FAILED TO MOUNT FILESYSTEM (error %i) **", &fat_error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -400,20 +406,22 @@ void Socket_Close(cc_socket s) {
|
|||
closesocket(s);
|
||||
}
|
||||
|
||||
// libogc only implements net_select for gamecube currently
|
||||
static cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) {
|
||||
fd_set set;
|
||||
struct timeval time = { 0 };
|
||||
int res; // number of 'ready' sockets
|
||||
FD_ZERO(&set);
|
||||
FD_SET(s, &set);
|
||||
|
||||
if (mode == SOCKET_POLL_READ) {
|
||||
res = select(s + 1, &set, NULL, NULL, &time);
|
||||
} else {
|
||||
res = select(s + 1, NULL, &set, NULL, &time);
|
||||
}
|
||||
|
||||
if (res < 0) { *success = false; return errno; }
|
||||
*success = FD_ISSET(s, &set) != 0; return 0;
|
||||
*success = FD_ISSET(s, &set) != 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
cc_result Socket_CheckReadable(cc_socket s, cc_bool* readable) {
|
||||
|
|
10
third_party/gldc/src/gldc.h
vendored
10
third_party/gldc/src/gldc.h
vendored
|
@ -56,16 +56,6 @@ typedef struct {
|
|||
//20
|
||||
GLushort width;
|
||||
GLushort height;
|
||||
// 24
|
||||
GLushort mipmap; /* Bitmask of supplied mipmap levels */
|
||||
// 26
|
||||
GLubyte mipmap_bias;
|
||||
GLubyte _pad3;
|
||||
// 28
|
||||
GLushort _pad0;
|
||||
// 30
|
||||
GLubyte _pad1;
|
||||
GLubyte _pad2;
|
||||
} __attribute__((aligned(32))) TextureObject;
|
||||
|
||||
|
||||
|
|
6
third_party/gldc/src/state.c
vendored
6
third_party/gldc/src/state.c
vendored
|
@ -77,6 +77,7 @@ static inline int DimensionFlag(int w) {
|
|||
}
|
||||
}
|
||||
|
||||
#define DEFAULT_MIPMAP_BIAS 4
|
||||
void apply_poly_header(pvr_poly_hdr_t* dst, int list_type) {
|
||||
TextureObject* tx1 = TEXTURE_ACTIVE;
|
||||
|
||||
|
@ -145,14 +146,13 @@ void apply_poly_header(pvr_poly_hdr_t* dst, int list_type) {
|
|||
|
||||
dst->mode2 |= (txr_alpha << PVR_TA_PM2_TXRALPHA_SHIFT) & PVR_TA_PM2_TXRALPHA_MASK;
|
||||
dst->mode2 |= (filter << PVR_TA_PM2_FILTER_SHIFT) & PVR_TA_PM2_FILTER_MASK;
|
||||
dst->mode2 |= (tx1->mipmap_bias << PVR_TA_PM2_MIPBIAS_SHIFT) & PVR_TA_PM2_MIPBIAS_MASK;
|
||||
dst->mode2 |= (DEFAULT_MIPMAP_BIAS << PVR_TA_PM2_MIPBIAS_SHIFT) & PVR_TA_PM2_MIPBIAS_MASK;
|
||||
dst->mode2 |= (PVR_TXRENV_MODULATEALPHA << PVR_TA_PM2_TXRENV_SHIFT) & PVR_TA_PM2_TXRENV_MASK;
|
||||
|
||||
dst->mode2 |= (DimensionFlag(tx1->width) << PVR_TA_PM2_USIZE_SHIFT) & PVR_TA_PM2_USIZE_MASK;
|
||||
dst->mode2 |= (DimensionFlag(tx1->height) << PVR_TA_PM2_VSIZE_SHIFT) & PVR_TA_PM2_VSIZE_MASK;
|
||||
|
||||
dst->mode3 = (0 << PVR_TA_PM3_MIPMAP_SHIFT) & PVR_TA_PM3_MIPMAP_MASK;
|
||||
dst->mode3 |= (tx1->color << PVR_TA_PM3_TXRFMT_SHIFT) & PVR_TA_PM3_TXRFMT_MASK;
|
||||
dst->mode3 = (tx1->color << PVR_TA_PM3_TXRFMT_SHIFT) & PVR_TA_PM3_TXRFMT_MASK;
|
||||
dst->mode3 |= ((uint32_t)tx1->data & 0x00fffff8) >> 3;
|
||||
}
|
||||
|
||||
|
|
3
third_party/gldc/src/texture.c
vendored
3
third_party/gldc/src/texture.c
vendored
|
@ -86,15 +86,12 @@ static void* yalloc_alloc_and_defrag(size_t size) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define GL_KOS_INTERNAL_DEFAULT_MIPMAP_LOD_BIAS 4
|
||||
static void _glInitializeTextureObject(TextureObject* txr, unsigned int id) {
|
||||
txr->index = id;
|
||||
txr->width = txr->height = 0;
|
||||
txr->mipmap = 0;
|
||||
txr->data = NULL;
|
||||
txr->minFilter = GL_NEAREST;
|
||||
txr->magFilter = GL_NEAREST;
|
||||
txr->mipmap_bias = GL_KOS_INTERNAL_DEFAULT_MIPMAP_LOD_BIAS;
|
||||
}
|
||||
|
||||
void _glInitTextures() {
|
||||
|
|
Loading…
Reference in a new issue