This commit is contained in:
Aaron Robinson 2003-05-20 06:39:41 +00:00
parent c9fa132611
commit 384fdd5cd2
8 changed files with 104 additions and 9 deletions

View File

@ -2,12 +2,10 @@ Cxbx Todo:
Retail Games!
Hijack TLS init function, prepare using our own rules.
Perfect the timing on KeTickCount
Certain SetRenderState's simply update a global..have Cxbx use these
Fix TLS (Just do it by hand, forget using Win32 TLS)
Some sort of delete-after-emulation type of functionality?
Use SetDataFormat instead of parsing device input by hand?

View File

@ -276,6 +276,15 @@ BOOL WINAPI EmuCloseHandle
// ******************************************************************
VOID WINAPI EmuXapiInitProcess();
// ******************************************************************
// * func: EmuXapiThreadStartup
// ******************************************************************
VOID WINAPI EmuXapiThreadStartup
(
DWORD dwDummy1,
DWORD dwDummy2
);
/* Too High Level!
// ******************************************************************
// * func: XapiSetupPerTitleDriveLetters

View File

@ -516,8 +516,8 @@ EmuExe::EmuExe(Xbe *x_Xbe, DebugMode x_debug_mode, char *x_debug_filename) : Exe
{
memcpy(pWriteCursor, x_Xbe->m_TLS, sizeof(Xbe::TLS));
pWriteCursor += sizeof(Xbe::TLS);
memcpy(pWriteCursor, x_Xbe->GetTLSData(), (x_Xbe->m_TLS->dwDataEndAddr - x_Xbe->m_TLS->dwDataStartAddr));
pWriteCursor += (x_Xbe->m_TLS->dwDataEndAddr - x_Xbe->m_TLS->dwDataStartAddr);
memcpy(pWriteCursor, x_Xbe->GetTLSData(), RoundUp(x_Xbe->m_TLS->dwDataEndAddr - x_Xbe->m_TLS->dwDataStartAddr, 0x04));
pWriteCursor += RoundUp(x_Xbe->m_TLS->dwDataEndAddr - x_Xbe->m_TLS->dwDataStartAddr, 0x04);
}
// ******************************************************************
@ -571,7 +571,7 @@ EmuExe::EmuExe(Xbe *x_Xbe, DebugMode x_debug_mode, char *x_debug_filename) : Exe
if(x_Xbe->m_TLS != 0)
{
*(uint32 *)((uint32)m_bzSection[i] + 41) = WriteCursor;
WriteCursor += (x_Xbe->m_TLS->dwDataEndAddr - x_Xbe->m_TLS->dwDataStartAddr);
WriteCursor += RoundUp(x_Xbe->m_TLS->dwDataEndAddr - x_Xbe->m_TLS->dwDataStartAddr, 0x04);
}
else
{

View File

@ -308,8 +308,6 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit
{
EmuSwapFS(); // XBox FS
// __asm int 3
Entry();
EmuSwapFS(); // Win2k/XP FS

View File

@ -364,7 +364,7 @@ HRESULT WINAPI xd3d8::EmuIDirect3D8_CreateDevice
Adapter = D3DADAPTER_DEFAULT;
// pPresentationParameters->Windowed = TRUE;
pPresentationParameters->Windowed = TRUE;
// TODO: More intelligently set this only when the game wants it
// pPresentationParameters->SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;

View File

@ -148,6 +148,17 @@ void EmuGenerateFS(Xbe::TLS *pTLS, void *pTLSData)
NewPcr->PrcbData.CurrentThread->TlsData = (void*)pTLSData;
}
// ******************************************************************
// * Prepare TLS
// ******************************************************************
{
// TLS Index Address := 0
*(uint32*)pTLS->dwTLSIndexAddr = 0;
// dword @ pTLSData := pTLSData
*(void**)pTLSData = pTLSData;
}
// ******************************************************************
// * Swap into the "NewFS"
// ******************************************************************

View File

@ -290,6 +290,43 @@ VOID WINAPI xapi::EmuXapiInitProcess()
return;
}
// ******************************************************************
// * func: EmuXapiThreadStartup
// ******************************************************************
VOID WINAPI xapi::EmuXapiThreadStartup
(
DWORD dwDummy1,
DWORD dwDummy2
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuXapi (0x%.08X): EmuXapiThreadStartup\n"
"(\n"
" dwDummy1 : 0x%.08X\n"
" dwDummy2 : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwDummy1, dwDummy2);
}
#endif
EmuSwapFS(); // XBox FS
__asm
{
push dwDummy2
call dwDummy1
}
return;
}
/* Too High Level!
// ******************************************************************
// * func: XapiSetupPerTitleDriveLetters

View File

@ -250,6 +250,38 @@ SOOVPA<7> XapiInitProcess_1_0_4361 =
}
};
// ******************************************************************
// * XapiThreadStartup
// ******************************************************************
SOOVPA<10> XapiThreadStartup_1_0_4361 =
{
0, // Large == 0
10, // Count == 10
{
// XapiThreadStartup+0x00 : push 0x18
{ 0x00, 0x6A }, // (Offset,Value)-Pair #1
{ 0x01, 0x18 }, // (Offset,Value)-Pair #2
// XapiThreadStartup+0x10 : mov eax, fs:[0x28]
{ 0x10, 0x64 }, // (Offset,Value)-Pair #3
{ 0x11, 0xA1 }, // (Offset,Value)-Pair #4
{ 0x12, 0x28 }, // (Offset,Value)-Pair #5
// XapiThreadStartup+0x3F : repe movsd
{ 0x3F, 0xF3 }, // (Offset,Value)-Pair #6
{ 0x40, 0xA5 }, // (Offset,Value)-Pair #7
// XapiThreadStartup+0x7C : jmp +0x0C
{ 0x7C, 0xEB }, // (Offset,Value)-Pair #8
{ 0x7D, 0x0C }, // (Offset,Value)-Pair #9
// XapiThreadStartup+0x86 : retn
{ 0x86, 0xC3 }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * XapiSetupPerTitleDriveLetters
// ******************************************************************
@ -370,6 +402,16 @@ OOVPATable XAPI_1_0_4361[] =
#endif
},
//*/
// XapiThreadStartup
{
(OOVPA*)&XapiThreadStartup_1_0_4361,
xapi::EmuXapiThreadStartup,
#ifdef _DEBUG_TRACE
"XapiThreadStartup"
#endif
},
/* Too High Level
// XapiSetupPerTitleDriveLetters
{