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

@@ -12,6 +12,7 @@
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "app/core/common.h"
#include "app/core/constants.h"
#include "app/rom.h"
@@ -19,15 +20,6 @@ namespace yaze {
namespace app {
namespace snes_asm {
static auto string_replace(std::string &str, const std::string &from,
const std::string &to) -> bool {
size_t start = str.find(from);
if (start == std::string::npos) return false;
str.replace(start, from.length(), to);
return true;
}
std::string GenerateBytePool(char mosaic_tiles[core::kNumOverworldMaps]) {
std::string to_return = "";
int column = 0;
@@ -89,12 +81,12 @@ absl::Status Script::GenerateMosaicChangeAssembly(
file.close();
auto assembly_string = assembly.str();
if (!string_replace(assembly_string, "<HOOK>", kMosaicChangeOffset)) {
if (!core::StringReplace(assembly_string, "<HOOK>", kMosaicChangeOffset)) {
return absl::InternalError(
"Mosaic template did not have proper `<HOOK>` to replace.");
}
if (!string_replace(
if (!core::StringReplace(
assembly_string, "<EXPANDED_SPACE>",
absl::StrFormat("$%x", routine_offset + kSNESToPCOffset))) {
return absl::InternalError(