Implement Workaround Fix for missing DSound Library

The workaround will fix DSound 4039 build. It will also fix any other
missing DSound library section as well. In HLEDB v2, the scan method
will check for DSOUND header section. If it doesn't have it, then DSound
DB will be skip.
This commit is contained in:
RadWolfie 2017-09-02 09:41:22 -05:00 committed by Luke Usher
parent 5f38195dfd
commit 22ca5b38d4
1 changed files with 18 additions and 2 deletions

View File

@ -288,11 +288,22 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
LastUnResolvedXRefs = UnResolvedXRefs;
bool bDSoundLibSection = false;
uint16 preserveVersion = 0;
for(uint32 v=0;v<dwLibraryVersions;v++)
{
uint16 BuildVersion = pLibraryVersion[v].wBuildVersion;
uint16 OrigBuildVersion = BuildVersion;
if (preserveVersion < BuildVersion) {
preserveVersion = BuildVersion;
}
std::string LibraryName(pLibraryVersion[v].szName, pLibraryVersion[v].szName + 8);
reProcessScan:
// Aliases - for testing purposes only
// TODO: Remove these and come up with a better way to handle XDKs we don't hve databases for
if(BuildVersion == 4039) { BuildVersion = 4034; }
@ -307,8 +318,6 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
if(BuildVersion == 5659) { BuildVersion = 5558; }
if(BuildVersion == 5120) { BuildVersion = 5233; }
if(BuildVersion == 5933) { BuildVersion = 5849; } // These XDK versions are pretty much the same
std::string LibraryName(pLibraryVersion[v].szName, pLibraryVersion[v].szName + 8);
Xbe::SectionHeader* pSectionHeaders = reinterpret_cast<Xbe::SectionHeader*>(pXbeHeader->dwSectionHeadersAddr);
Xbe::SectionHeader* pSectionScan = nullptr;
@ -337,6 +346,7 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
}
if (strcmp(LibraryName.c_str(), Lib_DSOUND) == 0)
{
bDSoundLibSection = true;
// Skip scanning for DSOUND symbols when LLE APU is selected
if (bLLE_APU)
continue;
@ -601,6 +611,12 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
}
if (g_bPrintfOn && notFoundHLEDB) printf("Skipped\n");
if (v == dwLibraryVersions - 1 && bDSoundLibSection == false) {
LibraryName = Lib_DSOUND;
OrigBuildVersion = BuildVersion = preserveVersion;
goto reProcessScan;
}
}
bXRefFirstPass = false;