I see in Program.cs the comment below baseNames have not been seen, followed by lines with baseNames.Add(...). I've been looking at the disassembly of Hachi (Nintendo's official DS emulator for Wii U), which includes function symbols. I decided to scan it for these "unseen" base names and managed to find a few instances that were easy to confirm are correct.
(Note: for simplicity, since it shows up a few times, I'll use uint = unsigned int for brevity)
__nw and __dl: Hachi includes both __nw__FUi and __dl__FPv, which calls malloc and free respectively, which matches the expected behavior for operator new and operator delete. It also includes an import for __nw__FUiRCQ2_3std9nothrow_t, which matches the expected signature for non-throwing operator new.
__cl: Hachi seems to have a class called nerd::TNumericalMatrix. It includes a function with the mangled name __cl__Q2_4nerd44TNumericalMatrix__tm__20_fXCUiL_1_4XCUiL_1_4FUiT1_RZ1Z, which (simplified) translates to float& nerd::TNumericalMatrix<float, 4, 4>operator()(uint a, uint b). Looking at the function's assembly, it appears to calculate i = (a + 4*b), then return's the ith 4-byte value in the object's data. The class appears to be used as a multidimensional array. Since C++ doesn't have multidimensional operator[] support (yet), it seems reasonable to assume that this function would be implemented as operator().
__rs: There are two functions in Hachi that start with __rs. One of those functions is __rs__Q2_3std52basic_istream__tm__31_cQ2_3std20char_traits__tm__2_cFRf_RQ2_3std27basic_istream__tm__7_Z1ZZ2Z, which translates to (simplified) std::istream& std::istream::operator>>(float&) (with std::istream = std::basic_istream<char>). While the body of the function is too complicated for me to 100% confirm this is what the function's behavior matches, there isn't much else it could be. The other function that starts with __rs has the same signature except the argument is int&.
__vc: There are a bunch of functions in Hachi that start with __vc, with most of them being for std::map. A simple one to analyze is __CPR199____vc__Q2_3std172map__tm__160_Q2_3std16pair__tm__5_UiUiiQ2_3std38less__tm__26_Q2_3stdJ36JQ2_4nerd76GlobalStdAllocator__tm__50_Q2_3std40pair__tm__28_CQ2_3stdJ36JiFRCZ1Z_RZ2Z. Simplified, and substituting nerd::GlobalStdAllocator for the default std::allocator, this becomes int& std::map<std::pair<uint, uint>, int>::operator[](const std::pair<uint, uint>&). This matches the expected function signature for this function. For all the std::map::operator[] functions I looked at, they all took an argument of const Z1& and returned an instance of Z2&, so this seems to work for all of them.
All these should be able to be moved out of the "have not been seen" section, as they are present in an official Nintendo release.
I see in
Program.cs
the commentbelow baseNames have not been seen
, followed by lines withbaseNames.Add(...)
. I've been looking at the disassembly of Hachi (Nintendo's official DS emulator for Wii U), which includes function symbols. I decided to scan it for these "unseen" base names and managed to find a few instances that were easy to confirm are correct.(Note: for simplicity, since it shows up a few times, I'll use
uint = unsigned int
for brevity)__nw
and__dl
: Hachi includes both__nw__FUi
and__dl__FPv
, which callsmalloc
andfree
respectively, which matches the expected behavior foroperator new
andoperator delete
. It also includes an import for__nw__FUiRCQ2_3std9nothrow_t
, which matches the expected signature for non-throwingoperator new
.__cl
: Hachi seems to have a class callednerd::TNumericalMatrix
. It includes a function with the mangled name__cl__Q2_4nerd44TNumericalMatrix__tm__20_fXCUiL_1_4XCUiL_1_4FUiT1_RZ1Z
, which (simplified) translates tofloat& nerd::TNumericalMatrix<float, 4, 4>operator()(uint a, uint b)
. Looking at the function's assembly, it appears to calculatei = (a + 4*b)
, then return's thei
th 4-byte value in the object's data. The class appears to be used as a multidimensional array. Since C++ doesn't have multidimensionaloperator[]
support (yet), it seems reasonable to assume that this function would be implemented asoperator()
.__rs
: There are two functions in Hachi that start with__rs
. One of those functions is__rs__Q2_3std52basic_istream__tm__31_cQ2_3std20char_traits__tm__2_cFRf_RQ2_3std27basic_istream__tm__7_Z1ZZ2Z
, which translates to (simplified)std::istream& std::istream::operator>>(float&)
(withstd::istream = std::basic_istream<char>
). While the body of the function is too complicated for me to 100% confirm this is what the function's behavior matches, there isn't much else it could be. The other function that starts with__rs
has the same signature except the argument isint&
.__vc
: There are a bunch of functions in Hachi that start with__vc
, with most of them being forstd::map
. A simple one to analyze is__CPR199____vc__Q2_3std172map__tm__160_Q2_3std16pair__tm__5_UiUiiQ2_3std38less__tm__26_Q2_3stdJ36JQ2_4nerd76GlobalStdAllocator__tm__50_Q2_3std40pair__tm__28_CQ2_3stdJ36JiFRCZ1Z_RZ2Z
. Simplified, and substitutingnerd::GlobalStdAllocator
for the defaultstd::allocator
, this becomesint& std::map<std::pair<uint, uint>, int>::operator[](const std::pair<uint, uint>&)
. This matches the expected function signature for this function. For all thestd::map::operator[]
functions I looked at, they all took an argument ofconst Z1&
and returned an instance ofZ2&
, so this seems to work for all of them.All these should be able to be moved out of the "have not been seen" section, as they are present in an official Nintendo release.