Move memcard code to the mc namespace.
This commit is contained in:
parent
d7d1ca4a24
commit
15e7edbc72
11 changed files with 23 additions and 3 deletions
|
@ -15,6 +15,7 @@ namespace {
|
|||
} //unnamed namespace
|
||||
|
||||
int main() {
|
||||
using mc::MemoryCard;
|
||||
nana::form frm;
|
||||
|
||||
const MemoryCard mc1(std::ifstream("/home/michele/dev/code/cpp/memoserv/epsxe000_xa2.mcr", std::ios::binary));
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
#include "memcard/icon_fetch.hpp"
|
||||
|
||||
namespace duck {
|
||||
AnimationWithSize make_nana_animation (const ConstBlock& block, int width, int height, int fps) {
|
||||
AnimationWithSize make_nana_animation (const mc::ConstBlock& block, int width, int height, int fps) {
|
||||
nana::frameset fset;
|
||||
using mc::icon_fetch;
|
||||
|
||||
for (const auto& frame : icon_fetch(block, width, height)) {
|
||||
nana::paint::image img;
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
#include "animation_with_size.hpp"
|
||||
|
||||
namespace mc {
|
||||
template <bool> class BasicBlock;
|
||||
using ConstBlock = BasicBlock<true>;
|
||||
} //namespace mc
|
||||
|
||||
namespace duck {
|
||||
AnimationWithSize make_nana_animation (const ConstBlock& block, int width, int height, int fps);
|
||||
AnimationWithSize make_nana_animation (const mc::ConstBlock& block, int width, int height, int fps);
|
||||
} //namespace duck
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
//see: https://www.psdevwiki.com/ps3/PS1_Savedata#Memory_Card_Formats_PS1
|
||||
|
||||
namespace mc {
|
||||
enum class IconDisplayFlag {
|
||||
NoIcon = 0x00,
|
||||
OneFrame = 0x11,
|
||||
|
@ -63,3 +64,4 @@ inline int32_t calc_icon_count (IconDisplayFlag idf) {
|
|||
|
||||
using Block = BasicBlock<false>;
|
||||
using ConstBlock = BasicBlock<true>;
|
||||
} //namespace mc
|
||||
|
|
|
@ -3,4 +3,6 @@
|
|||
#include "memcard/block.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace mc {
|
||||
std::vector<std::vector<char>> icon_fetch (const ConstBlock& block, int width, int height);
|
||||
} //namespace mc
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "block.hpp"
|
||||
#include "memcard/block.hpp"
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
||||
namespace mc {
|
||||
class MemoryCard {
|
||||
public:
|
||||
MemoryCard();
|
||||
|
@ -19,3 +20,4 @@ public:
|
|||
private:
|
||||
std::vector<uint8_t> m_data;
|
||||
};
|
||||
} //namespace mc
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#define FLOAT_PALETTE_CONV
|
||||
|
||||
namespace mc {
|
||||
namespace {
|
||||
#if defined(FLOAT_PALETTE_CONV)
|
||||
uint8_t _5bit_to_8bit(int n) {
|
||||
|
@ -89,3 +90,4 @@ IconDisplayFlag BasicBlock<Const>::icon_display_flag() const {
|
|||
|
||||
template class BasicBlock<true>;
|
||||
template class BasicBlock<false>;
|
||||
} //namespace mc
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
namespace mc {
|
||||
namespace {
|
||||
namespace bmp {
|
||||
const uint16_t g_signature = 'B' bitor (static_cast<int>('M') << 8);
|
||||
|
@ -194,3 +195,4 @@ std::vector<std::vector<char>> icon_fetch (const ConstBlock& block, int width, i
|
|||
}
|
||||
return retval;
|
||||
}
|
||||
} //namespace mc
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <iterator>
|
||||
#include <cassert>
|
||||
|
||||
namespace mc {
|
||||
MemoryCard::MemoryCard() :
|
||||
m_data(8192 * 16)
|
||||
{
|
||||
|
@ -33,3 +34,4 @@ ConstBlock MemoryCard::operator[] (std::size_t index) const {
|
|||
assert(index < 15);
|
||||
return ConstBlock(m_data.data() + (index + 1) * Block::size());
|
||||
}
|
||||
} //namespace mc
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
namespace mc {
|
||||
namespace {
|
||||
template <typename T>
|
||||
[[gnu::pure]]
|
||||
|
@ -308,3 +309,4 @@ std::vector<float> blackmanharris_resize (
|
|||
|
||||
return retval;
|
||||
}
|
||||
} //namespace mc
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
namespace mc {
|
||||
std::vector<float> blackmanharris_resize (
|
||||
int in_w,
|
||||
int in_h,
|
||||
|
@ -9,3 +10,4 @@ std::vector<float> blackmanharris_resize (
|
|||
int out_w,
|
||||
int out_h
|
||||
);
|
||||
} //namespace mc
|
||||
|
|
Loading…
Add table
Reference in a new issue