progress
This commit is contained in:
@@ -159,7 +159,7 @@ IA_ U8 atm_swap_u8(U8*r addr, U8 value){asm volatile("lock xchgq %0,%1":"=r"(val
|
||||
#pragma endregion Thread Coherence
|
||||
|
||||
#pragma region Debug
|
||||
WinAPI void process_exit(U4 status) asm("exit");
|
||||
WinAPI void process_exit(U4 status) asm("ExitProcess");
|
||||
#define debug_trap() __builtin_debugtrap()
|
||||
#if BUILD_DEBUG
|
||||
IA_ void assert(U8 cond) { if(cond){return;} else{debug_trap(); process_exit(1);} }
|
||||
@@ -566,3 +566,61 @@ IA_ void str8gen_append_fmt(Str8Gen*r gen, Str8 fmt, KTL_Str8 tbl) {
|
||||
}
|
||||
#define str8gen_append_str8_(gen, s) str8gen_append_str8(gen, str8(s))
|
||||
#pragma endregion Text Ops
|
||||
|
||||
#pragma region OS_GDI_And_Minimal
|
||||
// --- WinAPI Minimal Definitions ---
|
||||
typedef struct MS_WNDCLASSA {
|
||||
U4 style;
|
||||
S8 (*lpfnWndProc)(void*, U4, U8, S8);
|
||||
S4 cbClsExtra;
|
||||
S4 cbWndExtra;
|
||||
void* hInstance;
|
||||
void* hIcon;
|
||||
void* hCursor;
|
||||
void* hbrBackground;
|
||||
char const* lpszMenuName;
|
||||
char const* lpszClassName;
|
||||
} MS_WNDCLASSA;
|
||||
|
||||
typedef struct MS_POINT { S4 x, y; } MS_POINT;
|
||||
typedef struct MS_MSG { void* hwnd; U4 message; U8 wParam; S8 lParam; U4 time; MS_POINT pt; } MS_MSG;
|
||||
typedef struct MS_RECT { S4 left, top, right, bottom; } MS_RECT;
|
||||
typedef struct MS_PAINTSTRUCT { void* hdc; S4 fErase; MS_RECT rcPaint; S4 fRestore; S4 fIncUpdate; U1 rgbReserved[32]; } MS_PAINTSTRUCT;
|
||||
|
||||
// Win32 API declarations
|
||||
WinAPI void* ms_virtual_alloc(void* lpAddress, U8 dwSize, U4 flAllocationType, U4 flProtect) asm("VirtualAlloc");
|
||||
WinAPI void ms_exit_process(U4 uExitCode) asm("ExitProcess");
|
||||
WinAPI U2 ms_register_class_a(const MS_WNDCLASSA* lpWndClass) asm("RegisterClassA");
|
||||
WinAPI void* ms_create_window_ex_a(U4 dwExStyle, char const* lpClassName, char const* lpWindowName, U4 dwStyle, S4 X, S4 Y, S4 nWidth, S4 nHeight, void* hWndParent, void* hMenu, void* hInstance, void* lpParam) asm("CreateWindowExA");
|
||||
WinAPI S4 ms_show_window(void* hWnd, S4 nCmdShow) asm("ShowWindow");
|
||||
WinAPI S4 ms_get_message_a(MS_MSG* lpMsg, void* hWnd, U4 wMsgFilterMin, U4 wMsgFilterMax) asm("GetMessageA");
|
||||
WinAPI S4 ms_translate_message(const MS_MSG* lpMsg) asm("TranslateMessage");
|
||||
WinAPI S8 ms_dispatch_message_a(const MS_MSG* lpMsg) asm("DispatchMessageA");
|
||||
WinAPI S8 ms_def_window_proc_a(void* hWnd, U4 Msg, U8 wParam, S8 lParam) asm("DefWindowProcA");
|
||||
WinAPI void ms_post_quit_message(S4 nExitCode) asm("PostQuitMessage");
|
||||
WinAPI S4 ms_invalidate_rect(void* hWnd, const MS_RECT* lpRect, S4 bErase) asm("InvalidateRect");
|
||||
WinAPI void* ms_begin_paint(void* hWnd, MS_PAINTSTRUCT* lpPaint) asm("BeginPaint");
|
||||
WinAPI S4 ms_end_paint(void* hWnd, const MS_PAINTSTRUCT* lpPaint) asm("EndPaint");
|
||||
WinAPI U4 ms_set_text_color(void* hdc, U4 color) asm("SetTextColor");
|
||||
WinAPI U4 ms_set_bk_color(void* hdc, U4 color) asm("SetBkColor");
|
||||
WinAPI S4 ms_text_out_a(void* hdc, S4 x, S4 y, char const* lpString, S4 c) asm("TextOutA");
|
||||
WinAPI void* ms_get_stock_object(S4 i) asm("GetStockObject");
|
||||
WinAPI void* ms_create_font_a(S4 cHeight, S4 cWidth, S4 cEscapement, S4 cOrientation, S4 cWeight, U4 bItalic, U4 bUnderline, U4 bStrikeOut, U4 iCharSet, U4 iOutPrecision, U4 iClipPrecision, U4 iQuality, U4 iPitchAndFamily, char const* pszFaceName) asm("CreateFontA");
|
||||
WinAPI void* ms_select_object(void* hdc, void* h) asm("SelectObject");
|
||||
WinAPI S4 ms_rectangle(void* hdc, S4 left, S4 top, S4 right, S4 bottom) asm("Rectangle");
|
||||
|
||||
#define MS_MEM_COMMIT 0x00001000
|
||||
#define MS_MEM_RESERVE 0x00002000
|
||||
#define MS_PAGE_READWRITE 0x04
|
||||
#define MS_WM_DESTROY 0x0002
|
||||
#define MS_WM_PAINT 0x000F
|
||||
#define MS_WM_KEYDOWN 0x0100
|
||||
#define MS_WS_OVERLAPPEDWINDOW 0x00CF0000
|
||||
#define MS_WS_VISIBLE 0x10000000
|
||||
#define MS_VK_LEFT 0x25
|
||||
#define MS_VK_UP 0x26
|
||||
#define MS_VK_RIGHT 0x27
|
||||
#define MS_VK_DOWN 0x28
|
||||
|
||||
#define MS_PAGE_EXECUTE_READWRITE 0x40
|
||||
#pragma endregion OS_GDI_And_Minimal
|
||||
|
||||
Reference in New Issue
Block a user