add yaze_check_version and core::CheckVersion
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
@@ -322,6 +323,17 @@ void ApplyBpsPatch(const std::vector<uint8_t> &source,
|
||||
}
|
||||
}
|
||||
|
||||
absl::StatusOr<std::string> CheckVersion(const char* version) {
|
||||
std::string version_string = version;
|
||||
if (version_string != kYazeVersion) {
|
||||
std::string message = absl::StrFormat(
|
||||
"Yaze version mismatch: expected %s, got %s", kYazeVersion,
|
||||
version_string.c_str());
|
||||
return absl::InvalidArgumentError(message);
|
||||
}
|
||||
return version_string;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -271,6 +271,8 @@ void ApplyBpsPatch(const std::vector<uint8_t> &source,
|
||||
const std::vector<uint8_t> &patch,
|
||||
std::vector<uint8_t> &target);
|
||||
|
||||
absl::StatusOr<std::string> CheckVersion(const char *version);
|
||||
|
||||
} // namespace core
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
Reference in New Issue
Block a user