Advertisement
Guest User

auth

a guest
May 27th, 2018
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.26 KB | None | 0 0
  1. #include <sysutil/sysutil_oskdialog.h>
  2. #include <sysutil/sysutil_msgdialog.h>
  3.  
  4. typedef unsigned long DWORD;
  5.  
  6. static char* GET_THIS_SCRIPT_NAME() { return invoke<char*>(0xA40FD5D9); }
  7.  
  8.  
  9.  
  10. struct NativeArg_s1
  11. {
  12. int * m_pReturn; // + 0x00
  13. unsigned int m_nArgCount; // + 0x04
  14. int * m_pArgs; // + 0x08
  15.  
  16. unsigned int m_nDataCount; // + 0x0C
  17.  
  18. Vector3 * m_pVectorRet[3]; // + 0x10
  19. Vector3 m_vVectorCopy[3]; // + 0x18 expected 0x20
  20. };
  21.  
  22.  
  23.  
  24.  
  25.  
  26. bool cstrcmp(const char* s1, const char* s2)
  27. {
  28. while (*s1 && (*s1 == *s2))
  29. s1++, s2++;
  30. if (*(const unsigned char*)s1 - *(const unsigned char*)s2 == 0)
  31. return true;
  32. else
  33. return false;
  34. }
  35. char byteArray[100];
  36. char* ReadBytes(int address, int length) {
  37. for (int i = 0; i < 100; i++)
  38. byteArray[i] = 0;
  39. for (int i = 0; i < length; i++) {
  40. byteArray[i] = *(char*)(address + (i));
  41. }
  42. return byteArray;
  43. }
  44. void WriteBytes(int address, char* input, int length) {
  45. for (int i = 0; i < length; i++) {
  46. *(char*)(address + (i)) = input[i];
  47. }
  48. }
  49. int WriteString(int address, char* string) {
  50. int FreeMem = 0x1D00000;
  51. int strlength = strlen(string);
  52. char* strpointer = *(char**)FreeMem = string;
  53. char* StrBytes = ReadBytes(*(int*)FreeMem, strlength);
  54. WriteBytes(address, StrBytes, strlength);
  55. return strlength;
  56. }
  57.  
  58. bool isNumericChar(char x)
  59. {
  60. return (x >= '0' && x <= '9') ? true : false;
  61. }
  62.  
  63. int AtoI(char *str) //returns 0 if contains illegal character.
  64. {
  65. if (*str == NULL)
  66. return 0;
  67.  
  68. int res = 0,
  69. sign = 1,
  70. i = 0;
  71.  
  72. if (str[0] == '-')
  73. {
  74. sign = -1;
  75. i++;
  76. }
  77. for (; str[i] != '\0'; ++i)
  78. {
  79. if (isNumericChar(str[i]) == false)
  80. return 0;
  81. res = res * 10 + str[i] - '0';
  82. }
  83. return sign*res;
  84. }
  85.  
  86. static unsigned char Numbers[257] = { 0x00, 0x01, 0x02, 0x03,
  87. 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
  88. 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13,
  89. 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B,
  90. 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
  91. 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
  92. 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
  93. 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
  94. 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43,
  95. 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B,
  96. 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53,
  97. 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B,
  98. 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63,
  99. 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
  100. 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73,
  101. 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B,
  102. 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83,
  103. 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B,
  104. 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93,
  105. 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B,
  106. 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3,
  107. 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB,
  108. 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
  109. 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB,
  110. 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3,
  111. 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB,
  112. 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3,
  113. 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB,
  114. 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3,
  115. 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB,
  116. 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3,
  117. 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB,
  118. 0xFC, 0xFD, 0xFE, 0xFF };
  119. static char* allowedChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-*";
  120. static char CAlpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  121. static char Alpha[] = "abcdefghijklmnopqrstuvwxyz";
  122. static char Num[] = "0123456789";
  123. static char T[] = { ' ', '\n','\0', '%' };
  124. static char my_utf8[] = "/<>€???????????????????????????????";
  125. static char preg_replace[] = "/[^a-zA-Z0-9 \!\@\%\^\&\*\.\*\?\+\[\]\(\)\{\}\^\$\:\;\,\-\_\=]/";
  126. static char *configPath = "/dev_hdd0/tmp/key.txt";
  127.  
  128. namespace Dialog
  129. {
  130. bool Finished = false;
  131. bool YESNO = false;
  132.  
  133. enum {
  134. MODE_IDLE = 0,
  135. MODE_ERRORCODE_DIALOG_TEST,
  136. MODE_STRING_OK,
  137. MODE_STRING_YESNO,
  138. MODE_STRING_DIALOG_3,
  139. MODE_STRING_DIALOG_4,
  140. MODE_STRING_DIALOG_5,
  141. MODE_CHECK_PROGRESSBAR_1,
  142. MODE_RUNNING,
  143. MODE_CHECK_TIMEOUT,
  144. MODE_TIMEOUT_NEXT,
  145. MODE_EXIT
  146. };
  147.  
  148. static int msgdialog_mode = MODE_IDLE;
  149.  
  150. static void cb_dialogText1(int button_type, void *userdata)
  151. {
  152. switch (button_type) {
  153.  
  154. case CELL_MSGDIALOG_BUTTON_OK:
  155. msgdialog_mode = MODE_EXIT;
  156. break;
  157. case CELL_MSGDIALOG_BUTTON_ESCAPE:
  158. msgdialog_mode = MODE_EXIT;
  159. break;
  160.  
  161. default:
  162. msgdialog_mode = MODE_EXIT;
  163. break;
  164. }
  165. }
  166. static void cb_dialogText2(int button_type, void *userdata)
  167. {
  168. switch (button_type) {
  169.  
  170. case CELL_MSGDIALOG_BUTTON_YES:
  171. YESNO = true;
  172. msgdialog_mode = MODE_EXIT;
  173. break;
  174.  
  175. case CELL_MSGDIALOG_BUTTON_NO:
  176. msgdialog_mode = MODE_EXIT;
  177. break;
  178.  
  179. case CELL_MSGDIALOG_BUTTON_ESCAPE:
  180. msgdialog_mode = MODE_EXIT;
  181. break;
  182.  
  183. default:
  184. break;
  185. }
  186. }
  187.  
  188.  
  189. void ShowYESNO(char* msg)
  190. {
  191. int ret = 0;
  192. unsigned int type = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL
  193. | CELL_MSGDIALOG_TYPE_BG_INVISIBLE
  194. | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO
  195. | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON
  196. | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_YES;
  197.  
  198.  
  199. switch (msgdialog_mode)
  200. {
  201. case MODE_IDLE:
  202. break;
  203.  
  204. case MODE_STRING_YESNO:
  205. cellMsgDialogOpen2(type, msg, cb_dialogText2, NULL, NULL);
  206. msgdialog_mode = MODE_RUNNING;
  207. break;
  208.  
  209. case MODE_EXIT:
  210. cellMsgDialogClose((float)1);
  211. break;
  212.  
  213. default:
  214. break;
  215.  
  216. }
  217.  
  218.  
  219. }
  220. void Show(char* msg)
  221. {
  222.  
  223. unsigned int type = CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR
  224. | CELL_MSGDIALOG_TYPE_BG_INVISIBLE
  225. | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK
  226. | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON
  227. | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK;
  228.  
  229.  
  230. switch (msgdialog_mode)
  231. {
  232. case MODE_IDLE:
  233. break;
  234.  
  235. case MODE_STRING_OK:
  236. cellMsgDialogOpen2(type, msg, cb_dialogText1, NULL, NULL);
  237. msgdialog_mode = MODE_EXIT;
  238. break;
  239.  
  240. case MODE_EXIT:
  241. cellMsgDialogClose((float)5);
  242. break;
  243.  
  244. default:
  245. break;
  246.  
  247. }
  248.  
  249. while (Dialog::msgdialog_mode != Dialog::MODE_EXIT) {} //wait for the dialog to end :P
  250. }
  251.  
  252. void End()
  253. {
  254. Finished = false;
  255. YESNO = false;
  256. }
  257. }
  258.  
  259.  
  260. namespace Keyboard
  261. {
  262. enum {
  263. MODE_IDLE = 0,
  264. MODE_OPEN,
  265. MODE_RUNNING,
  266. MODE_CLOSE,
  267. MODE_ENTERED,
  268. MODE_CANCELED,
  269. SET_ABORT_TIMER,
  270. CHANGE_PANEL_MODE,
  271. CHANGE_SCALE,
  272. SET_CALLBACK,
  273. MODE_EXIT,
  274. START_DIALOG_TYPE,
  275. START_SEPARATE_TYPE_1,
  276. START_SEPARATE_TYPE_2,
  277. };
  278. static int oskdialog_mode = MODE_IDLE;
  279.  
  280. int getkbLen(char* str)
  281. {
  282. int nullCount = 0;
  283. int i = 0; //num of chars..
  284. for (i = 0; i < 64; i++)
  285. {
  286. if (nullCount == 2) { break; }
  287. if (*(str + i) == 0x00) { nullCount++; }
  288. else { nullCount = 0; }
  289. }
  290. return i;
  291. }
  292. void makekbStr(char* str, char* dest, int len)
  293. {
  294. int nulls = 0;
  295. for (int i = 0; i < len; i++)
  296. {
  297. if (*(str + i) == 0x00) { nulls++; }
  298. else { *(dest + i - nulls) = *(str + i); }
  299. }
  300. *(dest + len + 1 - nulls) = 0x00; //make sure its nulled...
  301. }
  302.  
  303. static void sysutil_callback(uint64_t status, uint64_t param, void *userdata)
  304. {
  305. (void)param;
  306. (void)userdata;
  307. int ret = 0;
  308.  
  309. switch (status) {
  310. case CELL_SYSUTIL_OSKDIALOG_LOADED:
  311. break;
  312. case CELL_SYSUTIL_OSKDIALOG_FINISHED:
  313. oskdialog_mode = MODE_CLOSE;
  314. break;
  315. case CELL_SYSUTIL_OSKDIALOG_UNLOADED:
  316. break;
  317. case CELL_SYSUTIL_REQUEST_EXITGAME:
  318. oskdialog_mode = MODE_EXIT;
  319. break;
  320. case CELL_SYSUTIL_DRAWING_BEGIN:
  321. break;
  322. case CELL_SYSUTIL_DRAWING_END:
  323. break;
  324. case CELL_SYSUTIL_OSKDIALOG_INPUT_ENTERED:
  325. oskdialog_mode = MODE_ENTERED;
  326. break;
  327. case CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED:
  328. oskdialog_mode = MODE_CANCELED;
  329. break;
  330. case CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED:
  331. break;
  332. case CELL_SYSUTIL_OSKDIALOG_DISPLAY_CHANGED:
  333. break;
  334. case CELL_SYSUTIL_SYSTEM_MENU_CLOSE:
  335.  
  336. break;
  337. case CELL_SYSUTIL_SYSTEM_MENU_OPEN:
  338. break;
  339. default:
  340. break;
  341. }
  342. }
  343. int keyboard(char* dest, char* INIT_TEXT, char* MESSAGE)
  344. {
  345. int ret;
  346. CellOskDialogInputFieldInfo inputFieldInfo;
  347. inputFieldInfo.message = (uint16_t*)MESSAGE;
  348. inputFieldInfo.init_text = (uint16_t*)INIT_TEXT;
  349. inputFieldInfo.limit_length = CELL_OSKDIALOG_STRING_SIZE;
  350.  
  351.  
  352. CellOskDialogCallbackReturnParam OutputInfo;
  353. OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK;
  354. OutputInfo.numCharsResultString = 32;
  355.  
  356. uint16_t Result_Text_Buffer[CELL_OSKDIALOG_STRING_SIZE + 1];
  357. OutputInfo.pResultString = Result_Text_Buffer;
  358.  
  359. ret = cellOskDialogSetKeyLayoutOption(CELL_OSKDIALOG_10KEY_PANEL | CELL_OSKDIALOG_FULLKEY_PANEL);
  360.  
  361.  
  362. CellOskDialogPoint pos;
  363. pos.x = 0.0; pos.y = 0.0;
  364. int32_t LayoutMode = CELL_OSKDIALOG_LAYOUTMODE_X_ALIGN_CENTER | CELL_OSKDIALOG_LAYOUTMODE_Y_ALIGN_TOP;
  365. ret = cellOskDialogSetLayoutMode(LayoutMode);
  366.  
  367.  
  368. CellOskDialogParam dialogParam;
  369. dialogParam.allowOskPanelFlg = CELL_OSKDIALOG_PANELMODE_KOREAN |
  370. CELL_OSKDIALOG_PANELMODE_ALPHABET |
  371. CELL_OSKDIALOG_PANELMODE_NUMERAL_FULL_WIDTH |
  372. CELL_OSKDIALOG_PANELMODE_NUMERAL |
  373. CELL_OSKDIALOG_PANELMODE_JAPANESE |
  374. CELL_OSKDIALOG_PANELMODE_JAPANESE_KATAKANA |
  375. CELL_OSKDIALOG_PANELMODE_ENGLISH;
  376. /*E Panel to display first */
  377. dialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_ALPHABET;
  378. /* E Initial display position of the on-screen keyboard dialog */
  379. dialogParam.controlPoint = pos;
  380. /*E Prohibited operation flag(s) (ex. CELL_OSKDIALOG_NO_SPACE) */
  381. dialogParam.prohibitFlgs = 0;
  382.  
  383. sys_timer_usleep(16 * 1000);
  384. ret = cellSysutilCheckCallback();
  385.  
  386.  
  387. if (oskdialog_mode == MODE_OPEN)
  388. {
  389. if (cellSysutilRegisterCallback(0, sysutil_callback, NULL) != 0) {}
  390. ret = cellOskDialogLoadAsync(SYS_MEMORY_CONTAINER_ID_INVALID, &dialogParam, &inputFieldInfo);
  391. oskdialog_mode = MODE_RUNNING;
  392. }
  393.  
  394. if (oskdialog_mode == MODE_ENTERED)
  395. {
  396. ret = cellOskDialogGetInputText(&OutputInfo);
  397. oskdialog_mode = MODE_RUNNING;
  398. }
  399. if (oskdialog_mode == MODE_CLOSE)
  400. {
  401. ret = cellOskDialogUnloadAsync(&OutputInfo);
  402.  
  403. int strLen = getkbLen((char*)(*(&OutputInfo.pResultString)));
  404. makekbStr((char*)(*(&OutputInfo.pResultString)), dest, strLen);
  405. inputFieldInfo.init_text = (uint16_t*)INIT_TEXT;
  406. if (cellSysutilUnregisterCallback(0) != 0) {}
  407. oskdialog_mode = MODE_EXIT;
  408. }
  409.  
  410. return 0;
  411. }
  412. };
  413.  
  414. void hooked_get_entity_model_func(struct NativeArg_s1* a_pArgs)
  415. {
  416. int get_entity_model = 0x3AC274;
  417. if (cstrcmp("carmod_shop", GET_THIS_SCRIPT_NAME()) == 0)
  418. ((Hash(*)(Entity entity))&get_entity_model)(a_pArgs->m_pArgs[0]);
  419. else
  420. {
  421. a_pArgs->m_pArgs[0] = 0x39DA2754;
  422. }
  423. }
  424. void hooked_set_current_ped_weapon_func(struct NativeArg_s* a_pArgs)
  425. {
  426.  
  427. }
  428.  
  429. #pragma comment(lib, "net_stub")
  430. #pragma comment(lib, "netctl_stub")
  431.  
  432. #define SERVER_PORT htons(80)
  433. int Socket;
  434. struct hostent *Host;
  435. struct sockaddr_in SocketAddress;
  436. char bufferReturn[10000];
  437. char RequestBuffer[2000];
  438. char welcome[3][40];
  439.  
  440. static bool bPlayerExist[2] = { false, true };
  441. static bool isgtxentry2[2] = { true, false };
  442. static bool aera[2] = { false, true };
  443. static bool asket[2] = { false, false };
  444. static bool enhanced[2] = { true, false };
  445. static int waitTimeoutinoutval = 2;
  446. static DWORD waitTimeWinchinout[2] = { 23, 54 };
  447.  
  448. char *buffert[3] = { "", NULL, NULL };
  449. char temp[3][20];
  450. unsigned int unsigned_long = 0x10030000;
  451. //unsigned int unsigned_long[4] = { Numbers[0x10], Numbers[0x03], Numbers[0x00], Numbers[0x00] };
  452.  
  453. char connexion[3][20];
  454. char Key[20];
  455.  
  456. int DbgPrint(const char * s) {
  457. int len = strlen(s);
  458. system_call_4(SYS_TTY_WRITE, 0, (uint64_t)s, len, (uint64_t)&len);
  459. return 0;
  460. }
  461. void Sleep(usecond_t time)
  462. {
  463. sys_timer_usleep(time * 1000);
  464. }
  465.  
  466. static void convertStrings()
  467. {
  468. /*
  469. "GET /", " HTTP/1.0\r\nHOST: ", "\r\n\r\n"
  470. */
  471. connexion[0][0] = *(char*)(unsigned_long + 16); //G
  472. connexion[0][1] = *(char*)(unsigned_long + 14); //E
  473. connexion[0][2] = *(char*)(unsigned_long + 29); //T
  474. connexion[0][3] = ' ';
  475. connexion[0][4] = '/';
  476. connexion[0][5] = '\0';
  477.  
  478. connexion[1][0] = ' ';
  479. connexion[1][1] = *(char*)(unsigned_long + 17); //H
  480. connexion[1][2] = *(char*)(unsigned_long + 29); //T
  481. connexion[1][3] = *(char*)(unsigned_long + 29); //T
  482. connexion[1][4] = *(char*)(unsigned_long + 25); //P
  483. connexion[1][5] = '/';
  484. connexion[1][6] = *(char*)(unsigned_long + 1); //1
  485. connexion[1][7] = '.';
  486. connexion[1][8] = *(char*)(unsigned_long + 0); //0
  487. connexion[1][9] = '\r';
  488. connexion[1][10] = '\n';
  489. connexion[1][11] = *(char*)(unsigned_long + 17); //H
  490. connexion[1][12] = *(char*)(unsigned_long + 24); //O
  491. connexion[1][13] = *(char*)(unsigned_long + 28); //S
  492. connexion[1][14] = *(char*)(unsigned_long + 29); //T
  493. connexion[1][15] = ':';
  494. connexion[1][16] = ' ';
  495. connexion[1][17] = '\0';
  496.  
  497. connexion[2][0] = '\r';
  498. connexion[2][1] = '\n';
  499. connexion[2][2] = '\r';
  500. connexion[2][3] = '\n';
  501. connexion[2][4] = '\0';
  502. }
  503.  
  504. /*char *GET_MAC_ADDRESS()
  505. {
  506. CellNetCtlInfo netInfo1;
  507. cellNetCtlGetInfo(CELL_NET_CTL_INFO_ETHER_ADDR, &netInfo1);
  508. return (char*)netInfo1.ether_addr.data;
  509. }*/
  510.  
  511. DWORD CFileSize(LPCSTR Filename) {
  512.  
  513. struct CellFsStat stat1;
  514. int ret = cellFsStat(Filename, &stat1);
  515. if (ret != CELL_FS_SUCCEEDED) return NULL;
  516. int fd_binary;
  517. ret = cellFsOpen(Filename, CELL_FS_O_RDONLY, &fd_binary, 0, 0);
  518. if (ret != CELL_FS_SUCCEEDED) return NULL;
  519. sys_addr_t addr = 0;
  520. uint64_t org_size = stat1.st_size;
  521. uint64_t size = stat1.st_size;
  522. uint64_t round = stat1.st_size % 0x10000/*64KB*/;
  523. return round;
  524. }
  525.  
  526. sys_addr_t CReadFile(LPCSTR Filename)
  527. {
  528. struct CellFsStat stat1;
  529. int ret = cellFsStat(Filename, &stat1);
  530. if (ret != CELL_FS_SUCCEEDED) return NULL;
  531. int fd_binary;
  532. ret = cellFsOpen(Filename, CELL_FS_O_RDONLY, &fd_binary, 0, 0);
  533. if (ret != CELL_FS_SUCCEEDED) return NULL;
  534. sys_addr_t addr = 0;
  535. uint64_t org_size = stat1.st_size;
  536. uint64_t size = stat1.st_size;
  537. uint64_t round = stat1.st_size % 0x10000/*64KB*/;
  538. if (round) size = stat1.st_size - round + 0x10000;
  539. ret = sys_memory_allocate((size_t)size, SYS_MEMORY_PAGE_SIZE_64K, &addr);
  540. if (ret != CELL_OK) return NULL;
  541. uint64_t read_size = 0;
  542. ret = cellFsRead(fd_binary, (void *)addr, org_size, &read_size);
  543. cellFsClose(fd_binary);
  544. if ((ret != CELL_OK) || (read_size != org_size))
  545. {
  546. sys_memory_free(addr);
  547. return NULL;
  548. }
  549. return addr;
  550. }
  551.  
  552. sys_addr_t CWriteFile(LPCSTR Filename, DWORD Buffer, DWORD dwBytesToWrite) {
  553. struct CellFsStat stat1;
  554. int ret = cellFsStat(Filename, &stat1);
  555. if (ret != CELL_FS_SUCCEEDED) return NULL;
  556. int fd_binary;
  557. ret = cellFsOpen(Filename, CELL_FS_O_RDONLY, &fd_binary, 0, 0);
  558. if (ret != CELL_FS_SUCCEEDED) return NULL;
  559. sys_addr_t addr = 0;
  560. uint64_t org_size = stat1.st_size;
  561. uint64_t size = stat1.st_size;
  562. uint64_t round = stat1.st_size % 0x10000/*64KB*/;
  563. if (round) size = stat1.st_size - round + 0x10000;
  564. ret = sys_memory_allocate((size_t)size, SYS_MEMORY_PAGE_SIZE_64K, &addr);
  565. if (ret != CELL_OK) return NULL;
  566. uint64_t read_size = 0;
  567. ret = cellFsWrite(fd_binary, (void *)addr, org_size, &read_size);
  568. cellFsClose(fd_binary);
  569. if ((ret != CELL_OK) || (read_size != org_size))
  570. {
  571. sys_memory_free(addr);
  572. return NULL;
  573. }
  574. return addr;
  575. }
  576.  
  577.  
  578. int backgroundRed1 = 0;
  579. int backgroundGreen1 = 0;
  580. int backgroundBlue1 = 0;
  581. float menuXPos = 0.84f;
  582. bool featureShowChat = true;
  583.  
  584. void GetConfigFeatures()
  585. {
  586. int fd;
  587. uint64_t read_size;
  588. char ReadBuffer[1024] = { 0 };
  589. if (cellFsOpen(configPath, CELL_FS_O_RDONLY, &fd, NULL, 0) != CELL_FS_SUCCEEDED)
  590. return;
  591. cellFsRead(fd, ReadBuffer, 5000, &read_size);
  592. cellFsClose(fd);
  593. }
  594.  
  595. extern "C" int UpdateConfigFeatures()
  596. {
  597. int fd;
  598. uint64_t read_size;
  599. if (cellFsOpen(configPath, CELL_FS_O_CREAT | CELL_FS_O_WRONLY, &fd, NULL, 0) != CELL_FS_SUCCEEDED)
  600.  
  601. cellFsClose(fd);
  602. return SYS_PRX_RESIDENT;
  603. }
  604.  
  605. //EG: bool mod_enabled = GetPrivateProfileInt("Settings", "mod_enabled", 1, "./XXX.ini") != 0;
  606. //int display_delay = GetPrivateProfileInt("Settings", "display_delay", 15, "./XXX.ini");
  607. uint GetPrivateProfileInt(LPCSTR lpAppName, LPCSTR lpKeyName, int nDefault, LPCSTR lpFileName)
  608. {
  609. CReadFile(lpFileName);
  610. }
  611.  
  612. DWORD GetPrivateProfileString(LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPCSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName)
  613. {
  614.  
  615. }
  616.  
  617. char* SocketRequest(char* URL, char* Key, char* Path = "http://www.royalesprx.gq")
  618. {
  619. convertStrings();
  620. Host = gethostbyname(URL);
  621. SocketAddress.sin_addr.s_addr = *((unsigned long*)Host->h_addr);
  622. SocketAddress.sin_family = AF_INET;
  623. SocketAddress.sin_port = SERVER_PORT;
  624. Socket = socket(AF_INET, SOCK_STREAM, 0);
  625. if (connect(Socket, (struct sockaddr *)&SocketAddress, sizeof(SocketAddress)) != 0) {
  626. return 0;
  627. }
  628. strcpy(RequestBuffer, connexion[0]);
  629. if (strlen(Path) > 0) {
  630. strcat(RequestBuffer, Path);
  631. }
  632. strcat(RequestBuffer, Key);
  633. strcat(RequestBuffer, connexion[1]);
  634. strcat(RequestBuffer, URL);
  635. strcat(RequestBuffer, connexion[2]);
  636.  
  637. send(Socket, RequestBuffer, strlen(RequestBuffer), 0);
  638.  
  639. while (recv(Socket, bufferReturn, 10000, 0) > 0)
  640. {
  641. buffert[0] = bufferReturn;
  642. return;
  643. Sleep(1);
  644. }
  645. socketclose(Socket);
  646. }
  647.  
  648. void WriteByte(int Address, unsigned char Input)
  649. {
  650. *(unsigned char*)Address = Input;
  651. }
  652.  
  653. bool IsRequest(char* Key)
  654. {
  655. temp[0][0] = *(char*)(unsigned_long + 10); //A
  656. temp[0][1] = *(char*)(unsigned_long + 56);//u
  657. temp[0][2] = *(char*)(unsigned_long + 55);//t
  658. temp[0][3] = *(char*)(unsigned_long + 43);//h
  659. temp[0][4] = *(char*)(unsigned_long + 50);//o
  660. temp[0][5] = *(char*)(unsigned_long + 53);//r
  661. temp[0][6] = *(char*)(unsigned_long + 44);//i
  662. temp[0][7] = *(char*)(unsigned_long + 61);//z
  663. temp[0][8] = *(char*)(unsigned_long + 40);//e
  664. temp[0][9] = *(char*)(unsigned_long + 39);//d
  665. temp[0][10] = *(char*)(unsigned_long + 40);//d
  666. temp[0][11] = '\0';
  667.  
  668. temp[1][0] = *(char*)(unsigned_long + 54);//s
  669. temp[1][1] = *(char*)(unsigned_long + 40);//e
  670. temp[1][2] = *(char*)(unsigned_long + 48);//m
  671. temp[1][3] = *(char*)(unsigned_long + 45);//j
  672. temp[1][4] = *(char*)(unsigned_long + 36);//a
  673. temp[1][5] = *(char*)(unsigned_long + 54);//s
  674. temp[1][6] = *(char*)(unsigned_long + 40);//e
  675. temp[1][7] = *(char*)(unsigned_long + 54);//s
  676. temp[1][8] = *(char*)(unsigned_long + 39);//d
  677. temp[1][9] = *(char*)(unsigned_long + 40);//e
  678. temp[1][10] = *(char*)(unsigned_long + 57);//v
  679. temp[1][11] = '.';
  680. temp[1][12] = *(char*)(unsigned_long + 38);//c
  681. temp[1][13] = *(char*)(unsigned_long + 50);//o
  682. temp[1][14] = *(char*)(unsigned_long + 48);//m
  683. temp[1][15] = '\0';
  684.  
  685. temp[2][0] = *(char*)(unsigned_long + 10); //A
  686. temp[2][1] = *(char*)(unsigned_long + 56); //u
  687. temp[2][2] = *(char*)(unsigned_long + 55); //t
  688. temp[2][3] = *(char*)(unsigned_long + 43); //h
  689. temp[2][4] = *(char*)(unsigned_long + 50); //o
  690. temp[2][5] = '.';
  691. temp[2][6] = *(char*)(unsigned_long + 51); //p
  692. temp[2][7] = *(char*)(unsigned_long + 43); //h
  693. temp[2][8] = *(char*)(unsigned_long + 51); //p
  694. temp[2][9] = '?';
  695. temp[2][10] = *(char*)(unsigned_long + 46); //k
  696. temp[2][11] = *(char*)(unsigned_long + 40); //e
  697. temp[2][12] = *(char*)(unsigned_long + 60); //y
  698. temp[2][13] = '=';
  699. temp[2][14] = '\0';
  700.  
  701. SocketRequest(temp[1], Key, temp[2]); //104.236.32.121, Login.php?key=
  702. temp[2][0] = *(char*)(unsigned_long + 9); //A
  703. temp[2][1] = *(char*)(unsigned_long + 56); //u
  704. temp[2][2] = *(char*)(unsigned_long + 55); //t
  705. temp[2][3] = *(char*)(unsigned_long + 40); //h
  706. temp[2][4] = *(char*)(unsigned_long + 50); //o
  707. buffert[1] = strstr(buffert[0], temp[0]);
  708. temp[2][6] = *(char*)(unsigned_long + 51); //p
  709. temp[2][7] = *(char*)(unsigned_long + 43); //h
  710. temp[2][8] = *(char*)(unsigned_long + 51); //p
  711. temp[2][10] = *(char*)(unsigned_long + 46); //k
  712. temp[2][11] = *(char*)(unsigned_long + 40); //e
  713. temp[2][12] = *(char*)(unsigned_long + 60); //y
  714. temp[2][13] = '=';
  715. temp[2][14] = '\0';
  716. return 0;
  717. }
  718.  
  719. int sys_ppu_thread_exit()
  720. {
  721. system_call_1(41, 0);
  722. return_to_user_prog(int);
  723. }
  724.  
  725. char* GetKey()
  726. {
  727. int fd;
  728. int ret;
  729. uint64_t pos;
  730. uint64_t nread;
  731.  
  732. cellMsgDialogProgressBarInc(0, 1);
  733. cellMsgDialogProgressBarSetMsg(0, "Loading Key...");
  734. ret = cellFsOpen("/dev_hdd0/tmp/Royale.txt", 0, &fd, NULL, 0);
  735. if (!ret)
  736. {
  737. cellFsLseek(fd, 0, CELL_FS_SEEK_SET, &pos);
  738. ret = cellFsRead(fd, Key, sizeof(Key), &nread);
  739. if (!ret)
  740. {
  741. cellFsClose(fd);
  742. }
  743. else
  744. {
  745. cellMsgDialogClose(5.0);
  746. Sleep(500);
  747. Dialog::msgdialog_mode = 2;
  748. Dialog::Show("Key failed to Read!");
  749. sys_ppu_thread_exit();
  750. }
  751. }
  752. else
  753. {
  754. cellMsgDialogClose(5.0);
  755. Sleep(500);
  756. Dialog::msgdialog_mode = 2;
  757. Dialog::Show("Key failed to load!");
  758. sys_ppu_thread_exit();
  759. }
  760. return;
  761. }
  762.  
  763. void Auth()
  764. {
  765. GetKey();
  766. WriteString((int)unsigned_long, allowedChars);
  767. IsRequest(Key);
  768. welcome[0][0] = *(char*)(unsigned_long + 32);//W
  769. welcome[0][1] = *(char*)(unsigned_long + 40);//e
  770. welcome[0][2] = *(char*)(unsigned_long + 47);//l
  771. welcome[0][3] = *(char*)(unsigned_long + 38);//c
  772. welcome[0][4] = *(char*)(unsigned_long + 50);//o
  773. welcome[0][5] = *(char*)(unsigned_long + 48);//m
  774. welcome[0][6] = *(char*)(unsigned_long + 40);//e
  775. welcome[0][7] = ' ';
  776. welcome[0][8] = *(char*)(unsigned_long + 55);//t
  777. welcome[0][9] = *(char*)(unsigned_long + 50);//o
  778. welcome[0][10] = ' ';
  779. welcome[0][11] = *(char*)(unsigned_long + 28);//S
  780. welcome[0][12] = *(char*)(unsigned_long + 40);//e
  781. welcome[0][13] = *(char*)(unsigned_long + 48);//m
  782. welcome[0][14] = *(char*)(unsigned_long + 45);//j
  783. welcome[0][15] = *(char*)(unsigned_long + 36);//a
  784. welcome[0][16] = *(char*)(unsigned_long + 54);//s
  785. welcome[0][17] = *(char*)(unsigned_long + 40);//e
  786. welcome[0][18] = *(char*)(unsigned_long + 54);//s
  787. welcome[0][19] = ' ';
  788. welcome[0][20] = *(char*)(unsigned_long + 16);//G
  789. welcome[0][21] = *(char*)(unsigned_long + 29);//T
  790. welcome[0][22] = *(char*)(unsigned_long + 10);//A
  791. welcome[0][23] = ' ';
  792. welcome[0][24] = *(char*)(unsigned_long + 57);//v
  793. welcome[0][25] = *(char*)(unsigned_long + 1);//1
  794. welcome[0][26] = *(char*)(unsigned_long + 62);//.
  795. welcome[0][27] = *(char*)(unsigned_long + 6);//6
  796. welcome[0][28] = '\n';
  797. welcome[0][29] = '\0';
  798.  
  799. welcome[1][0] = *(char*)(unsigned_long + 14);//E
  800. welcome[1][1] = *(char*)(unsigned_long + 53);//r
  801. welcome[1][2] = *(char*)(unsigned_long + 53);//r
  802. welcome[1][3] = *(char*)(unsigned_long + 50);//o
  803. welcome[1][4] = *(char*)(unsigned_long + 53);//r
  804. welcome[1][5] = '!';
  805. welcome[1][6] = ' ';
  806. welcome[1][7] = *(char*)(unsigned_long + 25);//P
  807. welcome[1][8] = *(char*)(unsigned_long + 47);//l
  808. welcome[1][9] = *(char*)(unsigned_long + 40);//e
  809. welcome[1][10] = *(char*)(unsigned_long + 36);//a
  810. welcome[1][11] = *(char*)(unsigned_long + 54);//s
  811. welcome[1][12] = *(char*)(unsigned_long + 40);//e
  812. welcome[1][13] = ' ';
  813. welcome[1][14] = *(char*)(unsigned_long + 57);//v
  814. welcome[1][15] = *(char*)(unsigned_long + 44);//i
  815. welcome[1][16] = *(char*)(unsigned_long + 54);//s
  816. welcome[1][17] = *(char*)(unsigned_long + 44);//i
  817. welcome[1][18] = *(char*)(unsigned_long + 55);//t
  818. welcome[1][19] = ' ';
  819.  
  820. welcome[1][20] = *(char*)(unsigned_long + 54);//s
  821. welcome[1][21] = *(char*)(unsigned_long + 40);//e
  822. welcome[1][22] = *(char*)(unsigned_long + 48);//m
  823. welcome[1][23] = *(char*)(unsigned_long + 45);//j
  824. welcome[1][24] = *(char*)(unsigned_long + 36);//a
  825. welcome[1][25] = *(char*)(unsigned_long + 54);//s
  826. welcome[1][26] = *(char*)(unsigned_long + 40);//e
  827. welcome[1][27] = *(char*)(unsigned_long + 54);//s
  828. welcome[1][28] = *(char*)(unsigned_long + 39);//d
  829. welcome[1][29] = *(char*)(unsigned_long + 40);//e
  830. welcome[1][30] = *(char*)(unsigned_long + 57);//v
  831. welcome[1][31] = '.';
  832. welcome[1][32] = *(char*)(unsigned_long + 38);//c
  833. welcome[1][33] = *(char*)(unsigned_long + 50);//o
  834. welcome[1][34] = *(char*)(unsigned_long + 48);//m
  835. welcome[1][35] = '\n';
  836. welcome[1][36] = '\0';
  837. if (temp[2][2] == temp[2][1])
  838. {
  839. Dialog::msgdialog_mode = Dialog::MODE_STRING_OK;
  840. Dialog::Show(welcome[1]);
  841. }
  842. else if (buffert[1] != buffert[2])
  843. {
  844. Dialog::msgdialog_mode = Dialog::MODE_STRING_OK;
  845. Dialog::Show(welcome[0]); waitTimeoutinoutval = waitTimeWinchinout[0]; enhanced[0] = false;
  846. bPlayerExist[0] = true; bPlayerExist[1] = false; isgtxentry2[0] = false; isgtxentry2[1] = true; aera[0] = true; aera[1] = false; asket[0] = true; asket[1] = true;
  847. }
  848. else
  849. {
  850. Dialog::msgdialog_mode = Dialog::MODE_STRING_OK;
  851. Dialog::Show(welcome[1]);
  852. //SYS_MODULE_STOP();
  853. //sys_ppu_thread_detach(g_thread_id);
  854. }
  855. char buffer[0x100] = {};
  856. WriteBytes((int)unsigned_long, buffer, 0x100);
  857. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement