PDA

View Full Version : EFMI High Resolution


jeunealbert
04-12-2004, 10:48 AM
Hi all,
I just tried to switch the game to really high res, since opengl and d3d are pretty resolution independend, so I took my hexeditor and changed at offset 6494 the value 8002 (=640) to 0005 (=1280) and at offset 649B the value E001 (=480) to 0004 (=1024.)
Started monkey4 and the game was running in true 1280x1024.
There are problems with the movies though, but that doesn't really matter.
But there's one big problem: you can't save anymore (well, you can, but you can't load a game, that's saved with this resolution, savegames are slightly bigger than with normal res.)
Does anybody know, how the savegame format looks like? I've figured out, it's gzipped binary data.

bgbennyboy
04-12-2004, 03:16 PM
I dont know the format of it, if its like Grim Fandango then the entire heap is just dumped for a save game.

The problems with the movies might be because the movies are bink and are handled by bink.dll rather than the engine itself I think.

Rapp Scallion
04-12-2004, 03:37 PM
Hey, I wanna do this too :) Please tell me how. And it would me nice if you could post the numbers for the other resolutions aswell.

Is that hex-program for download? Or do you know about a downloadable one?

-Rapp Scallion

bgbennyboy
04-12-2004, 04:45 PM
Me and Huz are having a look at this at the moment. Right now I'm trying to stop the problem of the crashing save/load, I think I know what's causing it. If I get this sorted then i'll release a program to change the resolution to whatever you want.

Well done for spotting this jeunealbert!

jeunealbert
04-12-2004, 04:49 PM
@bgbennyboy
The problem with saving/restoring seems to be related to monkey4 saving a preview image with the savegame, so it's not just a heap dump. The preview image is slightly bigger, thus expanding the whole file and probably moving things to unexpected places so monkey4 chokes upon loading those savegames.
The problem with the movies is bink-related, bink still thinks, the screen is runng at 640x480.

@Rapp Scallion
Just search with google and you will find dozens of hexeditors.
Calculating numbers for other resolutions is easy: start windows' calc.exe and switch to scientific view. Switch to decimal view and type your desired width (eg 800.) Switch to hex view and read the value (eg. 0320) switch high- and lobyte (eg. 2003) and you've got the value to be written to monkey4.exe. Do the same for y-res.

The offsets that I've mentioned are for monkey4.exe v 1.1, if you've got some other version, it's easy to find the right offsets: search for the hex-value "80 02". There will be some of them, but not so much with the value "E0 01" following a few bytes later. Then it's trial-and-error to find the right ones.

bgbennyboy
04-12-2004, 04:54 PM
Yeah, thats what we figured, i'm trying to extract the image data atm, so I can shrink it to the right size and fix the saves. It doesnt seem to be stored in EMI's own TIL format nor in TIF which it also uses. I cant find bitmap, jpeg or gif data either so it might just be stored as raw pixels.

Also note that if you change all the hex values you end up changing the value for windowed mode too, so care is needed.

jeunealbert
04-12-2004, 05:02 PM
Me and Huz are having a look at this at the moment. Right now I'm trying to stop the problem of the crashing save/load, if I get this sorted then i'll release a program to change the resolution to whatever you want.
Nice to hear that, bgbennyboy!
I go stuck at that, I disassembled monkey4.exe with http://www.geocities.com/~sangcho/disasm.zip,
which gives a nice output, there are two functions worth looking at: lua_save and sputLua_ThumbnailFromScreen, but I don't know enough about assembly language to really figure it out.

Gabez
04-12-2004, 05:19 PM
This sounds great! Any chance of some screenshots for lazy people like me?

bgbennyboy
04-12-2004, 05:23 PM
There's thumbnailfromfile and screenshotforsavegame functions too. Unfortunately I dont know assembly either :~

jeunealbert
04-12-2004, 05:47 PM
At offset 23386 I changed another occurence of 80 02 to 00 04.
It's right before calling _BinkBufferBlit.
Now the videos are visible, although not scaled.
I think, it's the best we can get.

bgbennyboy
04-12-2004, 07:22 PM
Right:

The image data is stored after the "vQA12" header and is 98308 bytes long (it *might* be 98309). After chopping a new save down so that it fits there were still problems. Throughout the file, the odd byte was different (when compared to a save taken in exactly the same place with the unedited version). There are mention's of resolution in the saves - of 641 (and 1281 in the edited tile). I've been getting Huz to test the save's that i've been making, since I dont have my EMI cds with me, but he's had to go now so I dont know if changing the resolution data in the saves back to 640*480 will have any effect.

jeunealbert
04-12-2004, 08:16 PM
I don't have a "vQA12" header, for me it's "v1.1" +0x00.
I think the imediately following three bytes are the length of the image data, for 640x480 savegame it's 00 80 01, ie. 98,304 dec., for 1280x1024 it's 00 00 06 = 393,216 dec.

bgbennyboy
04-12-2004, 09:26 PM
Yes! I fixed it! I accidentally removed that size header before. Now when I crop down the image, the preview is messed up but the save game works!

I'll make a program to 'quickly and easily' change the EMI resolution and fix saved games tomorrow :)

Gabez
04-12-2004, 11:44 PM
*drools at thought of such a program*

James Isaac
04-13-2004, 07:20 AM
Wow - that sounds really great :)

Good work.

Mafiozi
04-13-2004, 09:33 AM
Cool, ill replay the gaeme again then..


P.S.Hey maybe u can make something like this for Grim Fandango?:manny:

Udvarnoky
04-13-2004, 01:17 PM
Nice job! I like things!

Joshi
04-13-2004, 01:20 PM
Here's a game for us laymens, at which post in this thread did you stop reading? My arm got whiplash from going over my own head so fast. But hey, good work, this should make playing this on my laptop even better, keep up the good work.

bgbennyboy
04-13-2004, 03:32 PM
I tried it with Grim Fandango too, unfortunately the backgrounds dont scale up in that so its no good (http://quick.mixnmojo.com/hoho.jpg).

Thrik
04-13-2004, 04:22 PM
Hee. That looks funky.

Also, Gabez! IRC >:

Mafiozi
04-13-2004, 05:13 PM
Originally posted by bgbennyboy
I tried it with Grim Fandango too, unfortunately the backgrounds dont scale up in that so its no good (http://quick.mixnmojo.com/hoho.jpg).

Hmm..Too bad :(
Maybe u missed somethiing??:D

bgbennyboy
04-13-2004, 06:19 PM
No ::

jeunealbert
04-13-2004, 08:51 PM
Didn't make much progress today, disabled the previews in the load screen (now just white boxes), works for old savegames, but as soon as there's a new one, it crashes; I can't imagine, what the load screens tries to read besides the name and the preview...

Preview image data is raw image, 256*128 3 bytes per pixel (RGB) = 98,304 bytes. For 1280x1024 it's 512*256 respectively.

bgbennyboy
04-13-2004, 10:16 PM
When you say you disabled the previews do you mean that you edited the save file as I did? Or that you patched the exe?

If you edited the save then yes, it will crash every time there's a new one, because the save will need 'fixing' every time EMI saves to it.

If you edited the exe so it doesnt display the preview, it might still mess up because the fileposition isnt where it expects (its inside all that extra image data that just after it). Of course thats just a theory.

Serge and I are having a go at fixing it through the assembly. That is, Serge is and i'm trying desperately to keep up :p

jeunealbert
04-14-2004, 06:02 AM
I've patched the exe to not load the image data from the savegame.

I don't think, it's crashing because savegamedata isn't at an expected position, I think, it's just because it's allocating a buffer, that's too small and thus overwriting memory, when loading the imagedata anyway.

As far as I can tell the size of the image data isn't hardcoded in the exe.

bgbennyboy
04-14-2004, 10:13 AM
So the fix is to either make it allocate a bigger buffer, stop it loading that image data or patch the function that takes the screenshot and saves the data so that it takes a normal sized screenshot originally.

Hmm..

jeunealbert
04-14-2004, 11:13 AM
Hi bgbennyboy,

was hacking the savegame files always successful?
I thought, it wasn't possible, until I noticed, I was doing something wrong (off by one - arghh!)
Well if you could confirm that, I'd stop immediately fiddling with debugging monkey4.exe and start writing a new monkey.exe.
Since the launcher dialog on the harddrive gets started by autostart, it'd be a good thing to replace it with something, that's not simply starting monkey4.exe, but keeps running in background, watching file changes in the savegame directory and correcting them.

bgbennyboy
04-14-2004, 11:22 AM
Hiya :)

Yeah it was and thats what I was starting to do :) A new launcher that lets you choose the res, then patches monkey4.exe and runs the new exe along with a few new options on the launcher like windowed mode.

I was then gonna have it scan the saves in the background correcting them as they changed. I then thought that it might create a large overhead and not work well if there were a large number of saves, so I then thought about having a hotkey to fix saves, say F12, that you press before you go into the save screen.

Anyway, yes, I put that on hold because you seemed to be making good progress and Serge is having a look through the assembly right now, a fix to make it save or load right is much better than fixing the saves so i'm waiting to see if that works before I do it :)

Rapp Scallion
04-14-2004, 12:08 PM
Am I the only one one who notices the fence on the dark part in the Grim Fandango image (To the left of the background image)? And some rocks! What is this?

Is it possible to do this with CMI too? Just wonderin'

Keep up the good work. Good luck!

-Rapp Scallion

jeunealbert
04-14-2004, 12:11 PM
Well, I thought of using a file change notification event and implementing a handler for it, the thread goes sleeping and will only be executed, when changes occur. So there will be not too much overhead, since only changed files will be affected.

But I think, I will wait for Serge too.

bgbennyboy
04-14-2004, 12:17 PM
Rapp: thats my desktop showing through I think :)

jeunealbert: Ah yes, thats a good idea, that would work.

Xippion
04-14-2004, 02:44 PM
Originally posted by jeunealbert
Nice to hear that, bgbennyboy!
I go stuck at that, I disassembled monkey4.exe with http://www.geocities.com/~sangcho/disasm.zip,
which gives a nice output, there are two functions worth looking at: lua_save and sputLua_ThumbnailFromScreen, but I don't know enough about assembly language to really figure it out. Why disassemble it when you can use programs like OllyDbg to push the memory while its... in memory? That's how I hacked out the "CD-ROM drive check", I even changed the installation process of EMI so when I install the Full Install from the special backups it will let me play through the entire game with music without having to ever use the CDs again. And it fully uninstalls too. That, AND my custom backup CD is patched to version 1.1.

Anyhow, I tried changing the bytes in Olly, but the resolution was still 640x480. :confused:

Xippion
04-14-2004, 03:10 PM
Ohhhh... I've done it. http://www.zippyimages.com/files/7361/emi_hires.png it's very nice indeed!

Krazy
04-15-2004, 12:51 AM
Wow that looks great. It would be better if there was some kind of graphics filter for the background though ;)

Xippion
04-15-2004, 05:19 AM
1280x960 would be better, because that keeps in ratio with the original, meaning for every background pixel in 640x480 there are exactly two across and two down. 960 would be 00 C3 (I think). Olly is far more useful for things like this than a HEX editor. All I did was search for 480 (as a constant) and changed them...

Anyhow EMI actually looks pretty good at that resolution with its 3D graphics. I'm not saying I'm a fan of the game, because let's face it CMI looks better in gameplay then EMI ever did - AND EMI isn't point'n'clic :(

I'm gunna have another punt at it a bit later, I'll let you know of the results esp regarding savegames, but I think I might know how to at least have it save and load its own without any problems (it will still be incompatible with savegames saved in 648x480). That would be better than having a loader-file.

James Isaac
04-15-2004, 06:37 AM
Can someone edit the first post to give all the steps that are known so far to make it work as well as possible? Becuase it is easier than going through all the posts, and finding all the right things to change.

jeunealbert
04-15-2004, 07:55 AM
Originally posted by Xippion
1280x960 would be better, because that keeps in ratio with the original, meaning for every background pixel in 640x480 there are exactly two across and two down.
No, it would be not.
Textures sizes have to be a power of two with at least 64x64.
So they surely fit better in 1024 then 960.

Anyway 960 would be C0 03, 00 C3 would give only 195.

Xippion
04-15-2004, 08:45 AM
480 isn't a power-of-2. Doubling it makes better sense.

jeunealbert
04-15-2004, 10:47 AM
I can't see any differences between the two resolutions, but I will keep 1280x1024, since this is the native resolution of my display.
Aspect ratio shouldn't be any problem, the difference is too small to be noticed.

Savegames should be compatible though, image preview is 512x256x3 for both.

jeunealbert
04-15-2004, 04:36 PM
I've got it.

Stay tuned and keep a little patience...

Serge
04-15-2004, 05:34 PM
History will teach us nothing

Originally posted by jeunealbert
Well, I thought of using a file change notification event and implementing a handler for it, the thread goes sleeping and will only be executed, when changes occur. So there will be not too much overhead, since only changed files will be affected.

But I think, I will wait for Serge too.

In other words, anyone should know by now, don't wait for Serge ;)

- Serge

jeunealbert
04-15-2004, 06:35 PM
Hey, don't get upset, Serge.
I would've waited for you to check the assembly before starting to write a launcher, but all of a sudden, I knew, where to look in the exe.
It's offset D600: mov edx, 100
and offset D617: mov edx, 80

Right now I'm checking everything before I'll provide a patch.

bgbennyboy
04-15-2004, 07:55 PM
Wait, youve made a patch?

Bloody hell, i'll abandon my launcher then ::

jeunealbert
04-15-2004, 08:25 PM
OK, I think it works.

Copy the exe into the same directory as monkey4.exe.
Start it from a command prompt with desired x- and y-resolution (e.g. monkeyres 800 600.)
There are no sanity checks, so only use reasonable values (even 0 0 work and monkey4.exe will not complain!)
And 320x200 is possible for all retro freaks;-)
I only tried it until 1280x1024, there will be problems with higher resolutions.
Savegames are interchangeable between resolutions, but the load screen only looks good for the higher resolutions, but see yourself.

http://www.freiling.org/monkeyres.exe

But of cause I have to tell you: you're using this program at your own risk, don't blame me, if it burns your pc, drinks your grog supply or impregnates your girlfriend;-)

jeunealbert
04-15-2004, 08:45 PM
If someone already downloaded the file, do it one more time, I've uploaded the wrong one.

Huz
04-15-2004, 09:25 PM
Runtime error 5 at 0x0040123D
0x0040123D
0x004015C9

Well, quite. That was with the patch 1.1 installed. Without the patch, it appears to do something but leaves you with a completely unusable .exe.

jeunealbert
04-15-2004, 10:31 PM
You need v1.1, it will not work with any other version.
Runtime error 5 means file access denied.
Monkey4.exe might be flagged read-only, opened by another process or you have insufficient privileges.
You might want to check in taskmanager, if monkey4.exe is still running, it likes to do so...

Serge
04-15-2004, 11:12 PM
No worries jeune! That comment was referring to my starting on projects (from SCRAMM to numerous versions of SCUMMRev) that were never finished. A kind of disclaimer to make you go on - not wait. So it's fine :) (and I see now that the title is easy to miss. :P - was meant to be read: "History will teach us nothing, in other words...")

- Serge

bgbennyboy
04-15-2004, 11:14 PM
Patch doesnt work for me either, it applies but then EMI crashes as soon as it loads. Huz and I appear to have different exe's from you. Perhaps if you detailed what you changed we can try and work out a new patch.

Huz
04-16-2004, 01:37 AM
Originally posted by jeunealbert
Runtime error 5 means file access denied.
Monkey4.exe might be flagged read-only Ah yes, that was the problem. The installer for the v1.1 patch seems to make it read-only, for some reason.

Anyway, your patch still doesn't work - EFMI now crashes on startup.

jeunealbert
04-16-2004, 06:00 AM
So your exe must be different.
Appart from the resolution patch, it just patches two other offsets in the exe. These are two consecutive instructions, one pushing 100h, the other pushing 80h on the stack. I just doubled both values.

jeunealbert
04-16-2004, 02:41 PM
Man, this is like the best thing I've downloaded in the past hour.
Correction: WORST!


I kinda dislike this level of sarcasm...

Here's what to do, step by step:
1. Get a hexeditor (search with google.)
2. You have to calculate a few values, use calc.exe for it.
Switch calc to scientific view. There are radiobuttons
"Dec" and "Hex", by switching between them you can easily
convert one to the other.
Say, we want to convert 5461 dec.
Switch to "Dec", type in 5461, switch to "Hex" and read:
1555. You have to switch 15 and 55: 5515, because this is the
way values appear in binary files.
Note: if you have a hexvalue like 1C8, it's 01C8.
3. Now open monkey4.exe with your hexeditor and search for
C7 44 24 XX 80 02 00 00 C7 84 24 XX 00 00 00 E0 01 00 00 (XX might be anything)
80 02 00 00 is 640 dec. = x-resolution,
E0 01 00 00 is 480 dec. = y-resolution.
Calculate your desired values and overwrite x- and y-res.
Now do the same for
C7 44 24 XX 80 02 00 00 C7 44 24 XX E0 01 00 00.
4. Now search for 68 80 00 00 00 68 00 01 00 00, replace it
with 68 00 01 00 00 68 00 02 00 00.
5. Done.

Isak
04-16-2004, 04:07 PM
I have Escape from Monkey Island for ps2, no problems there no, and allways high resolution :p

maybe we all should get a ps2 :D

MrManager
04-16-2004, 04:20 PM
The PS2 version has the same resolution as the default PC version you know.

bgbennyboy
04-16-2004, 05:24 PM
Nice one, jeunealbert :)

I'm going back to uni tonight, but I'll try and knock-up a quick patch/launcher for those of us with different exe's and i'll try and upload it tomorrow.

Isak
04-16-2004, 06:23 PM
Originally posted by RemiO
The PS2 version has the same resolution as the default PC version you know.

Oh, damn :cool:

d3vilsadvocate
04-16-2004, 08:03 PM
monkey.exe files to play in either 1280 or 1600:

http://users.quick-line.ch/chris/1600x1200.exe

http://users.quick-line.ch/chris/1280x1024.exe

thanks for the great idea!

btw try playing it with FFA. I was unlucky getting weird lines in the game while doing so, but you mite have some luck... textures look way nicer that way! :cool:

Huz
04-16-2004, 11:11 PM
Originally posted by jeunealbert
I kinda dislike this level of sarcasm... Sorry about that - I can see how it comes across as a bit caustic, but I was just messing around really! It was the BEST software I had downloaded in the past hour because it was also the ONLY software - and when it didn't work, I decided to call it the "worst" instead! Just a silly joke, sorry. :)

Xippion
04-17-2004, 04:40 AM
Let me show you why you should use 1280x960 instead of 1280x1024:

http://www.zippyimages.com/files/13512/1280x1024.png
http://www.zippyimages.com/files/13517/1280x960.png

The background images do look noticibly better too.

d3vilsadvocate
04-17-2004, 11:13 AM
Xippion that would be 1600x?

Xippion
04-17-2004, 01:11 PM
Originally posted by d3vilsadvocate
Xippion that would be 1600x? No, why did you think that? I don't think my monitor supports 1600x.

d3vilsadvocate
04-17-2004, 04:24 PM
sorry mate. that was meant to be a question :cool:
whats the right proportion of 1600xYYYY?

Xippion
04-18-2004, 06:33 AM
Originally posted by d3vilsadvocate
sorry mate. that was meant to be a question :cool:
whats the right proportion of 1600xYYYY? Well, the original is 640x480. 1280x960 is exactly 2x that. 1600 is 2.5x, which I might add will mean that the background images won't be even, but 1200 is right since it is 2.5x, the equation being (1600/640)x480=1200.

jeunealbert
04-18-2004, 08:48 AM
Xippion, I don't know, what you did, but I can't see flying manholes and huge cracks under doors.
You must have done something different while patching.

Xippion
04-18-2004, 12:18 PM
Originally posted by jeunealbert
Xippion, I don't know, what you did, but I can't see flying manholes and huge cracks under doors.
You must have done something different while patching. I downloaded d3vilsadvocate's version, since your instructions didn't work for my v1.1 exe, nor did the patch and I was sick of twiddlying in olly. Then I patched his exe to 960, which fixed it.

ThunderPeel2001
04-18-2004, 08:33 PM
The next question is of course: GRIM FANDANGO!

All we need is a patch that runs it higher resolution and one that changes all the ingame textures to 256x256! :)

Mafiozi
04-23-2004, 06:04 PM
So anyone made the Launcher yet?:rolleyes:

jannar85
06-21-2004, 09:36 AM
*cough* *cough*

bgbennyboy
06-28-2004, 07:10 AM
Soon! Soon!

Joshi
06-28-2004, 04:27 PM
Good! Good!

bgbennyboy
08-11-2004, 11:18 AM
Told you all (http://quick.mixnmojo.com/downloads.shtml#emi-launcher)