one step closer to c89 compatibility

This commit is contained in:
UnknownShadow200 2020-02-06 19:17:41 +11:00
parent 4e01518ce2
commit 07b56e6ba3
4 changed files with 15 additions and 10 deletions

View File

@ -298,11 +298,11 @@ void Launcher_Run(void) {
/*########################################################################################################################* /*########################################################################################################################*
*---------------------------------------------------------Colours/Skin----------------------------------------------------* *---------------------------------------------------------Colours/Skin----------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
#define DEFAULT_BACKGROUND_COL BitmapCol_Make(153, 127, 172, 255); #define DEFAULT_BACKGROUND_COL BitmapCol_Make(153, 127, 172, 255)
#define DEFAULT_BUTTON_BORDER_COL BitmapCol_Make( 97, 81, 110, 255); #define DEFAULT_BUTTON_BORDER_COL BitmapCol_Make( 97, 81, 110, 255)
#define DEFAULT_BUTTON_FORE_ACTIVE_COL BitmapCol_Make(189, 168, 206, 255); #define DEFAULT_BUTTON_FORE_ACTIVE_COL BitmapCol_Make(189, 168, 206, 255)
#define DEFAULT_BUTTON_FORE_COL BitmapCol_Make(141, 114, 165, 255); #define DEFAULT_BUTTON_FORE_COL BitmapCol_Make(141, 114, 165, 255)
#define DEFAULT_BUTTON_HIGHLIGHT_COL BitmapCol_Make(162, 131, 186, 255); #define DEFAULT_BUTTON_HIGHLIGHT_COL BitmapCol_Make(162, 131, 186, 255)
BitmapCol Launcher_BackgroundCol = DEFAULT_BACKGROUND_COL; BitmapCol Launcher_BackgroundCol = DEFAULT_BACKGROUND_COL;
BitmapCol Launcher_ButtonBorderCol = DEFAULT_BUTTON_BORDER_COL; BitmapCol Launcher_ButtonBorderCol = DEFAULT_BUTTON_BORDER_COL;

View File

@ -231,10 +231,10 @@ struct SymbolAndName { IMAGEHLP_SYMBOL Symbol; char Name[256]; };
static int Logger_GetFrames(CONTEXT* ctx, cc_uintptr* addrs, int max) { static int Logger_GetFrames(CONTEXT* ctx, cc_uintptr* addrs, int max) {
STACKFRAME frame = { 0 }; STACKFRAME frame = { 0 };
DWORD type;
frame.AddrPC.Mode = AddrModeFlat; frame.AddrPC.Mode = AddrModeFlat;
frame.AddrFrame.Mode = AddrModeFlat; frame.AddrFrame.Mode = AddrModeFlat;
frame.AddrStack.Mode = AddrModeFlat; frame.AddrStack.Mode = AddrModeFlat;
DWORD type;
#if defined _M_IX86 #if defined _M_IX86
type = IMAGE_FILE_MACHINE_I386; type = IMAGE_FILE_MACHINE_I386;

View File

@ -225,9 +225,12 @@ void Platform_Log(const String* message) {
#define FILETIME_EPOCH 50491123200000ULL #define FILETIME_EPOCH 50491123200000ULL
#define FileTime_TotalMS(time) ((time / 10000) + FILETIME_EPOCH) #define FileTime_TotalMS(time) ((time / 10000) + FILETIME_EPOCH)
TimeMS DateTime_CurrentUTC_MS(void) { TimeMS DateTime_CurrentUTC_MS(void) {
FILETIME ft; GetSystemTimeAsFileTime(&ft); FILETIME ft;
cc_uint64 raw;
GetSystemTimeAsFileTime(&ft);
/* in 100 nanosecond units, since Jan 1 1601 */ /* in 100 nanosecond units, since Jan 1 1601 */
cc_uint64 raw = ft.dwLowDateTime | ((cc_uint64)ft.dwHighDateTime << 32); raw = ft.dwLowDateTime | ((cc_uint64)ft.dwHighDateTime << 32);
return FileTime_TotalMS(raw); return FileTime_TotalMS(raw);
} }
@ -380,6 +383,7 @@ int File_Exists(const String* path) {
cc_result Directory_Enum(const String* dirPath, void* obj, Directory_EnumCallback callback) { cc_result Directory_Enum(const String* dirPath, void* obj, Directory_EnumCallback callback) {
String path; char pathBuffer[MAX_PATH + 10]; String path; char pathBuffer[MAX_PATH + 10];
TCHAR str[NATIVE_STR_LEN]; TCHAR str[NATIVE_STR_LEN];
TCHAR* src;
WIN32_FIND_DATA entry; WIN32_FIND_DATA entry;
HANDLE find; HANDLE find;
cc_result res; cc_result res;
@ -398,7 +402,7 @@ cc_result Directory_Enum(const String* dirPath, void* obj, Directory_EnumCallbac
String_Format1(&path, "%s/", dirPath); String_Format1(&path, "%s/", dirPath);
/* ignore . and .. entry */ /* ignore . and .. entry */
TCHAR* src = entry.cFileName; src = entry.cFileName;
if (src[0] == '.' && src[1] == '\0') continue; if (src[0] == '.' && src[1] == '\0') continue;
if (src[0] == '.' && src[1] == '.' && src[2] == '\0') continue; if (src[0] == '.' && src[1] == '.' && src[2] == '\0') continue;

View File

@ -549,13 +549,14 @@ void Window_Close(void) {
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(void) {
HWND foreground;
MSG msg; MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, 1)) { while (PeekMessage(&msg, NULL, 0, 0, 1)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
HWND foreground = GetForegroundWindow(); foreground = GetForegroundWindow();
if (foreground) { if (foreground) {
Window_Focused = foreground == win_handle; Window_Focused = foreground == win_handle;
} }