mirror of
https://github.com/PatrickvL/Dxbx.git
synced 2024-05-31 19:17:53 -04:00
Lots of kernel API fixups (some are actually variables, others are update according to Undocumented.h)
This commit is contained in:
parent
7feadd8901
commit
942d4b2d50
|
@ -1428,6 +1428,20 @@ typedef struct
|
|||
} TXNetConfigParams,*PTXNetConfigParams;
|
||||
|
||||
|
||||
typedef struct _LAUNCH_DATA_HEADER {
|
||||
DWORD dwLaunchDataType;
|
||||
DWORD dwTitleId;
|
||||
CHAR szLaunchPath[520];
|
||||
DWORD dwFlags;
|
||||
} LAUNCH_DATA_HEADER, *PLAUNCH_DATA_HEADER;
|
||||
|
||||
typedef struct _LAUNCH_DATA_PAGE {
|
||||
LAUNCH_DATA_HEADER Header;
|
||||
UCHAR Pad[492];
|
||||
UCHAR LaunchData[3072];
|
||||
} LAUNCH_DATA_PAGE, *PLAUNCH_DATA_PAGE;
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// Thanks and credit go to Woodoo
|
||||
|
@ -1444,9 +1458,10 @@ extern "C"
|
|||
extern INT WINAPI XWriteTitleInfoNoReboot(LPVOID,LPVOID,DWORD,DWORD,LPVOID);
|
||||
extern INT WINAPI XWriteTitleInfoAndRebootA(LPVOID,LPVOID,DWORD,DWORD,LPVOID);
|
||||
|
||||
extern DWORD* LaunchDataPage;
|
||||
/* oddly enough, this is a pointer to a pointer */
|
||||
extern PLAUNCH_DATA_PAGE *LaunchDataPage;
|
||||
}
|
||||
|
||||
|
||||
extern "C" XBOXAPI LPVOID XeImageFileName;
|
||||
|
||||
#endif // __XBOX_INTERNAL_H__
|
||||
|
|
|
@ -417,6 +417,10 @@ const FILE_VALID_SET_FLAGS = $00000036;
|
|||
// ******************************************************************
|
||||
// * OBJECT_ATTRIBUTES
|
||||
// ******************************************************************
|
||||
// Object Attributes type
|
||||
// Differences from NT: There are no Length, SecurityDescriptor, or
|
||||
// SecurityQualityOfService fields. Also, ObjectName is ANSI, not
|
||||
// Unicode.
|
||||
type
|
||||
_OBJECT_ATTRIBUTES = packed record
|
||||
RootDirectory: HANDLE;
|
||||
|
@ -425,6 +429,17 @@ type
|
|||
end;
|
||||
OBJECT_ATTRIBUTES = _OBJECT_ATTRIBUTES;
|
||||
POBJECT_ATTRIBUTES = ^OBJECT_ATTRIBUTES;
|
||||
|
||||
// Flags for OBJECT_ATTRIBUTES::Attributes
|
||||
const OBJ_INHERIT = $00000002;
|
||||
const OBJ_PERMANENT = $00000010;
|
||||
const OBJ_EXCLUSIVE = $00000020;
|
||||
const OBJ_CASE_INSENSITIVE = $00000040;
|
||||
const OBJ_OPENIF = $00000080;
|
||||
const OBJ_OPENLINK = $00000100;
|
||||
const OBJ_KERNEL_HANDLE = $00000200;
|
||||
const OBJ_VALID_ATTRIBUTES = $000003F2;
|
||||
|
||||
(*
|
||||
// ******************************************************************
|
||||
// * FSINFOCLASS
|
||||
|
@ -866,6 +881,20 @@ type
|
|||
PrcbData: KPRCB; // 0x28
|
||||
end;
|
||||
|
||||
// Structure of the data at FS
|
||||
// Source: Undocumented.h
|
||||
type
|
||||
_FS_STRUCTURE = record
|
||||
ExceptionFrame: PPVOID; // 000 Current exception handler information
|
||||
TlsDataTop: PVOID; // 004 Pointer to current TLS data top
|
||||
unknown2: array [0..$1C-1] of BYTE; // 008
|
||||
CurrentIrql: KIRQL; // 024 Current IRQL of the OS
|
||||
ThreadObject: PKTHREAD; // 028 Thread structure of the current thread
|
||||
unknown3: array [0..$100-1] of BYTE; // ??? just padding - real size is unknown
|
||||
end;
|
||||
FS_STRUCTURE = _FS_STRUCTURE;
|
||||
PFS_STRUCTURE = ^FS_STRUCTURE;
|
||||
|
||||
// ******************************************************************
|
||||
// * EEPROM_INDEX
|
||||
// ******************************************************************
|
||||
|
|
|
@ -129,7 +129,7 @@ begin
|
|||
//
|
||||
|
||||
begin
|
||||
//if(SurfaceDesc.Format != XTL::D3DFMT_A8R8G8B8)
|
||||
//if(SurfaceDesc.Format <> XTL_D3DFMT_A8R8G8B8)
|
||||
// Break;
|
||||
//CxbxKrnlCleanup('Temporarily unsupported format for active texture unswizzle (0x%.08X)', SurfaceDesc.Format);
|
||||
|
||||
|
|
|
@ -1478,7 +1478,7 @@ begin
|
|||
dwWidth := 1 shl ((pPixelContainer.Format and X_D3DFORMAT_USIZE_MASK) shr X_D3DFORMAT_USIZE_SHIFT);
|
||||
dwHeight := 1 shl ((pPixelContainer.Format and X_D3DFORMAT_VSIZE_MASK) shr X_D3DFORMAT_VSIZE_SHIFT);
|
||||
dwMipMapLevels := (pPixelContainer.Format and X_D3DFORMAT_MIPMAP_MASK) shr X_D3DFORMAT_MIPMAP_SHIFT;
|
||||
dwDepth := 1;// HACK? 1 << ((pPixelContainer.Format and X_D3DFORMAT_PSIZE_MASK) shr X_D3DFORMAT_PSIZE_SHIFT);
|
||||
dwDepth := 1;// HACK? 1 shl ((pPixelContainer.Format and X_D3DFORMAT_PSIZE_MASK) shr X_D3DFORMAT_PSIZE_SHIFT);
|
||||
dwPitch := dwWidth*4;
|
||||
dwBPP := 4;
|
||||
end
|
||||
|
@ -1492,7 +1492,7 @@ begin
|
|||
dwWidth := 1 shl ((pPixelContainer.Format and X_D3DFORMAT_USIZE_MASK) shr X_D3DFORMAT_USIZE_SHIFT);
|
||||
dwHeight := 1 shl ((pPixelContainer.Format and X_D3DFORMAT_VSIZE_MASK) shr X_D3DFORMAT_VSIZE_SHIFT);
|
||||
dwMipMapLevels := (pPixelContainer.Format and X_D3DFORMAT_MIPMAP_MASK) shr X_D3DFORMAT_MIPMAP_SHIFT;
|
||||
dwDepth := 1; // HACK? 1 << ((pPixelContainer.Format and X_D3DFORMAT_PSIZE_MASK) shr X_D3DFORMAT_PSIZE_SHIFT);
|
||||
dwDepth := 1; // HACK? 1 shl ((pPixelContainer.Format and X_D3DFORMAT_PSIZE_MASK) shr X_D3DFORMAT_PSIZE_SHIFT);
|
||||
dwPitch := dwWidth * 2;
|
||||
dwBPP := 2;
|
||||
end
|
||||
|
@ -1504,7 +1504,7 @@ else if (X_Format = X_D3DFMT_L8) or (X_Format = X_D3DFMT_P8) or (X_Format = X_D3
|
|||
dwWidth := 1 shl ((pPixelContainer.Format and X_D3DFORMAT_USIZE_MASK) shr X_D3DFORMAT_USIZE_SHIFT);
|
||||
dwHeight := 1 shl ((pPixelContainer.Format and X_D3DFORMAT_VSIZE_MASK) shr X_D3DFORMAT_VSIZE_SHIFT);
|
||||
dwMipMapLevels := (pPixelContainer.Format and X_D3DFORMAT_MIPMAP_MASK) shr X_D3DFORMAT_MIPMAP_SHIFT;
|
||||
dwDepth := 1;// HACK? 1 << ((pPixelContainer.Format and X_D3DFORMAT_PSIZE_MASK) shr X_D3DFORMAT_PSIZE_SHIFT);
|
||||
dwDepth := 1;// HACK? 1 shl ((pPixelContainer.Format and X_D3DFORMAT_PSIZE_MASK) shr X_D3DFORMAT_PSIZE_SHIFT);
|
||||
dwPitch := dwWidth;
|
||||
dwBPP := 1;
|
||||
end
|
||||
|
|
|
@ -390,26 +390,26 @@ begin
|
|||
{
|
||||
VSH_SHADER_INSTRUCTION Inst;
|
||||
|
||||
VshParseInstruction(pToken, &Inst);
|
||||
VshConvertToIntermediate(&Inst, pShader);
|
||||
VshParseInstruction(pToken, @Inst);
|
||||
VshConvertToIntermediate(@Inst, pShader);
|
||||
EOI = (boolean)VshGetField(pToken, FLD_FINAL);
|
||||
}
|
||||
|
||||
// The size of the shader is
|
||||
*pOriginalSize = (DWORD)pToken - (DWORD)pFunction;
|
||||
|
||||
char* pShaderDisassembly = (char*)(*CxbxMalloc(pShader->IntermediateCount * 50); // Should be plenty
|
||||
DbgVshPrintf("-- Before conversion --\n");
|
||||
char* pShaderDisassembly = (char*)(*CxbxMalloc(pShader.IntermediateCount * 50); // Should be plenty
|
||||
DbgVshPrintf('-- Before conversion --');
|
||||
VshWriteShader(pShader, pShaderDisassembly, FALSE);
|
||||
DbgVshPrintf("%s", pShaderDisassembly);
|
||||
DbgVshPrintf("-----------------------\n");
|
||||
DbgVshPrintf('%s', pShaderDisassembly);
|
||||
DbgVshPrintf('-----------------------');
|
||||
|
||||
VshConvertShader(pShader, bNoReservedConstants);
|
||||
VshWriteShader(pShader, pShaderDisassembly, TRUE);
|
||||
|
||||
DbgVshPrintf("-- After conversion ---\n");
|
||||
DbgVshPrintf("%s", pShaderDisassembly);
|
||||
DbgVshPrintf("-----------------------\n");
|
||||
DbgVshPrintf('-- After conversion ---');
|
||||
DbgVshPrintf('%s', pShaderDisassembly);
|
||||
DbgVshPrintf('-----------------------');
|
||||
|
||||
hRet = D3DXAssembleShader(pShaderDisassembly,
|
||||
strlen(pShaderDisassembly),
|
||||
|
@ -420,7 +420,7 @@ begin
|
|||
|
||||
if (FAILED(hRet))
|
||||
{
|
||||
EmuWarning("Couldn't assemble recompiled vertex shader\n");
|
||||
EmuWarning('Couldn''t assemble recompiled vertex shader');
|
||||
}
|
||||
|
||||
CxbxFree(pShaderDisassembly);
|
||||
|
|
|
@ -204,7 +204,7 @@ begin
|
|||
begin
|
||||
DWORD dwCur := *(DWORD* )(dwPtr+v);
|
||||
|
||||
if (dwCur >= $803A6000 && dwCur < $819A6000) then
|
||||
if (dwCur >= $803A6000) and (dwCur < $819A6000) then
|
||||
*(DWORD* )(dwPtr+v) := g_HaloHack[1] + (dwCur - $803A6000);
|
||||
end;
|
||||
end; *)
|
||||
|
|
|
@ -43,9 +43,9 @@ type
|
|||
// * X_CDirectSoundBuffer
|
||||
// ******************************************************************
|
||||
X_CDirectSoundBuffer = packed record
|
||||
(* BYTE UnknownA[0x20]; // Offset: 0x00 *)
|
||||
(* BYTE UnknownA[0..$20-1]; // Offset: 0x00 *)
|
||||
|
||||
(* BYTE UnknownB[0x0C]; // Offset: 0x24 *)
|
||||
(* BYTE UnknownB[0..$0C-1]; // Offset: 0x24 *)
|
||||
EmuBuffer: PVOID; // Offset: 0x28
|
||||
EmuBufferDesc: _DSBUFFERDESC; // Offset: 0x2C
|
||||
EmuLockPtr1: PVOID; // Offset: 0x30
|
||||
|
@ -757,8 +757,8 @@ begin
|
|||
begin
|
||||
DWORD dwAcceptableMask := $00000010 or $00000020 or $00000080 or $00000100 or $00002000 or $00040000 or $00080000;
|
||||
|
||||
if (pdsbd.dwFlags and (~dwAcceptableMask)) then
|
||||
EmuWarning('Use of unsupported pdsbd.dwFlags mask(s) ($%.08X)', pdsbd.dwFlags and (~dwAcceptableMask));
|
||||
if (pdsbd.dwFlags and (not dwAcceptableMask)) then
|
||||
EmuWarning('Use of unsupported pdsbd.dwFlags mask(s) ($%.08X)', pdsbd.dwFlags and (not dwAcceptableMask));
|
||||
|
||||
pDSBufferDesc.dwSize := SizeOf(DSBUFFERDESC);
|
||||
pDSBufferDesc.dwFlags := (pdsbd.dwFlags and dwAcceptableMask) or DSBCAPS_CTRLVOLUME or DSBCAPS_GETCURRENTPOSITION2;
|
||||
|
@ -776,7 +776,7 @@ begin
|
|||
pDSBufferDesc.lpwfxFormat := (WAVEFORMATEX)CxbxMalloc(SizeOf(WAVEFORMATEX)+pdsbd.lpwfxFormat.cbSize);
|
||||
memcpy(pDSBufferDesc.lpwfxFormat, pdsbd.lpwfxFormat, SizeOf(WAVEFORMATEX));
|
||||
|
||||
if (pDSBufferDesc.lpwfxFormat.wFormatTag = (*WAVE_FORMAT_XBOX_ADPCM*)(*0x0069) then
|
||||
if (pDSBufferDesc.lpwfxFormat.wFormatTag = (*WAVE_FORMAT_XBOX_ADPCM*)(* $0069) then
|
||||
begin
|
||||
dwEmuFlags := dwEmuFlags or DSB_FLAG_ADPCM;
|
||||
|
||||
|
@ -1304,7 +1304,7 @@ begin
|
|||
[pThis, dwReserved1, dwReserved2, dwFlags);
|
||||
{$ENDIF}
|
||||
|
||||
if (dwFlags and (~DSBPLAY_LOOPING)) then
|
||||
if (dwFlags and (not DSBPLAY_LOOPING)) then
|
||||
CxbxKrnlCleanup('Unsupported Playing Flags');
|
||||
|
||||
HackUpdateSoundBuffers();
|
||||
|
@ -1418,7 +1418,7 @@ begin
|
|||
// Cxbx TODO: Ensure that 4627 & 4361 are intercepting far enough back
|
||||
// (otherwise pThis is manipulated!)
|
||||
|
||||
// HRESULT hRet = pThis->EmuDirectSoundBuffer8->SetVolume(lVolume);
|
||||
// HRESULT hRet = pThis.EmuDirectSoundBuffer8.SetVolume(lVolume);
|
||||
|
||||
EmuSwapFS(fsXbox);
|
||||
|
||||
|
@ -1445,7 +1445,7 @@ begin
|
|||
[pThis, dwFrequency);
|
||||
{$ENDIF}
|
||||
|
||||
// HRESULT hRet = pThis->EmuDirectSoundBuffer8->SetFrequency(dwFrequency);
|
||||
// HRESULT hRet = pThis.EmuDirectSoundBuffer8.SetFrequency(dwFrequency);
|
||||
|
||||
EmuSwapFS(fsXbox);
|
||||
|
||||
|
@ -1479,13 +1479,13 @@ begin
|
|||
|
||||
// convert from Xbox to PC DSound
|
||||
begin
|
||||
DWORD dwAcceptableMask := 0x00000010; // Cxbx TODO: Note 0x00040000 is being ignored (DSSTREAMCAPS_LOCDEFER)
|
||||
DWORD dwAcceptableMask := $00000010; // Cxbx TODO: Note 0x00040000 is being ignored (DSSTREAMCAPS_LOCDEFER)
|
||||
|
||||
if (pdssd.dwFlags and (~dwAcceptableMask)) then
|
||||
EmuWarning('Use of unsupported pdssd.dwFlags mask(s) (0x%.08X)', pdssd.dwFlags and (~dwAcceptableMask));
|
||||
if (pdssd.dwFlags and (not dwAcceptableMask)) then
|
||||
EmuWarning('Use of unsupported pdssd.dwFlags mask(s) (0x%.08X)', pdssd.dwFlags and (not dwAcceptableMask));
|
||||
|
||||
pDSBufferDesc.dwSize := SizeOf(DSBUFFERDESC);
|
||||
// pDSBufferDesc->dwFlags = (pdssd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2;
|
||||
// pDSBufferDesc.dwFlags = (pdssd.dwFlags and dwAcceptableMask) or DSBCAPS_CTRLVOLUME or DSBCAPS_GETCURRENTPOSITION2;
|
||||
pDSBufferDesc.dwFlags := DSBCAPS_CTRLVOLUME;
|
||||
pDSBufferDesc.dwBufferBytes := DSBSIZE_MIN;
|
||||
|
||||
|
@ -1502,7 +1502,7 @@ begin
|
|||
if (pDSBufferDesc.lpwfxFormat <> 0 and pDSBufferDesc.lpwfxFormat.wFormatTag <> WAVE_FORMAT_PCM) then
|
||||
begin
|
||||
EmuWarning('Invalid WAVE_FORMAT!');
|
||||
if (pDSBufferDesc.lpwfxFormat.wFormatTag = (*WAVE_FORMAT_XBOX_ADPCM*)(*0x0069) then
|
||||
if (pDSBufferDesc.lpwfxFormat.wFormatTag = (*WAVE_FORMAT_XBOX_ADPCM*)(* $0069) then
|
||||
EmuWarning('WAVE_FORMAT_XBOX_ADPCM Unsupported!');
|
||||
|
||||
ppStream^.EmuDirectSoundBuffer8 := 0;
|
||||
|
|
|
@ -160,10 +160,19 @@ type
|
|||
|
||||
function Unimplemented(const aAPI: string): NTSTATUS;
|
||||
|
||||
procedure InitializeObjectAttributes(
|
||||
p: POBJECT_ATTRIBUTES;
|
||||
n: PANSI_STRING;
|
||||
a: ULONG;
|
||||
r: HANDLE;
|
||||
dummy: Pointer
|
||||
);
|
||||
|
||||
var
|
||||
{156}xboxkrnl_KeTickCount: DWord;
|
||||
{162}xboxkrnl_KiBugCheckData: array [0..5 - 1] of ULONG_PTR; // Source: ReactOS
|
||||
{164}xboxkrnl_LaunchDataPage: PLAUNCH_DATA_PAGE;
|
||||
{357}xboxkrnl_IdexChannelObject: DWord;
|
||||
|
||||
// The following API names are derived from Pedro's APILogger V2
|
||||
// See http://forums.xbox-scene.com/index.php?showtopic=456303
|
||||
|
@ -240,7 +249,6 @@ procedure {334} xboxkrnl_WRITE_PORT_BUFFER_ULONG(
|
|||
Buffer: PULONG;
|
||||
Count: ULONG
|
||||
); stdcall; // Source: ReactOS
|
||||
function {357} xboxkrnl_IdexChannelObject(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
||||
function {000} xboxkrnl_UnknownAPI000(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function {367} xboxkrnl_UnknownAPI367(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
@ -259,6 +267,22 @@ begin
|
|||
Result := STATUS_PROCEDURE_NOT_FOUND; // abuse a standard NT error code
|
||||
end;
|
||||
|
||||
// Initializes an OBJECT_ATTRIBUTES.
|
||||
//
|
||||
// Differences from NT: SECURITY_DESCRIPTOR support is gone.
|
||||
procedure InitializeObjectAttributes(
|
||||
p: POBJECT_ATTRIBUTES;
|
||||
n: PANSI_STRING;
|
||||
a: ULONG;
|
||||
r: HANDLE;
|
||||
dummy: Pointer
|
||||
);
|
||||
begin
|
||||
p.RootDirectory := r;
|
||||
p.Attributes := a;
|
||||
p.ObjectName := n;
|
||||
end;
|
||||
|
||||
/// ##########
|
||||
/// ########## Start of Xbox Kernel API's :
|
||||
/// ##########
|
||||
|
@ -481,13 +505,6 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {357} xboxkrnl_IdexChannelObject(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('IdexChannelObject');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {367} xboxkrnl_UnknownAPI367(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
|
|
@ -56,27 +56,26 @@ function {003} xboxkrnl_AvSetDisplayMode(
|
|||
Pitch: ULONG;
|
||||
FrameBuffer: ULONG
|
||||
): ULONG; stdcall; // Source: OpenXDK
|
||||
procedure {004} xboxkrnl_AvSetSavedDataAddress(
|
||||
function {004} xboxkrnl_AvSetSavedDataAddress(
|
||||
Address: PVOID
|
||||
); stdcall; // Source: OpenXDK
|
||||
): PVOID; stdcall; // Source: OpenXDK
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
xboxkrnl_AvSavedDataAddress: PVOID = PVOID($F0040000); // Dxbx TODO : Take shogun's NULL ?
|
||||
|
||||
function {001} xboxkrnl_AvGetSavedDataAddress(
|
||||
): PVOID; stdcall; // Source: OpenXDK
|
||||
// Branch:shogun Revision:145 Translator:PatrickvL Done:100
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
EmuSwapFS(fsWindows);
|
||||
DbgPrintf('EmuKrnl : AvGetSavedDataAddress();');
|
||||
EmuSwapFS(fsXbox);
|
||||
{$ENDIF}
|
||||
|
||||
// Cxbx TODO: We might want to return something sometime...
|
||||
|
||||
EmuSwapFS(fsXbox);
|
||||
|
||||
Result := PVOID($F0040000); // Dxbx TODO : Take shogun's NULL ?
|
||||
Result := xboxkrnl_AvSavedDataAddress;
|
||||
end;
|
||||
|
||||
procedure {002} xboxkrnl_AvSendTVEncoderOption(
|
||||
|
@ -105,13 +104,22 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
procedure {004} xboxkrnl_AvSetSavedDataAddress(
|
||||
function {004} xboxkrnl_AvSetSavedDataAddress(
|
||||
Address: PVOID
|
||||
); stdcall; // Source: OpenXDK
|
||||
): PVOID; stdcall; // Source: OpenXDK
|
||||
begin
|
||||
{$IFDEF DEBUG}
|
||||
EmuSwapFS(fsWindows);
|
||||
Unimplemented('AvSetSavedDataAddress');
|
||||
DbgPrintf('EmuKrnl : AvSetSavedDataAddress(' +
|
||||
#13#10'(' +
|
||||
#13#10' Address : 0x%.8x' +
|
||||
#13#10')', [
|
||||
Address
|
||||
]);
|
||||
EmuSwapFS(fsXbox);
|
||||
{$ENDIF}
|
||||
Result := Address;
|
||||
xboxkrnl_AvSavedDataAddress := Result;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
@ -174,8 +174,12 @@ begin
|
|||
Result := pRet;
|
||||
end;
|
||||
|
||||
// Differences from NT: There is no PoolType field, as the XBOX
|
||||
// only has 1 pool, the non-paged pool.
|
||||
// ExAllocatePoolWithTag:
|
||||
// Allocates memory from the memory pool. The Tag parameter is a 4-letter
|
||||
// character constant to which to associate the allocation.
|
||||
//
|
||||
// Differences from NT: There is no PoolType field, as the XBOX only has 1
|
||||
// pool, the non-paged pool.
|
||||
function {015} xboxkrnl_ExAllocatePoolWithTag(
|
||||
NumberOfBytes: SIZE_T;
|
||||
Tag: ULONG
|
||||
|
@ -202,6 +206,10 @@ begin
|
|||
Result := pRet;
|
||||
end;
|
||||
|
||||
// ExFreePool:
|
||||
// Frees memory allocated by ExAllocatePool* functions.
|
||||
//
|
||||
// Differences from NT: None.
|
||||
procedure {017} xboxkrnl_ExFreePool(
|
||||
Block: PVOID
|
||||
); stdcall; // Source: ReactOS
|
||||
|
@ -265,6 +273,11 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// ExQueryNonVolatileSettings
|
||||
// Queries saved information, such as the region code.
|
||||
//
|
||||
// New to the XBOX.
|
||||
//
|
||||
// ExQueryNonVolatileSetting retrieves EEPROM information -
|
||||
// this function, when first called, creates a "shadow" copy
|
||||
// of the EEPROM in RAM which is used in subsequent calls to Query,
|
||||
|
@ -430,6 +443,10 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// ExSaveNonVolatileSettings
|
||||
// Writes saved information, such as the region code.
|
||||
//
|
||||
// New to the XBOX.
|
||||
function {029} xboxkrnl_ExSaveNonVolatileSetting(
|
||||
ValueIndex: DWORD;
|
||||
Type_: PDWORD; // OUT
|
||||
|
|
|
@ -42,6 +42,9 @@ uses
|
|||
uDxbxKrnlUtils;
|
||||
|
||||
var
|
||||
{040}xboxkrnl_HalDiskCachePartitionCount: DWORD;
|
||||
{041}xboxkrnl_HalDiskModelNumber: DWORD;
|
||||
{042}xboxkrnl_HalDiskSerialNumber: DWORD;
|
||||
{356}xboxkrnl_HalBootSMCVideoMode: DWORD; // Source: OpenXDK
|
||||
|
||||
procedure {009} xboxkrnl_HalReadSMCTrayState(
|
||||
|
@ -55,9 +58,6 @@ function {039} xboxkrnl_HalDisableSystemInterrupt(
|
|||
Vector: ULONG;
|
||||
Irql: KIRQL
|
||||
): LONGBOOL; stdcall; // Source: ReactOS
|
||||
function {040} xboxkrnl_HalDiskCachePartitionCount(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function {041} xboxkrnl_HalDiskModelNumber(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function {042} xboxkrnl_HalDiskSerialNumber(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function {043} xboxkrnl_HalEnableSystemInterrupt(
|
||||
Vector: ULONG;
|
||||
Irql: KIRQL;
|
||||
|
@ -141,27 +141,6 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {040} xboxkrnl_HalDiskCachePartitionCount(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('HalDiskCachePartitionCount');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {041} xboxkrnl_HalDiskModelNumber(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('HalDiskModelNumber');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {042} xboxkrnl_HalDiskSerialNumber(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('HalDiskSerialNumber');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {043} xboxkrnl_HalEnableSystemInterrupt(
|
||||
Vector: ULONG;
|
||||
Irql: KIRQL;
|
||||
|
@ -283,7 +262,6 @@ end;
|
|||
// Note that this function can't really be called directly...
|
||||
//
|
||||
// New to the XBOX.
|
||||
|
||||
procedure {365} xboxkrnl_HalEnableSecureTrayEject(
|
||||
); stdcall; // Source: XBMC Undocumented.h
|
||||
begin
|
||||
|
|
|
@ -289,7 +289,16 @@ function xboxkrnl_IoSetShareAccess(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
|||
function xboxkrnl_IoStartNextPacket(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_IoStartNextPacketByKey(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_IoStartPacket(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_IoSynchronousDeviceIoControlRequest(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_IoSynchronousDeviceIoControlRequest(
|
||||
IoControlCode: ULONG ;
|
||||
DeviceObject: PDEVICE_OBJECT;
|
||||
InputBuffer: PVOID ; // OPTIONAL
|
||||
InputBufferLength: ULONG;
|
||||
OutputBuffer: PVOID; // OPTIONAL
|
||||
OutputBufferLength: ULONG;
|
||||
unknown_use_zero: PDWORD; // OPTIONAL
|
||||
InternalDeviceIoControl: BOOLEAN
|
||||
): NTSTATUS; stdcall;
|
||||
function xboxkrnl_IoSynchronousFsdRequest(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_IofCallDriver(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_IofCompleteRequest(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
@ -457,6 +466,12 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// IoCreateSymbolicLink:
|
||||
// Creates a symbolic link in the object namespace.
|
||||
// NtCreateSymbolicLinkObject is much harder to use than this simple
|
||||
// function, so just use this one.
|
||||
//
|
||||
// Differences from NT: Uses ANSI_STRING instead of UNICODE_STRING.
|
||||
function xboxkrnl_IoCreateSymbolicLink(
|
||||
SymbolicLinkName: PSTRING;
|
||||
DeviceName: PSTRING
|
||||
|
@ -488,6 +503,11 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// IoDeleteSymbolicLink:
|
||||
// Creates a symbolic link in the object namespace. Deleting symbolic links
|
||||
// through the Nt* functions is a pain, so use this instead.
|
||||
//
|
||||
// Differences from NT: Uses ANSI_STRING instead of UNICODE_STRING.
|
||||
function xboxkrnl_IoDeleteSymbolicLink(
|
||||
SymbolicLinkName: PSTRING
|
||||
): NTSTATUS; stdcall;
|
||||
|
@ -593,7 +613,21 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_IoSynchronousDeviceIoControlRequest(): NTSTATUS; stdcall;
|
||||
// IoSynchronousDeviceIoControlRequest:
|
||||
// NICE. Makes kernel driver stuff sooooo much easier. This does a
|
||||
// blocking IOCTL on the specified device.
|
||||
//
|
||||
// New to the XBOX.
|
||||
function xboxkrnl_IoSynchronousDeviceIoControlRequest(
|
||||
IoControlCode: ULONG ;
|
||||
DeviceObject: PDEVICE_OBJECT;
|
||||
InputBuffer: PVOID ; // OPTIONAL
|
||||
InputBufferLength: ULONG;
|
||||
OutputBuffer: PVOID; // OPTIONAL
|
||||
OutputBufferLength: ULONG;
|
||||
unknown_use_zero: PDWORD; // OPTIONAL
|
||||
InternalDeviceIoControl: BOOLEAN
|
||||
): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('IoSynchronousDeviceIoControlRequest');
|
||||
|
|
|
@ -41,8 +41,8 @@ uses
|
|||
uDxbxKrnl;
|
||||
|
||||
var
|
||||
xboxkrnl_KdDebuggerEnabled: LONGBOOL; // Source: ReactOS
|
||||
xboxkrnl_KdDebuggerNotPresent: LONGBOOL; // Source: ReactOS
|
||||
{088}xboxkrnl_KdDebuggerEnabled: ByteBool;
|
||||
{089}xboxkrnl_KdDebuggerNotPresent: LONGBOOL; // Source: ReactOS
|
||||
|
||||
implementation
|
||||
|
||||
|
|
|
@ -41,11 +41,24 @@ uses
|
|||
uDxbxKrnl,
|
||||
uDxbxKrnlUtils;
|
||||
|
||||
var
|
||||
{120}xboxkrnl_KeInterruptTime: DWord;
|
||||
{154}xboxkrnl_KeSystemTime: DWord;
|
||||
{157}xboxkrnl_KeTimeIncrement: DWord = $2710;
|
||||
|
||||
function xboxkrnl_KeAlertResumeThread(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeAlertThread(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeBoostPriorityThread(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeBugCheck(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeBugCheckEx(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeBugCheck(
|
||||
BugCheckCode: DWORD
|
||||
): NTSTATUS; stdcall;
|
||||
function xboxkrnl_KeBugCheckEx(
|
||||
BugCheckCode: DWORD;
|
||||
BugCheckParameter1: PVOID;
|
||||
BugCheckParameter2: PVOID;
|
||||
BugCheckParameter3: PVOID;
|
||||
BugCheckParameter4: PVOID
|
||||
): NTSTATUS; stdcall;
|
||||
function xboxkrnl_KeCancelTimer(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeConnectInterrupt(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeDelayExecutionThread(
|
||||
|
@ -79,7 +92,6 @@ function xboxkrnl_KeInsertHeadQueue(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
|||
function xboxkrnl_KeInsertQueue(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeInsertQueueApc(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeInsertQueueDpc(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeInterruptTime(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeIsExecutingDpc(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeLeaveCriticalRegion(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KePulseEvent(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
@ -90,7 +102,7 @@ function xboxkrnl_KeQueryPerformanceFrequency(): NTSTATUS; stdcall; // UNKNOWN_S
|
|||
procedure xboxkrnl_KeQuerySystemTime(
|
||||
CurrentTime: PLARGE_INTEGER
|
||||
); stdcall;
|
||||
function xboxkrnl_KeRaiseIrqlToDpcLevel(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeRaiseIrqlToDpcLevel(): KIRQL; stdcall;
|
||||
function xboxkrnl_KeRaiseIrqlToSynchLevel(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeReleaseMutant(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeReleaseSemaphore(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
@ -124,9 +136,7 @@ function xboxkrnl_KeSetTimerEx(
|
|||
function xboxkrnl_KeStallExecutionProcessor(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeSuspendThread(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeSynchronizeExecution(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeSystemTime(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeTestAlertThread(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeTimeIncrement(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeWaitForMultipleObjects(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_KeWaitForSingleObject(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
||||
|
@ -156,15 +166,30 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeBugCheck(): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
// KeBugCheck:
|
||||
// Bug checks the kernel.
|
||||
// Same as KeBugCheckEx(BugCheckCode, 0, 0, 0, 0);
|
||||
//
|
||||
// Differences from NT: None, other than the reaction.
|
||||
function xboxkrnl_KeBugCheck(
|
||||
BugCheckCode: DWORD
|
||||
): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:100
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('KeBugCheck');
|
||||
EmuSwapFS(fsXbox);
|
||||
Result := xboxkrnl_KeBugCheckEx(BugCheckCode, nil, nil, nil, nil);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeBugCheckEx(): NTSTATUS; stdcall;
|
||||
// KeBugCheckEx:
|
||||
// Bug checks the kernel.
|
||||
//
|
||||
// Differences from NT: None, other than the reaction.
|
||||
function xboxkrnl_KeBugCheckEx(
|
||||
BugCheckCode: DWORD;
|
||||
BugCheckParameter1: PVOID;
|
||||
BugCheckParameter2: PVOID;
|
||||
BugCheckParameter3: PVOID;
|
||||
BugCheckParameter4: PVOID
|
||||
): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
@ -248,6 +273,10 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// KeInitializeDpc:
|
||||
// Initializes a DPC structure.
|
||||
//
|
||||
// Differences from NT: This function sets less fields than the NT version.
|
||||
procedure xboxkrnl_KeInitializeDpc(
|
||||
Dpc: PKDPC;
|
||||
DeferredRoutine: PKDEFERRED_ROUTINE;
|
||||
|
@ -316,6 +345,10 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// KeInitializeTimerEx:
|
||||
// Initializes a timer.
|
||||
//
|
||||
// Differences from NT: None.
|
||||
procedure xboxkrnl_KeInitializeTimerEx(
|
||||
Timer: PKTIMER;
|
||||
Type_: TIMER_TYPE
|
||||
|
@ -395,14 +428,6 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeInterruptTime(): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('KeInterruptTime');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeIsExecutingDpc(): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
|
@ -469,7 +494,11 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeRaiseIrqlToDpcLevel(): NTSTATUS; stdcall;
|
||||
// KeRaiseIrqlToDpcLevel:
|
||||
// Raises IRQL to DISPATCH_LEVEL. Like KeRaiseIrql except returns old level directly.
|
||||
//
|
||||
// Differences from NT: None.
|
||||
function xboxkrnl_KeRaiseIrqlToDpcLevel(): KIRQL; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
@ -636,9 +665,8 @@ function xboxkrnl_KeSetTimer(
|
|||
): LONGBOOL; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:100
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
EmuSwapFS(fsWindows);
|
||||
DbgPrintf('EmuKrnl : KeSetTimer' +
|
||||
#13#10'(' +
|
||||
#13#10' Timer : 0x%.08X' +
|
||||
|
@ -646,12 +674,11 @@ begin
|
|||
#13#10' Dpc : 0x%.08X' +
|
||||
#13#10');',
|
||||
[Timer, DueTime.QUADPART, Dpc]);
|
||||
EmuSwapFS(fsXbox);
|
||||
{$ENDIF}
|
||||
|
||||
// Call the newer function and supply a period of 0 (source: ReactOS)
|
||||
Result := xboxkrnl_KeSetTimerEx(Timer, DueTime, {Period=}0, Dpc);
|
||||
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeSetTimerEx(
|
||||
|
@ -717,14 +744,6 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeSystemTime(): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('KeSystemTime');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeTestAlertThread(): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
|
@ -733,14 +752,6 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeTimeIncrement(): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('KeTimeIncrement');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_KeWaitForMultipleObjects(): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
|
|
|
@ -67,18 +67,24 @@ procedure xboxkrnl_MmDeleteKernelStack(
|
|||
EndAddress: PVOID;
|
||||
BaseAddress: PVOID
|
||||
); stdcall;
|
||||
function xboxkrnl_MmFreeContiguousMemory(
|
||||
procedure xboxkrnl_MmFreeContiguousMemory(
|
||||
BaseAddress: PVOID
|
||||
): NTSTATUS; stdcall;
|
||||
); stdcall;
|
||||
function xboxkrnl_MmFreeSystemMemory(
|
||||
BaseAddress: PVOID;
|
||||
NumberOfBytes: ULONG
|
||||
): NTSTATUS; stdcall;
|
||||
function xboxkrnl_MmGetPhysicalAddress(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_MmGetPhysicalAddress(
|
||||
BaseAddress: PVOID
|
||||
): PHYSICAL_ADDRESS; stdcall;
|
||||
function xboxkrnl_MmIsAddressValid(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_MmLockUnlockBufferPages(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_MmLockUnlockPhysicalPage(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_MmMapIoSpace(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_MmMapIoSpace(
|
||||
PhysicalAddress: PHYSICAL_ADDRESS;
|
||||
NumberOfBytes: ULONG;
|
||||
ProtectionType: ULONG
|
||||
): PVOID; stdcall;
|
||||
procedure xboxkrnl_MmPersistContiguousMemory(
|
||||
BaseAddress: PVOID;
|
||||
NumberOfBytes: ULONG;
|
||||
|
@ -96,7 +102,10 @@ function xboxkrnl_MmSetAddressProtect(
|
|||
NumberOfBytes: ULONG;
|
||||
NewProtect: ULONG
|
||||
): NTSTATUS; stdcall;
|
||||
function xboxkrnl_MmUnmapIoSpace(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_MmUnmapIoSpace(
|
||||
BaseAddress: PVOID;
|
||||
NumberOfBytes: ULONG
|
||||
): PVOID; stdcall;
|
||||
function xboxkrnl_MmDbgAllocateMemory(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_MmDbgFreeMemory(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_MmDbgQueryAvailablePages(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
@ -113,6 +122,12 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// MmAllocateContiguousMemory:
|
||||
// Allocates a range of physically contiguous, cache-aligned memory from the
|
||||
// non-paged pool (= main pool on XBOX).
|
||||
//
|
||||
// Differences from NT: HighestAcceptableAddress was deleted, opting instead
|
||||
// to not care about the highest address.
|
||||
function xboxkrnl_MmAllocateContiguousMemory(
|
||||
NumberOfBytes: ULONG
|
||||
): PVOID; stdcall;
|
||||
|
@ -131,6 +146,8 @@ begin
|
|||
[NumberOfBytes]);
|
||||
{$ENDIF}
|
||||
|
||||
// Result := xboxkrnl_MmAllocateContiguousMemoryEx(NumberOfBytes, $00000000, $FFFFFFFF, 0, PAGE_READWRITE);
|
||||
|
||||
//
|
||||
// Cxbx NOTE: Kludgey (but necessary) solution:
|
||||
//
|
||||
|
@ -311,9 +328,13 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_MmFreeContiguousMemory(
|
||||
// MmFreeContiguousMemory:
|
||||
// Frees memory allocated with MmAllocateContiguousMemory.
|
||||
//
|
||||
// Differences from NT: None.
|
||||
procedure xboxkrnl_MmFreeContiguousMemory(
|
||||
BaseAddress: PVOID
|
||||
): NTSTATUS; stdcall;
|
||||
); stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:5
|
||||
(*var
|
||||
OrigBaseAddress: PVoid; *)
|
||||
|
@ -336,14 +357,14 @@ begin
|
|||
g_AlignCache.remove(BaseAddress);
|
||||
end;
|
||||
|
||||
if(OrigBaseAddress <> &xLaunchDataPage)
|
||||
if(OrigBaseAddress <> @xLaunchDataPage)
|
||||
begin
|
||||
CxbxFree(OrigBaseAddress);
|
||||
end
|
||||
else
|
||||
begin
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf('Ignored MmFreeContiguousMemory(&xLaunchDataPage)');
|
||||
DbgPrintf('Ignored MmFreeContiguousMemory(@xLaunchDataPage)');
|
||||
{$ENDIF}
|
||||
end; *)
|
||||
|
||||
|
@ -373,7 +394,13 @@ begin
|
|||
Result := STATUS_SUCCESS;
|
||||
end;
|
||||
|
||||
function xboxkrnl_MmGetPhysicalAddress(): NTSTATUS; stdcall;
|
||||
// MmGetPhysicalAddress:
|
||||
// Translates a virtual address into a physical address.
|
||||
//
|
||||
// Differences from NT: PhysicalAddress is 32 bit, not 64.
|
||||
function xboxkrnl_MmGetPhysicalAddress(
|
||||
BaseAddress: PVOID
|
||||
): PHYSICAL_ADDRESS; stdcall;
|
||||
// Branch:Dxbx
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
@ -405,11 +432,25 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_MmMapIoSpace(): NTSTATUS; stdcall;
|
||||
// Branch:Dxbx
|
||||
// MmMapIoSpace:
|
||||
// Maps a physical address area into the virtual address space.
|
||||
// DO NOT USE MEMORY MAPPED WITH THIS AS A BUFFER TO OTHER CALLS. For
|
||||
// example, don't WriteFile or NtWriteFile these buffers. Copy them first.
|
||||
//
|
||||
// Differences from NT: PhysicalAddress is 32 bit, not 64. ProtectionType
|
||||
// specifies the page protections, but it's a Win32 PAGE_ macro instead
|
||||
// of the normal NT enumeration. PAGE_READWRITE is probably what you
|
||||
// want...
|
||||
function xboxkrnl_MmMapIoSpace(
|
||||
PhysicalAddress: PHYSICAL_ADDRESS;
|
||||
NumberOfBytes: ULONG;
|
||||
ProtectionType: ULONG
|
||||
): PVOID; stdcall;
|
||||
// Branch:Dxbx Translator:PatrickvL Done:0
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('MmMapIoSpace');
|
||||
Unimplemented('MmMapIoSpace');
|
||||
Result := nil;
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
|
@ -474,7 +515,7 @@ begin
|
|||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf('EmuKrnl : MmQueryStatistics'+
|
||||
#13#10'(\'+
|
||||
#13#10'('+
|
||||
#13#10' MemoryStatistics : 0x%.08X' +
|
||||
#13#10');',
|
||||
[MemoryStatistics]);
|
||||
|
@ -482,13 +523,13 @@ begin
|
|||
|
||||
(*MEMORYSTATUS MemoryStatus;
|
||||
|
||||
GlobalMemoryStatus(&MemoryStatus);
|
||||
GlobalMemoryStatus(@MemoryStatus);
|
||||
|
||||
ZeroMemory(MemoryStatistics, sizeof(MM_STATISTICS));
|
||||
|
||||
MemoryStatistics->Length = sizeof(MM_STATISTICS);
|
||||
MemoryStatistics->TotalPhysicalPages = MemoryStatus.dwTotalVirtual / 4096;
|
||||
MemoryStatistics->AvailablePages = MemoryStatus.dwAvailVirtual / 4096;
|
||||
MemoryStatistics.Length = sizeof(MM_STATISTICS);
|
||||
MemoryStatistics.TotalPhysicalPages = MemoryStatus.dwTotalVirtual / 4096;
|
||||
MemoryStatistics.AvailablePages = MemoryStatus.dwAvailVirtual / 4096;
|
||||
|
||||
// HACK (does this matter?)
|
||||
MemoryStatistics.VirtualMemoryBytesReserved := MemoryStatus.dwTotalPhys - MemoryStatus.dwAvailPhys; *)
|
||||
|
@ -519,34 +560,42 @@ begin
|
|||
{$ENDIF}
|
||||
|
||||
// Halo Hack
|
||||
(*if(BaseAddress == (PVOID)0x80366000)
|
||||
(*if(BaseAddress == (PVOID)$80366000)
|
||||
{
|
||||
BaseAddress = (PVOID)(g_HaloHack[0] + (0x80366000 - 0x80061000));
|
||||
BaseAddress = (PVOID)(g_HaloHack[0] + ($80366000 - $80061000));
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): Halo Access Adjust 3 was applied! (0x%.08X)\n", GetCurrentThreadId(), BaseAddress);
|
||||
DbgPrintf('EmuKrnl : Halo Access Adjust 3 was applied! (0x%.08X)', [BaseAddress]);
|
||||
{$ENDIF}
|
||||
}
|
||||
|
||||
DWORD dwOldProtect;
|
||||
|
||||
if(!VirtualProtect(BaseAddress, NumberOfBytes, NewProtect & (~PAGE_WRITECOMBINE), &dwOldProtect))
|
||||
EmuWarning("VirtualProtect Failed!"); *)
|
||||
if(!VirtualProtect(BaseAddress, NumberOfBytes, NewProtect and (not PAGE_WRITECOMBINE), @dwOldProtect))
|
||||
EmuWarning('VirtualProtect Failed!'); *)
|
||||
|
||||
(*
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf('EmuKrnl : VirtualProtect was 0x%.08X -> 0x%.08X\n", GetCurrentThreadId(), dwOldProtect, NewProtect & (~PAGE_WRITECOMBINE));
|
||||
DbgPrintf('EmuKrnl : VirtualProtect was 0x%.08X -> 0x%.08X', [dwOldProtect, NewProtect and (not PAGE_WRITECOMBINE)]);
|
||||
{$ENDIF}
|
||||
*)
|
||||
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_MmUnmapIoSpace(): NTSTATUS; stdcall;
|
||||
// MmUnmapIoSpace:
|
||||
// Unmaps a virtual address mapping made by MmMapIoSpace.
|
||||
//
|
||||
// Differences from NT: None.
|
||||
function xboxkrnl_MmUnmapIoSpace(
|
||||
BaseAddress: PVOID;
|
||||
NumberOfBytes: ULONG
|
||||
): PVOID; stdcall;
|
||||
// Branch:Dxbx
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('MmUnmapIoSpace');
|
||||
Unimplemented('MmUnmapIoSpace');
|
||||
Result := nil;
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
|
|
|
@ -246,6 +246,10 @@ procedure xboxkrnl_NtYieldExecution(); stdcall;
|
|||
|
||||
implementation
|
||||
|
||||
// NtAllocateVirtualMemory:
|
||||
// Allocates virtual memory.
|
||||
//
|
||||
// Differences from NT: There is no ProcessHandle parameter.
|
||||
function xboxkrnl_NtAllocateVirtualMemory(
|
||||
BaseAddress: PPVOID; // OUT * ?
|
||||
ZeroBits: ULONG;
|
||||
|
@ -305,8 +309,10 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// 0x00BB - NtClose
|
||||
|
||||
// NtClose:
|
||||
// Closes a file or other handle.
|
||||
//
|
||||
// Differences from NT: None.
|
||||
function xboxkrnl_NtClose(
|
||||
Handle: Handle
|
||||
): NTSTATUS; stdcall; {XBSYSAPI EXPORTNUM(187)}
|
||||
|
@ -360,18 +366,18 @@ function xboxkrnl_NtCreateEvent(
|
|||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
||||
(* char *szBuffer = (ObjectAttributes != 0) ? ObjectAttributes->ObjectName->Buffer : 0;
|
||||
(* char *szBuffer = iif(Assigned(ObjectAttributes), ObjectAttributes.ObjectName.Buffer, '');
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtCreateEvent\n"
|
||||
"(\n"
|
||||
" EventHandle : 0x%.08X\n"
|
||||
" ObjectAttributes : 0x%.08X (\"%s\")\n"
|
||||
" EventType : 0x%.08X\n"
|
||||
" InitialState : 0x%.08X\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), EventHandle, ObjectAttributes, szBuffer,
|
||||
EventType, InitialState);
|
||||
DbgPrintf('EmuKrnl : NtCreateEvent' +
|
||||
#13#10'(' +
|
||||
#13#10' EventHandle : 0x%.08X' +
|
||||
#13#10' ObjectAttributes : 0x%.08X ("%s")' +
|
||||
#13#10' EventType : 0x%.08X' +
|
||||
#13#10' InitialState : 0x%.08X' +
|
||||
#13#10');',
|
||||
[EventHandle, ObjectAttributes, szBuffer,
|
||||
EventType, InitialState]);
|
||||
{$ENDIF}
|
||||
|
||||
wchar_t wszObjectName[160-1];
|
||||
|
@ -380,26 +386,26 @@ begin
|
|||
NtDll::OBJECT_ATTRIBUTES NtObjAttr;
|
||||
|
||||
// initialize object attributes
|
||||
if(szBuffer != 0)
|
||||
{
|
||||
mbstowcs(wszObjectName, "\\??\\", 4);
|
||||
if Assigned(szBuffer) then
|
||||
begin
|
||||
mbstowcs(wszObjectName, '\??\', 4);
|
||||
mbstowcs(wszObjectName+4, szBuffer, 160-1);
|
||||
|
||||
NtDll::RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
|
||||
NtDll::RtlInitUnicodeString(@NtUnicodeString, wszObjectName);
|
||||
|
||||
InitializeObjectAttributes(&NtObjAttr, &NtUnicodeString, ObjectAttributes->Attributes, ObjectAttributes->RootDirectory, NULL);
|
||||
}
|
||||
InitializeObjectAttributes(@NtObjAttr, @NtUnicodeString, ObjectAttributes.Attributes, ObjectAttributes.RootDirectory, NULL);
|
||||
end;
|
||||
|
||||
NtObjAttr.RootDirectory = 0;
|
||||
|
||||
// redirect to NtCreateEvent
|
||||
NTSTATUS ret = NtDll::NtCreateEvent(EventHandle, EVENT_ALL_ACCESS, (szBuffer != 0) ? &NtObjAttr : 0, (NtDll::EVENT_TYPE)EventType, InitialState);
|
||||
NTSTATUS ret = NtDll::NtCreateEvent(EventHandle, EVENT_ALL_ACCESS, iif(Assigned(szBuffer), @NtObjAttr, nil), (NtDll::EVENT_TYPE)EventType, InitialState);
|
||||
|
||||
if(FAILED(ret))
|
||||
EmuWarning("NtCreateEvent Failed!");
|
||||
EmuWarning('NtCreateEvent Failed!');
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtCreateEvent EventHandle = 0x%.08X\n", GetCurrentThreadId(), *EventHandle);
|
||||
DbgPrintf('EmuKrnl : NtCreateEvent EventHandle = 0x%.08X', [*EventHandle]);
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
|
@ -411,6 +417,11 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// NtCreateFile:
|
||||
// Creates or opens a file or device object.
|
||||
//
|
||||
// Differences from NT: The EaBuffer and EaLength options are gone.
|
||||
// OBJECT_ATTRIBUTES uses ANSI_STRING, so only ANSI filenames work.
|
||||
function xboxkrnl_NtCreateFile(
|
||||
FileHandle: PHANDLE; // OUT
|
||||
DesiredAccess: ACCESS_MASK;
|
||||
|
@ -644,16 +655,16 @@ function xboxkrnl_NtCreateMutant(
|
|||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
||||
(* char *szBuffer = (ObjectAttributes != 0) ? ObjectAttributes->ObjectName->Buffer : 0;
|
||||
(* char *szBuffer = iif(Assigned(ObjectAttributes), ObjectAttributes.ObjectName.Buffer, '');
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtCreateMutant\n"
|
||||
"(\n"
|
||||
" MutantHandle : 0x%.08X\n"
|
||||
" ObjectAttributes : 0x%.08X (\"%s\")\n"
|
||||
" InitialOwner : 0x%.08X\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), MutantHandle, ObjectAttributes, szBuffer, InitialOwner);
|
||||
DbgPrintf('EmuKrnl : NtCreateMutant' +
|
||||
#13#10'(' +
|
||||
#13#10' MutantHandle : 0x%.08X' +
|
||||
#13#10' ObjectAttributes : 0x%.08X ("%s")' +
|
||||
#13#10' InitialOwner : 0x%.08X' +
|
||||
#13#10');',
|
||||
[MutantHandle, ObjectAttributes, szBuffer, InitialOwner]);
|
||||
{$ENDIF}
|
||||
|
||||
wchar_t wszObjectName[160-1];
|
||||
|
@ -662,26 +673,26 @@ begin
|
|||
NtDll::OBJECT_ATTRIBUTES NtObjAttr;
|
||||
|
||||
// initialize object attributes
|
||||
if(szBuffer != 0)
|
||||
{
|
||||
mbstowcs(wszObjectName, "\\??\\", 4);
|
||||
if Assigned((szBuffer) then
|
||||
begin
|
||||
mbstowcs(wszObjectName, '\??\', 4);
|
||||
mbstowcs(wszObjectName+4, szBuffer, 160-1);
|
||||
|
||||
NtDll::RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
|
||||
NtDll::RtlInitUnicodeString(@NtUnicodeString, wszObjectName);
|
||||
|
||||
InitializeObjectAttributes(&NtObjAttr, &NtUnicodeString, ObjectAttributes->Attributes, ObjectAttributes->RootDirectory, NULL);
|
||||
}
|
||||
InitializeObjectAttributes(@NtObjAttr, @NtUnicodeString, ObjectAttributes.Attributes, ObjectAttributes.RootDirectory, NULL);
|
||||
end;
|
||||
|
||||
NtObjAttr.RootDirectory = 0;
|
||||
|
||||
// redirect to NtCreateMutant
|
||||
NTSTATUS ret = NtDll::NtCreateMutant(MutantHandle, MUTANT_ALL_ACCESS, (szBuffer != 0) ? &NtObjAttr : 0, InitialOwner);
|
||||
NTSTATUS ret = NtDll::NtCreateMutant(MutantHandle, MUTANT_ALL_ACCESS, iif(Assigned(szBuffer), @NtObjAttr, nil), InitialOwner);
|
||||
|
||||
if(FAILED(ret))
|
||||
EmuWarning("NtCreateMutant Failed!");
|
||||
EmuWarning('NtCreateMutant Failed!');
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtCreateMutant MutantHandle = 0x%.08X\n", GetCurrentThreadId(), *MutantHandle);
|
||||
DbgPrintf('EmuKrnl : NtCreateMutant MutantHandle = 0x%.08X', [*MutantHandle]);
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
|
@ -749,7 +760,22 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_NtDeviceIoControlFile(FileHandle: dtU32; Event: dtU32; pApcRoutine: dtU32; pApcContext: dtU32; pIoStatusBlock: dtU32; pIoControlCode: dtU32; pInputBuffer: dtU32; InputBufferLength: dtU32; pOutputBuffer: dtU32; OutputBufferLength: dtU32): NTSTATUS; stdcall;
|
||||
// NtDeviceIoControl:
|
||||
// Does an IOCTL on a device.
|
||||
//
|
||||
// Differences from NT: None known.
|
||||
function xboxkrnl_NtDeviceIoControlFile(
|
||||
FileHandle: dtU32;
|
||||
Event: dtU32;
|
||||
pApcRoutine: dtU32;
|
||||
pApcContext: dtU32;
|
||||
pIoStatusBlock: dtU32;
|
||||
pIoControlCode: dtU32;
|
||||
pInputBuffer: dtU32;
|
||||
InputBufferLength: dtU32;
|
||||
pOutputBuffer: dtU32;
|
||||
OutputBufferLength: dtU32
|
||||
): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
@ -820,6 +846,10 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// NtFreeVirtualMemory:
|
||||
// Frees virtual memory.
|
||||
//
|
||||
// Differences from NT: There is no ProcessHandle parameter.
|
||||
function xboxkrnl_NtFreeVirtualMemory(
|
||||
BaseAddress: PPVOID; // OUT
|
||||
FreeSize: PULONG; // OUT
|
||||
|
@ -841,12 +871,23 @@ begin
|
|||
[BaseAddress, FreeSize, FreeType]);
|
||||
{$ENDIF}
|
||||
|
||||
ret := NtFreeVirtualMemory(GetCurrentProcess(), BaseAddress, FreeSize, FreeType);
|
||||
Result := ret;
|
||||
Result := NtFreeVirtualMemory(GetCurrentProcess(), BaseAddress, FreeSize, FreeType);
|
||||
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_NtFsControlFile(FileHandle: dtU32; Event: dtU32; pApcRoutine: dtU32; pApcContext: dtU32; pIoStatusBlock: dtU32; FsControlCode: dtU32; pInputBuffer: dtU32; InputBufferLength: dtU32; pOutputBuffer: dtU32; OutputBufferLength: dtU32): NTSTATUS; stdcall;
|
||||
function xboxkrnl_NtFsControlFile(
|
||||
FileHandle: dtU32;
|
||||
Event: dtU32;
|
||||
pApcRoutine: dtU32;
|
||||
pApcContext: dtU32;
|
||||
pIoStatusBlock: dtU32;
|
||||
FsControlCode: dtU32;
|
||||
pInputBuffer: dtU32;
|
||||
InputBufferLength: dtU32;
|
||||
pOutputBuffer: dtU32;
|
||||
OutputBufferLength: dtU32
|
||||
): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
@ -862,6 +903,12 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// NtOpenFile:
|
||||
// Opens a file or device object. Same as calling:
|
||||
// NtCreateFile(FileHandle, DesiredAccess, ObjectAttributes,
|
||||
// IoStatusBlock, NULL, 0, ShareAccess, OPEN_EXISTING, OpenOptions);
|
||||
//
|
||||
// Differences from NT: See NtCreateFile.
|
||||
function xboxkrnl_NtOpenFile(
|
||||
FileHandle: PHANDLE; // OUT
|
||||
DesiredAccess: ACCESS_MASK;
|
||||
|
@ -872,25 +919,24 @@ function xboxkrnl_NtOpenFile(
|
|||
): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:100
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
||||
{$IFDEF _DEBUG_TRACE}
|
||||
EmuSwapFS(fsWindows);
|
||||
DbgPrintf('EmuKrnl : NtOpenFile' +
|
||||
#13#10'(' +
|
||||
#13#10' FileHandle : 0x%.08X' +
|
||||
#13#10' DesiredAccess : 0x%.08X' +
|
||||
#13#10' ObjectAttributes : 0x%.08X (\%s\)' +
|
||||
#13#10' ObjectAttributes : 0x%.08X ("%s")' +
|
||||
#13#10' IoStatusBlock : 0x%.08X' +
|
||||
#13#10' ShareAccess : 0x%.08X' +
|
||||
#13#10' CreateOptions : 0x%.08X' +
|
||||
#13#10');',
|
||||
[FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes.ObjectName.Buffer,
|
||||
IoStatusBlock, ShareAccess, OpenOptions]);
|
||||
EmuSwapFS(fsXbox);
|
||||
{$ENDIF}
|
||||
|
||||
EmuSwapFS(fsXbox);
|
||||
|
||||
Result := xboxkrnl_NtCreateFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, NULL, 0, ShareAccess, FILE_OPEN, OpenOptions);
|
||||
Result := xboxkrnl_NtCreateFile(FileHandle, DesiredAccess, ObjectAttributes,
|
||||
IoStatusBlock, NULL, 0, ShareAccess, OPEN_EXISTING, OpenOptions);
|
||||
end;
|
||||
|
||||
function xboxkrnl_NtOpenSymbolicLinkObject(pFileHandle: dtU32; pObjectAttributes: dtObjectAttributes): NTSTATUS; stdcall;
|
||||
|
@ -974,28 +1020,28 @@ begin
|
|||
|
||||
(*
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtQueryDirectoryFile\n"
|
||||
"(\n"
|
||||
" FileHandle : 0x%.08X\n"
|
||||
" Event : 0x%.08X\n"
|
||||
" ApcRoutine : 0x%.08X\n"
|
||||
" ApcContext : 0x%.08X\n"
|
||||
" IoStatusBlock : 0x%.08X\n"
|
||||
" FileInformation : 0x%.08X\n"
|
||||
" Length : 0x%.08X\n"
|
||||
" FileInformationClass : 0x%.08X\n"
|
||||
" FileMask : 0x%.08X (%s)\n"
|
||||
" RestartScan : 0x%.08X\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock,
|
||||
DbgPrintf('EmuKrnl : NtQueryDirectoryFile' +
|
||||
#13#10'(' +
|
||||
#13#10' FileHandle : 0x%.08X' +
|
||||
#13#10' Event : 0x%.08X' +
|
||||
#13#10' ApcRoutine : 0x%.08X' +
|
||||
#13#10' ApcContext : 0x%.08X' +
|
||||
#13#10' IoStatusBlock : 0x%.08X' +
|
||||
#13#10' FileInformation : 0x%.08X' +
|
||||
#13#10' Length : 0x%.08X' +
|
||||
#13#10' FileInformationClass : 0x%.08X' +
|
||||
#13#10' FileMask : 0x%.08X (%s)' +
|
||||
#13#10' RestartScan : 0x%.08X' +
|
||||
#13#10');',
|
||||
[FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock,
|
||||
FileInformation, Length, FileInformationClass, FileMask,
|
||||
(FileMask != 0) ? FileMask->Buffer : "", RestartScan);
|
||||
iif(Assigned(FileMask), FileMask.Buffer, ''), RestartScan]);
|
||||
{$ENDIF}
|
||||
|
||||
NTSTATUS ret;
|
||||
|
||||
if(FileInformationClass != 1) // Due to unicode->string conversion
|
||||
CxbxKrnlCleanup("Unsupported FileInformationClass");
|
||||
if (FileInformationClass <> 1) // Due to unicode->string conversion
|
||||
CxbxKrnlCleanup('Unsupported FileInformationClass');
|
||||
|
||||
NtDll::UNICODE_STRING NtFileMask;
|
||||
|
||||
|
@ -1003,18 +1049,18 @@ begin
|
|||
|
||||
// initialize FileMask
|
||||
{
|
||||
if(FileMask != 0)
|
||||
mbstowcs(wszObjectName, FileMask->Buffer, 160-1);
|
||||
if Assigned(FileMask) then
|
||||
mbstowcs(wszObjectName, FileMask.Buffer, 160-1);
|
||||
else
|
||||
mbstowcs(wszObjectName, "", 160-1);
|
||||
mbstowcs(wszObjectName, '', 160-1);
|
||||
|
||||
NtDll::RtlInitUnicodeString(&NtFileMask, wszObjectName);
|
||||
NtDll::RtlInitUnicodeString(@NtFileMask, wszObjectName);
|
||||
}
|
||||
|
||||
NtDll::FILE_DIRECTORY_INFORMATION *FileDirInfo = (NtDll::FILE_DIRECTORY_INFORMATION*)(*CxbxMalloc(0x40 + 160*2);
|
||||
NtDll::FILE_DIRECTORY_INFORMATION *FileDirInfo = (NtDll::FILE_DIRECTORY_INFORMATION*)(*CxbxMalloc($40 + 160*2);
|
||||
|
||||
char *mbstr = FileInformation->FileName;
|
||||
wchar_t *wcstr = FileDirInfo->FileName;
|
||||
char *mbstr = FileInformation.FileName;
|
||||
wchar_t *wcstr = FileDirInfo.FileName;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1023,22 +1069,22 @@ begin
|
|||
ret = NtDll::NtQueryDirectoryFile
|
||||
(
|
||||
FileHandle, Event, (NtDll::PIO_APC_ROUTINE)ApcRoutine, ApcContext, (NtDll::IO_STATUS_BLOCK*)(*IoStatusBlock, FileDirInfo,
|
||||
0x40+160*2, (NtDll::FILE_INFORMATION_CLASS)FileInformationClass, TRUE, &NtFileMask, RestartScan
|
||||
$40+160*2, (NtDll::FILE_INFORMATION_CLASS)FileInformationClass, TRUE, @NtFileMask, RestartScan
|
||||
);
|
||||
|
||||
// convert from PC to Xbox
|
||||
{
|
||||
memcpy(FileInformation, FileDirInfo, 0x40);
|
||||
memcpy(FileInformation, FileDirInfo, $40);
|
||||
|
||||
wcstombs(mbstr, wcstr, 160);
|
||||
|
||||
FileInformation->FileNameLength /= 2;
|
||||
FileInformation.FileNameLength /= 2;
|
||||
}(*
|
||||
|
||||
RestartScan = FALSE;
|
||||
}
|
||||
// Xbox does not return . and ..
|
||||
while(strcmp(mbstr, ".") == 0 || strcmp(mbstr, "..") == 0);
|
||||
while (strcmp(mbstr, '.') = 0) or (strcmp(mbstr, '..') = 0);
|
||||
|
||||
// TODO: Cache the last search result for quicker access with CreateFile (xbox does this internally!)
|
||||
CxbxFree(FileDirInfo);
|
||||
|
@ -1072,7 +1118,7 @@ function xboxkrnl_NtQueryFullAttributesFile(
|
|||
// Branch:martin Revision:39 Translator:PatrickvL Done:10
|
||||
var
|
||||
szBuffer: PChar;
|
||||
wszObjectName: Array [0..160 - 1] of wchar_t;
|
||||
wszObjectName: array [0..160 - 1] of wchar_t;
|
||||
NtUnicodeString: UNICODE_STRING;
|
||||
NtObjAttr: OBJECT_ATTRIBUTES;
|
||||
ret: NTSTATUS;
|
||||
|
@ -1081,10 +1127,10 @@ begin
|
|||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf('EmuKrnl : NtQueryFullAttributesFile'+
|
||||
'(\'+
|
||||
' ObjectAttributes : 0x%.08X (%s)'+
|
||||
' Attributes : 0x%.08X'+
|
||||
');',
|
||||
#13#10'('+
|
||||
#13#10' ObjectAttributes : 0x%.08X (%s)'+
|
||||
#13#10' Attributes : 0x%.08X'+
|
||||
#13#10');',
|
||||
[ObjectAttributes, ObjectAttributes.ObjectName.Buffer, Attributes]);
|
||||
{$ENDIF}
|
||||
|
||||
|
@ -1092,10 +1138,10 @@ begin
|
|||
|
||||
// initialize object attributes
|
||||
mbstowcs(wszObjectName, szBuffer, 160-1);
|
||||
RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
|
||||
InitializeObjectAttributes(&NtObjAttr, &NtUnicodeString, ObjectAttributes.Attributes, ObjectAttributes.RootDirectory, NULL);
|
||||
RtlInitUnicodeString(@NtUnicodeString, wszObjectName);
|
||||
InitializeObjectAttributes(@NtObjAttr, @NtUnicodeString, ObjectAttributes.Attributes, ObjectAttributes.RootDirectory, NULL);
|
||||
|
||||
ret = NtQueryFullAttributesFile(&NtObjAttr, Attributes); *)
|
||||
ret = NtQueryFullAttributesFile(@NtObjAttr, Attributes); *)
|
||||
Result := ret;
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
@ -1147,8 +1193,8 @@ begin
|
|||
if (FileInfo = FileNetworkOpenInformation) and (pInfo.AllocationSize.LowPart = 57344) then
|
||||
begin
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf('pInfo.AllocationSize : %d', pInfo->AllocationSize.LowPart);
|
||||
DbgPrintf('pInfo.EndOfFile : %d', pInfo->EndOfFile.LowPart);
|
||||
DbgPrintf('pInfo.AllocationSize : %d', pInfo.AllocationSize.LowPart);
|
||||
DbgPrintf('pInfo.EndOfFile : %d', pInfo.EndOfFile.LowPart);
|
||||
{$ENDIF}
|
||||
|
||||
pInfo.EndOfFile.LowPart := $1000;
|
||||
|
@ -1238,6 +1284,11 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// NtQueryVolumeInformation:
|
||||
// Queries information about a file system. This is not documented by
|
||||
// Microsoft even under NT.
|
||||
//
|
||||
// Differences from NT: None known.
|
||||
function xboxkrnl_NtQueryVolumeInformationFile(
|
||||
FileHandle: HANDLE;
|
||||
IoStatusBlock: PIO_STATUS_BLOCK; // OUT
|
||||
|
@ -1251,21 +1302,21 @@ begin
|
|||
|
||||
(*
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtQueryVolumeInformationFile\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, FileInformationClass);
|
||||
DbgPrintf('EmuKrnl : NtQueryVolumeInformationFile' +
|
||||
#13#10'(' +
|
||||
#13#10' FileHandle : 0x%.08X' +
|
||||
#13#10' IoStatusBlock : 0x%.08X' +
|
||||
#13#10' FileInformation : 0x%.08X' +
|
||||
#13#10' Length : 0x%.08X' +
|
||||
#13#10' FileInformationClass: 0x%.08X' +
|
||||
#13#10');',
|
||||
[FileHandle, IoStatusBlock, FileInformation,
|
||||
Length, FileInformationClass]);
|
||||
{$ENDIF}
|
||||
|
||||
// Safety/Sanity Check
|
||||
if((FileInformationClass != FileFsSizeInformation) && (FileInformationClass != FileDirectoryInformation))
|
||||
CxbxKrnlCleanup("NtQueryVolumeInformationFile: Unsupported FileInformationClass");
|
||||
if (FileInformationClass <> FileFsSizeInformation) and (FileInformationClass <> FileDirectoryInformation) then
|
||||
CxbxKrnlCleanup('NtQueryVolumeInformationFile: Unsupported FileInformationClass');
|
||||
|
||||
NTSTATUS ret = NtDll::NtQueryVolumeInformationFile
|
||||
(
|
||||
|
@ -1276,14 +1327,14 @@ begin
|
|||
);
|
||||
|
||||
// NOTE: TODO: Dynamically fill in, or allow configuration?
|
||||
if(FileInformationClass == FileFsSizeInformation)
|
||||
if(FileInformationClass = FileFsSizeInformation)
|
||||
{
|
||||
FILE_FS_SIZE_INFORMATION *SizeInfo = (FILE_FS_SIZE_INFORMATION*)(*FileInformation;
|
||||
|
||||
SizeInfo->TotalAllocationUnits.QuadPart = 0x4C468;
|
||||
SizeInfo->AvailableAllocationUnits.QuadPart = 0x2F125;
|
||||
SizeInfo->SectorsPerAllocationUnit = 32;
|
||||
SizeInfo->BytesPerSector = 512;
|
||||
SizeInfo.TotalAllocationUnits.QuadPart = $4C468;
|
||||
SizeInfo.AvailableAllocationUnits.QuadPart = $2F125;
|
||||
SizeInfo.SectorsPerAllocationUnit = 32;
|
||||
SizeInfo.BytesPerSector = 512;
|
||||
}
|
||||
|
||||
return ret;*)
|
||||
|
@ -1292,6 +1343,10 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// NtReadFile:
|
||||
// Reads a file.
|
||||
//
|
||||
// Differences from NT: There is no Key parameter.
|
||||
function xboxkrnl_NtReadFile(
|
||||
FileHandle: HANDLE; // Cxbx TODO: correct paramters
|
||||
Event: HANDLE; // OPTIONAL
|
||||
|
@ -1302,39 +1357,35 @@ function xboxkrnl_NtReadFile(
|
|||
Length: ULONG;
|
||||
ByteOffset: PLARGE_INTEGER // OPTIONAL
|
||||
): NTSTATUS; stdcall;
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:0
|
||||
// Branch:martin Revision:39 Translator:PatrickvL Done:100
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
||||
(*
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtReadFile\n"
|
||||
"(\n"
|
||||
" FileHandle : 0x%.08X\n"
|
||||
" Event : 0x%.08X\n"
|
||||
" ApcRoutine : 0x%.08X\n"
|
||||
" ApcContext : 0x%.08X\n"
|
||||
" IoStatusBlock : 0x%.08X\n"
|
||||
" Buffer : 0x%.08X\n"
|
||||
" Length : 0x%.08X\n"
|
||||
" ByteOffset : 0x%.08X (0x%.08X)\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), FileHandle, Event, ApcRoutine,
|
||||
ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, ByteOffset == 0 ? 0 : ByteOffset->QuadPart);
|
||||
DbgPrintf('EmuKrnl (0x%X): NtReadFile' +
|
||||
#13#10'(' +
|
||||
#13#10' FileHandle : 0x%.08X' +
|
||||
#13#10' Event : 0x%.08X' +
|
||||
#13#10' ApcRoutine : 0x%.08X' +
|
||||
#13#10' ApcContext : 0x%.08X' +
|
||||
#13#10' IoStatusBlock : 0x%.08X' +
|
||||
#13#10' Buffer : 0x%.08X' +
|
||||
#13#10' Length : 0x%.08X' +
|
||||
#13#10' ByteOffset : 0x%.08X' + // ' (0x%.08X)' +
|
||||
#13#10');',
|
||||
[FileHandle, Event, ApcRoutine,
|
||||
ApcContext, IoStatusBlock, Buffer, Length, ByteOffset{, ByteOffset = 0 ? 0 : ByteOffset.QuadPart}]);
|
||||
{$ENDIF}
|
||||
|
||||
// Halo...
|
||||
// if(ByteOffset != 0 && ByteOffset->QuadPart == 0x00120800)
|
||||
// if Assigned(ByteOffset) and (ByteOffset.QuadPart = $00120800) then
|
||||
// _asm int 3
|
||||
|
||||
NTSTATUS ret = NtDll::NtReadFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, (NtDll::LARGE_INTEGER*)(*ByteOffset, 0);
|
||||
Result := JwaNative.NtWriteFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, JwaWinType.PLARGE_INTEGER(ByteOffset), nil);
|
||||
|
||||
if(FAILED(ret))
|
||||
EmuWarning("NtReadFile Failed!");
|
||||
if (FAILED(Result)) then
|
||||
EmuWarning('NtReadFile Failed! (0x%.08X)', [Result]);
|
||||
|
||||
return ret;*)
|
||||
|
||||
Result := Unimplemented('NtReadFile');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
|
@ -1357,7 +1408,7 @@ begin
|
|||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf('EmuKrnl : NtReleaseMutant'+
|
||||
#13#10'(\'+
|
||||
#13#10'('+
|
||||
#13#10' MutantHandle : 0x%.08X'+
|
||||
#13#10' PreviousCount : 0x%.08X'+
|
||||
#13#10');',
|
||||
|
@ -1421,7 +1472,7 @@ begin
|
|||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf('EmuKrnl : NtResumeThread'+
|
||||
#13#10'(\'+
|
||||
#13#10'('+
|
||||
#13#10' ThreadHandle : 0x%.08X'+
|
||||
#13#10' PreviousSuspendCount : 0x%.08X'+
|
||||
#13#10');',
|
||||
|
@ -1447,7 +1498,7 @@ begin
|
|||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf('EmuKrnl : NtSetEvent'+
|
||||
#13#10'(\'+
|
||||
#13#10'('+
|
||||
#13#10' EventHandle : 0x%.08X'+
|
||||
#13#10' PreviousState : 0x%.08X'+
|
||||
#13#10');',
|
||||
|
@ -1559,16 +1610,17 @@ begin
|
|||
|
||||
(*
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtUserIoApcDispatcher\n"
|
||||
"(\n"
|
||||
" ApcContext : 0x%.08X\n"
|
||||
" IoStatusBlock : 0x%.08X\n"
|
||||
" Reserved : 0x%.08X\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), ApcContext, IoStatusBlock, Reserved);
|
||||
DbgPrintf('EmuKrnl : NtUserIoApcDispatcher' +
|
||||
#13#10'(' +
|
||||
#13#10' ApcContext : 0x%.08X' +
|
||||
#13#10' IoStatusBlock : 0x%.08X' +
|
||||
#13#10' Reserved : 0x%.08X' +
|
||||
#13#10');',
|
||||
[ApcContext, IoStatusBlock, Reserved]);
|
||||
|
||||
DbgPrintf("IoStatusBlock->Pointer : 0x%.08X\n"
|
||||
"IoStatusBlock->Information : 0x%.08X\n", IoStatusBlock->u1.Pointer, IoStatusBlock->Information);
|
||||
DbgPrintf('IoStatusBlock.Pointer : 0x%.08X' +
|
||||
#13#10'IoStatusBlock.Information : 0x%.08X',
|
||||
[IoStatusBlock.u1.Pointer, IoStatusBlock.Information]);
|
||||
{$ENDIF}
|
||||
|
||||
EmuSwapFS(); // Xbox FS
|
||||
|
@ -1577,14 +1629,14 @@ begin
|
|||
|
||||
dwEsi = (uint32)IoStatusBlock;
|
||||
|
||||
if((IoStatusBlock->u1.Status & 0xC0000000) == 0xC0000000)
|
||||
if((IoStatusBlock.u1.Status and $C0000000) = $C0000000)
|
||||
{
|
||||
dwEcx = 0;
|
||||
dwEax = NtDll::RtlNtStatusToDosError(IoStatusBlock->u1.Status);
|
||||
dwEax = NtDll::RtlNtStatusToDosError(IoStatusBlock.u1.Status);
|
||||
}
|
||||
else
|
||||
{
|
||||
dwEcx = (DWORD)IoStatusBlock->Information;
|
||||
dwEcx = (DWORD)IoStatusBlock.Information;
|
||||
dwEax = 0;
|
||||
}
|
||||
|
||||
|
@ -1630,7 +1682,7 @@ begin
|
|||
EmuSwapFS(); // Win2k/XP FS
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtUserIoApcDispatcher Completed\n", GetCurrentThreadId());
|
||||
DbgPrintf('EmuKrnl : NtUserIoApcDispatcher Completed');
|
||||
{$ENDIF}
|
||||
|
||||
return;*)
|
||||
|
@ -1667,13 +1719,13 @@ begin
|
|||
#13#10' Alertable : 0x%.08X'+
|
||||
#13#10' Timeout : 0x%.08X (%d)'+
|
||||
#13#10');',
|
||||
Handle, WaitMode, Alertable, Timeout, Timeout == 0 ? 0 : Timeout->QuadPart); *)
|
||||
Handle, WaitMode, Alertable, Timeout, Timeout == 0 ? 0 : Timeout.QuadPart); *)
|
||||
{$ENDIF}
|
||||
|
||||
(* NTSTATUS ret = NtDll::NtWaitForSingleObject(Handle, Alertable, (NtDll::PLARGE_INTEGER)Timeout);
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("Finished waiting for 0x%.08X\n", Handle);
|
||||
DbgPrintf('Finished waiting for 0x%.08X', [Handle]);
|
||||
{$ENDIF}
|
||||
|
||||
return ret;
|
||||
|
@ -1697,17 +1749,17 @@ begin
|
|||
|
||||
(*
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuKrnl (0x%X): NtWaitForMultipleObjectsEx\n"
|
||||
"(\n"
|
||||
" Count : 0x%.08X\n"
|
||||
" Handles : 0x%.08X\n"
|
||||
" WaitType : 0x%.08X\n"
|
||||
" WaitMode : 0x%.08X\n"
|
||||
" Alertable : 0x%.08X\n"
|
||||
" Timeout : 0x%.08X (%d)\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), Count, Handles, WaitType, WaitMode, Alertable,
|
||||
Timeout, Timeout == 0 ? 0 : Timeout->QuadPart);
|
||||
DbgPrintf('EmuKrnl : NtWaitForMultipleObjectsEx' +
|
||||
#13#10'(' +
|
||||
#13#10' Count : 0x%.08X' +
|
||||
#13#10' Handles : 0x%.08X' +
|
||||
#13#10' WaitType : 0x%.08X' +
|
||||
#13#10' WaitMode : 0x%.08X' +
|
||||
#13#10' Alertable : 0x%.08X' +
|
||||
#13#10' Timeout : 0x%.08X (%d)' +
|
||||
#13#10');',
|
||||
[Count, Handles, WaitType, WaitMode, Alertable,
|
||||
Timeout, Timeout == 0 ? 0 : Timeout.QuadPart]);
|
||||
{$ENDIF}
|
||||
|
||||
NTSTATUS ret = NtDll::NtWaitForMultipleObjects(Count, Handles, (NtDll::OBJECT_WAIT_TYPE)WaitType, Alertable, (NtDll::PLARGE_INTEGER)Timeout);
|
||||
|
@ -1719,6 +1771,10 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
// NtWriteFile:
|
||||
// Writes a file.
|
||||
//
|
||||
// Differences from NT: There is no Key parameter.
|
||||
function xboxkrnl_NtWriteFile(
|
||||
FileHandle: HANDLE; // Cxbx TODO: correct paramters
|
||||
Event: DWORD; // Dxbx correction (was PVOID)
|
||||
|
@ -1750,7 +1806,7 @@ begin
|
|||
{$ENDIF}
|
||||
|
||||
// Halo..
|
||||
// if (ByteOffset != 0 && ByteOffset->QuadPart == 0x01C00800) then
|
||||
// if Assigned(ByteOffset) and (ByteOffset.QuadPart = $01C00800) then
|
||||
// _asm int 3
|
||||
|
||||
Result := JwaNative.NtWriteFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, JwaWinType.PLARGE_INTEGER(ByteOffset), nil);
|
||||
|
|
|
@ -40,17 +40,23 @@ uses
|
|||
uEmuKrnl,
|
||||
uDxbxKrnl;
|
||||
|
||||
var
|
||||
{240}xboxkrnl_ObDirectoryObjectType: POBJECT_TYPE = NULL;
|
||||
{245}xboxkrnl_ObpObjectHandleTable: array [0..0] of DWord; // Dxbx TODO : Determine array size
|
||||
{249}xboxkrnl_ObSymbolicLinkObjectType: POBJECT_TYPE = NULL;
|
||||
|
||||
function xboxkrnl_ObCreateObject(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObDirectoryObjectType(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObInsertObject(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObMakeTemporaryObject(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObOpenObjectByName(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObOpenObjectByPointer(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObpObjectHandleTable(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObReferenceObjectByHandle(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObReferenceObjectByHandle(
|
||||
Handle: HANDLE;
|
||||
ObjectType: POBJECT_TYPE; // OPTIONAL?
|
||||
Object_: PPVOID
|
||||
): NTSTATUS; stdcall;
|
||||
function xboxkrnl_ObReferenceObjectByName(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObReferenceObjectByPointer(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObSymbolicLinkObjectType(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObfDereferenceObject(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_ObfReferenceObject(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
||||
|
@ -63,13 +69,6 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_ObDirectoryObjectType(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('ObDirectoryObjectType');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_ObInsertObject(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
@ -98,14 +97,18 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_ObpObjectHandleTable(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('ObpObjectHandleTable');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_ObReferenceObjectByHandle(): NTSTATUS; stdcall;
|
||||
// ObReferenceObjectByHandle:
|
||||
// Turns a handle into a kernel object pointer. The ObjectType parameter
|
||||
// specifies what type of object it is. This function also increments the
|
||||
// object's reference count.
|
||||
//
|
||||
// Differences from NT: There are no DesiredAccess, AccessMode, or
|
||||
// HandleInformation parameters.
|
||||
function xboxkrnl_ObReferenceObjectByHandle(
|
||||
Handle: HANDLE;
|
||||
ObjectType: POBJECT_TYPE; // OPTIONAL?
|
||||
Object_: PPVOID
|
||||
): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('ObReferenceObjectByHandle');
|
||||
|
@ -126,13 +129,6 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_ObSymbolicLinkObjectType(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('ObSymbolicLinkObjectType');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_ObfDereferenceObject(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
|
|
@ -218,7 +218,7 @@ end; // PCSTProxy
|
|||
|
||||
// PsCreateSystemThread:
|
||||
// Creates a system thread. Same as:
|
||||
// PsCreateSystemThreadEx(ThreadHandle, NULL, 0x3000, 0, ThreadId, StartContext1,
|
||||
// PsCreateSystemThreadEx(ThreadHandle, NULL, $3000, 0, ThreadId, StartContext1,
|
||||
// StartContext2, FALSE, DebugStack, PspSystemThreadStartup);
|
||||
//
|
||||
// New to the XBOX. (It is too different from NT to be considered the same)
|
||||
|
@ -273,7 +273,7 @@ begin
|
|||
dwCreationFlags, Addr(lpThreadId)]);
|
||||
{$ENDIF}
|
||||
|
||||
// PsCreateSystemThreadEx(ThreadHandle, NULL, 0x3000, 0, ThreadId, StartContext1,
|
||||
// PsCreateSystemThreadEx(ThreadHandle, NULL, $3000, 0, ThreadId, StartContext1,
|
||||
// StartContext2, FALSE, DebugStack, PspSystemThreadStartup);
|
||||
|
||||
// Pass-through to Ex-implementation :
|
||||
|
@ -414,14 +414,14 @@ begin
|
|||
|
||||
(*
|
||||
|
||||
DbgPrintf("EmuKrnl (0x%X): PsTerminateSystemThread\n"
|
||||
"(\n"
|
||||
" ExitStatus : 0x%.08X\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), ExitStatus);
|
||||
DbgPrintf('EmuKrnl : PsTerminateSystemThread' +
|
||||
#13#10'(' +
|
||||
#13#10' ExitStatus : 0x%.08X' +
|
||||
#13#10');',
|
||||
[ExitStatus]);
|
||||
|
||||
// call thread notification routine(s)
|
||||
if(g_pfnThreadNotification != 0)
|
||||
if Assigned(g_pfnThreadNotification) then
|
||||
{
|
||||
XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification;
|
||||
|
||||
|
|
|
@ -116,7 +116,9 @@ function xboxkrnl_RtlDowncaseUnicodeString(
|
|||
procedure xboxkrnl_RtlEnterCriticalSection(
|
||||
CriticalSection: PRTL_CRITICAL_SECTION
|
||||
); stdcall;
|
||||
function xboxkrnl_RtlEnterCriticalSectionAndRegion(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_RtlEnterCriticalSectionAndRegion(
|
||||
CriticalSection: PRTL_CRITICAL_SECTION
|
||||
): NTSTATUS; stdcall;
|
||||
function xboxkrnl_RtlEqualString(
|
||||
String1: PSTRING;
|
||||
String2: PSTRING;
|
||||
|
@ -186,7 +188,9 @@ function xboxkrnl_RtlIntegerToUnicodeString(
|
|||
procedure xboxkrnl_RtlLeaveCriticalSection(
|
||||
CriticalSection: PRTL_CRITICAL_SECTION
|
||||
); stdcall;
|
||||
function xboxkrnl_RtlLeaveCriticalSectionAndRegion(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_RtlLeaveCriticalSectionAndRegion(
|
||||
CriticalSection: PRTL_CRITICAL_SECTION
|
||||
): NTSTATUS; stdcall;
|
||||
function xboxkrnl_RtlLowerChar(
|
||||
Character: ANSICHAR
|
||||
): ANSICHAR; stdcall;
|
||||
|
@ -276,7 +280,11 @@ procedure xboxkrnl_RtlZeroMemory(
|
|||
Destination: PVOID;
|
||||
Length: SIZE_T
|
||||
); stdcall; // Source:JwaNative
|
||||
function xboxkrnl_RtlRip(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
procedure xboxkrnl_RtlRip(
|
||||
Part1: PCSZ;
|
||||
Part2: PCSZ;
|
||||
Part3: PCSZ
|
||||
); stdcall;
|
||||
function xboxkrnl_RtlSnprintf(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_RtlSprintf(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function xboxkrnl_RtlVsnprintf(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
@ -501,10 +509,22 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_RtlEnterCriticalSectionAndRegion(): NTSTATUS; stdcall;
|
||||
function xboxkrnl_RtlEnterCriticalSectionAndRegion(
|
||||
CriticalSection: PRTL_CRITICAL_SECTION
|
||||
): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('RtlEnterCriticalSectionAndRegion');
|
||||
{$IFDEF DXBX_EXTREME_LOGGING}
|
||||
DbgPrintf('EmuKrnl : RtlEnterCriticalSectionAndRegion' +
|
||||
#13#10'(' +
|
||||
#13#10' CriticalSection : 0x%.08X' +
|
||||
#13#10');',
|
||||
[CriticalSection]);
|
||||
{$ENDIF}
|
||||
|
||||
JwaNative.RtlEnterCriticalSection(CriticalSection);
|
||||
Result := 0; // Dxbx TODO
|
||||
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
|
@ -722,7 +742,9 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_RtlLeaveCriticalSectionAndRegion(): NTSTATUS; stdcall;
|
||||
function xboxkrnl_RtlLeaveCriticalSectionAndRegion(
|
||||
CriticalSection: PRTL_CRITICAL_SECTION
|
||||
): NTSTATUS; stdcall;
|
||||
// Source:JwaNative Translator:PatrickvL Done:100
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
|
@ -1004,10 +1026,18 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function xboxkrnl_RtlRip(): NTSTATUS; stdcall;
|
||||
// RtlRip:
|
||||
// Traps to the debugger with a certain message, then crashes.
|
||||
//
|
||||
// New to the XBOX.
|
||||
procedure xboxkrnl_RtlRip(
|
||||
Part1: PCSZ;
|
||||
Part2: PCSZ;
|
||||
Part3: PCSZ
|
||||
); stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('RtlRip');
|
||||
Unimplemented('RtlRip');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
|
|
|
@ -44,33 +44,11 @@ var
|
|||
{321}xboxkrnl_XboxEEPROMKey: array [0..16 - 1] of UCHAR; // Source OpenXDK
|
||||
{322}xboxkrnl_XboxHardwareInfo: XBOX_HARDWARE_INFO; // Source OpenXDK
|
||||
{323}xboxkrnl_XboxHDKey: array [0..16 - 1] of UCHAR; // Source OpenXDK
|
||||
{324}xboxkrnl_XboxKrnlVersion: DWord;
|
||||
{325}xboxkrnl_XboxSignatureKey: array [0..16 - 1] of Byte; // Source OpenXDK
|
||||
|
||||
function {324} xboxkrnl_XboxKrnlVersion(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function {353} xboxkrnl_XboxLANKey(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function {354} xboxkrnl_XboxAlternateSignatureKeys(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
{353}xboxkrnl_XboxLANKey: DWord;
|
||||
{354}xboxkrnl_XboxAlternateSignatureKeys: DWord;
|
||||
|
||||
implementation
|
||||
|
||||
function {324} xboxkrnl_XboxKrnlVersion(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('XboxKrnlVersion');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {353} xboxkrnl_XboxLANKey(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('XboxLANKey');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {354} xboxkrnl_XboxAlternateSignatureKeys(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('XboxAlternateSignatureKeys');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
@ -41,6 +41,9 @@ uses
|
|||
uEmuKrnl,
|
||||
uDxbxKrnl;
|
||||
|
||||
var
|
||||
{355}xboxkrnl_XePublicKeyData: DWord;
|
||||
|
||||
function {326} xboxkrnl_XeImageFileName(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
function {327} xboxkrnl_XeLoadSection(
|
||||
Section: PXBE_SECTIONHEADER // In, out
|
||||
|
@ -48,7 +51,6 @@ function {327} xboxkrnl_XeLoadSection(
|
|||
function {328} xboxkrnl_XeUnloadSection(
|
||||
Section: PXBE_SECTIONHEADER // In, out
|
||||
): NTSTATUS; stdcall; // Source: XBMC
|
||||
function {355} xboxkrnl_XePublicKeyData(): NTSTATUS; stdcall; // UNKNOWN_SIGNATURE
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -64,7 +66,6 @@ end;
|
|||
// count is now above zero.
|
||||
//
|
||||
// New to the XBOX.
|
||||
|
||||
function {327} xboxkrnl_XeLoadSection(
|
||||
Section: PXBE_SECTIONHEADER // In, out
|
||||
): NTSTATUS; stdcall; // Source: XBMC
|
||||
|
@ -79,7 +80,6 @@ end;
|
|||
// if the count is now below zero.
|
||||
//
|
||||
// New to the XBOX.
|
||||
|
||||
function {328} xboxkrnl_XeUnloadSection(
|
||||
Section: PXBE_SECTIONHEADER // In, out
|
||||
): NTSTATUS; stdcall; // Source: XBMC
|
||||
|
@ -89,11 +89,4 @@ begin
|
|||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
function {355} xboxkrnl_XePublicKeyData(): NTSTATUS; stdcall;
|
||||
begin
|
||||
EmuSwapFS(fsWindows);
|
||||
Result := Unimplemented('XePublicKeyData');
|
||||
EmuSwapFS(fsXbox);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
@ -50,14 +50,15 @@ function XTL_EmuXGIsSwizzledFormat(Format : D3DFORMAT) : PVOID; stdcall;
|
|||
begin
|
||||
{$IFDEF _DEBUG_TRACE}
|
||||
EmuSwapFS(); // Win2k/XP FS
|
||||
DbgPrintf('EmuXapi: EmuXGIsSwizzledFormat\n' +
|
||||
DbgPrintf('EmuXapi: EmuXGIsSwizzledFormat' +
|
||||
#13#10+'(' +
|
||||
#13#10+' Format : 0x%.08X\n' +
|
||||
#13#10+' Format : 0x%.08X' +
|
||||
#13#10+')',
|
||||
[Ord(Format)]);
|
||||
EmuSwapFS(); // Xbox FS
|
||||
{$ENDIF}
|
||||
(* Result := FALSE; *)
|
||||
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
(*procedure XTL_EmuXGSwizzleRect
|
||||
|
@ -76,29 +77,29 @@ begin
|
|||
EmuSwapFS(); // Win2k/XP FS
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuXapi (0x%X): EmuXGSwizzleRect\n"
|
||||
"(\n"
|
||||
" pSource : 0x%.08X\n"
|
||||
" Pitch : 0x%.08X\n"
|
||||
" pRect : 0x%.08X\n"
|
||||
" pDest : 0x%.08X\n"
|
||||
" Width : 0x%.08X\n"
|
||||
" Height : 0x%.08X\n"
|
||||
" pPoint : 0x%.08X\n"
|
||||
" BytesPerPixel : 0x%.08X\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), pSource, Pitch, pRect, pDest, Width, Height,
|
||||
pPoint, BytesPerPixel);
|
||||
DbgPrintf('EmuXapi : EmuXGSwizzleRect' +
|
||||
#13#10'(' +
|
||||
#13#10' pSource : 0x%.08X' +
|
||||
#13#10' Pitch : 0x%.08X' +
|
||||
#13#10' pRect : 0x%.08X' +
|
||||
#13#10' pDest : 0x%.08X' +
|
||||
#13#10' Width : 0x%.08X' +
|
||||
#13#10' Height : 0x%.08X' +
|
||||
#13#10' pPoint : 0x%.08X' +
|
||||
#13#10' BytesPerPixel : 0x%.08X' +
|
||||
#13#10');',
|
||||
[pSource, Pitch, pRect, pDest, Width, Height,
|
||||
pPoint, BytesPerPixel]);
|
||||
{$ENDIF}
|
||||
|
||||
if (pRect == NULL && pPoint == NULL && Pitch == 0) then
|
||||
if (pRect = NULL) and (pPoint = NULL) and (Pitch = 0) then
|
||||
{
|
||||
memcpy(pDest, pSource, Width*Height*BytesPerPixel);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pPoint != NULL && (pPoint->x != 0 || pPoint->y != 0)) then
|
||||
CxbxKrnlCleanup("Temporarily unsupported swizzle (very easy fix)");
|
||||
if (Assigned(pPoint) and (pPoint.x <> 0 or pPoint.y <> 0)) then
|
||||
CxbxKrnlCleanup('Temporarily unsupported swizzle (very easy fix)');
|
||||
|
||||
DWORD dwMaxY = Height;
|
||||
DWORD dwChunkSize = Width;
|
||||
|
@ -106,13 +107,13 @@ begin
|
|||
uint08 *pSrc = (uint08*)(*pSource;
|
||||
uint08 *pDst = (uint08*)(*pDest;
|
||||
|
||||
if (pRect != 0) then
|
||||
if Assigned(pRect) then
|
||||
{
|
||||
pSrc += pRect->top*Pitch;
|
||||
pSrc += pRect->left;
|
||||
pSrc += pRect.top*Pitch;
|
||||
pSrc += pRect.left;
|
||||
|
||||
dwMaxY = pRect->bottom - pRect->top;
|
||||
dwChunkSize = pRect->right - pRect->left;
|
||||
dwMaxY = pRect.bottom - pRect.top;
|
||||
dwChunkSize = pRect.right - pRect.left;
|
||||
}
|
||||
|
||||
for(DWORD y=0;y<dwMaxY;y++)
|
||||
|
@ -146,30 +147,30 @@ end;
|
|||
EmuSwapFS(); // Win2k/XP FS
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
DbgPrintf("EmuXapi (0x%X): EmuXGSwizzleBox\n"
|
||||
"(\n"
|
||||
" pSource : 0x%.08X\n"
|
||||
" RowPitch : 0x%.08X\n"
|
||||
" SlicePitch : 0x%.08X\n"
|
||||
" pBox : 0x%.08X\n"
|
||||
" pDest : 0x%.08X\n"
|
||||
" Width : 0x%.08X\n"
|
||||
" Height : 0x%.08X\n"
|
||||
" Depth : 0x%.08X\n"
|
||||
" pPoint : 0x%.08X\n"
|
||||
" BytesPerPixel : 0x%.08X\n"
|
||||
");\n",
|
||||
GetCurrentThreadId(), pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height,
|
||||
Depth, pPoint, BytesPerPixel);
|
||||
DbgPrintf('EmuXapi : EmuXGSwizzleBox' +
|
||||
#13#10'(' +
|
||||
#13#10' pSource : 0x%.08X' +
|
||||
#13#10' RowPitch : 0x%.08X' +
|
||||
#13#10' SlicePitch : 0x%.08X' +
|
||||
#13#10' pBox : 0x%.08X' +
|
||||
#13#10' pDest : 0x%.08X' +
|
||||
#13#10' Width : 0x%.08X' +
|
||||
#13#10' Height : 0x%.08X' +
|
||||
#13#10' Depth : 0x%.08X' +
|
||||
#13#10' pPoint : 0x%.08X' +
|
||||
#13#10' BytesPerPixel : 0x%.08X' +
|
||||
#13#10');',
|
||||
[pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height,
|
||||
Depth, pPoint, BytesPerPixel]);
|
||||
{$ENDIF}
|
||||
|
||||
if (pBox == NULL && pPoint == NULL && RowPitch == 0 && SlicePitch == 0) then
|
||||
if (pBox = NULL) and (pPoint = NULL) and (RowPitch = 0) and (SlicePitch = 0) then
|
||||
{
|
||||
memcpy(pDest, pSource, Width*Height*Depth*BytesPerPixel);
|
||||
}
|
||||
else
|
||||
{
|
||||
CxbxKrnlCleanup("Temporarily unsupported swizzle (easy fix)");
|
||||
CxbxKrnlCleanup('Temporarily unsupported swizzle (easy fix)');
|
||||
}
|
||||
|
||||
EmuSwapFS(); // Xbox FS
|
||||
|
@ -219,22 +220,22 @@ begin
|
|||
if (i < dwWidth) then
|
||||
begin
|
||||
dwMaskU |= j;
|
||||
j<<=1;
|
||||
j := j shl 1;
|
||||
end;
|
||||
|
||||
if (i < dwHeight) then
|
||||
begin
|
||||
dwMaskV |= j;
|
||||
j<<=1;
|
||||
j := j shl 1;
|
||||
end;
|
||||
|
||||
if (i < dwDepth) then
|
||||
begin
|
||||
dwMaskW |= j;
|
||||
j<<=1;
|
||||
j := j shl 1;
|
||||
end;
|
||||
|
||||
i<<=1;
|
||||
i := i shl 1;
|
||||
end;
|
||||
|
||||
DWORD dwSU = 0;
|
||||
|
@ -254,19 +255,19 @@ begin
|
|||
{
|
||||
if(i<=dwMaskU)
|
||||
{
|
||||
if(dwMaskU & i) dwSU |= (dwOffsetU & i);
|
||||
if(dwMaskU and i) > 0 then dwSU |= (dwOffsetU and i);
|
||||
else dwOffsetU<<=1;
|
||||
}
|
||||
|
||||
if (i<=dwMaskV) then
|
||||
{
|
||||
if(dwMaskV & i) dwSV |= (dwOffsetV & i);
|
||||
if(dwMaskV and i) > 0 then dwSV |= (dwOffsetV and i);
|
||||
else dwOffsetV<<=1;
|
||||
}
|
||||
|
||||
if (i<=dwMaskW) then
|
||||
{
|
||||
if(dwMaskW & i) dwSW |= (dwOffsetW & i);
|
||||
if(dwMaskW and i) > 0 then dwSW |= (dwOffsetW and i);
|
||||
else dwOffsetW<<=1;
|
||||
}
|
||||
}
|
||||
|
@ -285,15 +286,15 @@ begin
|
|||
|
||||
for (DWORD x=0; x<dwWidth; x++)
|
||||
{
|
||||
memcpy(pDstBuff, &((BYTE*)(*pSrcBuff)[(dwU|dwV|dwW)*dwBPP], dwBPP);
|
||||
memcpy(pDstBuff, @((BYTE*)(*pSrcBuff)[(dwU|dwV|dwW)*dwBPP], dwBPP);
|
||||
pDstBuff=(PVOID)(((DWORD)pDstBuff)+dwBPP);
|
||||
|
||||
dwU = (dwU - dwMaskU) & dwMaskU;
|
||||
dwU = (dwU - dwMaskU) and dwMaskU;
|
||||
}
|
||||
pDstBuff=(PVOID)(((DWORD)pDstBuff)+(dwPitch-dwWidth*dwBPP));
|
||||
dwV = (dwV - dwMaskV) & dwMaskV;
|
||||
dwV = (dwV - dwMaskV) and dwMaskV;
|
||||
}
|
||||
dwW = (dwW - dwMaskW) & dwMaskW;
|
||||
dwW = (dwW - dwMaskW) and dwMaskW;
|
||||
}
|
||||
} *)
|
||||
end;
|
||||
|
|
|
@ -1477,12 +1477,12 @@ begin
|
|||
|
||||
// Get the .xbe header
|
||||
// MARKED OUT BY CXBX
|
||||
{Xbe::Header* pXbeHeader = (Xbe::Header* ) 0x00010000;
|
||||
{Xbe::Header* pXbeHeader = (Xbe::Header* ) $00010000;
|
||||
|
||||
// Get the number of sections this .xbe has and the
|
||||
// location of the section headers.
|
||||
DWORD dwNumSections = pXbeHeader->dwSections;
|
||||
DWORD dwSectionAddr = pXbeHeader->dwSectionHeadersAddr - pXbeHeader->dwBaseAddr;
|
||||
DWORD dwNumSections = pXbeHeader.dwSections;
|
||||
DWORD dwSectionAddr = pXbeHeader.dwSectionHeadersAddr - pXbeHeader.dwBaseAddr;
|
||||
|
||||
// Get section headers.
|
||||
Xbe::SectionHeader* pSectionHeaders = (Xbe::SectionHeader* ) CxbxMalloc( sizeof( Xbe::SectionHeader ) * dwNumSections );
|
||||
|
@ -1491,7 +1491,7 @@ begin
|
|||
|
||||
for( DWORD i = 0; i < dwNumSections; i++ )
|
||||
begin
|
||||
memcpy( &pSectionHeaders[i], ((DWORD* ) dwOffset), sizeof( Xbe::SectionHeader ) );
|
||||
memcpy( @pSectionHeaders[i], ((DWORD* ) dwOffset), sizeof( Xbe::SectionHeader ) );
|
||||
dwOffset += sizeof( Xbe::SectionHeader );
|
||||
end;
|
||||
|
||||
|
@ -1501,7 +1501,7 @@ begin
|
|||
for( DWORD i = 0; i < dwNumSections; i++ )
|
||||
begin
|
||||
char szSectionName[32];
|
||||
dwOffset = pSectionHeaders[i].dwSectionNameAddr - pXbeHeader->dwBaseAddr;
|
||||
dwOffset = pSectionHeaders[i].dwSectionNameAddr - pXbeHeader.dwBaseAddr;
|
||||
sprintf( szSectionName, '%s', ((DWORD* ) dwOffset) );
|
||||
|
||||
// Do we have a match?
|
||||
|
@ -1514,7 +1514,7 @@ begin
|
|||
|
||||
// If we have a match, get the raw address of this section
|
||||
// and return a pointer to that address.
|
||||
if ( dwSection != -1 ) then
|
||||
if ( dwSection <> -1 ) then
|
||||
begin
|
||||
pRet = (LPVOID) pSectionHeaders[dwSection].dwRawAddr;
|
||||
end;
|
||||
|
|
|
@ -133,22 +133,22 @@ end;
|
|||
|
||||
function ResourceTracker.exists(uiKey: uint32): BOOL;
|
||||
begin
|
||||
(* this->Lock();
|
||||
(* this.Lock();
|
||||
|
||||
RTNode *cur = m_head;
|
||||
|
||||
while(cur != 0)
|
||||
while Assigned(cur)
|
||||
{
|
||||
if (cur->uiKey == uiKey) then
|
||||
if (cur.uiKey = uiKey) then
|
||||
{
|
||||
this->Unlock();
|
||||
this.Unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
cur = cur->pNext;
|
||||
cur = cur.pNext;
|
||||
}
|
||||
|
||||
this->Unlock();
|
||||
this.Unlock();
|
||||
|
||||
return false; *)
|
||||
end;
|
||||
|
@ -162,14 +162,14 @@ function ResourceTracker.get(uiKey: uint32): PVOID;
|
|||
begin
|
||||
(* RTNode *cur = m_head;
|
||||
|
||||
while(cur != 0)
|
||||
while Assigned(cur)
|
||||
{
|
||||
if (cur->uiKey == uiKey) then
|
||||
if (cur.uiKey = uiKey) then
|
||||
{
|
||||
return cur->pResource;
|
||||
return cur.pResource;
|
||||
}
|
||||
|
||||
cur = cur->pNext;
|
||||
cur = cur.pNext;
|
||||
}
|
||||
|
||||
return 0; *)
|
||||
|
@ -193,8 +193,8 @@ begin
|
|||
(* if m_head = 0 then
|
||||
{
|
||||
m_tail = m_head = new RTNode();
|
||||
m_tail->pResource = 0;
|
||||
m_tail->pNext = 0;
|
||||
m_tail.pResource = 0;
|
||||
m_tail.pNext = 0;
|
||||
}
|
||||
|
||||
m_tail.pResource := pResource;
|
||||
|
@ -224,19 +224,19 @@ begin
|
|||
RTNode *pre = 0;
|
||||
RTNode *cur = m_head;
|
||||
|
||||
while(cur != 0)
|
||||
while Assigned(cur)
|
||||
{
|
||||
if (cur->uiKey == uiKey) then
|
||||
if (cur.uiKey = uiKey) then
|
||||
{
|
||||
if (pre != 0) then
|
||||
if Assigned(pre) then
|
||||
{
|
||||
pre->pNext = cur->pNext;
|
||||
pre.pNext = cur.pNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_head = cur->pNext;
|
||||
m_head = cur.pNext;
|
||||
|
||||
if (m_head->pNext == 0) then
|
||||
if (m_head.pNext = nil) then
|
||||
{
|
||||
delete m_head;
|
||||
|
||||
|
@ -247,13 +247,13 @@ begin
|
|||
|
||||
delete cur;
|
||||
|
||||
this->Unlock();
|
||||
this.Unlock();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pre = cur;
|
||||
cur = cur->pNext;
|
||||
cur = cur.pNext;
|
||||
}
|
||||
*)
|
||||
Self.Unlock();
|
||||
|
|
|
@ -22,6 +22,11 @@ unit uConsts;
|
|||
interface
|
||||
|
||||
const
|
||||
XBOX_MEMORY_SIZE = 128*1024*1024;
|
||||
|
||||
XBE_IMAGE_BASE = $00010000;
|
||||
XBE_HEADER_SIZE = $1000;
|
||||
|
||||
DLL_IMAGE_BASE = $10000000;
|
||||
MAXIMUM_XBOX_THREADS = 256;
|
||||
|
||||
|
@ -31,16 +36,12 @@ const
|
|||
CDXBXDLLNAME = 'Dxbx.dll';
|
||||
|
||||
// Application Versions
|
||||
{$IFDEF DEBUG}
|
||||
_DXBX_VERSION = '0.0.0.10 Debug';
|
||||
{$ELSE}
|
||||
_DXBX_VERSION = '0.0.0.10';
|
||||
{$ENDIF}
|
||||
_DXBX_VERSION = '0.0.1.1' {$IFDEF DEBUG} + ' Debug'{$ENDIF};
|
||||
_XDK_TRACKER_VERSION = '2.0.2.0';
|
||||
|
||||
// Dialog Filters
|
||||
DIALOG_FILTER_TEXT = 'Text Documents (*.txt)|*.txt';
|
||||
DIALOG_FILTER_EXE = 'Windows Executables (*.exe)|*.exe';
|
||||
DIALOG_FILTER_EXE = 'Windows Executables (*.exe)|*.exe'; // obsolete
|
||||
DIALOG_FILTER_XBE = 'Xbox Executables (*.xbe)|*.xbe';
|
||||
|
||||
// Magic values
|
||||
|
@ -55,6 +56,8 @@ const
|
|||
|
||||
// XOR keys
|
||||
|
||||
XOR_MAX_VIRTUAL_ADDRESS = $01000000;
|
||||
|
||||
XOR_EP_DEBUG = $94859D4B; // Entry Point (Debug)
|
||||
XOR_EP_RETAIL = $A8FC57AB; // Entry Point (Retail)
|
||||
XOR_KT_DEBUG = $EFB1F152; // Kernel Thunk (Debug)
|
||||
|
@ -65,11 +68,13 @@ const
|
|||
|
||||
// XBE constants
|
||||
|
||||
// Initialization flags
|
||||
XBE_INIT_FLAG_MountUtilityDrive = $00000001;
|
||||
XBE_INIT_FLAG_FormatUtilityDrive = $00000002;
|
||||
XBE_INIT_FLAG_Limit64MB = $00000004;
|
||||
XBE_INIT_FLAG_DontSetupHarddisk = $00000008;
|
||||
|
||||
// Section flags
|
||||
XBE_SECTIONHEADER_FLAG_Writable = $00000001;
|
||||
XBE_SECTIONHEADER_FLAG_Preload = $00000002;
|
||||
XBE_SECTIONHEADER_FLAG_Executable = $00000004;
|
||||
|
@ -87,18 +92,19 @@ const
|
|||
|
||||
XBE_LIBRARYNAME_MAXLENGTH = 8;
|
||||
|
||||
XBE_TITLENAME_MAXLENGTH = 40;
|
||||
|
||||
XBE_DebugUnicodeFileName_MAXLENGTH = 40; // ?? 256;
|
||||
|
||||
// game region flags for Xbe certificate
|
||||
XBEIMAGE_GAME_REGION_NA = $00000001;
|
||||
XBEIMAGE_GAME_REGION_US_CANADA = $00000001;
|
||||
XBEIMAGE_GAME_REGION_JAPAN = $00000002;
|
||||
XBEIMAGE_GAME_REGION_RESTOFWORLD = $00000004;
|
||||
XBEIMAGE_GAME_REGION_MANUFACTURING = $80000000;
|
||||
|
||||
XBEIMAGE_GAME_REGION_ALL = XBEIMAGE_GAME_REGION_NA + XBEIMAGE_GAME_REGION_JAPAN + XBEIMAGE_GAME_REGION_RESTOFWORLD;
|
||||
XBEIMAGE_GAME_REGION_ALL = XBEIMAGE_GAME_REGION_US_CANADA + XBEIMAGE_GAME_REGION_JAPAN + XBEIMAGE_GAME_REGION_RESTOFWORLD;
|
||||
|
||||
// XBE media type flags for Xbe certificate
|
||||
|
||||
XBEIMAGE_MEDIA_TYPE_HARD_DISK = $00000001;
|
||||
XBEIMAGE_MEDIA_TYPE_DVD_X2 = $00000002;
|
||||
XBEIMAGE_MEDIA_TYPE_DVD_CD = $00000004;
|
||||
|
@ -144,12 +150,12 @@ const
|
|||
cOpen = 'open';
|
||||
|
||||
CCXBXKRNLINIT = 'CxbxKrnlInit';
|
||||
CXBXKRNL_KERNELTHUNKTABLE = 'CxbxKrnl_KernelThunkTable';
|
||||
CXBXKRNL_KERNELTHUNKTABLE = 'CxbxKrnl_KernelThunkTable'; // obsolete
|
||||
CSETXBEPATHMANGLEDNAME = '?SetXbePath@EmuShared@@QAEXPBD@Z';
|
||||
|
||||
// Limits
|
||||
_RecentXbeLimit: Integer = 10;
|
||||
_RecentExeLimit: Integer = 10;
|
||||
_RecentExeLimit: Integer = 10; // obsolete
|
||||
|
||||
implementation
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ uses
|
|||
uEmuKrnlXc,
|
||||
uEmuKrnlXe;
|
||||
|
||||
function CxbxKrnl_KernelThunkTable: PKernelThunkTable; cdecl;
|
||||
|
||||
implementation
|
||||
function CxbxKrnl_KernelThunkTable: PKernelThunkTable; cdecl; // obsolete
|
||||
|
||||
var
|
||||
KernelThunkTable: packed array [0..NUMBER_OF_THUNKS - 1] of Pointer = (
|
||||
|
@ -92,9 +90,9 @@ var
|
|||
{037}@xboxkrnl_FscSetCacheSize,
|
||||
{038}@xboxkrnl_HalClearSoftwareInterrupt,
|
||||
{039}@xboxkrnl_HalDisableSystemInterrupt,
|
||||
{040}@xboxkrnl_HalDiskCachePartitionCount, // Dxbx TODO : variable ?
|
||||
{041}@xboxkrnl_HalDiskModelNumber, // Dxbx TODO : variable ?
|
||||
{042}@xboxkrnl_HalDiskSerialNumber, // Dxbx TODO : variable ?
|
||||
{040}@xboxkrnl_HalDiskCachePartitionCount, // variable
|
||||
{041}@xboxkrnl_HalDiskModelNumber, // variable
|
||||
{042}@xboxkrnl_HalDiskSerialNumber, // variable
|
||||
{043}@xboxkrnl_HalEnableSystemInterrupt,
|
||||
{044}@xboxkrnl_HalGetInterruptVector,
|
||||
{045}@xboxkrnl_HalReadSMBusValue,
|
||||
|
@ -173,7 +171,7 @@ var
|
|||
{117}@xboxkrnl_KeInsertQueue,
|
||||
{118}@xboxkrnl_KeInsertQueueApc,
|
||||
{119}@xboxkrnl_KeInsertQueueDpc,
|
||||
{120}@xboxkrnl_KeInterruptTime,
|
||||
{120}@xboxkrnl_KeInterruptTime, // variable
|
||||
{121}@xboxkrnl_KeIsExecutingDpc,
|
||||
{122}@xboxkrnl_KeLeaveCriticalRegion,
|
||||
{123}@xboxkrnl_KePulseEvent,
|
||||
|
@ -207,15 +205,15 @@ var
|
|||
{151}@xboxkrnl_KeStallExecutionProcessor,
|
||||
{152}@xboxkrnl_KeSuspendThread,
|
||||
{153}@xboxkrnl_KeSynchronizeExecution,
|
||||
{154}@xboxkrnl_KeSystemTime,
|
||||
{154}@xboxkrnl_KeSystemTime, // variable
|
||||
{155}@xboxkrnl_KeTestAlertThread,
|
||||
{156}@xboxkrnl_KeTickCount, // variable
|
||||
{157}@xboxkrnl_KeTimeIncrement,
|
||||
{157}@xboxkrnl_KeTimeIncrement, // variable
|
||||
{158}@xboxkrnl_KeWaitForMultipleObjects,
|
||||
{159}@xboxkrnl_KeWaitForSingleObject,
|
||||
{160}@xboxkrnl_KfRaiseIrql,
|
||||
{161}@xboxkrnl_KfLowerIrql,
|
||||
{162}@xboxkrnl_KiBugCheckData,
|
||||
{162}@xboxkrnl_KiBugCheckData, // variable
|
||||
{163}@xboxkrnl_KiUnlockDispatcherDatabase,
|
||||
{164}@xboxkrnl_LaunchDataPage, // variable
|
||||
{165}@xboxkrnl_MmAllocateContiguousMemory,
|
||||
|
@ -293,16 +291,16 @@ var
|
|||
{237}@xboxkrnl_NtWriteFileGather,
|
||||
{238}@xboxkrnl_NtYieldExecution,
|
||||
{239}@xboxkrnl_ObCreateObject,
|
||||
{240}@xboxkrnl_ObDirectoryObjectType,
|
||||
{240}@xboxkrnl_ObDirectoryObjectType, // variable
|
||||
{241}@xboxkrnl_ObInsertObject,
|
||||
{242}@xboxkrnl_ObMakeTemporaryObject,
|
||||
{243}@xboxkrnl_ObOpenObjectByName,
|
||||
{244}@xboxkrnl_ObOpenObjectByPointer,
|
||||
{245}@xboxkrnl_ObpObjectHandleTable,
|
||||
{245}@xboxkrnl_ObpObjectHandleTable, // variable
|
||||
{246}@xboxkrnl_ObReferenceObjectByHandle,
|
||||
{247}@xboxkrnl_ObReferenceObjectByName,
|
||||
{248}@xboxkrnl_ObReferenceObjectByPointer,
|
||||
{249}@xboxkrnl_ObSymbolicLinkObjectType,
|
||||
{249}@xboxkrnl_ObSymbolicLinkObjectType, // variable
|
||||
{250}@xboxkrnl_ObfDereferenceObject,
|
||||
{251}@xboxkrnl_ObfReferenceObject,
|
||||
{252}@xboxkrnl_PhyGetLinkState,
|
||||
|
@ -312,7 +310,7 @@ var
|
|||
{256}@xboxkrnl_PsQueryStatistics,
|
||||
{257}@xboxkrnl_PsSetCreateThreadNotifyRoutine,
|
||||
{258}@xboxkrnl_PsTerminateSystemThread,
|
||||
{259}@xboxkrnl_PsThreadObjectType,
|
||||
{259}@xboxkrnl_PsThreadObjectType, // variable
|
||||
{260}@xboxkrnl_RtlAnsiStringToUnicodeString,
|
||||
{261}@xboxkrnl_RtlAppendStringToString,
|
||||
{262}@xboxkrnl_RtlAppendUnicodeStringToString,
|
||||
|
@ -374,12 +372,12 @@ var
|
|||
{318}@xboxkrnl_RtlUshortByteSwap,
|
||||
{319}@xboxkrnl_RtlWalkFrameChain,
|
||||
{320}@xboxkrnl_RtlZeroMemory,
|
||||
{321}@xboxkrnl_XboxEEPROMKey,
|
||||
{322}@xboxkrnl_XboxHardwareInfo,
|
||||
{323}@xboxkrnl_XboxHDKey,
|
||||
{324}@xboxkrnl_XboxKrnlVersion,
|
||||
{325}@xboxkrnl_XboxSignatureKey,
|
||||
{326}@xboxkrnl_XeImageFileName,
|
||||
{321}@xboxkrnl_XboxEEPROMKey, // variable
|
||||
{322}@xboxkrnl_XboxHardwareInfo, // variable
|
||||
{323}@xboxkrnl_XboxHDKey, // variable
|
||||
{324}@xboxkrnl_XboxKrnlVersion, // variable
|
||||
{325}@xboxkrnl_XboxSignatureKey, // variable
|
||||
{326}@xboxkrnl_XeImageFileName, // variable
|
||||
{327}@xboxkrnl_XeLoadSection,
|
||||
{328}@xboxkrnl_XeUnloadSection,
|
||||
{329}@xboxkrnl_READ_PORT_BUFFER_UCHAR,
|
||||
|
@ -406,11 +404,11 @@ var
|
|||
{350}@xboxkrnl_XcCryptService,
|
||||
{351}@xboxkrnl_XcUpdateCrypto,
|
||||
{352}@xboxkrnl_RtlRip,
|
||||
{353}@xboxkrnl_XboxLANKey,
|
||||
{354}@xboxkrnl_XboxAlternateSignatureKeys,
|
||||
{355}@xboxkrnl_XePublicKeyData, // Dxbx TODO : variable ?
|
||||
{353}@xboxkrnl_XboxLANKey, // variable
|
||||
{354}@xboxkrnl_XboxAlternateSignatureKeys, // variable
|
||||
{355}@xboxkrnl_XePublicKeyData, // variable
|
||||
{356}@xboxkrnl_HalBootSMCVideoMode, // variable
|
||||
{357}@xboxkrnl_IdexChannelObject,
|
||||
{357}@xboxkrnl_IdexChannelObject, // variable
|
||||
{358}@xboxkrnl_HalIsResetOrShutdownPending,
|
||||
{359}@xboxkrnl_IoMarkIrpMustComplete,
|
||||
{360}@xboxkrnl_HalInitiateShutdown,
|
||||
|
@ -434,12 +432,14 @@ var
|
|||
{378}@xboxkrnl_MmDbgWriteCheck
|
||||
);
|
||||
|
||||
function CxbxKrnl_KernelThunkTable: PKernelThunkTable;
|
||||
implementation
|
||||
|
||||
function CxbxKrnl_KernelThunkTable: PKernelThunkTable; // obsolete
|
||||
begin
|
||||
Result := @KernelThunkTable;
|
||||
end;
|
||||
|
||||
exports
|
||||
CxbxKrnl_KernelThunkTable;
|
||||
CxbxKrnl_KernelThunkTable; // obsolete
|
||||
|
||||
end.
|
||||
|
|
|
@ -42,6 +42,9 @@ type
|
|||
|
||||
TRawSection = TVarByteArray;
|
||||
|
||||
TPWCharArray = array [0..(MaxInt div SizeOf(PWideChar)) - 1] of PWideChar;
|
||||
PPWCharArray = ^TPWCharArray;
|
||||
|
||||
TDWordArray = array [0..(MaxInt div SizeOf(DWord)) - 1] of DWord;
|
||||
PDWordArray = ^TDWordArray;
|
||||
|
||||
|
|
17
src/uXbe.pas
17
src/uXbe.pas
|
@ -86,7 +86,7 @@ type
|
|||
dwSize: DWord; // 0x0000 - size of certificate
|
||||
dwTimeDate: DWord; // 0x0004 - timedate stamp
|
||||
dwTitleId: DWord; // 0x0008 - title id
|
||||
wszTitleName: array [0..39] of WideChar; // 0x000C - title name (unicode)
|
||||
wszTitleName: array [0..XBE_TITLENAME_MAXLENGTH-1] of WideChar; // 0x000C - title name (unicode)
|
||||
dwAlternateTitleId: array [0..15] of Dword; // 0x005C - alternate title ids
|
||||
dwAllowedMedia: Dword; // 0x009C - allowed media types
|
||||
dwGameRegion: DWord; // 0x00A0 - game region
|
||||
|
@ -150,7 +150,7 @@ type
|
|||
PXbeSectionHeader = PXBE_SECTIONHEADER;
|
||||
|
||||
_XBE_LIBRARYVERSION = packed record
|
||||
szName: array [0..7] of AnsiChar; // library name
|
||||
szName: array [0..XBE_LIBRARYNAME_MAXLENGTH-1] of AnsiChar; // library name
|
||||
wMajorVersion: Word; // major version
|
||||
wMinorVersion: Word; // minor version
|
||||
wBuildVersion: Word; // build version
|
||||
|
@ -331,7 +331,7 @@ function GetWordVal(aBuffer: MathPtr; i: Integer): Word;
|
|||
|
||||
function BetterTime(x_timeDate: uint32): string;
|
||||
|
||||
function OpenXbe(aFileName: string; var aXbe: TXbe; var aExeFileName, aXbeFileName: string): Boolean;
|
||||
function OpenXbe(aXbeFileName: string; var aXbe: TXbe): Boolean;
|
||||
|
||||
procedure XbeLoaded;
|
||||
function GameRegionToString(const aGameRegion: Integer): string;
|
||||
|
@ -347,15 +347,12 @@ begin
|
|||
WriteLog(DxbxFormat('DXBX: %s loaded.', [m_szAsciiTitle]));
|
||||
end;
|
||||
|
||||
function OpenXbe(aFileName: string; var aXbe: TXbe; var aExeFileName, aXbeFileName: string): Boolean;
|
||||
function OpenXbe(aXbeFileName: string; var aXbe: TXbe): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Assigned(aXbe) or not (FileExists(aFileName)) then
|
||||
if Assigned(aXbe) or not (FileExists(aXbeFileName)) then
|
||||
Exit;
|
||||
|
||||
aExeFileName := '';
|
||||
aXbeFileName := aFileName;
|
||||
|
||||
{var}aXbe := TXbe.Create(aXbeFileName, ftXbe);
|
||||
try
|
||||
XbeLoaded();
|
||||
|
@ -396,7 +393,7 @@ begin
|
|||
if (aGameRegion and XBEIMAGE_GAME_REGION_JAPAN) > 0 then
|
||||
Result := Result + ' JAP';
|
||||
|
||||
if (aGameRegion and XBEIMAGE_GAME_REGION_NA) > 0 then
|
||||
if (aGameRegion and XBEIMAGE_GAME_REGION_US_CANADA) > 0 then
|
||||
Result := Result + ' NTSC';
|
||||
|
||||
if (aGameRegion and XBEIMAGE_GAME_REGION_RESTOFWORLD) > 0 then
|
||||
|
@ -1089,7 +1086,7 @@ begin
|
|||
while(++v<100*17-1) and (len < 1024) and (color = (x_Gray[v] shr 4)) do
|
||||
Inc(len);
|
||||
|
||||
LogoRLE *cur = (LogoRLE * )&LogoBuffer[LogoSize];
|
||||
LogoRLE *cur = (LogoRLE * )@LogoBuffer[LogoSize];
|
||||
|
||||
if (len <= 7) then
|
||||
begin
|
||||
|
|
|
@ -330,9 +330,9 @@ cleanup:
|
|||
|
||||
MSG Msg;
|
||||
|
||||
while(PeekMessage(&Msg, hWndDlg, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE)) do
|
||||
while(PeekMessage(@Msg, hWndDlg, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE)) do
|
||||
;
|
||||
while(PeekMessage(&Msg, hWndDlg, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE)) do
|
||||
while(PeekMessage(@Msg, hWndDlg, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE)) do
|
||||
;
|
||||
end;
|
||||
|
||||
|
|
Loading…
Reference in a new issue