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(;
{
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, 0xa7011;
// while (ReadInt(0xA8CD64, 1) != 0)
// continue;
//return ReadString(0x29F0E22);
//}
namespace Menu
{
void Bind(uint64_t nothing)
{
for(;
{
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;
}