Last active
August 29, 2015 14:20
-
-
Save Nekotekina/0fd8e112b5b71a043f0c to your computer and use it in GitHub Desktop.
CgBinaryDisasm::FormatDisAsm attempt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string CgBinaryDisasm::FormatDisAsm(const std::string& code) | |
{ | |
const std::pair<std::string, std::function<std::string()>> repl_list[] = | |
{ | |
{ "$$", [this]{ return "$"; } }, // may require std::string("$") | |
{ "$0", [this]{ return GetSrcDisAsm<SRC0>(src0); } }, | |
{ "$1", [this]{ return GetSrcDisAsm<SRC1>(src1); } }, | |
{ "$2", [this]{ return GetSrcDisAsm<SRC2>(src2); } }, | |
{ "$t", [this]{ return AddTexDisAsm(); } }, | |
{ "$m", [this]{ return GetMask(); } }, | |
{ "$cond", [this]{ return GetCondDisAsm(); } }, | |
{ "$c", [this]{ return AddConstDisAsm(); } }, | |
}; | |
return fmt::replace_all(code, repl_list); | |
} | |
std::string CgBinaryDisasm::FormatDisasm(const std::string& code) | |
{ | |
const std::pair<std::string, std::function<std::string()>> repl_list[] = | |
{ | |
{ "$$", [this]{ return "$"; } }, // may require std::string("$") | |
{ "$0", [this]{ return GetSRCDisasm(0); } }, | |
{ "$1", [this]{ return GetSRCDisasm(1); } }, | |
{ "$2", [this]{ return GetSRCDisasm(2); } }, | |
{ "$s", [this]{ return GetSRCDisasm(2); } }, | |
{ "$am", [this]{ return AddAddrMaskDisasm(); } }, | |
{ "$a", [this]{ return AddAddrRegDisasm(); } }, | |
{ "$t", [this]{ return GetTexDisasm(); } }, | |
{ "$fa", [this]{ return std::to_string(GetAddrDisasm()); } }, | |
{ "$ifcond ", [this] | |
{ | |
std::string cond = GetCondDisasm(); | |
if (cond == "true") cond.clear(); | |
return cond; | |
} | |
}, | |
{ "$cond", [this]{ return GetCondDisasm(); } }, | |
}; | |
return fmt::replace_all(code, repl_list); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment