Skip to content

Commit

Permalink
Merge pull request #2 from airbus-cert/issue_1
Browse files Browse the repository at this point in the history
Allow passing DLL paths (fix #1)
  • Loading branch information
simsor authored Oct 7, 2022
2 parents dc1ee10 + 1eaca8d commit 1578ba6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions TTD/TTD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace TTD {
return this->cursor->ICursor->GetModuleList(cursor);
}

ReplayEngine::ReplayEngine() {
ReplayEngine::ReplayEngine(const wchar_t* ttdReplayPath, const wchar_t* ttdReplayCpuPath) {
HINSTANCE hinstLib;
PROC_Initiate InitiateReplayEngineHandshake;
PROC_Create CreateReplayEngineWithHandshake;
Expand All @@ -109,7 +109,12 @@ namespace TTD {
SHA256_CTX ctx;
BYTE sha[32];

hinstLib = LoadLibrary(TEXT("TTDReplay.dll"));
hinstLib = LoadLibraryW(ttdReplayCpuPath);
if (hinstLib == NULL) {
throw std::exception("Unable to find TTDReplayCPU.dll");
}

hinstLib = LoadLibraryW(ttdReplayPath);
if (hinstLib == NULL) {
throw std::exception("Unable to find TTDReplay.dll");
}
Expand Down
2 changes: 1 addition & 1 deletion TTD/TTD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ namespace TTD {
TTD_Replay_ReplayEngine* engine;

public:
ReplayEngine();
ReplayEngine(const wchar_t* ttdReplayPath=L"TTDReplay.dll", const wchar_t* ttdReplayCpuPath=L"TTDReplayCPU.dll");

/**** Wrapping around the vftable ****/
bool Initialize(const wchar_t* trace_filename);
Expand Down

0 comments on commit 1578ba6

Please sign in to comment.