Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Runtime.InteropServices
- Imports System.Threading
- Imports System.Text
- Imports System.IO
- ' Ranking system and charts built into program, probably if I feel like it
- Public Class Populous
- Public Structure Info
- Shared InstallPath As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Bullfrog Productions Ltd\Populous: The Beginning", "InstallPath", "")
- Shared InstallDirectory As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Bullfrog Productions Ltd\Populous: The Beginning", "InstallDirectory", "")
- Shared InstallDrive As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Bullfrog Productions Ltd\Populous: The Beginning", "InstallDrive", "")
- Shared Language As Integer = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Bullfrog Productions Ltd\Populous: The Beginning", "Language", "")
- Shared MathmakerURL As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Bullfrog Productions Ltd\Populous: The Beginning", "Matchmaker URL", "")
- Shared Version As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Bullfrog Productions Ltd\Populous: The Beginning", "Version", "")
- End Structure
- Shared keys_cmd = New String() {"Pause", _
- "Toggle View", _
- "Encyclopaedia", _
- "Set map marker 1", _
- "Set map marker 2", _
- "Set map marker 3", _
- "Set map marker 4", _
- "Goto map marker 1", _
- "Goto map marker 2", _
- "Goto map marker 3", _
- "Goto map marker 4", _
- "Zoom in", _
- "Zoom out", _
- "Quick load", _
- "Quick save", _
- "Goto shaman", _
- "Chat/Message", _
- "Command tracking", _
- "Release Guarding", _
- "Toggle level stats", _
- "Rotate building", _
- "Assign units to group 1", _
- "Assign units to group 2", _
- "Assign units to group 3", _
- "Assign units to group 4", _
- "Assign units to group 5", _
- "Assign units to group 6", _
- "Select units to group 1", _
- "Select units to group 2", _
- "Select units to group 3", _
- "Select units to group 4", _
- "Select units to group 5", _
- "Select units to group 6", _
- "Goto units to group 1", _
- "Goto units to group 2", _
- "Goto units to group 3", _
- "Goto units to group 4", _
- "Goto units to group 5", _
- "Goto units to group 6", _
- "Goto reincarnation site", _
- "Toggle local selection", _
- "Reselect last selection", _
- "Reorient view", _
- "Display last dialog", _
- "Toggle auto deselect", _
- "Call to arms", _
- "Scatter people"}
- Structure constant
- Shared name
- Shared value
- End Structure
- Structure keybind
- Public cmd As String
- Public modifer
- Public key
- End Structure
- Public Structure player
- Public tribe As tribe
- Public time
- Public flightWwon
- Public fightsLost
- Public enemyFolloweredKilled
- Public enemyBuildingsDestroyed
- Public enemyShamanLills
- Public ownFollowersLost
- Public ownBuildingsDestroyed
- Public ownShamanDeaths
- ' Units
- Public units_total_population As Integer
- Public units_total_firewarrior As Integer
- Public units_total_preist As Integer
- Public units_total_spy As Integer
- Public units_total_brave As Integer
- ' Selected Units
- Public units_selected_total_population As Integer
- Public units_selected_total_firewarrior As Integer
- Public units_selected_total_preist As Integer
- Public units_selected_total_spy As Integer
- Public units_selected_total_brave As Integer
- ' Idle Units
- Public units_idle_total_population As Integer
- Public units_idle_total_firewarrior As Integer
- Public units_idle_total_preist As Integer
- Public units_idle_total_spy As Integer
- Public units_idle_total_brave As Integer
- ' Units in huts
- Public units_hut_total_population As Integer
- Public units_hut_total_firewarrior As Integer
- Public units_hut_total_preist As Integer
- Public units_hut_total_spy As Integer
- Public units_hut_total_brave As Integer
- ' Units working
- Public units_working_total_population As Integer
- Public units_working_total_firewarrior As Integer
- Public units_working_total_preist As Integer
- Public units_working_total_spy As Integer
- Public units_working_total_brave As Integer
- ' Units in boat
- Public units_boat_total_population As Integer
- Public units_boat_total_firewarrior As Integer
- Public units_boat_total_preist As Integer
- Public units_boat_total_spy As Integer
- Public units_boat_total_brave As Integer
- ' Units in baloon
- Public units_baloon_total_population As Integer
- Public units_baloon_total_firewarrior As Integer
- Public units_baloon_total_preist As Integer
- Public units_baloon_total_spy As Integer
- Public units_baloon_total_brave As Integer
- Public vehicle_total_boat
- Public vehicle_total_baloon
- Public spells As spell
- Public buildings As building
- Public special As special
- End Structure
- Public Structure spell
- Public convert
- Public blast
- Public bloodlust
- Public teleport
- Public armagedon
- Public invisible
- Public swarm
- Public ghosts
- Public lightning
- Public landbridge
- Public magicsheild
- Public swamp
- Public tornado
- Public hypno
- Public erode
- Public earthquake
- Public flatten
- Public volcano
- Public AOD
- Public firestorm
- End Structure
- Public Structure building
- Public hut
- Public tower
- Public warrior
- Public preist
- Public spy
- Public firewarrior
- Public boat
- Public baloon
- End Structure
- Structure special
- Public GOD
- Public FOG
- End Structure
- Public Enum mode
- Hardware = 0
- Software = 1
- End Enum
- Public Enum tribe As Byte
- blue = 0
- red = 1
- yellow = 2
- green = 3
- End Enum
- Shared constants() As constant
- Shared keybindings() As keybind
- Shared players(4) As player
- Shared keys(47) As keybind
- Shared datafilestruct = New String() {"0", "1", "2", "3", "4", "5", _
- "6", "7", "8", "9", "a", "b", _
- "c", "d", "e", "f", "g", "h", _
- "i", "j", "k", "l", "m", "n", _
- "o", "p", "q", "r", "s", "t", _
- "u", "v", "w", "x", "y", "z"}
- Public Class memory
- ' They're many different ways to hook the game, You can hook it on launch like PopRe MM does or you can Hot Hook it and hook it at a later time.
- ' Windows.h/Windows API WriteProcessMemory/ReadProcessMemory
- <DllImport("kernel32.dll")> _
- Public Shared Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, <[In](), Out()> ByVal buffer As Byte(), ByVal size As UInteger, ByRef lpNumberOfBytesWritten As IntPtr) As Integer
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function ReadProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, <[In](), Out()> ByVal buffer As Byte(), ByVal size As UInteger, ByRef lpNumberOfBytesRead As IntPtr) As Integer
- End Function
- Public proc As Process
- Enum GameStatus As Byte
- Quit = 0
- Won = 2
- Lost = 4
- End Enum
- Public gameMode As mode
- Public status As GameStatus = GameStatus.Lost
- Public gameStarted As Boolean = False
- Private Delegate Sub ExitedEventHandler(ByVal [When] As DateTime)
- Private Event OnExit As ExitedEventHandler
- Public Delegate Sub GameStartEventHandler([When] As DateTime)
- Public Event OnGameStart As GameStartEventHandler
- Private Const DefaultGameSpeed As Byte = 12
- Public Sub New(ByVal TheProcess As Process)
- proc = TheProcess
- End Sub
- ' Watch for the game to close
- ' Operational Functions/Memory Writers
- Private Sub ExitWatcher()
- While True
- Try
- Thread.Sleep(1000)
- If proc.HasExited Then
- RaiseEvent OnExit(DateTime.Now)
- Thread.CurrentThread.Abort()
- End If
- Catch
- End Try
- End While
- End Sub
- ' Read Memory
- Public Function ReadProcessMemory(ByVal MemoryAddress As IntPtr, ByVal bytesToRead As UInteger) As Byte()
- Dim ptr As IntPtr = CType(&H0, IntPtr)
- Dim buffer As Byte() = New Byte(CInt((bytesToRead - 1))) {}
- ReadProcessMemory(proc.Handle, MemoryAddress, buffer, bytesToRead, ptr)
- Return buffer
- End Function
- Public Function ReadInt8(ByVal address As IntPtr) As [Byte]
- Return ReadProcessMemory(address, 1)(0)
- End Function
- Public Function ReadInt16(ByVal address As IntPtr) As Short
- Return BitConverter.ToInt16(ReadProcessMemory(address, 2), 0)
- End Function
- Public Function ReadInt32(ByVal address As IntPtr) As Integer
- Return BitConverter.ToInt32(ReadProcessMemory(address, 4), 0)
- End Function
- Public Function ReadString(ByVal address As IntPtr, ByVal enc As Encoding, ByVal MaxLength As UInteger) As String
- Return enc.GetString(ReadProcessMemory(address, MaxLength))
- End Function
- ' Write Memory
- Public Function WriteProcessMemory(ByVal address As IntPtr, ByVal bytes As Byte())
- Try
- Dim r As New IntPtr(&H0)
- WriteProcessMemory(proc.Handle, address, bytes, CUInt(bytes.Length), r)
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
- Public Function WriteInt8(ByVal address As IntPtr, ByVal val As Byte)
- Try
- Dim bytes As Byte() = New Byte() {val}
- WriteProcessMemory(address, bytes)
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
- Public Function WriteInt16(ByVal address As IntPtr, ByVal val As Short)
- Try
- Dim bytes As Byte() = BitConverter.GetBytes(val)
- WriteProcessMemory(address, bytes)
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
- Public Function WriteInt32(ByVal address As IntPtr, ByVal val As Integer)
- Try
- Dim bytes As Byte() = BitConverter.GetBytes(val)
- WriteProcessMemory(address, bytes)
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
- Public Function WriteString(ByVal address As IntPtr, ByVal enc As Encoding, ByVal str As String)
- Try
- Dim bytes As Byte() = enc.GetBytes(str)
- WriteProcessMemory(address, bytes)
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
- ' Additonal Functions
- Public Sub BlockBYRNE()
- If gameMode = mode.Hardware Then
- WriteInt8(CType(&H46871F, IntPtr), &HE9)
- WriteInt8(CType(&H468720, IntPtr), &HF2)
- WriteInt8(CType(&H468721, IntPtr), 0)
- WriteInt8(CType(&H468722, IntPtr), 0)
- WriteInt8(CType(&H468723, IntPtr), 0)
- ElseIf gameMode = mode.Software Then
- WriteInt8(CType(&H4AEA3F, IntPtr), &HE9)
- WriteInt8(CType(&H4AEA40, IntPtr), &HF2)
- WriteInt8(CType(&H4AEA41, IntPtr), 0)
- WriteInt8(CType(&H4AEA42, IntPtr), 0)
- WriteInt8(CType(&H4AEA43, IntPtr), 0)
- End If
- End Sub
- Public Sub BlockResync()
- If gameMode = mode.Hardware Then
- WriteInt8(CType(&H4AB017, IntPtr), &H90)
- WriteInt8(CType(&H4AB018, IntPtr), &H90)
- WriteInt8(CType(&H4AB019, IntPtr), &H90)
- WriteInt8(CType(&H4AB01A, IntPtr), &H90)
- WriteInt8(CType(&H4AB01B, IntPtr), &H90)
- WriteInt8(CType(&H4AB01C, IntPtr), &H90)
- WriteInt8(CType(&H4AB01D, IntPtr), &H90)
- WriteInt8(CType(&H4AB01E, IntPtr), &H90)
- WriteInt8(CType(&H4AB01F, IntPtr), &H90)
- WriteInt8(CType(&H4AB020, IntPtr), &H90)
- WriteInt8(CType(&H4AB021, IntPtr), &H90)
- WriteInt8(CType(&H4AB022, IntPtr), &H90)
- WriteInt8(CType(&H4AB023, IntPtr), &H90)
- WriteInt8(CType(&H4AB024, IntPtr), &H90)
- WriteInt8(CType(&H4AB025, IntPtr), &H90)
- WriteInt8(CType(&H4AB026, IntPtr), &H90)
- WriteInt8(CType(&H4AB027, IntPtr), &H90)
- WriteInt8(CType(&H4AB028, IntPtr), &H90)
- WriteInt8(CType(&H4AB029, IntPtr), &H90)
- WriteInt8(CType(&H4AB02A, IntPtr), &H90)
- WriteInt8(CType(&H4AB02B, IntPtr), &H90)
- WriteInt8(CType(&H4AB02C, IntPtr), &H90)
- WriteInt8(CType(&H4AB02D, IntPtr), &H90)
- WriteInt8(CType(&H4AB02E, IntPtr), &H90)
- WriteInt8(CType(&H4AB02F, IntPtr), &H90)
- WriteInt8(CType(&H4AB030, IntPtr), &H90)
- WriteInt8(CType(&H4AB031, IntPtr), &H90)
- WriteInt8(CType(&H4AB032, IntPtr), &H90)
- WriteInt8(CType(&H4AB033, IntPtr), &H90)
- WriteInt8(CType(&H4AB060, IntPtr), &H90)
- WriteInt8(CType(&H4AB061, IntPtr), &H90)
- WriteInt8(CType(&H4AB062, IntPtr), &H90)
- WriteInt8(CType(&H4AB063, IntPtr), &H90)
- WriteInt8(CType(&H4AB064, IntPtr), &H90)
- WriteInt8(CType(&H4AB065, IntPtr), &H90)
- WriteInt8(CType(&H4AB066, IntPtr), &H90)
- WriteInt8(CType(&H4AB067, IntPtr), &H90)
- WriteInt8(CType(&H4AB068, IntPtr), &H90)
- WriteInt8(CType(&H4AB069, IntPtr), &H90)
- WriteInt8(CType(&H4AB06A, IntPtr), &H90)
- WriteInt8(CType(&H4AB06B, IntPtr), &H90)
- WriteInt8(CType(&H4AB06C, IntPtr), &H90)
- WriteInt8(CType(&H4AB06D, IntPtr), &H90)
- WriteInt8(CType(&H4AB06E, IntPtr), &H90)
- WriteInt8(CType(&H4AB06F, IntPtr), &H90)
- WriteInt8(CType(&H4AB070, IntPtr), &H90)
- WriteInt8(CType(&H4AB071, IntPtr), &H90)
- WriteInt8(CType(&H4AB072, IntPtr), &H90)
- WriteInt8(CType(&H4AB073, IntPtr), &H90)
- WriteInt8(CType(&H4AB074, IntPtr), &H90)
- WriteInt8(CType(&H4AB075, IntPtr), &H90)
- WriteInt8(CType(&H4AB076, IntPtr), &H90)
- WriteInt8(CType(&H4AB077, IntPtr), &H90)
- WriteInt8(CType(&H4AB078, IntPtr), &H90)
- WriteInt8(CType(&H4AB079, IntPtr), &H90)
- WriteInt8(CType(&H4AB07A, IntPtr), &H90)
- WriteInt8(CType(&H4AB07B, IntPtr), &H90)
- WriteInt8(CType(&H4AB07C, IntPtr), &H90)
- WriteInt8(CType(&H4AB0A9, IntPtr), &H90)
- WriteInt8(CType(&H4AB0AA, IntPtr), &H90)
- WriteInt8(CType(&H4AB0AB, IntPtr), &H90)
- WriteInt8(CType(&H4AB0AC, IntPtr), &H90)
- WriteInt8(CType(&H4AB0AD, IntPtr), &H90)
- WriteInt8(CType(&H4AB0AE, IntPtr), &H90)
- WriteInt8(CType(&H4AB0AF, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B0, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B1, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B2, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B3, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B4, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B5, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B6, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B7, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B8, IntPtr), &H90)
- WriteInt8(CType(&H4AB0B9, IntPtr), &H90)
- WriteInt8(CType(&H4AB0BA, IntPtr), &H90)
- WriteInt8(CType(&H4AB0BB, IntPtr), &H90)
- WriteInt8(CType(&H4AB0BC, IntPtr), &H90)
- WriteInt8(CType(&H4AB0BD, IntPtr), &H90)
- WriteInt8(CType(&H4AB0BE, IntPtr), &H90)
- WriteInt8(CType(&H4AB0BF, IntPtr), &H90)
- WriteInt8(CType(&H4AB0C0, IntPtr), &H90)
- WriteInt8(CType(&H4AB0C1, IntPtr), &H90)
- WriteInt8(CType(&H4AB0C2, IntPtr), &H90)
- WriteInt8(CType(&H4AB0C3, IntPtr), &H90)
- WriteInt8(CType(&H4AB0C4, IntPtr), &H90)
- WriteInt8(CType(&H4AB0C5, IntPtr), &H90)
- ElseIf gameMode = mode.Software Then
- WriteInt8(CType(&H464BCE, IntPtr), &H90)
- WriteInt8(CType(&H464CBF, IntPtr), &H90)
- WriteInt8(CType(&H464CC0, IntPtr), &H90)
- WriteInt8(CType(&H464CC1, IntPtr), &H90)
- WriteInt8(CType(&H464CC2, IntPtr), &H90)
- WriteInt8(CType(&H464CC3, IntPtr), &H90)
- WriteInt8(CType(&H464CC4, IntPtr), &H90)
- WriteInt8(CType(&H464CC5, IntPtr), &H90)
- WriteInt8(CType(&H464CC6, IntPtr), &H90)
- WriteInt8(CType(&H464CC7, IntPtr), &H90)
- WriteInt8(CType(&H464CC8, IntPtr), &H90)
- WriteInt8(CType(&H464CC9, IntPtr), &H90)
- WriteInt8(CType(&H464CCA, IntPtr), &H90)
- WriteInt8(CType(&H464CCB, IntPtr), &H90)
- WriteInt8(CType(&H464CCC, IntPtr), &H90)
- WriteInt8(CType(&H464CCD, IntPtr), &H90)
- WriteInt8(CType(&H464CCE, IntPtr), &H90)
- WriteInt8(CType(&H464CD0, IntPtr), &H90)
- WriteInt8(CType(&H464CD1, IntPtr), &H90)
- WriteInt8(CType(&H464CED, IntPtr), &H90)
- WriteInt8(CType(&H464CEE, IntPtr), &H90)
- WriteInt8(CType(&H464CEF, IntPtr), &H90)
- WriteInt8(CType(&H464CF0, IntPtr), &H90)
- WriteInt8(CType(&H464CF1, IntPtr), &H90)
- WriteInt8(CType(&H464CF2, IntPtr), &H90)
- WriteInt8(CType(&H464CF3, IntPtr), &H90)
- WriteInt8(CType(&H464CF4, IntPtr), &H90)
- WriteInt8(CType(&H464CF5, IntPtr), &H90)
- WriteInt8(CType(&H464CF6, IntPtr), &H90)
- WriteInt8(CType(&H464CF7, IntPtr), &H90)
- WriteInt8(CType(&H464CF8, IntPtr), &H90)
- WriteInt8(CType(&H464CF9, IntPtr), &H90)
- WriteInt8(CType(&H464CFA, IntPtr), &H90)
- WriteInt8(CType(&H464CFB, IntPtr), &H90)
- WriteInt8(CType(&H464CFC, IntPtr), &H90)
- WriteInt8(CType(&H464CFD, IntPtr), &H90)
- WriteInt8(CType(&H464CFE, IntPtr), &H90)
- WriteInt8(CType(&H464CFF, IntPtr), &H90)
- WriteInt8(CType(&H464D00, IntPtr), &H90)
- WriteInt8(CType(&H464D01, IntPtr), &H90)
- WriteInt8(CType(&H464D02, IntPtr), &H90)
- WriteInt8(CType(&H464D03, IntPtr), &H90)
- WriteInt8(CType(&H464D04, IntPtr), &H90)
- WriteInt8(CType(&H464D05, IntPtr), &H90)
- WriteInt8(CType(&H464D06, IntPtr), &H90)
- WriteInt8(CType(&H464D07, IntPtr), &H90)
- WriteInt8(CType(&H464D08, IntPtr), &H90)
- WriteInt8(CType(&H464D09, IntPtr), &H90)
- WriteInt8(CType(&H464D36, IntPtr), &H90)
- WriteInt8(CType(&H464D37, IntPtr), &H90)
- WriteInt8(CType(&H464D38, IntPtr), &H90)
- WriteInt8(CType(&H464D39, IntPtr), &H90)
- WriteInt8(CType(&H464D3A, IntPtr), &H90)
- WriteInt8(CType(&H464D3B, IntPtr), &H90)
- WriteInt8(CType(&H464D3C, IntPtr), &H90)
- WriteInt8(CType(&H464D3D, IntPtr), &H90)
- WriteInt8(CType(&H464D3E, IntPtr), &H90)
- WriteInt8(CType(&H464D3F, IntPtr), &H90)
- WriteInt8(CType(&H464D40, IntPtr), &H90)
- WriteInt8(CType(&H464D41, IntPtr), &H90)
- WriteInt8(CType(&H464D42, IntPtr), &H90)
- WriteInt8(CType(&H464D43, IntPtr), &H90)
- WriteInt8(CType(&H464D44, IntPtr), &H90)
- WriteInt8(CType(&H464D45, IntPtr), &H90)
- WriteInt8(CType(&H464D46, IntPtr), &H90)
- WriteInt8(CType(&H464D47, IntPtr), &H90)
- WriteInt8(CType(&H464D48, IntPtr), &H90)
- WriteInt8(CType(&H464D49, IntPtr), &H90)
- WriteInt8(CType(&H464D4A, IntPtr), &H90)
- WriteInt8(CType(&H464D4B, IntPtr), &H90)
- WriteInt8(CType(&H464D4C, IntPtr), &H90)
- WriteInt8(CType(&H464D4D, IntPtr), &H90)
- WriteInt8(CType(&H464D4E, IntPtr), &H90)
- WriteInt8(CType(&H464D4F, IntPtr), &H90)
- WriteInt8(CType(&H464D50, IntPtr), &H90)
- WriteInt8(CType(&H464D51, IntPtr), &H90)
- WriteInt8(CType(&H464D52, IntPtr), &H90)
- End If
- End Sub
- Public Sub FixTexture()
- If gameMode = mode.Hardware Then
- Dim fix As Byte() = New Byte(0) {}
- fix(0) = &H3F
- WriteProcessMemory(CType(&H5177BC, IntPtr), fix)
- End If
- End Sub
- Public Sub ChangeResolution(w As Integer, h As Integer)
- If gameMode = mode.Hardware Then
- WriteInt8(CType(&H410F9A, IntPtr), &H6A)
- WriteInt8(CType(&H410F9B, IntPtr), &H20)
- WriteInt8(CType(&H410F9A, IntPtr), &H6A)
- WriteInt8(CType(&H410F9B, IntPtr), &H20)
- WriteInt8(CType(&H410F9C, IntPtr), &H68)
- WriteInt8(CType(&H410F9D, IntPtr), CByte((h And &HFF)))
- WriteInt8(CType(&H410F9E, IntPtr), CByte(Math.Round(CDbl((CDbl((h And &HFF00)) / 256)))))
- WriteInt8(CType(&H410F9F, IntPtr), 0)
- WriteInt8(CType(&H410FA0, IntPtr), 0)
- WriteInt8(CType(&H410FA1, IntPtr), &H68)
- WriteInt8(CType(&H410FA2, IntPtr), CByte((w And &HFF)))
- WriteInt8(CType(&H410FA3, IntPtr), CByte(Math.Round(CDbl((CDbl((w And &HFF00)) / 256)))))
- WriteInt8(CType(&H410FA4, IntPtr), 0)
- WriteInt8(CType(&H410FA5, IntPtr), 0)
- WriteInt8(CType(&H457D60, IntPtr), &H6A)
- WriteInt8(CType(&H457D61, IntPtr), &H20)
- WriteInt8(CType(&H457D62, IntPtr), &H68)
- WriteInt8(CType(&H457D63, IntPtr), CByte((h And &HFF)))
- WriteInt8(CType(&H457D64, IntPtr), CByte(Math.Round(CDbl((CDbl((h And &HFF00)) / 256)))))
- WriteInt8(CType(&H457D65, IntPtr), 0)
- WriteInt8(CType(&H457D66, IntPtr), 0)
- WriteInt8(CType(&H457D67, IntPtr), &H68)
- WriteInt8(CType(&H457D68, IntPtr), CByte((w And &HFF)))
- WriteInt8(CType(&H457D69, IntPtr), CByte(Math.Round(CDbl((CDbl((w And &HFF00)) / 256)))))
- WriteInt8(CType(&H457D6A, IntPtr), 0)
- WriteInt8(CType(&H457D6B, IntPtr), 0)
- Dim n As Integer = &H410FA6
- While n <= &H410FC5
- WriteInt8(CType(n, IntPtr), &H90)
- n += 1
- End While
- Dim n2 As Integer = &H457D6C
- While n2 <= &H457D86
- WriteInt8(CType(n2, IntPtr), &H90)
- n2 += 1
- End While
- End If
- End Sub
- Public Sub ChangeTribe(ByVal t As tribe) ' illegal online (cheating)
- If gameMode = mode.Hardware Then
- WriteInt8(CType(&H884C88, IntPtr), t)
- End If
- End Sub
- Public ReadOnly Property Joined() As Boolean
- Get
- If gameMode = mode.Hardware Then
- Return ReadInt8(CType(&H87D29CL, IntPtr)) <> 0
- ElseIf gameMode = mode.Software Then
- Return ReadInt8(CType(&H894D04L, IntPtr)) <> 0
- End If
- Return False
- End Get
- End Property
- ' Could add more featues like Change Speed, Window Mode but thats for later.
- ' Game Watchers (Online)
- Public Function DetectGameStatus() As GameStatus
- If gameMode = mode.Hardware Then
- status = CType(ReadInt8(CType(&H89C664, IntPtr)), GameStatus)
- ElseIf gameMode = mode.Software Then
- status = CType(ReadInt8(CType(&H884BFC, IntPtr)), GameStatus)
- End If
- Return status
- End Function
- Public Sub WatchGameStart()
- Dim Watcher = New Thread(AddressOf GameStartWatcher)
- Watcher.IsBackground = True
- Watcher.Start()
- End Sub
- Public Sub WatchGame()
- Dim Watcher = New Thread(AddressOf GameWatcher)
- Watcher.IsBackground = True
- Watcher.Start()
- End Sub
- Private Sub GameStartWatcher()
- ' the speed value changes when the game starts
- Try
- Speed = 0
- Thread.Sleep(1000)
- While Speed <> DefaultGameSpeed AndAlso Not proc.HasExited
- Thread.Sleep(1000)
- End While
- If Not proc.HasExited Then
- gameStarted = True
- RaiseEvent OnGameStart(DateTime.Now)
- End If
- Catch
- End Try
- End Sub
- Private Sub GameWatcher()
- Try
- While Not proc.HasExited
- DetectGameStatus()
- GetUnitInfo()
- Thread.Sleep(1000)
- End While
- Catch
- End Try
- End Sub
- Public Sub GetUnitInfo()
- End Sub
- Public Property Speed() As Byte
- Get
- If gameMode = mode.Hardware Then
- Return ReadInt8(CType(&H89D161, IntPtr))
- ElseIf gameMode = mode.Software Then
- Return ReadInt8(CType(&H8856F9, IntPtr))
- End If
- Return 0
- End Get
- Set(value As Byte)
- If gameMode = mode.Hardware Then
- WriteInt8(CType(&H89D161, IntPtr), value)
- ElseIf gameMode = mode.Hardware Then
- WriteInt8(CType(&H8856F9, IntPtr), value)
- End If
- End Set
- End Property
- End Class
- Public Class colors
- Public Structure RGB
- Public R As Integer
- Public G As Integer
- Public B As Integer
- End Structure
- Public Function [Set](ByVal blue As RGB, ByVal red As RGB, ByVal yellow As RGB, ByVal green As RGB)
- Dim writer As New System.IO.BinaryWriter(System.IO.Stream.Null)
- For Each pal In Populous.datafilestruct
- Try
- writer = New System.IO.BinaryWriter(System.IO.File.Open(Populous.Info.InstallPath & "\data\pal0-" & pal & ".dat", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite))
- Catch
- Return False
- End Try
- Try
- writer.Seek(216 * 4, System.IO.SeekOrigin.Current)
- ' Each color has 4 bytes so we do 216*4
- For j As Integer = 0 To 31
- If j < 8 Then
- writer.Write(CByte(blue.R)) 'R
- writer.Write(CByte(blue.G)) 'G
- writer.Write(CByte(blue.B)) 'B
- ' We don't know what this is
- writer.Write(CByte(0))
- ElseIf j < 16 Then
- writer.Write(CByte(green.R)) 'R
- writer.Write(CByte(green.G)) 'G
- writer.Write(CByte(green.B)) 'B
- ' We don't know what this is
- writer.Write(CByte(0))
- ElseIf j < 24 Then
- writer.Write(CByte(yellow.R)) 'R
- writer.Write(CByte(yellow.G)) 'G
- writer.Write(CByte(yellow.B)) 'B
- ' We don't know what this is
- writer.Write(CByte(0))
- ElseIf j < 32 Then
- writer.Write(CByte(red.R)) 'R
- writer.Write(CByte(red.G)) 'G
- writer.Write(CByte(red.B)) 'B
- ' We don't know what this is
- writer.Write(CByte(0))
- End If
- Next
- Catch
- Return False
- End Try
- writer.Close()
- Next
- Try
- writer.Close()
- writer.Dispose()
- Catch ex As Exception
- End Try
- Return True
- End Function
- Public Function restore()
- Return True
- End Function
- End Class
- Public Class files
- Private Declare Function GetKeyboardLayout Lib "user32" (ByVal idThread As UInteger) As IntPtr
- <DllImport("User32.dll")> _
- Shared Function GetKeyboardLayout(idThread As Integer) As IntPtr
- End Function
- <DllImport("user32.dll")> _
- Shared Function MapVirtualKeyEx(uCode As Integer, uMapType As Integer, dwhkl As Integer) As Integer
- End Function
- <DllImport("user32.dll")> _
- Shared Function GetKeyboardState(ByVal keyState() As Byte) As Boolean
- End Function
- <DllImport("user32.dll")> _
- Shared Function ToAsciiEx(uVirtKey As Integer, uScanCode As Integer, lpKeyState As Byte, lpChar As Integer, uFlags As Integer, dwhkl As Integer) As Integer
- End Function
- Private keys_loc = New Integer() {8, 23, 38, 53, 68, 83, 98, 113, 128, 143, _
- 158, 173, 188, 203, 218, 233, 248, 263, 278, _
- 293, 308, 323, 338, 353, 368, 383, 398, 413, _
- 428, 443, 458, 473, 488, 503, 518, 533, 548, _
- 563, 578, 593, 608, 623, 638, 653, 668, 683, _
- 698}
- Enum install
- complete
- recomended
- minimum
- End Enum
- Public Function scan(ByVal install As install)
- Return 0
- End Function
- Public Function repair(ByVal install As install)
- Return 0
- End Function
- Public Function loadFile(ByVal file)
- Return 0
- End Function
- Public Function loadConstants()
- Return 0
- End Function
- Public Function loadKeyBinding()
- Return 0
- End Function
- Public Function saveKeyBinding()
- Return 0
- End Function
- Public Function loadLanguageFile(ByVal file As String)
- End Function
- Public Function LoadLevelHDR(ByVal file As String)
- End Function
- Public Function saveConstants()
- Return 0
- End Function
- Public Function CheckGameVersion()
- Return 0
- End Function
- Public Function FileCheck(ByVal file As String)
- Return 0
- End Function
- End Class
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement