Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <pspkernel.h>
- #include <pspdebug.h>
- #include <pspnet.h>
- #include <pspdisplay.h>
- #include <pspdisplay_kernel.h>
- #include <pspctrl.h>
- #include <pspctrl_kernel.h>
- #include <pspaudio.h>
- #include <psputility.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <psploadexec.h>
- #include <stdio.h>
- #include "main.h"
- SceCtrlData pad; //Used to read the button input
- void *vram;
- char buffer[100];
- int currentFunction = 0; //THIS IS THE INTEGER THAT HOLDS WHICH MENU TAB WE ARE CURRENTLY ON
- void og_main(){
- //Allow for a bit of init time by whatever
- sceKernelDelayThread(3000000);
- //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
- do{
- //Do a "do"->loop to allow for a pause initially then check
- sceKernelDelayThread(100000);
- }while(!sceKernelFindModuleByName("sceKernelLibrary"));
- initgraphics();
- while(1){
- RefreshButtons(0); // Refresh the buttons, note that this is called upon every button pressed to refresh button input thanks to NoFx for this
- if(pad.Buttons & PSP_CTRL_LTRIGGER){
- if(currentFunction == 0){
- currentFunction = 3;
- }
- else{
- currentFunction--;
- }
- drawMenu();
- RefreshButtons(200000);
- }
- if(pad.Buttons & PSP_CTRL_RTRIGGER){
- if(currentFunction == 3){
- currentFunction = 0;
- }
- else{
- currentFunction++;
- }
- drawMenu();
- RefreshButtons(200000);
- }
- if(pad.Buttons & PSP_CTRL_CIRCLE){
- ExitMenu();
- RefreshButtons(200000);
- }
- if(pad.Buttons & PSP_CTRL_UP){
- switch(currentFunction){
- case 0:
- moveRALoggingUp();
- RefreshButtons(200000);
- break;
- case 1:
- moveAddressLoggingUp();
- RefreshButtons(200000);
- break;
- case 2:
- moveFNCHunterUp();
- RefreshButtons(200000);
- break;
- case 3:
- moveOptionsUp();
- RefreshButtons(200000);
- break;
- default:
- break;
- }
- }
- if(pad.Buttons & PSP_CTRL_DOWN){
- switch(currentFunction){
- case 0:
- moveRALoggingDown();
- RefreshButtons(200000);
- break;
- case 1:
- moveAddressLoggingDown();
- RefreshButtons(200000);
- break;
- case 2:
- moveFNCHunterDown();
- RefreshButtons(200000);
- break;
- case 3:
- moveOptionsDown();
- RefreshButtons(200000);
- break;
- default:
- break;
- }
- }
- if(pad.Buttons & PSP_CTRL_CROSS){
- switch(currentFunction){
- case 0:
- selectOptionRALog();
- break;
- case 1:
- selectOptionAddressLog();
- break;
- case 2:
- selectOptionFNCHunt();
- break;
- case 3:
- selectOption();
- break;
- }
- }
- if((pad.Buttons & PSP_CTRL_VOLUP) && (pad.Buttons & PSP_CTRL_VOLDOWN)){
- SetMenu();
- drawMenu();
- RefreshButtons(200000);
- }
- }
- }
- void drawMenu(){
- pspDebugScreenClear();
- RefreshButtons(10000);
- pspDebugScreenSetTextColor(0xFF0000FF);
- sprintf(buffer, "Extraxicity 0.1\nCoded By: Silo\n\n\n");
- pspDebugScreenPuts(buffer);
- pspDebugScreenSetTextColor(currentFunction == 0 ? 0xFFCC0000 : 0xFFFFFFFF); //If we are on this, paint it blue (ABGR)
- sprintf(buffer, "[RA Logging]");
- pspDebugScreenPuts(buffer);
- pspDebugScreenSetTextColor(0xFF33FFFF);
- sprintf(buffer, " || ");
- pspDebugScreenPuts(buffer);
- pspDebugScreenSetTextColor(currentFunction == 1 ? 0xFFCC0000 : 0xFFFFFFFF); //Paint option blue if we are on it (ABGR)
- sprintf(buffer, "[Address Logging]");
- pspDebugScreenPuts(buffer);
- pspDebugScreenSetTextColor(0xFF33FFFF);
- sprintf(buffer, " || ");
- pspDebugScreenPuts(buffer);
- pspDebugScreenSetTextColor(currentFunction == 2 ? 0xFFCC0000 : 0xFFFFFFFF); //Paint option blue if we are on it (ABGR)
- sprintf(buffer, "[FNC Hunter]");
- pspDebugScreenPuts(buffer);
- pspDebugScreenSetTextColor(0xFF33FFFF);
- sprintf(buffer, " || ");
- pspDebugScreenPuts(buffer);
- pspDebugScreenSetTextColor(currentFunction == 3 ? 0xFFCC0000 : 0xFFFFFFFF); //Paint option blue if we are on it (ABGR)
- sprintf(buffer, "[Options]");
- pspDebugScreenPuts(buffer);
- switch(currentFunction){
- case 0:
- RALogging();
- break;
- case 1:
- addressLogging();
- break;
- case 2:
- FNCHunter();
- break;
- case 3:
- optionsSelections(); //WE ARE ON TAB THREE, SO PRINT THE OPTIONS' OPTIONS (that sounds funny...)
- break;
- default:
- break;
- }
- }
- void optionsSelections(){
- pspDebugScreenSetTextColor(optionSelected == 0 ? 0xFFCC0000 : 0xFFFFFFFF); //SET COLOR OF IT ENABLED OR NOT
- pspDebugScreenPuts(pauseGame == 0 ? "\n\nCurrent Thread Status: Unpaused" : "\n\nCurrent Thread Status: Paused"); //Print the status
- pspDebugScreenSetTextColor(optionSelected == 1 ? 0xFFCC0000 : 0xFFFFFFFF);
- pspDebugScreenPuts("\nRandom Option"); //JUST A RANDOM OPTION FOR TESTING PURPOSES...
- }
- void RALogging(){
- pspDebugScreenSetTextColor(RALoggingOption == 0 ? 0xFFCC0000 : 0xFFFFFFFF);
- pspDebugScreenPuts("\n\nAddress: 0x08900000");
- pspDebugScreenSetTextColor(RALoggingOption == 1 ? 0xFFCC0000 : 0xFFFFFFFF);
- pspDebugScreenPuts("\nLog the RA!");
- }
- void addressLogging(){
- pspDebugScreenSetTextColor(AddressLoggingOption == 0 ? 0xFFCC0000 : 0xFFFFFFFF);
- pspDebugScreenPuts("\n\nAddress: ");
- pspDebugScreenPuts(addressLogger);
- pspDebugScreenSetTextColor(0xFF00FF00);
- pspDebugScreenPuts(" |");
- pspDebugScreenSetTextColor(0xFFFFFFFF);
- pspDebugScreenPuts(" Register: a0");
- pspDebugScreenSetTextColor(0xFF00FF00);
- pspDebugScreenPuts(" |");
- pspDebugScreenSetTextColor(0xFF0055FF);
- pspDebugScreenPuts(" Contents: 00000001");
- pspDebugScreenSetTextColor(AddressLoggingOption == 1 ? 0xFFCC0000 : 0xFFFFFFFF);
- pspDebugScreenPuts("\nStart logging!");
- }
- void FNCHunter(){
- pspDebugScreenSetTextColor(FNCHunterOption == 0 ? 0xFFCC0000 : 0xFFFFFFFF);
- pspDebugScreenPuts("\n\nSearch For: 0x27BDFFE0");
- pspDebugScreenSetTextColor(FNCHunterOption == 1 ? 0xFFCC0000 : 0xFFFFFFFF);
- pspDebugScreenPuts("\nReplace With: 0x03E00008");
- pspDebugScreenSetTextColor(FNCHunterOption == 2 ? 0xFFCC0000 : 0xFFFFFFFF);
- pspDebugScreenPuts("\nStart Searching!");
- }
- void moveRALoggingUp(){
- if(RALoggingOption == 0){
- RALoggingOption = 1;
- }
- else{
- RALoggingOption--;
- }
- drawMenu();
- }
- void moveRALoggingDown(){
- if(RALoggingOption == 1){
- RALoggingOption = 0;
- }
- else{
- RALoggingOption++;
- }
- drawMenu();
- }
- void moveAddressLoggingUp(){
- if(AddressLoggingOption == 0){
- AddressLoggingOption = 1;
- }
- else{
- AddressLoggingOption--;
- }
- drawMenu();
- }
- void moveAddressLoggingDown(){
- if(AddressLoggingOption == 1){
- AddressLoggingOption = 0;
- }
- else{
- AddressLoggingOption++;
- }
- drawMenu();
- }
- void moveFNCHunterUp(){
- if(FNCHunterOption == 0){
- FNCHunterOption = 2;
- }
- else{
- FNCHunterOption--;
- }
- drawMenu();
- }
- void moveFNCHunterDown(){
- if(FNCHunterOption == 2){
- FNCHunterOption = 0;
- }
- else{
- FNCHunterOption++;
- }
- drawMenu();
- }
- void moveOptionsUp(){
- if(optionSelected == 0){
- optionSelected = 1;
- }
- else{
- optionSelected--;
- }
- drawMenu();
- }
- void moveOptionsDown(){
- if(optionSelected == 1){
- optionSelected = 0;
- }
- else{
- optionSelected++;
- }
- drawMenu();
- }
- void selectOptionRALog(){
- switch(RALoggingOption){
- case 0:
- break;
- case 1:
- break;
- default:
- break;
- }
- }
- void selectOptionAddressLog(){
- switch(AddressLoggingOption){
- case 0:
- pspDebugScreenPuts("\n\n\nChange Address");
- RefreshButtons(200000);
- break;
- case 1:
- pspDebugScreenPuts("\n\n\nBegin LOGGING");
- RefreshButtons(200000);
- break;
- default:
- break;
- }
- }
- void selectOptionFNCHunt(){
- switch(FNCHunterOption){
- case 0:
- pspDebugScreenPuts("\n\n\nSearch");
- RefreshButtons(200000);
- break;
- case 1:
- pspDebugScreenPuts("\n\n\nData");
- RefreshButtons(200000);
- break;
- case 2:
- pspDebugScreenPuts("\n\n\nBegin Search");
- RefreshButtons(200000);
- break;
- default:
- break;
- }
- }
- void selectOption(){
- switch(optionSelected){
- case 0:
- if(pauseGame == 1){
- pauseGame = 0;
- }
- else{
- pauseGame = 1;
- }
- drawMenu();
- RefreshButtons(200000);
- break;
- case 1:
- pspDebugScreenPuts("\n\n\nRandom Option");
- RefreshButtons(200000);
- break;
- default:
- break;
- }
- }
- //Refresh button input, thanks to Nofx once again
- int RefreshButtons(int rate){
- sceCtrlPeekBufferPositive(&pad, 1);
- sceKernelDelayThread(rate);
- return 0;
- }
- //Init the graphics based on Omenu's method, thanks to NoFx for this
- int initgraphics(void){
- //Heapsize will be determined by the width of the buffer multiplied by the screen height multiplied by the pixel size
- SceUID id = sceKernelAllocPartitionMemory(4, "GfxHeap", PSP_SMEM_High, (512*272)*2, NULL);
- vram = (void*)(0xA0000000 | (int)sceKernelGetBlockHeadAddr(id));
- return 0;
- }
- //Exits back out of the menu
- void ExitMenu(){
- sceCtrlSetButtonMasks(0x10000, 0);
- sceCtrlSetButtonMasks(0xFFFF, 0);
- sceDisplaySetFrameBufferInternal(0, 0, 512, 0, 1);
- RefreshButtons(200000);
- }
- //Setup the premenu stuff
- void SetMenu(){
- if(vram == NULL)
- initgraphics();
- //Steal the framebuffer forcefully from the home menu
- sceDisplaySetFrameBufferInternal(0, vram, 512, 0, 1);
- //Init the pspdebug based on that framebuffer
- pspDebugScreenInitEx(vram, 0, 0);
- sceCtrlSetButtonMasks(0xFFFF, 1);
- sceCtrlSetButtonMasks(0x10000, 2);
- RefreshButtons(200000);
- }
Add Comment
Please, Sign In to add comment