From c347d4d227ca7f4d120643c63ed9b04a4afdd01e Mon Sep 17 00:00:00 2001 From: GeeckoDev Date: Mon, 13 Jul 2015 15:33:52 +0200 Subject: [PATCH] samples: add missing callbacks.h and Makefile Fixes issue #2 --- sample/Makefile | 26 ++++++++++++++++++++++++++ sample/callbacks.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 sample/Makefile create mode 100644 sample/callbacks.h diff --git a/sample/Makefile b/sample/Makefile new file mode 100644 index 0000000..09b2b30 --- /dev/null +++ b/sample/Makefile @@ -0,0 +1,26 @@ +all: + make -C clock + make -C coordinates + make -C deform + make -C depth + make -C objcontrol + make -C screensaver + make -C transform + +clean: + make -C clock clean + make -C coordinates clean + make -C deform clean + make -C depth clean + make -C objcontrol clean + make -C screensaver clean + make -C transform clean + +install: + make -C clock install + make -C coordinates install + make -C deform install + make -C depth install + make -C objcontrol install + make -C screensaver install + make -C transform install diff --git a/sample/callbacks.h b/sample/callbacks.h new file mode 100644 index 0000000..1f7b733 --- /dev/null +++ b/sample/callbacks.h @@ -0,0 +1,38 @@ +#ifndef __CALLBACKS_H__ +#define __CALLBACKS_H__ + +#include + +int callbacks_exit() +{ + sceKernelExitGame(); + + return 0; +} + +int callbacks_thread() +{ + int id; + + id = sceKernelCreateCallback("exit_cb", callbacks_exit, NULL); + sceKernelRegisterExitCallback(id); + sceKernelSleepThreadCB(); + + return 0; +} + +int callbacks_setup() +{ + int id; + + id = sceKernelCreateThread("cb", callbacks_thread, 0x11, 0xFA0, 0, NULL); + + if (id >= 0) + { + sceKernelStartThread(id, 0, NULL); + } + + return id; +} + +#endif // __CALLBACKS_H__