他人の空似自作物置場

touhouSE_th145BGMOnly.zip/touhouSE_src/th135.cpp

#include "stdafx.h"

namespace TouhouSE {

namespace TH135 {

const unsigned char KEY[64] = {
  0xC7, 0x9A, 0x9E, 0x9B, 0xFB, 0xC2, 0x0C, 0xB0, 0xC3, 0xE7, 0xAE, 0x27, 0x49, 0x67, 0x62, 0x8A,
  0x78, 0xBB, 0xD1, 0x2C, 0xB2, 0x4D, 0xF4, 0x87, 0xC7, 0x09, 0x35, 0xF7, 0x01, 0xF8, 0x2E, 0xE5,
  0x49, 0x3B, 0x83, 0x6B, 0x84, 0x26, 0xAA, 0x42, 0x9A, 0xE1, 0xCC, 0xEE, 0x08, 0xA2, 0x15, 0x1C,
  0x42, 0xE7, 0x48, 0xB1, 0x9C, 0xCE, 0x7A, 0xD9, 0x40, 0x1A, 0x4D, 0xD4, 0x36, 0x37, 0x5C, 0x89,
};
const unsigned char PUBLIC_EXPONENT[3] = {
  0x01, 0x00, 0x01,
};
const unsigned char SIGNATURE_DATA[32] = {
  0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
};
const unsigned int MAX_DECRYPT_SIZE = _countof(KEY) - _countof(SIGNATURE_DATA);

class Owner : public Th135ArchiveExtractorBase<Owner> {
public:
  Owner(
    std::istream &in,
    std::unique_ptr<std::vector<std::shared_ptr<FileInfo> > > fileInfoList,
    std::vector<boost::filesystem::path> pathList,
    const unsigned int headerSize)
    :
    Th135ArchiveExtractorBase<Owner>(in, std::move(fileInfoList), std::move(pathList), headerSize)
  {}

  static const std::array<std::wstring, 20000> &getDirNameList() {
    return DIR_NAME_LIST;
  }

  static unsigned int calcHash(const std::string &in, const unsigned int init = 0x811C9DC5) {
    const std::string temp = Utility::wStrToStr(normalize(Utility::strToWStr(in)));
    // FNV1
    return std::accumulate(temp.begin(), temp.end(), init, [](const unsigned int cur, const char c) {
      return (cur * 0x1000193) ^ c;
    });
  }

  std::wstring GetName() const {
    return L"心綺楼";
  }
};

ADD_DAT_EXTRACTOR(Owner);

} // TH135

} // TouhouSE