Author Topic: Minimap Scrolling Patch  (Read 1981 times)

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Minimap Scrolling Patch
« on: July 15, 2008, 10:23:08 AM »
Ever get sick of how the MiniMap scrolls in OP2? If you move the mouse to the extreme top or bottom, it gets caught and stops scrolling. I find this very frustrating sometimes. Particularly when you're in a hurry to do something.

But, it's also easily fixed. Find the following virtual address with the following instruction:
Code: [Select]
0045865C      FF4C24 14        DEC DWORD PTR SS:[ESP+14]
... and change it to this:
Code: [Select]
0045865C      FF4C24 1C        DEC DWORD PTR SS:[ESP+1C]


What this does is decrements Rect.y2 instead of Rect.y1, just before the mouse is clipped to that rectangular region of the screen. Notice how you can't move the mouse off the minimap while the button is down. Anyways, it seems this just fixes a minor bug. With this fix, the clipped region actually corresponds to where the mouse should be allowed to roam. Now you're blocked from falling off the bottom edge (which prevented scrolling), and you no longer fall off the top edge (which prevented scrolling).
 

Offline gpgarrettboast

  • Administrator
  • Hero Member
  • *****
  • Posts: 553
Minimap Scrolling Patch
« Reply #1 on: July 15, 2008, 11:59:09 AM »
You're awesome Hooman :]

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Minimap Scrolling Patch
« Reply #2 on: July 15, 2008, 08:35:40 PM »
Have you tested it on globe view? Speaking of, why does globe view occasionally cause OP2 to crash?
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Minimap Scrolling Patch
« Reply #3 on: July 15, 2008, 09:18:37 PM »
I've never looked into it.

But then, only multiplayer levels have that option available, which makes it more annoying to test. I suppose I should look into that sometime. I did think of it briefly the other day.
 

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Minimap Scrolling Patch
« Reply #4 on: July 15, 2008, 10:17:24 PM »
Quote
But then, only multiplayer levels have that option available
Not necessarily. Just make a colony game on a world map.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Minimap Scrolling Patch
« Reply #5 on: July 16, 2008, 08:11:57 AM »
Can you upload a exe with the patch so we can see it thanks :)

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Minimap Scrolling Patch
« Reply #6 on: July 16, 2008, 10:21:38 AM »
The idea is we patch it ourselves because Hooman wants all of us to help him out around here. He can't do it all, you know... Not enough time in a day.

Edit: Here you go. But here's something you might want to look at Hooman: It kept crashing, though I was certain I did everything right... I eventually found out it was crashing because the exe wasn't named right (Outpost2M.exe instead of Outpost2.exe). Strange...

Uhh... The forum won't let me upload it... Not even to the file forum...

Well, for now, if you really want this, I can send it to you on IRC or you can do it yourself by using a hex editor to change the 14 at offset 57A5F to a 1C.
« Last Edit: July 16, 2008, 03:55:27 PM by Sirbomber »
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Minimap Scrolling Patch
« Reply #7 on: July 16, 2008, 10:33:52 PM »
I'm aware we could just make a colony test mission for the world view thing. I was more pointing out that currently only multiplayer maps of that form exist.

Hmm, impressive Sirbomber. I wasn't really expecting such initiative. I just thought this might eventually end up in the next update whenever that comes out. You even managed to convert it to the correct file offset.



As a side note for a quick sanity check (and so I remember and don't freak out the next time too), when converting the virtual address of a byte to the file offset, the last 2 digits should match. This is because the memory alignment of sections is 4096 bytes, where as the file alignment is 512 bytes. These value in hex are 0x1000 and 0x200 respectively. Hence, the last two digits will be the same.
[* The important part I initially worried about *] Since the 0x14 was the 4th byte in the instruction (at offset 3 from the instruction start), it would be at address 0045865C+3 = 045865F. The last two digits 5F mathch the file offset of 57A5F.

And of course, when making the changes, you can compare surrounding code bytes to be sure, which I checked into, and yes, it's correct.
[End note to self]