Skip to content

Commit

Permalink
PS2: Support for latest SDK with -D__NEW_PS2SDK__
Browse files Browse the repository at this point in the history
  • Loading branch information
sunmax committed Jan 23, 2014
1 parent 4ccdb3e commit 487e642
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 9 additions & 0 deletions backends/platform/ps2/Gs2dScreen.cpp
Expand Up @@ -378,7 +378,12 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {
createAnimTextures();

// create animation thread
#ifdef __NEW_PS2SDK__
ee_thread_t animThread;
ee_thread_status_t thisThread;
#else
ee_thread_t animThread, thisThread;
#endif
ReferThreadStatus(GetThreadId(), &thisThread);

_animStack = memalign(64, ANIM_STACK_SIZE);
Expand All @@ -395,7 +400,11 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {

void Gs2dScreen::quit(void) {
_systemQuit = true;
#ifdef __NEW_PS2SDK__
ee_thread_status_t statAnim;
#else
ee_thread_t statAnim;
#endif
do { // wait until thread called ExitThread()
SignalSema(g_AnimSema);
ReferThreadStatus(_animTid, &statAnim);
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/ps2/Makefile.ps2
Expand Up @@ -98,7 +98,7 @@ FLAGS += -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-unused-paramete
CFLAGS = $(FLAGS) -std=c99
CXXFLAGS = $(FLAGS) -Wnon-virtual-dtor -Wno-reorder -fno-exceptions -fno-rtti

DEFINES = -D_EE -D__PLAYSTATION2__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\"
DEFINES = -D_EE -D__PLAYSTATION2__ -D__NEW_PS2SDK__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\"
DEFINES += -DDISABLE_SAVEGAME_SORTING -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_DOSBOX_OPL -DDISABLE_SID -DDISABLE_NES_APU

INCDIR := $(PS2SDK)/ee/include $(PS2SDK)/common/include $(PS2SDK)/ports/include . $(srcdir) $(srcdir)/engines
Expand Down
14 changes: 13 additions & 1 deletion backends/platform/ps2/systemps2.cpp
Expand Up @@ -111,7 +111,11 @@ extern "C" int scummvm_main(int argc, char *argv[]);

extern "C" int main(int argc, char *argv[]) {
SifInitRpc(0);
#ifdef __NEW_PS2SDK__
ee_thread_status_t thisThread;
#else
ee_thread_t thisThread;
#endif
int tid = GetThreadId();
ReferThreadStatus(tid, &thisThread);

Expand Down Expand Up @@ -452,8 +456,12 @@ void OSystem_PS2::initTimer(void) {
g_TimerThreadSema = CreateSema(&threadSema);
g_SoundThreadSema = CreateSema(&threadSema);
assert((g_TimerThreadSema >= 0) && (g_SoundThreadSema >= 0));

#ifdef __NEW_PS2SDK__
ee_thread_t timerThread, soundThread;
ee_thread_status_t thisThread;
#else
ee_thread_t timerThread, soundThread, thisThread;
#endif
ReferThreadStatus(GetThreadId(), &thisThread);

_timerStack = (uint8 *)memalign(64, TIMER_STACK_SIZE);
Expand Down Expand Up @@ -885,7 +893,11 @@ void OSystem_PS2::quit(void) {
//setTimerCallback(NULL, 0);
_screen->wantAnim(false);
_systemQuit = true;
#ifdef __NEW_PS2SDK__
ee_thread_status_t statSound, statTimer;
#else
ee_thread_t statSound, statTimer;
#endif
printf("Waiting for timer and sound thread to end\n");
do { // wait until both threads called ExitThread()
ReferThreadStatus(_timerTid, &statTimer);
Expand Down

0 comments on commit 487e642

Please sign in to comment.