Refactor common functionality into zelda3 namespace; remove references to core::common
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
set(
|
||||
YAZE_APP_CORE_SRC
|
||||
app/core/common.cc
|
||||
app/core/controller.cc
|
||||
app/emu/emulator.cc
|
||||
app/core/project.cc
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "app/core/common.h"
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
|
||||
namespace yaze {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "app/core/common.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/gui/modules/text_editor.h"
|
||||
#include "app/gui/style.h"
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "app/core/common.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "app/core/common.h"
|
||||
#include "util/hex.h"
|
||||
#include "util/log.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "app/core/common.h"
|
||||
#include "app/core/features.h"
|
||||
#include "app/emu/cpu/internal/opcodes.h"
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/hyrule_magic.h"
|
||||
#include "util/macro.h"
|
||||
|
||||
#define DEBUG_LOG(msg) std::cout << msg << std::endl
|
||||
@@ -237,13 +238,13 @@ std::vector<uint8_t> HyruleMagicDecompress(uint8_t const* src, int* const size,
|
||||
|
||||
// rle 16-bit alternating copy
|
||||
|
||||
d = core::ldle16b(src);
|
||||
d = zelda3::ldle16b(src);
|
||||
|
||||
src += 2;
|
||||
|
||||
while (c > 1) {
|
||||
// copy that 16-bit number c/2 times into the b2 buffer.
|
||||
core::stle16b(b2 + bd, d);
|
||||
zelda3::stle16b(b2 + bd, d);
|
||||
|
||||
bd += 2;
|
||||
c -= 2; // hence c/2
|
||||
@@ -276,7 +277,7 @@ std::vector<uint8_t> HyruleMagicDecompress(uint8_t const* src, int* const size,
|
||||
if (p_big_endian) {
|
||||
d = (*src << 8) + src[1];
|
||||
} else {
|
||||
d = core::ldle16b(src);
|
||||
d = zelda3::ldle16b(src);
|
||||
}
|
||||
|
||||
while (c--) {
|
||||
@@ -459,8 +460,8 @@ void CompressionCommandAlternative(const uint8_t* rom_data,
|
||||
comp_accumulator = 0;
|
||||
}
|
||||
|
||||
void CheckByteRepeatV2(const uint8_t* data, uint& src_pos, const unsigned int last_pos,
|
||||
CompressionCommand& cmd) {
|
||||
void CheckByteRepeatV2(const uint8_t* data, uint& src_pos,
|
||||
const unsigned int last_pos, CompressionCommand& cmd) {
|
||||
unsigned int i = 0;
|
||||
while (src_pos + i < last_pos && data[src_pos] == data[src_pos + i]) {
|
||||
++i;
|
||||
@@ -469,8 +470,8 @@ void CheckByteRepeatV2(const uint8_t* data, uint& src_pos, const unsigned int la
|
||||
cmd.arguments[kCommandByteFill][0] = data[src_pos];
|
||||
}
|
||||
|
||||
void CheckWordRepeatV2(const uint8_t* data, uint& src_pos, const unsigned int last_pos,
|
||||
CompressionCommand& cmd) {
|
||||
void CheckWordRepeatV2(const uint8_t* data, uint& src_pos,
|
||||
const unsigned int last_pos, CompressionCommand& cmd) {
|
||||
if (src_pos + 2 <= last_pos && data[src_pos] != data[src_pos + 1]) {
|
||||
unsigned int pos = src_pos;
|
||||
char byte1 = data[pos];
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "app/core/common.h"
|
||||
#include "app/core/project.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "hyrule_magic.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace core {
|
||||
namespace zelda3 {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -76,5 +68,5 @@ uint16_t ldle16b_i(uint8_t const *const p_arr, size_t const p_index) {
|
||||
return ldle16b(p_arr + (2 * p_index));
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace yaze
|
||||
} // namespace zelda3
|
||||
} // namespace yaze
|
||||
@@ -1,23 +1,16 @@
|
||||
#ifndef YAZE_CORE_COMMON_H
|
||||
#define YAZE_CORE_COMMON_H
|
||||
#ifndef YAZE_APP_ZELDA3_HYRULE_MAGIC_H
|
||||
#define YAZE_APP_ZELDA3_HYRULE_MAGIC_H
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
|
||||
namespace yaze {
|
||||
|
||||
/**
|
||||
* @namespace yaze::core
|
||||
* @brief Core application logic and utilities.
|
||||
*/
|
||||
namespace core {
|
||||
|
||||
namespace zelda3 {
|
||||
/**
|
||||
* @brief Store little endian 16-bit value using a byte pointer, offset by an
|
||||
* index before dereferencing
|
||||
@@ -37,7 +30,7 @@ uint16_t ldle16b_i(uint8_t const *const p_arr, size_t const p_index);
|
||||
// Load little endian halfword (16-bit) dereferenced from
|
||||
uint16_t ldle16b(uint8_t const *const p_arr);
|
||||
|
||||
} // namespace core
|
||||
} // namespace zelda3
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
#endif // YAZE_APP_ZELDA3_HYRULE_MAGIC_H
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/hyrule_magic.h"
|
||||
#include "util/macro.h"
|
||||
|
||||
namespace yaze {
|
||||
@@ -923,9 +924,9 @@ void Tracker::SaveSongs(Rom &rom) {
|
||||
q = 1;
|
||||
|
||||
for (n = 0; n < 8; n++) {
|
||||
core::stle16b_i(trtbl->buf, n, SaveSpcCommand(rom, sp->tbl[n], p, q));
|
||||
stle16b_i(trtbl->buf, n, SaveSpcCommand(rom, sp->tbl[n], p, q));
|
||||
|
||||
if (core::ldle16b_i(trtbl->buf, n)) AddSpcReloc(trtbl, n << 1), q = 0;
|
||||
if (ldle16b_i(trtbl->buf, n)) AddSpcReloc(trtbl, n << 1), q = 0;
|
||||
}
|
||||
|
||||
sp->addr = trtbl->start;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
set(
|
||||
YAZE_APP_ZELDA3_SRC
|
||||
app/zelda3/hyrule_magic.cc
|
||||
app/zelda3/overworld/overworld_map.cc
|
||||
app/zelda3/overworld/overworld.cc
|
||||
app/zelda3/screen/inventory.cc
|
||||
|
||||
Reference in New Issue
Block a user