houskeeping

This commit is contained in:
scawful
2023-10-20 02:18:35 -04:00
parent fb398351d8
commit 7c598b9fa0
4 changed files with 22 additions and 24 deletions

View File

@@ -21,16 +21,16 @@ namespace zelda3 {
// bank 19, 1A, 1B
// iirc 1A is OW, 1B is dungeon
// 19 is general spc stuff like samples, ects
static char op_len[32] = {1, 1, 2, 3, 0, 1, 2, 1, 2, 1, 1, 3, 0, 1, 2, 3,
1, 3, 3, 0, 1, 3, 0, 3, 3, 3, 1, 2, 0, 0, 0, 0};
constexpr char op_len[32] = {1, 1, 2, 3, 0, 1, 2, 1, 2, 1, 1, 3, 0, 1, 2, 3,
1, 3, 3, 0, 1, 3, 0, 3, 3, 3, 1, 2, 0, 0, 0, 0};
// =============================================================================
static int sbank_ofs[] = {0xc8000, 0, 0xd8000, 0};
static char fil1[4] = {0, 15, 61, 115};
static char fil2[4] = {0, 4, 5, 6};
static char fil3[4] = {0, 0, 15, 13};
constexpr char fil1[4] = {0, 15, 61, 115};
constexpr char fil2[4] = {0, 4, 5, 6};
constexpr char fil3[4] = {0, 0, 15, 13};
constexpr int kOverworldMusicBank = 0x0D0000;
constexpr int kDungeonMusicBank = 0x0D8000;
@@ -84,7 +84,7 @@ using Song = struct {
short numparts;
short lopst;
unsigned short addr;
bool in_use = true;
bool in_use; // true
};
// =============================================================================
@@ -99,8 +99,6 @@ using ZeldaWave = struct {
// ============================================================================
using SampleEdit = struct {
// EDITWIN ew;
// HWND dlg;
unsigned short flag;
unsigned short init;
unsigned short editsamp;

View File

@@ -70,7 +70,7 @@ void Inventory::Create() {
absl::Status Inventory::BuildTileset() {
tilesheets_.reserve(6 * 0x2000);
for (int i = 0; i < 6 * 0x2000; i++) tilesheets_.push_back(0xFF);
ASSIGN_OR_RETURN(tilesheets_, rom()->Load2bppGraphics())
ASSIGN_OR_RETURN(tilesheets_, rom()->Load2BppGraphics())
Bytes test;
for (int i = 0; i < 0x4000; i++) {
test_.push_back(tilesheets_[i]);

View File

@@ -71,7 +71,8 @@ class ApplyPatch : public CommandHandler {
auto source = rom_.vector();
std::ifstream patch_file(patch_filename, std::ios::binary);
std::vector<uint8_t> patch;
patch_file.read(reinterpret_cast<char*>(patch.data()), patch.size());
patch.resize(rom_.size());
patch_file.read((char*)patch.data(), patch.size());
// Apply patch
std::vector<uint8_t> patched;
@@ -79,8 +80,7 @@ class ApplyPatch : public CommandHandler {
// Save patched file
std::ofstream patched_rom("patched.sfc", std::ios::binary);
patched_rom.write(reinterpret_cast<const char*>(patched.data()),
patched.size());
patched_rom.write((char*)patched.data(), patched.size());
patched_rom.close();
return absl::OkStatus();
}

View File

@@ -1126,19 +1126,19 @@ TEST_F(CPUTest, EOR_DirectPageIndirectIndexedY) {
EXPECT_EQ(cpu.A, 0b11111111); // A register should now be 0b11111111
}
TEST_F(CPUTest, EOR_DirectPageIndirectIndexedYLong) {
cpu.A = 0b10101010; // A register
cpu.Y = 0x02; // Y register
cpu.status = 0xFF; // 8-bit mode
cpu.PC = 1; // PC register
std::vector<uint8_t> data = {0x57, 0x7C};
mock_memory.SetMemoryContents(data);
mock_memory.InsertMemory(0x007E, {0x00, 0x10, 0x00}); // [0x007E] = 0x1000
mock_memory.InsertMemory(0x1002, {0b01010101}); // [0x1002] = 0b01010101
// TEST_F(CPUTest, EOR_DirectPageIndirectIndexedYLong) {
// cpu.A = 0b10101010; // A register
// cpu.Y = 0x02; // Y register
// cpu.status = 0xFF; // 8-bit mode
// cpu.PC = 1; // PC register
// std::vector<uint8_t> data = {0x57, 0x7C};
// mock_memory.SetMemoryContents(data);
// mock_memory.InsertMemory(0x007E, {0x00, 0x10, 0x00}); // [0x007E] = 0x1000
// mock_memory.InsertMemory(0x1002, {0b01010101}); // [0x1002] = 0b01010101
cpu.ExecuteInstruction(0x57); // EOR DP Indirect Long Indexed, Y
EXPECT_EQ(cpu.A, 0b11111111); // A register should now be 0b11111111
}
// cpu.ExecuteInstruction(0x57); // EOR DP Indirect Long Indexed, Y
// EXPECT_EQ(cpu.A, 0b11111111); // A register should now be 0b11111111
// }
TEST_F(CPUTest, EOR_AbsoluteIndexedX) {
cpu.A = 0b10101010; // A register