diff --git a/src/ExtMath.h b/src/ExtMath.h index 94c6debf3..b209ccc39 100644 --- a/src/ExtMath.h +++ b/src/ExtMath.h @@ -32,7 +32,7 @@ CC_API double Math_Sin(double x); CC_API double Math_Cos(double x); float Math_SinF(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). */ /* e.g. for log3(x), use: Math_Log(x)/log(3) */ diff --git a/src/Graphics_D3D9.c b/src/Graphics_D3D9.c index 52faf6fe5..436f75b21 100644 --- a/src/Graphics_D3D9.c +++ b/src/Graphics_D3D9.c @@ -81,7 +81,7 @@ static void CreateD3D9Instance(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; int i; @@ -94,7 +94,7 @@ static void FindCompatibleViewFormat(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; int i; diff --git a/src/Platform_3DS.c b/src/Platform_3DS.c index f2d0600ab..ed2693ced 100644 --- a/src/Platform_3DS.c +++ b/src/Platform_3DS.c @@ -187,9 +187,12 @@ static cc_result File_Do(cc_file* file, const cc_string* path, int mode) { char str[NATIVE_STR_LEN]; GetNativePath(str, path); - Platform_Log1("Opening file: %c", str); *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) { @@ -518,13 +521,21 @@ cc_bool DynamicLib_DescribeError(cc_string* dst) { *#########################################################################################################################*/ #define SOC_CTX_ALIGN 0x1000 #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) { Platform_SingleProcess = true; // create root directories (no permissions anyways) - mkdir("sdmc://3ds", 0666); - mkdir("sdmc://3ds/ClassiCube", 0666); + CreateRootDirectory("sdmc://3ds"); + CreateRootDirectory("sdmc://3ds/ClassiCube"); // 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. @@ -567,4 +578,4 @@ cc_result Platform_Encrypt(const void* data, int len, cc_string* dst) { cc_result Platform_Decrypt(const void* data, int len, cc_string* dst) { return ERR_NOT_SUPPORTED; } -#endif +#endif \ No newline at end of file diff --git a/src/Vorbis.c b/src/Vorbis.c index 1075366ed..d75c35842 100644 --- a/src/Vorbis.c +++ b/src/Vorbis.c @@ -194,6 +194,7 @@ static int iLog(int x) { return bits; } +/* https://en.wikipedia.org/wiki/Single-precision_floating-point_format */ /* Float consists of: */ /* - 1 bit for sign */ /* - 8 bits for biased exponent */ diff --git a/src/Window_3DS.c b/src/Window_3DS.c index 6f76fb83d..3d0ba103c 100644 --- a/src/Window_3DS.c +++ b/src/Window_3DS.c @@ -88,10 +88,11 @@ void Window_ProcessEvents(double delta) { Input_SetNonRepeatable(KeyBinds[KEYBIND_RIGHT], mods & KEY_DRIGHT); Input_SetNonRepeatable(IPT_RIGHT, mods & KEY_DRIGHT); - Input_SetNonRepeatable(KeyBinds[KEYBIND_FORWARD], mods & KEY_DUP); - Input_SetNonRepeatable(IPT_UP, mods & KEY_DUP); - Input_SetNonRepeatable(KeyBinds[KEYBIND_BACK], mods & KEY_DDOWN); - Input_SetNonRepeatable(IPT_DOWN, mods & KEY_DDOWN); + // NOTE: KEY_DUP and KEY_DDOWN are deliberately swapped here + Input_SetNonRepeatable(KeyBinds[KEYBIND_FORWARD], mods & KEY_DDOWN); + Input_SetNonRepeatable(IPT_UP, mods & KEY_DDOWN); + Input_SetNonRepeatable(KeyBinds[KEYBIND_BACK], mods & KEY_DUP); + Input_SetNonRepeatable(IPT_DOWN, mods & KEY_DUP); if (hidKeysHeld() & KEY_TOUCH) { int x, y; @@ -155,7 +156,6 @@ void Window_DrawFramebuffer(Rect2D r) { } // TODO implement // TODO gspWaitForVBlank(); - Platform_LogConst("DRAW FB!!!"); gfxFlushBuffers(); //gfxSwapBuffers(); // TODO: tearing??