Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » ModeX in Win32

This thread is locked; no one can reply to it. rss feed Print
ModeX in Win32
Chris Pable
Member #2,643
August 2002
avatar

Is it possible to have modeX in an MSVC win32 app? I kinda really need modex cuz my program relies on speed. Id use DJPP but i have no clue what to download :\. I know its pretty stupid but if its possible or someone can help me find out what i need to get at DJPPs site. Id be very grateful. Thanks.

--------
Professional Nutcase....

Goalie Ca
Member #2,579
July 2002
avatar

isn't directx h-accell faster? Its all done by gpu rather than cpu. And transfers over the bus are limited that way too.

-------------
Bah weep granah weep nini bong!

Gabhonga
Member #1,247
February 2001
avatar

djGpp can be found at www.delorie.com/djgpp/...heh, all you were lacking was a little gee...

you know dos/modex is already considered "retro", and cause lots of problems & pain on very new systems (winXP will give up on modex I think)...
but as your program relies on speed I assume you don't care and want to write it for people with old machines :)

--------------------------------------------------------
sigs suck

MindCode
Member #2,031
March 2002
avatar

To directly answer the question: yes. At least I've dont it. What I did was use the Win32 Api function ChangeVidioState (i think that's what it was called) to the vga res 320x200:8bpp figuring that windows would revert to the vga setup. Then I used the asm calls to "tweak" the mode. It worked but I don't think it's a good idea to try; it might not work with all cards and operating systems.

______________________________________
Frag The Planet

Thomas Harte
Member #33
April 2000
avatar

It definitely would not work with NT/2000/XP, which doesn't allow you direct hardware access. Also, I believe some drivers do supply card specific replacements for 320x200x8bpp. In this way, a graphics card for an XP machine need not be very VGA compatiable at all, supporting just whatever subset of the VGA functionality they have used for 640x480x4bpp mode.

Perhaps if you explain the factors which make you want to use Mode-X even on windows machines, people can come up with alternatives?

Goalie Ca
Member #2,579
July 2002
avatar

if it was soo good i'm sure it would appear in commercial games. there's no rhyme or reason for using it.

-------------
Bah weep granah weep nini bong!

Chris Pable
Member #2,643
August 2002
avatar

The machines Im designing this for cant handle the installation of direct X 7 and above I think 6 might even be too high so Im not going to use that. Mainly because these machine cant handle it ^_^. Im talking 486s running at 33MHZ and windows 98 ^_^. 640x480 is WAY too much for them to handle. I wanted to design the game so it would have something like commander keen quality graphics and speed. SO I figured Mode X was the way to go. Keep in mind people with pentiums also should also be able tio use this if they are running win xp. So from what it sounds like... Im trying to do thew impossible >.< If anyone has any other ideas please let me know... PS so rry i havent check on this for a bit School started and I was bogged down with home work ^_^

--------
Professional Nutcase....

HoopsMan
Member #1,943
February 2002

If you can use the DirectX 5.0 SDK, I seem to remember it having a DIRECTX_USE_MODEX or some such flag. Check out the DirectX 5.0 SDK docs for more help. I think this flag was removed in the later versions of the SDK. It is specified in the video mode settings function. (again, SetDisplayMode from the DirectDraw interface or some such ;D)

Thomas Harte
Member #33
April 2000
avatar

In that case, all you are doing is allowing DirectX to use the super-slow Mode-X for 320x240 mode, rather than simply not listing it as an available mode if your graphics driver doesn't support it as a mode. It doesn't mean DirectX will necessarily use Mode-X, and as I implied if it does use Mode-X there will be a large speed hit. This is because DirectX makes the front buffer appear to be genuinely linear (all DirectX modes are), and then decodes to the funny Mode-X memory arrangement behind your back.

HoopsMan
Member #1,943
February 2002

From the DirectX 5.0 SDK,

The IDirectDraw2::SetDisplayMode method sets the mode of the display-device hardware.

HRESULT SetDisplayMode(
DWORD dwWidth,
DWORD dwHeight,
DWORD dwBPP,
DWORD dwRefreshRate,
DWORD dwFlags
);

Parameters

dwWidth and dwHeight

Width and height of the new mode.

dwBPP

Bits per pixel (bpp) of the new mode.

dwRefreshRate

Refresh rate of the new mode. If this parameter is set to 0, the IDirectDraw interface version of this method is used.

dwFlags

Flags describing additional options. Currently, the only valid flag is DDSDM_STANDARDVGAMODE, which causes the method to set Mode 13 instead of Mode X 320x200x8 mode. If you are setting another resolution, bit depth, or a Mode X mode, do not use this flag and set the parameter to 0.

*******************

Also,

The IDirectDraw2::SetCooperativeLevel method determines the top-level behavior of the application.

HRESULT SetCooperativeLevel(
HWND hWnd,
DWORD dwFlags
);

Parameters

hWnd

Window handle used for the application. This parameter can be NULL when the DDSCL_NORMAL flag is specified in the dwFlags
parameter.

dwFlags

One or more of the following flags:

DDSCL_ALLOWMODEX
Allows the use of Mode X display modes. This flag must be used with the DDSCL_EXCLUSIVE and DDSCL_FULLSCREEN flags.

DDSCL_ALLOWREBOOT
Allows CTRL+ALT+DEL to function while in exclusive (full-screen) mode.

DDSCL_EXCLUSIVE
Requests the exclusive level. This flag must be used with the DDSCL_FULLSCREEN flag.

DDSCL_FULLSCREEN
Indicates that the exclusive-mode owner will be responsible for the entire primary surface. GDI can be ignored. This flag must be used with the DDSCL_EXCLUSIVE flag.

DDSCL_NORMAL
Indicates that the application will function as a regular Windows application. This flag cannot be used with the DDSCL_ALLOWMODEX, DDSCL_EXCLUSIVE, or DDSCL_FULLSCREEN flags.

DDSCL_NOWINDOWCHANGES
Indicates that DirectDraw is not allowed to minimize or restore the application window on activation.

*************

Hope it helps.

[EDIT]
This Page used to have a 9.0 MB DJGPP 3.0 zip archive. It's a University page (Surrey or something) for Protected Mode programming. That one archive contains a very good startup kit for DJGPP. Serveer seems to be down currently though...:'(

Go to: