Post: [SPRX] All Clients DPAD Button Monitoring
07-31-2014, 11:56 AM #1
seb5594
Proud Former Admin
(adsbygoogle = window.adsbygoogle || []).push({});
Yo Guys,
I've been working on MW3 things via SPRX and made this little Button Monitoring.
It works perfect and i wanted to share it with you Smile

This one will work Online and Offline!

The Script
    
enum Buttons
{
Up = 0x3135,
Down = 0x3137,
Left = 0x3139,
Right = 0x3231,
X = 0x3235,
Square = 0x3131,
Triangle = 0x3430,
L1 = 0x3133,
L2 = 0x3700,
L3 = 0x3900,
R1 = 0x3100,
R2 = 0x3500,
R3 = 0x3237
};
bool DetectBtn(int clientIndex, Buttons Btn)
{
return *(short*)(*(int*)0x017BB210 + (clientIndex * 0x68B80) + 0x21022) == Btn;
}


Usage
    
if(DetectBtn(0, Up))
{
//do whatever
}


Credits
seb5594 - Building Function
SC58 - client_s Pointer


Other interesting MW3 Release(s) from me:
You must login or register to view this content.

Last edited by seb5594 ; 07-31-2014 at 07:06 PM.

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

A Friend, Absolute Zero, EdiTzZ, En3RGyMoDz, iMoDz-Baptiste, LaRip8, Notorious, SaberNGU, SnaY, Swaqq, Taylor
08-02-2014, 12:21 PM #11
lutsch1234
Bounty hunter
Maybe you can release the calls so we can use the button monitoring
08-02-2014, 04:16 PM #12
Originally posted by lutsch1234 View Post
Maybe you can release the calls so we can use the button monitoring


You don't need any calls stare
08-02-2014, 08:33 PM #13
lutsch1234
Bounty hunter
I tested it without calls but if i load the game i get a blackscreen and ist not the eboot because without the sprx its working.
Here is the source if you could look at it and tell me what i did wrong:

#include "stdafx.h"

#include <cellstatus.h>
#include <sys/prx.h>
#include <sys/timer.h>
#include <sys/syscall.h>
#include <sys/ppu_thread.h>
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/memory.h>
#include <typeinfo>

int console_write(const char * s)
{
uint32_t len;
system_call_4(403, 0, (uint64_t) s, 32, (uint64_t) &len);
return_to_user_prog(int);
}
void sleep(usecond_t time)
{
sys_timer_usleep(time * 1000);
}

sys_ppu_thread_t Main_Function;
sys_ppu_thread_t RPC_CALL_THREAD;

sys_ppu_thread_t create_thread(void (*entry)(uint64_t), int priority, size_t stacksize, const char* threadname,sys_ppu_thread_t id)
{
if(sys_ppu_thread_create(&id, entry, 0, priority , stacksize, 0, threadname) == CELL_OK)
{
console_write("\n\nMENU STARTED !\n\n");
}

return id;
}

void writeString(const char* str, int len, unsigned int addr)
{
for(int i = 0; i < len; i++)
{
if(*(str+i) == 0x00) {break;;}
*(char*)(addr+i) = *(str+i);
}
}


char* ReadString(int address)
{
return (char*)(address);
}


int intArray[100];


int* ReadInt(int address, int length)
{
for (int i = 0; i < length; i++)
{
intArray = *(int*)(address + (i * 0x04));
}
return intArray;
}


void WriteByte(int Address, unsigned char Input)
{
*(unsigned char*)Address = Input;
}
#define TOC 0x0072DCE8
struct opd_s
{
uint32_t sub;
uint32_t toc;
};
union color_s
{
struct
{
int8_t r;
int8_t g;
int8_t b;
int8_t a;
};
int32_t rgba;
};
struct hudelem_s
{
int type;
float x;
float y;
float z;
int targetEntNum;
float fontScale;
float fromFontScale;
float fontScaleStartTime;
float fontScaleTime;
int font;
int alignOrg;
int alignScreen;
color_s color;
color_s fromColor;
int fadeStartTime;
int fadeTime;
int label;
int width;
int height;
int materialIndex;
int fromWidth;
int fromHeight;
int scaleStartTime;
int scaleTime;
float fromX;
float fromY;
int fromAlignOrg;
int fromAlignScreen;
int moveStartTime;
int moveTime;
int time;
int duration;
float value;
int text;
float sort;
color_s glowColor;
int fxBirthTime;
int fxLetterTime;
int fxDecayStartTime;
int fxDecayDuration;
int soundID;
int flags;
};
struct game_hudelem_s
{
hudelem_s elem;
int clientNum;
int team;
int archived;
};
int G_LocalizedStringIndex(const char* Text)
{
opd_s Localized = { 0x001BE6CC, TOC };
int(*LocalizedStringIndex)(const char* Text) = (int(*)(const char*))&Localized;
return LocalizedStringIndex(Text);
}
opd_s GMI = { 0x001BE744, TOC };
int(*GetMaterialIndex)(const char* Material) = (int(*)(const char*))&GMI;
game_hudelem_s* HudElem_Alloc()
{
for (int i = 0; i < 1024; i++)
{
game_hudelem_s* elem = (game_hudelem_s*)(0x00F0E10C + (i * 0xB4));
if (!elem->elem.type) return elem;
}
return (game_hudelem_s*)-1;
}
game_hudelem_s* setShader(int clientIndex, const char* Shader, int Width, int Height, float X, float Y, int Allign = 5, unsigned char R = 0, unsigned char G = 0, unsigned char B = 0, unsigned char A = 0)
{
game_hudelem_s* elem = HudElem_Alloc();
elem->clientNum = clientIndex;
elem->elem.type = 4;
*(int*)0x00F3B198 = 5594;
elem->elem.materialIndex = GetMaterialIndex(Shader);
*(int*)0x00F3B198 = 0;
elem->elem.width = Width;
elem->elem.height = Height;
elem->elem.x = X;
elem->elem.y = Y;
elem->elem.alignOrg = Allign;
elem->elem.color.r = R;
elem->elem.color.g = G;
elem->elem.color.b = B;
elem->elem.color.a = A;
return elem;
}
game_hudelem_s* setText(int clientIndex, const char* Text, int Font, float FontScale, float X, float Y, int Allign, unsigned char R = 0, unsigned char G = 0, unsigned char B = 0, unsigned char A = 0, unsigned char glowR = 0, unsigned char glowG = 0, unsigned char glowB = 0, unsigned char glowA = 0)
{
game_hudelem_s* elem = HudElem_Alloc();
elem->clientNum = clientIndex;
elem->elem.type = 1;
elem->elem.text = G_LocalizedStringIndex(Text);
elem->elem.font = Font;
elem->elem.fontScale = FontScale;
elem->elem.x = X;
elem->elem.y = Y;
elem->elem.alignOrg = Allign;
elem->elem.alignScreen = 0;
elem->elem.color.r = R;
elem->elem.color.g = G;
elem->elem.color.b = B;
elem->elem.color.a = A;
elem->elem.glowColor.r = glowR;
elem->elem.glowColor.g = glowG;
elem->elem.glowColor.b = glowB;
elem->elem.glowColor.a = glowA;
return elem;
}
void HudElem_DestroyAll()
{
opd_s HDA = { 0x001872E8, TOC };
void(*HudElemDestroyAll)() = (void(*)())&HDA;
HudElemDestroyAll();
}


void FoneScaleOverTime(game_hudelem_s* Elem, float FontSize, float Time)
{
Elem->elem.fromFontScale = Elem->elem.fontScale;
Elem->elem.fontScaleTime = Time;
Elem->elem.fontScaleStartTime = *(int*)0x00FC3DB0;
Elem->elem.fontScale = FontSize;
}
void ScaleOverTime(game_hudelem_s *Elem, int time, float width, float height)
{
Elem->elem.fromHeight = Elem->elem.height;
Elem->elem.fromWidth = Elem->elem.width;
Elem->elem.scaleStartTime = *(int*)0x00FC3DB0;
Elem->elem.scaleTime = (int)float(time * 1000 + 0.5);
Elem->elem.height = height;
Elem->elem.width = width;
}
void MoveOverTime(game_hudelem_s *Elem, int time, float x, float y)
{
Elem->elem.fromX = Elem->elem.x;
Elem->elem.fromY = Elem->elem.y;
Elem->elem.fromAlignOrg = Elem->elem.alignOrg;
Elem->elem.fromAlignScreen = Elem->elem.alignScreen;
Elem->elem.moveStartTime = *(int*)0x00FC3DB0;
Elem->elem.moveTime = (int)float(time * 1000 + 0.5);
Elem->elem.x = x;
Elem->elem.y = y;
}
void FadeOverTime(game_hudelem_s* Elem, float Time, int R, int G, int B, int A)
{
Elem->elem.fromColor = Elem->elem.color;
Elem->elem.color.r = R;
Elem->elem.color.g = G;
Elem->elem.color.b = B;
Elem->elem.color.a = A;
Elem->elem.fadeTime = (int)float(Time * 1000 + 0.5);
Elem->elem.fadeStartTime = *(int*)0x00FC3DB0;
}
enum Buttons
{
Up = 0x3135,
Down = 0x3137,
Left = 0x3139,
Right = 0x3231,
X = 0x3235,
Square = 0x3131,
Triangle = 0x3430,
L1 = 0x3133,
L2 = 0x3700,
L3 = 0x3900,
R1 = 0x3100,
R2 = 0x3500,
R3 = 0x3237
};
bool DetectBtn(int clientIndex, Buttons Btn)
{
return *(short*)(*(int*)0x017BB210 + (clientIndex * 0x68B80) + 0x21022) == Btn;
}


void Calls_thread(std::uint64_t nothing)
{
for(;Winky Winky
{
if(DetectBtn(0, Up))
{


//WriteByte(0xF44980 + 0x331F, 0x01);
//SV_GameSendServerCommand(0, "c Client(0)Pressed^1[UP]");
// UFO = true;
game_hudelem_s* MyText = setText(0, "Freeplayer20896 is da BOZZ", 0, 2, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 255);
sleep(100);
}

}

}
//char* Keyboard(char* Title = "", char* PresetText = "", int MaxLength = 64)
//{
// CALL(6, 0x3652A8, 0, Title, PresetText, MaxLength, 0, 0xa69578, 0xa7011Cool Man (aka Tustin);
// while (ReadInt(0xA8CD64, 1) != 0)
// continue;
//return ReadString(0x29F0E22);
//}




namespace Menu
{

void Bind(uint64_t nothing)
{
for(;Winky Winky
{


if(DetectBtn(0, Up))
{

game_hudelem_s* MyText = setText(0, "Freeplayer20896 is da BOZZ", 0, 2, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 255);
//WriteByte(0xF44980 + 0x331F, 0x01);
//SV_GameSendServerCommand(0, "c Client(0)Pressed^1[UP]");
// UFO = true;
sleep(100);
}


if(DetectBtn(0, Down))
{


//WriteByte(0xF44980 + 0x331F, 0x00);
//SV_GameSendServerCommand(0, "c Client(0)Pressed^1[DOWN]");
// UFO = false;
sleep(100);
}

}
}

}











SYS_MODULE_INFO( SPRXProject, 0, 1, 1);
SYS_MODULE_START( _SPRXProject_prx_entry );

SYS_LIB_DECLARE_WITH_STUB( LIBNAME, SYS_LIB_AUTO_EXPORT, STUBNAME );
SYS_LIB_EXPORT( _SPRXProject_export_function, LIBNAME );

// An exported function is needed to generate the project's PRX stub export library
extern "C" int _SPRXProject_export_function(void)
{
return CELL_OK;
}

extern "C" int _SPRXProject_prx_entry(void)
{
create_thread(Menu::Bind, 0x4AA, 0x6000, "Main Function", Main_Function);
create_thread(Calls_thread, 0x4AA, 0x6000, "RPC CALL THREAD", RPC_CALL_THREAD);
return SYS_PRX_RESIDENT;
}
08-02-2014, 08:36 PM #14
Taylor
Former Black Knight.
Originally posted by seb5594 View Post
Yo Guys,
I've been working on MW3 things via SPRX and made this little Button Monitoring.
It works perfect and i wanted to share it with you Smile

This one will work Online and Offline!

The Script
    
enum Buttons
{
Up = 0x3135,
Down = 0x3137,
Left = 0x3139,
Right = 0x3231,
X = 0x3235,
Square = 0x3131,
Triangle = 0x3430,
L1 = 0x3133,
L2 = 0x3700,
L3 = 0x3900,
R1 = 0x3100,
R2 = 0x3500,
R3 = 0x3237
};
bool DetectBtn(int clientIndex, Buttons Btn)
{
return *(short*)(*(int*)0x017BB210 + (clientIndex * 0x68B80) + 0x21022) == Btn;
}


Usage
    
if(DetectBtn(0, Up))
{
//do whatever
}


Credits
seb5594 - Building Function
SC58 - client_s Pointer


Other interesting MW3 Release(s) from me:
You must login or register to view this content.



Good work seb, as always! Smile
08-02-2014, 08:36 PM #15
SC58
Former Staff
Should learn how to hook function to monitor the calling of Sv_ExeCuteClientCommand with n XX so you don't have to get mem to use button monitoring.. it would prob go a bit faster if you did it that way

The following 2 users say thank you to SC58 for this useful post:

-JM-,
08-02-2014, 08:42 PM #16
-JM-
Space Ninja
Originally posted by SC58 View Post
Should learn how to hook function to monitor the calling of Sv_ExeCuteClientCommand with n XX so you don't have to get mem to use button monitoring.. it would prob go a bit faster if you did it that way


Finally your doing a constructive post
08-03-2014, 01:43 AM #17
seb5594
Proud Former Admin
Originally posted by SC58 View Post
Should learn how to hook function to monitor the calling of Sv_ExeCuteClientCommand with n XX so you don't have to get mem to use button monitoring.. it would prob go a bit faster if you did it that way

Ya ikr, but it fucked up on MW2, i didn't tried it on MW3 yet :p
08-05-2014, 12:41 AM #18
Swaqq
Professional Thanker
Release it on Ghosts? Sticky's is all wrong
10-11-2018, 09:33 AM #19
Are there any offsets for O, START & SELECT?

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo