Skip to content

Commit

Permalink
Merge pull request #18 from CalDrac/meteos
Browse files Browse the repository at this point in the history
New Game: Meteos
  • Loading branch information
Dinopony authored Oct 12, 2023
2 parents 7058cb4 + b7bb93d commit d2d0069
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 0 deletions.
40 changes: 40 additions & 0 deletions HintMachine/Games/INintendoDSConnector.cs
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;
}
}
}
131 changes: 131 additions & 0 deletions HintMachine/Games/MeteosConnector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
using System;

namespace HintMachine.Games
{
class MeteosConnector : INintendoDSConnector
{
private readonly HintQuestCumulative _sendBlocksQuest = new HintQuestCumulative
{
Name = "Send meteos into space",
Description = "Use simple and deluge mode for this quest",
GoalValue = 500,
MaxIncrease = 100
};
/* Might be added back later
private readonly HintQuestCumulative _levelClearQuest = new HintQuestCumulative
{
Name = "Clear non-boss Star Trip levels",
//Description = "Use Star Trip mode for this quest",
GoalValue = 6,
MaxIncrease = 6
};
*/
private readonly HintQuestCumulative _starTripQuest = new HintQuestCumulative
{
Name = "Finish Star Trip",
//Description = "Use Star Trip mode for this quest",
GoalValue = 1,
MaxIncrease = 2

};

private bool _starTripStarted = false;

// ---------------------------------------------------------

public MeteosConnector()
{
Name = "Meteos (DS)";
Description = "Match 3+ blocks of the same color horizontally or vertically to ignite a propulsion and send them to your opponents.";
SupportedVersions = "Tested on USA rom with BizHawk 2.9.1";
Author = "CalDrac";
Quests.Add(_sendBlocksQuest);
//Quests.Add(_levelClearQuest); //Might be added back later
Quests.Add(_starTripQuest);
}

public override bool Connect()
{
if (!base.Connect())
return false;

byte[] METEOS_SIG = new byte[] { 0xFF, 0xDE, 0xFF, 0xE7, 0xFF, 0xDE, 0xFF, 0xE7, 0xFF, 0xDE, 0xFF, 0xE7, 0xFF, 0xDE, 0x47, 0x8B };
if (FindRamSignature(METEOS_SIG, 0))
return true;

return false;
}

public override void Disconnect()
{
_ram = null;
}

public override bool Poll()
{
long level = _ram.ReadInt32(_dsRamBaseAddress + 0x3BFEFC);

/* levelQuest might be added back later
if (level < 16 && level > 0)
{
//Prevent quest increase if retrying a level
if (level > maxLevel)
{
maxLevel = level;
}
//Reset Star Trip condition
if (level == 1)
{
maxLevel = 1;
}
//update nbNiveaux in Star trip
_levelClearQuest.UpdateValue(maxLevel - 1);
return true;
}
else */
//level = 16 is the ending
if(level == 1)
{
_starTripStarted = true;
_starTripQuest.UpdateValue(0);
}
if (level == 16)
{
if (_starTripStarted)
{
_starTripQuest.UpdateValue(1);
_starTripStarted = false;
}
}
if(level > 16)
{
_starTripStarted = false;
int nbPlayers = _ram.ReadInt32(_dsRamBaseAddress + 0x63080);

long rightAddr = 0x0;
switch (nbPlayers)
{
case 1:
rightAddr = _dsRamBaseAddress + 0x2018CC;
break;

case 2:
rightAddr = _dsRamBaseAddress + 0x2019EC;
break;

case 3:
rightAddr = _dsRamBaseAddress + 0x201B0C;
break;

case 4:
rightAddr = _dsRamBaseAddress + 0x201C2C;
break;
}
_sendBlocksQuest.UpdateValue(_ram.ReadInt32(rightAddr));
return true;
}
return true;
}
}
}
4 changes: 4 additions & 0 deletions HintMachine/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ internal static class Globals
new FZeroGXConnector(),
new IslandersConnector(),
new DorfromantikConnector(),
new MeteosConnector(),
new PacManChampionshipEditionDXConnector(),
};

Expand All @@ -65,14 +66,17 @@ public static IGameConnector FindGameFromName(string name)
"Le saviez vous ? Le Hit Machine a été diffusé sur M6 entre 1994 et 2009",
"Le saviez vous ? Le developpement de la HintMachine a demarré en Septembre 2023.",
"✨ Je m'appelle Charly - Et je m'appelle Lulu - On est sur M6 - pour le HitMachine ✨",

};
public static readonly List<string> CharlyMachineFacts = new List<string>() {
"Le saviez vous ? Charly se nomme Charly Nestor.",
"Le saviez vous ? Charly est né le 10 avril 1964",
"Le feu ça brule"
};
public static readonly List<string> LuluMachineFacts = new List<string>() {
"Le saviez vous ? Lulu se nomme Jean-Marc Lubin",
"Le saviez vous ? Lulu a commencé sa carriere télé en 1990",
"L'eau ça mouille"
};
}
}
2 changes: 2 additions & 0 deletions HintMachine/HintMachine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ArchipelagoHintSession.cs" />
<Compile Include="Games\INintendoDSConnector.cs" />
<Compile Include="Games\MeteosConnector.cs" />
<Compile Include="Games\BustAMove4Connector.cs" />
<Compile Include="Games\PacManChampionshipEditionDXConnector.cs" />
<Compile Include="Games\FZeroGXConnector.cs" />
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Given its high dependency to system calls to do RAM peeking and stuff, only Wind
- Geometry Wars Galaxies (Wii)
- Geometry Wars : Retro Evolved
- ISLANDERS
- Meteos (DS)
- One Finger Death Punch
- PAC-MAN Championship Edition DX+
- Puyo Puyo Tetris
Expand Down

0 comments on commit d2d0069

Please sign in to comment.