Merge pull request #1281 from RadWolfie/check-hle-cache-file-for-lle-stat
Temporary check HLE cache file for LLE flags used.
This commit is contained in:
commit
c2b4162a9b
|
@ -1320,7 +1320,6 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
case ID_EMULATION_LLE_JIT:
|
case ID_EMULATION_LLE_JIT:
|
||||||
{
|
{
|
||||||
m_FlagsLLE = m_FlagsLLE ^ LLE_JIT;
|
m_FlagsLLE = m_FlagsLLE ^ LLE_JIT;
|
||||||
ClearHLECache();
|
|
||||||
RefreshMenus();
|
RefreshMenus();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1328,7 +1327,6 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
case ID_EMULATION_LLE_APU:
|
case ID_EMULATION_LLE_APU:
|
||||||
{
|
{
|
||||||
m_FlagsLLE = m_FlagsLLE ^ LLE_APU;
|
m_FlagsLLE = m_FlagsLLE ^ LLE_APU;
|
||||||
ClearHLECache();
|
|
||||||
RefreshMenus();
|
RefreshMenus();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1336,7 +1334,6 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
case ID_EMULATION_LLE_GPU:
|
case ID_EMULATION_LLE_GPU:
|
||||||
{
|
{
|
||||||
m_FlagsLLE = m_FlagsLLE ^ LLE_GPU;
|
m_FlagsLLE = m_FlagsLLE ^ LLE_GPU;
|
||||||
ClearHLECache();
|
|
||||||
RefreshMenus();
|
RefreshMenus();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -350,6 +350,9 @@ void EmuUpdateLLEStatus(uint32_t XbLibScan)
|
||||||
// NOTE: EmuHLEIntercept do not get to be in XbSymbolDatabase, do the intecept in Cxbx project only.
|
// NOTE: EmuHLEIntercept do not get to be in XbSymbolDatabase, do the intecept in Cxbx project only.
|
||||||
void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||||
{
|
{
|
||||||
|
// NOTE: Increase this revision number any time we changed something inside Cxbx-Reloaded.
|
||||||
|
int revisionCache = 4;
|
||||||
|
|
||||||
Xbe::LibraryVersion *pLibraryVersion = (Xbe::LibraryVersion*)pXbeHeader->dwLibraryVersionsAddr;
|
Xbe::LibraryVersion *pLibraryVersion = (Xbe::LibraryVersion*)pXbeHeader->dwLibraryVersionsAddr;
|
||||||
|
|
||||||
uint16 xdkVersion = 0;
|
uint16 xdkVersion = 0;
|
||||||
|
@ -383,6 +386,8 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||||
}
|
}
|
||||||
|
|
||||||
EmuUpdateLLEStatus(XbLibScan);
|
EmuUpdateLLEStatus(XbLibScan);
|
||||||
|
int gFlagsLLE;
|
||||||
|
g_EmuShared->GetFlagsLLE(&gFlagsLLE);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("*******************************************************************************\n");
|
printf("*******************************************************************************\n");
|
||||||
|
@ -422,7 +427,19 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||||
if (HLECacheHash == XbSymbolLibraryVersion()) {
|
if (HLECacheHash == XbSymbolLibraryVersion()) {
|
||||||
char buffer[SHRT_MAX] = { 0 };
|
char buffer[SHRT_MAX] = { 0 };
|
||||||
char* bufferPtr = buffer;
|
char* bufferPtr = buffer;
|
||||||
|
g_HLECacheUsed = true;
|
||||||
|
|
||||||
|
const uint32 cacheRevision = GetPrivateProfileInt("Info", "revision", 0, filename.c_str());
|
||||||
|
const uint32 cacheFlagsLLE = GetPrivateProfileInt("Info", "FlagsLLE", 0, filename.c_str());
|
||||||
|
|
||||||
|
if (cacheFlagsLLE != gFlagsLLE) {
|
||||||
|
g_HLECacheUsed = false;
|
||||||
|
}
|
||||||
|
else if (cacheRevision != revisionCache) {
|
||||||
|
g_HLECacheUsed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_HLECacheUsed) {
|
||||||
printf("Using HLE Cache\n");
|
printf("Using HLE Cache\n");
|
||||||
|
|
||||||
GetPrivateProfileSection("Symbols", buffer, sizeof(buffer), filename.c_str());
|
GetPrivateProfileSection("Symbols", buffer, sizeof(buffer), filename.c_str());
|
||||||
|
@ -449,30 +466,21 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||||
output << "HLECache: 0x" << std::setfill('0') << std::setw(8) << std::hex << location
|
output << "HLECache: 0x" << std::setfill('0') << std::setw(8) << std::hex << location
|
||||||
<< " -> " << functionName;
|
<< " -> " << functionName;
|
||||||
void* pFunc = GetEmuPatchAddr(functionName);
|
void* pFunc = GetEmuPatchAddr(functionName);
|
||||||
if (pFunc != nullptr)
|
if (pFunc != nullptr) {
|
||||||
{
|
|
||||||
// skip entries that weren't located at all
|
// skip entries that weren't located at all
|
||||||
if (location == NULL)
|
if (location == NULL) {
|
||||||
{
|
|
||||||
output << "\t(not patched)";
|
output << "\t(not patched)";
|
||||||
}
|
}
|
||||||
// Prevent patching illegal addresses
|
// Prevent patching illegal addresses
|
||||||
else if (location < XBE_IMAGE_BASE)
|
else if (location < XBE_IMAGE_BASE) {
|
||||||
{
|
|
||||||
output << "\t*ADDRESS TOO LOW!*";
|
output << "\t*ADDRESS TOO LOW!*";
|
||||||
}
|
} else if (location > g_SystemMaxMemory) {
|
||||||
else if (location > g_SystemMaxMemory)
|
|
||||||
{
|
|
||||||
output << "\t*ADDRESS TOO HIGH!*";
|
output << "\t*ADDRESS TOO HIGH!*";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
EmuInstallPatch(functionName, location, pFunc);
|
EmuInstallPatch(functionName, location, pFunc);
|
||||||
output << "\t*PATCHED*";
|
output << "\t*PATCHED*";
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (location != NULL)
|
if (location != NULL)
|
||||||
output << "\t(no patch)";
|
output << "\t(no patch)";
|
||||||
}
|
}
|
||||||
|
@ -498,8 +506,7 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||||
}
|
}
|
||||||
|
|
||||||
EmuD3D_Init_DeferredStates();
|
EmuD3D_Init_DeferredStates();
|
||||||
|
}
|
||||||
g_HLECacheUsed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If g_SymbolAddresses didn't get filled, the HLE cache is invalid
|
// If g_SymbolAddresses didn't get filled, the HLE cache is invalid
|
||||||
|
@ -572,6 +579,15 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||||
WritePrivateProfileString("Info", "HLECacheHash", HLECacheHashString.c_str(), filename.c_str());
|
WritePrivateProfileString("Info", "HLECacheHash", HLECacheHashString.c_str(), filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::stringstream revision;
|
||||||
|
revision << std::dec << revisionCache;
|
||||||
|
WritePrivateProfileString("Info", "revision", revision.str().c_str(), filename.c_str());
|
||||||
|
|
||||||
|
std::stringstream flagsLLE;
|
||||||
|
flagsLLE << std::dec << gFlagsLLE;
|
||||||
|
WritePrivateProfileString("Info", "FlagsLLE", flagsLLE.str().c_str(), filename.c_str());
|
||||||
|
|
||||||
// Write the Certificate Details to the cache file
|
// Write the Certificate Details to the cache file
|
||||||
WritePrivateProfileString("Certificate", "Name", tAsciiTitle, filename.c_str());
|
WritePrivateProfileString("Certificate", "Name", tAsciiTitle, filename.c_str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue