Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System****;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace New_dvar_dumper
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
games = new Game[]
{
new Game { name = "No Game", processName = "...", dvarBase = 0, dvarSize = 0, pointerToAddress = 0 },
new Game { name = "MW3 - MP", processName = "iw5mp", dvarBase = 0x59CDE00, dvarSize = 76, pointerToAddress = 12 },
new Game { name = "MW2 - MP", processName = "iw4mp", dvarBase = 0x63813F0, dvarSize = 76, pointerToAddress = 12 },
new Game { name = "BlackOps - MP", processName = "BlackOpsMP", dvarBase = 0x3860E90, dvarSize = 112, pointerToAddress = 0x18 },
new Game { name = "BlackOps II - MP", processName = "t6mp", dvarBase = 0x2A1FC48, dvarSize = 96, pointerToAddress = 0x18 },
new Game { name = "MW1 - MP", processName = "iw3mp", dvarBase = 0xCBAB808, dvarSize = 76, pointerToAddress = 12 },
new Game { name = "WAW - MP", processName = "CoDWaWmp", dvarBase = 0xF3F3F70, dvarSize = 92, pointerToAddress = 16 },
new Game { name = "MW3 - SP", processName = "iw5sp", dvarBase = 0x1C473C0, dvarSize = 76, pointerToAddress = 12 },
new Game { name = "MW2 - SP", processName = "iw4sp", dvarBase = 0x196AA90, dvarSize = 80, pointerToAddress = 12 },
new Game { name = "BlackOps - SP", processName = "BlackOps", dvarBase = 0x2621BF0, dvarSize = 112, pointerToAddress = 0x18 },
new Game { name = "BlackOps II - SP", processName = "t6sp", dvarBase = 0x2A41B10, dvarSize = 96, pointerToAddress = 0x18 },
new Game { name = "BlackOps II - ZM", processName = "t6zm", dvarBase = 0x29F5548, dvarSize = 96, pointerToAddress = 0x18 },
new Game { name = "WAW - SP", processName = "CoDWaW", dvarBase = 0x21B1348, dvarSize = 92, pointerToAddress = 16 },
};
}
static Memory memory = new Memory();
static Game[] games;
int gameFound = 0;
private struct Game
{
public string processName;
public string name;
public int dvarBase;
public int dvarSize;
public int pointerToAddress;
}
private void timerGameCheck_Tick(object sender, EventArgs e)
{
for (int i = 0; i < games.Length; i++)
{
Process[] processes = Process.GetProcessesByName(games[i].processName);
if (processes.Length != 0)
{
gameFound = i;
labelFoundGame.Text = games[i].name;
}
}
}
private void buttonDump_Click(object sender, EventArgs e)
{
textDumped.Text = null;
if(!memory.Open_pHandel(games[gameFound].processName))
{
MessageBox.Show("Game not found!");
return;
}
bool containIndex = checkContainIndex.Checked;
bool containDebugInfo = checkHaveDebugInfo.Checked;
int startTime = Environment.TickCount;
textDumped.Text += (containIndex ? "Index | " : "") + "Name | Address\r\n\r\n";
for (int i = 0; i <= 4096; i++)
{
int tempBase = games[gameFound].dvarBase + (games[gameFound].dvarSize * i);
string name = memory.ReadStringAdvanced(memory.ReadInt(tempBase), 32);
int address = tempBase + games[gameFound].pointerToAddress;
if (name == null || address == 0)
break;//I would do continue, But either way works.
textDumped.Text += (containIndex ? i.ToString() + " - " : "") + name + " - 0x" + address.ToString("X") + "\r\n";
}
if(containDebugInfo)
{
int timeTaken = Environment.TickCount - startTime;
textDumped.Text += "\r\nDebugInformation\r\n\r\nTime taken: " + timeTaken.ToString() + "ms(" + (timeTaken / 1000).ToString() + "seconds)\r\n";
}
}
private void buttonSave_Click(object sender, EventArgs e)
{
if (gameFound != 0)
File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + games[gameFound].name + " dvar dump.txt", textDumped.Text);
}
}
}