mirror of
https://github.com/dgis/emu48android
synced 2024-12-26 09:58:49 +01:00
This commit is contained in:
parent
81b3024034
commit
cf1ba8a3a8
4 changed files with 226 additions and 128 deletions
|
@ -2070,8 +2070,9 @@ BOOL emu48Start()
|
|||
ReadSettings();
|
||||
|
||||
_tcscpy(szCurrentDirectory, "");
|
||||
_tcscpy(szEmuDirectory, "assets/calculators/");
|
||||
_tcscpy(szRomDirectory, "assets/calculators/");
|
||||
|
||||
_tcscpy(szPort2Filename, "");
|
||||
|
||||
// running an instance of me?
|
||||
// if (bSingleInstance && (hWnd = FindWindow(MAKEINTATOM(classAtom),NULL)) != NULL)
|
||||
|
@ -2149,6 +2150,8 @@ BOOL emu48Start()
|
|||
//
|
||||
// VERIFY(hAccel = LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_MENU)));
|
||||
|
||||
hWindowDC = CreateCompatibleDC(NULL);
|
||||
|
||||
// initialization
|
||||
QueryPerformanceFrequency(&lFreq); // init high resolution counter
|
||||
QueryPerformanceCounter(&lAppStart);
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// PCH.H
|
||||
//
|
||||
|
||||
#define DEBUG_DISPLAY 1
|
||||
|
||||
#define _WIN32_IE 0x0200
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
|
|
|
@ -13,6 +13,9 @@ const TCHAR * assetsPrefix = _T("assets/"),
|
|||
assetsPrefixLength = 7;
|
||||
AAssetManager * assetManager;
|
||||
|
||||
VOID OutputDebugString(LPCSTR lpOutputString) {
|
||||
LOGD("%s", lpOutputString);
|
||||
}
|
||||
|
||||
DWORD GetCurrentDirectory(DWORD nBufferLength, LPTSTR lpBuffer) {
|
||||
if(getcwd(lpBuffer, nBufferLength)) {
|
||||
|
@ -51,15 +54,6 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
|||
HANDLE handle = malloc(sizeof(_HANDLE));
|
||||
handle->handleType = HANDLE_TYPE_FILE_ASSET;
|
||||
handle->fileAsset = asset;
|
||||
// char buf[BUFSIZ];
|
||||
// int nb_read = 0;
|
||||
// nb_read = AAsset_read(asset, buf, BUFSIZ);
|
||||
// AAsset_close(asset);
|
||||
// }
|
||||
// AAssetDir* assetDir = AAssetManager_openDir(assetManager, "");
|
||||
// const char* filename = (const char*)NULL;
|
||||
// while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) {
|
||||
// AAssetDir_close(assetDir);
|
||||
return handle;
|
||||
}
|
||||
} else {
|
||||
|
@ -105,7 +99,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
|||
return handle;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) {
|
||||
|
@ -407,15 +401,24 @@ BOOL WINAPI CloseHandle(HANDLE hObject) {
|
|||
case HANDLE_TYPE_FILE: {
|
||||
int closeResult = close(hObject->fileDescriptor);
|
||||
if(closeResult >= 0) {
|
||||
hObject->handleType = HANDLE_TYPE_INVALID;
|
||||
hObject->fileDescriptor = 0;
|
||||
free(hObject);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HANDLE_TYPE_FILE_ASSET: {
|
||||
AAsset_close(hObject->fileAsset);
|
||||
hObject->handleType = HANDLE_TYPE_INVALID;
|
||||
hObject->fileAsset = NULL;
|
||||
free(hObject);
|
||||
return TRUE;
|
||||
}
|
||||
case HANDLE_TYPE_FILE_MAPPING: {
|
||||
int closeResult = UnmapViewOfFile(hObject->fileMappingAddress);
|
||||
if(closeResult == TRUE) {
|
||||
hObject->handleType = HANDLE_TYPE_INVALID;
|
||||
hObject->fileDescriptor = 0;
|
||||
hObject->fileMappingSize = 0;
|
||||
hObject->fileMappingAddress = NULL;
|
||||
|
@ -424,7 +427,16 @@ BOOL WINAPI CloseHandle(HANDLE hObject) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case HANDLE_TYPE_FILE_MAPPING_ASSET: {
|
||||
hObject->handleType = HANDLE_TYPE_INVALID;
|
||||
hObject->fileAsset = NULL;
|
||||
hObject->fileMappingSize = 0;
|
||||
hObject->fileMappingAddress = NULL;
|
||||
free(hObject);
|
||||
return TRUE;
|
||||
}
|
||||
case HANDLE_TYPE_EVENT: {
|
||||
hObject->handleType = HANDLE_TYPE_INVALID;
|
||||
int result = 0;
|
||||
result = pthread_cond_destroy(&hObject->eventCVariable);
|
||||
_ASSERT(result == 0);
|
||||
|
@ -436,6 +448,7 @@ BOOL WINAPI CloseHandle(HANDLE hObject) {
|
|||
return TRUE;
|
||||
}
|
||||
case HANDLE_TYPE_THREAD:
|
||||
hObject->handleType = HANDLE_TYPE_INVALID;
|
||||
hObject->threadId = 0;
|
||||
free(hObject);
|
||||
return TRUE;
|
||||
|
@ -626,6 +639,26 @@ BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy,
|
|||
BOOL IsRectEmpty(CONST RECT *lprc) { return 0; }
|
||||
BOOL WINAPI SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lppt) { return 0; }
|
||||
|
||||
// GDI
|
||||
HGDIOBJ SelectObject(HDC hdc, HGDIOBJ h) {
|
||||
switch (h->handleType) {
|
||||
case HGDIOBJ_TYPE_PEN:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_BRUSH:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_FONT:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_BITMAP:
|
||||
hdc->selectedBitmap = h;
|
||||
break;
|
||||
case HGDIOBJ_TYPE_REGION:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_PALETTE:
|
||||
hdc->selectedPalette = h;
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
int GetObject(HANDLE h, int c, LPVOID pv) {
|
||||
//TODO
|
||||
return 0;
|
||||
|
@ -634,41 +667,55 @@ HGDIOBJ GetCurrentObject(HDC hdc, UINT type) {
|
|||
//TODO
|
||||
return NULL;
|
||||
}
|
||||
int SetStretchBltMode(HDC hdc, int mode) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
HPALETTE CreatePalette(CONST LOGPALETTE * plpal) {
|
||||
//TODO
|
||||
return NULL;
|
||||
}
|
||||
HPALETTE SelectPalette(HDC hdc, HPALETTE hPal, BOOL bForceBkgd) {
|
||||
//TODO
|
||||
return NULL;
|
||||
}
|
||||
UINT RealizePalette(HDC hdc) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
HDC CreateCompatibleDC(HDC hdc) {
|
||||
//TODO
|
||||
return NULL;
|
||||
}
|
||||
BOOL DeleteDC(HDC hdc) {
|
||||
//TODO
|
||||
return 0;
|
||||
BOOL DeleteObject(HGDIOBJ ho) {
|
||||
switch(ho->handleType) {
|
||||
case HGDIOBJ_TYPE_PALETTE: {
|
||||
ho->handleType = 0;
|
||||
ho->paletteLog = NULL;
|
||||
free(ho);
|
||||
return TRUE;
|
||||
}
|
||||
case HGDIOBJ_TYPE_BITMAP: {
|
||||
ho->handleType = 0;
|
||||
ho->bitmapInfoHeader = NULL;
|
||||
ho->bitmapBits = NULL;
|
||||
ho->bitmapInfo = NULL;
|
||||
free(ho);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
HGDIOBJ GetStockObject(int i) {
|
||||
//TODO
|
||||
return NULL;
|
||||
}
|
||||
HGDIOBJ SelectObject(HDC hdc, HGDIOBJ h) {
|
||||
HPALETTE CreatePalette(CONST LOGPALETTE * plpal) {
|
||||
HGDIOBJ newHDC = (HGDIOBJ)malloc(sizeof(_HGDIOBJ));
|
||||
newHDC->handleType = HGDIOBJ_TYPE_PALETTE;
|
||||
newHDC->paletteLog = (PLOGPALETTE)plpal; // Can be free -> we have to make a copy
|
||||
return newHDC;
|
||||
}
|
||||
HPALETTE SelectPalette(HDC hdc, HPALETTE hPal, BOOL bForceBkgd) {
|
||||
hdc->selectedPalette = hPal;
|
||||
return hPal;
|
||||
}
|
||||
UINT RealizePalette(HDC hdc) {
|
||||
//TODO
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// DC
|
||||
|
||||
HDC CreateCompatibleDC(HDC hdc) {
|
||||
HDC newHDC = (HDC)malloc(sizeof(struct _HDC));
|
||||
newHDC->handleType = HDC_TYPE_DC;
|
||||
newHDC->hdcCompatible = hdc;
|
||||
return newHDC;
|
||||
}
|
||||
BOOL DeleteDC(HDC hdc) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
BOOL MoveToEx(HDC hdc, int x, int y, LPPOINT lppt) {
|
||||
//TODO
|
||||
|
@ -686,6 +733,14 @@ BOOL BitBlt(HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, D
|
|||
//TODO
|
||||
return 0;
|
||||
}
|
||||
int SetStretchBltMode(HDC hdc, int mode) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD *prgbq) {
|
||||
//TODO
|
||||
return 0;
|
||||
|
@ -696,21 +751,28 @@ UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD *prgbq
|
|||
#define DIB_RGB_COLORS 0 /* color table in RGBs */
|
||||
#define DIB_PAL_COLORS 1 /* color table in palette indices */
|
||||
HBITMAP CreateDIBitmap( HDC hdc, CONST BITMAPINFOHEADER *pbmih, DWORD flInit, CONST VOID *pjBits, CONST BITMAPINFO *pbmi, UINT iUsage) {
|
||||
//TODO
|
||||
return NULL;
|
||||
HGDIOBJ newHDC = (HGDIOBJ)malloc(sizeof(_HGDIOBJ));
|
||||
newHDC->handleType = HGDIOBJ_TYPE_BITMAP;
|
||||
newHDC->bitmapInfo = pbmi;
|
||||
newHDC->bitmapInfoHeader = pbmih;
|
||||
newHDC->bitmapBits = pjBits;
|
||||
return newHDC;
|
||||
}
|
||||
HBITMAP CreateDIBSection(HDC hdc, CONST BITMAPINFO *pbmi, UINT usage, VOID **ppvBits, HANDLE hSection, DWORD offset) {
|
||||
//TODO
|
||||
return NULL;
|
||||
HGDIOBJ newHDC = (HGDIOBJ)malloc(sizeof(_HGDIOBJ));
|
||||
newHDC->handleType = HGDIOBJ_TYPE_BITMAP;
|
||||
newHDC->bitmapInfo = pbmi;
|
||||
newHDC->bitmapInfoHeader = pbmi;
|
||||
// For DIB_RGB_COLORS only
|
||||
int size = pbmi->bmiHeader.biWidth * abs(pbmi->bmiHeader.biHeight) * 4; //(pbmi->bmiHeader.biBitCount >> 3);
|
||||
newHDC->bitmapBits = malloc(size); //pbmi->bmiHeader.biSizeImage);
|
||||
*ppvBits = newHDC->bitmapBits;
|
||||
return newHDC;
|
||||
}
|
||||
HBITMAP CreateCompatibleBitmap( HDC hdc, int cx, int cy) {
|
||||
//TODO
|
||||
return NULL;
|
||||
}
|
||||
BOOL DeleteObject(HGDIOBJ ho) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
int GetDIBits(HDC hdc, HBITMAP hbm, UINT start, UINT cLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT usage) {
|
||||
//TODO
|
||||
return 0;
|
||||
|
@ -787,7 +849,21 @@ MMRESULT timeEndPeriod(UINT uPeriod) {
|
|||
return 0; //No error
|
||||
}
|
||||
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) {
|
||||
//TODO
|
||||
if(lpSystemTime) {
|
||||
struct timespec ts = {0, 0};
|
||||
struct tm tm = {};
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
time_t tim = ts.tv_sec;
|
||||
localtime_r(&tim, &tm);
|
||||
lpSystemTime->wYear = 1900 + tm.tm_year;
|
||||
lpSystemTime->wMonth = 1 + tm.tm_mon;
|
||||
lpSystemTime->wDayOfWeek = tm.tm_wday;
|
||||
lpSystemTime->wDay = tm.tm_mday;
|
||||
lpSystemTime->wHour = tm.tm_hour;
|
||||
lpSystemTime->wMinute = tm.tm_min;
|
||||
lpSystemTime->wSecond = tm.tm_sec;
|
||||
lpSystemTime->wMilliseconds = ts.tv_nsec / 1e6;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -855,7 +931,7 @@ extern TCHAR szCurrentKml[MAX_PATH];
|
|||
INT_PTR DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) {
|
||||
//TODO
|
||||
if(lpTemplateName == MAKEINTRESOURCE(IDD_CHOOSEKML)) {
|
||||
lstrcpy(szCurrentKml, "assets/calculators/real48sx.kml");
|
||||
lstrcpy(szCurrentKml, "real48sx.kml");
|
||||
} else if(lpTemplateName == MAKEINTRESOURCE(IDD_KMLLOG)) {
|
||||
//LOGD(szLog);
|
||||
lpDialogFunc(NULL, WM_INITDIALOG, 0, 0);
|
||||
|
|
|
@ -51,8 +51,18 @@ typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
|
|||
|
||||
#define CONST const
|
||||
|
||||
#define _ASSERT(expr)
|
||||
//#define _ASSERT(expr) \
|
||||
// (void)( \
|
||||
// (!!(expr)) || \
|
||||
// (1 != _CrtDbgReportW(_CRT_ASSERT, _CRT_WIDE(__FILE__), __LINE__, NULL, L"%ls", NULL)) || \
|
||||
// (_CrtDbgBreak(), 0) \
|
||||
// )
|
||||
|
||||
|
||||
enum HANDLE_TYPE {
|
||||
HANDLE_TYPE_FILE = 1,
|
||||
HANDLE_TYPE_INVALID = 0,
|
||||
HANDLE_TYPE_FILE,
|
||||
HANDLE_TYPE_FILE_ASSET,
|
||||
HANDLE_TYPE_FILE_MAPPING,
|
||||
HANDLE_TYPE_FILE_MAPPING_ASSET,
|
||||
|
@ -60,7 +70,7 @@ enum HANDLE_TYPE {
|
|||
HANDLE_TYPE_THREAD,
|
||||
};
|
||||
typedef struct {
|
||||
int handleType;
|
||||
enum HANDLE_TYPE handleType;
|
||||
|
||||
int fileDescriptor;
|
||||
|
||||
|
@ -77,11 +87,8 @@ typedef struct {
|
|||
BOOL eventState;
|
||||
} _HANDLE;
|
||||
typedef _HANDLE * HANDLE;
|
||||
typedef HANDLE HPALETTE;
|
||||
typedef HANDLE HBITMAP;
|
||||
|
||||
typedef HANDLE HMENU;
|
||||
typedef HANDLE HFONT;
|
||||
typedef void * HGDIOBJ;
|
||||
|
||||
#define MK_LBUTTON 0x0001
|
||||
|
||||
|
@ -139,7 +146,7 @@ typedef pthread_mutex_t CRITICAL_SECTION;
|
|||
typedef HANDLE HINSTANCE;
|
||||
typedef HANDLE HWND;
|
||||
typedef void WNDCLASS;
|
||||
typedef HANDLE HDC;
|
||||
|
||||
typedef HANDLE HCURSOR;
|
||||
|
||||
struct FILETIME {
|
||||
|
@ -231,11 +238,9 @@ enum
|
|||
FILE_FLAG_OVERLAPPED = 2,
|
||||
FILE_FLAG_SEQUENTIAL_SCAN = 4,
|
||||
PAGE_READONLY,
|
||||
FILE_MAP_READ,
|
||||
CREATE_ALWAYS,
|
||||
PAGE_READWRITE,
|
||||
PAGE_WRITECOPY,
|
||||
FILE_MAP_WRITE,
|
||||
FILE_MAP_COPY,
|
||||
|
||||
//errors
|
||||
|
@ -243,6 +248,8 @@ enum
|
|||
ERROR_ALREADY_EXISTS = 1
|
||||
};
|
||||
|
||||
#define FILE_MAP_WRITE 0x0002
|
||||
#define FILE_MAP_READ 0x0004
|
||||
|
||||
enum MsgBoxFlagType {
|
||||
IDOK = 0,
|
||||
|
@ -332,33 +339,7 @@ enum {
|
|||
#define ZeroMemory(p,s) memset(p,0,s)
|
||||
#define FillMemory(p,n,v) memset(p,v,n*sizeof(*(p)))
|
||||
#define CopyMemory(d,src,s) memcpy(d,src,s)
|
||||
//inline unsigned char HIBYTE(int i) { return i>>8; }
|
||||
//inline unsigned char LOBYTE(int i) { return i; }
|
||||
//inline BOOL _istdigit(unichar c) { return (c>='0' && c<='9'); }
|
||||
/*
|
||||
extern RGBColor RGB(int r, int g, int b);
|
||||
inline ControlRef GetDlgItem(WindowRef window, SInt32 control_code)
|
||||
{
|
||||
ControlRef control;
|
||||
ControlID control_id = { app_signature, control_code };
|
||||
FailOSErr(GetControlByID(window, &control_id, &control));
|
||||
return control;
|
||||
}
|
||||
// For radio groups, 1=first choice, 2=second, etc
|
||||
extern void CheckDlgButton(WindowRef, SInt32 control_code, SInt32 value);
|
||||
extern void SetDlgItemInt(WindowRef, SInt32 control_code, int value, bool);
|
||||
extern void SetDlgItemText(WindowRef, SInt32 control_code, CFStringRef);
|
||||
// Use this to fiddle with dropdown menus (pass a CB_ constant for msg)
|
||||
// Indexes are zero-based. Also handles WMU_SETWINDOWVALUE
|
||||
extern int SendDlgItemMessage(WindowRef, SInt32 control_code, int msg, int p1, void *p2);
|
||||
// For checkboxes, result will be zero or one (can cast directly to bool)
|
||||
extern SInt32 IsDlgButtonChecked(WindowRef, SInt32 control_code);
|
||||
// Despite its name, this dims/undims controls
|
||||
extern void EnableWindow(ControlRef, bool enable);
|
||||
// Used to fill in font dropdown menus
|
||||
typedef FMFontFamilyCallbackFilterProcPtr FONTENUMPROC;
|
||||
extern void EnumFontFamilies(void *, void *, FONTENUMPROC, void *userdata);
|
||||
*/
|
||||
|
||||
typedef struct _OVERLAPPED {
|
||||
/*
|
||||
ULONG_PTR Internal;
|
||||
|
@ -376,6 +357,8 @@ typedef struct _OVERLAPPED {
|
|||
} OVERLAPPED, *LPOVERLAPPED;
|
||||
|
||||
|
||||
extern VOID OutputDebugString(LPCSTR lpOutputString);
|
||||
|
||||
extern DWORD GetCurrentDirectory(DWORD nBufferLength, LPTSTR lpBuffer);
|
||||
extern BOOL SetCurrentDirectory(LPCTSTR); // returns NO if fails
|
||||
extern HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPVOID lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, LPVOID hTemplateFile);
|
||||
|
@ -393,18 +376,6 @@ extern LPVOID MapViewOfFile(HANDLE hFileMappingObject,DWORD dwDesiredAccess, DWO
|
|||
extern BOOL UnmapViewOfFile(LPCVOID lpBaseAddress);
|
||||
extern BOOL SetEndOfFile(HANDLE hFile);
|
||||
|
||||
/*
|
||||
extern int ReadFile(int fd, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPVOID lpOverlapped);
|
||||
// WriteFile() writes to a temp file, then swaps that with the real file
|
||||
extern OSErr WriteFile(FSPtr &, void *buf, SInt64 size, void *, void *);
|
||||
extern UInt64 GetFileSize(FSPtr &, void *);
|
||||
// Do a strcmp-like comparison between 64-bit times
|
||||
extern int CompareFileTime(FILETIME *, FILETIME *);
|
||||
extern long SetFilePointer(FSPtr &, long offset, void *, FilePointerType startpoint);
|
||||
|
||||
extern void SetTimer(void *, TimerType, int msec, void *);
|
||||
*/
|
||||
|
||||
typedef UINT_PTR (CALLBACK *LPOFNHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef struct tagOFNA {
|
||||
DWORD lStructSize;
|
||||
|
@ -474,11 +445,6 @@ extern int MessageBox(HANDLE, LPCTSTR szMessage, LPCTSTR szTitle, int flags);
|
|||
extern BOOL QueryPerformanceFrequency(PLARGE_INTEGER l);
|
||||
extern BOOL QueryPerformanceCounter(PLARGE_INTEGER l);
|
||||
extern DWORD timeGetTime(void);
|
||||
extern void EnterCriticalSection(CRITICAL_SECTION *);
|
||||
extern void LeaveCriticalSection(CRITICAL_SECTION *);
|
||||
extern HANDLE CreateEvent(LPVOID lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCTSTR name);
|
||||
extern BOOL SetEvent(HANDLE hEvent);
|
||||
extern BOOL ResetEvent(HANDLE hEvent);
|
||||
|
||||
#define WAIT_OBJECT_0 0
|
||||
#define WAIT_TIMEOUT 0x00000102
|
||||
|
@ -490,6 +456,13 @@ extern void Sleep(int);
|
|||
|
||||
extern BOOL GetSystemPowerStatus(LPSYSTEM_POWER_STATUS l);
|
||||
|
||||
// Event
|
||||
|
||||
extern HANDLE CreateEvent(LPVOID lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCTSTR name);
|
||||
extern BOOL SetEvent(HANDLE hEvent);
|
||||
extern BOOL ResetEvent(HANDLE hEvent);
|
||||
|
||||
// Thread
|
||||
|
||||
typedef DWORD (*PTHREAD_START_ROUTINE)(
|
||||
LPVOID lpThreadParameter
|
||||
|
@ -499,14 +472,12 @@ typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
|
|||
extern HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
|
||||
extern DWORD ResumeThread(HANDLE hThread);
|
||||
extern BOOL CloseHandle(HANDLE hObject);
|
||||
#define OBJ_BITMAP 7
|
||||
extern int GetObject(HANDLE h, int c, LPVOID pv);
|
||||
extern HGDIOBJ GetCurrentObject(HDC hdc, UINT type);
|
||||
#define HALFTONE 4
|
||||
extern int SetStretchBltMode(HDC hdc, int mode);
|
||||
extern BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
|
||||
|
||||
typedef struct tagBITMAP
|
||||
extern void EnterCriticalSection(CRITICAL_SECTION *);
|
||||
extern void LeaveCriticalSection(CRITICAL_SECTION *);
|
||||
|
||||
// GDI
|
||||
typedef struct __attribute__((packed)) tagBITMAP
|
||||
{
|
||||
LONG bmType;
|
||||
LONG bmWidth;
|
||||
|
@ -523,14 +494,14 @@ typedef struct tagBITMAP
|
|||
#define BI_BITFIELDS 3L
|
||||
#define BI_JPEG 4L
|
||||
#define BI_PNG 5L
|
||||
typedef struct tagBITMAPFILEHEADER {
|
||||
typedef struct __attribute__((packed)) tagBITMAPFILEHEADER {
|
||||
WORD bfType;
|
||||
DWORD bfSize;
|
||||
WORD bfReserved1;
|
||||
WORD bfReserved2;
|
||||
DWORD bfOffBits;
|
||||
} BITMAPFILEHEADER, FAR *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;
|
||||
typedef struct tagBITMAPINFOHEADER{
|
||||
typedef struct __attribute__((packed)) tagBITMAPINFOHEADER{
|
||||
DWORD biSize;
|
||||
LONG biWidth;
|
||||
LONG biHeight;
|
||||
|
@ -543,27 +514,77 @@ typedef struct tagBITMAPINFOHEADER{
|
|||
DWORD biClrUsed;
|
||||
DWORD biClrImportant;
|
||||
} BITMAPINFOHEADER, FAR *LPBITMAPINFOHEADER, *PBITMAPINFOHEADER;
|
||||
typedef struct tagBITMAPINFO {
|
||||
typedef struct __attribute__((packed)) tagBITMAPINFO {
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
RGBQUAD bmiColors[1];
|
||||
} BITMAPINFO, FAR *LPBITMAPINFO, *PBITMAPINFO;
|
||||
typedef struct tagPALETTEENTRY {
|
||||
typedef struct __attribute__((packed)) tagPALETTEENTRY {
|
||||
BYTE peRed;
|
||||
BYTE peGreen;
|
||||
BYTE peBlue;
|
||||
BYTE peFlags;
|
||||
} PALETTEENTRY, *PPALETTEENTRY, FAR *LPPALETTEENTRY;
|
||||
typedef struct tagLOGPALETTE {
|
||||
typedef struct __attribute__((packed)) tagLOGPALETTE {
|
||||
WORD palVersion;
|
||||
WORD palNumEntries;
|
||||
PALETTEENTRY palPalEntry[1];
|
||||
} LOGPALETTE, *PLOGPALETTE, NEAR *NPLOGPALETTE, FAR *LPLOGPALETTE;
|
||||
enum HGDIOBJ_TYPE {
|
||||
HGDIOBJ_TYPE_INVALID = 0,
|
||||
HGDIOBJ_TYPE_PEN,
|
||||
HGDIOBJ_TYPE_BRUSH,
|
||||
HGDIOBJ_TYPE_FONT,
|
||||
HGDIOBJ_TYPE_BITMAP,
|
||||
HGDIOBJ_TYPE_REGION,
|
||||
HGDIOBJ_TYPE_PALETTE
|
||||
};
|
||||
typedef struct {
|
||||
enum HGDIOBJ_TYPE handleType;
|
||||
|
||||
// HGDIOBJ_TYPE_PALETTE
|
||||
PLOGPALETTE paletteLog;
|
||||
|
||||
// HGDIOBJ_TYPE_BITMAP
|
||||
CONST BITMAPINFO *bitmapInfo;
|
||||
CONST BITMAPINFOHEADER * bitmapInfoHeader;
|
||||
CONST VOID *bitmapBits;
|
||||
} _HGDIOBJ;
|
||||
typedef _HGDIOBJ * HGDIOBJ;
|
||||
//typedef void * HGDIOBJ;
|
||||
typedef HGDIOBJ HPALETTE;
|
||||
typedef HGDIOBJ HBITMAP;
|
||||
typedef HGDIOBJ HFONT;
|
||||
|
||||
extern int GetObject(HANDLE h, int c, LPVOID pv);
|
||||
extern BOOL DeleteObject(HGDIOBJ ho);
|
||||
|
||||
#define OBJ_BITMAP 7
|
||||
|
||||
#define WHITE_PEN 6
|
||||
#define BLACK_PEN 7
|
||||
extern HGDIOBJ GetStockObject(int i);
|
||||
extern HPALETTE CreatePalette(CONST LOGPALETTE * plpal);
|
||||
extern HPALETTE SelectPalette(HDC hdc, HPALETTE hPal, BOOL bForceBkgd);
|
||||
extern UINT RealizePalette(HDC hdc);
|
||||
|
||||
// DC
|
||||
|
||||
enum HDC_TYPE {
|
||||
HDC_TYPE_DC = 1,
|
||||
HDC_TYPE_FILE_ASSET
|
||||
};
|
||||
struct _HDC;
|
||||
typedef struct _HDC * HDC;
|
||||
struct _HDC{
|
||||
enum HDC_TYPE handleType;
|
||||
HDC hdcCompatible;
|
||||
HBITMAP selectedBitmap;
|
||||
HPALETTE selectedPalette;
|
||||
};
|
||||
//typedef HANDLE HDC;
|
||||
|
||||
extern HDC CreateCompatibleDC(HDC hdc);
|
||||
extern BOOL DeleteDC(HDC hdc);
|
||||
extern HGDIOBJ SelectObject(HDC hdc, HGDIOBJ h);
|
||||
extern HGDIOBJ GetCurrentObject(HDC hdc, UINT type);
|
||||
typedef struct tagPOINT
|
||||
{
|
||||
LONG x;
|
||||
|
@ -571,14 +592,14 @@ typedef struct tagPOINT
|
|||
} POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;
|
||||
extern BOOL MoveToEx(HDC hdc, int x, int y, LPPOINT lppt);
|
||||
extern BOOL LineTo(HDC hdc, int x, int y);
|
||||
#define WHITE_PEN 6
|
||||
#define BLACK_PEN 7
|
||||
extern HGDIOBJ GetStockObject(int i);
|
||||
#define SRCCOPY (DWORD)0x00CC0020 /* dest = source */
|
||||
#define DSTINVERT (DWORD)0x00550009 /* dest = (NOT dest) */
|
||||
#define BLACKNESS (DWORD)0x00000042 /* dest = BLACK */
|
||||
extern BOOL PatBlt(HDC hdc, int x, int y, int w, int h, DWORD rop);
|
||||
extern BOOL BitBlt(HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, DWORD rop);
|
||||
#define HALFTONE 4
|
||||
extern int SetStretchBltMode(HDC hdc, int mode);
|
||||
extern BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
|
||||
extern UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD *prgbq);
|
||||
/* constants for CreateDIBitmap */
|
||||
#define CBM_INIT 0x04L /* initialize bitmap */
|
||||
|
@ -588,7 +609,6 @@ extern UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD
|
|||
extern HBITMAP CreateDIBitmap( HDC hdc, CONST BITMAPINFOHEADER *pbmih, DWORD flInit, CONST VOID *pjBits, CONST BITMAPINFO *pbmi, UINT iUsage);
|
||||
extern HBITMAP CreateDIBSection(HDC hdc, CONST BITMAPINFO *pbmi, UINT usage, VOID **ppvBits, HANDLE hSection, DWORD offset);
|
||||
extern HBITMAP CreateCompatibleBitmap( HDC hdc, int cx, int cy);
|
||||
extern BOOL DeleteObject(HGDIOBJ ho);
|
||||
typedef struct _RGNDATAHEADER {
|
||||
DWORD dwSize;
|
||||
DWORD iType;
|
||||
|
@ -602,6 +622,8 @@ typedef struct _RGNDATA {
|
|||
char Buffer[1];
|
||||
} RGNDATA, *PRGNDATA, NEAR *NPRGNDATA, FAR *LPRGNDATA;
|
||||
extern int GetDIBits(HDC hdc, HBITMAP hbm, UINT start, UINT cLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT usage);
|
||||
extern HPALETTE SelectPalette(HDC hdc, HPALETTE hPal, BOOL bForceBkgd);
|
||||
extern UINT RealizePalette(HDC hdc);
|
||||
/* GetRegionData/ExtCreateRegion */
|
||||
#define RDH_RECTANGLES 1
|
||||
extern BOOL SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom);
|
||||
|
@ -621,13 +643,8 @@ extern int SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw);
|
|||
extern HRGN ExtCreateRegion(CONST XFORM * lpx, DWORD nCount, CONST RGNDATA * lpData);
|
||||
extern BOOL GdiFlush(void);
|
||||
|
||||
#define _ASSERT(expr)
|
||||
//#define _ASSERT(expr) \
|
||||
// (void)( \
|
||||
// (!!(expr)) || \
|
||||
// (1 != _CrtDbgReportW(_CRT_ASSERT, _CRT_WIDE(__FILE__), __LINE__, NULL, L"%ls", NULL)) || \
|
||||
// (_CrtDbgBreak(), 0) \
|
||||
// )
|
||||
// Window
|
||||
|
||||
|
||||
|
||||
// disrpl.c
|
||||
|
|
Loading…
Reference in a new issue