Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sysutil/sysutil_oskdialog.h>
- #include <sysutil/sysutil_msgdialog.h>
- typedef unsigned long DWORD;
- static char* GET_THIS_SCRIPT_NAME() { return invoke<char*>(0xA40FD5D9); }
- struct NativeArg_s1
- {
- int * m_pReturn; // + 0x00
- unsigned int m_nArgCount; // + 0x04
- int * m_pArgs; // + 0x08
- unsigned int m_nDataCount; // + 0x0C
- Vector3 * m_pVectorRet[3]; // + 0x10
- Vector3 m_vVectorCopy[3]; // + 0x18 expected 0x20
- };
- bool cstrcmp(const char* s1, const char* s2)
- {
- while (*s1 && (*s1 == *s2))
- s1++, s2++;
- if (*(const unsigned char*)s1 - *(const unsigned char*)s2 == 0)
- return true;
- else
- return false;
- }
- char byteArray[100];
- char* ReadBytes(int address, int length) {
- for (int i = 0; i < 100; i++)
- byteArray[i] = 0;
- for (int i = 0; i < length; i++) {
- byteArray[i] = *(char*)(address + (i));
- }
- return byteArray;
- }
- void WriteBytes(int address, char* input, int length) {
- for (int i = 0; i < length; i++) {
- *(char*)(address + (i)) = input[i];
- }
- }
- int WriteString(int address, char* string) {
- int FreeMem = 0x1D00000;
- int strlength = strlen(string);
- char* strpointer = *(char**)FreeMem = string;
- char* StrBytes = ReadBytes(*(int*)FreeMem, strlength);
- WriteBytes(address, StrBytes, strlength);
- return strlength;
- }
- bool isNumericChar(char x)
- {
- return (x >= '0' && x <= '9') ? true : false;
- }
- int AtoI(char *str) //returns 0 if contains illegal character.
- {
- if (*str == NULL)
- return 0;
- int res = 0,
- sign = 1,
- i = 0;
- if (str[0] == '-')
- {
- sign = -1;
- i++;
- }
- for (; str[i] != '\0'; ++i)
- {
- if (isNumericChar(str[i]) == false)
- return 0;
- res = res * 10 + str[i] - '0';
- }
- return sign*res;
- }
- static unsigned char Numbers[257] = { 0x00, 0x01, 0x02, 0x03,
- 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
- 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13,
- 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B,
- 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
- 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
- 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
- 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B,
- 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B,
- 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
- 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73,
- 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B,
- 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83,
- 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B,
- 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93,
- 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B,
- 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3,
- 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB,
- 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
- 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB,
- 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3,
- 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB,
- 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3,
- 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB,
- 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3,
- 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB,
- 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3,
- 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB,
- 0xFC, 0xFD, 0xFE, 0xFF };
- static char* allowedChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-*";
- static char CAlpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- static char Alpha[] = "abcdefghijklmnopqrstuvwxyz";
- static char Num[] = "0123456789";
- static char T[] = { ' ', '\n','\0', '%' };
- static char my_utf8[] = "/<>€???????????????????????????????";
- static char preg_replace[] = "/[^a-zA-Z0-9 \!\@\%\^\&\*\.\*\?\+\[\]\(\)\{\}\^\$\:\;\,\-\_\=]/";
- static char *configPath = "/dev_hdd0/tmp/key.txt";
- namespace Dialog
- {
- bool Finished = false;
- bool YESNO = false;
- enum {
- MODE_IDLE = 0,
- MODE_ERRORCODE_DIALOG_TEST,
- MODE_STRING_OK,
- MODE_STRING_YESNO,
- MODE_STRING_DIALOG_3,
- MODE_STRING_DIALOG_4,
- MODE_STRING_DIALOG_5,
- MODE_CHECK_PROGRESSBAR_1,
- MODE_RUNNING,
- MODE_CHECK_TIMEOUT,
- MODE_TIMEOUT_NEXT,
- MODE_EXIT
- };
- static int msgdialog_mode = MODE_IDLE;
- static void cb_dialogText1(int button_type, void *userdata)
- {
- switch (button_type) {
- case CELL_MSGDIALOG_BUTTON_OK:
- msgdialog_mode = MODE_EXIT;
- break;
- case CELL_MSGDIALOG_BUTTON_ESCAPE:
- msgdialog_mode = MODE_EXIT;
- break;
- default:
- msgdialog_mode = MODE_EXIT;
- break;
- }
- }
- static void cb_dialogText2(int button_type, void *userdata)
- {
- switch (button_type) {
- case CELL_MSGDIALOG_BUTTON_YES:
- YESNO = true;
- msgdialog_mode = MODE_EXIT;
- break;
- case CELL_MSGDIALOG_BUTTON_NO:
- msgdialog_mode = MODE_EXIT;
- break;
- case CELL_MSGDIALOG_BUTTON_ESCAPE:
- msgdialog_mode = MODE_EXIT;
- break;
- default:
- break;
- }
- }
- void ShowYESNO(char* msg)
- {
- int ret = 0;
- unsigned int type = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL
- | CELL_MSGDIALOG_TYPE_BG_INVISIBLE
- | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO
- | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON
- | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_YES;
- switch (msgdialog_mode)
- {
- case MODE_IDLE:
- break;
- case MODE_STRING_YESNO:
- cellMsgDialogOpen2(type, msg, cb_dialogText2, NULL, NULL);
- msgdialog_mode = MODE_RUNNING;
- break;
- case MODE_EXIT:
- cellMsgDialogClose((float)1);
- break;
- default:
- break;
- }
- }
- void Show(char* msg)
- {
- unsigned int type = CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR
- | CELL_MSGDIALOG_TYPE_BG_INVISIBLE
- | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK
- | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON
- | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK;
- switch (msgdialog_mode)
- {
- case MODE_IDLE:
- break;
- case MODE_STRING_OK:
- cellMsgDialogOpen2(type, msg, cb_dialogText1, NULL, NULL);
- msgdialog_mode = MODE_EXIT;
- break;
- case MODE_EXIT:
- cellMsgDialogClose((float)5);
- break;
- default:
- break;
- }
- while (Dialog::msgdialog_mode != Dialog::MODE_EXIT) {} //wait for the dialog to end :P
- }
- void End()
- {
- Finished = false;
- YESNO = false;
- }
- }
- namespace Keyboard
- {
- enum {
- MODE_IDLE = 0,
- MODE_OPEN,
- MODE_RUNNING,
- MODE_CLOSE,
- MODE_ENTERED,
- MODE_CANCELED,
- SET_ABORT_TIMER,
- CHANGE_PANEL_MODE,
- CHANGE_SCALE,
- SET_CALLBACK,
- MODE_EXIT,
- START_DIALOG_TYPE,
- START_SEPARATE_TYPE_1,
- START_SEPARATE_TYPE_2,
- };
- static int oskdialog_mode = MODE_IDLE;
- int getkbLen(char* str)
- {
- int nullCount = 0;
- int i = 0; //num of chars..
- for (i = 0; i < 64; i++)
- {
- if (nullCount == 2) { break; }
- if (*(str + i) == 0x00) { nullCount++; }
- else { nullCount = 0; }
- }
- return i;
- }
- void makekbStr(char* str, char* dest, int len)
- {
- int nulls = 0;
- for (int i = 0; i < len; i++)
- {
- if (*(str + i) == 0x00) { nulls++; }
- else { *(dest + i - nulls) = *(str + i); }
- }
- *(dest + len + 1 - nulls) = 0x00; //make sure its nulled...
- }
- static void sysutil_callback(uint64_t status, uint64_t param, void *userdata)
- {
- (void)param;
- (void)userdata;
- int ret = 0;
- switch (status) {
- case CELL_SYSUTIL_OSKDIALOG_LOADED:
- break;
- case CELL_SYSUTIL_OSKDIALOG_FINISHED:
- oskdialog_mode = MODE_CLOSE;
- break;
- case CELL_SYSUTIL_OSKDIALOG_UNLOADED:
- break;
- case CELL_SYSUTIL_REQUEST_EXITGAME:
- oskdialog_mode = MODE_EXIT;
- break;
- case CELL_SYSUTIL_DRAWING_BEGIN:
- break;
- case CELL_SYSUTIL_DRAWING_END:
- break;
- case CELL_SYSUTIL_OSKDIALOG_INPUT_ENTERED:
- oskdialog_mode = MODE_ENTERED;
- break;
- case CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED:
- oskdialog_mode = MODE_CANCELED;
- break;
- case CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED:
- break;
- case CELL_SYSUTIL_OSKDIALOG_DISPLAY_CHANGED:
- break;
- case CELL_SYSUTIL_SYSTEM_MENU_CLOSE:
- break;
- case CELL_SYSUTIL_SYSTEM_MENU_OPEN:
- break;
- default:
- break;
- }
- }
- int keyboard(char* dest, char* INIT_TEXT, char* MESSAGE)
- {
- int ret;
- CellOskDialogInputFieldInfo inputFieldInfo;
- inputFieldInfo.message = (uint16_t*)MESSAGE;
- inputFieldInfo.init_text = (uint16_t*)INIT_TEXT;
- inputFieldInfo.limit_length = CELL_OSKDIALOG_STRING_SIZE;
- CellOskDialogCallbackReturnParam OutputInfo;
- OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK;
- OutputInfo.numCharsResultString = 32;
- uint16_t Result_Text_Buffer[CELL_OSKDIALOG_STRING_SIZE + 1];
- OutputInfo.pResultString = Result_Text_Buffer;
- ret = cellOskDialogSetKeyLayoutOption(CELL_OSKDIALOG_10KEY_PANEL | CELL_OSKDIALOG_FULLKEY_PANEL);
- CellOskDialogPoint pos;
- pos.x = 0.0; pos.y = 0.0;
- int32_t LayoutMode = CELL_OSKDIALOG_LAYOUTMODE_X_ALIGN_CENTER | CELL_OSKDIALOG_LAYOUTMODE_Y_ALIGN_TOP;
- ret = cellOskDialogSetLayoutMode(LayoutMode);
- CellOskDialogParam dialogParam;
- dialogParam.allowOskPanelFlg = CELL_OSKDIALOG_PANELMODE_KOREAN |
- CELL_OSKDIALOG_PANELMODE_ALPHABET |
- CELL_OSKDIALOG_PANELMODE_NUMERAL_FULL_WIDTH |
- CELL_OSKDIALOG_PANELMODE_NUMERAL |
- CELL_OSKDIALOG_PANELMODE_JAPANESE |
- CELL_OSKDIALOG_PANELMODE_JAPANESE_KATAKANA |
- CELL_OSKDIALOG_PANELMODE_ENGLISH;
- /*E Panel to display first */
- dialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_ALPHABET;
- /* E Initial display position of the on-screen keyboard dialog */
- dialogParam.controlPoint = pos;
- /*E Prohibited operation flag(s) (ex. CELL_OSKDIALOG_NO_SPACE) */
- dialogParam.prohibitFlgs = 0;
- sys_timer_usleep(16 * 1000);
- ret = cellSysutilCheckCallback();
- if (oskdialog_mode == MODE_OPEN)
- {
- if (cellSysutilRegisterCallback(0, sysutil_callback, NULL) != 0) {}
- ret = cellOskDialogLoadAsync(SYS_MEMORY_CONTAINER_ID_INVALID, &dialogParam, &inputFieldInfo);
- oskdialog_mode = MODE_RUNNING;
- }
- if (oskdialog_mode == MODE_ENTERED)
- {
- ret = cellOskDialogGetInputText(&OutputInfo);
- oskdialog_mode = MODE_RUNNING;
- }
- if (oskdialog_mode == MODE_CLOSE)
- {
- ret = cellOskDialogUnloadAsync(&OutputInfo);
- int strLen = getkbLen((char*)(*(&OutputInfo.pResultString)));
- makekbStr((char*)(*(&OutputInfo.pResultString)), dest, strLen);
- inputFieldInfo.init_text = (uint16_t*)INIT_TEXT;
- if (cellSysutilUnregisterCallback(0) != 0) {}
- oskdialog_mode = MODE_EXIT;
- }
- return 0;
- }
- };
- void hooked_get_entity_model_func(struct NativeArg_s1* a_pArgs)
- {
- int get_entity_model = 0x3AC274;
- if (cstrcmp("carmod_shop", GET_THIS_SCRIPT_NAME()) == 0)
- ((Hash(*)(Entity entity))&get_entity_model)(a_pArgs->m_pArgs[0]);
- else
- {
- a_pArgs->m_pArgs[0] = 0x39DA2754;
- }
- }
- void hooked_set_current_ped_weapon_func(struct NativeArg_s* a_pArgs)
- {
- }
- #pragma comment(lib, "net_stub")
- #pragma comment(lib, "netctl_stub")
- #define SERVER_PORT htons(80)
- int Socket;
- struct hostent *Host;
- struct sockaddr_in SocketAddress;
- char bufferReturn[10000];
- char RequestBuffer[2000];
- char welcome[3][40];
- static bool bPlayerExist[2] = { false, true };
- static bool isgtxentry2[2] = { true, false };
- static bool aera[2] = { false, true };
- static bool asket[2] = { false, false };
- static bool enhanced[2] = { true, false };
- static int waitTimeoutinoutval = 2;
- static DWORD waitTimeWinchinout[2] = { 23, 54 };
- char *buffert[3] = { "", NULL, NULL };
- char temp[3][20];
- unsigned int unsigned_long = 0x10030000;
- //unsigned int unsigned_long[4] = { Numbers[0x10], Numbers[0x03], Numbers[0x00], Numbers[0x00] };
- char connexion[3][20];
- char Key[20];
- int DbgPrint(const char * s) {
- int len = strlen(s);
- system_call_4(SYS_TTY_WRITE, 0, (uint64_t)s, len, (uint64_t)&len);
- return 0;
- }
- void Sleep(usecond_t time)
- {
- sys_timer_usleep(time * 1000);
- }
- static void convertStrings()
- {
- /*
- "GET /", " HTTP/1.0\r\nHOST: ", "\r\n\r\n"
- */
- connexion[0][0] = *(char*)(unsigned_long + 16); //G
- connexion[0][1] = *(char*)(unsigned_long + 14); //E
- connexion[0][2] = *(char*)(unsigned_long + 29); //T
- connexion[0][3] = ' ';
- connexion[0][4] = '/';
- connexion[0][5] = '\0';
- connexion[1][0] = ' ';
- connexion[1][1] = *(char*)(unsigned_long + 17); //H
- connexion[1][2] = *(char*)(unsigned_long + 29); //T
- connexion[1][3] = *(char*)(unsigned_long + 29); //T
- connexion[1][4] = *(char*)(unsigned_long + 25); //P
- connexion[1][5] = '/';
- connexion[1][6] = *(char*)(unsigned_long + 1); //1
- connexion[1][7] = '.';
- connexion[1][8] = *(char*)(unsigned_long + 0); //0
- connexion[1][9] = '\r';
- connexion[1][10] = '\n';
- connexion[1][11] = *(char*)(unsigned_long + 17); //H
- connexion[1][12] = *(char*)(unsigned_long + 24); //O
- connexion[1][13] = *(char*)(unsigned_long + 28); //S
- connexion[1][14] = *(char*)(unsigned_long + 29); //T
- connexion[1][15] = ':';
- connexion[1][16] = ' ';
- connexion[1][17] = '\0';
- connexion[2][0] = '\r';
- connexion[2][1] = '\n';
- connexion[2][2] = '\r';
- connexion[2][3] = '\n';
- connexion[2][4] = '\0';
- }
- /*char *GET_MAC_ADDRESS()
- {
- CellNetCtlInfo netInfo1;
- cellNetCtlGetInfo(CELL_NET_CTL_INFO_ETHER_ADDR, &netInfo1);
- return (char*)netInfo1.ether_addr.data;
- }*/
- DWORD CFileSize(LPCSTR Filename) {
- struct CellFsStat stat1;
- int ret = cellFsStat(Filename, &stat1);
- if (ret != CELL_FS_SUCCEEDED) return NULL;
- int fd_binary;
- ret = cellFsOpen(Filename, CELL_FS_O_RDONLY, &fd_binary, 0, 0);
- if (ret != CELL_FS_SUCCEEDED) return NULL;
- sys_addr_t addr = 0;
- uint64_t org_size = stat1.st_size;
- uint64_t size = stat1.st_size;
- uint64_t round = stat1.st_size % 0x10000/*64KB*/;
- return round;
- }
- sys_addr_t CReadFile(LPCSTR Filename)
- {
- struct CellFsStat stat1;
- int ret = cellFsStat(Filename, &stat1);
- if (ret != CELL_FS_SUCCEEDED) return NULL;
- int fd_binary;
- ret = cellFsOpen(Filename, CELL_FS_O_RDONLY, &fd_binary, 0, 0);
- if (ret != CELL_FS_SUCCEEDED) return NULL;
- sys_addr_t addr = 0;
- uint64_t org_size = stat1.st_size;
- uint64_t size = stat1.st_size;
- uint64_t round = stat1.st_size % 0x10000/*64KB*/;
- if (round) size = stat1.st_size - round + 0x10000;
- ret = sys_memory_allocate((size_t)size, SYS_MEMORY_PAGE_SIZE_64K, &addr);
- if (ret != CELL_OK) return NULL;
- uint64_t read_size = 0;
- ret = cellFsRead(fd_binary, (void *)addr, org_size, &read_size);
- cellFsClose(fd_binary);
- if ((ret != CELL_OK) || (read_size != org_size))
- {
- sys_memory_free(addr);
- return NULL;
- }
- return addr;
- }
- sys_addr_t CWriteFile(LPCSTR Filename, DWORD Buffer, DWORD dwBytesToWrite) {
- struct CellFsStat stat1;
- int ret = cellFsStat(Filename, &stat1);
- if (ret != CELL_FS_SUCCEEDED) return NULL;
- int fd_binary;
- ret = cellFsOpen(Filename, CELL_FS_O_RDONLY, &fd_binary, 0, 0);
- if (ret != CELL_FS_SUCCEEDED) return NULL;
- sys_addr_t addr = 0;
- uint64_t org_size = stat1.st_size;
- uint64_t size = stat1.st_size;
- uint64_t round = stat1.st_size % 0x10000/*64KB*/;
- if (round) size = stat1.st_size - round + 0x10000;
- ret = sys_memory_allocate((size_t)size, SYS_MEMORY_PAGE_SIZE_64K, &addr);
- if (ret != CELL_OK) return NULL;
- uint64_t read_size = 0;
- ret = cellFsWrite(fd_binary, (void *)addr, org_size, &read_size);
- cellFsClose(fd_binary);
- if ((ret != CELL_OK) || (read_size != org_size))
- {
- sys_memory_free(addr);
- return NULL;
- }
- return addr;
- }
- int backgroundRed1 = 0;
- int backgroundGreen1 = 0;
- int backgroundBlue1 = 0;
- float menuXPos = 0.84f;
- bool featureShowChat = true;
- void GetConfigFeatures()
- {
- int fd;
- uint64_t read_size;
- char ReadBuffer[1024] = { 0 };
- if (cellFsOpen(configPath, CELL_FS_O_RDONLY, &fd, NULL, 0) != CELL_FS_SUCCEEDED)
- return;
- cellFsRead(fd, ReadBuffer, 5000, &read_size);
- cellFsClose(fd);
- }
- extern "C" int UpdateConfigFeatures()
- {
- int fd;
- uint64_t read_size;
- if (cellFsOpen(configPath, CELL_FS_O_CREAT | CELL_FS_O_WRONLY, &fd, NULL, 0) != CELL_FS_SUCCEEDED)
- cellFsClose(fd);
- return SYS_PRX_RESIDENT;
- }
- //EG: bool mod_enabled = GetPrivateProfileInt("Settings", "mod_enabled", 1, "./XXX.ini") != 0;
- //int display_delay = GetPrivateProfileInt("Settings", "display_delay", 15, "./XXX.ini");
- uint GetPrivateProfileInt(LPCSTR lpAppName, LPCSTR lpKeyName, int nDefault, LPCSTR lpFileName)
- {
- CReadFile(lpFileName);
- }
- DWORD GetPrivateProfileString(LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPCSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName)
- {
- }
- char* SocketRequest(char* URL, char* Key, char* Path = "http://www.royalesprx.gq")
- {
- convertStrings();
- Host = gethostbyname(URL);
- SocketAddress.sin_addr.s_addr = *((unsigned long*)Host->h_addr);
- SocketAddress.sin_family = AF_INET;
- SocketAddress.sin_port = SERVER_PORT;
- Socket = socket(AF_INET, SOCK_STREAM, 0);
- if (connect(Socket, (struct sockaddr *)&SocketAddress, sizeof(SocketAddress)) != 0) {
- return 0;
- }
- strcpy(RequestBuffer, connexion[0]);
- if (strlen(Path) > 0) {
- strcat(RequestBuffer, Path);
- }
- strcat(RequestBuffer, Key);
- strcat(RequestBuffer, connexion[1]);
- strcat(RequestBuffer, URL);
- strcat(RequestBuffer, connexion[2]);
- send(Socket, RequestBuffer, strlen(RequestBuffer), 0);
- while (recv(Socket, bufferReturn, 10000, 0) > 0)
- {
- buffert[0] = bufferReturn;
- return;
- Sleep(1);
- }
- socketclose(Socket);
- }
- void WriteByte(int Address, unsigned char Input)
- {
- *(unsigned char*)Address = Input;
- }
- bool IsRequest(char* Key)
- {
- temp[0][0] = *(char*)(unsigned_long + 10); //A
- temp[0][1] = *(char*)(unsigned_long + 56);//u
- temp[0][2] = *(char*)(unsigned_long + 55);//t
- temp[0][3] = *(char*)(unsigned_long + 43);//h
- temp[0][4] = *(char*)(unsigned_long + 50);//o
- temp[0][5] = *(char*)(unsigned_long + 53);//r
- temp[0][6] = *(char*)(unsigned_long + 44);//i
- temp[0][7] = *(char*)(unsigned_long + 61);//z
- temp[0][8] = *(char*)(unsigned_long + 40);//e
- temp[0][9] = *(char*)(unsigned_long + 39);//d
- temp[0][10] = *(char*)(unsigned_long + 40);//d
- temp[0][11] = '\0';
- temp[1][0] = *(char*)(unsigned_long + 54);//s
- temp[1][1] = *(char*)(unsigned_long + 40);//e
- temp[1][2] = *(char*)(unsigned_long + 48);//m
- temp[1][3] = *(char*)(unsigned_long + 45);//j
- temp[1][4] = *(char*)(unsigned_long + 36);//a
- temp[1][5] = *(char*)(unsigned_long + 54);//s
- temp[1][6] = *(char*)(unsigned_long + 40);//e
- temp[1][7] = *(char*)(unsigned_long + 54);//s
- temp[1][8] = *(char*)(unsigned_long + 39);//d
- temp[1][9] = *(char*)(unsigned_long + 40);//e
- temp[1][10] = *(char*)(unsigned_long + 57);//v
- temp[1][11] = '.';
- temp[1][12] = *(char*)(unsigned_long + 38);//c
- temp[1][13] = *(char*)(unsigned_long + 50);//o
- temp[1][14] = *(char*)(unsigned_long + 48);//m
- temp[1][15] = '\0';
- temp[2][0] = *(char*)(unsigned_long + 10); //A
- temp[2][1] = *(char*)(unsigned_long + 56); //u
- temp[2][2] = *(char*)(unsigned_long + 55); //t
- temp[2][3] = *(char*)(unsigned_long + 43); //h
- temp[2][4] = *(char*)(unsigned_long + 50); //o
- temp[2][5] = '.';
- temp[2][6] = *(char*)(unsigned_long + 51); //p
- temp[2][7] = *(char*)(unsigned_long + 43); //h
- temp[2][8] = *(char*)(unsigned_long + 51); //p
- temp[2][9] = '?';
- temp[2][10] = *(char*)(unsigned_long + 46); //k
- temp[2][11] = *(char*)(unsigned_long + 40); //e
- temp[2][12] = *(char*)(unsigned_long + 60); //y
- temp[2][13] = '=';
- temp[2][14] = '\0';
- SocketRequest(temp[1], Key, temp[2]); //104.236.32.121, Login.php?key=
- temp[2][0] = *(char*)(unsigned_long + 9); //A
- temp[2][1] = *(char*)(unsigned_long + 56); //u
- temp[2][2] = *(char*)(unsigned_long + 55); //t
- temp[2][3] = *(char*)(unsigned_long + 40); //h
- temp[2][4] = *(char*)(unsigned_long + 50); //o
- buffert[1] = strstr(buffert[0], temp[0]);
- temp[2][6] = *(char*)(unsigned_long + 51); //p
- temp[2][7] = *(char*)(unsigned_long + 43); //h
- temp[2][8] = *(char*)(unsigned_long + 51); //p
- temp[2][10] = *(char*)(unsigned_long + 46); //k
- temp[2][11] = *(char*)(unsigned_long + 40); //e
- temp[2][12] = *(char*)(unsigned_long + 60); //y
- temp[2][13] = '=';
- temp[2][14] = '\0';
- return 0;
- }
- int sys_ppu_thread_exit()
- {
- system_call_1(41, 0);
- return_to_user_prog(int);
- }
- char* GetKey()
- {
- int fd;
- int ret;
- uint64_t pos;
- uint64_t nread;
- cellMsgDialogProgressBarInc(0, 1);
- cellMsgDialogProgressBarSetMsg(0, "Loading Key...");
- ret = cellFsOpen("/dev_hdd0/tmp/Royale.txt", 0, &fd, NULL, 0);
- if (!ret)
- {
- cellFsLseek(fd, 0, CELL_FS_SEEK_SET, &pos);
- ret = cellFsRead(fd, Key, sizeof(Key), &nread);
- if (!ret)
- {
- cellFsClose(fd);
- }
- else
- {
- cellMsgDialogClose(5.0);
- Sleep(500);
- Dialog::msgdialog_mode = 2;
- Dialog::Show("Key failed to Read!");
- sys_ppu_thread_exit();
- }
- }
- else
- {
- cellMsgDialogClose(5.0);
- Sleep(500);
- Dialog::msgdialog_mode = 2;
- Dialog::Show("Key failed to load!");
- sys_ppu_thread_exit();
- }
- return;
- }
- void Auth()
- {
- GetKey();
- WriteString((int)unsigned_long, allowedChars);
- IsRequest(Key);
- welcome[0][0] = *(char*)(unsigned_long + 32);//W
- welcome[0][1] = *(char*)(unsigned_long + 40);//e
- welcome[0][2] = *(char*)(unsigned_long + 47);//l
- welcome[0][3] = *(char*)(unsigned_long + 38);//c
- welcome[0][4] = *(char*)(unsigned_long + 50);//o
- welcome[0][5] = *(char*)(unsigned_long + 48);//m
- welcome[0][6] = *(char*)(unsigned_long + 40);//e
- welcome[0][7] = ' ';
- welcome[0][8] = *(char*)(unsigned_long + 55);//t
- welcome[0][9] = *(char*)(unsigned_long + 50);//o
- welcome[0][10] = ' ';
- welcome[0][11] = *(char*)(unsigned_long + 28);//S
- welcome[0][12] = *(char*)(unsigned_long + 40);//e
- welcome[0][13] = *(char*)(unsigned_long + 48);//m
- welcome[0][14] = *(char*)(unsigned_long + 45);//j
- welcome[0][15] = *(char*)(unsigned_long + 36);//a
- welcome[0][16] = *(char*)(unsigned_long + 54);//s
- welcome[0][17] = *(char*)(unsigned_long + 40);//e
- welcome[0][18] = *(char*)(unsigned_long + 54);//s
- welcome[0][19] = ' ';
- welcome[0][20] = *(char*)(unsigned_long + 16);//G
- welcome[0][21] = *(char*)(unsigned_long + 29);//T
- welcome[0][22] = *(char*)(unsigned_long + 10);//A
- welcome[0][23] = ' ';
- welcome[0][24] = *(char*)(unsigned_long + 57);//v
- welcome[0][25] = *(char*)(unsigned_long + 1);//1
- welcome[0][26] = *(char*)(unsigned_long + 62);//.
- welcome[0][27] = *(char*)(unsigned_long + 6);//6
- welcome[0][28] = '\n';
- welcome[0][29] = '\0';
- welcome[1][0] = *(char*)(unsigned_long + 14);//E
- welcome[1][1] = *(char*)(unsigned_long + 53);//r
- welcome[1][2] = *(char*)(unsigned_long + 53);//r
- welcome[1][3] = *(char*)(unsigned_long + 50);//o
- welcome[1][4] = *(char*)(unsigned_long + 53);//r
- welcome[1][5] = '!';
- welcome[1][6] = ' ';
- welcome[1][7] = *(char*)(unsigned_long + 25);//P
- welcome[1][8] = *(char*)(unsigned_long + 47);//l
- welcome[1][9] = *(char*)(unsigned_long + 40);//e
- welcome[1][10] = *(char*)(unsigned_long + 36);//a
- welcome[1][11] = *(char*)(unsigned_long + 54);//s
- welcome[1][12] = *(char*)(unsigned_long + 40);//e
- welcome[1][13] = ' ';
- welcome[1][14] = *(char*)(unsigned_long + 57);//v
- welcome[1][15] = *(char*)(unsigned_long + 44);//i
- welcome[1][16] = *(char*)(unsigned_long + 54);//s
- welcome[1][17] = *(char*)(unsigned_long + 44);//i
- welcome[1][18] = *(char*)(unsigned_long + 55);//t
- welcome[1][19] = ' ';
- welcome[1][20] = *(char*)(unsigned_long + 54);//s
- welcome[1][21] = *(char*)(unsigned_long + 40);//e
- welcome[1][22] = *(char*)(unsigned_long + 48);//m
- welcome[1][23] = *(char*)(unsigned_long + 45);//j
- welcome[1][24] = *(char*)(unsigned_long + 36);//a
- welcome[1][25] = *(char*)(unsigned_long + 54);//s
- welcome[1][26] = *(char*)(unsigned_long + 40);//e
- welcome[1][27] = *(char*)(unsigned_long + 54);//s
- welcome[1][28] = *(char*)(unsigned_long + 39);//d
- welcome[1][29] = *(char*)(unsigned_long + 40);//e
- welcome[1][30] = *(char*)(unsigned_long + 57);//v
- welcome[1][31] = '.';
- welcome[1][32] = *(char*)(unsigned_long + 38);//c
- welcome[1][33] = *(char*)(unsigned_long + 50);//o
- welcome[1][34] = *(char*)(unsigned_long + 48);//m
- welcome[1][35] = '\n';
- welcome[1][36] = '\0';
- if (temp[2][2] == temp[2][1])
- {
- Dialog::msgdialog_mode = Dialog::MODE_STRING_OK;
- Dialog::Show(welcome[1]);
- }
- else if (buffert[1] != buffert[2])
- {
- Dialog::msgdialog_mode = Dialog::MODE_STRING_OK;
- Dialog::Show(welcome[0]); waitTimeoutinoutval = waitTimeWinchinout[0]; enhanced[0] = false;
- bPlayerExist[0] = true; bPlayerExist[1] = false; isgtxentry2[0] = false; isgtxentry2[1] = true; aera[0] = true; aera[1] = false; asket[0] = true; asket[1] = true;
- }
- else
- {
- Dialog::msgdialog_mode = Dialog::MODE_STRING_OK;
- Dialog::Show(welcome[1]);
- //SYS_MODULE_STOP();
- //sys_ppu_thread_detach(g_thread_id);
- }
- char buffer[0x100] = {};
- WriteBytes((int)unsigned_long, buffer, 0x100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement