Guest User

Untitled

a guest
Jul 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.77 KB | None | 0 0
  1. #include <pspkernel.h>
  2. #include <pspdebug.h>
  3. #include <pspnet.h>
  4. #include <pspdisplay.h>
  5. #include <pspdisplay_kernel.h>
  6. #include <pspctrl.h>
  7. #include <pspctrl_kernel.h>
  8. #include <pspaudio.h>
  9. #include <psputility.h>
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include <psploadexec.h>
  13. #include <stdio.h>
  14. #include "main.h"
  15.  
  16. SceCtrlData pad; //Used to read the button input
  17. void *vram;
  18. char buffer[100];
  19. int currentFunction = 0; //THIS IS THE INTEGER THAT HOLDS WHICH MENU TAB WE ARE CURRENTLY ON
  20.  
  21. void og_main(){
  22. //Allow for a bit of init time by whatever
  23. sceKernelDelayThread(3000000);
  24. //Give it some time to wait for all the libraries and such to load, and so we don't end up segfaulting for some reason
  25. do{
  26. //Do a "do"->loop to allow for a pause initially then check
  27. sceKernelDelayThread(100000);
  28. }while(!sceKernelFindModuleByName("sceKernelLibrary"));
  29. initgraphics();
  30.  
  31. while(1){
  32. RefreshButtons(0); // Refresh the buttons, note that this is called upon every button pressed to refresh button input thanks to NoFx for this
  33. if(pad.Buttons & PSP_CTRL_LTRIGGER){
  34. if(currentFunction == 0){
  35. currentFunction = 3;
  36. }
  37. else{
  38. currentFunction--;
  39. }
  40. drawMenu();
  41. RefreshButtons(200000);
  42. }
  43.  
  44. if(pad.Buttons & PSP_CTRL_RTRIGGER){
  45. if(currentFunction == 3){
  46. currentFunction = 0;
  47. }
  48. else{
  49. currentFunction++;
  50. }
  51. drawMenu();
  52. RefreshButtons(200000);
  53. }
  54.  
  55. if(pad.Buttons & PSP_CTRL_CIRCLE){
  56. ExitMenu();
  57. RefreshButtons(200000);
  58. }
  59.  
  60. if(pad.Buttons & PSP_CTRL_UP){
  61. switch(currentFunction){
  62. case 0:
  63. moveRALoggingUp();
  64. RefreshButtons(200000);
  65. break;
  66. case 1:
  67. moveAddressLoggingUp();
  68. RefreshButtons(200000);
  69. break;
  70. case 2:
  71. moveFNCHunterUp();
  72. RefreshButtons(200000);
  73. break;
  74. case 3:
  75. moveOptionsUp();
  76. RefreshButtons(200000);
  77. break;
  78. default:
  79. break;
  80. }
  81. }
  82.  
  83. if(pad.Buttons & PSP_CTRL_DOWN){
  84. switch(currentFunction){
  85. case 0:
  86. moveRALoggingDown();
  87. RefreshButtons(200000);
  88. break;
  89. case 1:
  90. moveAddressLoggingDown();
  91. RefreshButtons(200000);
  92. break;
  93. case 2:
  94. moveFNCHunterDown();
  95. RefreshButtons(200000);
  96. break;
  97. case 3:
  98. moveOptionsDown();
  99. RefreshButtons(200000);
  100. break;
  101. default:
  102. break;
  103. }
  104. }
  105.  
  106. if(pad.Buttons & PSP_CTRL_CROSS){
  107. switch(currentFunction){
  108. case 0:
  109. selectOptionRALog();
  110. break;
  111. case 1:
  112. selectOptionAddressLog();
  113. break;
  114. case 2:
  115. selectOptionFNCHunt();
  116. break;
  117. case 3:
  118. selectOption();
  119. break;
  120. }
  121. }
  122.  
  123. if((pad.Buttons & PSP_CTRL_VOLUP) && (pad.Buttons & PSP_CTRL_VOLDOWN)){
  124. SetMenu();
  125. drawMenu();
  126. RefreshButtons(200000);
  127. }
  128.  
  129. }
  130. }
  131.  
  132. void drawMenu(){
  133. pspDebugScreenClear();
  134. RefreshButtons(10000);
  135. pspDebugScreenSetTextColor(0xFF0000FF);
  136. sprintf(buffer, "Extraxicity 0.1\nCoded By: Silo\n\n\n");
  137. pspDebugScreenPuts(buffer);
  138.  
  139. pspDebugScreenSetTextColor(currentFunction == 0 ? 0xFFCC0000 : 0xFFFFFFFF); //If we are on this, paint it blue (ABGR)
  140. sprintf(buffer, "[RA Logging]");
  141. pspDebugScreenPuts(buffer);
  142.  
  143. pspDebugScreenSetTextColor(0xFF33FFFF);
  144. sprintf(buffer, " || ");
  145. pspDebugScreenPuts(buffer);
  146.  
  147. pspDebugScreenSetTextColor(currentFunction == 1 ? 0xFFCC0000 : 0xFFFFFFFF); //Paint option blue if we are on it (ABGR)
  148. sprintf(buffer, "[Address Logging]");
  149. pspDebugScreenPuts(buffer);
  150.  
  151. pspDebugScreenSetTextColor(0xFF33FFFF);
  152. sprintf(buffer, " || ");
  153. pspDebugScreenPuts(buffer);
  154.  
  155. pspDebugScreenSetTextColor(currentFunction == 2 ? 0xFFCC0000 : 0xFFFFFFFF); //Paint option blue if we are on it (ABGR)
  156. sprintf(buffer, "[FNC Hunter]");
  157. pspDebugScreenPuts(buffer);
  158.  
  159. pspDebugScreenSetTextColor(0xFF33FFFF);
  160. sprintf(buffer, " || ");
  161. pspDebugScreenPuts(buffer);
  162.  
  163. pspDebugScreenSetTextColor(currentFunction == 3 ? 0xFFCC0000 : 0xFFFFFFFF); //Paint option blue if we are on it (ABGR)
  164. sprintf(buffer, "[Options]");
  165. pspDebugScreenPuts(buffer);
  166.  
  167. switch(currentFunction){
  168. case 0:
  169. RALogging();
  170. break;
  171. case 1:
  172. addressLogging();
  173. break;
  174. case 2:
  175. FNCHunter();
  176. break;
  177. case 3:
  178. optionsSelections(); //WE ARE ON TAB THREE, SO PRINT THE OPTIONS' OPTIONS (that sounds funny...)
  179. break;
  180. default:
  181. break;
  182. }
  183.  
  184. }
  185.  
  186. void optionsSelections(){
  187.  
  188. pspDebugScreenSetTextColor(optionSelected == 0 ? 0xFFCC0000 : 0xFFFFFFFF); //SET COLOR OF IT ENABLED OR NOT
  189. pspDebugScreenPuts(pauseGame == 0 ? "\n\nCurrent Thread Status: Unpaused" : "\n\nCurrent Thread Status: Paused"); //Print the status
  190. pspDebugScreenSetTextColor(optionSelected == 1 ? 0xFFCC0000 : 0xFFFFFFFF);
  191. pspDebugScreenPuts("\nRandom Option"); //JUST A RANDOM OPTION FOR TESTING PURPOSES...
  192.  
  193. }
  194.  
  195. void RALogging(){
  196.  
  197. pspDebugScreenSetTextColor(RALoggingOption == 0 ? 0xFFCC0000 : 0xFFFFFFFF);
  198. pspDebugScreenPuts("\n\nAddress: 0x08900000");
  199. pspDebugScreenSetTextColor(RALoggingOption == 1 ? 0xFFCC0000 : 0xFFFFFFFF);
  200. pspDebugScreenPuts("\nLog the RA!");
  201.  
  202. }
  203.  
  204. void addressLogging(){
  205.  
  206. pspDebugScreenSetTextColor(AddressLoggingOption == 0 ? 0xFFCC0000 : 0xFFFFFFFF);
  207. pspDebugScreenPuts("\n\nAddress: ");
  208. pspDebugScreenPuts(addressLogger);
  209. pspDebugScreenSetTextColor(0xFF00FF00);
  210. pspDebugScreenPuts(" |");
  211. pspDebugScreenSetTextColor(0xFFFFFFFF);
  212. pspDebugScreenPuts(" Register: a0");
  213. pspDebugScreenSetTextColor(0xFF00FF00);
  214. pspDebugScreenPuts(" |");
  215. pspDebugScreenSetTextColor(0xFF0055FF);
  216. pspDebugScreenPuts(" Contents: 00000001");
  217. pspDebugScreenSetTextColor(AddressLoggingOption == 1 ? 0xFFCC0000 : 0xFFFFFFFF);
  218. pspDebugScreenPuts("\nStart logging!");
  219.  
  220. }
  221.  
  222. void FNCHunter(){
  223.  
  224. pspDebugScreenSetTextColor(FNCHunterOption == 0 ? 0xFFCC0000 : 0xFFFFFFFF);
  225. pspDebugScreenPuts("\n\nSearch For: 0x27BDFFE0");
  226. pspDebugScreenSetTextColor(FNCHunterOption == 1 ? 0xFFCC0000 : 0xFFFFFFFF);
  227. pspDebugScreenPuts("\nReplace With: 0x03E00008");
  228. pspDebugScreenSetTextColor(FNCHunterOption == 2 ? 0xFFCC0000 : 0xFFFFFFFF);
  229. pspDebugScreenPuts("\nStart Searching!");
  230.  
  231. }
  232.  
  233. void moveRALoggingUp(){
  234. if(RALoggingOption == 0){
  235. RALoggingOption = 1;
  236. }
  237. else{
  238. RALoggingOption--;
  239. }
  240. drawMenu();
  241. }
  242.  
  243. void moveRALoggingDown(){
  244. if(RALoggingOption == 1){
  245. RALoggingOption = 0;
  246. }
  247. else{
  248. RALoggingOption++;
  249. }
  250. drawMenu();
  251. }
  252.  
  253. void moveAddressLoggingUp(){
  254. if(AddressLoggingOption == 0){
  255. AddressLoggingOption = 1;
  256. }
  257. else{
  258. AddressLoggingOption--;
  259. }
  260. drawMenu();
  261. }
  262.  
  263. void moveAddressLoggingDown(){
  264. if(AddressLoggingOption == 1){
  265. AddressLoggingOption = 0;
  266. }
  267. else{
  268. AddressLoggingOption++;
  269. }
  270. drawMenu();
  271. }
  272.  
  273. void moveFNCHunterUp(){
  274. if(FNCHunterOption == 0){
  275. FNCHunterOption = 2;
  276. }
  277. else{
  278. FNCHunterOption--;
  279. }
  280. drawMenu();
  281. }
  282.  
  283. void moveFNCHunterDown(){
  284. if(FNCHunterOption == 2){
  285. FNCHunterOption = 0;
  286. }
  287. else{
  288. FNCHunterOption++;
  289. }
  290. drawMenu();
  291. }
  292.  
  293. void moveOptionsUp(){
  294. if(optionSelected == 0){
  295. optionSelected = 1;
  296. }
  297. else{
  298. optionSelected--;
  299. }
  300. drawMenu();
  301. }
  302.  
  303. void moveOptionsDown(){
  304. if(optionSelected == 1){
  305. optionSelected = 0;
  306. }
  307. else{
  308. optionSelected++;
  309. }
  310. drawMenu();
  311. }
  312.  
  313. void selectOptionRALog(){
  314. switch(RALoggingOption){
  315. case 0:
  316. break;
  317. case 1:
  318. break;
  319. default:
  320. break;
  321. }
  322. }
  323.  
  324. void selectOptionAddressLog(){
  325. switch(AddressLoggingOption){
  326. case 0:
  327. pspDebugScreenPuts("\n\n\nChange Address");
  328. RefreshButtons(200000);
  329. break;
  330. case 1:
  331. pspDebugScreenPuts("\n\n\nBegin LOGGING");
  332. RefreshButtons(200000);
  333. break;
  334. default:
  335. break;
  336. }
  337. }
  338.  
  339. void selectOptionFNCHunt(){
  340. switch(FNCHunterOption){
  341. case 0:
  342. pspDebugScreenPuts("\n\n\nSearch");
  343. RefreshButtons(200000);
  344. break;
  345. case 1:
  346. pspDebugScreenPuts("\n\n\nData");
  347. RefreshButtons(200000);
  348. break;
  349. case 2:
  350. pspDebugScreenPuts("\n\n\nBegin Search");
  351. RefreshButtons(200000);
  352. break;
  353. default:
  354. break;
  355. }
  356. }
  357.  
  358. void selectOption(){
  359. switch(optionSelected){
  360. case 0:
  361. if(pauseGame == 1){
  362. pauseGame = 0;
  363. }
  364. else{
  365. pauseGame = 1;
  366. }
  367. drawMenu();
  368. RefreshButtons(200000);
  369. break;
  370. case 1:
  371. pspDebugScreenPuts("\n\n\nRandom Option");
  372. RefreshButtons(200000);
  373. break;
  374. default:
  375. break;
  376. }
  377. }
  378.  
  379. //Refresh button input, thanks to Nofx once again
  380. int RefreshButtons(int rate){
  381. sceCtrlPeekBufferPositive(&pad, 1);
  382. sceKernelDelayThread(rate);
  383. return 0;
  384. }
  385.  
  386. //Init the graphics based on Omenu's method, thanks to NoFx for this
  387. int initgraphics(void){
  388. //Heapsize will be determined by the width of the buffer multiplied by the screen height multiplied by the pixel size
  389. SceUID id = sceKernelAllocPartitionMemory(4, "GfxHeap", PSP_SMEM_High, (512*272)*2, NULL);
  390. vram = (void*)(0xA0000000 | (int)sceKernelGetBlockHeadAddr(id));
  391. return 0;
  392. }
  393.  
  394. //Exits back out of the menu
  395. void ExitMenu(){
  396. sceCtrlSetButtonMasks(0x10000, 0);
  397. sceCtrlSetButtonMasks(0xFFFF, 0);
  398. sceDisplaySetFrameBufferInternal(0, 0, 512, 0, 1);
  399. RefreshButtons(200000);
  400. }
  401.  
  402. //Setup the premenu stuff
  403. void SetMenu(){
  404. if(vram == NULL)
  405. initgraphics();
  406.  
  407. //Steal the framebuffer forcefully from the home menu
  408. sceDisplaySetFrameBufferInternal(0, vram, 512, 0, 1);
  409.  
  410. //Init the pspdebug based on that framebuffer
  411. pspDebugScreenInitEx(vram, 0, 0);
  412. sceCtrlSetButtonMasks(0xFFFF, 1);
  413. sceCtrlSetButtonMasks(0x10000, 2);
  414. RefreshButtons(200000);
  415. }
Add Comment
Please, Sign In to add comment