Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PS3.h
- //Updated and fixed code: 11-18-14
- /*Credits: Me - BaSs_HaXoR, for coding this library, BadLuckBrian for his conversion and I/O methods, Milky4444 for helping me understand ProcessID (PID) and get it working.
- RELATED LINKS:
- http://www.nextgenupdate.com/forums/ps3-cheats-customization/709164-tut-how-use-ps3tmapi-dll-c-win32-clr-post5629749.html
- http://www.mediafire.com/view/l7irme6pkrhk1i1/SNPS3.h
- http://www.se7ensins.com/forums/threads/release-development-application-ps3tmapi_net-dll-c-c-vb-net.883290/?jdfwkey=0f1qw1
- http://www.nextgenupdate.com/forums/ps3-cheats-customization/634548-release-development-application-ps3tmapi_net-dll-c-c-vb-net-10.html
- http://pastebin.com/9LnzYZtS
- http://pastebin.com/8wq3ywnh //THANKS TO BLB
- */
- /*
- /$$$$$$ /$$ /$$ /$$$$$$$
- /$$__ $$ | $$ | $$ | $$__ $$
- | $$ \__/ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ | $$ \ $$ /$$ /$$ /$$
- | $$ /$$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ | $$$$$$$ | $$ | $$|__/
- | $$ | $$ \ $$| $$ | $$| $$$$$$$$| $$ | $$ | $$__ $$| $$ | $$
- | $$ $$| $$ | $$| $$ | $$| $$_____/| $$ | $$ | $$ \ $$| $$ | $$ /$$
- | $$$$$$/| $$$$$$/| $$$$$$$| $$$$$$$| $$$$$$$ | $$$$$$$/| $$$$$$$|__/
- \______/ \______/ \_______/ \_______/ \_______/ |_______/ \____ $$
- /$$ | $$
- | $$$$$$/
- \______/
- Yeaboii BaSs_HaXoR
- Yb dP 8 w .d88b. w w dP"Yb
- Yb db dP 8d8b. .d88 w8ww YPwww. .d88b .d8b 8 8 8d8b w w8ww Yb dP " d8
- YbdPYbdP 8P Y8 8 8 8 d8 8.dP' 8 8b d8 8P 8 8 YbdP dP
- YP YP 8 8 `Y88 Y8P `Y88P' `Y88P `Y8P `Y8P8 8 8 Y8P dP w
- dP x
- */
- #pragma once
- #include <iostream>
- #include <Windows.h>
- #include "C:\Program Files (x86)\SN Systems\PS3\sdk\include\ps3tmapi.h"
- /*
- IN YOUR PROJECT SETTINGS! ADD THESE:
- C/C++/Additional Include Directories/-> C:\Program Files (x86)\SN Systems\PS3\sdk\include\
- Linker/Input/Additional Dependencies/-> C:\Program Files (x86)\SN Systems\PS3\sdk\lib\PS3TMAPI.lib
- Linker/Input/Additional Dependencies/-> C:\Program Files (x86)\SN Systems\PS3\sdk\lib\PS3TMAPIx64.lib
- */
- int target=0xfffffffe; //target default
- unsigned int pid; //This is a decimal value of your ProcessID, Convert to HEX if to see (Thanks to Milky4444 for clearing that up)
- using namespace System;
- namespace PS3 {
- public ref class PS3TMAPI
- {
- public: void Connect()
- {
- SNPS3InitTargetComms();
- SNPS3Connect(target, NULL);
- }
- public: void Attach()
- {
- SNPS3InitTargetComms();
- SNPS3Connect(target,NULL);
- unsigned int pCount[32];
- SNPS3InitTargetComms();
- SNPS3ProcessList(target,pCount,&pid);
- SNPS3ProcessAttach(target,0,pid);
- SNPS3ProcessContinue(target,pid);
- }
- public: void writestring(UINT32 Address, std::string text)
- {
- SNPS3InitTargetComms();
- SetMemory(Address, (BYTE*)text.c_str(), text.length() + 1);
- }
- public: void SetMemory(UINT32 Address, BYTE *bytes, int sizeOfArray)
- {
- SNPS3InitTargetComms();
- SNPS3ProcessSetMemory(target, 0, pid, 0, Address, sizeOfArray, bytes);
- }
- public: BYTE* GetMemory(UINT32 Address, INT32 Length)
- {
- SNPS3InitTargetComms();
- BYTE* ret = new BYTE[Length];
- SNPS3ProcessGetMemory(target, 0, pid, 0, Address, Length, ret);
- return ret;
- }
- public: void writeByte(UINT32 Address, BYTE input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[] = { input };
- SetMemory(Address, bytes, 1);
- }
- public: void writeBool(UINT32 Address, bool input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[] = { input };
- bytes[0] = input ? (BYTE)1 : (BYTE)0;
- SetMemory(Address, bytes, 1);
- }
- public: BYTE readByte(UINT32 Address)
- {
- SNPS3InitTargetComms();
- return (BYTE)GetMemory(Address, 1)[0];
- }
- public: char* ReadString(UINT32 Address)
- {
- SNPS3InitTargetComms();
- int i = 0;
- while (PS3::PS3TMAPI::readByte(Address + i) != 0x00){ i++; }
- i++;//null terminate
- return (char*)PS3::PS3TMAPI::GetMemory(Address, i);
- }
- public: bool readBool(UINT32 Address)
- {
- SNPS3InitTargetComms();
- return GetMemory(Address, 1)[0] != 0;
- }
- public: INT16 readShort(UINT32 Address)
- {
- SNPS3InitTargetComms();
- BYTE* read = GetMemory(Address, 2);
- std::reverse(read, read + 2);
- return *(INT16*)read;
- }
- public: INT32 readInt(UINT32 Address)
- {
- SNPS3InitTargetComms();
- BYTE* read = GetMemory(Address, 4);
- std::reverse(read, read + 4);
- return *(INT32*)read;
- }
- public: INT64 readInt64(UINT64 Address)
- {
- SNPS3InitTargetComms();
- BYTE* read = GetMemory(Address, 8);
- std::reverse(read, read + 8);
- return *(INT64*)read;
- }
- public: UINT16 readUShort(UINT32 Address)
- {
- SNPS3InitTargetComms();
- BYTE* read = GetMemory(Address, 2);
- std::reverse(read, read + 2);
- return *(UINT16*)read;
- }
- public: UINT32 readUInt(UINT32 Address)
- {
- SNPS3InitTargetComms();
- BYTE* read = GetMemory(Address, 4);
- std::reverse(read, read + 4);
- return *(UINT32*)read;
- }
- public: UINT64 readUInt64(UINT32 Address)
- {
- SNPS3InitTargetComms();
- BYTE* read = GetMemory(Address, 8);
- std::reverse(read, read + 8);
- return *(UINT64*)read;
- }
- public: FLOAT readFloat(UINT32 Address)
- {
- SNPS3InitTargetComms();
- BYTE* read = GetMemory(Address, 4);
- std::reverse(read, read + 4);
- return *(FLOAT*)read;
- }
- public: DOUBLE readDouble(UINT32 Address)
- {
- SNPS3InitTargetComms();
- BYTE* read = GetMemory(Address, 8);
- std::reverse(read, read + 8);
- return *(DOUBLE*)read;
- }
- public: bool cmpArray(BYTE* a, BYTE* b, INT32 ArrayLength)
- {
- SNPS3InitTargetComms();
- INT32 CheckArray = 0;
- for (INT32 i = 0; i < ArrayLength; i++)
- if (a[i] == b[i])
- CheckArray++;
- return CheckArray == ArrayLength;
- }
- public: void writeShort(UINT32 Address, INT16 input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[2];
- *(INT16*)bytes = input;
- std::reverse(bytes, bytes + 2);
- SetMemory(Address, bytes, 2);
- }
- public: void writeInt(UINT32 Address, INT32 input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[4];
- *(INT32*)bytes = input;
- std::reverse(bytes, bytes + 4);
- SetMemory(Address, bytes, 4);
- }
- public: void writeInt64(UINT32 Address, INT64 input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[8];
- *(INT64*)bytes = input;
- std::reverse(bytes, bytes + 8);
- SetMemory(Address, bytes, 8);
- }
- public: void writeUShort(UINT32 Address, UINT16 input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[2];
- *(UINT16*)bytes = input;
- std::reverse(bytes, bytes + 2);
- SetMemory(Address, bytes, 2);
- }
- public: void writeUInt(UINT32 Address, UINT32 input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[4];
- *(UINT32*)bytes = input;
- std::reverse(bytes, bytes + 4);
- SetMemory(Address, bytes, 4);
- }
- public: void writeUInt64(UINT32 Address, UINT64 input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[8];
- *(UINT64*)bytes = input;
- std::reverse(bytes, bytes + 8);
- SetMemory(Address, bytes, 8);
- }
- public: void writeFloat(UINT32 Address, float input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[4];
- *(float*)bytes = input;
- std::reverse(bytes, bytes + 4);
- SetMemory(Address, bytes, 4);
- }
- public: void writeDouble(UINT32 Address, DOUBLE input)
- {
- SNPS3InitTargetComms();
- BYTE bytes[8];
- *(DOUBLE*)bytes = input;
- std::reverse(bytes, bytes + 8);
- SetMemory(Address, bytes, 8);
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement