Add virtual bad word list; Load if dump is missing

This commit is contained in:
B3n30 2018-07-22 22:50:31 +02:00
parent 8388e5519b
commit 7605e26b94
3 changed files with 147 additions and 2 deletions

View file

@ -7,6 +7,7 @@
#include <memory>
#include <utility>
#include <vector>
#include "bad_word_list.app.romfs.h"
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/logging/log.h"
@ -133,7 +134,19 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
}
} else if (high == system_data_archive) {
if (low == ng_word_list)
archive_name = "NG bad word list";
LOG_WARNING(
Service_FS,
"Bad Word List file missing. Loading open source replacement from memory");
std::vector<u8> bad_word_list_file;
bad_word_list_file.assign(BAD_WORD_LIST_DATA,
BAD_WORD_LIST_DATA + BAD_WORD_LIST_DATA_len);
u64 romfs_offset = 0;
u64 romfs_size = bad_word_list_file.size();
std::unique_ptr<DelayGenerator> delay_generator =
std::make_unique<RomFSDelayGenerator>();
file = std::make_unique<IVFCFileInMemory>(std::move(bad_word_list_file), romfs_offset,
romfs_size, std::move(delay_generator));
return MakeResult<std::unique_ptr<FileBackend>>(std::move(file));
}
if (!archive_name.empty()) {