Skip to content

Commit

Permalink
Newest Afterbirth version memory layout changes.
Browse files Browse the repository at this point in the history
Also updated my knowledge on the Zodiac item in the source code.
Bumped version to v1.3.2
  • Loading branch information
networkMe committed Nov 14, 2015
1 parent 1879698 commit 3feac7d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 37 deletions.
4 changes: 2 additions & 2 deletions res/DllResources.rc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ MHUD2_ISAAC_FONT_CHARMAP RCDATA "files/MHUD2FontCharmap.texmap"
OPENGL_HUD_SPRITE_VERTEX_SHADER RCDATA "shaders/hud_icon_vert.glsl"
OPENGL_HUD_SPRITE_FRAG_SHADER RCDATA "shaders/hud_icon_frag.glsl"

#define PRODUCT_VER 1,3,1,0
#define PRODUCT_VER_STR "1.3.1"
#define PRODUCT_VER 1,3,2,0
#define PRODUCT_VER_STR "1.3.2"

#ifdef NDEBUG
#define VER_DEBUG 0
Expand Down
4 changes: 2 additions & 2 deletions res/WinResource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

APP_ICON ICON "files/MissingHUD2_Ico.ico"

#define PRODUCT_VER 1,3,1,0
#define PRODUCT_VER_STR "1.3.1"
#define PRODUCT_VER 1,3,2,0
#define PRODUCT_VER_STR "1.3.2"

#ifdef NDEBUG
#define VER_DEBUG 0
Expand Down
2 changes: 1 addition & 1 deletion src/LoaderGUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
</font>
</property>
<property name="text">
<string>&lt;a href=&quot;https://github.com/networkMe/missinghud2/releases&quot;&gt;v1.3.1&lt;/a&gt;</string>
<string>&lt;a href=&quot;https://github.com/networkMe/missinghud2/releases&quot;&gt;v1.3.2&lt;/a&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
Expand Down
24 changes: 8 additions & 16 deletions src/dll/RebirthMemReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ float RebirthMemReader::GetDealWithDevilChance()
if (current_floor_ == 1 || current_floor_ > 8) // In-eligible for natural DWD on these floors (even with Goat Head)
return 0.0f;

// If these 2 conditions are met, you get a guaranteed DWD. I have not a clue what sets these though!
DWORD dwd_floor_flag_unknown_1 = *((DWORD*)(player_manager_inst + PLAYER_MANAGER_DEVILDEAL_UNKNOWN_1));
DWORD dwd_floor_flag_unknown_2 = *((DWORD*)(player_manager_inst + PLAYER_MANAGER_DEVILDEAL_UNKNOWN_2));
if (dwd_floor_flag_unknown_1 == 0x2 && dwd_floor_flag_unknown_2 < 0xB)
return 1.0f;

DWORD player = GetPlayerMemAddr();
float dwd_chance = 0.01f; // Default 1% chance

Expand All @@ -120,20 +114,18 @@ float RebirthMemReader::GetDealWithDevilChance()
if (PlayerHasItem(PASSIVE_ITEM_BLACKCANDLE)) // Black Candle adds 15% chance
dwd_chance += 0.15f;

DWORD afterbirth_items_flag = *((DWORD*)(player + UNKNOWN_AFTERBIRTH_ITEMS));
DWORD pentagram_count = *((DWORD*)(player + PASSIVE_ITEM_PENTAGRAM_COUNT));

// No idea what Afterbirth item this is, but it can affect whether
// the Afterbirth item's 5% increase is introduced
if (PlayerHasItem(0x188))
// Zodiac has a chance to give you a Pentagram effect
if (PlayerHasItem(PASSIVE_ITEM_ZODIAC))
{
// This item relies on RNG as to whether it contributes to the devil deal chance or not??
DWORD rng_func_result = AfterBirthItemRNGFunc();
if (rng_func_result == 0x33)
++afterbirth_items_flag;
if (rng_func_result == PASSIVE_ITEM_PENTAGRAM) // Is Zodiac randomly providing a Pentagram?
++pentagram_count;
}

if (afterbirth_items_flag > 1) // There's a 3 Afterbirth items that use this flag
dwd_chance += 0.05f; // They add 5% if it's above 1 but I have no idea what sets this flag
if (pentagram_count > 1)
dwd_chance += 0.05f; // More than one Pentagram adds another 5% chance

DWORD player_active_item = *((DWORD*)(player + ITEM_ACTIVE_SLOT));
if (player_active_item == ACTIVE_ITEM_BOOKOFREVELATIONS) // Holding Book of Revelations adds 17.5% chance
Expand Down Expand Up @@ -430,7 +422,7 @@ bool RebirthMemReader::PlayingGreed()

DWORD RebirthMemReader::AfterBirthItemRNGFunc()
{
if (!PlayerHasItem(0x188))
if (!PlayerHasItem(PASSIVE_ITEM_ZODIAC))
return 0;

DWORD player_manager_inst = GetPlayerManagerMemAddr();
Expand Down
27 changes: 13 additions & 14 deletions src/dll/RebirthMemReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,23 @@

#define WCHAR_ISAAC_MODULE_NAME L"isaac-ng.exe"

#define ITEM_ACTIVE_SLOT 0x1CD4
#define ITEM_ACTIVE_SLOT 0x1CF4
#define ACTIVE_ITEM_BOOKOFREVELATIONS 0x4E
#define ACTIVE_ITEM_BOOKOFBELIAL 0x22

#define PLAYER_HAS_ITEM_FORM_OFFSET 0x1D84
#define PLAYER_HAS_ITEM_FORM_OFFSET 0x1DA4
#define PASSIVE_ITEM_PENTAGRAM 0x33
#define PASSIVE_ITEM_BLACKCANDLE 0x104
#define PASSIVE_ITEM_GOATHEAD 0xD7
#define UNKNOWN_AFTERBIRTH_ITEMS 0x1E50
#define PASSIVE_ITEM_ZODIAC 0x188
#define PASSIVE_ITEM_PENTAGRAM_COUNT 0x1E70

#define PLAYER_MANAGER_FLOOR_FLAGS 0x708C
#define PLAYER_MANAGER_FLOOR_BOSS_FIGHT 0x7014
#define PLAYER_MANAGER_ROOM_CODE 0x7018
#define PLAYER_MANAGER_ROOM_CODE_FORMULA_OFFSET 0x6D40
#define PLAYER_MANAGER_BOSS_ROOM_CODE 0x7020
#define PLAYER_MANAGER_DEVILDEAL_PREV_FLOOR 0x174DD4
#define PLAYER_MANAGER_DEVILDEAL_UNKNOWN_1 0x175020
#define PLAYER_MANAGER_DEVILDEAL_UNKNOWN_2 0x703C
#define PLAYER_MANAGER_DEVILDEAL_PREV_FLOOR 0x174DDC

#define BOSS_FIGHT_TOOK_RED_DMG 0xE8C

Expand All @@ -56,14 +55,14 @@
// These values are the offsets of the specific statistic from the core Player memory address
enum RebirthPlayerStat
{
kSpeed = 0x1CBC,
kRange = 0x1BF4,
kTearsDelay = 0x1BE0,
kShotSpeed = 0x1BE4,
kShotHeight = 0x1BF8,
kDamage = 0x1BF0,
kLuck = 0x1CC0,
kTearsFired = 0x1BEC,
kSpeed = 0x1CDC,
kRange = 0x1C14,
kTearsDelay = 0x1C00,
kShotSpeed = 0x1C04,
kShotHeight = 0x1C18,
kDamage = 0x1C10,
kLuck = 0x1CE0,
kTearsFired = 0x1C0C,
kDealWithDevil = 0xFFFFFFFF // An advanced function is required for this statistic
};

Expand Down
4 changes: 2 additions & 2 deletions src/mhud2_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#ifndef MISSINGHUD2_VERSION_H
#define MISSINGHUD2_VERSION_H

#define MHUD2_VERSION "v1.3.1"
#define MHUD2_VERSION "v1.3.2"

#define MHUD2_MAJOR_VERSION 1
#define MHUD2_MINOR_VERSION 3
#define MHUD2_REVISION_VERSION 1
#define MHUD2_REVISION_VERSION 2

#endif //MISSINGHUD2_VERSION_H

0 comments on commit 3feac7d

Please sign in to comment.