Post: Small C++ PS3 Library (Source)
06-08-2014, 07:54 PM #1
seb5594
Proud Former Admin
(adsbygoogle = window.adsbygoogle || []).push({}); Hey NGU Members,

Since no one bothered to make a C++ Tool i thought this would help to get started Smile
This will import the PS3TMAPI DLL (Thanks to Enstone for the method) and you can read/write data (like PS3Lib Extensions).
I want also to thank itsLollo, he helped me to solve some probs :p

    
const WCHAR * dllName = L"ps3tmapi.dll";
HINSTANCE hlib = LoadLibrary(dllName);

typedef int(__cdecl *InitTargetCommsFunction)(void);
typedef int(__cdecl *ConnectFunction)(int, LPWSTR);
typedef int(__cdecl *DisconnectFunction)(int);
typedef int(__cdecl *ProcessListFunction)(int, UINT32*, UINT32*);
typedef int(__cdecl *ProcessAttachFunction)(int, UINT32, UINT32);
typedef int(__cdecl *ProcessContinueFunction) (int, UINT32);
typedef int(__cdecl *ProcessSetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);
typedef int(__cdecl *ProcessGetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);

InitTargetCommsFunction InitTargetComms = (InitTargetCommsFunction)GetProcAddress(hlib, "SNPS3InitTargetComms");
ConnectFunction ProcConnectTarget = (ConnectFunction)GetProcAddress(hlib, "SNPS3Connect");
DisconnectFunction ProcDisconnectTarget = (DisconnectFunction)GetProcAddress(hlib, "SNPS3Disconnect");
ProcessListFunction ProcProcessList = (ProcessListFunction)GetProcAddress(hlib, "SNPS3ProcessList");
ProcessAttachFunction ProcProcessAttach = (ProcessAttachFunction)GetProcAddress(hlib, "SNPS3ProcessAttach");
ProcessContinueFunction ProcProcessContinue = (ProcessContinueFunction)GetProcAddress(hlib, "SNPS3ProcessContinue");
ProcessGetMemoryFunction ProcGetMemory = (ProcessGetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessGetMemory");
ProcessSetMemoryFunction ProcSetMemory = (ProcessSetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessSetMemory");

INT32 Target = 0xFFFFFFFE;
UINT32 puCount[32];
UINT32 ProcessID;

static void ConnectTarget()
{
try
{
InitTargetComms();
ProcConnectTarget(Target, NULL);
MessageBox(0, L"Succesfully conncted to Dev-Kit", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while connecting to Dev-Kit", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void Attach()
{
try
{
ProcProcessList(Target, puCount, &ProcessID);
ProcProcessAttach(Target, 0, ProcessID);
ProcProcessContinue(Target, ProcessID);
MessageBox(0, L"Succesfully attached your game", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while attaching your game", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void SetMemory(UINT32 Address, BYTE *bytes, int sizeOfArray)
{
InitTargetComms();
ProcSetMemory(Target, 0, ProcessID, 0, Address, sizeOfArray, bytes);
}

static BYTE* GetMemory(UINT32 Address, INT32 Length)
{
InitTargetComms();
BYTE* ret = new BYTE[Length];
ProcGetMemory(Target, 0, ProcessID, 0, Address, Length, ret);
return ret;
}

static signed char ReadSByte(UINT32 Address)
{
return (signed char)GetMemory(Address, 1)[0];
}
static BYTE ReadByte(UINT32 Address)
{
return (BYTE)GetMemory(Address, 1)[0];
}
static bool ReadBool(UINT32 Address)
{
return GetMemory(Address, 1)[0] != 0;
}
static INT16 ReadInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(INT16*)read;
}
static INT32 ReadInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(INT32*)read;
}
static INT64 ReadInt64(UINT64 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(INT64*)read;
}
static UINT16 ReadUInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(UINT16*)read;
}
static UINT32 ReadUInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(UINT32*)read;
}
static UINT64 ReadUInt64(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(UINT64*)read;
}
static FLOAT ReadFloat(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(FLOAT*)read;
}
static DOUBLE ReadDouble(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(DOUBLE*)read;
}
static void WriteByte(UINT32 Address, BYTE input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteSByte(UINT32 Address, signed char input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteBool(UINT32 Address, bool input)
{
BYTE bytes[] = { input };
bytes[0] = input ? (BYTE)1 : (BYTE)0;
SetMemory(Address, bytes, 1);
}
static void WriteInt16(UINT32 Address, INT16 input)
{
BYTE bytes[2];
*(INT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteInt32(UINT32 Address, INT32 input)
{
BYTE bytes[4];
*(INT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteInt64(UINT32 Address, INT64 input)
{
BYTE bytes[8];
*(INT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteUInt16(UINT32 Address, UINT16 input)
{
BYTE bytes[2];
*(UINT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteUInt32(UINT32 Address, UINT32 input)
{
BYTE bytes[4];
*(UINT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteUInt64(UINT32 Address, UINT64 input)
{
BYTE bytes[8];
*(UINT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteFloat(UINT32 Address, float input)
{
BYTE bytes[4];
*(float*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteDouble(UINT32 Address, DOUBLE input)
{
BYTE bytes[8];
*(DOUBLE*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteString(UINT32 Address, std::string text)
{
SetMemory(Address, (BYTE*)text.c_str(), text.length() + 1);
}
static bool CompareByteArray(BYTE* a, BYTE* b, INT32 ArrayLength)
{
INT32 CheckArray = 0;
for (INT32 i = 0; i < ArrayLength; i++)
if (a[i] == b[i])
CheckArray++;
return CheckArray == ArrayLength;
}
static std::string ReadString(UINT32 Address, INT32 Length)
{
return (reinterpret_cast<const char*>(GetMemory(Address, Length)));
}


I really hope some ppl will take the time to learn some C++, enjoy! :yes:
(adsbygoogle = window.adsbygoogle || []).push({});

The following 19 users say thank you to seb5594 for this useful post:

Azus, Bad Luck Brian, BornShooter, Cyb3r, flynhigh09, Im Not Boobdidas, iMoDz-Baptiste, ItsLollo1000, MegaMister, milky4444, Notorious, Padavona, SnaY, Swiss, SyGnUs, Tustin, Hash847, witchery
06-08-2014, 07:59 PM #2
Originally posted by seb5594 View Post
Hey NGU Members,

Since no one bothered to make a C++ Tool i thought this would help to get started Smile
This will import the PS3TMAPI DLL (Thanks to Enstone for the method) and you can read/write data (like PS3Lib Extensions).
I want also to thank itsLollo, he helped me to solve some probs :p

    
const WCHAR * dllName = L"ps3tmapi.dll";
HINSTANCE hlib = LoadLibrary(dllName);

typedef int(__cdecl *InitTargetCommsFunction)(void);
typedef int(__cdecl *ConnectFunction)(int, LPWSTR);
typedef int(__cdecl *DisconnectFunction)(int);
typedef int(__cdecl *ProcessListFunction)(int, UINT32*, UINT32*);
typedef int(__cdecl *ProcessAttachFunction)(int, UINT32, UINT32);
typedef int(__cdecl *ProcessContinueFunction) (int, UINT32);
typedef int(__cdecl *ProcessSetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);
typedef int(__cdecl *ProcessGetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);

InitTargetCommsFunction InitTargetComms = (InitTargetCommsFunction)GetProcAddress(hlib, "SNPS3InitTargetComms");
ConnectFunction ProcConnectTarget = (ConnectFunction)GetProcAddress(hlib, "SNPS3Connect");
DisconnectFunction ProcDisconnectTarget = (DisconnectFunction)GetProcAddress(hlib, "SNPS3Disconnect");
ProcessListFunction ProcProcessList = (ProcessListFunction)GetProcAddress(hlib, "SNPS3ProcessList");
ProcessAttachFunction ProcProcessAttach = (ProcessAttachFunction)GetProcAddress(hlib, "SNPS3ProcessAttach");
ProcessContinueFunction ProcProcessContinue = (ProcessContinueFunction)GetProcAddress(hlib, "SNPS3ProcessContinue");
ProcessGetMemoryFunction ProcGetMemory = (ProcessGetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessGetMemory");
ProcessSetMemoryFunction ProcSetMemory = (ProcessSetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessSetMemory");

INT32 Target = 0xFFFFFFFE;
UINT32 puCount[32];
UINT32 ProcessID;

static void ConnectTarget()
{
try
{
InitTargetComms();
ProcConnectTarget(Target, NULL);
MessageBox(0, L"Succesfully conncted to Dev-Kit", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while connecting to Dev-Kit", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void Attach()
{
try
{
ProcProcessList(Target, puCount, &ProcessID);
ProcProcessAttach(Target, 0, ProcessID);
ProcProcessContinue(Target, ProcessID);
MessageBox(0, L"Succesfully attached your game", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while attaching your game", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void SetMemory(UINT32 Address, BYTE *bytes, int sizeOfArray)
{
InitTargetComms();
ProcSetMemory(Target, 0, ProcessID, 0, Address, sizeOfArray, bytes);
}

static BYTE* GetMemory(UINT32 Address, INT32 Length)
{
InitTargetComms();
BYTE* ret = new BYTE[Length];
ProcGetMemory(Target, 0, ProcessID, 0, Address, Length, ret);
return ret;
}

static signed char ReadSByte(UINT32 Address)
{
return (signed char)GetMemory(Address, 1)[0];
}
static BYTE ReadByte(UINT32 Address)
{
return (BYTE)GetMemory(Address, 1)[0];
}
static bool ReadBool(UINT32 Address)
{
return GetMemory(Address, 1)[0] != 0;
}
static INT16 ReadInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(INT16*)read;
}
static INT32 ReadInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(INT32*)read;
}
static INT64 ReadInt64(UINT64 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(INT64*)read;
}
static UINT16 ReadUInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(UINT16*)read;
}
static UINT32 ReadUInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(UINT32*)read;
}
static UINT64 ReadUInt64(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(UINT64*)read;
}
static FLOAT ReadFloat(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(FLOAT*)read;
}
static DOUBLE ReadDouble(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(DOUBLE*)read;
}
static void WriteByte(UINT32 Address, BYTE input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteSByte(UINT32 Address, signed char input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteBool(UINT32 Address, bool input)
{
BYTE bytes[] = { input };
bytes[0] = input ? (BYTE)1 : (BYTE)0;
SetMemory(Address, bytes, 1);
}
static void WriteInt16(UINT32 Address, INT16 input)
{
BYTE bytes[2];
*(INT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteInt32(UINT32 Address, INT32 input)
{
BYTE bytes[4];
*(INT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteInt64(UINT32 Address, INT64 input)
{
BYTE bytes[8];
*(INT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteUInt16(UINT32 Address, UINT16 input)
{
BYTE bytes[2];
*(UINT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteUInt32(UINT32 Address, UINT32 input)
{
BYTE bytes[4];
*(UINT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteUInt64(UINT32 Address, UINT64 input)
{
BYTE bytes[8];
*(UINT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteFloat(UINT32 Address, float input)
{
BYTE bytes[4];
*(float*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteDouble(UINT32 Address, DOUBLE input)
{
BYTE bytes[8];
*(DOUBLE*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteString(UINT32 Address, std::string text)
{
SetMemory(Address, (BYTE*)text.c_str(), text.length() + 1);
}
static bool CompareByteArray(BYTE* a, BYTE* b, INT32 ArrayLength)
{
INT32 CheckArray = 0;
for (INT32 i = 0; i < ArrayLength; i++)
if (a[i] == b[i])
CheckArray++;
return CheckArray == ArrayLength;
}
static std::string ReadString(UINT32 Address, INT32 Length)
{
return (reinterpret_cast<const char*>(GetMemory(Address, Length)));
}


I really hope some ppl will take the time to learn some C++, enjoy! :yes:


Thanks man, this will help a lot of people out!
06-08-2014, 08:00 PM #3
Citadel
Samurai Poster
Originally posted by seb5594 View Post
Hey NGU Members,

Since no one bothered to make a C++ Tool i thought this would help to get started Smile
This will import the PS3TMAPI DLL (Thanks to Enstone for the method) and you can read/write data (like PS3Lib Extensions).
I want also to thank itsLollo, he helped me to solve some probs :p

    
const WCHAR * dllName = L"ps3tmapi.dll";
HINSTANCE hlib = LoadLibrary(dllName);

typedef int(__cdecl *InitTargetCommsFunction)(void);
typedef int(__cdecl *ConnectFunction)(int, LPWSTR);
typedef int(__cdecl *DisconnectFunction)(int);
typedef int(__cdecl *ProcessListFunction)(int, UINT32*, UINT32*);
typedef int(__cdecl *ProcessAttachFunction)(int, UINT32, UINT32);
typedef int(__cdecl *ProcessContinueFunction) (int, UINT32);
typedef int(__cdecl *ProcessSetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);
typedef int(__cdecl *ProcessGetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);

InitTargetCommsFunction InitTargetComms = (InitTargetCommsFunction)GetProcAddress(hlib, "SNPS3InitTargetComms");
ConnectFunction ProcConnectTarget = (ConnectFunction)GetProcAddress(hlib, "SNPS3Connect");
DisconnectFunction ProcDisconnectTarget = (DisconnectFunction)GetProcAddress(hlib, "SNPS3Disconnect");
ProcessListFunction ProcProcessList = (ProcessListFunction)GetProcAddress(hlib, "SNPS3ProcessList");
ProcessAttachFunction ProcProcessAttach = (ProcessAttachFunction)GetProcAddress(hlib, "SNPS3ProcessAttach");
ProcessContinueFunction ProcProcessContinue = (ProcessContinueFunction)GetProcAddress(hlib, "SNPS3ProcessContinue");
ProcessGetMemoryFunction ProcGetMemory = (ProcessGetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessGetMemory");
ProcessSetMemoryFunction ProcSetMemory = (ProcessSetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessSetMemory");

INT32 Target = 0xFFFFFFFE;
UINT32 puCount[32];
UINT32 ProcessID;

static void ConnectTarget()
{
try
{
InitTargetComms();
ProcConnectTarget(Target, NULL);
MessageBox(0, L"Succesfully conncted to Dev-Kit", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while connecting to Dev-Kit", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void Attach()
{
try
{
ProcProcessList(Target, puCount, &ProcessID);
ProcProcessAttach(Target, 0, ProcessID);
ProcProcessContinue(Target, ProcessID);
MessageBox(0, L"Succesfully attached your game", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while attaching your game", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void SetMemory(UINT32 Address, BYTE *bytes, int sizeOfArray)
{
InitTargetComms();
ProcSetMemory(Target, 0, ProcessID, 0, Address, sizeOfArray, bytes);
}

static BYTE* GetMemory(UINT32 Address, INT32 Length)
{
InitTargetComms();
BYTE* ret = new BYTE[Length];
ProcGetMemory(Target, 0, ProcessID, 0, Address, Length, ret);
return ret;
}

static signed char ReadSByte(UINT32 Address)
{
return (signed char)GetMemory(Address, 1)[0];
}
static BYTE ReadByte(UINT32 Address)
{
return (BYTE)GetMemory(Address, 1)[0];
}
static bool ReadBool(UINT32 Address)
{
return GetMemory(Address, 1)[0] != 0;
}
static INT16 ReadInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(INT16*)read;
}
static INT32 ReadInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(INT32*)read;
}
static INT64 ReadInt64(UINT64 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(INT64*)read;
}
static UINT16 ReadUInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(UINT16*)read;
}
static UINT32 ReadUInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(UINT32*)read;
}
static UINT64 ReadUInt64(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(UINT64*)read;
}
static FLOAT ReadFloat(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(FLOAT*)read;
}
static DOUBLE ReadDouble(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(DOUBLE*)read;
}
static void WriteByte(UINT32 Address, BYTE input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteSByte(UINT32 Address, signed char input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteBool(UINT32 Address, bool input)
{
BYTE bytes[] = { input };
bytes[0] = input ? (BYTE)1 : (BYTE)0;
SetMemory(Address, bytes, 1);
}
static void WriteInt16(UINT32 Address, INT16 input)
{
BYTE bytes[2];
*(INT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteInt32(UINT32 Address, INT32 input)
{
BYTE bytes[4];
*(INT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteInt64(UINT32 Address, INT64 input)
{
BYTE bytes[8];
*(INT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteUInt16(UINT32 Address, UINT16 input)
{
BYTE bytes[2];
*(UINT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteUInt32(UINT32 Address, UINT32 input)
{
BYTE bytes[4];
*(UINT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteUInt64(UINT32 Address, UINT64 input)
{
BYTE bytes[8];
*(UINT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteFloat(UINT32 Address, float input)
{
BYTE bytes[4];
*(float*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteDouble(UINT32 Address, DOUBLE input)
{
BYTE bytes[8];
*(DOUBLE*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteString(UINT32 Address, std::string text)
{
SetMemory(Address, (BYTE*)text.c_str(), text.length() + 1);
}
static bool CompareByteArray(BYTE* a, BYTE* b, INT32 ArrayLength)
{
INT32 CheckArray = 0;
for (INT32 i = 0; i < ArrayLength; i++)
if (a[i] == b[i])
CheckArray++;
return CheckArray == ArrayLength;
}
static std::string ReadString(UINT32 Address, INT32 Length)
{
return (reinterpret_cast<const char*>(GetMemory(Address, Length)));
}


I really hope some ppl will take the time to learn some C++, enjoy! :yes:


If I understood any of this, I would use it lol
06-08-2014, 08:03 PM #4
seb5594
Proud Former Admin
Originally posted by BlackPanther View Post
Thanks man, this will help a lot of people out!


I hope so, if ppl started with C++ and struggle with some things like that then it will definitely help

Originally posted by Citadel View Post
If I understood any of this, I would use it lol


Once you understanded C++ it will be easy as C# Smile

The following user thanked seb5594 for this useful post:

flynhigh09
06-08-2014, 08:03 PM #5
Citadel
Samurai Poster
Originally posted by seb5594 View Post
I hope so, if ppl started with C++ and struggle with some things like that then it will definitely help



Once you understanded C++ it will be easy as C# Smile


Lol I barely understand more than the basics of CS lol
06-08-2014, 09:34 PM #6
Originally posted by seb5594 View Post
Hey NGU Members,

Since no one bothered to make a C++ Tool i thought this would help to get started Smile
This will import the PS3TMAPI DLL (Thanks to Enstone for the method) and you can read/write data (like PS3Lib Extensions).
I want also to thank itsLollo, he helped me to solve some probs :p

    
const WCHAR * dllName = L"ps3tmapi.dll";
HINSTANCE hlib = LoadLibrary(dllName);

typedef int(__cdecl *InitTargetCommsFunction)(void);
typedef int(__cdecl *ConnectFunction)(int, LPWSTR);
typedef int(__cdecl *DisconnectFunction)(int);
typedef int(__cdecl *ProcessListFunction)(int, UINT32*, UINT32*);
typedef int(__cdecl *ProcessAttachFunction)(int, UINT32, UINT32);
typedef int(__cdecl *ProcessContinueFunction) (int, UINT32);
typedef int(__cdecl *ProcessSetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);
typedef int(__cdecl *ProcessGetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);

InitTargetCommsFunction InitTargetComms = (InitTargetCommsFunction)GetProcAddress(hlib, "SNPS3InitTargetComms");
ConnectFunction ProcConnectTarget = (ConnectFunction)GetProcAddress(hlib, "SNPS3Connect");
DisconnectFunction ProcDisconnectTarget = (DisconnectFunction)GetProcAddress(hlib, "SNPS3Disconnect");
ProcessListFunction ProcProcessList = (ProcessListFunction)GetProcAddress(hlib, "SNPS3ProcessList");
ProcessAttachFunction ProcProcessAttach = (ProcessAttachFunction)GetProcAddress(hlib, "SNPS3ProcessAttach");
ProcessContinueFunction ProcProcessContinue = (ProcessContinueFunction)GetProcAddress(hlib, "SNPS3ProcessContinue");
ProcessGetMemoryFunction ProcGetMemory = (ProcessGetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessGetMemory");
ProcessSetMemoryFunction ProcSetMemory = (ProcessSetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessSetMemory");

INT32 Target = 0xFFFFFFFE;
UINT32 puCount[32];
UINT32 ProcessID;

static void ConnectTarget()
{
try
{
InitTargetComms();
ProcConnectTarget(Target, NULL);
MessageBox(0, L"Succesfully conncted to Dev-Kit", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while connecting to Dev-Kit", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void Attach()
{
try
{
ProcProcessList(Target, puCount, &ProcessID);
ProcProcessAttach(Target, 0, ProcessID);
ProcProcessContinue(Target, ProcessID);
MessageBox(0, L"Succesfully attached your game", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while attaching your game", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void SetMemory(UINT32 Address, BYTE *bytes, int sizeOfArray)
{
InitTargetComms();
ProcSetMemory(Target, 0, ProcessID, 0, Address, sizeOfArray, bytes);
}

static BYTE* GetMemory(UINT32 Address, INT32 Length)
{
InitTargetComms();
BYTE* ret = new BYTE[Length];
ProcGetMemory(Target, 0, ProcessID, 0, Address, Length, ret);
return ret;
}

static signed char ReadSByte(UINT32 Address)
{
return (signed char)GetMemory(Address, 1)[0];
}
static BYTE ReadByte(UINT32 Address)
{
return (BYTE)GetMemory(Address, 1)[0];
}
static bool ReadBool(UINT32 Address)
{
return GetMemory(Address, 1)[0] != 0;
}
static INT16 ReadInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(INT16*)read;
}
static INT32 ReadInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(INT32*)read;
}
static INT64 ReadInt64(UINT64 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(INT64*)read;
}
static UINT16 ReadUInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(UINT16*)read;
}
static UINT32 ReadUInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(UINT32*)read;
}
static UINT64 ReadUInt64(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(UINT64*)read;
}
static FLOAT ReadFloat(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(FLOAT*)read;
}
static DOUBLE ReadDouble(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(DOUBLE*)read;
}
static void WriteByte(UINT32 Address, BYTE input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteSByte(UINT32 Address, signed char input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteBool(UINT32 Address, bool input)
{
BYTE bytes[] = { input };
bytes[0] = input ? (BYTE)1 : (BYTE)0;
SetMemory(Address, bytes, 1);
}
static void WriteInt16(UINT32 Address, INT16 input)
{
BYTE bytes[2];
*(INT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteInt32(UINT32 Address, INT32 input)
{
BYTE bytes[4];
*(INT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteInt64(UINT32 Address, INT64 input)
{
BYTE bytes[8];
*(INT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteUInt16(UINT32 Address, UINT16 input)
{
BYTE bytes[2];
*(UINT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteUInt32(UINT32 Address, UINT32 input)
{
BYTE bytes[4];
*(UINT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteUInt64(UINT32 Address, UINT64 input)
{
BYTE bytes[8];
*(UINT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteFloat(UINT32 Address, float input)
{
BYTE bytes[4];
*(float*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteDouble(UINT32 Address, DOUBLE input)
{
BYTE bytes[8];
*(DOUBLE*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteString(UINT32 Address, std::string text)
{
SetMemory(Address, (BYTE*)text.c_str(), text.length() + 1);
}
static bool CompareByteArray(BYTE* a, BYTE* b, INT32 ArrayLength)
{
INT32 CheckArray = 0;
for (INT32 i = 0; i < ArrayLength; i++)
if (a[i] == b[i])
CheckArray++;
return CheckArray == ArrayLength;
}
static std::string ReadString(UINT32 Address, INT32 Length)
{
return (reinterpret_cast<const char*>(GetMemory(Address, Length)));
}


I really hope some ppl will take the time to learn some C++, enjoy! :yes:


dankz, i made one myself a month back but this is alot better than mine lol
06-09-2014, 12:33 PM #7
A Friend
League Champion
Originally posted by seb5594 View Post
Hey NGU Members,

Since no one bothered to make a C++ Tool i thought this would help to get started Smile
This will import the PS3TMAPI DLL (Thanks to Enstone for the method) and you can read/write data (like PS3Lib Extensions).
I want also to thank itsLollo, he helped me to solve some probs :p

    
const WCHAR * dllName = L"ps3tmapi.dll";
HINSTANCE hlib = LoadLibrary(dllName);

typedef int(__cdecl *InitTargetCommsFunction)(void);
typedef int(__cdecl *ConnectFunction)(int, LPWSTR);
typedef int(__cdecl *DisconnectFunction)(int);
typedef int(__cdecl *ProcessListFunction)(int, UINT32*, UINT32*);
typedef int(__cdecl *ProcessAttachFunction)(int, UINT32, UINT32);
typedef int(__cdecl *ProcessContinueFunction) (int, UINT32);
typedef int(__cdecl *ProcessSetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);
typedef int(__cdecl *ProcessGetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);

InitTargetCommsFunction InitTargetComms = (InitTargetCommsFunction)GetProcAddress(hlib, "SNPS3InitTargetComms");
ConnectFunction ProcConnectTarget = (ConnectFunction)GetProcAddress(hlib, "SNPS3Connect");
DisconnectFunction ProcDisconnectTarget = (DisconnectFunction)GetProcAddress(hlib, "SNPS3Disconnect");
ProcessListFunction ProcProcessList = (ProcessListFunction)GetProcAddress(hlib, "SNPS3ProcessList");
ProcessAttachFunction ProcProcessAttach = (ProcessAttachFunction)GetProcAddress(hlib, "SNPS3ProcessAttach");
ProcessContinueFunction ProcProcessContinue = (ProcessContinueFunction)GetProcAddress(hlib, "SNPS3ProcessContinue");
ProcessGetMemoryFunction ProcGetMemory = (ProcessGetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessGetMemory");
ProcessSetMemoryFunction ProcSetMemory = (ProcessSetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessSetMemory");

INT32 Target = 0xFFFFFFFE;
UINT32 puCount[32];
UINT32 ProcessID;

static void ConnectTarget()
{
try
{
InitTargetComms();
ProcConnectTarget(Target, NULL);
MessageBox(0, L"Succesfully conncted to Dev-Kit", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while connecting to Dev-Kit", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void Attach()
{
try
{
ProcProcessList(Target, puCount, &ProcessID);
ProcProcessAttach(Target, 0, ProcessID);
ProcProcessContinue(Target, ProcessID);
MessageBox(0, L"Succesfully attached your game", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while attaching your game", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void SetMemory(UINT32 Address, BYTE *bytes, int sizeOfArray)
{
InitTargetComms();
ProcSetMemory(Target, 0, ProcessID, 0, Address, sizeOfArray, bytes);
}

static BYTE* GetMemory(UINT32 Address, INT32 Length)
{
InitTargetComms();
BYTE* ret = new BYTE[Length];
ProcGetMemory(Target, 0, ProcessID, 0, Address, Length, ret);
return ret;
}

static signed char ReadSByte(UINT32 Address)
{
return (signed char)GetMemory(Address, 1)[0];
}
static BYTE ReadByte(UINT32 Address)
{
return (BYTE)GetMemory(Address, 1)[0];
}
static bool ReadBool(UINT32 Address)
{
return GetMemory(Address, 1)[0] != 0;
}
static INT16 ReadInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(INT16*)read;
}
static INT32 ReadInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(INT32*)read;
}
static INT64 ReadInt64(UINT64 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(INT64*)read;
}
static UINT16 ReadUInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(UINT16*)read;
}
static UINT32 ReadUInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(UINT32*)read;
}
static UINT64 ReadUInt64(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(UINT64*)read;
}
static FLOAT ReadFloat(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(FLOAT*)read;
}
static DOUBLE ReadDouble(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(DOUBLE*)read;
}
static void WriteByte(UINT32 Address, BYTE input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteSByte(UINT32 Address, signed char input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteBool(UINT32 Address, bool input)
{
BYTE bytes[] = { input };
bytes[0] = input ? (BYTE)1 : (BYTE)0;
SetMemory(Address, bytes, 1);
}
static void WriteInt16(UINT32 Address, INT16 input)
{
BYTE bytes[2];
*(INT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteInt32(UINT32 Address, INT32 input)
{
BYTE bytes[4];
*(INT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteInt64(UINT32 Address, INT64 input)
{
BYTE bytes[8];
*(INT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteUInt16(UINT32 Address, UINT16 input)
{
BYTE bytes[2];
*(UINT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteUInt32(UINT32 Address, UINT32 input)
{
BYTE bytes[4];
*(UINT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteUInt64(UINT32 Address, UINT64 input)
{
BYTE bytes[8];
*(UINT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteFloat(UINT32 Address, float input)
{
BYTE bytes[4];
*(float*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteDouble(UINT32 Address, DOUBLE input)
{
BYTE bytes[8];
*(DOUBLE*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteString(UINT32 Address, std::string text)
{
SetMemory(Address, (BYTE*)text.c_str(), text.length() + 1);
}
static bool CompareByteArray(BYTE* a, BYTE* b, INT32 ArrayLength)
{
INT32 CheckArray = 0;
for (INT32 i = 0; i < ArrayLength; i++)
if (a[i] == b[i])
CheckArray++;
return CheckArray == ArrayLength;
}
static std::string ReadString(UINT32 Address, INT32 Length)
{
return (reinterpret_cast<const char*>(GetMemory(Address, Length)));
}


I really hope some ppl will take the time to learn some C++, enjoy! :yes:

I always wanted to do C++ because my mom does and it's different from everyone, but should I learn C# first then translate it to C++ so it's easier for me? Also if I do learn I'll learn everything not just the stuff for modding
06-10-2014, 06:28 PM #8
Azus
Little One
Originally posted by seb5594 View Post
Hey NGU Members,

Since no one bothered to make a C++ Tool i thought this would help to get started Smile
This will import the PS3TMAPI DLL (Thanks to Enstone for the method) and you can read/write data (like PS3Lib Extensions).
I want also to thank itsLollo, he helped me to solve some probs :p

    
const WCHAR * dllName = L"ps3tmapi.dll";
HINSTANCE hlib = LoadLibrary(dllName);

typedef int(__cdecl *InitTargetCommsFunction)(void);
typedef int(__cdecl *ConnectFunction)(int, LPWSTR);
typedef int(__cdecl *DisconnectFunction)(int);
typedef int(__cdecl *ProcessListFunction)(int, UINT32*, UINT32*);
typedef int(__cdecl *ProcessAttachFunction)(int, UINT32, UINT32);
typedef int(__cdecl *ProcessContinueFunction) (int, UINT32);
typedef int(__cdecl *ProcessSetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);
typedef int(__cdecl *ProcessGetMemoryFunction)(int, UINT32, UINT32, UINT64, UINT64, int, BYTE*);

InitTargetCommsFunction InitTargetComms = (InitTargetCommsFunction)GetProcAddress(hlib, "SNPS3InitTargetComms");
ConnectFunction ProcConnectTarget = (ConnectFunction)GetProcAddress(hlib, "SNPS3Connect");
DisconnectFunction ProcDisconnectTarget = (DisconnectFunction)GetProcAddress(hlib, "SNPS3Disconnect");
ProcessListFunction ProcProcessList = (ProcessListFunction)GetProcAddress(hlib, "SNPS3ProcessList");
ProcessAttachFunction ProcProcessAttach = (ProcessAttachFunction)GetProcAddress(hlib, "SNPS3ProcessAttach");
ProcessContinueFunction ProcProcessContinue = (ProcessContinueFunction)GetProcAddress(hlib, "SNPS3ProcessContinue");
ProcessGetMemoryFunction ProcGetMemory = (ProcessGetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessGetMemory");
ProcessSetMemoryFunction ProcSetMemory = (ProcessSetMemoryFunction)GetProcAddress(hlib, "SNPS3ProcessSetMemory");

INT32 Target = 0xFFFFFFFE;
UINT32 puCount[32];
UINT32 ProcessID;

static void ConnectTarget()
{
try
{
InitTargetComms();
ProcConnectTarget(Target, NULL);
MessageBox(0, L"Succesfully conncted to Dev-Kit", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while connecting to Dev-Kit", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void Attach()
{
try
{
ProcProcessList(Target, puCount, &ProcessID);
ProcProcessAttach(Target, 0, ProcessID);
ProcProcessContinue(Target, ProcessID);
MessageBox(0, L"Succesfully attached your game", L"Success", MB_OK || MB_ICONINFORMATION);
}
catch (...)
{
MessageBox(0, L"Error while attaching your game", L"Error", MB_OK || MB_ICONSTOP);
}
}

static void SetMemory(UINT32 Address, BYTE *bytes, int sizeOfArray)
{
InitTargetComms();
ProcSetMemory(Target, 0, ProcessID, 0, Address, sizeOfArray, bytes);
}

static BYTE* GetMemory(UINT32 Address, INT32 Length)
{
InitTargetComms();
BYTE* ret = new BYTE[Length];
ProcGetMemory(Target, 0, ProcessID, 0, Address, Length, ret);
return ret;
}

static signed char ReadSByte(UINT32 Address)
{
return (signed char)GetMemory(Address, 1)[0];
}
static BYTE ReadByte(UINT32 Address)
{
return (BYTE)GetMemory(Address, 1)[0];
}
static bool ReadBool(UINT32 Address)
{
return GetMemory(Address, 1)[0] != 0;
}
static INT16 ReadInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(INT16*)read;
}
static INT32 ReadInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(INT32*)read;
}
static INT64 ReadInt64(UINT64 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(INT64*)read;
}
static UINT16 ReadUInt16(UINT32 Address)
{
BYTE* read = GetMemory(Address, 2);
std::reverse(read, read + 2);
return *(UINT16*)read;
}
static UINT32 ReadUInt32(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(UINT32*)read;
}
static UINT64 ReadUInt64(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(UINT64*)read;
}
static FLOAT ReadFloat(UINT32 Address)
{
BYTE* read = GetMemory(Address, 4);
std::reverse(read, read + 4);
return *(FLOAT*)read;
}
static DOUBLE ReadDouble(UINT32 Address)
{
BYTE* read = GetMemory(Address, Cool Man (aka Tustin);
std::reverse(read, read + Cool Man (aka Tustin);
return *(DOUBLE*)read;
}
static void WriteByte(UINT32 Address, BYTE input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteSByte(UINT32 Address, signed char input)
{
BYTE bytes[] = { input };
SetMemory(Address, bytes, 1);
}
static void WriteBool(UINT32 Address, bool input)
{
BYTE bytes[] = { input };
bytes[0] = input ? (BYTE)1 : (BYTE)0;
SetMemory(Address, bytes, 1);
}
static void WriteInt16(UINT32 Address, INT16 input)
{
BYTE bytes[2];
*(INT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteInt32(UINT32 Address, INT32 input)
{
BYTE bytes[4];
*(INT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteInt64(UINT32 Address, INT64 input)
{
BYTE bytes[8];
*(INT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteUInt16(UINT32 Address, UINT16 input)
{
BYTE bytes[2];
*(UINT16*)bytes = input;
std::reverse(bytes, bytes + 2);
SetMemory(Address, bytes, 2);
}
static void WriteUInt32(UINT32 Address, UINT32 input)
{
BYTE bytes[4];
*(UINT32*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteUInt64(UINT32 Address, UINT64 input)
{
BYTE bytes[8];
*(UINT64*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteFloat(UINT32 Address, float input)
{
BYTE bytes[4];
*(float*)bytes = input;
std::reverse(bytes, bytes + 4);
SetMemory(Address, bytes, 4);
}
static void WriteDouble(UINT32 Address, DOUBLE input)
{
BYTE bytes[8];
*(DOUBLE*)bytes = input;
std::reverse(bytes, bytes + Cool Man (aka Tustin);
SetMemory(Address, bytes, Cool Man (aka Tustin);
}
static void WriteString(UINT32 Address, std::string text)
{
SetMemory(Address, (BYTE*)text.c_str(), text.length() + 1);
}
static bool CompareByteArray(BYTE* a, BYTE* b, INT32 ArrayLength)
{
INT32 CheckArray = 0;
for (INT32 i = 0; i < ArrayLength; i++)
if (a[i] == b[i])
CheckArray++;
return CheckArray == ArrayLength;
}
static std::string ReadString(UINT32 Address, INT32 Length)
{
return (reinterpret_cast<const char*>(GetMemory(Address, Length)));
}


I really hope some ppl will take the time to learn some C++, enjoy! :yes:


This is about to come in handy tears
06-15-2014, 08:58 PM #9
I don't know why you casted the returned object as a constant char when you're using std::string, but okay lol. I also don't know why you have everything as a static member...neither do I know why you used typedef to declare you definitions, you could have simple have done something like this;

    
int (*InitTargetCommsFunction)() = (int(__cdecl*)())GetProcAddress(LoadLibary(L"ps3tmapi.dll"), "SNPS3InitTargetComms");


Much easier, more user friendly and also takes less blocks up.

but for your read string, I don't get why you couldn't of just done this?

    
char*readString(int address, int length)
{
return (char*)GetMemory(address, length);
}


I would have understood what you did if you was casting it as std::string, but you're not XD

But over all it is good to see c++ in the ps3 scene :yes:

The following 3 users say thank you to Bitwise for this useful post:

ErasedDev, John, SC58
06-15-2014, 09:45 PM #10
Originally posted by Bitwise View Post
I don't know why you casted the returned object as a constant char when you're using std::string, but okay lol. I also don't know why you have everything as a static member...neither do I know why you used typedef to declare you definitions, you could have simple have done something like this;

    
int (*InitTargetCommsFunction)() = (int(__cdecl*)())GetProcAddress(LoadLibary(L"ps3tmapi.dll"), "SNPS3InitTargetComms");


Much easier, more user friendly and also takes less blocks up.

but for your read string, I don't get why you couldn't of just done this?

    
char*readString(int address, int length)
{
return (char*)GetMemory(address, length);
}


I would have understood what you did if you was casting it as std::string, but you're not XD

But over all it is good to see c++ in the ps3 scene :yes:


Once again, stop judging the ps3 scene just by knowing ngu. 90% of the ps3 developers code either in C or C++. What programming language do you think homebrews are coded with? The reason C# is used a lot on ngu is because it's better for RTM tools and loading plugins into the game process is not as easy as on Xbox.

The following 3 users say thank you to therifboy for this useful post:

B777x, iMP3Rz

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo