This commit is contained in:
Akash Mozumdar 2018-06-15 05:51:11 -04:00
parent 5890f0022c
commit 73246f7eea
3 changed files with 40 additions and 39 deletions

View File

@ -81,13 +81,14 @@ BOOL IthIsWine()
// jichi 9/28/2013: prevent parallelization in wine // jichi 9/28/2013: prevent parallelization in wine
void IthCoolDown() void IthCoolDown()
{ {
return;
// http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/Thread/NtDelayExecution.html // http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/Thread/NtDelayExecution.html
//const LONGLONG timeout = -10000; // in 100ns, i.e. 1ms //const LONGLONG timeout = -10000; // in 100ns, i.e. 1ms
//NtDelayExecution(FALSE, (PLARGE_INTEGER)&timeout); //NtDelayExecution(FALSE, (PLARGE_INTEGER)&timeout);
//NtFlushInstructionCache(NtCurrentProcess(), (LPVOID)hp.addr, hp.recover_len); //NtFlushInstructionCache(NtCurrentProcess(), (LPVOID)hp.addr, hp.recover_len);
// Flush the instruction cache line, and prevent wine from rending things in parallel // Flush the instruction cache line, and prevent wine from rending things in parallel
if (IthIsWine()) //if (IthIsWine())
IthSleep(1); // sleep for 1 ms // IthSleep(1); // sleep for 1 ms
//__asm //__asm
//{ //{
// //mov eax,0x2710 // = 10000 // //mov eax,0x2710 // = 10000

View File

@ -17,7 +17,6 @@ int FillRange(LPCWSTR name,DWORD *lower, DWORD *upper);
DWORD SearchPattern(DWORD base, DWORD base_length, LPCVOID search, DWORD search_length); // KMP DWORD SearchPattern(DWORD base, DWORD base_length, LPCVOID search, DWORD search_length); // KMP
DWORD IthGetMemoryRange(LPCVOID mem, DWORD *base, DWORD *size); DWORD IthGetMemoryRange(LPCVOID mem, DWORD *base, DWORD *size);
BOOL IthGetFileInfo(LPCWSTR file, LPVOID info, DWORD size = 0x1000);
DWORD GetExportAddress(DWORD hModule,DWORD hash); DWORD GetExportAddress(DWORD hModule,DWORD hash);
} // extern "C" } // extern "C"

View File

@ -544,41 +544,42 @@ bool DetermineEngineOther()
} }
// jichi 8/24/2013: Move into functions // jichi 8/24/2013: Move into functions
static BYTE static_file_info[0x1000]; // Artikash 6/15/2018: Removed this detection for Abel Software games. IthGetFileInfo no longer works correctly
if (IthGetFileInfo(L"*01", static_file_info)) //static BYTE static_file_info[0x1000];
if (*(DWORD*)static_file_info == 0) { //if (IthGetFileInfo(L"*01", static_file_info))
STATUS_INFO_LENGTH_MISMATCH; // if (*(DWORD*)static_file_info == 0) {
static WCHAR static_search_name[MAX_PATH]; // STATUS_INFO_LENGTH_MISMATCH;
LPWSTR name=(LPWSTR)(static_file_info+0x5E); // static WCHAR static_search_name[MAX_PATH];
int len = wcslen(name); // LPWSTR name=(LPWSTR)(static_file_info+0x5E);
name[len-2] = L'.'; // int len = wcslen(name);
name[len-1] = L'e'; // name[len-2] = L'.';
name[len] = L'x'; // name[len-1] = L'e';
name[len+1] = L'e'; // name[len] = L'x';
name[len+2] = 0; // name[len+1] = L'e';
if (Util::CheckFile(name)) { // name[len+2] = 0;
sizeof(FILE_BOTH_DIR_INFORMATION); // if (Util::CheckFile(name)) {
name[len-2] = L'*'; // sizeof(FILE_BOTH_DIR_INFORMATION);
name[len-1] = 0; // name[len-2] = L'*';
wcscpy(static_search_name,name); // name[len-1] = 0;
IthGetFileInfo(static_search_name,static_file_info); // wcscpy(static_search_name,name);
union { // IthGetFileInfo(static_search_name,static_file_info);
FILE_BOTH_DIR_INFORMATION *both_info; // union {
DWORD addr; // FILE_BOTH_DIR_INFORMATION *both_info;
}; // DWORD addr;
both_info = (FILE_BOTH_DIR_INFORMATION *)static_file_info; // };
//BYTE* ptr=static_file_info; // both_info = (FILE_BOTH_DIR_INFORMATION *)static_file_info;
len=0; // //BYTE* ptr=static_file_info;
while (both_info->NextEntryOffset) { // len=0;
addr += both_info->NextEntryOffset; // while (both_info->NextEntryOffset) {
len++; // addr += both_info->NextEntryOffset;
} // len++;
if (len > 3) { // }
InsertAbelHook(); // if (len > 3) {
return true; // InsertAbelHook();
} // return true;
} // }
} // }
// }
return false; return false;
} }
@ -589,7 +590,7 @@ bool DetermineEngineAtLast()
{ {
if (Util::CheckFile(L"MovieTexture.dll") && (InsertPensilHook() || Insert2RMHook())) // MovieTexture.dll also exists in 2RM games such as 母子愛2体験版, which is checked first if (Util::CheckFile(L"MovieTexture.dll") && (InsertPensilHook() || Insert2RMHook())) // MovieTexture.dll also exists in 2RM games such as 母子愛2体験版, which is checked first
return true; return true;
if (Util::CheckFile(L"system") && Util::CheckFile(L"system.dat")) { // jichi 7/31/2015 if ((Util::CheckFile(L"system") && Util::CheckFile(L"system.dat")) || Util::CheckFile(L"*01")) { // jichi 7/31/2015 & Artikash 6/15/2018
InsertAbelHook(); InsertAbelHook();
return true; return true;
} }