kernel: move ApplyMediaPatches function

This commit is contained in:
RadWolfie 2021-07-03 23:19:15 -05:00
parent 5692f79d78
commit f3dc44ebae
2 changed files with 30 additions and 30 deletions

View File

@ -120,36 +120,6 @@ ULONG g_CxbxFatalErrorCode = FATAL_ERROR_NONE;
// Define function located in EmuXApi so we can call it from here
void SetupXboxDeviceTypes();
void ApplyMediaPatches()
{
// Patch the XBE Header to allow running from all media types
g_pCertificate->dwAllowedMedia |= 0
| XBEIMAGE_MEDIA_TYPE_HARD_DISK
| XBEIMAGE_MEDIA_TYPE_DVD_X2
| XBEIMAGE_MEDIA_TYPE_DVD_CD
| XBEIMAGE_MEDIA_TYPE_CD
| XBEIMAGE_MEDIA_TYPE_DVD_5_RO
| XBEIMAGE_MEDIA_TYPE_DVD_9_RO
| XBEIMAGE_MEDIA_TYPE_DVD_5_RW
| XBEIMAGE_MEDIA_TYPE_DVD_9_RW
;
// Patch the XBE Header to allow running on all regions
g_pCertificate->dwGameRegion = 0
| XBEIMAGE_GAME_REGION_MANUFACTURING
| XBEIMAGE_GAME_REGION_NA
| XBEIMAGE_GAME_REGION_JAPAN
| XBEIMAGE_GAME_REGION_RESTOFWORLD
;
// Patch the XBE Security Flag
// This field is only present if the Xbe Size is >= than our Certificate Structure
// This works as our structure is large enough to fit the newer certificate size,
// while dwSize is the actual size of the certificate in the Xbe.
// Source: Various Hacked Kernels
if (g_pCertificate->dwSize >= sizeof(Xbe::Certificate)) {
g_pCertificate->dwSecurityFlags &= ~1;
}
}
void SetupPerTitleKeys()
{
// Generate per-title keys from the XBE Certificate

View File

@ -44,3 +44,33 @@ static void CxbxrKrnlSetupDummyHeader() {
strncpy_s((PSTR)DummyKernel->SectionHeader.Name, 8, "DONGS", 8);
EmuLogInit(LOG_LEVEL::INFO, "Initialized dummy kernel image header.");
}
static void ApplyMediaPatches()
{
// Patch the XBE Header to allow running from all media types
g_pCertificate->dwAllowedMedia |= 0
| XBEIMAGE_MEDIA_TYPE_HARD_DISK
| XBEIMAGE_MEDIA_TYPE_DVD_X2
| XBEIMAGE_MEDIA_TYPE_DVD_CD
| XBEIMAGE_MEDIA_TYPE_CD
| XBEIMAGE_MEDIA_TYPE_DVD_5_RO
| XBEIMAGE_MEDIA_TYPE_DVD_9_RO
| XBEIMAGE_MEDIA_TYPE_DVD_5_RW
| XBEIMAGE_MEDIA_TYPE_DVD_9_RW
;
// Patch the XBE Header to allow running on all regions
g_pCertificate->dwGameRegion = 0
| XBEIMAGE_GAME_REGION_MANUFACTURING
| XBEIMAGE_GAME_REGION_NA
| XBEIMAGE_GAME_REGION_JAPAN
| XBEIMAGE_GAME_REGION_RESTOFWORLD
;
// Patch the XBE Security Flag
// This field is only present if the Xbe Size is >= than our Certificate Structure
// This works as our structure is large enough to fit the newer certificate size,
// while dwSize is the actual size of the certificate in the Xbe.
// Source: Various Hacked Kernels
if (g_pCertificate->dwSize >= sizeof(Xbe::Certificate)) {
g_pCertificate->dwSecurityFlags &= ~1;
}
}