diff options
author | Alejandro Marzini | 2010-08-06 03:21:21 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-08-06 03:21:21 +0000 |
commit | 33e40e1a20c4cc60031854c87d6da5e461f9eb73 (patch) | |
tree | f76425d516e75d147ffbbacbec3fad49297da1b1 /backends/platform/psp/display_manager.cpp | |
parent | f97809a9a62a2d8840229facb2c2b6f75e37bad3 (diff) | |
parent | 6c8bcd2ba1cad1312f0a588ca284110bbbb81ccc (diff) | |
download | scummvm-rg350-33e40e1a20c4cc60031854c87d6da5e461f9eb73.tar.gz scummvm-rg350-33e40e1a20c4cc60031854c87d6da5e461f9eb73.tar.bz2 scummvm-rg350-33e40e1a20c4cc60031854c87d6da5e461f9eb73.zip |
Merged from trunk, from r51495 to r51775
svn-id: r51776
Diffstat (limited to 'backends/platform/psp/display_manager.cpp')
-rw-r--r-- | backends/platform/psp/display_manager.cpp | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index a9f33f6091..5037543f12 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -34,7 +34,6 @@ #include "backends/platform/psp/default_display_client.h" #include "backends/platform/psp/cursor.h" #include "backends/platform/psp/pspkeyboard.h" -#include "backends/platform/psp/thread.h" #define USE_DISPLAY_CALLBACK // to use callback for finishing the render #include "backends/platform/psp/display_manager.h" @@ -65,37 +64,24 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = { void MasterGuRenderer::setupCallbackThread() { DEBUG_ENTER_FUNC(); - int thid = sceKernelCreateThread("displayCbThread", guCallbackThread, PRIORITY_DISPLAY_THREAD, STACK_DISPLAY_THREAD, THREAD_ATTR_USER, 0); - PSP_DEBUG_PRINT("Display CB thread id is %x\n", thid); - - // We want to pass the pointer to this, but we'll have to take address of this so use a little trick - MasterGuRenderer *_this = this; - - if (thid >= 0) { - sceKernelStartThread(thid, sizeof(uint32 *), &_this); - } else - PSP_ERROR("failed to create display callback thread\n"); + // start the thread that updates the display + threadCreateAndStart("DisplayCbThread", PRIORITY_DISPLAY_THREAD, STACK_DISPLAY_THREAD); } -// thread that reacts to the callback -int MasterGuRenderer::guCallbackThread(SceSize, void *__this) { +// this function gets called by PspThread when starting the new thread +void MasterGuRenderer::threadFunction() { DEBUG_ENTER_FUNC(); - // Dereferenced the copied value which was this - MasterGuRenderer *_this = *(MasterGuRenderer **)__this; - // Create the callback. It should always get the pointer to MasterGuRenderer - _this->_callbackId = sceKernelCreateCallback("Display Callback", guCallback, _this); - if (_this->_callbackId < 0) { - PSP_ERROR("failed to create display callback\n"); - return -1; + _callbackId = sceKernelCreateCallback("Display Callback", guCallback, this); + if (_callbackId < 0) { + PSP_ERROR("failed to create display callback\n"); } PSP_DEBUG_PRINT("created callback. Going to sleep\n"); - sceKernelSleepThreadCB(); // sleep until we get a callback - return 0; + sceKernelSleepThreadCB(); // sleep until we get a callback } // This callback is called when the render is finished. It swaps the buffers |