From 757b4b04fe17a90c7577dbf55e68d5415a52bccd Mon Sep 17 00:00:00 2001 From: Poliwrath Date: Sun, 7 Apr 2019 15:29:04 -0400 Subject: [PATCH] Add iDmacDrv stub building --- iDmacDrv/premake5.lua | 29 +++++++++++ iDmacDrv/src/Source.def | 16 ++++++ iDmacDrv/src/main.cpp | 110 ++++++++++++++++++++++++++++++++++++++++ premake5.lua | 3 +- 4 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 iDmacDrv/premake5.lua create mode 100644 iDmacDrv/src/Source.def create mode 100644 iDmacDrv/src/main.cpp diff --git a/iDmacDrv/premake5.lua b/iDmacDrv/premake5.lua new file mode 100644 index 0000000..b9f4288 --- /dev/null +++ b/iDmacDrv/premake5.lua @@ -0,0 +1,29 @@ +project "iDmacDrv" + targetname "iDmacDrv" + language "C++" + kind "SharedLib" + + files + { + "src/**.cpp", "src/**.h", + "deps/cpp/**.cpp", "deps/inc/**.h" + } + + includedirs { "src", } + + linkoptions { "/DEF:iDmacDrv/src/Source.def" } + + prebuildcommands { + "if not exist $(TargetDir)output mkdir $(TargetDir)output", + } + + postbuildcommands { + "if exist $(TargetDir)iDmacDrv32.dll xcopy /y $(TargetDir)iDmacDrv32.dll $(TargetDir)output\\", + "if exist $(TargetDir)iDmacDrv64.dll xcopy /y $(TargetDir)iDmacDrv64.dll $(TargetDir)output\\" + } + + filter "platforms:x86" + targetsuffix "32" + + filter "platforms:x64" + targetsuffix "64" \ No newline at end of file diff --git a/iDmacDrv/src/Source.def b/iDmacDrv/src/Source.def new file mode 100644 index 0000000..215ffb9 --- /dev/null +++ b/iDmacDrv/src/Source.def @@ -0,0 +1,16 @@ +EXPORTS + +iDmacDrvOpen @1 +iDmacDrvClose @2 +iDmacDrvDmaRead @3 +iDmacDrvDmaWrite @4 +iDmacDrvRegisterRead @5 +iDmacDrvRegisterWrite @6 +iDmacDrvRegisterBufferRead @7 +iDmacDrvRegisterBufferWrite @8 +iDmacDrvMemoryRead @9 +iDmacDrvMemoryWrite @10 +iDmacDrvMemoryReadExt @11 +iDmacDrvMemoryWriteExt @12 +iDmacDrvMemoryBufferRead @13 +iDmacDrvMemoryBufferWrite @14 diff --git a/iDmacDrv/src/main.cpp b/iDmacDrv/src/main.cpp new file mode 100644 index 0000000..d798a6b --- /dev/null +++ b/iDmacDrv/src/main.cpp @@ -0,0 +1,110 @@ +#pragma optimize("", off) +#include +int main(); + +BOOL WINAPI DllMain( + HINSTANCE hinstDLL, // handle to DLL module + DWORD fdwReason, // reason for calling function + LPVOID lpReserved ) // reserved +{ + // Perform actions based on the reason for calling. + switch( fdwReason ) + { + case DLL_PROCESS_ATTACH: + // Initialize once for each new process. + // Return FALSE to fail DLL load. + return main(); + break; + + case DLL_THREAD_ATTACH: + // Do thread-specific initialization. + break; + + case DLL_THREAD_DETACH: + // Do thread-specific cleanup. + break; + + case DLL_PROCESS_DETACH: + // Perform any necessary cleanup. + break; + } + return TRUE; // Successful DLL_PROCESS_ATTACH. +} + +bool initOK = false; + +extern "C" __declspec(dllexport) DWORD __cdecl iDmacDrvOpen(int deviceId, LPVOID outBuffer, LPVOID lpSomeFlag) +{ + return 0; +} + +extern "C" __declspec(dllexport) DWORD __cdecl iDmacDrvClose(int deviceId, LPVOID lpWriteAccess) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvDmaRead(int a1, LPVOID lp, UINT_PTR ucb, LPVOID a4) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvDmaWrite(int a1, void *lp, UINT_PTR ucb, LPVOID a4) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvRegisterRead(int DeviceId, DWORD CommandCode, LPVOID OutBuffer, LPVOID DeviceResult) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvRegisterWrite(int deviceId, DWORD CommandCode, int unused, LPVOID DeviceResult) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvRegisterBufferRead(int a1, DWORD BytesReturned, LPVOID lp, UINT_PTR ucb, LPVOID a5) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvRegisterBufferWrite(int a1, DWORD BytesReturned, void *lp, UINT_PTR ucb, LPVOID a5) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvMemoryRead(int a1, DWORD BytesReturned, LPVOID lp, LPVOID a4) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvMemoryWrite(int a1, DWORD BytesReturned, int a3, LPVOID lp) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvMemoryReadExt(int a1, DWORD BytesReturned, int a3, LPVOID lp, DWORD nOutBufferSize, LPVOID a6) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvMemoryWriteExt(int a1, int a2, int a3, void *Src, rsize_t DstSize, LPVOID lp) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvMemoryBufferRead(int a1, DWORD BytesReturned, LPVOID lp, UINT_PTR ucb, LPVOID a5) +{ + return 0; +} + +extern "C" __declspec(dllexport) int __cdecl iDmacDrvMemoryBufferWrite(int a1, int a2, void *lp, UINT_PTR ucb, LPVOID a5) +{ + return 0; +} + +int main() +{ + return 1; +} +#pragma optimize("", on) \ No newline at end of file diff --git a/premake5.lua b/premake5.lua index 8e98d0d..675ad32 100644 --- a/premake5.lua +++ b/premake5.lua @@ -69,4 +69,5 @@ project "udis86" include "OpenParrot" include "OpenParrotLoader" -include "OpenParrotKonamiLoader" \ No newline at end of file +include "OpenParrotKonamiLoader" +include "iDmacDrv" \ No newline at end of file