From b98fc210bed8865080cc844e576321f2e160c3f4 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Tue, 10 Jun 2003 08:18:43 +0000 Subject: [PATCH] Fun Stuff --- CxbxKrnl.dsp | 8 ++++ Include/Win32/CxbxKrnl/Emu.h | 2 +- Include/Win32/CxbxKrnl/HLEDataBase.h | 1 + Include/Win32/CxbxKrnl/XG.1.0.4627.h | 42 +++++++++++++++++++ Include/Win32/CxbxKrnl/xd3d8.h | 2 +- Source/Win32/CxbxKrnl/Emu.cpp | 23 ++++++++--- Source/Win32/CxbxKrnl/EmuD3D8.cpp | 6 +-- Source/Win32/CxbxKrnl/EmuKrnl.cpp | 2 +- Source/Win32/CxbxKrnl/HLEDataBase.cpp | 8 ++++ Source/Win32/CxbxKrnl/XG.1.0.4627.inl | 55 +++++++++++++++++++++++++ Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl | 32 +++++++++++++- 11 files changed, 167 insertions(+), 14 deletions(-) create mode 100644 Include/Win32/CxbxKrnl/XG.1.0.4627.h create mode 100644 Source/Win32/CxbxKrnl/XG.1.0.4627.inl diff --git a/CxbxKrnl.dsp b/CxbxKrnl.dsp index 5212d9bb7..3fea6bf00 100644 --- a/CxbxKrnl.dsp +++ b/CxbxKrnl.dsp @@ -254,6 +254,10 @@ SOURCE=.\Include\Win32\CxbxKrnl\XG.1.0.4361.h # End Source File # Begin Source File +SOURCE=.\Include\Win32\CxbxKrnl\XG.1.0.4627.h +# End Source File +# Begin Source File + SOURCE=.\Include\Win32\CxbxKrnl\xntdll.h # End Source File # End Group @@ -376,6 +380,10 @@ SOURCE=.\Source\Win32\XBVideo.cpp SOURCE=.\Source\Win32\CxbxKrnl\XG.1.0.4361.inl # End Source File +# Begin Source File + +SOURCE=.\Source\Win32\CxbxKrnl\XG.1.0.4627.inl +# End Source File # End Group # End Target # End Project diff --git a/Include/Win32/CxbxKrnl/Emu.h b/Include/Win32/CxbxKrnl/Emu.h index 88ccf99b0..fcb202639 100644 --- a/Include/Win32/CxbxKrnl/Emu.h +++ b/Include/Win32/CxbxKrnl/Emu.h @@ -57,7 +57,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuCleanThread(); // ****************************************************************** // * func: EmuCleanup // ****************************************************************** -extern "C" CXBXKRNL_API void NTAPI EmuCleanup(const char *szErrorMessage); +extern "C" CXBXKRNL_API void NTAPI EmuCleanup(const char *szErrorMessage, ...); // ****************************************************************** // * func: EmuPanic diff --git a/Include/Win32/CxbxKrnl/HLEDataBase.h b/Include/Win32/CxbxKrnl/HLEDataBase.h index cafcf2d65..6b87f137c 100644 --- a/Include/Win32/CxbxKrnl/HLEDataBase.h +++ b/Include/Win32/CxbxKrnl/HLEDataBase.h @@ -43,6 +43,7 @@ #include "D3D8.1.0.4361.h" #include "D3D8.1.0.4627.h" #include "XG.1.0.4361.h" +#include "XG.1.0.4627.h" // ****************************************************************** // * HLEDataBase diff --git a/Include/Win32/CxbxKrnl/XG.1.0.4627.h b/Include/Win32/CxbxKrnl/XG.1.0.4627.h new file mode 100644 index 000000000..5c22bce20 --- /dev/null +++ b/Include/Win32/CxbxKrnl/XG.1.0.4627.h @@ -0,0 +1,42 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->XG.1.0.4627.h +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** +#ifndef XG_1_0_4627_H +#define XG_1_0_4627_H + +#include "OOVPA.h" + +extern OOVPATable XG_1_0_4627[]; +extern uint32 XG_1_0_4627_SIZE; + +#endif diff --git a/Include/Win32/CxbxKrnl/xd3d8.h b/Include/Win32/CxbxKrnl/xd3d8.h index 8d7477f20..c6bc1c772 100644 --- a/Include/Win32/CxbxKrnl/xd3d8.h +++ b/Include/Win32/CxbxKrnl/xd3d8.h @@ -60,7 +60,7 @@ inline D3DFORMAT EmuXB2PC_D3DFormat(X_D3DFORMAT Format) else if(Format == 0x2C) return D3DFMT_D16; - EmuCleanup("EmuXB2PC_D3DFormat: Unknown Format"); + EmuCleanup("EmuXB2PC_D3DFormat: Unknown Format (%d)", Format); return Format; } diff --git a/Source/Win32/CxbxKrnl/Emu.cpp b/Source/Win32/CxbxKrnl/Emu.cpp index 2373dc196..5b361c396 100644 --- a/Source/Win32/CxbxKrnl/Emu.cpp +++ b/Source/Win32/CxbxKrnl/Emu.cpp @@ -364,7 +364,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit { EmuSwapFS(); // XBox FS - _asm int 3 +// _asm int 3 Entry(); @@ -387,20 +387,31 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit // ****************************************************************** // * func: EmuCleanup // ****************************************************************** -extern "C" CXBXKRNL_API void NTAPI EmuCleanup(const char *szErrorMessage) +extern "C" CXBXKRNL_API void NTAPI EmuCleanup(const char *szErrorMessage, ...) { // ****************************************************************** // * Print out ErrorMessage (if exists) // ****************************************************************** if(szErrorMessage != NULL) { - char buffer[255]; + char szBuffer1[255]; + char szBuffer2[255]; - sprintf(buffer, "Emu (0x%X): Recieved Fatal Message!\n\n%s\n", GetCurrentThreadId(), szErrorMessage); + va_list argp; - printf("%s", buffer); + sprintf(szBuffer1, "Emu (0x%X): Recieved Fatal Message -> \n\n", GetCurrentThreadId()); - MessageBox(NULL, buffer, "CxbxKrnl", MB_OK | MB_ICONEXCLAMATION); + va_start(argp, szErrorMessage); + + vsprintf(szBuffer2, szErrorMessage, argp); + + va_end(argp); + + strcat(szBuffer1, szBuffer2); + + printf("%s", szBuffer1); + + MessageBox(NULL, szBuffer1, "CxbxKrnl", MB_OK | MB_ICONEXCLAMATION); } printf("CxbxKrnl: Terminating Process\n"); diff --git a/Source/Win32/CxbxKrnl/EmuD3D8.cpp b/Source/Win32/CxbxKrnl/EmuD3D8.cpp index 5d091ab25..c3c72c618 100644 --- a/Source/Win32/CxbxKrnl/EmuD3D8.cpp +++ b/Source/Win32/CxbxKrnl/EmuD3D8.cpp @@ -1017,7 +1017,7 @@ HRESULT WINAPI xd3d8::EmuIDirect3DSurface8_GetDesc if(SurfaceDesc.MultiSampleType == D3DMULTISAMPLE_NONE) pDesc->MultiSampleType = (xd3d8::D3DMULTISAMPLE_TYPE)0x0011; else - EmuCleanup("EmuIDirect3DSurface8_GetDesc Unknown Multisample format!"); + EmuCleanup("EmuIDirect3DSurface8_GetDesc Unknown Multisample format! (%d)", SurfaceDesc.MultiSampleType); pDesc->Width = SurfaceDesc.Width; pDesc->Height = SurfaceDesc.Height; @@ -1066,7 +1066,7 @@ HRESULT WINAPI xd3d8::EmuIDirect3DSurface8_LockRect NewFlags |= D3DLOCK_READONLY; if(Flags & !(0x80 | 0x40)) - EmuCleanup("EmuIDirect3DSurface8_LockRect: Unknown Flags!"); + EmuCleanup("EmuIDirect3DSurface8_LockRect: Unknown Flags! (0x%.08X)", Flags); // This is lame, but we have no choice (afaik) ((IDirect3DSurface8*)pThis)->UnlockRect(); @@ -1253,7 +1253,7 @@ VOID WINAPI xd3d8::EmuIDirect3DDevice8_SetRenderState_CullMode Value = D3DCULL_CCW; break; default: - EmuCleanup("EmuIDirect3DDevice8_SetRenderState_CullMode: Unknown Cullmode"); + EmuCleanup("EmuIDirect3DDevice8_SetRenderState_CullMode: Unknown Cullmode (%d)", Value); } g_pD3D8Device->SetRenderState(D3DRS_CULLMODE, Value); diff --git a/Source/Win32/CxbxKrnl/EmuKrnl.cpp b/Source/Win32/CxbxKrnl/EmuKrnl.cpp index 3939eb41e..b0223fc7c 100644 --- a/Source/Win32/CxbxKrnl/EmuKrnl.cpp +++ b/Source/Win32/CxbxKrnl/EmuKrnl.cpp @@ -211,7 +211,7 @@ XBSYSAPI EXPORTNUM(24) NTSTATUS NTAPI xboxkrnl::ExQueryNonVolatileSetting break; default: - printf("EmuKrnl (0x%X): ExQueryNonVolatileSetting unknown ValueIndex : %.08X\n", ValueIndex); + printf("ExQueryNonVolatileSetting unknown ValueIndex (%d)\n", ValueIndex); break; } diff --git a/Source/Win32/CxbxKrnl/HLEDataBase.cpp b/Source/Win32/CxbxKrnl/HLEDataBase.cpp index 40b495a05..20fc3215d 100644 --- a/Source/Win32/CxbxKrnl/HLEDataBase.cpp +++ b/Source/Win32/CxbxKrnl/HLEDataBase.cpp @@ -72,6 +72,7 @@ namespace xg #include "D3D8.1.0.4361.inl" #include "D3D8.1.0.4627.inl" #include "XG.1.0.4361.inl" +#include "XG.1.0.4627.inl" // ****************************************************************** // * HLEDataBase @@ -141,6 +142,13 @@ HLEData HLEDataBase[] = XG_1_0_4361, XG_1_0_4361_SIZE }, + // XG Version 1.0.4627 + { + "XGRAPHC", + 1, 0, 4627, + XG_1_0_4627, + XG_1_0_4627_SIZE + }, }; // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/XG.1.0.4627.inl b/Source/Win32/CxbxKrnl/XG.1.0.4627.inl new file mode 100644 index 000000000..1587031dd --- /dev/null +++ b/Source/Win32/CxbxKrnl/XG.1.0.4627.inl @@ -0,0 +1,55 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->XG.1.0.4627.cpp +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** + +// ****************************************************************** +// * XG_1_0_4627 +// ****************************************************************** +OOVPATable XG_1_0_4627[] = +{ + // XGIsSwizzledFormat (* unchanged since 4361 *) + { + (OOVPA*)&XGIsSwizzledFormat_1_0_4361, + + xg::EmuXGIsSwizzledFormat, + + #ifdef _DEBUG_TRACE + "XGIsSwizzledFormat" + #endif + }, +}; + +// ****************************************************************** +// * XG_1_0_4627_SIZE +// ****************************************************************** +uint32 XG_1_0_4627_SIZE = sizeof(XG_1_0_4627); diff --git a/Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl b/Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl index caed4b2b3..15373850c 100644 --- a/Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl +++ b/Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl @@ -32,6 +32,34 @@ // * // ****************************************************************** +// ****************************************************************** +// * RtlFreeHeap +// ****************************************************************** +SOOVPA<9> RtlFreeHeap_1_0_4627 = +{ + 0, // Large == 0 + 9, // Count == 9 + + { + // RtlFreeHeap+0x1F : test edi, edi + { 0x1F, 0x85 }, // (Offset,Value)-Pair #1 + { 0x20, 0xFF }, // (Offset,Value)-Pair #2 + + // RtlFreeHeap+0x23 : mov al, 1 + { 0x23, 0xB0 }, // (Offset,Value)-Pair #3 + { 0x24, 0x01 }, // (Offset,Value)-Pair #4 + + // RtlFreeHeap+0x35 : mov eax, fs:[0x20] + { 0x35, 0x64 }, // (Offset,Value)-Pair #5 + { 0x36, 0xA1 }, // (Offset,Value)-Pair #6 + { 0x37, 0x20 }, // (Offset,Value)-Pair #7 + + // RtlFreeHeap+0x49 : push 0x0B + { 0x49, 0x6A }, // (Offset,Value)-Pair #8 + { 0x4A, 0x0B }, // (Offset,Value)-Pair #9 + } +}; + // ****************************************************************** // * XAPI_1_0_4627 // ****************************************************************** @@ -57,9 +85,9 @@ OOVPATable XAPI_1_0_4627[] = "RtlAllocateHeap" #endif }, - // RtlFreeHeap (* unchanged since 1.0.4361 *) (* OR FARTHER, AND VERIFY THIS ONE *) + // RtlFreeHeap { - (OOVPA*)&RtlFreeHeap_1_0_4361, + (OOVPA*)&RtlFreeHeap_1_0_4627, xapi::EmuRtlFreeHeap,