From 6afb63ac77cf05329731a4033c920f520efcfa1b Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Sun, 25 Nov 2018 12:10:17 +0000 Subject: [PATCH] Fix regression in THPS2X: Needs re-testing with Panzer Dragoon Orta --- src/CxbxKrnl/EmuKrnlPs.cpp | 40 +++++++++++++++++++------------------- src/core/HLE/XAPI/Xapi.cpp | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/CxbxKrnl/EmuKrnlPs.cpp b/src/CxbxKrnl/EmuKrnlPs.cpp index c33dd806b..a20d4e977 100644 --- a/src/CxbxKrnl/EmuKrnlPs.cpp +++ b/src/CxbxKrnl/EmuKrnlPs.cpp @@ -149,23 +149,6 @@ static unsigned int WINAPI PCSTProxy // Suspend right before calling the thread notification routines SuspendThread(GetCurrentThread()); - // call thread notification routine(s) - if (g_iThreadNotificationCount != 0) - { - for (int i = 0; i < 16; i++) - { - XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification[i]; - - // If the routine doesn't exist, don't execute it! - if (pfnNotificationRoutine == NULL) - continue; - - DBG_PRINTF("Calling pfnNotificationRoutine[%d] (0x%.8X)\n", g_iThreadNotificationCount, pfnNotificationRoutine); - - pfnNotificationRoutine(TRUE); - } - } - // use the special calling convention __try { @@ -319,8 +302,8 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE iPCSTProxyParam->StartContext = StartContext; iPCSTProxyParam->SystemRoutine = SystemRoutine; // NULL, XapiThreadStartup or unknown? iPCSTProxyParam->StartSuspended = CreateSuspended; - iPCSTProxyParam->hStartedEvent = hStartedEvent; - + iPCSTProxyParam->hStartedEvent = hStartedEvent; + *ThreadHandle = (HANDLE)_beginthreadex(NULL, KernelStackSize, PCSTProxy, iPCSTProxyParam, NULL, (uint*)&dwThreadId); // Note : DO NOT use iPCSTProxyParam anymore, since ownership is transferred to the proxy (which frees it too) @@ -349,6 +332,23 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE } } } + + // call thread notification routine(s) + if (g_iThreadNotificationCount != 0) + { + for (int i = 0; i < 16; i++) + { + XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification[i]; + + // If the routine doesn't exist, don't execute it! + if (pfnNotificationRoutine == NULL) + continue; + + DBG_PRINTF("Calling pfnNotificationRoutine[%d] (0x%.8X)\n", g_iThreadNotificationCount, pfnNotificationRoutine); + + pfnNotificationRoutine(TRUE); + } + } // Release the event CloseHandle(hStartedEvent); @@ -367,7 +367,7 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE } // ****************************************************************** -// * 0x0100 - PsQueryStatistics() +// * 0x0100 - PsQueryStatisti cs() // ****************************************************************** XBSYSAPI EXPORTNUM(256) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsQueryStatistics ( diff --git a/src/core/HLE/XAPI/Xapi.cpp b/src/core/HLE/XAPI/Xapi.cpp index 4409211b2..313a9ddb4 100644 --- a/src/core/HLE/XAPI/Xapi.cpp +++ b/src/core/HLE/XAPI/Xapi.cpp @@ -358,7 +358,7 @@ bool TitleIsLegoSW() pTitleId++; } - + if (result) { EmuLog(LOG_LEVEL::WARNING, "Applying Lego Star Wars Hack"); }