mirror of
https://github.com/InvisibleUp/uvmac.git
synced 2024-06-11 05:29:26 +00:00
Remove Windows CE support
it's just dead weight i have to work around
This commit is contained in:
parent
fc7898c4d7
commit
1f5e800332
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
This code is descended from Weston Pawlowski's Windows
|
This code is descended from Weston Pawlowski's Windows
|
||||||
port of vMac, by Philip Cummins.
|
port of vMac, by Philip Cummins.
|
||||||
Adapted by Fabio Concas to run on Pocket PC 2003 devices.
|
|
||||||
|
|
||||||
The main entry point '_tWinMain' is at the end of this file.
|
The main entry point '_tWinMain' is at the end of this file.
|
||||||
*/
|
*/
|
||||||
|
@ -48,13 +47,6 @@
|
||||||
#define UseUni 0
|
#define UseUni 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#define UseWinCE 1
|
|
||||||
#else
|
|
||||||
#define UseWinCE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define _CSIDL_APPDATA 0x001a
|
#define _CSIDL_APPDATA 0x001a
|
||||||
|
|
||||||
typedef BOOL (WINAPI *SHGetSpecialFolderPathProcPtr) (
|
typedef BOOL (WINAPI *SHGetSpecialFolderPathProcPtr) (
|
||||||
|
@ -382,18 +374,8 @@ LOCALVAR HWND MainWnd = NULL;
|
||||||
LOCALVAR int WndX;
|
LOCALVAR int WndX;
|
||||||
LOCALVAR int WndY;
|
LOCALVAR int WndY;
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
LOCALVAR short oldOrientation;
|
|
||||||
LOCALVAR unsigned long oldDisplayOrientation;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
LOCALVAR bool UseFullScreen = (WantInitFullScreen != 0);
|
LOCALVAR bool UseFullScreen = (WantInitFullScreen != 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
LOCALVAR bool UseMagnify = (WantInitMagnify != 0);
|
LOCALVAR bool UseMagnify = (WantInitMagnify != 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MayFullScreen
|
#if MayFullScreen
|
||||||
LOCALVAR short hOffset;
|
LOCALVAR short hOffset;
|
||||||
|
@ -1644,7 +1626,7 @@ LOCALFUNC bool GetKeyboardLayoutHex(uimr *r)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ItnlKyBdFix && ! UseWinCE
|
#if ItnlKyBdFix
|
||||||
LOCALPROC CheckKeyboardLayout(void)
|
LOCALPROC CheckKeyboardLayout(void)
|
||||||
{
|
{
|
||||||
uimr sv;
|
uimr sv;
|
||||||
|
@ -1658,9 +1640,7 @@ LOCALPROC CheckKeyboardLayout(void)
|
||||||
VkMapFromLayout(sv);
|
VkMapFromLayout(sv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ItnlKyBdFix
|
|
||||||
LOCALPROC InitCheckKeyboardLayout(void)
|
LOCALPROC InitCheckKeyboardLayout(void)
|
||||||
{
|
{
|
||||||
uimr sv;
|
uimr sv;
|
||||||
|
@ -1851,11 +1831,7 @@ LOCALPROC DoKeyCode(int i, bool down)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef EnableGrabSpecialKeys
|
#ifndef EnableGrabSpecialKeys
|
||||||
#if UseWinCE
|
|
||||||
#define EnableGrabSpecialKeys 0
|
|
||||||
#else
|
|
||||||
#define EnableGrabSpecialKeys (MayFullScreen && GrabKeysFullScreen)
|
#define EnableGrabSpecialKeys (MayFullScreen && GrabKeysFullScreen)
|
||||||
#endif
|
|
||||||
#endif /* EnableGrabSpecialKeys */
|
#endif /* EnableGrabSpecialKeys */
|
||||||
|
|
||||||
#if EnableGrabSpecialKeys
|
#if EnableGrabSpecialKeys
|
||||||
|
@ -2129,11 +2105,7 @@ LOCALPROC UnGrabSpecialKeys(void)
|
||||||
/* --- priority --- */
|
/* --- priority --- */
|
||||||
|
|
||||||
#ifndef EnableChangePriority
|
#ifndef EnableChangePriority
|
||||||
#if UseWinCE
|
|
||||||
#define EnableChangePriority 0
|
|
||||||
#else
|
|
||||||
#define EnableChangePriority MayFullScreen
|
#define EnableChangePriority MayFullScreen
|
||||||
#endif
|
|
||||||
#endif /* EnableChangePriority */
|
#endif /* EnableChangePriority */
|
||||||
|
|
||||||
#if EnableChangePriority
|
#if EnableChangePriority
|
||||||
|
@ -2826,11 +2798,6 @@ LOCALPROC GetWndTitle(void)
|
||||||
|
|
||||||
LOCALPROC DisposeMainWindow(void)
|
LOCALPROC DisposeMainWindow(void)
|
||||||
{
|
{
|
||||||
#if UseWinCE
|
|
||||||
/* Show the taskbar */
|
|
||||||
SHFullScreen(MainWnd, SHFS_SHOWTASKBAR);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (MainWndDC != NULL) {
|
if (MainWndDC != NULL) {
|
||||||
ReleaseDC(MainWnd, MainWndDC);
|
ReleaseDC(MainWnd, MainWndDC);
|
||||||
}
|
}
|
||||||
|
@ -3128,11 +3095,6 @@ LOCALFUNC bool ReCreateMainWindow(void)
|
||||||
UnGrabTheMachine();
|
UnGrabTheMachine();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UseWinCE && 0
|
|
||||||
/* Show the taskbar */
|
|
||||||
SHFullScreen(MainWnd, SHFS_SHOWTASKBAR);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MayNotFullScreen
|
#if MayNotFullScreen
|
||||||
CurWinIndx = WinIndx;
|
CurWinIndx = WinIndx;
|
||||||
#endif
|
#endif
|
||||||
|
@ -3140,26 +3102,18 @@ LOCALFUNC bool ReCreateMainWindow(void)
|
||||||
MainWnd = NewMainWindow;
|
MainWnd = NewMainWindow;
|
||||||
MainWndDC = NewMainWndDC;
|
MainWndDC = NewMainWndDC;
|
||||||
gTrueBackgroundFlag = false;
|
gTrueBackgroundFlag = false;
|
||||||
#if 1
|
|
||||||
UseFullScreen = WantFullScreen;
|
UseFullScreen = WantFullScreen;
|
||||||
#endif
|
|
||||||
#if 1
|
|
||||||
UseMagnify = WantMagnify;
|
UseMagnify = WantMagnify;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (UseFullScreen)
|
if (UseFullScreen)
|
||||||
#endif
|
|
||||||
#if MayFullScreen
|
#if MayFullScreen
|
||||||
{
|
{
|
||||||
ViewHSize = ScreenX;
|
ViewHSize = ScreenX;
|
||||||
ViewVSize = ScreenY;
|
ViewVSize = ScreenY;
|
||||||
#if 1
|
|
||||||
if (UseMagnify) {
|
if (UseMagnify) {
|
||||||
ViewHSize /= WindowScale;
|
ViewHSize /= WindowScale;
|
||||||
ViewVSize /= WindowScale;
|
ViewVSize /= WindowScale;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (ViewHSize >= vMacScreenWidth) {
|
if (ViewHSize >= vMacScreenWidth) {
|
||||||
ViewHStart = 0;
|
ViewHStart = 0;
|
||||||
ViewHSize = vMacScreenWidth;
|
ViewHSize = vMacScreenWidth;
|
||||||
|
@ -3190,70 +3144,6 @@ LOCALFUNC bool ReCreateMainWindow(void)
|
||||||
} else {
|
} else {
|
||||||
(void) InvalidateRgn(MainWnd, NULL, FALSE);
|
(void) InvalidateRgn(MainWnd, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
/* Create and set logical palette for this window */
|
|
||||||
{
|
|
||||||
HPALETTE hpal;
|
|
||||||
LOGPALETTE *lppal = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) +
|
|
||||||
sizeof(PALETTEENTRY) * 2);
|
|
||||||
|
|
||||||
if (! lppal)
|
|
||||||
{
|
|
||||||
MacMsg("CreateWindow failed",
|
|
||||||
"Sorry, Mini vMac encountered errors"
|
|
||||||
" and cannot continue.", true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
lppal->palNumEntries = 2;
|
|
||||||
lppal->palVersion = 0x0300;
|
|
||||||
lppal->palPalEntry[0].peRed = 255;
|
|
||||||
lppal->palPalEntry[0].peGreen = 255;
|
|
||||||
lppal->palPalEntry[0].peBlue = 255;
|
|
||||||
lppal->palPalEntry[0].peFlags = 0;
|
|
||||||
lppal->palPalEntry[1].peRed = 0;
|
|
||||||
lppal->palPalEntry[1].peGreen = 0;
|
|
||||||
lppal->palPalEntry[1].peBlue = 0;
|
|
||||||
lppal->palPalEntry[1].peFlags = 0;
|
|
||||||
|
|
||||||
hpal = CreatePalette(lppal);
|
|
||||||
|
|
||||||
if (hpal == NULL) {
|
|
||||||
free(lppal);
|
|
||||||
MacMsg("CreateWindow failed",
|
|
||||||
"Sorry, Mini vMac encountered errors"
|
|
||||||
" and cannot continue.", true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SelectPalette(MainWndDC, hpal, FALSE) == NULL) {
|
|
||||||
free(lppal);
|
|
||||||
MacMsg("CreateWindow failed",
|
|
||||||
"Sorry, Mini vMac encountered errors"
|
|
||||||
" and cannot continue.", true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RealizePalette(MainWndDC) == GDI_ERROR) {
|
|
||||||
free(lppal);
|
|
||||||
MacMsg("CreateWindow failed",
|
|
||||||
"Sorry, Mini vMac encountered errors"
|
|
||||||
" and cannot continue.", true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(lppal);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
/* Hide the taskbar */
|
|
||||||
SHFullScreen(MainWnd, SHFS_HIDETASKBAR);
|
|
||||||
(void) MoveWindow(MainWnd, 0, 0,
|
|
||||||
ScreenX, ScreenY, TRUE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (HaveCursorHidden) {
|
if (HaveCursorHidden) {
|
||||||
(void) MoveMouse(CurMouseH, CurMouseV);
|
(void) MoveMouse(CurMouseH, CurMouseV);
|
||||||
WantCursorHidden = true;
|
WantCursorHidden = true;
|
||||||
|
@ -3262,39 +3152,14 @@ LOCALFUNC bool ReCreateMainWindow(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
LOCALFUNC bool AlreadyRunningCheck(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Adapted from example program from Microsoft eMbedded Visual C++
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* If it is already running, then focus on the window */
|
|
||||||
HWND hWnd = FindWindow(WndClassName, WndTitle);
|
|
||||||
if (hWnd == NULL) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
Set focus to foremost child window.
|
|
||||||
The "| 0x01" is used to bring any owned
|
|
||||||
windows to the foreground and activate them.
|
|
||||||
*/
|
|
||||||
SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct BITMAPINFOHEADER256 {
|
typedef struct BITMAPINFOHEADER256 {
|
||||||
BITMAPINFOHEADER bmi;
|
BITMAPINFOHEADER bmi;
|
||||||
RGBQUAD colors[CLUT_size];
|
RGBQUAD colors[CLUT_size];
|
||||||
//RGBQUAD colors[2];
|
//RGBQUAD colors[2];
|
||||||
} BITMAPINFOHEADER256;
|
} BITMAPINFOHEADER256;
|
||||||
|
|
||||||
#if 1
|
|
||||||
#define ScaledHeight (WindowScale * vMacScreenHeight)
|
#define ScaledHeight (WindowScale * vMacScreenHeight)
|
||||||
#define ScaledWidth (WindowScale * vMacScreenWidth)
|
#define ScaledWidth (WindowScale * vMacScreenWidth)
|
||||||
#endif
|
|
||||||
|
|
||||||
LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
int16_t bottom, int16_t right)
|
int16_t bottom, int16_t right)
|
||||||
|
@ -3304,9 +3169,7 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
int XDest;
|
int XDest;
|
||||||
int YDest;
|
int YDest;
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (UseFullScreen)
|
if (UseFullScreen)
|
||||||
#endif
|
|
||||||
#if MayFullScreen
|
#if MayFullScreen
|
||||||
{
|
{
|
||||||
if (top < ViewVStart) {
|
if (top < ViewVStart) {
|
||||||
|
@ -3331,9 +3194,7 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
XDest = left;
|
XDest = left;
|
||||||
YDest = top;
|
YDest = top;
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (UseFullScreen)
|
if (UseFullScreen)
|
||||||
#endif
|
|
||||||
#if MayFullScreen
|
#if MayFullScreen
|
||||||
{
|
{
|
||||||
XDest -= ViewHStart;
|
XDest -= ViewHStart;
|
||||||
|
@ -3341,15 +3202,11 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (UseMagnify) {
|
if (UseMagnify) {
|
||||||
XDest *= WindowScale;
|
XDest *= WindowScale;
|
||||||
YDest *= WindowScale;
|
YDest *= WindowScale;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if 1
|
|
||||||
if (UseFullScreen)
|
if (UseFullScreen)
|
||||||
#endif
|
|
||||||
#if MayFullScreen
|
#if MayFullScreen
|
||||||
{
|
{
|
||||||
XDest += hOffset;
|
XDest += hOffset;
|
||||||
|
@ -3357,16 +3214,6 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
{ /* testing code */
|
|
||||||
if (PatBlt(MainWndDC,
|
|
||||||
(int)left - 1,
|
|
||||||
(int)top - 1,
|
|
||||||
(int)right - left + 2,
|
|
||||||
(int)bottom - top + 2, PATCOPY)) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (vMacScreenDepth > 0 && UseColorMode) {
|
if (vMacScreenDepth > 0 && UseColorMode) {
|
||||||
int i;
|
int i;
|
||||||
int nDestWidth = (right - left);
|
int nDestWidth = (right - left);
|
||||||
|
@ -3451,12 +3298,10 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (UseMagnify) {
|
if (UseMagnify) {
|
||||||
nDestWidth *= WindowScale;
|
nDestWidth *= WindowScale;
|
||||||
nDestHeight *= WindowScale;
|
nDestHeight *= WindowScale;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (StretchDIBits(
|
if (StretchDIBits(
|
||||||
MainWndDC, /* handle of device context */
|
MainWndDC, /* handle of device context */
|
||||||
|
@ -3494,7 +3339,6 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
bmh.bmi.biYPelsPerMeter = 0;
|
bmh.bmi.biYPelsPerMeter = 0;
|
||||||
bmh.bmi.biClrUsed = 0;
|
bmh.bmi.biClrUsed = 0;
|
||||||
bmh.bmi.biClrImportant = 0;
|
bmh.bmi.biClrImportant = 0;
|
||||||
#if ! UseWinCE
|
|
||||||
bmh.colors[0].rgbRed = 255;
|
bmh.colors[0].rgbRed = 255;
|
||||||
bmh.colors[0].rgbGreen = 255;
|
bmh.colors[0].rgbGreen = 255;
|
||||||
bmh.colors[0].rgbBlue = 255;
|
bmh.colors[0].rgbBlue = 255;
|
||||||
|
@ -3503,9 +3347,7 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
bmh.colors[1].rgbGreen = 0;
|
bmh.colors[1].rgbGreen = 0;
|
||||||
bmh.colors[1].rgbBlue = 0;
|
bmh.colors[1].rgbBlue = 0;
|
||||||
bmh.colors[1].rgbReserved = 0;
|
bmh.colors[1].rgbReserved = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (UseMagnify) {
|
if (UseMagnify) {
|
||||||
#if EnableScalingBuff
|
#if EnableScalingBuff
|
||||||
if (ScalingBuff != NULL) {
|
if (ScalingBuff != NULL) {
|
||||||
|
@ -3597,55 +3439,11 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
/* address of array with DIB bits */
|
/* address of array with DIB bits */
|
||||||
(const struct tagBITMAPINFO *)&bmh,
|
(const struct tagBITMAPINFO *)&bmh,
|
||||||
/* address of structure with bitmap info. */
|
/* address of structure with bitmap info. */
|
||||||
#if ! UseWinCE
|
|
||||||
DIB_RGB_COLORS /* RGB or palette indices */
|
DIB_RGB_COLORS /* RGB or palette indices */
|
||||||
#else
|
|
||||||
DIB_PAL_COLORS /* palette indices */
|
|
||||||
#endif
|
|
||||||
) == 0) {
|
) == 0) {
|
||||||
/* ReportWinLastError(); */
|
/* ReportWinLastError(); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (StretchDIBits(
|
|
||||||
MainWndDC, /* handle of device context */
|
|
||||||
XDest,
|
|
||||||
/*
|
|
||||||
x-coordinate of upper-left corner of dest. rect.
|
|
||||||
*/
|
|
||||||
YDest,
|
|
||||||
/*
|
|
||||||
y-coordinate of upper-left corner of dest. rect.
|
|
||||||
*/
|
|
||||||
(right - left) * WindowScale,
|
|
||||||
/* dest. rectangle width */
|
|
||||||
(bottom - top) * WindowScale,
|
|
||||||
/* dest. rectangle height */
|
|
||||||
left,
|
|
||||||
/*
|
|
||||||
x-coordinate of lower-left corner
|
|
||||||
of source rect.
|
|
||||||
*/
|
|
||||||
0,
|
|
||||||
/*
|
|
||||||
y-coordinate of lower-left corner
|
|
||||||
of source rect.
|
|
||||||
*/
|
|
||||||
(right - left), /* source rectangle width */
|
|
||||||
(bottom - top), /* source rectangle height */
|
|
||||||
(CONST VOID *)p, /* address of array with DIB bits */
|
|
||||||
(const struct tagBITMAPINFO *)&bmh,
|
|
||||||
/* address of structure with bitmap info. */
|
|
||||||
#if ! UseWinCE
|
|
||||||
DIB_RGB_COLORS, /* RGB or palette indices */
|
|
||||||
#else
|
|
||||||
DIB_PAL_COLORS, /* palette indices */
|
|
||||||
#endif
|
|
||||||
SRCCOPY
|
|
||||||
) == 0) {
|
|
||||||
/* ReportWinLastError(); */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3677,11 +3475,7 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
|
||||||
(CONST VOID *)p, /* address of array with DIB bits */
|
(CONST VOID *)p, /* address of array with DIB bits */
|
||||||
(const struct tagBITMAPINFO *)&bmh,
|
(const struct tagBITMAPINFO *)&bmh,
|
||||||
/* address of structure with bitmap info. */
|
/* address of structure with bitmap info. */
|
||||||
#if ! UseWinCE
|
|
||||||
DIB_RGB_COLORS /* RGB or palette indices */
|
DIB_RGB_COLORS /* RGB or palette indices */
|
||||||
#else
|
|
||||||
DIB_PAL_COLORS /* palette indices */
|
|
||||||
#endif
|
|
||||||
) == 0) {
|
) == 0) {
|
||||||
/* ReportWinLastError(); */
|
/* ReportWinLastError(); */
|
||||||
}
|
}
|
||||||
|
@ -3820,20 +3614,17 @@ LOCALPROC MousePositionNotify(LONG NewMousePosx, LONG NewMousePosy)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! UseWinCE
|
|
||||||
/* if (ShouldHaveCursorHidden || CurMouseButton) */
|
/* if (ShouldHaveCursorHidden || CurMouseButton) */
|
||||||
/*
|
/*
|
||||||
for a game like arkanoid, would like mouse to still
|
for a game like arkanoid, would like mouse to still
|
||||||
move even when outside window in one direction
|
move even when outside window in one direction
|
||||||
*/
|
*/
|
||||||
#endif
|
|
||||||
MousePositionSet(NewMousePosx, NewMousePosy);
|
MousePositionSet(NewMousePosx, NewMousePosy);
|
||||||
}
|
}
|
||||||
|
|
||||||
WantCursorHidden = ShouldHaveCursorHidden;
|
WantCursorHidden = ShouldHaveCursorHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ! UseWinCE
|
|
||||||
LOCALPROC CheckMouseState(void)
|
LOCALPROC CheckMouseState(void)
|
||||||
{
|
{
|
||||||
POINT NewMousePos;
|
POINT NewMousePos;
|
||||||
|
@ -3843,7 +3634,6 @@ LOCALPROC CheckMouseState(void)
|
||||||
NewMousePos.y -= WndY;
|
NewMousePos.y -= WndY;
|
||||||
MousePositionNotify(NewMousePos.x, NewMousePos.y);
|
MousePositionNotify(NewMousePos.x, NewMousePos.y);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
LOCALVAR const uint8_t Native2MacRomanTab[] = {
|
LOCALVAR const uint8_t Native2MacRomanTab[] = {
|
||||||
0xAD, 0xB0, 0xE2, 0xC4, 0xE3, 0xC9, 0xA0, 0xE0,
|
0xAD, 0xB0, 0xE2, 0xC4, 0xE3, 0xC9, 0xA0, 0xE0,
|
||||||
|
@ -4692,20 +4482,12 @@ LOCALFUNC bool GetAppDataPath(LPTSTR lpszPath,
|
||||||
return IsOk;
|
return IsOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
/* Are we in control mode? */
|
|
||||||
/* Needed because you can't hold down a key with the virtual keyboard */
|
|
||||||
LOCALVAR bool CtrlMode = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LOCALPROC InsertADisk0(void)
|
LOCALPROC InsertADisk0(void)
|
||||||
{
|
{
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
TCHAR szDirName[256];
|
TCHAR szDirName[256];
|
||||||
TCHAR szFile[256];
|
TCHAR szFile[256];
|
||||||
#if ! UseWinCE
|
|
||||||
TCHAR szFileTitle[256];
|
TCHAR szFileTitle[256];
|
||||||
#endif
|
|
||||||
UINT i;
|
UINT i;
|
||||||
size_t cbString;
|
size_t cbString;
|
||||||
TCHAR chReplace;
|
TCHAR chReplace;
|
||||||
|
@ -4737,10 +4519,8 @@ LOCALPROC InsertADisk0(void)
|
||||||
ofn.nFilterIndex = 2;
|
ofn.nFilterIndex = 2;
|
||||||
ofn.lpstrFile= szFile;
|
ofn.lpstrFile= szFile;
|
||||||
ofn.nMaxFile = sizeof(szFile);
|
ofn.nMaxFile = sizeof(szFile);
|
||||||
#if ! UseWinCE
|
|
||||||
ofn.lpstrFileTitle = szFileTitle;
|
ofn.lpstrFileTitle = szFileTitle;
|
||||||
ofn.nMaxFileTitle = sizeof(szFileTitle);
|
ofn.nMaxFileTitle = sizeof(szFileTitle);
|
||||||
#endif
|
|
||||||
ofn.lpstrInitialDir = szDirName;
|
ofn.lpstrInitialDir = szDirName;
|
||||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST
|
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST
|
||||||
| OFN_HIDEREADONLY;
|
| OFN_HIDEREADONLY;
|
||||||
|
@ -4751,21 +4531,10 @@ LOCALPROC InsertADisk0(void)
|
||||||
|
|
||||||
if(! IsOk) {
|
if(! IsOk) {
|
||||||
/* report error */
|
/* report error */
|
||||||
#if UseWinCE
|
|
||||||
if (szFile[0]) {
|
|
||||||
char wMsg[1024];
|
|
||||||
sprintf(wMsg, "Couldn't open %ls", szFile);
|
|
||||||
MacMsg("error", wMsg, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
(void) InsertDiskOrAlias(ofn.lpstrFile,
|
(void) InsertDiskOrAlias(ofn.lpstrFile,
|
||||||
true, false);
|
true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
CtrlMode = false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCALFUNC bool LoadInitialImageFromName(char *ImageName)
|
LOCALFUNC bool LoadInitialImageFromName(char *ImageName)
|
||||||
|
@ -5440,11 +5209,6 @@ LOCALPROC CheckForSavedTasks(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
/* Sip Status ON/OFF */
|
|
||||||
LOCALVAR bool SipOn = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LRESULT CALLBACK Win32WMProc(HWND hwnd,
|
LRESULT CALLBACK Win32WMProc(HWND hwnd,
|
||||||
UINT uMessage, WPARAM wparam, LPARAM lparam);
|
UINT uMessage, WPARAM wparam, LPARAM lparam);
|
||||||
|
|
||||||
|
@ -5480,125 +5244,15 @@ LRESULT CALLBACK Win32WMProc(HWND hwnd,
|
||||||
|
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
#if UseWinCE
|
|
||||||
SipOn = false;
|
|
||||||
|
|
||||||
{
|
|
||||||
SIPINFO r;
|
|
||||||
|
|
||||||
memset(&r, 0 , sizeof(SIPINFO));
|
|
||||||
r.cbSize = sizeof(SIPINFO);
|
|
||||||
if (SipGetInfo(&r)) {
|
|
||||||
SipOn = 0 != (r.fdwFlags & SIPF_ON);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wparam == 0xAE) {
|
|
||||||
break;
|
|
||||||
} else if ((! SipOn) && (wparam == VK_RETURN)) {
|
|
||||||
break;
|
|
||||||
} else if ((! SipOn)
|
|
||||||
&& (wparam >= VK_LEFT) && (wparam <= VK_DOWN))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
} else if (wparam == VK_CONTROL && CtrlMode) {
|
|
||||||
DoVKcode0(wparam, false);
|
|
||||||
CtrlMode = false;
|
|
||||||
break;
|
|
||||||
} else if (wparam == VK_CONTROL) {
|
|
||||||
DoVKcode0(wparam, true);
|
|
||||||
CtrlMode = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (! TestBit(lparam, 30)) { /* ignore repeats */
|
if (! TestBit(lparam, 30)) { /* ignore repeats */
|
||||||
DoVKcode(wparam, lparam >> 24, true);
|
DoVKcode(wparam, lparam >> 24, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
return TRUE;
|
|
||||||
/*
|
|
||||||
So that hardware keys won't be
|
|
||||||
processed by the default handler
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
case WM_SYSKEYUP:
|
case WM_SYSKEYUP:
|
||||||
#if UseWinCE
|
|
||||||
SipOn = false;
|
|
||||||
|
|
||||||
{
|
|
||||||
SIPINFO r;
|
|
||||||
|
|
||||||
memset(&r, 0 , sizeof(SIPINFO));
|
|
||||||
r.cbSize = sizeof(SIPINFO);
|
|
||||||
if (SipGetInfo(&r)) {
|
|
||||||
SipOn = 0 != (r.fdwFlags & SIPF_ON);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wparam == 0xAE) { /* to hide SoftInput panel */
|
|
||||||
SipShowIM(SIPF_OFF);
|
|
||||||
break;
|
|
||||||
} else if ((! SipOn) && (wparam == VK_RETURN)) {
|
|
||||||
/* DPad Action to show SIP */
|
|
||||||
/* Show SoftInput Panel */
|
|
||||||
SipShowIM(SIPF_ON);
|
|
||||||
break;
|
|
||||||
} else if ((! SipOn)
|
|
||||||
&& (wparam >= VK_LEFT) && (wparam <= VK_DOWN))
|
|
||||||
{
|
|
||||||
switch (wparam) {
|
|
||||||
case VK_LEFT:
|
|
||||||
if (ViewHStart < (ViewHSize / 2)) {
|
|
||||||
ViewHStart = 0;
|
|
||||||
} else {
|
|
||||||
ViewHStart -= (ViewHSize / 2);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case VK_UP:
|
|
||||||
if (ViewVStart < (ViewVSize / 2)) {
|
|
||||||
ViewVStart = 0;
|
|
||||||
} else {
|
|
||||||
ViewVStart -= (ViewVSize / 2);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case VK_RIGHT:
|
|
||||||
ViewHStart += (ViewHSize / 2);
|
|
||||||
if (ViewHStart >= (vMacScreenWidth - ViewHSize))
|
|
||||||
{
|
|
||||||
ViewHStart = vMacScreenWidth - ViewHSize;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case VK_DOWN:
|
|
||||||
ViewVStart += (ViewVSize / 2);
|
|
||||||
if (ViewVStart
|
|
||||||
>= (vMacScreenHeight - ViewVSize))
|
|
||||||
{
|
|
||||||
ViewVStart = vMacScreenHeight - ViewVSize;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Screen_DrawAll();
|
|
||||||
} else
|
|
||||||
if (wparam == VK_CONTROL && CtrlMode) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
DoVKcode(wparam, lparam >> 24, false);
|
DoVKcode(wparam, lparam >> 24, false);
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
return TRUE;
|
|
||||||
/*
|
|
||||||
So that hardware keys won't be
|
|
||||||
processed by the default handler
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#if ItnlKyBdFix && ! UseWinCE
|
#if ItnlKyBdFix
|
||||||
case WM_INPUTLANGCHANGE:
|
case WM_INPUTLANGCHANGE:
|
||||||
CheckKeyboardLayout();
|
CheckKeyboardLayout();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -5608,7 +5262,6 @@ LRESULT CALLBACK Win32WMProc(HWND hwnd,
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
RequestMacOff = true;
|
RequestMacOff = true;
|
||||||
break;
|
break;
|
||||||
#if ! UseWinCE
|
|
||||||
case WM_QUERYENDSESSION:
|
case WM_QUERYENDSESSION:
|
||||||
if (AnyDiskInserted()) {
|
if (AnyDiskInserted()) {
|
||||||
RequestMacOff = true;
|
RequestMacOff = true;
|
||||||
|
@ -5617,7 +5270,6 @@ LRESULT CALLBACK Win32WMProc(HWND hwnd,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
if (MainWnd == hwnd) {
|
if (MainWnd == hwnd) {
|
||||||
gTrueBackgroundFlag = (LOWORD(wparam) == WA_INACTIVE);
|
gTrueBackgroundFlag = (LOWORD(wparam) == WA_INACTIVE);
|
||||||
|
@ -5659,9 +5311,6 @@ LRESULT CALLBACK Win32WMProc(HWND hwnd,
|
||||||
SetCurMouseButton(false);
|
SetCurMouseButton(false);
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
#if UseWinCE
|
|
||||||
MousePositionNotify(LOWORD (lparam), HIWORD (lparam));
|
|
||||||
#endif
|
|
||||||
/* windows may have messed up cursor */
|
/* windows may have messed up cursor */
|
||||||
/*
|
/*
|
||||||
there is no notification when the mouse moves
|
there is no notification when the mouse moves
|
||||||
|
@ -5693,11 +5342,7 @@ LOCALFUNC bool RegisterOurClass(void)
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
|
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW
|
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||||
#if ! UseWinCE
|
|
||||||
| CS_OWNDC
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
wc.lpfnWndProc = (WNDPROC)Win32WMProc;
|
wc.lpfnWndProc = (WNDPROC)Win32WMProc;
|
||||||
wc.cbClsExtra = 0;
|
wc.cbClsExtra = 0;
|
||||||
wc.cbWndExtra = 0;
|
wc.cbWndExtra = 0;
|
||||||
|
@ -5766,9 +5411,7 @@ label_retry:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (gBackgroundFlag)) {
|
if (! (gBackgroundFlag)) {
|
||||||
#if ! UseWinCE
|
|
||||||
CheckMouseState();
|
CheckMouseState();
|
||||||
#endif
|
|
||||||
|
|
||||||
#if EnableGrabSpecialKeys
|
#if EnableGrabSpecialKeys
|
||||||
CheckForLostKeyUps();
|
CheckForLostKeyUps();
|
||||||
|
@ -5782,106 +5425,6 @@ label_retry:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
LOCALFUNC bool Init_ChangeOrientation(void)
|
|
||||||
{
|
|
||||||
DEVMODE dm;
|
|
||||||
|
|
||||||
/* initialize the DEVMODE structure */
|
|
||||||
ZeroMemory(&dm, sizeof (dm));
|
|
||||||
dm.dmSize = sizeof (dm);
|
|
||||||
|
|
||||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
|
|
||||||
|
|
||||||
/* Backup old values */
|
|
||||||
oldOrientation = dm.dmOrientation;
|
|
||||||
oldDisplayOrientation = dm.dmDisplayOrientation;
|
|
||||||
|
|
||||||
|
|
||||||
/* Hide SIP (you can never tell...) */
|
|
||||||
SipShowIM(SIPF_OFF);
|
|
||||||
|
|
||||||
/* Switch to Landscape mode if possible */
|
|
||||||
dm.dmOrientation = DMORIENT_LANDSCAPE;
|
|
||||||
dm.dmDisplayOrientation = DMDO_90;
|
|
||||||
dm.dmFields = DM_ORIENTATION | DM_DISPLAYORIENTATION;
|
|
||||||
(void) ChangeDisplaySettingsEx(NULL, &dm, NULL, 0, 0);
|
|
||||||
/*
|
|
||||||
if (ChangeDisplaySettingsEx(NULL, &dm, NULL, 0, 0) !=
|
|
||||||
DISP_CHANGE_SUCCESSFUL)
|
|
||||||
{
|
|
||||||
MacMsg ("warning",
|
|
||||||
"Couldn't switch to Landscape mode.", false);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
LOCALPROC Uninit_ChangeOrientation(void)
|
|
||||||
{
|
|
||||||
DEVMODE dm;
|
|
||||||
|
|
||||||
/* Restore old display orientation */
|
|
||||||
ZeroMemory(&dm, sizeof (dm));
|
|
||||||
dm.dmSize = sizeof(dm);
|
|
||||||
|
|
||||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
|
|
||||||
|
|
||||||
dm.dmOrientation = oldOrientation;
|
|
||||||
dm.dmDisplayOrientation = oldDisplayOrientation;
|
|
||||||
dm.dmFields = DM_ORIENTATION | DM_DISPLAYORIENTATION;
|
|
||||||
|
|
||||||
ChangeDisplaySettingsEx(NULL, &dm, 0, 0, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ** code for handling hardware keys in Pocket PC devices ** */
|
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
typedef BOOL (__stdcall *UnregisterFunc1Proc)(UINT, UINT);
|
|
||||||
LOCALVAR HINSTANCE hCoreDLL = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
LOCALFUNC bool InitHotKeys(void)
|
|
||||||
{
|
|
||||||
UnregisterFunc1Proc procUndergisterFunc;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
hCoreDLL = LoadLibrary(TEXT("coredll.dll"));
|
|
||||||
if (! hCoreDLL) {
|
|
||||||
MacMsg ("Fatal", "Could not load coredll.dll", true);
|
|
||||||
} else {
|
|
||||||
procUndergisterFunc =
|
|
||||||
(UnregisterFunc1Proc) GetProcAddress(hCoreDLL,
|
|
||||||
TEXT("UnregisterFunc1"));
|
|
||||||
if (! procUndergisterFunc) {
|
|
||||||
MacMsg ("Fatal",
|
|
||||||
"Could not get UnregisterFunc1 procedure", true);
|
|
||||||
} else {
|
|
||||||
for (i = 0xc1; i <= 0xcf; ++i) {
|
|
||||||
procUndergisterFunc(MOD_WIN, i);
|
|
||||||
RegisterHotKey(MainWnd, i, MOD_WIN, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UseWinCE
|
|
||||||
LOCALPROC UninitHotKeys(void)
|
|
||||||
{
|
|
||||||
if (! hCoreDLL) {
|
|
||||||
FreeLibrary(hCoreDLL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "PROGMAIN.h"
|
#include "PROGMAIN.h"
|
||||||
|
|
||||||
/* ************************ */
|
/* ************************ */
|
||||||
|
@ -5976,15 +5519,9 @@ LOCALFUNC bool InitOSGLU(void)
|
||||||
if (RegisterInRegistry())
|
if (RegisterInRegistry())
|
||||||
#endif
|
#endif
|
||||||
if (LoadMacRom())
|
if (LoadMacRom())
|
||||||
#if UseWinCE
|
|
||||||
if (Init_ChangeOrientation())
|
|
||||||
#endif
|
|
||||||
if (ReCreateMainWindow())
|
if (ReCreateMainWindow())
|
||||||
if (InitWinKey2Mac())
|
if (InitWinKey2Mac())
|
||||||
if (InitTheCursor())
|
if (InitTheCursor())
|
||||||
#if UseWinCE
|
|
||||||
if (InitHotKeys())
|
|
||||||
#endif
|
|
||||||
if (Init60thCheck())
|
if (Init60thCheck())
|
||||||
if (WaitForRom())
|
if (WaitForRom())
|
||||||
{
|
{
|
||||||
|
@ -6016,10 +5553,6 @@ LOCALPROC UnInitOSGLU(void)
|
||||||
UnInitDrives();
|
UnInitDrives();
|
||||||
|
|
||||||
ForceShowCursor();
|
ForceShowCursor();
|
||||||
#if UseWinCE
|
|
||||||
Uninit_ChangeOrientation();
|
|
||||||
UninitHotKeys();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if EnableShellLinks
|
#if EnableShellLinks
|
||||||
UninitCOM();
|
UninitCOM();
|
||||||
|
@ -6047,12 +5580,6 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
CommandLine = lpCmdLine;
|
CommandLine = lpCmdLine;
|
||||||
|
|
||||||
GetWndTitle();
|
GetWndTitle();
|
||||||
#if UseWinCE
|
|
||||||
if (AlreadyRunningCheck()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ZapOSGLUVars();
|
ZapOSGLUVars();
|
||||||
if (InitOSGLU()) {
|
if (InitOSGLU()) {
|
||||||
ProgramMain();
|
ProgramMain();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user