mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
replace ByteBuffer with std::vector
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "loader/gamePatch.h"
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/stringUtils.h"
|
||||
#include "common/virtualMemory.h"
|
||||
#include "kernel/memory.h"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "loader/systemContent.h"
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/byteBuffer.h"
|
||||
#include "common/common.h"
|
||||
#include "common/file.h"
|
||||
#include "common/logging/log.h"
|
||||
@@ -121,7 +120,7 @@ void Psf::OpenJson(const std::filesystem::path& file_name) {
|
||||
}
|
||||
|
||||
auto buf = f.ReadWholeBuffer();
|
||||
if (buf.Size() == 0) {
|
||||
if (buf.empty()) {
|
||||
LOGF("invalid json file: %s\n", Common::PathToString(file_name).c_str());
|
||||
f.Close();
|
||||
return;
|
||||
@@ -131,8 +130,8 @@ void Psf::OpenJson(const std::filesystem::path& file_name) {
|
||||
std::vector<std::string> localized_languages;
|
||||
std::vector<std::string> localized_titles;
|
||||
|
||||
const auto* json_begin = reinterpret_cast<const char*>(buf.GetDataConst());
|
||||
const auto* json_end = json_begin + buf.Size();
|
||||
const auto* json_begin = reinterpret_cast<const char*>(buf.data());
|
||||
const auto* json_end = json_begin + buf.size();
|
||||
auto param_json = nlohmann::ordered_json::parse(json_begin, json_end, nullptr, false);
|
||||
if (param_json.is_discarded() || !param_json.is_object()) {
|
||||
LOGF("invalid json file: %s\n", Common::PathToString(file_name).c_str());
|
||||
@@ -432,12 +431,12 @@ void PlayGo::OpenChunkDefs(const std::filesystem::path& file_name) {
|
||||
auto buf = f.ReadWholeBuffer();
|
||||
f.Close();
|
||||
|
||||
if (buf.Size() == 0) {
|
||||
if (buf.empty()) {
|
||||
LOGF("invalid file: %s\n", Common::PathToString(file_name).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string_view xml(reinterpret_cast<const char*>(buf.GetDataConst()), buf.Size());
|
||||
const std::string_view xml(reinterpret_cast<const char*>(buf.data()), buf.size());
|
||||
|
||||
uint32_t max_chunk_id = 0;
|
||||
bool found = false;
|
||||
@@ -509,9 +508,9 @@ void PlayGo::OpenChunkManifest(const std::filesystem::path& file_name) {
|
||||
bool chunks[1000] {};
|
||||
uint32_t max_chunk_id = 0;
|
||||
bool found = false;
|
||||
const auto* data = buf.GetDataConst();
|
||||
const auto* data = buf.data();
|
||||
|
||||
for (size_t pos = 0; pos + sizeof(id_field) + sizeof(uint32_t) <= buf.Size(); pos++) {
|
||||
for (size_t pos = 0; pos + sizeof(id_field) + sizeof(uint32_t) <= buf.size(); pos++) {
|
||||
if (std::memcmp(data + pos, id_field, sizeof(id_field)) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user