Doo Doo Doo Doo Doo DooDoo Doo Doo

This commit is contained in:
Aaron Robinson 2003-04-29 03:30:58 +00:00
parent 7067994242
commit 6a8217e93b
11 changed files with 191 additions and 57 deletions

View File

@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="CxbxKrnl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
@ -53,7 +53,8 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 d3d8.lib dinput8.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"Bin/CxbxKrnl.pdb" /map:"Bin/CxbxKrnl.map" /debug /machine:I386 /nodefaultlib:"lbc" /out:"Bin/Cxbx.dll" /libpath:"Lib"
# ADD LINK32 d3d8.lib dinput8.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib:"lbc" /out:"Bin/Cxbx.dll" /libpath:"Lib"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "CxbxKrnl - Win32 Debug"
@ -213,6 +214,10 @@ SOURCE=.\Include\Win32\CxbxKrnl\ResCxbxDll.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\ThreadList.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\Xapi.1.0.3911.h
# End Source File
# Begin Source File
@ -325,6 +330,10 @@ SOURCE=.\Source\Win32\Mutex.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\CxbxKrnl\ThreadList.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\CxbxKrnl\Xapi.1.0.3911.inl
# End Source File
# Begin Source File

View File

@ -5,24 +5,23 @@ version: 0.7.0 (??/??/??)
- Added Controller Input and Configuration!
- __declspec(thread) style TLS is working!!
- Added Recent Xbe/Exe file menus
- Support __declspec(thread) style TLS ouch!! :)
- Fixed GUI color issues
- Massive code re-organization.
- Lots of random optimizations
- Sooo many random optimizations
- Went lower level with certain components of
emulation. This should allow progress to move
faster, ironically.
emulation. Progress should speed up.
- Some Xbe parsing and debug output fixes.
You should now be able to deal with the
slightly odd Linux Xbe files.
- Fixed GUI color issues
- Much better emulation exception handling
version: 0.6.0-pre12 (02/23/03)

View File

@ -1,5 +1,7 @@
Cxbx Todo:
Phase out EmuPanic() (EmuCleanup is good)
Some sort of delete-after-emulation type of functionality?
Use SetDataFormat instead of parsing device input by hand?

View File

@ -61,7 +61,7 @@ typedef signed long sint32;
// ******************************************************************
// * Version information
// ******************************************************************
#define _CXBX_VERSION "0.7.0-pre1"
#define _CXBX_VERSION "0.7.0-pre2"
// ******************************************************************
// * Define this to trace intercepted function calls

View File

@ -34,32 +34,4 @@
#ifndef EMUKRNL_H
#define EMUKRNL_H
// ******************************************************************
// * Linked list of threads
// ******************************************************************
struct ThreadList
{
static void Insert(HANDLE hThread, DWORD hThreadId)
{
ThreadList *tl = ThreadList::pHead;
tl->hThread = hThread;
tl->dwThreadId = GetCurrentThreadId();
tl->pNext = new ThreadList;
tl->pNext->hThread = NULL;
tl->pNext->dwThreadId = 0;
tl->pNext->pNext = NULL;
ThreadList::pHead = tl->pNext;
}
static ThreadList *pHead;
static ThreadList *pFirst;
HANDLE hThread;
DWORD dwThreadId;
ThreadList *pNext;
};
#endif

View File

@ -0,0 +1,56 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->ThreadList.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 <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef THREADLIST_H
#define THREADLIST_H
#include <windows.h>
// ******************************************************************
// * Linked list of threads
// ******************************************************************
struct ThreadList
{
static void Insert(HANDLE hThread, DWORD hThreadId);
static void Remove(DWORD hThreadId);
static ThreadList *pHead;
static ThreadList *pFirst;
HANDLE hThread;
DWORD dwThreadId;
ThreadList *pNext;
};
#endif

View File

@ -47,6 +47,7 @@ namespace xboxkrnl
#include "EmuD3D8.h"
#include "EmuKrnl.h"
#include "EmuShared.h"
#include "ThreadList.h"
#include "HLEDataBase.h"
// ******************************************************************
@ -401,13 +402,6 @@ extern "C" CXBXKRNL_API void NTAPI EmuPanic()
printf("Emu (0x%.08X): EmuPanic()\n", GetCurrentThreadId());
#ifdef _DEBUG_TRACE
MessageBox(NULL, "Kernel Panic! Process will now terminate.\n\n"
"Check debug traces for hints on the cause of this crash.", "CxbxKrnl", MB_OK | MB_ICONEXCLAMATION);
#else
MessageBox(NULL, "Kernel Panic! Process will now terminate.", "CxbxKrnl", MB_OK | MB_ICONEXCLAMATION);
#endif
EmuCleanup("Kernel Panic!");
EmuSwapFS(); // XBox FS
@ -611,11 +605,13 @@ int ExitException(LPEXCEPTION_POINTERS e)
printf("\n");
}
MessageBox(NULL, "Warning: Could not safely terminate process!", "Cxbx", MB_OK);
count++;
if(count > 1)
{
MessageBox(NULL, "Warning: Could not safely terminate process!", "Cxbx", MB_OK);
MessageBox(NULL, "Warning: Multiple Problems!", "Cxbx", MB_OK);
return EXCEPTION_CONTINUE_SEARCH;
}

View File

@ -108,7 +108,7 @@ void EmuGenerateFS(int TlsAdjust)
tlsExData->wSwapFS = NewFS;
tlsExData->bIsXboxFS = false;
tlsExData->dwSizeOfOrgTLS = (TlsAdjust == -1) ? -1 : 0x18 + TlsAdjust;
tlsExData->dwSizeOfOrgTLS = (TlsAdjust == -1) ? 0 : 0x18 + TlsAdjust;
tlsExData->pOrgTLS = (void*)new char[tlsExData->dwSizeOfOrgTLS];
memcpy(tlsExData->pOrgTLS, TLSPtr, tlsExData->dwSizeOfOrgTLS);
@ -217,7 +217,6 @@ void EmuCleanupFS()
}
memcpy(TLSPtr, tlsExData->pOrgTLS, tlsExData->dwSizeOfOrgTLS);
}
if(tlsExData->wSwapFS != 0)

View File

@ -56,12 +56,7 @@ namespace xntdll
#include "EmuFS.h"
#include "EmuFile.h"
#include "EmuKrnl.h"
// ******************************************************************
// * Globals
// ******************************************************************
ThreadList *ThreadList::pFirst = new ThreadList;
ThreadList *ThreadList::pHead = ThreadList::pFirst;
#include "ThreadList.h"
// ******************************************************************
// * Loaded at run-time to avoid linker conflicts
@ -159,6 +154,10 @@ static DWORD WINAPI PCSTProxy
callComplete:
EmuSwapFS(); // Win2k/XP FS
MessageBox(NULL, "Thread is all done.", "Cxbx", MB_OK);
EmuCleanupFS();
return 0;
@ -811,6 +810,42 @@ XBSYSAPI EXPORTNUM(255) NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadEx
return STATUS_SUCCESS;
}
// ******************************************************************
// * PsTerminateSystemThread
// ******************************************************************
XBSYSAPI EXPORTNUM(258) VOID NTAPI xboxkrnl::PsTerminateSystemThread(IN NTSTATUS ExitStatus)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuKrnl (0x%.08X): PsTerminateSystemThread\n"
"(\n"
" ExitStatus : 0x%.08X\n"
");\n",
GetCurrentThreadId(), ExitStatus);
}
#endif
// ******************************************************************
// * Remove this thread handle
// ******************************************************************
{
DWORD hThreadId = GetCurrentThreadId();
ThreadList::Remove(hThreadId);
}
ExitThread(ExitStatus);
EmuSwapFS(); // Xbox FS
return;
}
// ******************************************************************
// * 0x0115 RtlEnterCriticalSection
// ******************************************************************

View File

@ -43,6 +43,7 @@ namespace xboxkrnl
};
#include "Cxbx.h"
#include "Emu.h"
// ******************************************************************
// * NOTE:
@ -56,8 +57,8 @@ namespace xboxkrnl
// * option "#define PANIC(numb) cxbx_panic"
// *
// ******************************************************************
//#define PANIC(numb) EmuPanic
#define PANIC(numb) numb
#define PANIC(numb) EmuPanic
//#define PANIC(numb) numb
// ******************************************************************
// * KernelThunkTable
@ -322,7 +323,7 @@ extern "C" CXBXKRNL_API uint32 KernelThunkTable[367] =
(uint32)&xboxkrnl::PsCreateSystemThreadEx, // 0x00FF (255)
(uint32)PANIC(0x0100), // 0x0100 (256)
(uint32)PANIC(0x0101), // 0x0101 (257)
(uint32)PANIC(0x0102), // 0x0102 (258)
(uint32)&xboxkrnl::PsTerminateSystemThread, // 0x0102 (258)
(uint32)PANIC(0x0103), // 0x0103 (259)
(uint32)PANIC(0x0104), // 0x0104 (260)
(uint32)PANIC(0x0105), // 0x0105 (261)

View File

@ -0,0 +1,65 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->ThreadList.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 <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "ThreadList.h"
// ******************************************************************
// * Static
// ******************************************************************
ThreadList *ThreadList::pFirst = new ThreadList;
ThreadList *ThreadList::pHead = ThreadList::pFirst;
// ******************************************************************
// * ThreadList::Insert
// ******************************************************************
void ThreadList::Insert(HANDLE hThread, DWORD hThreadId)
{
ThreadList *tl = ThreadList::pHead;
tl->hThread = hThread;
tl->dwThreadId = GetCurrentThreadId();
tl->pNext = new ThreadList;
tl->pNext->hThread = NULL;
tl->pNext->dwThreadId = 0;
tl->pNext->pNext = NULL;
ThreadList::pHead = tl->pNext;
}
// ******************************************************************
// * ThreadList::Remove
// ******************************************************************
void ThreadList::Remove(DWORD hThreadId)
{
// TODO! (Make this a mutex though!)
}