From 5635d06b7efd7e5c800e0e911541baa92720b997 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 30 Jun 2024 23:38:58 +1000 Subject: [PATCH] Fix last commit --- src/LScreens.c | 4 ++-- src/PackedCol.h | 2 +- src/Platform.h | 3 ++- src/Platform_Windows.c | 6 ++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/LScreens.c b/src/LScreens.c index a798b12d2..3c8d18bbd 100644 --- a/src/LScreens.c +++ b/src/LScreens.c @@ -21,7 +21,7 @@ #include "Game.h" #define LAYOUTS static const struct LLayout -#define IsBackButton(btn) (btn == CCKEY_ESCAPE || btn == CCPAD_SELECT || btn == CCPAD_B) +#define IsBackButton(btn) (btn == CCKEY_ESCAPE || btn == CCPAD_SELECT || btn == CCPAD_2) /*########################################################################################################################* *---------------------------------------------------------Screen base-----------------------------------------------------* @@ -103,7 +103,7 @@ static void LScreen_KeyDown(struct LScreen* s, int key, cc_bool was) { if (s->selectedWidget->VTABLE->KeyDown(s->selectedWidget, key, was)) return; } - if (key == CCKEY_TAB || key == CCPAD_X) { + if (key == CCKEY_TAB || key == CCPAD_3) { LScreen_CycleSelected(s, Input_IsShiftPressed() ? -1 : 1); } else if (Input_IsUpButton(key)) { LScreen_CycleSelected(s, -1); diff --git a/src/PackedCol.h b/src/PackedCol.h index 5321d9c84..1290804ef 100644 --- a/src/PackedCol.h +++ b/src/PackedCol.h @@ -1,7 +1,7 @@ #ifndef CC_PACKEDCOL_H #define CC_PACKEDCOL_H #include "Core.h" -/* Manipulates a packed 32 bit RGBA colour, in a format suitable for the native 3D graphics API. +/* Manipulates a packed 32 bit RGBA colour, in a format suitable for the native 3D graphics API vertex colours. Copyright 2014-2023 ClassiCube | Licensed under BSD-3 */ diff --git a/src/Platform.h b/src/Platform.h index f73f6ea44..5ca1e5d9b 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -46,7 +46,7 @@ typedef struct cc_winstring_ { cc_unichar uni[NATIVE_STR_LEN]; /* String represented using UTF16 format */ char ansi[NATIVE_STR_LEN]; /* String lossily represented using ANSI format */ } cc_winstring; -/* Encodes a string in UTF16 and ASCII format, also null terminating the string. */ +/* Encodes a string into the platform native string format */ void Platform_EncodeString(cc_winstring* dst, const cc_string* src); cc_bool Platform_DescribeErrorExt(cc_result res, cc_string* dst, void* lib); @@ -58,6 +58,7 @@ typedef cc_winstring cc_filepath; typedef struct cc_filepath_ { char buffer[NATIVE_STR_LEN]; } cc_filepath; #define FILEPATH_RAW(raw) ((cc_filepath*)raw) #endif +/* Converts the provided path into a platform native file path */ void Platform_EncodePath(cc_filepath* dst, const cc_string* src); /* Initialises the platform specific state. */ diff --git a/src/Platform_Windows.c b/src/Platform_Windows.c index 1716c1088..c30f1faf1 100644 --- a/src/Platform_Windows.c +++ b/src/Platform_Windows.c @@ -290,12 +290,14 @@ cc_result File_OpenOrCreate(cc_file* file, const cc_filepath* path) { } cc_result File_Read(cc_file file, void* data, cc_uint32 count, cc_uint32* bytesRead) { - BOOL success = ReadFile(file, data, count, bytesRead, NULL); + /* NOTE: the (DWORD*) cast assumes that sizeof(long) is 4 */ + BOOL success = ReadFile(file, data, count, (DWORD*)bytesRead, NULL); return success ? 0 : GetLastError(); } cc_result File_Write(cc_file file, const void* data, cc_uint32 count, cc_uint32* bytesWrote) { - BOOL success = WriteFile(file, data, count, bytesWrote, NULL); + /* NOTE: the (DWORD*) cast assumes that sizeof(long) is 4 */ + BOOL success = WriteFile(file, data, count, (DWORD*)bytesWrote, NULL); return success ? 0 : GetLastError(); }