NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
dMj2dHeader_c Class Reference

#include <dol/bases/d_mj2d_data.hpp>

Description

Save data header holder.

The data stored here is temporary, as it is discarded unless the game is saved. Size must be 32-byte aligned.

Definition at line 15 of file d_mj2d_data.hpp.

Public Member Functions

 dMj2dHeader_c ()
 Constructs the holder.
 
void initialize ()
 Initializes the header data.
 
u16 getFreeModePlayCount (int world, int level) const
 Gets the Free Mode play count for the given world/level. See mFreeModePlayCount.
 
void setFreeModePlayCount (int world, int level, u16 count)
 Sets the Free Mode play count for the given world/level. See mFreeModePlayCount.
 
u16 getCoinBattlePlayCount (int world, int level) const
 Gets the Coin Battle play count for the given world/level. See mCoinBattlePlayCount.
 
void setCoinBattlePlayCount (int world, int level, u16 count)
 Sets the Coin Battle play count for the given world/level. See mCoinBattlePlayCount.
 
void setMultiModeCompletion (int world)
 Unlocks the given world in extra modes.
 
bool getMultiModeCompletion (int world) const
 Checks if the given world is unlocked in extra modes.
 

Private Member Functions

void versionUpdate ()
 Checks that the save data version matches the current one and clears the slot if not.
 
void setSelectFileNo (s8 file)
 Sets the last used save data slot.
 

Private Attributes

char mMagic [4]
 The savegame magic.
 
u8 mVersion [2]
 The save data version and subversion. See SAVE_VERSION and SAVE_SUB_VERSION.
 
u8 mLastSelectedFile
 The last selected save data slot.
 
u8 mUnknown7
 [Unused]. [Most likely declared as padding].
 
u16 mFreeModePlayCount [WORLD_COUNT][STAGE_COUNT]
 The play count of each level in Free Mode.
 
u16 mCoinBattlePlayCount [WORLD_COUNT][STAGE_COUNT]
 The play count of each level in Coin Battle.
 
u16 mExtraModesUnlockedWorlds
 The worlds unlocked in Extra Modes.
 
u16 mUnknown69A
 [Unused]. [Most likely declared as padding].
 
u32 mChecksum
 The CRC32 checksum of the above data (excluding mMagic).
 

Static Private Attributes

static char sSaveMagic [4] = {'S', 'M', 'N', 'P'}
 The expected savegame magic.
 

Constructor & Destructor Documentation

◆ dMj2dHeader_c()

dMj2dHeader_c::dMj2dHeader_c ( )

Constructs the holder.

Definition at line 270 of file d_mj2d_data.cpp.

Member Function Documentation

◆ initialize()

void dMj2dHeader_c::initialize ( )

Initializes the header data.

Definition at line 273 of file d_mj2d_data.cpp.

◆ getFreeModePlayCount()

u16 dMj2dHeader_c::getFreeModePlayCount ( int  world,
int  level 
) const

Gets the Free Mode play count for the given world/level. See mFreeModePlayCount.

Note
Unofficial name.

Definition at line 289 of file d_mj2d_data.cpp.

◆ setFreeModePlayCount()

void dMj2dHeader_c::setFreeModePlayCount ( int  world,
int  level,
u16  count 
)

Sets the Free Mode play count for the given world/level. See mFreeModePlayCount.

Note
Unofficial name.

Definition at line 293 of file d_mj2d_data.cpp.

◆ getCoinBattlePlayCount()

u16 dMj2dHeader_c::getCoinBattlePlayCount ( int  world,
int  level 
) const

Gets the Coin Battle play count for the given world/level. See mCoinBattlePlayCount.

Note
Unofficial name.

Definition at line 297 of file d_mj2d_data.cpp.

◆ setCoinBattlePlayCount()

void dMj2dHeader_c::setCoinBattlePlayCount ( int  world,
int  level,
u16  count 
)

Sets the Coin Battle play count for the given world/level. See mCoinBattlePlayCount.

Note
Unofficial name.

Definition at line 301 of file d_mj2d_data.cpp.

◆ setMultiModeCompletion()

void dMj2dHeader_c::setMultiModeCompletion ( int  world)

Unlocks the given world in extra modes.

Note
Unofficial name.

Definition at line 305 of file d_mj2d_data.cpp.

◆ getMultiModeCompletion()

bool dMj2dHeader_c::getMultiModeCompletion ( int  world) const

Checks if the given world is unlocked in extra modes.

Note
Unofficial name.

Definition at line 309 of file d_mj2d_data.cpp.

◆ versionUpdate()

void dMj2dHeader_c::versionUpdate ( )
private

Checks that the save data version matches the current one and clears the slot if not.

Definition at line 313 of file d_mj2d_data.cpp.

◆ setSelectFileNo()

void dMj2dHeader_c::setSelectFileNo ( s8  file)
private

Sets the last used save data slot.

Definition at line 285 of file d_mj2d_data.cpp.

Member Data Documentation

◆ mMagic

char dMj2dHeader_c::mMagic[4]
private

The savegame magic.

Definition at line 50 of file d_mj2d_data.hpp.

◆ mVersion

u8 dMj2dHeader_c::mVersion[2]
private

The save data version and subversion. See SAVE_VERSION and SAVE_SUB_VERSION.

Definition at line 51 of file d_mj2d_data.hpp.

◆ mLastSelectedFile

u8 dMj2dHeader_c::mLastSelectedFile
private

The last selected save data slot.

Definition at line 52 of file d_mj2d_data.hpp.

◆ mUnknown7

u8 dMj2dHeader_c::mUnknown7
private

[Unused]. [Most likely declared as padding].

Definition at line 53 of file d_mj2d_data.hpp.

◆ mFreeModePlayCount

u16 dMj2dHeader_c::mFreeModePlayCount[WORLD_COUNT][STAGE_COUNT]
private

The play count of each level in Free Mode.

[Value is increased by 0x100 for every playthrough until 10000].

Definition at line 57 of file d_mj2d_data.hpp.

◆ mCoinBattlePlayCount

u16 dMj2dHeader_c::mCoinBattlePlayCount[WORLD_COUNT][STAGE_COUNT]
private

The play count of each level in Coin Battle.

[Value is increased by 0x100 for every playthrough until 10000].

Definition at line 61 of file d_mj2d_data.hpp.

◆ mExtraModesUnlockedWorlds

u16 dMj2dHeader_c::mExtraModesUnlockedWorlds
private

The worlds unlocked in Extra Modes.

Playing a world in extra modes requires said world to be unlocked in at least one save slot. Value is a bitfield.

Definition at line 66 of file d_mj2d_data.hpp.

◆ mUnknown69A

u16 dMj2dHeader_c::mUnknown69A
private

[Unused]. [Most likely declared as padding].

Definition at line 67 of file d_mj2d_data.hpp.

◆ mChecksum

u32 dMj2dHeader_c::mChecksum
private

The CRC32 checksum of the above data (excluding mMagic).

Definition at line 69 of file d_mj2d_data.hpp.

◆ sSaveMagic

char dMj2dHeader_c::sSaveMagic = {'S', 'M', 'N', 'P'}
staticprivate

The expected savegame magic.

Value is SMNP for PAL games.

Note
Unofficial name. Is this even part of the class?

Definition at line 74 of file d_mj2d_data.hpp.