Post: [RELEASE] Development Application PS3TMAPI_NET.dll [C#/C++/VB.Net]
02-23-2013, 12:47 AM #1
(adsbygoogle = window.adsbygoogle || []).push({});


You must login or register to view this content.

Thread Updated ! Script VB.Net is now available.
NEW UPDATE : PS3Lib v3 RELEASED !

DOWNLOAD PS3Lib v4 Here:
You must login or register to view this content.


As you've seen the title, this thread will explain to you how to link your own application C#/C++/VB.Net to your PS3.
With this , you can send to all clients in game your mods very easily, and start to develop your own application Smile

I have worked for 2 weeks on a project for NGU Elite with Enzo-f a good security for the project , but I saw that some tools got leaked for public so this project is dead. It's now the time to release this.

First i want give a thanks to :

- BuC-ShoTz for his help for InitTargetComms() & The Out ProcessID Method Smile.
- FM|T Enstone for have contributed to the thread with his C++ Part Smile.

Don't forget to give these guys in credit and also me for my work on it , for have created these functions and the full tutorial.


How to use this method ?:

- it's with the Target Manager API. Everything is in a dll , the ps3tmapi_net.dll is in the folder C:\Program Files (x86)\SN Systems\PS3\bin , you need to find it , i'll not post this dll here.

First you need to add as reference the dll ps3tmapi_net.dll in your compiler , for me Visual Studio.


// C# Part :

Connection :
    
PS3TMAPI.InitTargetComms();
PS3TMAPI.Connect(0, null);


With these codes , the dll is now initialized with your application , it is ready to set others functions.


Get and Attach Process :
    
PS3TMAPI.GetProcessList(0, out processIDs);
ulong uProcess = processIDs[0];
ProcessID = Convert.ToUInt32(uProcess);
PS3TMAPI.ProcessAttach(0, PS3TMAPI.UnitType.PPU, ProcessID);
PS3TMAPI.ProcessContinue(0, ProcessID);


With these codes , your app will find and attach automatically the ProcessID.


Set Memory :
    
PS3TMAPI.ProcessSetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, Address, bytes);


This function will write your bytes in the memory. Replace "Address" and "bytes" with your own values. Example :

    
byte[] iMCSx = new byte[] { 0x69, 0x4D, 0x43, 0x53, 0x78, 0x00 };
PS3TMAPI.ProcessSetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, 0x01BBBC2C, iMCSx);



Get Memory :
    
byte[] iMCSx = new byte[0x20];
PS3TMAPI.ProcessGetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, Address, ref iMCSx);


This function will get all bytes starting at Address , and everything will be in the iMCSx's byte. 0x20 it's the length.


// VB.Net Part :

it's the same as the C# language , you need to add the ps3tmapi_net.dll in your application. You can look and use my functions converted all work perfectly :

Connection :
    
PS3TMAPI.InitTargetComms()
PS3TMAPI.Connect(0, vbNullString)



Get & Attach the process :
    
Try
PS3TMAPI.GetProcessList(0, processIDs)
Dim uProcess As ULong = processIDs(0)
ProcessID = Convert.ToUInt32(uProcess)
PS3TMAPI.ProcessAttach(0, PS3TMAPI.UnitType.PPU, ProcessID)
PS3TMAPI.ProcessContinue(0, ProcessID)
Dim Info As String = "The Process 0x" & ProcessID.ToString("X8") & " Has Been Attached !"
MessageBox.Show(Info, "Process Ready!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
Catch Ex As Exception
MessageBox.Show(Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
End Try



In the header of your form , declare these line uint & ulong for use the script Attach Process :


    
Private processIDs As UInteger()
Private ProcessID As UInteger



Set Memory :
    
Dim Test As Byte() = New Byte() {&H5} // it's 0x05 in byte C#
PS3TMAPI.ProcessSetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, Address (Example &H00FCA280, iMCSx)



All offset need to be converted , example 0x3980 is now &H3980 :
    
Private Function MW3ClientState(clientNum As UInteger) As UInteger
Return (&H110A280 + (clientNum * &H3980))
End Function



Example for use my PS3Lib's Script in Visual Basic :
    
PS3.SetMemory(Address, Byte)


I'm not a developer Visual Basic but i know the base and everything work. I gave just these base for Connect / Attach / SetMem , it's now at you to develop your own tool / function.


// C++ part :

Step 1:

If you're a c/c++ developper, first you will need to load ps3tmapi.dll in your code with :

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


ps3tmapi.dll must in the same directory as your exe or in your PATH.

Step 2:

Then you should use some typedef to simplify the functions' use:

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


You need all these functions to start any memory editing. Don't forget to create structure for SNPS3PROCESSINFO*.

Step 3:

Now it's important to locate SN's functions in the dll, we will use the famous "GetProcAddress" :
    
InitTargetCommsFunction InitTargetComms = (InitTargetCommsFunction) GetProcAddress(hlib, "SNPS3InitTargetComms");
ConnectFunction Connect = (ConnectFunction) GetProcAddress(hlib, "SNPS3Connect");
DisconnectFunction Disconnect = (DisconnectFunction) GetProcAddress(hlib, "SNPS3Disconnect");
ProcessListFunction ProcessList = (ProcessListFunction) GetProcAddress(hlib, "SNPS3ProcessList");
ProcessAttachFunction ProcessAttach = (ProcessAttachFunction) GetProcAddress(hlib, "SNPS3ProcessAttach");
ProcessContinueFunction ProcessContinue = (ProcessContinueFunction) GetProcAddress(hlib,"SNPS3ProcessContinue");
ProcessInfoFunction ProcessInfo = (ProcessInfoFunction) GetProcAddress(hlib, "SNPS3ProcessInfo");
ProcessGetMemoryFunction GetMemory = (ProcessGetMemoryFunction) GetProcAddress(hlib, "SNPS3ProcessGetMemory");
ProcessSetMemoryFunction SetMemory = (ProcessSetMemoryFunction) GetProcAddress(hlib, "SNPS3ProcessSetMemory");


Step 4:

You are now ready to use SN's functions in your program.

Start a connection with your ps3:
    
//Connection////////////////////////////
int target=0xfffffffe; //target default
InitTargetComms();
Connect(target,NULL);


Attach process to your program:
    
//Attach/////////////////////////////////
ProcessList(target,&puCount,puProcessID);
ProcProcessAttach(target, 0,*puProcessID);
ProcProcessContinue(target, *puProcessID);
ProcProcessInfo(target,*puProcessID,&puBufferSize,pProcessInfo);


Get memory and set memory on your ps3:
    
//Get/SetMemory/////////////////////////
GetMemory(target,0,*puProcessID,(pProcessInfo->ThreadIDs)[0],uAddress,nCount,pBuffer);
SetMemory(target,0,*puProcessID,(pProcessInfo->ThreadIDs)[0],uAddress,nCount,pBuffer);



Tips:
you have to call InitTargetComms() in all your threads, even if your ps3 is connected.
you can create an other GetMemory/SetMemory function to reduce the number of args.
all these functions return an int, which tells you if it succeeds or not, a success will be a positive value, a fail a negative one.


Lastest things for Developer C# & Visual Basic :

- I have coded a simple class for write easily these functions in your application.
- Download here (Copy/Paste Manually) : You must login or register to view this content.
- Add as Reference this and add it in your form like : using PS3Lib;
- Like this you can use functions quickly , exemple PS3.SetMemory(Adress, Bytes);

Source :

    
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


// Copyright © iMCSProduction 2013.
// Thanks to BuC-ShoTz to have contributed to this.
// Visit www.NextGenUpdate.com if you're English.
// Visit www.FrenchModdingTeam.com if you're French.
// Follow me www.Twitter.com/iMCSx - www.Youtube.com/iMCSx


namespace PS3Lib
{
public class PS3
{
public static uint ProcessID;
public static uint[] processIDs;
public static string snresult;
private static string usage;
public static string Info;
public static PS3TMAPI.ConnectStatus connectStatus;
public static string Status;
public static string MemStatus;


public static void ConnectDebug()
{
PS3TMAPI.InitTargetComms();
PS3TMAPI.Connect(0, null);
}


public static void GetStatus()
{
Status = Convert.ToString(PS3TMAPI.GetConnectStatus(0, out connectStatus, out usage));
}


public static void ProcessAttach()
{
PS3TMAPI.GetProcessList(0, out processIDs);
ulong uProcess = processIDs[0];
ProcessID = Convert.ToUInt32(uProcess);
PS3TMAPI.ProcessAttach(0, PS3TMAPI.UnitType.PPU, ProcessID);
PS3TMAPI.ProcessContinue(0, ProcessID);
Info = "The Process 0x" + ProcessID.ToString("X8") + " Has Been Attached !";
}
public static void SetMemory(uint Address, byte[] Bytes)
{
PS3TMAPI.ProcessSetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, Address, Bytes);
}
public static void GetMemory(uint Address, byte[] Bytes)
{
PS3TMAPI.ProcessGetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, Address, ref Bytes);
}
}
}





Have fun guys ! Smile
(adsbygoogle = window.adsbygoogle || []).push({});

The following 73 users say thank you to iMCSx for this useful post:

{H} | Exception, Nana, BadChoicesZ, basshead4ever, BuC-ShoTz, Bucko, cali123, CentralModz819, Cesei, deneo24, Chen Madhala, Chxii, CodJumper:, Sabotage, FAKA_ELITE, Flamby, FM|T Enstone, FM|T xDevOpS, FM|T xR3PMz, FM|T ZoRo, forcer911, Frank Ryan, Gay For Satan, Gendjisan, HaXingInc, I'm Rudi, i6oz, ibombo, iNDMx, ResistTheJamsha, jannu22, joni_djESP, KCxFTW, KoS_Riitalo, M-alShammary, Mad Scientist, Mango_Knife, Maty360414, MW2TopTenWORLD, Newelly, Norway-_-1999, Vince, primetime43, Pseudo_Soldier, RouletteBoi, ICS Vortex, SC58, Sirprizer, Skunk Modz, SnaY, SnD_Boosters, SyGnUs, T_m_b07, Terrorize 420, therifboy, TreyarchTragedy, Turk_Warrior, viralhysteria, VX_AG3NT, WeJailbreakYou, worrorfight, Fatality, xHostModer, xMonkeyBoyX, xPreeks, Xx-GIPPI-xX, zGooNzLobbies, Ziad1997, zMarcusHD

The following user groaned iMCSx for this awful post:

xTc
03-01-2013, 02:13 PM #38
BadChoicesZ
I defeated!
Originally posted by FM
What do you want exactly ?

You want get these bytes in your textBox ? Like "00AABBCC" ?


yes, i wanna know how to get the returned value of getmemory(offset, byte);
like how do i store it in a variable n such ??
03-01-2013, 09:50 PM #39
Originally posted by StubnOne View Post
yes, i wanna know how to get the returned value of getmemory(offset, byte);
like how do i store it in a variable n such ??


Try this :

    

// Get Bytes
byte[] MyMemOrigin = new byte[0x10];
PS3.GetMemory(Address, MyMemOrigin);

// Convert To Uint32
uint MyMemUint = checked(BitConverter.ToUInt32(MyMemOrigin, 0));


// Write The Result In String
iMCSxMem.Text = String.Format("{0:x8}", MyMemUint);



Work fine.

The following user thanked iMCSx for this useful post:

BadChoicesZ
03-03-2013, 09:51 PM #40
ICS Vortex
Between Light and Lies
Originally posted by FM
Try this :

    

// Get Bytes
byte[] MyMemOrigin = new byte[0x10];
PS3.GetMemory(Address, MyMemOrigin);

// Convert To Uint32
uint MyMemUint = checked(BitConverter.ToUInt32(MyMemOrigin, 0));


// Write The Result In String
iMCSxMem.Text = String.Format("{0:x8}", MyMemUint);



Work fine.


Thanks for you're tutorial, but I'm having a few problems.
I basically started coding in VB a week ago. I'm making of course, a RTE tool for all CODs.
My problem(s) are:
Whenever I try to connect to my PS3, I get an unresponsive program which begins to respond after a while, but does not connect properly.
This is the code that I am using for it:
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
PS3TMAPI.InitTargetComms()
PS3TMAPI.Connect(0, TextBox1.Text)
End Sub
//TextBox1.Text = my IP Address box

Also, whenever I try to attach a process, I get "Object reference not set to an instance of an object". I assume this could be with the connection problem, since I can't get my program to connect at all, but it's worth throwing out there to see if I can get any help.
So, do you have any idea of what I'm doing wrong?
Thanks!

Here's a tiny picture of it if you are having trouble "visualizing" what I mean by a few things. You must login or register to view this content.
03-04-2013, 09:23 AM #41
Originally posted by ICS
Thanks for you're tutorial, but I'm having a few problems.
I basically started coding in VB a week ago. I'm making of course, a RTE tool for all CODs.
My problem(s) are:
Whenever I try to connect to my PS3, I get an unresponsive program which begins to respond after a while, but does not connect properly.
This is the code that I am using for it:
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
PS3TMAPI.InitTargetComms()
PS3TMAPI.Connect(0, TextBox1.Text)
End Sub
//TextBox1.Text = my IP Address box

Also, whenever I try to attach a process, I get "Object reference not set to an instance of an object". I assume this could be with the connection problem, since I can't get my program to connect at all, but it's worth throwing out there to see if I can get any help.
So, do you have any idea of what I'm doing wrong?
Thanks!

Here's a tiny picture of it if you are having trouble "visualizing" what I mean by a few things. You must login or register to view this content.


Try this PS3TMAPI.Connect(0, vbNullString)

And check if the dll ps3tmapi_net is in your debug folder of your vb project Winky Winky

The following user thanked iMCSx for this useful post:

ICS Vortex
03-04-2013, 07:39 PM #42
ICS Vortex
Between Light and Lies
Originally posted by FM
Try this PS3TMAPI.Connect(0, vbNullString)

And check if the dll ps3tmapi_net is in your debug folder of your vb project Winky Winky


Thanks for the reply, but it still does the same thing. I changed it to what I had: PS3TMAPI.Connect(0, TextBox1.Text) because I thought that is how you would connect the IP Address textbox input to the connect button?
03-04-2013, 11:45 PM #43
BadChoicesZ
I defeated!
Originally posted by ICS
Thanks for the reply, but it still does the same thing. I changed it to what I had: PS3TMAPI.Connect(0, TextBox1.Text) because I thought that is how you would connect the IP Address textbox input to the connect button?


when i was coding with C# i thought the same thing that i'd need to provide IP address to connect, however i think it conects to PS3 that is created on TargetManager, so
PS3TMAPI.Connect(0, null);
or the vbstringnull thing said iMCSx should work...

The following user thanked BadChoicesZ for this useful post:

ICS Vortex
03-05-2013, 01:51 AM #44
ICS Vortex
Between Light and Lies
Originally posted by StubnOne View Post
when i was coding with C# i thought the same thing that i'd need to provide IP address to connect, however i think it conects to PS3 that is created on TargetManager, so
PS3TMAPI.Connect(0, null);
or the vbstringnull thing said iMCSx should work...


So you're saying that we wouldn't even need an IP box?
What if we have 2 DEX PS3's as I do :p?
Edit: Tried it again while running MW3 and the Target Manager and Debugger. I still get an unresponsive program when I try to Connect. After thinking I could have possibly connected, I tried to attach the process using his code. I still get this error :p You must login or register to view this content.
03-05-2013, 06:28 AM #45
BadChoicesZ
I defeated!
Originally posted by ICS
So you're saying that we wouldn't even need an IP box?
What if we have 2 DEX PS3's as I do :p?
Edit: Tried it again while running MW3 and the Target Manager and Debugger. I still get an unresponsive program when I try to Connect. After thinking I could have possibly connected, I tried to attach the process using his code. I still get this error :p You must login or register to view this content.


yeah u shouldnt need any ip box,
You must login or register to view this content.
thats program im currently trying to finish off, and it connects to ps3 and attaches fine,

if u wanted to Connect ur other jb ps3, i would presume u would use targetmanager and Find Ps3 Ip and set it up that way, ... could b wrong tho :P
03-08-2013, 12:28 PM #46
:fyea:

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo