Skip to content

Commit 2270479

Browse files
More Monsters v0.5.0 - Part 2
1 parent 9974801 commit 2270479

File tree

18 files changed

+83
-7
lines changed

18 files changed

+83
-7
lines changed

MRDX.Game.MoreMonsters/CombinationHandler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ private void SetupCombinationFinalStatsUpdate ( nuint unk1 ) {
446446
else { ApplyTechniquesParentDifferent( childBreed ); }
447447

448448
}
449+
450+
if ( _monsterCurrent.GenusMain == MonsterGenus.Worm ) { // Handle Worm Info
451+
Memory.Instance.WriteRaw( Mod.address_monster_mm_wormsub, [ (byte) ( _monsterCurrent.GenusSub + 1 ) ] );
452+
}
449453
}
450454

451455
private void ApplyParentStatBonuses ( MonsterBreed breed, (byte, double)[] childGrowths ) {

MRDX.Game.MoreMonsters/FreezerHandler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ private void FreezerWriteMonsterToFreezer ( nuint self, int freezerID, int unk2
7878
Memory.Instance.WriteRaw( Mod.address_monster_mm_truemain, [ (byte) ( _monsterCurrent.GenusMain + 1 ) ] );
7979
Memory.Instance.WriteRaw( Mod.address_monster_mm_truesub, [ (byte) (_monsterCurrent.GenusSub + 1) ] );
8080

81+
if ( _monsterCurrent.GenusMain == MonsterGenus.Worm ) { // Handle Worm Info
82+
Memory.Instance.WriteRaw( Mod.address_monster_mm_wormsub, [ (byte) ( _monsterCurrent.GenusSub + 1 ) ] );
83+
}
84+
8185
_hook_freezerWriteFreezer!.OriginalFunction( self, freezerID, unk2 );
8286

8387

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

MRDX.Game.MoreMonsters/Mod.cs

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ [ HookDef( BaseGame.Mr2, Region.Us, "51 56 8B F1 8B 0D ?? ?? ?? ??" )]
7777
[Function( CallingConventions.Fastcall )]
7878
public delegate void H_LoadingRanch ( int unk1, int unk2, nuint unk3, nuint unk4 );
7979

80+
[HookDef( BaseGame.Mr2, Region.Us, "55 8B EC 83 E4 F8 83 EC 24 A1 ?? ?? ?? ?? 33 C4 89 44 24 ?? 53" ) ]
81+
[Function( CallingConventions.MicrosoftThiscall )]
82+
public delegate void H_WormCocoonStart ( nuint unk1, nuint unk2, nuint unk3ptr );
8083

8184

8285
public class Mod : ModBase // <= Do not Remove.
@@ -96,14 +99,16 @@ public class Mod : ModBase // <= Do not Remove.
9699

97100
// Offsets are exact for monster values. For Freezer Data, add +2.
98101
public static short memory_mm_version = 1; // Versioning starts at 1, with 0.5.0
99-
public static nuint offset_mm_version { get { return 0x15C; } }
102+
public static nuint offset_mm_version { get { return 0x159; } }
103+
public static nuint offset_mm_wormsub { get { return 0x162; } }
100104
public static nuint offset_mm_truemain { get { return 0x163; } }
101105
public static nuint offset_mm_alternate { get { return 0x164; } }
102106
public static nuint offset_mm_scaling { get { return 0x165; } }
103107
public static nuint offset_mm_truesub { get { return 0x166; } }
104108
public static nuint offset_mm_trueguts { get { return 0x167; } }
105109

106110
public static nuint address_monster_mm_version { get { return address_monster + offset_mm_version; } }
111+
public static nuint address_monster_mm_wormsub { get { return address_monster + offset_mm_wormsub; } }
107112
public static nuint address_monster_mm_truemain { get { return address_monster + offset_mm_truemain; } }
108113
public static nuint address_monster_mm_alternate { get { return address_monster + offset_mm_alternate; } }
109114
public static nuint address_monster_mm_scaling { get { return address_monster + offset_mm_scaling; } }
@@ -139,6 +144,8 @@ public class Mod : ModBase // <= Do not Remove.
139144
private IHook<H_FileSave> _hook_fileSave;
140145
private IHook<H_LoadingRanch> _hook_loadingRanch;
141146

147+
private IHook<H_WormCocoonStart> _hook_wormCocoonStart;
148+
142149
private IHook<H_ShrineMonsterUnlockedChecker> _hook_shrineMonsterUnlockedChecker;
143150

144151
private int _loadedFileCorrectFreezer = 0;
@@ -150,7 +157,6 @@ public class Mod : ModBase // <= Do not Remove.
150157

151158
private Dictionary<int, (MMBreed, byte)> _songIDMapping = new Dictionary<int, (MMBreed, byte)>();
152159

153-
154160
private IHook<H_GetMonsterBreedName> _hook_monsterBreedNames;
155161

156162
public CombinationHandler handlerCombination;
@@ -235,6 +241,8 @@ public Mod(ModContext context)
235241

236242
_iHooks.AddHook<H_LoadingRanch>( HFLoadingRanch ).ContinueWith( result => _hook_loadingRanch = result.Result );
237243

244+
//_iHooks.AddHook<H_WormCocoonStart>( HF_WormCocoonStart ).ContinueWith( result => _hook_wormCocoonStart = result.Result );
245+
238246
_iHooks.AddHook<H_ShrineMonsterUnlockedChecker>( CheckShrineMonsterUnlocked ).ContinueWith( result => _hook_shrineMonsterUnlockedChecker = result.Result );
239247

240248
handlerFreezer = new FreezerHandler( this, _iHooks, _monsterCurrent );
@@ -598,14 +606,18 @@ private int SetupMysteryStat ( nuint self ) {
598606
var ret = _hook_statUpdate!.OriginalFunction( self );
599607

600608
if ( shrineReplacementActive ) {
601-
// TODO - Choose Random Variant or something akin to that. _shrineReplacementMonster._monsterVariants[ 0 ];
602609
var variant = MonsterBreed.GetBreed( _shrineReplacementMonster._genusNewMain, _shrineReplacementMonster._genusNewSub );
603610
WriteMonsterData( variant );
604611

605612
Memory.Instance.Write( address_monster_mm_alternate, _shrineMonsterAlternate );
606613

607614
shrineReplacementActive = false;
608615
}
616+
617+
if ( _monsterCurrent.GenusMain == MonsterGenus.Worm ) { // Handle Worm Info
618+
Memory.Instance.WriteRaw( Mod.address_monster_mm_wormsub, [ (byte) ( _monsterCurrent.GenusSub + 1 ) ] );
619+
}
620+
609621
return ret;
610622
}
611623

@@ -764,6 +776,7 @@ private void VersionUpdateFreezerMonster_V0x5x0_MM1 ( byte freezerSlot ) {
764776
var mainPosMM = startPos + offset_mm_truemain + 0x8;
765777
var subPosMM = startPos + offset_mm_truesub + 0x8;
766778
var gutsPosMM = startPos + offset_mm_trueguts + 0x8;
779+
var wormPosMM = startPos + offset_mm_wormsub + 0x8;
767780

768781
byte mmMain = (byte) ( mainA + 1 );
769782
byte mmSub = (byte) ( subA + 1 );
@@ -782,6 +795,11 @@ private void VersionUpdateFreezerMonster_V0x5x0_MM1 ( byte freezerSlot ) {
782795
Memory.Instance.Write<Byte>( gutsPosMM, ref gutsA );
783796
}
784797

798+
// Handle Worm
799+
if ( (MonsterGenus) mainA == MonsterGenus.Worm ) {
800+
Memory.Instance.Write<byte>( wormPosMM, ref mmSub );
801+
}
802+
785803
Logger.Info( $"Monster in Freezer Slot {freezerSlot} updated to Version 0.5.0 Standards (v1)." );
786804
}
787805

@@ -880,6 +898,25 @@ private void HFLoadingRanch ( int unk1, int unk2, nuint unk3, nuint unk4 ) {
880898
Memory.Instance.WriteRaw( address_game + 0x571470, rawSoundData );
881899
}
882900

901+
/// <summary>
902+
/// This function refuses to hook properly so we're doing it another way for now. Leaving it in as this is the PROPER way to do things.
903+
/// THis should be writing the Worm's Sub ON Cocoon, instead it crashes the game. Cool!
904+
/// </summary>
905+
/// <param name="self"></param>
906+
/// <param name="unk1"></param>
907+
/// <param name="unk2"></param>
908+
/// <param name="unk3ptr"></param>
909+
public void HF_WormCocoonStart ( nuint unk1, nuint unk2, nuint unk3ptr ) {
910+
911+
Logger.Debug( $"Worm Cocoon Starting with {unk1}, {unk2}, {unk3ptr}.", Color.WhiteSmoke );
912+
byte wormSub = (byte) ( (byte) _monsterCurrent.GenusSub + 1);
913+
Memory.Instance.Write<byte>( address_monster_mm_wormsub, ref wormSub );
914+
915+
_hook_wormCocoonStart!.OriginalFunction( unk1, unk2, unk3ptr );
916+
Logger.Debug( $"Worm Sub : {wormSub} written to MM Data.", Color.WhiteSmoke );
917+
918+
919+
}
883920
/// <summary>
884921
/// This function replaces the location where the game is looking for sound data when wandering around on the ranch.
885922
/// Errantry files can only be of length 0x7EF.

MRDX.Game.MoreMonsters/NewMonsterData/MDATA_MONSTER.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,5 @@
220220
1272626 0 Skele Zilla 17 26 17 0 310 -40 3 140 150 130 110 80 100 3 3 2 2 1 2 1 16 1031 1001 1024
221221
1272627 0 Dire Penguin 25 34 25 25 310 0 0 110 110 130 120 90 170 2 2 2 2 2 3 1 14 7 10001 0
222222
1272628 0 Display Case 34 4 34 34 270 5 1 110 140 100 90 40 190 2 2 1 1 0 4 0 16 67 1000001 64
223+
1272629 0 Golden Mocchi 25 15 25 25 310 75 0 110 110 140 130 130 120 2 2 3 3 2 3 2 13 7 10001 0
224+
1272630 0 Probe Worm 36 22 36 33 320 -5 0 130 70 70 140 50 120 3 2 1 3 0 2 2 11 3 1001 0

MRDX.Game.MoreMonsters/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Monster size variations are random from the shrine, and partially inherited from
4141

4242
##### v0.5.0 - 3/22/26
4343

44-
* 2 additional monsters combinations have been added!
44+
* 4 additional monsters combinations have been added!
4545
* Fixed an issue where using guaranteed monster combination items (Phoenix Feather, Ducken Doll, etc.) would crash the game.
4646
* Fixed an issue where Japanese Version generated monsters in VS Mode could load incorrectly.
4747
* Fixed a rare issue where all More Monster related data would be removed from monsters in the freezer, reverting them to Base/Base monsters.

0 commit comments

Comments
 (0)