chore: cleanup files and move common method

This commit is contained in:
Justin Scofield
2022-08-07 12:38:55 -04:00
parent 465b3fc49b
commit 3b24ce11d0
7 changed files with 20 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
#include "common.h"
#include <cstdint>
#include <string>
namespace yaze {
namespace app {
@@ -19,7 +20,7 @@ int AddressFromBytes(uint8_t addr1, uint8_t addr2, uint8_t addr3) {
}
// hextodec has been imported from SNESDisasm to parse hex numbers
int HexToDec(char* input, int length) {
int HexToDec(char *input, int length) {
int result = 0;
int value;
int ceiling = length - 1;
@@ -48,6 +49,15 @@ int HexToDec(char* input, int length) {
return result;
}
bool StringReplace(std::string &str, const std::string &from,
const std::string &to) {
size_t start = str.find(from);
if (start == std::string::npos) return false;
str.replace(start, from.length(), to);
return true;
}
} // namespace core
} // namespace app
} // namespace yaze