Map Detectives: Quality of Life Improvements

One of the problems I encountered running Map Detectives: Urban Mystery on Windows 10 was that the game changed the screen resolution to 640×480 and did not restore it upon exiting. My laptop's natural resolution is 3240×2160 with 200% scaling, so having all my windows and icons rearranged to fit such a small screen size was very annoying. There are no display options within the game and the sherston.ini file located next to the game executable had no effect when edited. All is not lost, however — with a few small edits to the game's executable files these problems can be solved.


Update

Just before I posted this I happened to take another look at the Teacher Options in the game, and there's a 'Whole screen' checkbox right there, which sort of makes this post redundant. Oh well — at least it might help you avoid the initial resolution change… original post follows:


Resolution Change

To prevent the screen resolution being changed, patch xtras/budapi.x32 as follows:

| File offset | RVA      | Original byte | Patched byte |
|-------------|----------|---------------|--------------|
| 0e8b8       | 1000e8b8 | 55            | c3           |
| 1514b       | 1001514b | 55            | c3           |

This changes the two functions that call ChangeDisplaySettingsA and ChangeDisplaySettingsExA to return immediately. These functions are ultimately called by the exported xtra methods baSetDisplay, baSetDisplayEx, and baSetMultiDisplay.

That stops the resolution change but the game still runs fullscreen which makes referring to it while using other applications awkward. Let's change things so it doesn't go fullscreen!

Fullscreen Window

Fixing this is a bit more involved since the code that creates the game window is located in a DLL that's extracted at runtime. The game attempts to load the DLL and, if it can't do so, proceeds to extract it to a temporary directory and load it from there. All we need to do is grab a copy of that DLL, patch it, and make sure the game can load our patched copy. Easy!

Kill the game after it has switched to fullscreen mode and locate iml32.dll in a subdirectory of your temporary directory (on my system this was in %TEMP%\TempFolder.aaa). Copy it to the game's directory. Now patch the following bytes:

| File offset | RVA      | Original byte | Patched byte |
|-------------|----------|---------------|--------------|
| 2755f       | 6902755f | 6a            | eb           |
| 27560       | 69027560 | 03            | 07           |

This changes the following code sequence:

;       ...                                   ...
loc_6902755f:
        push 03h                            ; 6A 03
        push eax                            ; 50
        call ds:ShowWindow                  ; FF 15 4C 34 07 69
loc_69027568:
        lea ecx, [esp+154h+lpWindowName]    ; 8D 4C 24 08
;       ...                                   ...

…to skip over the call to ShowWindow(SW_MAXIMIZE, hWnd):

;       ...                                   ...
loc_6902755f:
        jmp loc_69027568                    ; EB 07
        push eax                            ; 50
        call ds:ShowWindow                  ; FF 15 4C 34 07 69
loc_69027568:
        lea ecx, [esp+154h+lpWindowName]    ; 8D 4C 24 08
;       ...                                   ...

All sorted!