[MOD] Community Code/Offset List - 1.63
I'm from the Xbox 360 modding scene and this is something that's pretty popular over there (except we do it with COD games and whatnot) so I figured we could do this here aswell!
What is this exactly?
This is a list of code/offsets that can be used or contributed to by anyone in the community. If you want something added just comment it down below and I'll add it to the list. If you post something that is not yours you must give credit for it and if you use code or offsets from this list you must give credit where it is due.
Offsets
Code
What is this exactly?
This is a list of code/offsets that can be used or contributed to by anyone in the community. If you want something added just comment it down below and I'll add it to the list. If you post something that is not yours you must give credit for it and if you use code or offsets from this list you must give credit where it is due.
Offsets
Code:
const DWORD ScriptFunc_activateAddons = 0x0079982B; const DWORD ScriptFunc_cameraInterest = 0x00778761; const DWORD ScriptFunc_createMine = 0x00786CD4; const DWORD ScriptFunc_createVehicle = 0x00797C23; const DWORD ScriptFunc_deleteWaypoint = 0x0079DA80; const DWORD ScriptFunc_hideBody = 0x0077695B; const DWORD ScriptFunc_openMap = 0x0076A32C; const DWORD ScriptFunc_player = 0x0077063A; const DWORD ScriptFunc_preloadCamera = 0x00778692; const DWORD ScriptFunc_preloadSound = 0x007832F7; const DWORD ScriptFunc_scriptDone = 0x0076FAD2; const DWORD ScriptFunc_selectPlayer = 0x00779A84; const DWORD ScriptFunc_setPlayable = 0x00779C53; const DWORD ScriptFunc_setPlayerRespawnTime = 0x00769FBE; const DWORD ScriptFunc_surfaceIsWater = 0x0076AAFF; const DWORD ScriptFunc_surfaceType = 0x0078343D; const DWORD ScriptFunc_terminate = 0x0076FB07; DWORD World = *(DWORD*)0x00DA8208; DWORD EntityLink = *(DWORD*)(World + 0x13A8); DWORD Entity = *(DWORD*)(EntityLink + 4); DWORD VisualState = *(DWORD*)(Entity + 0x18); Vector3 Coordinates = *(Vector3*)(VisualState + 0x28);
MemoryHelper
Code:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace XeClutch
{
class MemoryHelper
{
// Structures
public struct Vector3
{
public float x, y, z;
}
// Variables
public bool m_Attached;
public IntPtr m_Handle;
public Process m_Process;
public string m_ProcessName;
// Kernel Imports
[DllImport("kernel32.dll")]
static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out int lpNumberOfBytesRead);
[DllImport("kernel32.dll")]
static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
[DllImport("kernel32.dll")]
static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool CloseHandle(IntPtr hObject);
// Constructor
public MemoryHelper(string szProcessName)
{
m_Attached = false;
m_Handle = IntPtr.Zero;
m_Process = null;
m_ProcessName = szProcessName;
}
// Methods
public bool Attach(int AccessFlag)
{
Process[] processes = Process.GetProcessesByName(m_ProcessName);
if (processes.Length != 1)
return (m_Attached = false);
m_Process = processes[0];
m_Handle = OpenProcess((int)AccessFlag, true, m_Process.Id);
return (m_Attached = true);
}
public bool Detach()
{
try
{
CloseHandle(m_Handle);
return true;
}
catch
{
return false;
}
}
public void PatchCall(uint address, uint calladdress)
{
byte[] final = { 0xE8, 0x00, 0x00, 0x00, 0x00 };
uint buffer = 0xFFFFFFFF - (address - calladdress);
if (calladdress > (address - 5))
buffer = calladdress - (address + 5);
Array.Copy(BitConverter.GetBytes(buffer), 0, final, 1, 4);
WriteBytes(address, final);
}
public void PatchJump(uint address, uint jumpaddress)
{
byte[] final = { 0xE9, 0x00, 0x00, 0x00, 0x00 };
uint buffer = 0xFFFFFFFF - (address - jumpaddress);
if (jumpaddress > (address - 5))
buffer = jumpaddress - (address + 5);
Array.Copy(BitConverter.GetBytes(buffer), 0, final, 1, 4);
WriteBytes(address, final);
}
public byte ReadByte(uint address)
{
return ReadBytes(address, 1)[0];
}
public byte[] ReadBytes(uint address, int len)
{
int buffer = 0;
byte[] output = new byte[len];
bool worked = ReadProcessMemory(m_Handle, (IntPtr)address, output, len, out buffer);
int err = Marshal.GetLastWin32Error();
return output;
}
public float ReadFloat(uint address)
{
return BitConverter.ToSingle(ReadBytes(address, 4), 0);
}
public string ReadString(uint address, int len)
{
return Encoding.ASCII.GetString(ReadBytes(address, len));
}
public uint ReadUInt32(uint address)
{
return BitConverter.ToUInt32(ReadBytes(address, 4), 0);
}
public Vector3 ReadVector3(uint address)
{
Vector3 ret;
ret.x = ReadFloat(address);
ret.y = ReadFloat(address + 4);
ret.z = ReadFloat(address + 8);
return ret;
}
public uint SearchBytes(uint address, int len, byte[] data)
{
byte[] bytes = ReadBytes(address, len);
string bytestosearch = "";
string bytesscanning = "";
foreach (byte b in data)
bytestosearch += b.ToString("X2");
for (uint i = 0; i < (len - data.Length); i++)
{
bytesscanning = "";
for (int j = 0; j < data.Length; i++)
bytesscanning += bytes[i + j].ToString("X2");
if (bytesscanning == bytestosearch)
return address + i;
}
return 0;
}
public uint SearchFloat(uint address, int len, float data)
{
return SearchBytes(address, len, BitConverter.GetBytes(data));
}
public uint SearchString(uint address, int len, string data)
{
return SearchBytes(address, len, Encoding.ASCII.GetBytes(data));
}
public uint SearchUInt32(uint address, int len, uint data)
{
return SearchBytes(address, len, BitConverter.GetBytes(data));
}
public void WriteByte(uint address, byte data)
{
WriteBytes(address, new byte[] { data });
}
public void WriteBytes(uint address, byte[] data)
{
int buffer = 0;
WriteProcessMemory(m_Handle, (IntPtr)address, data, data.Length, out buffer);
}
public void WriteFloat(uint address, float data)
{
WriteBytes(address, BitConverter.GetBytes(data));
}
public void WriteNOP(uint address, int len)
{
byte[] nop = new byte[len];
for (int i = 0; i < len; i++)
nop[i] = 0x90;
WriteBytes(address, nop);
}
public void WriteString(uint address, string data)
{
WriteBytes(address, Encoding.ASCII.GetBytes(data));
}
public void WriteUInt32(uint address, uint data)
{
WriteBytes(address, BitConverter.GetBytes(data));
}
public void WriteVector3(uint address, Vector3 data)
{
WriteFloat(address, data.x);
WriteFloat(address + 4, data.y);
WriteFloat(address + 8, data.z);
}
}
}

