This commit is contained in:
Aaron Robinson 2003-04-12 11:21:35 +00:00
parent 3571059286
commit c273af7e69
13 changed files with 415 additions and 146 deletions

View File

@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cxbe", "Cxbe.vcproj", "{0F4725FF-D671-49C0-A7E5-54DBC18226D1}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cxbe", "Cxbe.vcproj", "{EDA06923-F975-4B5F-A61C-C50989D4F0A2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cxbx", "Cxbx.vcproj", "{56F746E9-DCE6-441E-867C-594C8028A54C}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cxbx", "Cxbx.vcproj", "{27D286C4-D1B8-4D4F-88B8-ABEF85F96CFB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CxbxKrnl", "CxbxKrnl.vcproj", "{251B0184-1631-4203-9667-B98EB55E7458}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CxbxKrnl", "CxbxKrnl.vcproj", "{61ABBF02-FB2C-4004-AADD-E5A667B76C9E}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
@ -11,21 +11,21 @@ Global
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
{56F746E9-DCE6-441E-867C-594C8028A54C}.0 = {251B0184-1631-4203-9667-B98EB55E7458}
{27D286C4-D1B8-4D4F-88B8-ABEF85F96CFB}.0 = {61ABBF02-FB2C-4004-AADD-E5A667B76C9E}
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{0F4725FF-D671-49C0-A7E5-54DBC18226D1}.Debug.ActiveCfg = Debug|Win32
{0F4725FF-D671-49C0-A7E5-54DBC18226D1}.Debug.Build.0 = Debug|Win32
{0F4725FF-D671-49C0-A7E5-54DBC18226D1}.Release.ActiveCfg = Release|Win32
{0F4725FF-D671-49C0-A7E5-54DBC18226D1}.Release.Build.0 = Release|Win32
{56F746E9-DCE6-441E-867C-594C8028A54C}.Debug.ActiveCfg = Debug|Win32
{56F746E9-DCE6-441E-867C-594C8028A54C}.Debug.Build.0 = Debug|Win32
{56F746E9-DCE6-441E-867C-594C8028A54C}.Release.ActiveCfg = Release|Win32
{56F746E9-DCE6-441E-867C-594C8028A54C}.Release.Build.0 = Release|Win32
{251B0184-1631-4203-9667-B98EB55E7458}.Debug.ActiveCfg = Debug|Win32
{251B0184-1631-4203-9667-B98EB55E7458}.Debug.Build.0 = Debug|Win32
{251B0184-1631-4203-9667-B98EB55E7458}.Release.ActiveCfg = Release|Win32
{251B0184-1631-4203-9667-B98EB55E7458}.Release.Build.0 = Release|Win32
{EDA06923-F975-4B5F-A61C-C50989D4F0A2}.Debug.ActiveCfg = Debug|Win32
{EDA06923-F975-4B5F-A61C-C50989D4F0A2}.Debug.Build.0 = Debug|Win32
{EDA06923-F975-4B5F-A61C-C50989D4F0A2}.Release.ActiveCfg = Release|Win32
{EDA06923-F975-4B5F-A61C-C50989D4F0A2}.Release.Build.0 = Release|Win32
{27D286C4-D1B8-4D4F-88B8-ABEF85F96CFB}.Debug.ActiveCfg = Debug|Win32
{27D286C4-D1B8-4D4F-88B8-ABEF85F96CFB}.Debug.Build.0 = Debug|Win32
{27D286C4-D1B8-4D4F-88B8-ABEF85F96CFB}.Release.ActiveCfg = Release|Win32
{27D286C4-D1B8-4D4F-88B8-ABEF85F96CFB}.Release.Build.0 = Release|Win32
{61ABBF02-FB2C-4004-AADD-E5A667B76C9E}.Debug.ActiveCfg = Debug|Win32
{61ABBF02-FB2C-4004-AADD-E5A667B76C9E}.Debug.Build.0 = Debug|Win32
{61ABBF02-FB2C-4004-AADD-E5A667B76C9E}.Release.ActiveCfg = Release|Win32
{61ABBF02-FB2C-4004-AADD-E5A667B76C9E}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection

View File

@ -1 +1,36 @@
Flushed
ret = xntdll::ZwCreateFile
(
FileHandle, DesiredAccess, (xntdll::_OBJECT_ATTRIBUTES*)ObjectAttributes, (xntdll::_IO_STATUS_BLOCK *)IoStatusBlock,
(xntdll::_LARGE_INTEGER *)AllocationSize, FileAttributes, ShareAccess, Disposition,
CreateOptions, 0, 0
);
/*
Data Start Address : 0x00000000
Data End Address : 0x00000000
TLS Index Address : 0x00030DC4
TLS Callback Address : 0x00000000
Size of Zero Fill : 0x0000000C -> 12
Characteristics : 0x00000000 -> 16
Data Start Address : 0x00010494 |
Data End Address : 0x000104A0 |-> 12
TLS Index Address : 0x00030D5C
TLS Callback Address : 0x00000000
Size of Zero Fill : 0x00000008 -> 8
Characteristics : 0x00000000 -> 26
Data Start Address : 0x00010494 |
Data End Address : 0x000104A4 |-> 16
TLS Index Address : 0x00030D5C
TLS Callback Address : 0x00000000
Size of Zero Fill : 0x00000008 -> 8
Characteristics : 0x00000000 -> 36
Data Start Address : 0x00010494 |
Data End Address : 0x000104A8 |-> 20
TLS Index Address : 0x00030D5C
TLS Callback Address : 0x00000000
Size of Zero Fill : 0x00000008 -> 8
Characteristics : 0x00000000 -> 52
*/

View File

@ -53,6 +53,17 @@ static inline void EmuSwapFS()
}
}
// ******************************************************************
// * func: EmuIsXboxFS
// ******************************************************************
// *
// * This function will return true if the current FS register is
// * the Xbox emulation variety. Alternatively, false means the
// * Win2k/XP FS register is currently loaded.
// *
// ******************************************************************
bool EmuIsXboxFS();
// ******************************************************************
// * func: EmuGenerateFS
// ******************************************************************

View File

@ -42,14 +42,70 @@ namespace xboxkrnl
#include <xboxkrnl/xboxkrnl.h>
};
#include <stdio.h>
// ******************************************************************
// * prevent name collisions
// ******************************************************************
namespace xntdll
{
#include "xntdll.h"
};
#include "Emu.h"
// ******************************************************************
// * emulated "special" file handle
// * Maximum number of open handles in the system
// ******************************************************************
struct EmuHandle
#define EMU_MAX_HANDLES 1024
// ******************************************************************
// * Wrapper of a handle object
// ******************************************************************
class EmuHandle
{
enum _EmuHandleType m_Type;
public:
// Type of handle
volatile enum _EmuHandleType m_Type;
// To keep the size 8 bytes, these 2 items are in a union
union
{
// Pointer to actual object (when handle is valid)
volatile class EmuNtObject *m_Object;
// Pointer to next free handle
volatile EmuHandle *m_NextFree;
};
// Close this handle
xntdll::NTSTATUS Close(void);
// Initialize the EmuHandle system
static bool Initialize();
// Close all open handles
static void CloseAll(void);
// Allocate an empty handle
static volatile EmuHandle *Allocate(void);
private:
// Array of EmuHandles in the system
static EmuHandle Handles[EMU_MAX_HANDLES];
// Pointer to first free handle in array, or NULL if none
volatile static EmuHandle *FirstFree;
// Pointer to last free handle in array, or NULL if none
volatile static EmuHandle *LastFree;
// Lock on the handle system
static CRITICAL_SECTION HandleLock;
// Quick functions to lock/unlock
inline static void Lock(void);
inline static void Unlock(void);
};
// ******************************************************************
@ -57,11 +113,70 @@ struct EmuHandle
// ******************************************************************
typedef enum _EmuHandleType
{
EMUHANDLE_TYPE_PARTITION1 = 0,
EMUHANDLE_TYPE_TDATA
// Unallocated handle
EMUHANDLE_TYPE_EMPTY = 0,
// Allocated but so far unused handle
EMUHANDLE_TYPE_ALLOCATED,
// File handle with no really special features
EMUHANDLE_TYPE_FILE,
// Fake file/directory/directory object/partition handle
EMUHANDLE_TYPE_OBJECT
}
EmuHandleType;
// ******************************************************************
// * An NT fake object
// ******************************************************************
class EmuNtObject
{
public:
// Decrements the reference count of this object (never override)
void NtClose(void);
// These functions mimic the Nt* calls
// Increments the reference count of this object
// For file handles, a whole new EmuFile structure is returned.
// For other objects (the default implementation), "this" is returned.
virtual EmuNtObject *NtDuplicateObject(void);
protected:
// Object name (Unicode, because we handle after-conversion strings)
const WCHAR *Name;
ULONG NameLength;
// Permanent status
bool PermanentFlag;
// Called by close() when the reference count reaches zero
virtual void Free(void) = 0;
// Constructor
EmuNtObject(void);
// Destructor
virtual ~EmuNtObject() = 0;
private:
// Reference count
ULONG RefCount;
};
// ******************************************************************
// * Emulated file handle
// ******************************************************************
class EmuNtFile : public EmuNtObject
{
public:
// We need to override NtDuplicateObject in this case
private:
// The Windows file handle
HANDLE File;
// Pointer to the volume from which this came
//EmuNtVolume *Volume;
};
// ******************************************************************
// * is hFile a 'special' emulated handle?
// ******************************************************************

View File

@ -77,9 +77,9 @@ enum InputDeviceComponent
};
// ******************************************************************
// * Input Device Title Lookup Table
// * Input Device Name Lookup Table
// ******************************************************************
extern const char *g_InputDeviceTitle[INPUT_DEVICE_COMPONENT_COUNT];
extern const char *g_InputDeviceName[INPUT_DEVICE_COMPONENT_COUNT];
// ******************************************************************
// * InputMapping Flags

View File

@ -448,6 +448,12 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
case ID_FILE_RXBE_8:
case ID_FILE_RXBE_9:
{
if(m_Xbe != 0)
CloseXbe();
if(m_Xbe != 0)
break;
HMENU menu = GetMenu(m_hwnd);
HMENU file_menu = GetSubMenu(menu, 0);
HMENU rxbe_menu = GetSubMenu(file_menu, 9);
@ -473,6 +479,12 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
case ID_FILE_REXE_8:
case ID_FILE_REXE_9:
{
if(m_Xbe != 0)
CloseXbe();
if(m_Xbe != 0)
break;
HMENU menu = GetMenu(m_hwnd);
HMENU file_menu = GetSubMenu(menu, 0);
HMENU rexe_menu = GetSubMenu(file_menu, 10);
@ -1199,7 +1211,7 @@ void WndMain::RefreshMenus()
int max = m_dwRecentXbe;
for(int v=0;v<max;v++)
EnableMenuItem(rxbe_menu, ID_FILE_RXBE_0 + v, MF_BYCOMMAND | (m_Xbe == 0) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(rxbe_menu, ID_FILE_RXBE_0 + v, MF_BYCOMMAND | MF_ENABLED);
}
// ******************************************************************
@ -1210,7 +1222,7 @@ void WndMain::RefreshMenus()
int max = m_dwRecentExe;
for(int v=0;v<max;v++)
EnableMenuItem(rexe_menu, ID_FILE_REXE_0 + v, MF_BYCOMMAND | (m_Xbe == 0) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(rexe_menu, ID_FILE_REXE_0 + v, MF_BYCOMMAND | MF_ENABLED);
}
}
@ -1444,38 +1456,52 @@ void WndMain::OpenXbe(const char *x_filename)
// ******************************************************************
if(m_XbeFilename[0] != '\0')
{
bool exists = false;
bool found = false;
// check if this filename already exists
for(int c=0;c<m_dwRecentXbe;c++)
if(strcmp(m_szRecentXbe[c], m_XbeFilename) == 0)
exists = true;
if(!exists)
// if this filename already exists, temporarily remove it
for(int c=0, r=0;c<m_dwRecentXbe;c++, r++)
{
// move all items down one, removing the last one if necessary
for(int v=RECENT_XBE_SIZE;v>0;v--)
if(strcmp(m_szRecentXbe[c], m_XbeFilename) == 0)
{
if(m_szRecentXbe[v-1] == 0)
m_szRecentXbe[v] = 0;
else
{
if(m_szRecentXbe[v] == 0)
m_szRecentXbe[v] = (char*)calloc(1, 260);
strncpy(m_szRecentXbe[v], m_szRecentXbe[v-1], 259);
}
found = true;
r++;
}
// add new item as first index
if(r != c)
{
if(m_szRecentXbe[0] == 0)
m_szRecentXbe[0] = (char*)calloc(1, 260);
strcpy(m_szRecentXbe[0], m_XbeFilename);
m_dwRecentXbe++;
if(m_szRecentXbe[r] == 0 || r > m_dwRecentXbe - 1)
m_szRecentXbe[c] = 0;
else
strncpy(m_szRecentXbe[c], m_szRecentXbe[r], 259);
}
}
if(found)
m_dwRecentXbe--;
// move all items down one, removing the last one if necessary
for(int v=RECENT_XBE_SIZE-1;v>0;v--)
{
if(m_szRecentXbe[v-1] == 0)
m_szRecentXbe[v] = 0;
else
{
if(m_szRecentXbe[v] == 0)
m_szRecentXbe[v] = (char*)calloc(1, 260);
strncpy(m_szRecentXbe[v], m_szRecentXbe[v-1], 259);
}
}
// add new item as first index
{
if(m_szRecentXbe[0] == 0)
m_szRecentXbe[0] = (char*)calloc(1, 260);
strcpy(m_szRecentXbe[0], m_XbeFilename);
}
if(m_dwRecentXbe < RECENT_XBE_SIZE)
m_dwRecentXbe++;
}
UpdateRecentFiles();
@ -1620,39 +1646,54 @@ void WndMain::ImportExe(const char *x_filename)
// ******************************************************************
// * save this Exe to the list of recent files
// ******************************************************************
if(m_ExeFilename[0] != '\0')
{
bool exists = false;
bool found = false;
// check if this filename already exists
for(int c=0;c<m_dwRecentExe;c++)
if(strcmp(m_szRecentExe[c], x_filename) == 0)
exists = true;
if(!exists)
// if this filename already exists, temporarily remove it
for(int c=0, r=0;c<m_dwRecentExe;c++, r++)
{
// move all items down one, removing the last one if necessary
for(int v=RECENT_EXE_SIZE;v>0;v--)
if(strcmp(m_szRecentExe[c], m_ExeFilename) == 0)
{
if(m_szRecentExe[v-1] == 0)
m_szRecentExe[v] = 0;
else
{
if(m_szRecentExe[v] == 0)
m_szRecentExe[v] = (char*)calloc(1, 260);
strncpy(m_szRecentExe[v], m_szRecentExe[v-1], 259);
}
found = true;
r++;
}
// add new item as first index
if(r != c)
{
if(m_szRecentExe[0] == 0)
m_szRecentExe[0] = (char*)calloc(1, 260);
strcpy(m_szRecentExe[0], x_filename);
m_dwRecentExe++;
if(m_szRecentExe[r] == 0 || r > m_dwRecentExe - 1)
m_szRecentExe[c] = 0;
else
strncpy(m_szRecentExe[c], m_szRecentExe[r], 259);
}
}
if(found)
m_dwRecentExe--;
// move all items down one, removing the last one if necessary
for(int v=RECENT_EXE_SIZE-1;v>0;v--)
{
if(m_szRecentExe[v-1] == 0)
m_szRecentExe[v] = 0;
else
{
if(m_szRecentExe[v] == 0)
m_szRecentExe[v] = (char*)calloc(1, 260);
strncpy(m_szRecentExe[v], m_szRecentExe[v-1], 259);
}
}
// add new item as first index
{
if(m_szRecentExe[0] == 0)
m_szRecentExe[0] = (char*)calloc(1, 260);
strcpy(m_szRecentExe[0], m_ExeFilename);
}
if(m_dwRecentExe < RECENT_EXE_SIZE)
m_dwRecentExe++;
}
UpdateRecentFiles();

View File

@ -259,7 +259,8 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit(uint32 TlsAdjust, Xbe::LibraryVersion
// ******************************************************************
extern "C" CXBXKRNL_API void NTAPI EmuPanic()
{
EmuSwapFS(); // Win2k/XP FS
if(EmuIsXboxFS())
EmuSwapFS(); // Win2k/XP FS
printf("Emu (0x%.08X): EmuPanic()\n", GetCurrentThreadId());
@ -269,6 +270,9 @@ extern "C" CXBXKRNL_API void NTAPI EmuPanic()
#else
MessageBox(NULL, "Kernel Panic! Process will now terminate.", "CxbxKrnl", MB_OK | MB_ICONEXCLAMATION);
#endif
ExitProcess(1);
EmuSwapFS(); // XBox FS
}

View File

@ -48,6 +48,9 @@ namespace xboxkrnl
#undef FIELD_OFFSET // prevent macro redefinition warnings
#include <windows.h>
static uint16 g_NewFS = -1;
static uint16 g_OrgFS = -1;
// ******************************************************************
// * func: EmuInitFS
// ******************************************************************
@ -64,9 +67,6 @@ void EmuGenerateFS(int TlsAdjust)
NT_TIB *OrgNtTib;
xboxkrnl::KPCR *NewPcr;
uint16 NewFS=0;
uint16 OrgFS=0;
void *TLSPtr = 0;
// ******************************************************************
@ -79,7 +79,7 @@ void EmuGenerateFS(int TlsAdjust)
memset(NewPcr, 0, sizeof(*NewPcr));
NewFS = EmuAllocateLDT((uint32)NewPcr, (uint32)NewPcr + dwSize);
g_NewFS = EmuAllocateLDT((uint32)NewPcr, (uint32)NewPcr + dwSize);
}
// ******************************************************************
@ -89,14 +89,14 @@ void EmuGenerateFS(int TlsAdjust)
{
// Obtain "OrgFS"
mov ax, fs
mov OrgFS, ax
mov g_OrgFS, ax
// Obtain "OrgNtTib"
mov eax, fs:[0x18]
mov OrgNtTib, eax
// Save "NewFS" inside OrgFS.ArbitraryUserPointer
mov ax, NewFS
mov ax, g_NewFS
mov fs:[0x14], ax
}
@ -133,35 +133,7 @@ void EmuGenerateFS(int TlsAdjust)
NewPcr->PrcbData.CurrentThread->TlsData = TLSPtr;
}
/*
Data Start Address : 0x00000000
Data End Address : 0x00000000
TLS Index Address : 0x00030DC4
TLS Callback Address : 0x00000000
Size of Zero Fill : 0x0000000C -> 12
Characteristics : 0x00000000 -> 16
Data Start Address : 0x00010494 |
Data End Address : 0x000104A0 |-> 12
TLS Index Address : 0x00030D5C
TLS Callback Address : 0x00000000
Size of Zero Fill : 0x00000008 -> 8
Characteristics : 0x00000000 -> 26
Data Start Address : 0x00010494 |
Data End Address : 0x000104A4 |-> 16
TLS Index Address : 0x00030D5C
TLS Callback Address : 0x00000000
Size of Zero Fill : 0x00000008 -> 8
Characteristics : 0x00000000 -> 36
Data Start Address : 0x00010494 |
Data End Address : 0x000104A8 |-> 20
TLS Index Address : 0x00030D5C
TLS Callback Address : 0x00000000
Size of Zero Fill : 0x00000008 -> 8
Characteristics : 0x00000000 -> 52
*/
// ******************************************************************
// * Swap into the "NewFS"
// ******************************************************************
@ -172,7 +144,7 @@ Characteristics : 0x00000000 -> 52
// ******************************************************************
__asm
{
mov ax, OrgFS
mov ax, g_OrgFS
mov fs:[0x14], ax // NewFS.ArbitraryUserPointer
}
@ -189,4 +161,20 @@ Characteristics : 0x00000000 -> 52
// * Swap back into the "OrgFS"
// ******************************************************************
EmuSwapFS();
}
// ******************************************************************
// * func: EmuIsXboxFS
// ******************************************************************
bool EmuIsXboxFS()
{
uint16 chk = 0;
__asm
{
mov ax, fs:[0x04]
mov chk, ax
}
return (g_NewFS == chk);
}

View File

@ -36,3 +36,91 @@
#include "EmuFile.h"
// Array of EmuHandles in the system
EmuHandle EmuHandle::Handles[EMU_MAX_HANDLES];
// Pointer to first free handle in array, or NULL if none
volatile EmuHandle *EmuHandle::FirstFree;
// Pointer to last free handle in array, or NULL if none
volatile EmuHandle *EmuHandle::LastFree;
// Lock on the handle system
CRITICAL_SECTION EmuHandle::HandleLock;
// ******************************************************************
// * Initialize the handle database
// ******************************************************************
bool EmuHandle::Initialize()
{
size_t x;
// Initialize the critical section
InitializeCriticalSection(&HandleLock);
// Mark all handles as free. We also set up the linked list of
// free handles here.
for (x = 0; x < EMU_MAX_HANDLES; x++)
{
Handles[x].m_Type = EMUHANDLE_TYPE_EMPTY;
Handles[x].m_NextFree = &Handles[x + 1];
}
// The last entry should have a NULL next entry
Handles[EMU_MAX_HANDLES - 1].m_NextFree = NULL;
// Set up the head and tail pointers
FirstFree = &Handles[0];
LastFree = &Handles[EMU_MAX_HANDLES];
return true;
}
// ******************************************************************
// * func: EmuHandle::Lock
// * Locks the handle database
// ******************************************************************
inline void EmuHandle::Lock(void)
{
EnterCriticalSection(&HandleLock);
}
// ******************************************************************
// * func: EmuHandle::Unlock
// * Unlocks the handle database
// ******************************************************************
inline void EmuHandle::Unlock(void)
{
LeaveCriticalSection(&HandleLock);
}
// ******************************************************************
// * func: EmuHandle::Allocate
// * Allocates a new handle
// ******************************************************************
EmuHandle volatile *EmuHandle::Allocate(void)
{
volatile EmuHandle *Handle;
// Lock the database
Lock();
// Get the first free entry
Handle = FirstFree;
// Remove it from the list
FirstFree = Handle->m_NextFree;
// If it was the last handle, clear LastFree
if (!Handle->m_NextFree)
LastFree = NULL;
// Initialize the handle's fields
Handle->m_Type = EMUHANDLE_TYPE_ALLOCATED;
Handle->m_Object = NULL;
// Unlock the database
Unlock();
return Handle;
}

View File

@ -278,6 +278,9 @@ XBSYSAPI EXPORTNUM(66) NTSTATUS NTAPI xboxkrnl::IoCreateFile
NTSTATUS ret = STATUS_SUCCESS;
EmuPanic();
/* TODO: Use new handle wrapping code
// ******************************************************************
// * For now, just check for 'special' cases
// ******************************************************************
@ -288,8 +291,6 @@ XBSYSAPI EXPORTNUM(66) NTSTATUS NTAPI xboxkrnl::IoCreateFile
iEmuHandle->m_Type = EMUHANDLE_TYPE_PARTITION1;
*FileHandle = PtrToEmuHandle(iEmuHandle);
// TODO: Update IoStatusBlock if necessary
}
else if(strcmp(ObjectAttributes->ObjectName->Buffer, "\\Device\\Harddisk0\\partition1\\TDATA") == 0)
{
@ -304,16 +305,8 @@ XBSYSAPI EXPORTNUM(66) NTSTATUS NTAPI xboxkrnl::IoCreateFile
else
{
EmuPanic();
/* TODO: In the future, this will look something like...
ret = xntdll::ZwCreateFile
(
FileHandle, DesiredAccess, (xntdll::_OBJECT_ATTRIBUTES*)ObjectAttributes, (xntdll::_IO_STATUS_BLOCK *)IoStatusBlock,
(xntdll::_LARGE_INTEGER *)AllocationSize, FileAttributes, ShareAccess, Disposition,
CreateOptions, 0, 0
);
*/
}
*/
EmuSwapFS(); // Xbox FS
@ -695,6 +688,10 @@ XBSYSAPI EXPORTNUM(218) NTSTATUS NTAPI xboxkrnl::NtQueryVolumeInformationFile
}
#endif
EmuPanic();
/* TODO: Use new handle wrapping code
// ******************************************************************
// * For now, handle 'special' case
// ******************************************************************
@ -723,6 +720,7 @@ XBSYSAPI EXPORTNUM(218) NTSTATUS NTAPI xboxkrnl::NtQueryVolumeInformationFile
{
EmuPanic();
}
*/
EmuSwapFS(); // Xbox FS

View File

@ -184,7 +184,7 @@ CXBXKRNL_API void EmuShared::LoadInputConfiguration()
{
int RawData[3] = {-1, -1, 0}; // dwDevice, dwInfo, dwFlags
sprintf(szBuffer, "Component : %s", g_InputDeviceTitle[c]);
sprintf(szBuffer, "Component : %s", g_InputDeviceName[c]);
dwType = REG_BINARY; dwSize = sizeof(RawData);
RegQueryValueEx(hKey, szBuffer, NULL, &dwType, (PBYTE)&RawData[0], &dwSize);
@ -241,7 +241,7 @@ CXBXKRNL_API void EmuShared::SaveInputConfiguration()
m_InputConfig.Get((InputDeviceComponent)c, &RawData[0], &RawData[1], &RawData[2]);
sprintf(szBuffer, "Component : %s", g_InputDeviceTitle[c]);
sprintf(szBuffer, "Component : %s", g_InputDeviceName[c]);
dwType = REG_BINARY; dwSize = sizeof(RawData);
RegSetValueEx(hKey, szBuffer, 0, dwType, (PBYTE)&RawData, dwSize);

View File

@ -37,37 +37,26 @@
#include <string.h>
#include <stdio.h>
const char *g_InputDeviceTitle[INPUT_DEVICE_COMPONENT_COUNT]=
// ******************************************************************
// * Input Device Name Lookup Table
// ******************************************************************
const char *g_InputDeviceName[INPUT_DEVICE_COMPONENT_COUNT]=
{
// ******************************************************************
// * Analog Axis
// ******************************************************************
"LThumbX",
"LThumbY",
"RThumbX",
"RThumbY",
"LThumbX", "LThumbY", "RThumbX", "RThumbY",
// ******************************************************************
// * Analog Buttons
// ******************************************************************
"X",
"Y",
"A",
"B",
"White",
"Black",
"LTrigger",
"RTrigger",
"X", "Y", "A", "B", "White", "Black", "LTrigger", "RTrigger",
// ******************************************************************
// * Digital Buttons
// ******************************************************************
"DPadUp",
"DPadDown",
"DPadLeft",
"DPadRight",
"Back",
"Start",
"LThumb",
"RThumb",
"DPadUp", "DPadDown", "DPadLeft", "DPadRight",
"Back", "Start", "LThumb", "RThumb",
};
// ******************************************************************

View File

@ -53,7 +53,7 @@ void Mutex::Lock()
{
// Grab the lock, letting us look at the variables
// while(InterlockedCompareExchange((LPVOID*)&m_MutexLock, (LPVOID)1, (LPVOID)0))
while(InterlockedCompareExchange((LPLONG volatile)&m_MutexLock, (LONG)1, (LONG)0))
while(InterlockedCompareExchange((LPLONG)&m_MutexLock, (LONG)1, (LONG)0))
Sleep(1);
// Are we the the new owner?
@ -100,7 +100,7 @@ void Mutex::Unlock()
{
// Grab the lock, letting us look at the variables
// while(InterlockedCompareExchange((LPVOID*)&m_MutexLock, (LPVOID)1, (LPVOID)0))
while (InterlockedCompareExchange((LPLONG volatile)&m_MutexLock, (LONG)1, (LONG)0))
while (InterlockedCompareExchange((LPLONG)&m_MutexLock, (LONG)1, (LONG)0))
Sleep(1);
// Decrement the lock count