Home Fries

TAW 2.0 Known Issues and Bug Reports

529 posts in this topic

That might help.

As far as I can see, the game checks the resolution by using the Windows 'GetSystemMetrics' function with parameters 0 and 1. This (according to Microsoft documentation) should return the width and height 'of the screen of the primary display monitor, in pixels'. If these aren't 800 and 600, that error ensues.

EDIT: On second thoughts, there may be something else going on inside Windows that can cause the subroutine to fail:
 

while ( !sub_4EA7E4(800, 600) )
    sub_4EA3FC(
      "This program requires an 800x600 display resolution but was unable to obtain it.\nPlease use the display settings control panel to make 800x600 available.\n",
      v1);

bool __usercall sub_4EA7E4<eax>(int a1<eax>, int a2<edx>)
{
  int v2; // eax@1
  int v3; // edi@1
  int v4; // esi@1
  int v5; // eax@3
  int v7; // ST20_4@1
  int v8; // ST20_4@3

  v3 = a1;
  v4 = a2;
  v7 = GetSystemMetrics(0);
  v2 = GetSystemMetrics(1);
  return v3 == v7 && v2 == v4
      || (sub_4EA8F0(), Sleep(0x1F4u), v8 = GetSystemMetrics(0), v5 = GetSystemMetrics(1), v3 == v8) && v5 == v4;
}

I'm not sure what that OR is going to achieve...

Share this post


Link to post
Share on other sites

Oh, it seems that the values 'GetSystemMetrics' returns can be affected by the magnification setting for Windows objects. So it might be worth checking that this is set to 100%.

Share this post


Link to post
Share on other sites
14 hours ago, mikew said:

  return v3 == v7 && v2 == v4
      || (sub_4EA8F0(), Sleep(0x1F4u), v8 = GetSystemMetrics(0), v5 = GetSystemMetrics(1), v3 == v8) && v5 == v4;

I'm not sure what that OR is going to achieve...

That has been heavily optimized, but if we resolve it to plain old if-elses, it’s basically this:

resX = GetSystemMetrics(0);
resY = GetSystemMetrics(1);
if(resX != 800 || resY != 600) {
	return false;
}

sub_4EA8F0();

Sleep(500); // wait half a second

resX = GetSystemMetrics(0);
resY = GetSystemMetrics(1);
if(resX != 800 || resY != 600) {
	return false;
}

return true;

It checks if the resolution is 800×600 by default. If not, it calls sub_4EA8F8(), which I don’t know, but I’m sure it’s some DirectDraw or Win32 stuff to force resolution to 800×600. It lets half a second pass to realize that change, then it checks again.

At this point I’m sure sub_4EA8F8() fails for whatever reason. Does the display driver/monitor support 800×600 at all?

Share this post


Link to post
Share on other sites
10 hours ago, Krycztij said:

Does the display driver/monitor support 800×600 at all?

From Fox2's picture, it looks like it does...which is the strange thing here.

Thanks for picking apart that code!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now