Working on textures...
This commit is contained in:
parent
b66fa1ed27
commit
c3efd21a60
10
CxbxKrnl.dsp
10
CxbxKrnl.dsp
|
@ -1,5 +1,5 @@
|
|||
# Microsoft Developer Studio Project File - Name="CxbxKrnl" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 60000
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
@ -25,7 +25,7 @@ CFG=CxbxKrnl - Win32 Release
|
|||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
CPP=xicl6.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
|
@ -51,7 +51,7 @@ RSC=rc.exe
|
|||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
LINK32=xilink6.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 /map /machine:I386 /out:"Bin/Cxbx.dll" /libpath:"Lib"
|
||||
# SUBTRACT LINK32 /pdb:none /debug
|
||||
|
@ -78,9 +78,9 @@ LINK32=link.exe
|
|||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
LINK32=xilink6.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 /debug /machine:I386 /pdbtype:sept
|
||||
# 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 /debug /machine:I386 /pdbtype:sept /libpath:"Lib"
|
||||
# ADD LINK32 d3dx8.lib 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 /debug /machine:I386 /pdbtype:sept /libpath:"Lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef signed long sint32;
|
|||
// ******************************************************************
|
||||
// * Define this to trace intercepted function calls
|
||||
// ******************************************************************
|
||||
//#define _DEBUG_TRACE
|
||||
#define _DEBUG_TRACE
|
||||
|
||||
// ******************************************************************
|
||||
// * Round up dwValue to nearest multiple of dwMult
|
||||
|
|
|
@ -89,4 +89,9 @@ extern void *g_pTLSData;
|
|||
// ******************************************************************
|
||||
extern Xbe::Header *g_pXbeHeader;
|
||||
|
||||
// ******************************************************************
|
||||
// * data: g_hCurDir
|
||||
// ******************************************************************
|
||||
extern HANDLE g_hCurDir;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -71,9 +71,10 @@ namespace xd3d8
|
|||
// ******************************************************************
|
||||
// * global / static
|
||||
// ******************************************************************
|
||||
extern Xbe::TLS *g_pTLS = 0;
|
||||
extern void *g_pTLSData = 0;
|
||||
extern Xbe::Header *g_pXbeHeader = 0;
|
||||
extern Xbe::TLS *g_pTLS = NULL;
|
||||
extern void *g_pTLSData = NULL;
|
||||
extern Xbe::Header *g_pXbeHeader = NULL;
|
||||
extern HANDLE g_hCurDir = NULL;
|
||||
|
||||
// ******************************************************************
|
||||
// * static
|
||||
|
@ -243,6 +244,11 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit
|
|||
szBuffer[spot] = '\0';
|
||||
|
||||
SetCurrentDirectory(szBuffer);
|
||||
|
||||
g_hCurDir = CreateFile(szBuffer, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
|
||||
if(g_hCurDir == INVALID_HANDLE_VALUE)
|
||||
EmuCleanup("Could not map D:\\\n");
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
|
@ -397,7 +403,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit
|
|||
{
|
||||
EmuSwapFS(); // XBox FS
|
||||
|
||||
Entry();
|
||||
Entry();
|
||||
|
||||
EmuSwapFS(); // Win2k/XP FS
|
||||
}
|
||||
|
|
|
@ -471,7 +471,11 @@ HRESULT WINAPI xd3d8::EmuIDirect3D8_CreateDevice
|
|||
// * it is necessary to store this pointer globally for emulation
|
||||
// ******************************************************************
|
||||
g_pD3D8Device = *ppReturnedDeviceInterface;
|
||||
|
||||
/* HACK
|
||||
LPDIRECT3DTEXTURE8 pCxbxTexture;
|
||||
D3DXCreateTextureFromFile(g_pD3D8Device, "Media\\cxbx.bmp", &pCxbxTexture);
|
||||
g_pD3D8Device->SetTexture(0, pCxbxTexture);
|
||||
*/
|
||||
EmuSwapFS(); // XBox FS
|
||||
|
||||
return hRet;
|
||||
|
|
|
@ -352,7 +352,7 @@ XBSYSAPI EXPORTNUM(67) NTSTATUS xboxkrnl::IoCreateSymbolicLink
|
|||
}
|
||||
#endif
|
||||
|
||||
EmuCleanup("IoCreateSymbolicLink not implemented");
|
||||
EmuCleanup("IoCreateSymbolicLink not implemented");
|
||||
|
||||
// TODO: Actually um...implement this function
|
||||
NTSTATUS ret = STATUS_OBJECT_NAME_COLLISION;
|
||||
|
@ -643,80 +643,54 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile
|
|||
}
|
||||
#endif
|
||||
|
||||
char szFinalPath[260];
|
||||
char *szBuffer = ObjectAttributes->ObjectName->Buffer;
|
||||
|
||||
// ******************************************************************
|
||||
// * Make corrections to path, if necessary
|
||||
// * D:\ should map to current directory
|
||||
// ******************************************************************
|
||||
{
|
||||
char *szBuffer = ObjectAttributes->ObjectName->Buffer;
|
||||
if( (szBuffer[0] == 'D' || szBuffer[0] == 'd') && szBuffer[1] == ':' && szBuffer[2] == '\\')
|
||||
{
|
||||
szBuffer += 3;
|
||||
|
||||
// ******************************************************************
|
||||
// * D:\ should map to current directory
|
||||
// ******************************************************************
|
||||
if( (szBuffer[0] == 'D' || szBuffer[0] == 'd') && szBuffer[1] == ':' && szBuffer[2] == '\\')
|
||||
{
|
||||
szBuffer += 3;
|
||||
ObjectAttributes->RootDirectory = g_hCurDir;
|
||||
|
||||
GetCurrentDirectory(260, szFinalPath);
|
||||
#ifdef _DEBUG_TRACE
|
||||
printf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId());
|
||||
printf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer);
|
||||
printf(" New:\"%s\"\n", szBuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
strcat(szFinalPath, "\\");
|
||||
wchar_t wszObjectName[160];
|
||||
|
||||
strcat(szFinalPath, szBuffer);
|
||||
}
|
||||
else
|
||||
strcpy(szFinalPath, szBuffer);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_TRACE
|
||||
printf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId());
|
||||
printf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer);
|
||||
printf(" New:\"%s\"\n", szFinalPath);
|
||||
#endif
|
||||
|
||||
/****** The problem with this code is you can't use network paths, etc
|
||||
|
||||
NTSTATUS ret;
|
||||
|
||||
wchar_t wszObjectName[160];
|
||||
|
||||
xntdll::UNICODE_STRING NtUnicodeString;
|
||||
xntdll::OBJECT_ATTRIBUTES NtObjAttr;
|
||||
xntdll::UNICODE_STRING NtUnicodeString;
|
||||
xntdll::OBJECT_ATTRIBUTES NtObjAttr;
|
||||
|
||||
// ******************************************************************
|
||||
// * Initialize Object Attributes
|
||||
// * Initialize Object Attributes
|
||||
// ******************************************************************
|
||||
{
|
||||
mbstowcs(wszObjectName, szFinalPath, 160);
|
||||
{
|
||||
mbstowcs(wszObjectName, szBuffer, 160);
|
||||
|
||||
NT_RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
|
||||
NT_RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
|
||||
|
||||
InitializeObjectAttributes(&NtObjAttr, &NtUnicodeString, ObjectAttributes->Attributes, ObjectAttributes->RootDirectory, NULL);
|
||||
}
|
||||
InitializeObjectAttributes(&NtObjAttr, &NtUnicodeString, ObjectAttributes->Attributes, ObjectAttributes->RootDirectory, NULL);
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * Redirect to NtCreateFile
|
||||
// * Redirect to NtCreateFile
|
||||
// ******************************************************************
|
||||
ret = NT_NtCreateFile
|
||||
(
|
||||
FileHandle, DesiredAccess, &NtObjAttr, (xntdll::IO_STATUS_BLOCK*)IoStatusBlock,
|
||||
(xntdll::LARGE_INTEGER*)AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, NULL, NULL
|
||||
);
|
||||
NTSTATUS ret = NT_NtCreateFile
|
||||
(
|
||||
FileHandle, DesiredAccess, &NtObjAttr, (xntdll::IO_STATUS_BLOCK*)IoStatusBlock,
|
||||
(xntdll::LARGE_INTEGER*)AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, NULL, NULL
|
||||
);
|
||||
|
||||
if(FAILED(ret))
|
||||
EmuCleanup("NtCreateFile Failed!");
|
||||
*/
|
||||
// NOTE: We can map this to IoCreateFile once implemented (if ever necessary)
|
||||
// xboxkrnl::IoCreateFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, 0);
|
||||
// NOTE: We can map this to IoCreateFile once implemented (if ever necessary)
|
||||
// xboxkrnl::IoCreateFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, 0);
|
||||
|
||||
EmuSwapFS(); // Xbox FS
|
||||
|
||||
// TODO: Actually parse parameters and use the right CreateDisposition
|
||||
*FileHandle = CreateFile(szFinalPath, DesiredAccess, ShareAccess, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if(*FileHandle == INVALID_HANDLE_VALUE)
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -750,11 +724,52 @@ XBSYSAPI EXPORTNUM(202) NTSTATUS xboxkrnl::NtOpenFile
|
|||
}
|
||||
#endif
|
||||
|
||||
EmuCleanup("And...Remember to check if this should be NTAPI (NtOpenFile)");
|
||||
|
||||
xboxkrnl::IoCreateFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, 0, 0, ShareAccess, 1, OpenOptions, 0);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * 0x00D3 - NtQueryInformationFile
|
||||
// ******************************************************************
|
||||
XBSYSAPI EXPORTNUM(211) NTSTATUS NTAPI xboxkrnl::NtQueryInformationFile
|
||||
(
|
||||
IN HANDLE FileHandle,
|
||||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||||
OUT PVOID FileInformation,
|
||||
IN ULONG Length,
|
||||
IN FILE_INFORMATION_CLASS FileInfo
|
||||
)
|
||||
{
|
||||
EmuSwapFS(); // Win2k/XP FS
|
||||
|
||||
// ******************************************************************
|
||||
// * debug trace
|
||||
// ******************************************************************
|
||||
#ifdef _DEBUG_TRACE
|
||||
{
|
||||
printf("EmuKrnl (0x%X): NtQueryInformationFile\n"
|
||||
"(\n"
|
||||
" FileHandle : 0x%.08X\n"
|
||||
" IoStatusBlock : 0x%.08X\n"
|
||||
" FileInformation : 0x%.08X\n"
|
||||
" Length : 0x%.08X\n"
|
||||
" FileInformationClass: 0x%.08X\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation,
|
||||
Length, FileInfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
EmuCleanup("NtQueryInformationFile (TODO)");
|
||||
|
||||
EmuSwapFS(); // Xbox FS
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * 0x00DA - NtQueryVolumeInformationFile
|
||||
// ******************************************************************
|
||||
|
|
|
@ -276,7 +276,7 @@ extern "C" CXBXKRNL_API uint32 KernelThunkTable[367] =
|
|||
(uint32)PANIC(0x00D0), // 0x00D0 (208)
|
||||
(uint32)PANIC(0x00D1), // 0x00D1 (209)
|
||||
(uint32)PANIC(0x00D2), // 0x00D2 (210)
|
||||
(uint32)PANIC(0x00D3), // 0x00D3 (211)
|
||||
(uint32)&xboxkrnl::NtQueryInformationFile, // 0x00D3 (211)
|
||||
(uint32)PANIC(0x00D4), // 0x00D4 (212)
|
||||
(uint32)PANIC(0x00D5), // 0x00D5 (213)
|
||||
(uint32)PANIC(0x00D6), // 0x00D6 (214)
|
||||
|
|
Loading…
Reference in New Issue