source: trunk/src/ddraw/os2util.cpp@ 21916

Last change on this file since 21916 was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 2.9 KB
Line 
1/* $Id: OS2UTIL.CPP,v 1.16 2003-02-04 17:40:55 sandervl Exp $ */
2
3/*
4 * OS/2 Utility functions
5 *
6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11#define INCL_DOS
12#define INCL_DOSMEMMGR
13#define INCL_DOSDEVICES
14#define INCL_WIN
15#include <os2wrap.h>
16#include <misc.h>
17#include "os2util.h"
18#include "cio2.h"
19
20//******************************************************************************
21//******************************************************************************
22char *OS2AllocMem(ULONG size)
23{
24 PVOID lpMem;
25 APIRET rc;
26
27 rc = DosAllocMem(&lpMem, size, PAG_READ|PAG_WRITE|PAG_COMMIT);
28 if(rc) {
29 dprintf(("DDRAW: DosAllocMem returned %d", rc));
30 return(NULL);
31 }
32 return((char *)lpMem);
33}
34//******************************************************************************
35//******************************************************************************
36void OS2FreeMem(char *lpMem)
37{
38 APIRET rc;
39
40 rc = DosFreeMem(lpMem);
41 if(rc) {
42 dprintf(("DDRAW: DosFreeMem returned %d", rc));
43 }
44}//******************************************************************************
45//******************************************************************************
46void OS2MaximizeWindow(HWND hwndClient)
47{
48 WinSetWindowPos(hwndClient, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE);
49}
50//******************************************************************************
51//******************************************************************************
52BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG mp1, ULONG mp2)
53{
54 return WinPostMsg(hwnd, msg, (MPARAM)mp1, (MPARAM)mp2);
55}
56//******************************************************************************
57//******************************************************************************
58
59extern "C" {
60BOOL APIENTRY _GpiEnableYInversion (HPS hps, LONG lHeight);
61}
62
63void InverseDC(HDC hdc, LONG lHeight)
64{
65 USHORT sel = RestoreOS2FS();
66
67// _GpiEnableYInversion( WinGetPS( Win32ToOS2Handle( WindowFromDC(hdc) ) ), lHeight);
68 _GpiEnableYInversion( hdc, lHeight);
69 SetFS(sel);
70
71}
72//******************************************************************************
73//******************************************************************************
74int InitIO()
75{
76#if 0
77 WORD gdt;
78 HRESULT rc;
79 HFILE device;
80 ULONG ulAction;
81
82 rc = DosOpen( "\\dev\\fastio$",
83 &device,
84 &ulAction,
85 0,0,1,
86 OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE,
87 0);
88 if(rc)
89 return rc;
90
91 rc = DosDevIOCtl( device, 118, 100, 0,0,0,&gdt,2,&ulAction);
92
93 DosClose(device);
94
95 if(rc)
96 {
97 return rc;
98 }
99
100 USHORT sel = RestoreOS2FS();
101
102 io_init2(gdt);
103
104 SetFS(sel);
105#endif
106 return 0;
107}
108//******************************************************************************
109//******************************************************************************
Note: See TracBrowser for help on using the repository browser.