1
0
mirror of synced 2025-02-22 13:09:57 +01:00

Merge branch 'master' of github.com:teknogods/OpenParrot into idmac_stubs

This commit is contained in:
Poliwrath 2019-04-09 01:08:54 -04:00
commit d6ab3f90e2
7 changed files with 91 additions and 11 deletions

View File

@ -6,6 +6,7 @@
#include "Functions/Nesica_Libs/RfidEmu.h" #include "Functions/Nesica_Libs/RfidEmu.h"
#include "Functions/Nesica_Libs/NesysEmu.h" #include "Functions/Nesica_Libs/NesysEmu.h"
#include "Functions/Nesica_Libs/RegHooks.h" #include "Functions/Nesica_Libs/RegHooks.h"
#include "Utility/Hooking.Patterns.h"
static InitFunction initFunction([]() static InitFunction initFunction([]()
{ {
@ -42,6 +43,39 @@ static InitFunction initFunction_GC2([]()
#endif #endif
}, GameID::GrooveCoaster2); }, GameID::GrooveCoaster2);
static InitFunction initFunction_DariusBurst([]()
{
init_FastIoEmu();
init_RegHooks();
init_NesysEmu(true);
uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0);
// Ignore cryptopipe check.
// NOTE: This could be cause for the non-working TEST MODE. No time to analyze since dump was released and we want to give instant support.
injector::WriteMemory<BYTE>(imageBase + 0x2CC753, 0xEB, true);
// D:
injector::WriteMemoryRaw(imageBase + 0x482F38, "\x2E\x5C\x44", 3, true); // D:\%s%04d%02d%02d_%02d%02d%02d_
injector::WriteMemoryRaw(imageBase + 0x4830A0, "\x2E\x5C\x44", 3, true); // D:\%s/%s/*
injector::WriteMemoryRaw(imageBase + 0x4830AC, "\x2E\x5C\x44", 3, true); // D:\%s/%s
injector::WriteMemoryRaw(imageBase + 0x4830B3, "\x2E\x5C\x44", 3, true); // D:\%s/*
injector::WriteMemoryRaw(imageBase + 0x49FC90, "\x2E\x5C\x44", 3, true); // D:\%s
injector::WriteMemoryRaw(imageBase + 0x4A269C, "\x2E\x5C\x44", 3, true); // EDData
injector::WriteMemoryRaw(imageBase + 0x4AA168, "\x2E\x5C\x44", 3, true);
injector::WriteMemoryRaw(imageBase + 0x4D460C, "\x2E\x5C\x44", 3, true);
injector::WriteMemoryRaw(imageBase + 0x4D46A8, "\x2E\x5C\x44", 3, true); // Proclog
// D:/
injector::WriteMemoryRaw(imageBase + 0x4D44B4, "\x2E\x5C\x44", 3, true);
// Disable invertion of 2nd screen area
// NOTE: Nezarn is pro
injector::WriteMemoryRaw(imageBase + 0x4D4E34, "\x30\x2E\x30\x66\x20\x20\x20\x20", 8, true); // 0.0f
injector::WriteMemoryRaw(imageBase + 0x4D4E4C, "\x2A\x20\x30\x2E\x30\x66\x20\x20\x20\x20\x20\x2D", 12, true); // * 0.0f -
}, GameID::DariusBurst);
static InitFunction initFunction_PB([]() static InitFunction initFunction_PB([]()
{ {
uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0);

View File

@ -1,6 +1,7 @@
#include <StdInc.h> #include <StdInc.h>
#include "Utility/InitFunction.h" #include "Utility/InitFunction.h"
#include <thread> #include <thread>
#include "Utility/GameDetect.h"
static uint8_t g_fastIOValues[64]; static uint8_t g_fastIOValues[64];
@ -42,6 +43,7 @@ int __cdecl iDmacDrvRegisterRead(int DeviceId, DWORD CommandCode, LPVOID OutBuff
switch (CommandCode) switch (CommandCode)
{ {
// TODO: COMMAND CODES SHOULD BE DEFINED PROPERLY!
case 0x400: case 0x400:
{ {
result = 0x00010201; result = 0x00010201;
@ -51,9 +53,17 @@ int __cdecl iDmacDrvRegisterRead(int DeviceId, DWORD CommandCode, LPVOID OutBuff
result = 0x00FF00FF; result = 0x00FF00FF;
break; break;
case 0x4004: case 0x4004:
result = 0x00FF0000; if(GameDetect::currentGame == GameID::DariusBurst)
{
// I/O error without this switch
result = 0x00FF00FF;
}
else
{
result = 0x00FF0000;
}
break; break;
case 0x4120: case 0x4120: // Player 1 and 2 controls
result = g_fastIOValues[0] + ((DWORD)g_fastIOValues[1] * 0x100) + ((DWORD)g_fastIOValues[2] * 0x10000) + ((DWORD)g_fastIOValues[3] * 0x1000000); result = g_fastIOValues[0] + ((DWORD)g_fastIOValues[1] * 0x100) + ((DWORD)g_fastIOValues[2] * 0x10000) + ((DWORD)g_fastIOValues[3] * 0x1000000);
break; break;
case 0x412C: case 0x412C:
@ -97,8 +107,8 @@ int __cdecl iDmacDrvRegisterRead(int DeviceId, DWORD CommandCode, LPVOID OutBuff
//if (result != 0) //if (result != 0)
// CoinPackageSecond = 0; // CoinPackageSecond = 0;
break; break;
case 0x41A0: case 0x41A0: // Player 3 and 4 controls
result = 0; result = g_fastIOValues[10] + ((DWORD)g_fastIOValues[11] * 0x100) + ((DWORD)g_fastIOValues[12] * 0x10000) + ((DWORD)g_fastIOValues[13] * 0x1000000);
break; break;
case 0x41A8: case 0x41A8:
result = 0; result = 0;
@ -116,7 +126,27 @@ int __cdecl iDmacDrvRegisterRead(int DeviceId, DWORD CommandCode, LPVOID OutBuff
case 0x4108: case 0x4108:
result = 0; result = 0;
break; break;
case 0x4150u:
result = 0x1823C;
break;
// Packages that are ok to return 0 for now to prevent spam...
case 0x4158:
case 0x415C:
case 0x41D0:
case 0x41D4:
case 0x41D8:
case 0x41DC:
case 0x4148:
case 0x414C:
case 0x41C8:
case 0x41CC:
result = 0;
break;
default:
#ifdef _DEBUG
info(true, "Unknown Fast I/O Request: %08X", CommandCode);
#endif
break;
} }
*(DWORD*)OutBuffer = result; *(DWORD*)OutBuffer = result;
*(DWORD*)DeviceResult = 0; *(DWORD*)DeviceResult = 0;

View File

@ -473,13 +473,17 @@ void NesysEmu::SendResponse(nesys_command command, const void* data, size_t data
free(buffer); free(buffer);
} }
void NesysEmu::Initialize() void NesysEmu::Initialize(bool isDarius)
{ {
std::thread([=]() std::thread([=]()
{ {
while (true) while (true)
{ {
auto pipe = CreateNamedPipeW(L"\\\\.\\pipe\\nesys_games", PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 8192, 8192, 0, nullptr); HANDLE pipe;
if(!isDarius)
pipe = CreateNamedPipeW(L"\\\\.\\pipe\\nesys_games", PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 8192, 8192, 0, nullptr);
else
pipe = CreateNamedPipeW(L"\\\\.\\pipe\\nesystest", PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 8192, 8192, 0, nullptr);
if (pipe == INVALID_HANDLE_VALUE) if (pipe == INVALID_HANDLE_VALUE)
{ {
@ -537,7 +541,7 @@ void WriteNewsFile()
} }
} }
void init_NesysEmu() void init_NesysEmu(bool IsDarius)
{ {
CreateDirectoryA("OpenParrot", nullptr); CreateDirectoryA("OpenParrot", nullptr);
WriteNewsFile(); WriteNewsFile();
@ -545,6 +549,6 @@ void init_NesysEmu()
MH_CreateHookApi(L"iphlpapi.dll", "GetIfEntry", GetIfEntryFunc, (void**)&g_origGetIfEntry); MH_CreateHookApi(L"iphlpapi.dll", "GetIfEntry", GetIfEntryFunc, (void**)&g_origGetIfEntry);
MH_EnableHook(MH_ALL_HOOKS); MH_EnableHook(MH_ALL_HOOKS);
g_nesysEmu.Initialize(); g_nesysEmu.Initialize(IsDarius);
} }
#pragma optimize("", on) #pragma optimize("", on)

View File

@ -110,7 +110,7 @@ public:
~NesysEmu(); ~NesysEmu();
void Initialize(); void Initialize(bool isDarius);
void Shutdown(); void Shutdown();
@ -141,4 +141,4 @@ private:
std::map<nesys_command, std::function<void(const uint8_t*, size_t)>> m_commandHandlers; std::map<nesys_command, std::function<void(const uint8_t*, size_t)>> m_commandHandlers;
}; };
void init_NesysEmu(); void init_NesysEmu(bool IsDarius = false);

View File

@ -7,6 +7,7 @@ DWORD GameResult = 0;
DWORD IOErrorCoin = 0; DWORD IOErrorCoin = 0;
DWORD IOErrorCredit = 0; DWORD IOErrorCredit = 0;
DWORD EventModeEnable = 0; DWORD EventModeEnable = 0;
DWORD SystemType = 0;
DWORD FillDwordInformation(const char *setting, const char *subkey, DWORD defaultValue) DWORD FillDwordInformation(const char *setting, const char *subkey, DWORD defaultValue)
{ {
@ -230,6 +231,11 @@ LSTATUS __stdcall RegQueryValueExWWrap(
*lpData = FillDwordInformation("NESiCA", "IOErrorCredit", IOErrorCredit); // UNK *lpData = FillDwordInformation("NESiCA", "IOErrorCredit", IOErrorCredit); // UNK
*lpcbData = 4; *lpcbData = 4;
} }
else if (wcscmp(lpValueName, L"SystemType") == 0) // REG_DWORD
{
*lpData = FillDwordInformation("NESiCA", "SystemType", SystemType);; // UNK
*lpcbData = 4;
}
else else
{ {
MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0); MessageBoxA(0, "UNKNOWN REG QUERY FROM SOFTWWARE\\TAITO\\NESiCAxLive, contact devs!", "Error", 0);

View File

@ -385,6 +385,11 @@ void GameDetect::DetectCurrentGame()
currentGame = GameID::Daytona3; currentGame = GameID::Daytona3;
break; break;
} }
if(*(uint32_t*)(moduleBase + 0x2CC751) == 0x6B75C084)
{
currentGame = GameID::DariusBurst;
break;
}
#else #else
// X64 // X64
// School of Ragnarok // School of Ragnarok

View File

@ -47,6 +47,7 @@ enum class GameID
CrimzonClover, CrimzonClover,
Daytona3, Daytona3,
MB4, MB4,
DariusBurst,
GTIClub3, GTIClub3,
GRID GRID
}; };