From 5485699f06e9c201c6efb07b3cff10c783acb376 Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Sat, 13 Aug 2016 22:41:30 +0100 Subject: [PATCH] Remove some high level XAPI functions, including some which were not used --- src/CxbxKrnl/EmuXapi.cpp | 489 --------------------- src/CxbxKrnl/HLEDataBase.cpp | 1 + src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl | 29 -- src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl | 9 - src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl | 29 -- 5 files changed, 1 insertion(+), 556 deletions(-) diff --git a/src/CxbxKrnl/EmuXapi.cpp b/src/CxbxKrnl/EmuXapi.cpp index 065503ee4..b86dedfd9 100644 --- a/src/CxbxKrnl/EmuXapi.cpp +++ b/src/CxbxKrnl/EmuXapi.cpp @@ -703,55 +703,6 @@ DWORD WINAPI XTL::EmuXInputSetState return ret; } -// ****************************************************************** -// * func: EmuCreateMutex -// ****************************************************************** -HANDLE WINAPI XTL::EmuCreateMutex -( - LPSECURITY_ATTRIBUTES lpMutexAttributes, - BOOL bInitialOwner, - LPCSTR lpName -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmuCreateMutex\n" - "(\n" - " lpMutexAttributes : 0x%.08X\n" - " bInitialOwner : 0x%.08X\n" - " lpName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), lpMutexAttributes, bInitialOwner, lpName, lpName); - - HANDLE hRet = CreateMutex((SECURITY_ATTRIBUTES *)lpMutexAttributes, bInitialOwner, lpName); - - EmuSwapFS(); // XBox FS - - return hRet; -} - -// ****************************************************************** -// * func: EmuCloseHandle -// ****************************************************************** -BOOL WINAPI XTL::EmuCloseHandle -( - HANDLE hObject -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmuCloseHandle\n" - "(\n" - " hObject : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hObject); - - BOOL bRet = CloseHandle(hObject); - - EmuSwapFS(); // XBox FS - - return bRet; -} // ****************************************************************** // * func: EmuSetThreadPriorityBoost @@ -944,28 +895,6 @@ VOID WINAPI XTL::EmuXapiThreadStartup return; } -/* Too High Level! -// ****************************************************************** -// * func: XapiSetupPerTitleDriveLetters -// ****************************************************************** -XTL::NTSTATUS CDECL XTL::XapiSetupPerTitleDriveLetters(DWORD dwTitleId, LPCWSTR wszTitleName) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): XapiSetupPerTitleDriveLetters\n" - "(\n" - " dwTitleId : 0x%.08X\n" - " wszTitleName : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwTitleId, wszTitleName); - - NTSTATUS ret = STATUS_SUCCESS; - - EmuSwapFS(); // XBox FS - - return ret; -} -*/ // ****************************************************************** // * func: EmuXapiBootDash // ****************************************************************** @@ -1764,69 +1693,6 @@ BOOL WINAPI XTL::EmuPulseEvent( HANDLE hEvent ) return bRet; } -// ****************************************************************** -// * func: EmuCreateSemaphore -// ****************************************************************** -HANDLE WINAPI XTL::EmuCreateSemaphore -( - LPVOID lpSemaphoreAttributes, - LONG lInitialCount, - LONG lMaximumCount, - LPSTR lpName -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmuCreateSemaphore\n" - "(\n" - " lpSemaphoreAttributes : 0x%.08X\n" - " lInitialCount : 0x%.08X\n" - " lMaximumCount : 0x%.08X\n" - " lpName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName, lpName); - - if(lpSemaphoreAttributes) - EmuWarning( "lpSemaphoreAttributes != NULL" ); - - HANDLE hRet = CreateSemaphoreA( NULL, lInitialCount, lMaximumCount, lpName ); - if( !hRet ) - EmuWarning( "CreateSemaphore failed!" ); - - EmuSwapFS(); // Xbox FS - - return hRet; -} - -// ****************************************************************** -// * func: EmuReleaseSemaphore -// ****************************************************************** -BOOL WINAPI XTL::EmuReleaseSemaphore -( - HANDLE hSemaphore, - LONG lReleaseCount, - LPLONG lpPreviousCount -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmuReleaseSemaphore\n" - "(\n" - " hSemaphore : 0x%.08X\n" - " lReleaseCount : 0x%.08X\n" - " lpPreviousCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hSemaphore, lReleaseCount, lpPreviousCount); - - BOOL bRet = ReleaseSemaphore( hSemaphore, lReleaseCount, lpPreviousCount ); - if( !bRet ) - EmuWarning( "ReleaseSemaphore failed!" ); - - EmuSwapFS(); // Xbox FS - - return bRet; -} - // ****************************************************************** // * func: timeSetEvent // ****************************************************************** @@ -1950,60 +1816,6 @@ DWORD WINAPI XTL::EmuGetFileAttributesA return dwRet; } -// ****************************************************************** -// func: EmuVirtualProtect -// ****************************************************************** -BOOL WINAPI XTL::EmuVirtualProtect -( - LPVOID lpAddress, // region of committed pages - SIZE_T dwSize, // size of the region - DWORD flNewProtect, // desired access protection - PDWORD lpflOldProtect // old protection -) -{ - EmuSwapFS(); - - DbgPrintf("EmuXapi (0x%X): EmuVirtualProtect\n" - "(\n" - " lpAddress : 0x%.08X\n" - " dwSize : 0x%.08X\n" - " flNewProtect : 0x%.08X\n" - " lpflOldProtect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpAddress, dwSize, flNewProtect, lpflOldProtect); - - DWORD dwRet = VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect); - - EmuSwapFS(); - - return dwRet; -} - -// ****************************************************************** -// func: EmulstrcmpiW -// ****************************************************************** -int WINAPI XTL::EmulstrcmpiW -( - LPCWSTR lpString1, - LPCWSTR lpString2 -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmulstrcmpiW\n" - "(\n" - " lpString1 : 0x%.08X (%S)\n" - " lpString2 : 0x%.08X (%S)\n" - ");\n", - GetCurrentThreadId(), lpString1, lpString1, lpString2, lpString2); - - int Ret = lstrcmpiW(lpString1, lpString2); - - EmuSwapFS(); // Xbox FS - - return Ret; -} - // ****************************************************************** // func: XMountMUA // ****************************************************************** @@ -2146,223 +1958,6 @@ DWORD WINAPI XTL::EmuXUnmountAlternateTitle(CHAR chDrive) return ERROR_SUCCESS; } -// ****************************************************************** -// * func: EmuMoveFileA -// ****************************************************************** -BOOL WINAPI XTL::EmuMoveFileA -( - LPCSTR lpExistingFileName, - LPCSTR lpNewFileName -) -{ - EmuSwapFS(); // Win2k/XP FS - - printf("EmuXapi (0x%X): EmuMoveFileA\n" - "(\n" - " lpExistingFileName : 0x%.08X (%s)\n" - " lpNewFileName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), lpExistingFileName, lpExistingFileName, - lpNewFileName, lpNewFileName); - - // For Panzer. - BOOL bRet = MoveFileA( lpExistingFileName, lpNewFileName ); - - EmuSwapFS(); // Xbox FS - - return bRet; -} - -/* not necessary? -// ****************************************************************** -// * func: EmuXCalculateSignatureBegin -// ****************************************************************** -HANDLE WINAPI XTL::EmuXCalculateSignatureBegin -( - DWORD dwFlags -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): XCalculateSignatureBegin\n" - "(\n" - " dwFlags : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwFlags); - - EmuSwapFS(); // XBox FS - - // return a fake handle value for now - return (PVOID)0xAAAAAAAA; -} - -// ****************************************************************** -// * func: EmuXCalculateSignatureBeginEx -// ****************************************************************** -HANDLE WINAPI XTL::EmuXCalculateSignatureBeginEx -( - DWORD dwFlags, - DWORD dwAltTitleId -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): XCalculateSignatureBeginEx\n" - "(\n" - " dwFlags : 0x%.08X\n", - " dwAltTitleId : 0x%.08X\n", - ");\n", - GetCurrentThreadId(), dwFlags, dwAltTitleId); - - EmuSwapFS(); // XBox FS - - // return a fake handle value for now - return (PVOID)0xAAAAAAAA; -} - -// ****************************************************************** -// * func: EmuXCalculateSignatureUpdate -// ****************************************************************** -DWORD WINAPI XTL::EmuXCalculateSignatureUpdate -( - HANDLE hCalcSig, - const BYTE *pbData, - ULONG cbData -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): XCalculateSignatureUpdate\n" - "(\n" - " hCalcSig : 0x%.08X\n", - " pbData : 0x%.08X\n", - " cbData : 0x%.08X\n", - ");\n", - GetCurrentThreadId(), hCalcSig, pbData, cbData); - - EmuSwapFS(); // XBox FS - - return ERROR_SUCCESS; -} - -// ****************************************************************** -// * func: EmuXCalculateSignatureEnd -// ****************************************************************** -DWORD WINAPI XTL::EmuXCalculateSignatureEnd -( - HANDLE hCalcSig, - PXCALCSIG_SIGNATURE pSignature -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): XCalculateSignatureEnd\n" - "(\n" - " hCalcSig : 0x%.08X\n", - " pSignature : 0x%.08X\n", - ");\n", - GetCurrentThreadId(), hCalcSig, pSignature); - - EmuSwapFS(); // XBox FS - - return ERROR_SUCCESS; -} -//*/ -// ****************************************************************** -// * func: EmuCreateMutex -// ****************************************************************** -HANDLE WINAPI EmuCreateMutex -( - LPSECURITY_ATTRIBUTES lpMutexAttributes, - BOOL bInitialOwner, - LPCSTR lpName -) -{ - // TODO: Later (if needed) - return NULL; -} - -// ****************************************************************** -// * func: EmuCloseHandle -// ****************************************************************** -//BOOL WINAPI XTL::EmuCloseHandle -//( -// HANDLE hObject -//) -//{ -// EmuSwapFS(); // Win2k/XP FS -// -// DbgPrintf("EmuXapi (0x%X): EmuCloseHandle\n" -// "(\n" -// " hObject : 0x%.08X\n", -// ");\n", -// GetCurrentThreadId(), hObject); -// -// BOOL bRet = CloseHandle( hObject ); -// -// EmuSwapFS(); // Xbox FS -// -// return bRet; -//} - - - -// ****************************************************************** -// * func: EmuVirtualAlloc -// ****************************************************************** -LPVOID WINAPI XTL::EmuVirtualAlloc -( - LPVOID lpAddress, - SIZE_T dwSize, - DWORD flAllocationType, - DWORD flProtect -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmuVirtualAlloc\n" - "(\n" - " lpAddress : 0x%.08X\n" - " dwSize : 0x%.08X\n" - " flAllocationType : 0x%.08X\n" - " flProtect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpAddress, dwSize, flAllocationType, flProtect); - - LPVOID ret = VirtualAllocEx( GetCurrentProcess(), lpAddress, dwSize, flAllocationType, flProtect ); - - EmuSwapFS(); // Xbox FS - - return ret; -} - -// ****************************************************************** -// * func: EmuVirtualAlloc -// ****************************************************************** -BOOL WINAPI XTL::EmuVirtualFree -( - LPVOID lpAddress, - SIZE_T dwSize, - DWORD dwFreeType -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmuVirtualFree\n" - "(\n" - " lpAddress : 0x%.08X\n" - " dwSize : 0x%.08X\n" - " dwFreeType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpAddress, dwSize, dwFreeType); - - BOOL bRet = VirtualFreeEx( GetCurrentProcess(), lpAddress, dwSize, dwFreeType ); - - EmuSwapFS(); // Xbox FS - - return bRet; -} - // ****************************************************************** // * func: EmuXGetDeviceEnumerationStatus // ****************************************************************** @@ -2377,22 +1972,6 @@ DWORD WINAPI XTL::EmuXGetDeviceEnumerationStatus() return XDEVICE_ENUMERATION_IDLE; } -// ****************************************************************** -// * func: EmuSwitchToThread -// ****************************************************************** -BOOL WINAPI XTL::EmuSwitchToThread() -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmuSwitchToThread()\n", GetCurrentThreadId()); - - BOOL bRet = SwitchToThread(); - - EmuSwapFS(); // Xbox FS - - return bRet; -} - // ****************************************************************** // * func: EmuXInputGetDeviceDescription // ****************************************************************** @@ -2462,71 +2041,3 @@ DWORD WINAPI XTL::EmuXMountMURootA return ERROR_SUCCESS; } - -// ****************************************************************** -// * func: EmuReadFileEx -// ****************************************************************** -BOOL WINAPI XTL::EmuReadFileEx -( - HANDLE hFile, // handle to file - LPVOID lpBuffer, // data buffer - DWORD nNumberOfBytesToRead, // number of bytes to read - LPOVERLAPPED lpOverlapped, // offset - LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine // completion routine -) -{ - EmuSwapFS(); // Win2k/XP FS - - DbgPrintf("EmuXapi (0x%X): EmuReadFileEx\n" - "(\n" - " hFile : 0x%.08X\n" - " lpBuffer : 0x%.08X\n" - " nNumberOfBytesToRead : 0x%.08X\n" - " lpOverlapped : 0x%.08X\n" - " lpCompletionRoutine : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hFile, lpBuffer, nNumberOfBytesToRead, - lpOverlapped, lpCompletionRoutine); - - BOOL bRet = ReadFileEx( hFile, lpBuffer, nNumberOfBytesToRead, lpOverlapped, lpCompletionRoutine ); - if(!bRet) - printf("ReadFilEx failed!"); - - EmuSwapFS(); - - return bRet; -} - -// ****************************************************************** -// * func: EmuWriteFileEx -// ****************************************************************** -BOOL WINAPI XTL::EmuWriteFileEx -( - HANDLE hFile, // handle to output file - LPCVOID lpBuffer, // data buffer - DWORD nNumberOfBytesToWrite, // number of bytes to write - LPOVERLAPPED lpOverlapped, // overlapped buffer - LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine // completion routine -) -{ - EmuSwapFS(); // Win2k/XP FS - - printf("EmuXapi (0x%X): EmuWriteFileEx\n" - "(\n" - " hFile : 0x%.08X\n" - " lpBuffer : 0x%.08X\n" - " nNumberOfBytesToWrite: 0x%.08X\n" - " lpOverlapped : 0x%.08X\n" - " lpCompletionRoutine : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hFile, lpBuffer, nNumberOfBytesToWrite, - lpOverlapped, lpCompletionRoutine); - - BOOL bRet = WriteFileEx( hFile, lpBuffer, nNumberOfBytesToWrite, lpOverlapped, lpCompletionRoutine );; - if(!bRet) - printf("WriteFilEx failed!"); - - EmuSwapFS(); - - return bRet; -} diff --git a/src/CxbxKrnl/HLEDataBase.cpp b/src/CxbxKrnl/HLEDataBase.cpp index e74e7a8bd..51f2954b8 100644 --- a/src/CxbxKrnl/HLEDataBase.cpp +++ b/src/CxbxKrnl/HLEDataBase.cpp @@ -39,6 +39,7 @@ extern "C" const char *szHLELastCompileTime = __TIMESTAMP__; + #include "Emu.h" #include "EmuXTL.h" #include "HLEDataBase.h" diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl index 8e5dad292..37118ea74 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl @@ -1842,35 +1842,6 @@ OOVPATable XAPI_1_0_4627[] = "EmuQueueUserAPC" #endif }, - // VirtualProtect (* unchanged since 4627 *) - { - (OOVPA*)&VirtualProtect_1_0_4627, - XTL::EmuVirtualProtect, - - #ifdef _DEBUG_TRACE - "VirtualProtect" - #endif - }, - // CreateSemaphore - { - (OOVPA*)&CreateSemaphoreA_1_0_4627, - - XTL::EmuCreateSemaphore, - - #ifdef _DEBUG_TRACE - "EmuCreateSemaphoreA" - #endif - }, - // ReleaseSemaphore - { - (OOVPA*)&ReleaseSemaphore_1_0_4627, - - XTL::EmuReleaseSemaphore, - - #ifdef _DEBUG_TRACE - "EmuReleaseSemaphore" - #endif - }, // XMountAlternateTitleA { (OOVPA*)&XMountAlternateTitleA_1_0_4627, diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl index d01f010b8..7e789d25d 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl @@ -452,15 +452,6 @@ OOVPATable XAPI_1_0_5233[] = "EmuQueueUserAPC" #endif }, - // VirtualProtect (* unchanged since 4627 *) - { - (OOVPA*)&VirtualProtect_1_0_4627, - XTL::EmuVirtualProtect, - - #ifdef _DEBUG_TRACE - "VirtualProtect" - #endif - }, // GetFileAttributesA (* unchanged since 4134 *) { (OOVPA*)&GetFileAttributesA_1_0_4134, diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl index cd2b37a7b..c4c63ab24 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl @@ -659,26 +659,6 @@ OOVPATable XAPI_1_0_5558[] = "EmuXapiBootDash" #endif }, - // CreateSemaphore - { - (OOVPA*)&CreateSemaphoreA_1_0_5558, - - XTL::EmuCreateSemaphore, - - #ifdef _DEBUG_TRACE - "EmuCreateSemaphoreA" - #endif - }, - // ReleaseSemaphore - { - (OOVPA*)&ReleaseSemaphore_1_0_5558, - - XTL::EmuReleaseSemaphore, - - #ifdef _DEBUG_TRACE - "EmuReleaseSemaphore" - #endif - }, // XLaunchNewImageA { (OOVPA*)&XLaunchNewImageA_1_0_5558, @@ -715,15 +695,6 @@ OOVPATable XAPI_1_0_5558[] = #ifdef _DEBUG_TRACE "GetFileAttributesA" #endif - }, - // VirtualProtect (* unchanged since 4627 *) - { - (OOVPA*)&VirtualProtect_1_0_4627, - XTL::EmuVirtualProtect, - - #ifdef _DEBUG_TRACE - "VirtualProtect" - #endif }, // XGetSectionHandleA (* unchanged since 4134 *) {