NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_message.hpp
1#pragma once
2
3#include <game/bases/d_msg_res.hpp>
4#include <game/bases/d_dvd.hpp>
5
6/// @brief Helper class for managing message resources.
7/// @ingroup bases
8class dMessage_c {
9public:
10 dMessage_c(); ///< Constructs a new @p dMessage_c instance.
11 ~dMessage_c(); ///< Destroys the @p dMessage_c instance.
12
13private:
14 void buildMsgRes(EGG::Heap *heap); ///< Creates a new @p MsgRes_c instance from the loaded message resource file.
15
16public:
17 static bool create(EGG::Heap *heap); ///< Loads the message resource file from disk and initializes it.
18 static wchar_t *getMsg(ulong messageGroup, ulong messageID); ///< Gets a message from the group number and ID.
19 static MsgRes_c *getMesRes(); ///< Gets the @p MsgRes_c instance used.
20
21 /**
22 * @brief Writes @p num into @p dst with @p digitCount decimal digits, replacing
23 * suppressed leading zeros with spaces. At most @p writeLimit characters are
24 * written, followed by a null terminator.
25 * @unofficial
26 *
27 * @param num The number to convert.
28 * @param dst The destination buffer.
29 * @param writeLimit The maximum number of characters to write.
30 * @param digitCount The number of digits to write.
31 * @param suppressLeadingZero Whether to suppress leading zeros (1) or not (0).
32 */
33 static void numToString(int num, wchar_t *dst, size_t writeLimit, int digitCount, int suppressLeadingZero);
34
35 /// @brief Same as ::numToString, but uses full-width characters.
36 /// @unofficial
37 static void numToFullWidth(int num, wchar_t *dst, size_t writeLimit, int digitCount, int suppressLeadingZero);
38
39 static void changetoFullSize(wchar_t *str); ///< Converts regular ASCII characters in @p str to full-width characters.
40
41 dDvd::loader_c mLoader; ///< The loader for loading the message resource file from disk.
42 void *mpFileData; ///< The raw message resource file data.
43 MsgRes_c *mpMsgRes; ///< The message resource instance used to retrieve messages.
44};
A simple wrapper around EGG::MsgRes.
Definition d_msg_res.hpp:8
static void numToString(int num, wchar_t *dst, size_t writeLimit, int digitCount, int suppressLeadingZero)
Writes num into dst with digitCount decimal digits, replacing suppressed leading zeros with spaces....
Definition d_message.cpp:45
static wchar_t * getMsg(ulong messageGroup, ulong messageID)
Gets a message from the group number and ID.
Definition d_message.cpp:37
MsgRes_c * mpMsgRes
The message resource instance used to retrieve messages.
Definition d_message.hpp:43
void buildMsgRes(EGG::Heap *heap)
Creates a new MsgRes_c instance from the loaded message resource file.
Definition d_message.cpp:33
static MsgRes_c * getMesRes()
Gets the MsgRes_c instance used.
Definition d_message.cpp:41
~dMessage_c()
Destroys the dMessage_c instance.
Definition d_message.cpp:10
void * mpFileData
The raw message resource file data.
Definition d_message.hpp:42
static void numToFullWidth(int num, wchar_t *dst, size_t writeLimit, int digitCount, int suppressLeadingZero)
Same as numToString, but uses full-width characters.
Definition d_message.cpp:75
dDvd::loader_c mLoader
The loader for loading the message resource file from disk.
Definition d_message.hpp:41
static void changetoFullSize(wchar_t *str)
Converts regular ASCII characters in str to full-width characters.
Definition d_message.cpp:80
dMessage_c()
Constructs a new dMessage_c instance.
Definition d_message.cpp:8
static bool create(EGG::Heap *heap)
Loads the message resource file from disk and initializes it.
Definition d_message.cpp:14