Jump to content

Dune2K - High Resolution


CCHyper

Recommended Posts

EnumDisplaySettings is a Windows API call. You can get hold of it by importing win32api. The actual function description from MSDN:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd162611%28v=vs.85%29.aspx

 

Just a friendly way of telling the user if desired res is really supported, since i see many people on the forum where things don't seem to work out of the box (maybe because of that, maybe not). Not a necessary feature and of course if you feel like it ...

Little google turned up this piece of code:

import ctypesuser32 = ctypes.windll.user32screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)

So, with this I could check and prevent the user from patching with a resolution higher than his PC supports.

 

If this is what you mean, I will add it in the next version.

Link to comment
Share on other sites

Little google turned up this piece of code:

import ctypesuser32 = ctypes.windll.user32screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
So, with this I could check and prevent the user from patching with a resolution higher than his PC supports.

If this is what you mean, I will add it in the next version.

GetSystemMetrics is the wrong function. It can give you the fullscreen size but not all supported resolutions. EnumDisplaySettings is the function you should use. I can see if i have the time to implement this.

Link to comment
Share on other sites

mvi is making an image 'editor' for .r16 and .r8 files and you can find lots of info on http://d2kplus.com/wiki/index.php?title=Main_Page. However I think for the high resolution patch remaking textures etc. is not needed. If you want to make a mod, maybe than remaking textures is needed. Also it's too much work to remake it all. So, sorry, I won't help you with that.

 

 

Yep, made some great progress with it, I've not been able to do much the last couple of weeks, but I'm hoping to start a preview series of alpha releases for it soon, just so that I can make sure the first full release of the Resource Editor is perfect.

 

Absolutely fantastic work guys with the high res patching, it's truly exciting to see Dune 2000 being brought up to date with modern monitors. Do you mind if I start hosting a copy on the D2K+ site?

Link to comment
Share on other sites

Yep, made some great progress with it, I've not been able to do much the last couple of weeks, but I'm hoping to start a preview series of alpha releases for it soon, just so that I can make sure the first full release of the Resource Editor is perfect.

 

Absolutely fantastic work guys with the high res patching, it's truly exciting to see Dune 2000 being brought up to date with modern monitors. Do you mind if I start hosting a copy on the D2K+ site?

Not at all mvi. Thanks!

Link to comment
Share on other sites

GetSystemMetrics is the wrong function. It can give you the fullscreen size but not all supported resolutions. EnumDisplaySettings is the function you should use. I can see if i have the time to implement this.

I'm able to get win32api with EnumDisplaySettings also, but I couldn't find the correct variable/list to display the supported resolutions. I'm stuck at this:

>>> import win32api>>> a = win32api.EnumDisplaySettings(None,0)>>> dir(a)['BitsPerPel', 'Clear', 'Collate', 'Color', 'Copies', 'DefaultSource', 'DeviceName', 'DisplayFixedOutput', 'DisplayFlags', 'DisplayFrequency', 'DisplayOrientation', 'DitherType', 'DriverData', 'DriverExtra', 'DriverVersion', 'Duplex', 'Fields', 'FormName', 'ICMIntent', 'ICMMethod', 'LogPixels', 'MediaType', 'Nup', 'Orientation', 'PanningHeight', 'PanningWidth', 'PaperLength', 'PaperSize', 'PaperWidth', 'PelsHeight', 'PelsWidth', 'Position_x', 'Position_y', 'PrintQuality', 'Reserved1', 'Reserved2', 'Scale', 'Size', 'SpecVersion', 'TTOption', 'YResolution', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']

Version 1.1.1 1024x600 is also my max resolution

 

[image]

 

Thanks. I have added both resolutions to the supported list in the next version. I will see if I can use EnumDisplaySettings to detect if the user can actually use this resolution.

 

Yep, made some great progress with it, I've not been able to do much the last couple of weeks, but I'm hoping to start a preview series of alpha releases for it soon, just so that I can make sure the first full release of the Resource Editor is perfect.

 

Absolutely fantastic work guys with the high res patching, it's truly exciting to see Dune 2000 being brought up to date with modern monitors. Do you mind if I start hosting a copy on the D2K+ site?

 

That is great news. Yeah, it's amazing how a few years ago it looked almost impossible and then suddenly N.Kindt shows it's possible, really awesome.

 

I don't mind if you start hosting a copy, but there is currently one critical bug I rather see squished before releasing it to the masses. That is the starport menu bug (below 4th building icon).

Link to comment
Share on other sites

*I'm able to get win32api with EnumDisplaySettings also, but I couldn't find the correct variable/list to display the supported resolutions. I'm stuck at this:*

 

You need to iterate until EnumDisplaySettings returns nothing. Thats where you got through all supported resolutions. PelsWidth and PelsHeight is what you are looking for.

 

*That is great news. Yeah, it's amazing how a few years ago it looked almost impossible and then suddenly N.Kindt shows it's possible, really awesome.*

 

Thanks D2k Sardaukar! Everything is possible. ;)

 

*I don't mind if you start hosting a copy, but there is currently one critical bug I rather see squished before releasing it to the masses. That is the starport menu bug (below 4th building icon).*

 

Will take a look when i can but i think everyone could use the patch already with that in mind.

Link to comment
Share on other sites

Here is the coode to show supported resolutions:

from win32api import EnumDisplaySettingsglitches = ['1360x768', '1366x768', '1400x1050', '1680x1050']mode = 0resolutions = []while True:	try:		dm = EnumDisplaySettings(None, mode)		res = str(dm.PelsWidth) + "x" + str(dm.PelsHeight)		if res not in glitches and res not in resolutions:			resolutions.append(res)		mode += 1	except:		breakprint("Supported resolutions:")for r in resolutions:	print(r)

Image of the output attached.

 

post-37135-0-13682100-1368783501_thumb.p

  • Upvote 1
Link to comment
Share on other sites

Here is a more convenient way with indexing, ready to use.

from win32api import EnumDisplaySettingsmode = 0resolutions = []while True:    try:        dm = EnumDisplaySettings(None, mode)        res = str(dm.PelsWidth) + "x" + str(dm.PelsHeight)        if res not in resolutions and dm.PelsWidth % 32 == 0:            resolutions.append(res)        mode += 1    except:        breakprint("Supported resolutions:\n")for i, r in enumerate(resolutions):    print(str(i + 1) + ".\t" + r)i = 1while True:    try:        i = int(input("\nEnter resolution number: "))        if i < 1 or i > len(resolutions):            raise ValueError        break    except ValueError:        print("Need a number between 1 and " + str(len(resolutions)) + "!")res = resolutions[i-1]print(res)wh = res.partition('x')# Pass wh[0] and wh[2] to .dat patcher ...

post-37135-0-88639200-1368796762_thumb.p

Edited by N.Kindt
  • Upvote 2
Link to comment
Share on other sites

 

Here is a more convenient way with indexing, ready to use.

from win32api import EnumDisplaySettings...code...

Oh, you use some nice tricks. Very elegant programming! Thank you for sharing, I will use it in the next version.

 

The thought already passed my mind that having the user enter the resolutions manual is not user friendly and I should use some sort of drop down menu, but this index method of yours works also good.

 

 

I think 1024x768 is the highest I have rendered the game correctly at, Anything higher screws up building placement and FOW.

 

I have not experienced such errors*, not even on 1920x1080. I can only guess the cause and I'm guessing you are not using a fresh Dune 2000 (v1.06). I'm actually testing my script on a (old) Dune 2000 version of you, so it should work. You could alternatively try updating (videocard) driver(s) and -not- running the game in compatibility mode, but I'm not sure it will matter.

 

Edit: * Wait, you just mean the tile set bug. Just try a different resolution, it should work.

Edited by D2k Sardaukar
Link to comment
Share on other sites

I figured out why some resolutions display tile set bug and others not. It's rather simple, it's just if the tiles fit in the resolution with no remainder. Tiles are 32x32.

 

Those that don't fit have a remainder and so display a tile set bug:

1360 / 32 = 42,5

1366 / 32 = 42,6875

1400 / 32 = 43,75

1680 / 32 = 52,5

Link to comment
Share on other sites

*Oh, you use some nice tricks. Very elegant programming! Thank you for sharing, I will use it in the next version.*

 

Thank you!

 

The remainder things makes sense. Instead of the <glitches> list should just do a width % height != 0 discard then.

 

 

*I have not experienced such errors*, not even on 1920x1080.*

 

I also did not experience any glitches on higher resolutions i.e. 1920x1080.

 

EDIT: Updated script to check for compatible width.

 

Edited by N.Kindt
  • Upvote 1
Link to comment
Share on other sites

Fixed starport mouse movement crash below starport area.

Fixed starport right mouse button crash below starport area.

Fixed tooltip display below starport area (nothing displayed).

 

Tested only on 1024x768. Please test on higher resolutions and let me know if something comes up.

 

I hope this is final! :)

D2K-HRpatch-1.0.zip

  • Upvote 3
Link to comment
Share on other sites

Fixed starport mouse movement crash below starport area.

Fixed starport right mouse button crash below starport area.

Fixed tooltip display below starport area (nothing displayed).

 

Tested only on 1024x768. Please test on higher resolutions and let me know if something comes up.

 

I hope this is final! :)

It's working here! Really nice work! Now the game is truly high resolution. You kinda revived the whole game now. :)

 

Before I release my script with your new version there are some minor things I want to discuss with you.

 

1) First is the starport purchase button location. Having it just below the 4th building icon makes sense, because there aren't going to be any more icons and you don't want to move the mouse all the way down. However, if you click it, you sometimes also build the unit/building (normal building menu) that is underneath the button. You can test this the quickest on atreides test map. Should I drop the button down or not?

 

2) If the resolution is above 1024x768, the small campaign maps cause a crash. Let's call this the 'tiny-map-bug'. I'm thinking about making a small patch that increases the size of these maps by just adding in sand. I'm not sure if there are also multi player maps that are too small. Perhaps it's also possible to fix this in the .dat file? I did once save a map in average resolution with the viewport close to the edge. Then I loaded it with 1920x1080 resolution, first time it crashed, second time it accepted it and just showed green on the radar and a short time black on the map until I scrolled too far away of the edge. Fixing this crash with the .dat file would be most elegant, because else I'm messing with the original gameplay maps (not that the first maps are that important, but still). Only problem is, how difficult is it to fix this in the .dat file and do you find it fixable-worthy?

 

3) Certain elements on the globe (campaign world map) and (multiplayer) score screen are generated by the game and are not controllable with the .uil files. Therefore these elements are still displayed in the top left corner. I duct-tape-fixed this by just keeping the background image also in the left corner and making the rest black. Better would be to just find the location values stored for these elements in the .dat file (or somewhere else?) and adjust those. Do you know where I can find them? Perhaps mvi also known more about this?

 

4) Kinda the same thing as 3, but now for the video's.

Link to comment
Share on other sites

Fixed starport mouse movement crash below starport area.

Fixed starport right mouse button crash below starport area.

Fixed tooltip display below starport area (nothing displayed).

 

Tested only on 1024x768. Please test on higher resolutions and let me know if something comes up.

 

I hope this is final! :)

it great work! thank you!

 

 

i used D2K-HRpatch-1.0.exe -w 1024,4096 -h 768,4096 to patched it.but i can't use the "repair"  icon and something else.

Link to comment
Share on other sites

Thank you Sardaukar!

 

1) It's up to you or maybe we do a poll? Maybe you let the user decide? I would put it on the bottom. Sure you have to move the cursor down all the way for the purchase but this is only a problem on really high resolutions - i don't plan to play higher then 1024p (honestly 768p is enough for me).

 

2) Would be great if you could extend it somehow with additional tiles. I don't consider it worthy to fix, it's good to have but i don't see it necessary to put my time into this. I don't know how difficult it is to fix the .dat for this, this only becomes clear if you start debugging the code and i haven't done anything in that code section. Of course it's possbile to do in .dat, just a matter of time and patience.

 

3) This is also cosmetics and good to have. I have no idea where those values are. This also becomes only clear when debugging the code in question. So first thing is to find the location of that code, understand it's logic and patch it with x86 instructions. Perfectly possible to do but i am also not considering doing it, at least for now.

 

My biggest concern was getting all those 4 crashes fixed. Felt wrong if you have a high res patch but it's not playable and crahes (especially the mouse-move crash in starport). Since this is fixed now i need to concentrate on different projects (not highres or reverse engineering related) and invest more time there. Maybe i will come back to Dune 2000 again and try to find those problems but this is not a high priority for now. Now my prio is to play through Dune 2K in 1024x768. 8)

 

Great job we did here! Feels good! Thanks everyone for help and a great time! I hope everyone enjoys those high resolutions.

  • Upvote 2
Link to comment
Share on other sites

Thanks guys!

 

Updated my script.

Version 1.3	1) Updated N.Kindt's .DAT patcher, this gives:		a) Fixed starport mouse movement crash below starport area.		b) Fixed starport right mouse button crash below starport area.		c) Fixed tooltip display below starport area (nothing displayed).	2) Improved selecting resolution menu and auto-detect correct working resolutions.	3) Set patching messages to a minimum.	4) Auto-add sand to small campaign/mission maps.

We reached a no-bugs version, Waahoo*! :)

 

Download here: http://forum.dune2k.com/topic/19636-dune2k-high-resolution/page-15#entry380752

 

* Mario voice.

  • Upvote 3
Link to comment
Share on other sites

Don't add sand that would ruin the original map. Add rocks non passable by infantry.

Maybe next version. Only the first two levels of each house are affected on highest resolution (1920x1080) and that are simply 'how to play this game' maps/missions

 

Edit: Unless someone makes a mod with a very small map...

Edited by D2k Sardaukar
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...