Some cleanup

This commit is contained in:
Luke Usher 2016-08-20 13:49:19 +01:00
parent ac832097a9
commit 71a059104b
8 changed files with 11 additions and 297 deletions

View File

@ -292,7 +292,9 @@ void EmuInitFS()
continue;
}
DbgPrintf("Searching for FS Instruction in section %s\n", CxbxKrnl_Exe->m_SectionHeader[sectionIndex].m_name);
std::string sectionName(CxbxKrnl_Exe->m_SectionHeader[sectionIndex].m_name, 8);
DbgPrintf("Searching for FS Instruction in section %s\n", sectionName.c_str());
uint32_t startAddr = CxbxKrnl_Exe->m_SectionHeader[sectionIndex].m_virtual_addr + CxbxKrnl_XbeHeader->dwBaseAddr;
for (uint32 addr = startAddr; addr < startAddr + CxbxKrnl_Exe->m_SectionHeader[sectionIndex].m_sizeof_raw; addr++)
{

View File

@ -1266,7 +1266,7 @@ NTSTATUS CxbxObjectAttributesToNT(xboxkrnl::POBJECT_ATTRIBUTES ObjectAttributes,
DbgPrintf("EmuKrnl : %s Corrected path..\n.", aFileAPIName.c_str());
DbgPrintf(" Org:\"%s\"\n", OriginalPath.c_str());
if (NativePath.compare(CxbxBasePath) == 0)
if (NativePath.compare(0, CxbxBasePath.length(), CxbxBasePath) == 0)
{
DbgPrintf(" New:\"$CxbxPath\\EmuDisk%s%s\"\n", (NativePath.substr(CxbxBasePath.length(), std::string::npos)).c_str(), RelativePath.c_str());
}
@ -1438,7 +1438,9 @@ XBSYSAPI EXPORTNUM(9) VOID NTAPI xboxkrnl::HalReadSMCTrayState
// TODO: Make this configurable?
// TODO: What is the count parameter for??
*State = TRAY_CLOSED_NO_MEDIA;
// Pretent the tray is closed and media is present
// If we report TRAY_CLOSED_NO_MEDIA, dashboard will attempt DeviceIoControl
*State = TRAY_CLOSED_MEDIA_PRESENT;
// *Count = 1;
EmuSwapFS(); // Xbox FS

View File

@ -88,21 +88,6 @@ XFIBER g_Fibers[256];
// Number of fiber routines queued
int g_FiberCount = 0;
// ******************************************************************
// * func: EmuXapiApplyKernelPatches
// ******************************************************************
VOID WINAPI XTL::EmuXapiApplyKernelPatches()
{
#ifdef _DEBUG_TRACE
EmuSwapFS(); // Win2k/XP FS
DbgPrintf("EmuXapi (0x%X): EmuXapiApplyKernelPatches()\n", GetCurrentThreadId());
EmuSwapFS(); // XBox FS
#endif
// we dont really feel like patching, now do we?
return;
}
// ******************************************************************
// * func: EmuXFormatUtilityDrive
@ -1096,28 +1081,10 @@ LPVOID WINAPI XTL::EmuXLoadSectionA
");\n",
GetCurrentThreadId(), pSectionName, pSectionName );
// TODO: Search this .xbe for the section it wants to load.
// If we find it, return the address of it.
LPVOID pRet = NULL;
// Xbox Dashboard (3944)
if(strcmp("XIPS", pSectionName)==0)
pRet = (void*) 0x13B500;
// Blade II NTSC
else if(!strcmp(pSectionName, "DSPImage"))
pRet = (void*) 0x41F900;
// Zapper (NTSC)
// else if(!strcmp(pSectionName, "sig"))
// pRet = (void*) 0x41F900;
else
{
EmuWarning( "Section %s not found!", pSectionName );
// __asm int 3;
}
EmuWarning("Redirecting EmuXLoadSectionA to EmuXGetSectionHandleA\n");
LPVOID pRet = EmuXGetSectionHandleA(pSectionName);
EmuSwapFS(); // Xbox FS
return pRet;
@ -1167,7 +1134,7 @@ HANDLE WINAPI XTL::EmuXGetSectionHandleA
// Iterate thrugh sections
for (int i = 0; i < CxbxKrnl_Exe->m_Header.m_sections; i++) {
if (!strcmp(pSectionName, CxbxKrnl_Exe->m_SectionHeader[i].m_name)) {
if (!strncmp(pSectionName, CxbxKrnl_Exe->m_SectionHeader[i].m_name, 8)) {
pRet = (void*)CxbxKrnl_Exe->m_SectionHeader[i].m_virtual_addr;
break;
}

View File

@ -325,11 +325,6 @@ LAUNCH_DATA, *PLAUNCH_DATA;
#define XDEVICE_ENUMERATION_IDLE 0
#define XDEVICE_ENUMERATION_BUSY 1
// ******************************************************************
// * func: EmuXapiApplyKernelPatches
// ******************************************************************
VOID WINAPI EmuXapiApplyKernelPatches();
// ******************************************************************
// * func: EmuXFormatUtilityDrive
// ******************************************************************

View File

@ -32,110 +32,6 @@
// *
// ******************************************************************
// NOTE: This function actually came in with 4831, not 4928!
// ******************************************************************
// * XapiApplyKernelPatches
// ******************************************************************
SOOVPA<7> XapiApplyKernelPatches_1_0_4928 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x17, 0x81 },
{ 0x2A, 0x81 },
{ 0x4B, 0x05 },
{ 0x5F, 0x1B },
{ 0x7C, 0xFF },
{ 0x88, 0x6A },
{ 0x92, 0xC7 },
}
};
// NOTE: This function actually came in with 4928
// ******************************************************************
// * XapiInitProcess
// ******************************************************************
SOOVPA<7> XapiInitProcess_1_0_4928 =
{
0, // Large == 0
7, // Count == 7
-1, // XRef Not Saved
0, // XRef Not Used
{
{ 0x22, 0xC7 }, // (Offset,Value)-Pair #1
{ 0x23, 0x45 }, // (Offset,Value)-Pair #2
{ 0x24, 0xCC }, // (Offset,Value)-Pair #3
{ 0x25, 0x30 }, // (Offset,Value)-Pair #4
{ 0x4A, 0xA1 }, // (Offset,Value)-Pair #5
{ 0x4B, 0x18 }, // (Offset,Value)-Pair #6
{ 0x4C, 0x01 }, // (Offset,Value)-Pair #7
}
};
// ******************************************************************
// * XapiInitProcess
// ******************************************************************
SOOVPA<7> XapiInitProcess_1_0_4831 =
{
0, // Large == 0
7, // Count == 7
-1, // XRef Not Saved
0, // XRef Not Used
{
// XapiInitProcess+0x03 : sub esp, 0x34
{ 0x05, 0x34 }, // (Offset,Value)-Pair #1
// XapiInitProcess+0x13 : push 0x0C
{ 0x13, 0x6A }, // (Offset,Value)-Pair #2
{ 0x14, 0x0C }, // (Offset,Value)-Pair #3
// XapiInitProcess+0x2A : repe stosd
{ 0x1B, 0xF3 }, // (Offset,Value)-Pair #4
{ 0x1C, 0xAB }, // (Offset,Value)-Pair #5
// XapiInitProcess+0x55 : jz +0x0B
{ 0x48, 0x74 }, // (Offset,Value)-Pair #6
{ 0x49, 0x4A }, // (Offset,Value)-Pair #7
}
};
// ******************************************************************
// * XapiInitProcess
// ******************************************************************
SOOVPA<7> XapiInitProcess_1_0_5028 =
{
0, // Large == 0
7, // Count == 7
-1, // XRef Not Saved
0, // XRef Not Used
{
// XapiInitProcess+0x03 : sub esp, 0x34
{ 0x05, 0x34 }, // (Offset,Value)-Pair #1
// XapiInitProcess+0x22 : push 0x0C
{ 0x22, 0x6A }, // (Offset,Value)-Pair #2
{ 0x23, 0x0C }, // (Offset,Value)-Pair #3
// XapiInitProcess+0x2A : repe stosd
{ 0x2A, 0xF3 }, // (Offset,Value)-Pair #4
{ 0x2B, 0xAB }, // (Offset,Value)-Pair #5
// XapiInitProcess+0x55 : jz +0x0B
{ 0x55, 0x74 }, // (Offset,Value)-Pair #6
{ 0x56, 0x5F }, // (Offset,Value)-Pair #7
}
};
// ******************************************************************
// * XFormatUtilityDrive
// ******************************************************************
@ -595,31 +491,6 @@ SOOVPA<12> XInputGetCapabilities6_1_0_4928 =
}
};
// Blueshogun96 11/27/08
// This function actually began in 4831 XDKs. Since 4831 is a
// rare XDK, I'm assuming no one paid much attention to it.
// ******************************************************************
// * XapiApplyKernelPatches
// ******************************************************************
SOOVPA<7> XapiApplyKernelPatches_1_0_4831 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x17, 0x81 },
{ 0x2A, 0x81 },
{ 0x4B, 0x05 },
{ 0x64, 0x1B },
{ 0x94, 0xFF },
{ 0x96, 0xFA },
{ 0xA2, 0xFF },
}
};
// ******************************************************************
// * XInputGetCapabilities
// ******************************************************************
@ -1225,16 +1096,6 @@ SOOVPA<9> XInputGetDeviceDescription_1_0_4831 =
// ******************************************************************
OOVPATable XAPI_1_0_4627[] =
{
// XapiApplyKernelPatches
{
(OOVPA*)&XapiApplyKernelPatches_1_0_4928,
XTL::EmuXapiApplyKernelPatches,
#ifdef _DEBUG_TRACE
"EmuXapiApplyKernelPatches"
#endif
},
// XFormatUtilityDrive
{
(OOVPA*)&XFormatUtilityDrive_1_0_4627,
@ -1503,16 +1364,6 @@ OOVPATable XAPI_1_0_4627[] =
#ifdef _DEBUG_TRACE
"EmuXapiBootDash"
#endif
},
// XapiApplyKernelPatches
{
(OOVPA*)&XapiApplyKernelPatches_1_0_4831,
XTL::EmuXapiApplyKernelPatches,
#ifdef _DEBUG_TRACE
"EmuXapiApplyKernelPatches_4831"
#endif
},
// XInputGetCapabilities
{

View File

@ -32,79 +32,6 @@
// *
// ******************************************************************
// ******************************************************************
// * XapiApplyKernelPatches
// ******************************************************************
SOOVPA<7> XapiApplyKernelPatches_1_0_5233 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x17, 0x81 },
{ 0x30, 0x81 },
{ 0x49, 0x05 },
{ 0x62, 0x1B },
{ 0x7B, 0x85 },
{ 0x96, 0x6A },
{ 0xAD, 0x5F },
}
};
// ******************************************************************
// * XapiInitProcess
// ******************************************************************
SOOVPA<7> XapiInitProcess_1_0_5233 =
{
0, // Large == 0
7, // Count == 7
-1, // XRef Not Saved
0, // XRef Not Used
{
// XapiInitProcess+0x03 : sub esp, 0x34
{ 0x05, 0x34 }, // (Offset,Value)-Pair #1
// XapiInitProcess+0x22 : push 0x0C
{ 0x22, 0x6A }, // (Offset,Value)-Pair #2
{ 0x23, 0x0C }, // (Offset,Value)-Pair #3
// XapiInitProcess+0x2A : repe stosd
{ 0x2A, 0xF3 }, // (Offset,Value)-Pair #4
{ 0x2B, 0xAB }, // (Offset,Value)-Pair #5
// XapiInitProcess+0x55 : jz +0x0B
{ 0x55, 0x74 }, // (Offset,Value)-Pair #6
{ 0x56, 0x4B }, // (Offset,Value)-Pair #7
}
};
// ******************************************************************
// * XapiInitProcess
// ******************************************************************
SOOVPA<8> XapiInitProcess_1_0_5344 =
{
0, // Large == 0
8, // Count == 8
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x22, 0x6A },
{ 0x3E, 0x01 },
{ 0x5E, 0x7D },
{ 0x7E, 0x8B },
{ 0x9F, 0x68 },
{ 0xBE, 0x01 },
{ 0xDE, 0x6A },
{ 0xFE, 0x02 },
}
};
// ******************************************************************
// * XInitDevices
@ -224,16 +151,6 @@ SOOVPA<6> XGetFileCacheSize_1_0_5344 =
// ******************************************************************
OOVPATable XAPI_1_0_5233[] =
{
// XapiApplyKernelPatches
{
(OOVPA*)&XapiApplyKernelPatches_1_0_5233,
XTL::EmuXapiApplyKernelPatches,
#ifdef _DEBUG_TRACE
"EmuXapiApplyKernelPatches"
#endif
},
// GetTimeZoneInformation (* unchanged since 3911 *)
{
(OOVPA*)&GetTimeZoneInformation_1_0_3911,

View File

@ -487,16 +487,6 @@ SOOVPA<9> XInputClose_1_0_5558 =
// ******************************************************************
OOVPATable XAPI_1_0_5558[] =
{
// XapiApplyKernelPatches (* unchanged since 5233 *)
{
(OOVPA*)&XapiApplyKernelPatches_1_0_5233,
XTL::EmuXapiApplyKernelPatches,
#ifdef _DEBUG_TRACE
"EmuXapiApplyKernelPatches"
#endif
},
// SetThreadPriority (* unchanged since 3911 *)
{
(OOVPA*)&SetThreadPriority_1_0_3911,

View File

@ -211,16 +211,6 @@ SOOVPA<6> SwitchToThread_1_0_5849 =
// ******************************************************************
OOVPATable XAPI_1_0_5849[] =
{
// XapiApplyKernelPatches (* unchanged since 5233 *)
{
(OOVPA*)&XapiApplyKernelPatches_1_0_5233,
XTL::EmuXapiApplyKernelPatches,
#ifdef _DEBUG_TRACE
"EmuXapiApplyKernelPatches"
#endif
},
// SetThreadPriority (* unchanged since 3911 *)
{
(OOVPA*)&SetThreadPriority_1_0_3911,