Removed all key autogeneration code
This commit is contained in:
parent
1320eae273
commit
e2003a5b6b
|
@ -648,17 +648,13 @@ void KeyManager::ReloadKeys() {
|
||||||
|
|
||||||
if (Settings::values.use_dev_keys) {
|
if (Settings::values.use_dev_keys) {
|
||||||
dev_mode = true;
|
dev_mode = true;
|
||||||
LoadFromFile(sudachi_keys_dir / "dev.keys_autogenerated", false);
|
|
||||||
LoadFromFile(sudachi_keys_dir / "dev.keys", false);
|
LoadFromFile(sudachi_keys_dir / "dev.keys", false);
|
||||||
} else {
|
} else {
|
||||||
dev_mode = false;
|
dev_mode = false;
|
||||||
LoadFromFile(sudachi_keys_dir / "prod.keys_autogenerated", false);
|
|
||||||
LoadFromFile(sudachi_keys_dir / "prod.keys", false);
|
LoadFromFile(sudachi_keys_dir / "prod.keys", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadFromFile(sudachi_keys_dir / "title.keys_autogenerated", true);
|
|
||||||
LoadFromFile(sudachi_keys_dir / "title.keys", true);
|
LoadFromFile(sudachi_keys_dir / "title.keys", true);
|
||||||
LoadFromFile(sudachi_keys_dir / "console.keys_autogenerated", false);
|
|
||||||
LoadFromFile(sudachi_keys_dir / "console.keys", false);
|
LoadFromFile(sudachi_keys_dir / "console.keys", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,18 +843,11 @@ Key256 KeyManager::GetBISKey(u8 partition_id) const {
|
||||||
template <size_t Size>
|
template <size_t Size>
|
||||||
void KeyManager::WriteKeyToFile(KeyCategory category, std::string_view keyname,
|
void KeyManager::WriteKeyToFile(KeyCategory category, std::string_view keyname,
|
||||||
const std::array<u8, Size>& key) {
|
const std::array<u8, Size>& key) {
|
||||||
const auto sudachi_keys_dir = Common::FS::GetSudachiPath(Common::FS::SudachiPath::KeysDir);
|
const auto& sudachi_keys_dir = Common::FS::GetSudachiPath(Common::FS::SudachiPath::KeysDir);
|
||||||
|
|
||||||
std::string filename = "title.keys_autogenerated";
|
std::string filename = "title.keys";
|
||||||
|
|
||||||
if (category == KeyCategory::Standard) {
|
|
||||||
filename = dev_mode ? "dev.keys_autogenerated" : "prod.keys_autogenerated";
|
|
||||||
} else if (category == KeyCategory::Console) {
|
|
||||||
filename = "console.keys_autogenerated";
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto path = sudachi_keys_dir / filename;
|
const auto path = sudachi_keys_dir / filename;
|
||||||
const auto add_info_text = !Common::FS::Exists(path);
|
|
||||||
|
|
||||||
Common::FS::IOFile file{path, Common::FS::FileAccessMode::Append,
|
Common::FS::IOFile file{path, Common::FS::FileAccessMode::Append,
|
||||||
Common::FS::FileType::TextFile};
|
Common::FS::FileType::TextFile};
|
||||||
|
@ -867,14 +856,6 @@ void KeyManager::WriteKeyToFile(KeyCategory category, std::string_view keyname,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (add_info_text) {
|
|
||||||
void(file.WriteString(
|
|
||||||
"# This file is autogenerated by Sudachi\n"
|
|
||||||
"# It serves to store keys that were automatically generated from the normal keys\n"
|
|
||||||
"# If you are experiencing issues involving keys, it may help to delete this file\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void(file.WriteString(fmt::format("\n{} = {}", keyname, Common::HexToString(key))));
|
|
||||||
LoadFromFile(path, category == KeyCategory::Title);
|
LoadFromFile(path, category == KeyCategory::Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,7 +864,7 @@ void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (id == S128KeyType::Titlekey) {
|
if (id == S128KeyType::Titlekey) {
|
||||||
Key128 rights_id;
|
Key128 rights_id{};
|
||||||
std::memcpy(rights_id.data(), &field2, sizeof(u64));
|
std::memcpy(rights_id.data(), &field2, sizeof(u64));
|
||||||
std::memcpy(rights_id.data() + sizeof(u64), &field1, sizeof(u64));
|
std::memcpy(rights_id.data() + sizeof(u64), &field1, sizeof(u64));
|
||||||
WriteKeyToFile(KeyCategory::Title, Common::HexToString(rights_id), key);
|
WriteKeyToFile(KeyCategory::Title, Common::HexToString(rights_id), key);
|
||||||
|
|
Loading…
Reference in New Issue