Fix ROM title extraction in LoadZelda3 function

Resized the `title_` variable to `kTitleStringLength` to ensure it can hold the ROM title string. Used `std::copy` to copy the ROM title from `rom_data_` starting at `kTitleStringOffset` to `kTitleStringOffset + kTitleStringLength` into the `title_` variable. This change ensures that the `title_` variable correctly stores the ROM title extracted from the `rom_data_`.
This commit is contained in:
Justin Scofield
2024-12-31 18:53:33 -05:00
parent 5e1e2901ff
commit 7b00e0838f

View File

@@ -244,6 +244,7 @@ absl::Status Rom::LoadZelda3() {
// Copy ROM title
constexpr uint32_t kTitleStringOffset = 0x7FC0;
constexpr uint32_t kTitleStringLength = 20;
title_.resize(kTitleStringLength);
std::copy(rom_data_.begin() + kTitleStringOffset,
rom_data_.begin() + kTitleStringOffset + kTitleStringLength,
title_.begin());