他人の空似自作物置場

touhouSE_th145BGMOnly.zip/touhouSE_src/nfa0_v21.cpp

#include "stdafx.h"

namespace NFA0_V21 {

namespace endian = boost::spirit::endian;

class Decryptor {
public:
  static void Decrypt(unsigned char * const buf, const unsigned int size) {
    BOOST_FOREACH(unsigned char &c, std::make_pair(buf, &buf[size])) {
      c = rotate(c, 0xE7);
      c ^= 0xE7;
    }
  }

private:
  static unsigned char rotate(unsigned char c, unsigned int rawShift) {
    const unsigned int shift = rawShift % 8;
    return (c >> shift) + (c << (8 - shift));
  }
};

class Owner : public NFA0_V2_BASE::Owner<Owner, Decryptor> {
public:
  Owner(std::istream &in, const boost::shared_ptr<const std::vector<NFA0_V2_BASE::FileRecord> > fileList) : NFA0_V2_BASE::Owner<Owner, Decryptor>(in, fileList) {
  }
  std::wstring GetName() const {
    return L"不思議の幻想郷2.1";
  }
};

ADD_DAT_EXTRACTOR(Owner);

} // NFA0_V21