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();
- }
- typedef struct Example {
- int a;
- int b;
- } Example;
- void free_reference(Example** ref) {
- free(ref); // should be free(*ref);
- *ref = 0;
- }
- int main(int argc, char** argv)
- {
- // basic init
- setupExitCallback();
- pspDebugScreenInit();
- Example* ptr = malloc(sizeof(Example));
- printf("ptr: %d\n", ptr->a);
- test_crash();
- free_reference(&ptr);
- printf("ptr: %d\n", ptr->b);
- printf("No errors.");
- sceKernelSleepThread();
- sceKernelExitGame();
- return 0;
- }
Add Comment
Please, Sign In to add comment