他人の空似自作物置場

touhouSE_th145BGMOnly.zip/touhouSE_src/nfa0_v2x.cpp

#include "stdafx.h"

namespace NFA0_V2X {

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])) {
      const unsigned char temp = (c ^ (c >> 4));
      c = rotateRight(temp ^ (temp << 4), 0xE7);
    }
  }

private:
  static unsigned char rotateRight(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"不思議の幻想郷3";
  }
};

ADD_DAT_EXTRACTOR(Owner);

} // NFA0_V21