1
0
mirror of synced 2024-11-14 23:07:36 +01:00

SFV Fixes

SFV Fixes
This commit is contained in:
Reaver 2021-06-30 00:06:59 +03:00
parent f176c0235a
commit 14e24f2983
4 changed files with 207 additions and 78 deletions

View File

@ -28,54 +28,61 @@ NesysEmu::NesysEmu()
m_commandHandlers[LCOMMAND_CONNECT_REQUEST] = [=](const uint8_t* data, size_t length)
{
SendResponse(SCOMMAND_CONNECT_REPLY, nullptr);
Sleep(100);
// h
struct __declspec(align(4)) NESYS_TENPO_TABLE
if (GameDetect::currentGame != GameID::SFV)
{
int tenpo_id;
char tenpo_name[31];
char tenpo_addr[33];
char ticket[33];
char pref_name[17];
};
SendResponse(SCOMMAND_CONNECT_REPLY, nullptr);
struct NESYS_NEWS_TABLE
Sleep(100);
// h
struct __declspec(align(4)) NESYS_TENPO_TABLE
{
int tenpo_id;
char tenpo_name[31];
char tenpo_addr[33];
char ticket[33];
char pref_name[17];
};
struct NESYS_NEWS_TABLE
{
int type;
int size;
char iFilePath[1024];
};
struct nesys_cert_init_response
{
NESYS_TENPO_TABLE tenpo;
NESYS_NEWS_TABLE news;
uint32_t serverSize;
char server[];
};
const char* wat = "card_id=7020392010281502";
nesys_cert_init_response* response = (nesys_cert_init_response*)malloc(sizeof(nesys_cert_init_response) + strlen(wat));
response->tenpo.tenpo_id = 1337;
strcpy(response->tenpo.tenpo_name, "leet");
strcpy(response->tenpo.tenpo_addr, "l33t");
strcpy(response->tenpo.ticket, "teel");
strcpy(response->tenpo.pref_name, "t33l");
response->news.type = 0;
response->news.size = strlen("./OpenParrot/news.png");
strcpy(response->news.iFilePath, "./OpenParrot/news.png");
response->serverSize = strlen(wat);
memcpy(response->server, wat, strlen(wat));
SendResponse(SCOMMAND_CERT_INIT_NOTICE, response, sizeof(nesys_cert_init_response) + strlen(wat));
free(response);
}
else
{
int type;
int size;
char iFilePath[1024];
};
struct nesys_cert_init_response
{
NESYS_TENPO_TABLE tenpo;
NESYS_NEWS_TABLE news;
uint32_t serverSize;
char server[];
};
const char* wat = "card_id=7020392010281502";
nesys_cert_init_response* response = (nesys_cert_init_response*)malloc(sizeof(nesys_cert_init_response) + strlen(wat));
response->tenpo.tenpo_id = 1337;
strcpy(response->tenpo.tenpo_name, "leet");
strcpy(response->tenpo.tenpo_addr, "l33t");
strcpy(response->tenpo.ticket, "teel");
strcpy(response->tenpo.pref_name, "t33l");
response->news.type = 0;
response->news.size = strlen("./OpenParrot/news.png");
strcpy(response->news.iFilePath, "./OpenParrot/news.png");
response->serverSize = strlen(wat);
memcpy(response->server, wat, strlen(wat));
SendResponse(SCOMMAND_CERT_INIT_NOTICE, response, sizeof(nesys_cert_init_response) + strlen(wat));
free(response);
SendResponse(SCOMMAND_CERT_ERROR, nullptr);
}
};
m_commandHandlers[LCOMMAND_DISCONNECT_REQUEST] = [=](const uint8_t* data, size_t length)

View File

@ -8,8 +8,16 @@ DWORD IOErrorCoin = 0;
DWORD IOErrorCredit = 0;
DWORD EventModeEnable = 0;
DWORD SystemType = 0;
DWORD GameKind = 0;
DWORD EventNextTime = 0;
DWORD ConditionTime = 0;
DWORD TrafficCount = 0;
DWORD LogLevel = 0;
DWORD NewsPath = 0;
DWORD EventPath = 0;
DWORD LogPath = 0;
DWORD FillDwordInformation(const char *setting, const char *subkey, DWORD defaultValue)
DWORD FillDwordInformation(const char* setting, const char* subkey, DWORD defaultValue)
{
if (strcmp(config[setting][subkey].c_str(), "1") == 0)
return 1;
@ -104,9 +112,9 @@ LSTATUS __stdcall RegCreateKeyExWWrap(
LPDWORD lpdwDisposition
)
{
if(hKey == HKEY_LOCAL_MACHINE)
if (hKey == HKEY_LOCAL_MACHINE)
{
if(wcsicmp(lpSubKey, L"SOFTWARE\\TAITO\\NESiCAxLive") == 0)
if (wcsicmp(lpSubKey, L"SOFTWARE\\TAITO\\NESiCAxLive") == 0)
{
*phkResult = (HKEY)0x8101;
return ERROR_SUCCESS;
@ -128,15 +136,15 @@ void PromptError(DWORD errorCode, int errorType)
memset(tempBuf, 0, 256);
switch (errorType)
{
case 0:
sprintf(tempBuf, "Game sent NESiCA GameResult error code to %08X to launcher!", errorCode);
break;
case 1:
sprintf(tempBuf, "Game sent NESiCA IOErrorCoin error code to %08X to launcher!", errorCode);
break;
case 2:
sprintf(tempBuf, "Game sent NESiCA IOErrorCredit error code to %08X to launcher!", errorCode);
break;
case 0:
sprintf(tempBuf, "Game sent NESiCA GameResult error code to %08X to launcher!", errorCode);
break;
case 1:
sprintf(tempBuf, "Game sent NESiCA IOErrorCoin error code to %08X to launcher!", errorCode);
break;
case 2:
sprintf(tempBuf, "Game sent NESiCA IOErrorCredit error code to %08X to launcher!", errorCode);
break;
}
MessageBoxA(0, tempBuf, "NESiCA ERROR!", 0);
}
@ -146,7 +154,7 @@ LSTATUS __stdcall RegSetValueExAWrap(
LPCSTR lpValueName,
DWORD Reserved,
DWORD dwType,
CONST BYTE *lpData,
CONST BYTE* lpData,
DWORD cbData
)
{
@ -155,7 +163,7 @@ LSTATUS __stdcall RegSetValueExAWrap(
{
if (stricmp(lpValueName, "GameResult") == 0)
{
GameResult = *(DWORD *)lpData;
GameResult = *(DWORD*)lpData;
if (GameResult != 0)
{
PromptError(GameResult, 0);
@ -163,7 +171,7 @@ LSTATUS __stdcall RegSetValueExAWrap(
}
else if (stricmp(lpValueName, "IOErrorCoin") == 0)
{
IOErrorCoin = *(DWORD *)lpData;;
IOErrorCoin = *(DWORD*)lpData;;
if (IOErrorCoin != 0)
{
PromptError(IOErrorCoin, 1);
@ -171,7 +179,7 @@ LSTATUS __stdcall RegSetValueExAWrap(
}
else if (stricmp(lpValueName, "IOErrorCredit") == 0)
{
IOErrorCredit = *(DWORD *)lpData;;
IOErrorCredit = *(DWORD*)lpData;;
if (IOErrorCredit != 0)
{
PromptError(IOErrorCredit, 2);
@ -203,33 +211,33 @@ LSTATUS __stdcall RegSetValueExWWrap(
LPCWSTR lpValueName,
DWORD Reserved,
DWORD dwType,
CONST BYTE *lpData,
CONST BYTE* lpData,
DWORD cbData
)
{
// These are for the NESiCA Launcher and no need to handle them in any way!
if(hKey == (HKEY)0x8101)
if (hKey == (HKEY)0x8101)
{
if (wcsicmp(lpValueName, L"GameResult") == 0)
{
GameResult = *(DWORD *)lpData;
if(GameResult != 0)
GameResult = *(DWORD*)lpData;
if (GameResult != 0)
{
PromptError(GameResult, 0);
}
}
else if(wcsicmp(lpValueName, L"IOErrorCoin") == 0)
else if (wcsicmp(lpValueName, L"IOErrorCoin") == 0)
{
IOErrorCoin = *(DWORD *)lpData;;
if(IOErrorCoin != 0)
IOErrorCoin = *(DWORD*)lpData;;
if (IOErrorCoin != 0)
{
PromptError(IOErrorCoin, 1);
}
}
else if (wcsicmp(lpValueName, L"IOErrorCredit") == 0)
{
IOErrorCredit = *(DWORD *)lpData;;
if(IOErrorCredit != 0)
IOErrorCredit = *(DWORD*)lpData;;
if (IOErrorCredit != 0)
{
PromptError(IOErrorCredit, 2);
}
@ -246,7 +254,7 @@ LSTATUS __stdcall RegSetValueExWWrap(
return ERROR_SUCCESS;
}
if(hKey == (HKEY)0x8102)
if (hKey == (HKEY)0x8102)
{
MessageBoxA(0, "RegSetValueExW for TYPEX, Please contact devs!", "Error unhandled registry change", 0);
return ERROR_FILE_NOT_FOUND;
@ -320,7 +328,7 @@ LSTATUS __stdcall RegQueryValueExAWrap(
}
else if (stricmp(lpValueName, "Country") == 0) // REG_DWORD
{
*(DWORD *)lpData = FillDwordInformation("TYPEX", "Country", 1); // UNK
*(DWORD*)lpData = FillDwordInformation("TYPEX", "Country", 1); // UNK
*lpcbData = 1;
}
else
@ -381,9 +389,65 @@ LSTATUS __stdcall RegQueryValueExAWrap(
}
else if (stricmp(lpValueName, "SystemType") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "SystemType", SystemType);; // UNK
*lpData = FillDwordInformation("NESiCA", "SystemType", SystemType); // UNK
*lpcbData = 4;
}
if (stricmp(lpValueName, "ConditionTime") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "ConditionTime", 300); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "EventNextTime") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "EventNextTime", 900); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "EventPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (stricmp(lpValueName, "GameKind") == 0) // REG_DWORD
{
// TODO: ADD EACH AND EVERY SINGLE TYPE X GAMEKIND HERE!
*lpData = FillDwordInformation("NESiCA", "GameKind", 1234); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "LogLevel") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "LogLevel", 0); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "LogPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (stricmp(lpValueName, "NewsPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (stricmp(lpValueName, "TrafficCount") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "TrafficCount", 2); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "UpdateStep") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "UpdateStep", 0); // UNK
*lpcbData = 4;
}
else if (stricmp(lpValueName, "Country") == 0) // REG_DWORD
{
*(DWORD*)lpData = FillDwordInformation("NESiCA", "Country", 1); // UNK
*lpcbData = 1;
}
else if (stricmp(lpValueName, "AppVer") == 0) // REG_DWORD
{
*(DWORD*)lpData = FillDwordInformation("NESiCA", "AppVer", 1); // UNK
*lpcbData = 1;
}
else
{
MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0);
@ -460,7 +524,7 @@ LSTATUS __stdcall RegQueryValueExWWrap(
}
else if (wcsicmp(lpValueName, L"Country") == 0) // REG_DWORD
{
*(DWORD *)lpData = FillDwordInformation("TYPEX", "Country", 0); // UNK
*(DWORD*)lpData = FillDwordInformation("TYPEX", "Country", 0); // UNK
*lpcbData = 4;
}
else
@ -472,14 +536,14 @@ LSTATUS __stdcall RegQueryValueExWWrap(
}
// SOFTWARE\\TAITO\\NESiCAxLive
if(hKey == (HKEY)0x8101)
if (hKey == (HKEY)0x8101)
{
if (lpData == nullptr)
{
*lpcbData = 4;
return ERROR_MORE_DATA;
}
if(wcsicmp(lpValueName, L"CoinCredit") == 0) // REG_DWORD
if (wcsicmp(lpValueName, L"CoinCredit") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "CoinCredit", 0); // 0 = FREE PLAY
*lpcbData = 4;
@ -524,6 +588,62 @@ LSTATUS __stdcall RegQueryValueExWWrap(
*lpData = FillDwordInformation("NESiCA", "SystemType", SystemType);; // UNK
*lpcbData = 4;
}
if (wcsicmp(lpValueName, L"ConditionTime") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "ConditionTime", 300); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"EventNextTime") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "EventNextTime", 900); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"EventPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (wcsicmp(lpValueName, L"GameKind") == 0) // REG_DWORD
{
// TODO: ADD EACH AND EVERY SINGLE TYPE X GAMEKIND HERE!
*lpData = FillDwordInformation("NESiCA", "GameKind", 1234); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"LogLevel") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "LogLevel", 0); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"LogPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (wcsicmp(lpValueName, L"NewsPath") == 0) // REG_SZ
{
// TODO
return ERROR_FILE_NOT_FOUND;
}
else if (wcsicmp(lpValueName, L"TrafficCount") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "TrafficCount", 2); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"UpdateStep") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "UpdateStep", 0); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"Country") == 0) // REG_DWORD
{
*(DWORD*)lpData = FillDwordInformation("NESiCA", "Country", 1); // UNK
*lpcbData = 4;
}
else if (wcsicmp(lpValueName, L"AppVer") == 0) // REG_DWORD
{
*(DWORD*)lpData = FillDwordInformation("NESiCA", "Appver", 1); // UNK
*lpcbData = 4;
}
else
{
MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0);
@ -547,7 +667,7 @@ LSTATUS __stdcall RegCloseKeyWrap(
}
void init_RegHooks()
{
{
// ASCII
iatHook("advapi32.dll", RegCreateKeyExAWrap, "RegCreateKeyExA");
iatHook("advapi32.dll", RegOpenKeyExAWrap, "RegOpenKeyExA");

View File

@ -340,6 +340,8 @@ static InitFunction jvsInit([]()
{
return;
}
if (GameDetect::currentGame == GameID::SFV)
return;
if (GameDetect::IsTypeX())
hookPort = "COM2";

View File

@ -241,7 +241,7 @@ extern linb::ini config;
static InitFunction initFunc([]()
{
if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::PokkenTournament26 || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::TER || GameDetect::currentGame == GameID::Tekken7Update00)
if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::PokkenTournament26 || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::TER || GameDetect::currentGame == GameID::Tekken7Update00 || GameDetect::currentGame == GameID::SFV)
return;
if (ToBool(config["General"]["Windowed"]))