Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // include psp stuff
- #include <pspkernel.h>
- #include <pspdebug.h>
- #include <pspdisplay.h>
- #include <pspctrl.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- // include commons stuff
- #include "../common/callback.h"
- // configure PSP stuff
- #define VERS 1
- #define REVS 0
- PSP_MODULE_INFO("DebugExample", PSP_MODULE_USER, VERS, REVS);
- PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
- // make printing easier on us
- #define printf pspDebugScreenPrintf
- void crash(int error, const char* crasher, const char* message) {
- sceDisplayWaitVblankStart();
- printf("Error (%d) : %s\n", error, crasher);
- printf("%s\n", message);
- sceKernelSleepThread();
- }
- void test_crash() {
- sceDisplayWaitVblankStart();
- printf("No crash occured.");
- sceKernelSleepThread();
- }
- int main(int argc, char** argv)
- {
- // basic init
- setupExitCallback();
- pspDebugScreenInit();
- // path to non-existent file
- const char* path = "umd0:/this/path_doesnt/exist.txt";
- // attempt to open the non-existent file, uid being a handle pointer
- int uid = sceIoOpen(path, PSP_O_RDONLY, 0777);
- if(uid != 0)
- crash(uid, "File Open", "Failed to open file. File not found!");
- // if for some reason the file was found
- printf("I see you built the path to test if sceIoOpen worked to open files.");
- sceKernelSleepThread();
- sceKernelExitGame();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement