• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Graf

Sergeant
90 Badges
Jan 2, 2012
78
12
  • BATTLETECH: Flashpoint
  • BATTLETECH
  • Cities in Motion
  • BATTLETECH: Season pass
  • BATTLETECH: Heavy Metal
  • Deus Vult
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Darkest Hour
  • Europa Universalis III: Chronicles
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Mare Nostrum
  • Hearts of Iron III
  • Semper Fi
  • For the Motherland
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome Deluxe Edition
  • Naval War: Arctic Circle
  • Pride of Nations
  • Prison Architect
  • Shadowrun Returns
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • Stellaris
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • Victoria: Revolutions
Everyone is familiar with Resolution Changer (Internet Archive) and that it has an annoying crash when you move cursor to the bottom of the screen. It happens when your vertical resolution is higher than the original limit (that is 1024 from 1280x1024).

Copy&paste:
Code:
Param(
    [Parameter(Mandatory=$true,
        Position=0,
        HelpMessage='Enter your horizontal resolution.')]
    [ValidateRange(1024, 65534)]
    [Int]$hres,
    [Parameter(Mandatory=$true,
        Position=1,
        HelpMessage='Enter your vertical resolution.')]
    [ValidateRange(720, 8190)]
    [Int]$vres
)

$vicky = 'victoria.exe'

try {
    $bytes = [IO.File]::ReadAllBytes("$pwd\$vicky")
}
catch {
    throw "$vicky not found."
}

$offset1 = 0x27fc7
$offset2 = 0x27ff2
$offset3 = 0x27ffb
$offset4 = 0x284c6
$offset5 = 0x209f84
$offset6 = 0x209f9a
$offset7 = 0x29cfe8
$offset8 = 0x29cfec
$offset9 = 0x29dc49
$offset10 = 0x29dc5d
$offset11 = 0x8924d

$origBytes1 = 0x2004
$origBytes2 = 0x400
$origBytes3 = 0x400
$origBytes4 = 0x2000
[byte[]]$origBytes5 =
    0xc7, 0x05, 0xe8, 0xcf, 0x69, 0x00, 0x00, 0x05,
    0x00, 0x00, 0xc7, 0x05, 0xec, 0xcf, 0x69, 0x00,
    0x00, 0x04, 0x00, 0x00
[byte[]]$origBytes6 =
    0xc7, 0x05, 0xe8, 0xcf, 0x69, 0x00, 0x00, 0x04,
    0x00, 0x00, 0xc7, 0x05, 0xec, 0xcf, 0x69, 0x00,
    0x00, 0x03, 0x00, 0x00
$origBytes7 = 0x400
$origBytes8 = 0x300
[string]$origBytes9 = '1280'
[string]$origBytes10 = '1024'
[byte[]]$origBytes11 =
    0x8b, 0x54, 0x24, 0x18, 0x8b, 0x44, 0x24, 0x14,
    0x8d, 0x7a, 0x01, 0x8d, 0x48, 0x01, 0x57, 0x51,
    0x8b, 0x0d, 0xfc, 0x40, 0x9d, 0x01, 0x52, 0x50,
    0xe8, 0x56, 0x80, 0xf7, 0xff

$offset5End = $offset5 + $origBytes5.Length - 1
$offset6End = $offset6 + $origBytes6.Length - 1
$offset9End = $offset9 + $origBytes9.Length - 1
$offset10End = $offset10 + $origBytes10.Length - 1
$offset11End = $offset11 + $origBytes11.Length - 1

[byte[]]$hresBytes = [BitConverter]::GetBytes([int16]$hres)
[byte[]]$vresBytes = [BitConverter]::GetBytes([int16]$vres)
[byte[]]$vresBytes8 = [BitConverter]::GetBytes([int16]$vres * 8)
[byte[]]$vresBytes84 = [BitConverter]::GetBytes([int16]$vres * 8 + 4)

[byte[]]$offset5Bytes = @(0x90) * $origBytes5.Length
[byte[]]$offset6Bytes = @(0x90) * $origBytes6.Length
[byte[]]$offset9Bytes = [Text.Encoding]::ASCII.GetBytes('user')
[byte[]]$offset10Bytes = [Text.Encoding]::ASCII.GetBytes('user')

[byte[]]$mapInfraWrkaroundBytes = @(0x90) * $origBytes11.Length

if ([BitConverter]::ToInt16($bytes, $offset1) -ne $origBytes1 -or
        [BitConverter]::ToInt16($bytes, $offset2) -ne $origBytes2 -or
        [BitConverter]::ToInt16($bytes, $offset3) -ne $origBytes3 -or
        [BitConverter]::ToInt16($bytes, $offset4) -ne $origBytes4 -or
        (Compare-Object $bytes[$offset5..$offset5End] $origBytes5 -SyncWindow 0) -or
        (Compare-Object $bytes[$offset6..$offset6End] $origBytes6 -SyncWindow 0) -or
        [BitConverter]::ToInt16($bytes, $offset7) -ne $origBytes7 -or
        [BitConverter]::ToInt16($bytes, $offset8) -ne $origBytes8 -or
        [Text.Encoding]::ASCII.GetString($bytes[$offset9..$offset9End]) -ne $origBytes9 -or
        [Text.Encoding]::ASCII.GetString($bytes[$offset10..$offset10End]) -ne $origBytes10 -or
        (Compare-Object $bytes[$offset11..$offset11End] $origBytes11 -SyncWindow 0)
    ) {
    throw "$vicky not matching (already patched?)."
}

if ($vres -gt 1024) {
    $vresBytes84.CopyTo($bytes, $offset1)
    $vresBytes.CopyTo($bytes, $offset2)
    $vresBytes.CopyTo($bytes, $offset3)
    $vresBytes8.CopyTo($bytes, $offset4)
    $mapInfraWrkaroundBytes.CopyTo($bytes, $offset11)
}

$offset5Bytes.CopyTo($bytes, $offset5)
$offset6Bytes.CopyTo($bytes, $offset6)

$hresBytes.CopyTo($bytes, $offset7)
$vresBytes.CopyTo($bytes, $offset8)

$offset9Bytes.CopyTo($bytes, $offset9)
$offset10Bytes.CopyTo($bytes, $offset10)

Move-Item $vicky "$vicky.bak" -Force -ErrorAction Stop
[IO.File]::WriteAllBytes("$pwd\$vicky", $bytes)

"Done. Please create load_user.bmp with ${hres}x$vres resolution in `"gfx`" folder."

Requirements: Revolutions 2.01. Put it into the game folder. Use the following command line, your resolution as the arguments:

powershell -executionpolicy bypass -file .\vickyresfix.ps1 <horizontal resolution> <vertical resolution>

for example:
powershell -executionpolicy bypass -file .\vickyresfix.ps1 2560 1440

It will make a backup of victoria.exe, but be sure to make your own if you need the original file. Also, you have to create load_user.bmp in "gfx" folder with the resolution you chose above.

First, use the resolution changer. After that, you have to prepare some numbers. Say, you have resolution of 2560x1440:
  • convert 1440 to hexadecimal system -> 5A0
  • multiply by 8 -> 5A0*8=2D00
  • add 4 -> 2D00+4=2D04
Then swap the order of the bytes (see Endianness if curious) in the resulting three numbers (add leading zero where needed), so you have:
  1. 5A0 -> A005
  2. 2D00 -> 002D
  3. 2D04 -> 042D
And finally open the exe in a hex editor and look for these offsets:
000027FC7: 0420 042D (i.e. you should have bytes "0420" here, change them to your number 3)
000027FF2: 0004 A005 (number 1)
000027FFB: 0004 A005 (number 1)
0000284C6: 0020 002D (number 2)
 
Last edited:
  • 1Like
Reactions:
Everyone is familiar with Resolution Changer (Internet Archive) and that it has an annoying crash when you move cursor to the bottom of the screen. It happens when your vertical resolution is higher than the original limit (that is 1024 from 1280x1024).

Download: http://s000.tinyupload.com/index.php?file_id=74073712316215523182
Put it into the game folder (assuming you've used the resolution changer already). Use the following command line, vertical resolution as the argument:

powershell -executionpolicy bypass -file vickyresfix.ps1 <vertical resolution>

for example:
powershell -executionpolicy bypass -file vickyresfix.ps1 1440

It will make a backup of victoria.exe, but be sure to make your own if you need the original file.

First, you have to prepare some numbers. Say, you have resolution of 2560x1440:
  • convert 1440 to hexadecimal system -> 5A0
  • multiply by 8 -> 5A0*8=2D00
  • add 4 -> 2D00+4=2D04
Then swap the order of the bytes (see Endianness if curious) in the resulting three numbers (add leading zero where needed), so you have:
  1. 5A0 -> A005
  2. 2D00 -> 002D
  3. 2D04 -> 042D
And finally open the exe in a hex editor and look for these offsets:
000027FC7: 0420 042D (i.e. you should have bytes "0420" here, change them to your number 3)
000027FF2: 0004 A005 (number 1)
000027FFB: 0004 A005 (number 1)
0000284C6: 0020 002D (number 2)

Thank you! Still playing Ricky (Victoria Revolutions)?
 
Nobody said whether it works. So, I've "combined" the res changer and the fix into one script, see the original post.
Thank you very much. Your way works. I have been using it successfully for six months, but sometimes it blocks the antivirus. I did it by the second method, manually, the first did not work out. Thanks again!
 
You're welcome! Regarding the antivirus blocking, you mean downloading from tinybuild? Yes, this is some recent ridiculous behavior of those moronic antiviruses, to prevent you opening a file hosting so you don't download something somewhere that might contain something bad. Ridiculous!
 
You're welcome! Regarding the antivirus blocking, you mean downloading from tinybuild? Yes, this is some recent ridiculous behavior of those moronic antiviruses, to prevent you opening a file hosting so you don't download something somewhere that might contain something bad. Ridiculous!
Antivirus sometimes recognizes a modified exe file as dangerous.
 
Hmm, what AV? There's only a handful of modified bytes, and they don't look like a pattern of some virus to me. AV seem getting stranger and stranger... Does this happen only with exe modified by the script or manually too?
 
Hmm, what AV? There's only a handful of modified bytes, and they don't look like a pattern of some virus to me. AV seem getting stranger and stranger... Does this happen only with exe modified by the script or manually too?
Hey. I wrote above that I couldn't work with the script. I changed manually. It worked manually, but the antivirus complains about the fixed exe file. Antivirus Avast.
 
Well, Avast is not a good AV AFAIK. I have no idea how it detects something "bad" in the modified resolution values. Anyway, I provided the script and instructions rather than an exe specifically so it could be verified that I'm not adding some crap there.
 
  • 1
Reactions:
Hmm, after a year of use I am writing to say thank you again.

I would also like to note that when switching the map to "infrastructure", there may be a crash (at least for me), it's just for those who sometimes crash and can't understand why.
 
Thank you, I've missed this crash when testing, it appears when there's a certain level of infrastructure on screen and screen height>1024 again. Unfortunately I can't find the exact cause. Some kind of problematic DDraw surface, but I have no idea what it is.
 
I still cannot figure out what's going on with the infra map mode. So, I simply disabled the offending function call. No idea what it draws or does, whatever... After quick tests everything seem to be fine without it, but if you find anything missing, not rendering, etc. please tell. Updated script is in the first post.
 
  • 1Like
Reactions:
I still cannot figure out what's going on with the infra map mode. So, I simply disabled the offending function call. No idea what it draws or does, whatever... After quick tests everything seem to be fine without it, but if you find anything missing, not rendering, etc. please tell. Updated script is in the first post.
Thanks for your hard work!