mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 17:47:12 -04:00
3DS: Fix down/up being swapped (Thanks Pear), remove spammy 'draw framebuffer' log message, also log whether creating root directories succeeds or not
This commit is contained in:
parent
e76fb5e95f
commit
205b7c97ec
@ -32,7 +32,7 @@ CC_API double Math_Sin(double x);
|
|||||||
CC_API double Math_Cos(double x);
|
CC_API double Math_Cos(double x);
|
||||||
float Math_SinF(float x);
|
float Math_SinF(float x);
|
||||||
float Math_CosF(float x);
|
float Math_CosF(float x);
|
||||||
double Math_Atan2(double x, double y);\
|
double Math_Atan2(double x, double y);
|
||||||
|
|
||||||
/* Computes loge(x). Can also be used to approximate logy(x). */
|
/* Computes loge(x). Can also be used to approximate logy(x). */
|
||||||
/* e.g. for log3(x), use: Math_Log(x)/log(3) */
|
/* e.g. for log3(x), use: Math_Log(x)/log(3) */
|
||||||
|
@ -81,7 +81,7 @@ static void CreateD3D9Instance(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void FindCompatibleViewFormat(void) {
|
static void FindCompatibleViewFormat(void) {
|
||||||
static const D3DFORMAT formats[4] = { D3DFMT_X8R8G8B8, D3DFMT_R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
|
static const D3DFORMAT formats[] = { D3DFMT_X8R8G8B8, D3DFMT_R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
|
||||||
cc_result res;
|
cc_result res;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ static void FindCompatibleViewFormat(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void FindCompatibleDepthFormat(void) {
|
static void FindCompatibleDepthFormat(void) {
|
||||||
static const D3DFORMAT formats[6] = { D3DFMT_D32, D3DFMT_D24X8, D3DFMT_D24S8, D3DFMT_D24X4S4, D3DFMT_D16, D3DFMT_D15S1 };
|
static const D3DFORMAT formats[] = { D3DFMT_D32, D3DFMT_D24X8, D3DFMT_D24S8, D3DFMT_D24X4S4, D3DFMT_D16, D3DFMT_D15S1 };
|
||||||
cc_result res;
|
cc_result res;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -187,9 +187,12 @@ static cc_result File_Do(cc_file* file, const cc_string* path, int mode) {
|
|||||||
char str[NATIVE_STR_LEN];
|
char str[NATIVE_STR_LEN];
|
||||||
GetNativePath(str, path);
|
GetNativePath(str, path);
|
||||||
|
|
||||||
Platform_Log1("Opening file: %c", str);
|
|
||||||
*file = open(str, mode, 0666); // FS has no permissions anyways
|
*file = open(str, mode, 0666); // FS has no permissions anyways
|
||||||
return *file == -1 ? errno : 0;
|
//return *file == -1 ? errno : 0;
|
||||||
|
|
||||||
|
int ERR = *file == -1 ? errno : 0;
|
||||||
|
Platform_Log2("Open %s = %i", path, &ERR);
|
||||||
|
return ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result File_Open(cc_file* file, const cc_string* path) {
|
cc_result File_Open(cc_file* file, const cc_string* path) {
|
||||||
@ -518,13 +521,21 @@ cc_bool DynamicLib_DescribeError(cc_string* dst) {
|
|||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
#define SOC_CTX_ALIGN 0x1000
|
#define SOC_CTX_ALIGN 0x1000
|
||||||
#define SOC_CTX_SIZE 0x1000 * 128
|
#define SOC_CTX_SIZE 0x1000 * 128
|
||||||
|
static void CreateRootDirectory(const char* path) {
|
||||||
|
// create root directories (no permissions anyways)
|
||||||
|
int res = mkdir(path, 0666);
|
||||||
|
if (res >= 0) return;
|
||||||
|
|
||||||
|
int err = errno;
|
||||||
|
Platform_Log2("mkdir %c FAILED: %i", path, &err);
|
||||||
|
}
|
||||||
|
|
||||||
void Platform_Init(void) {
|
void Platform_Init(void) {
|
||||||
Platform_SingleProcess = true;
|
Platform_SingleProcess = true;
|
||||||
|
|
||||||
// create root directories (no permissions anyways)
|
// create root directories (no permissions anyways)
|
||||||
mkdir("sdmc://3ds", 0666);
|
CreateRootDirectory("sdmc://3ds");
|
||||||
mkdir("sdmc://3ds/ClassiCube", 0666);
|
CreateRootDirectory("sdmc://3ds/ClassiCube");
|
||||||
|
|
||||||
// See https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/services/soc.h
|
// See https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/services/soc.h
|
||||||
// * @param context_addr Address of a page-aligned (0x1000) buffer to be used.
|
// * @param context_addr Address of a page-aligned (0x1000) buffer to be used.
|
||||||
|
@ -194,6 +194,7 @@ static int iLog(int x) {
|
|||||||
return bits;
|
return bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* https://en.wikipedia.org/wiki/Single-precision_floating-point_format */
|
||||||
/* Float consists of: */
|
/* Float consists of: */
|
||||||
/* - 1 bit for sign */
|
/* - 1 bit for sign */
|
||||||
/* - 8 bits for biased exponent */
|
/* - 8 bits for biased exponent */
|
||||||
|
@ -88,10 +88,11 @@ void Window_ProcessEvents(double delta) {
|
|||||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_RIGHT], mods & KEY_DRIGHT);
|
Input_SetNonRepeatable(KeyBinds[KEYBIND_RIGHT], mods & KEY_DRIGHT);
|
||||||
Input_SetNonRepeatable(IPT_RIGHT, mods & KEY_DRIGHT);
|
Input_SetNonRepeatable(IPT_RIGHT, mods & KEY_DRIGHT);
|
||||||
|
|
||||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_FORWARD], mods & KEY_DUP);
|
// NOTE: KEY_DUP and KEY_DDOWN are deliberately swapped here
|
||||||
Input_SetNonRepeatable(IPT_UP, mods & KEY_DUP);
|
Input_SetNonRepeatable(KeyBinds[KEYBIND_FORWARD], mods & KEY_DDOWN);
|
||||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_BACK], mods & KEY_DDOWN);
|
Input_SetNonRepeatable(IPT_UP, mods & KEY_DDOWN);
|
||||||
Input_SetNonRepeatable(IPT_DOWN, mods & KEY_DDOWN);
|
Input_SetNonRepeatable(KeyBinds[KEYBIND_BACK], mods & KEY_DUP);
|
||||||
|
Input_SetNonRepeatable(IPT_DOWN, mods & KEY_DUP);
|
||||||
|
|
||||||
if (hidKeysHeld() & KEY_TOUCH) {
|
if (hidKeysHeld() & KEY_TOUCH) {
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -155,7 +156,6 @@ void Window_DrawFramebuffer(Rect2D r) {
|
|||||||
}
|
}
|
||||||
// TODO implement
|
// TODO implement
|
||||||
// TODO gspWaitForVBlank();
|
// TODO gspWaitForVBlank();
|
||||||
Platform_LogConst("DRAW FB!!!");
|
|
||||||
gfxFlushBuffers();
|
gfxFlushBuffers();
|
||||||
//gfxSwapBuffers();
|
//gfxSwapBuffers();
|
||||||
// TODO: tearing??
|
// TODO: tearing??
|
||||||
|
Loading…
x
Reference in New Issue
Block a user