-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a generic Nintendo DS connector
- Loading branch information
Showing
3 changed files
with
66 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using static HintMachine.ProcessRamWatcher; | ||
|
||
namespace HintMachine.Games | ||
{ | ||
public abstract class INintendoDSConnector : IGameConnector | ||
{ | ||
protected ProcessRamWatcher _ram = null; | ||
protected long _dsRamBaseAddress = 0; | ||
|
||
public INintendoDSConnector() | ||
{} | ||
|
||
public override bool Connect() | ||
{ | ||
_ram = new ProcessRamWatcher("EmuHawk"); | ||
return _ram.TryConnect(); | ||
} | ||
|
||
public override void Disconnect() | ||
{ | ||
_ram = null; | ||
_dsRamBaseAddress = 0; | ||
} | ||
|
||
protected bool FindRamSignature(byte[] ramSignature, uint signatureLookupAddr) | ||
{ | ||
long ramBaseAddress = 0x36F01952020; | ||
byte[] signatureBytes = _ram.ReadBytes(ramBaseAddress + signatureLookupAddr, ramSignature.Length); | ||
if (Enumerable.SequenceEqual(signatureBytes, ramSignature)) | ||
{ | ||
_dsRamBaseAddress = ramBaseAddress; | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters