Merge branch 'main' into main

This commit is contained in:
alk 2022-10-20 21:07:27 +03:00 committed by GitHub
commit e18a693f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 1522 additions and 1507 deletions

View file

@ -36,6 +36,7 @@ class cocos2d::CCArray {
auto fastRemoveObject(cocos2d::CCObject*) = mac 0x41a520;
auto fastRemoveObjectAtIndex(unsigned int) = mac 0x41a500;
auto fastRemoveObjectAtIndexNew(unsigned int) = mac 0x41a510;
auto insertObject(cocos2d::CCObject*, unsigned int) = mac 0x41a460;
auto lastObject() = mac 0x41a360;
auto objectAtIndex(unsigned int) = mac 0x41a340, ios 0x16510c;
auto removeAllObjects() = mac 0x41a4f0, ios 0x1651f0;

File diff suppressed because it is too large Load diff

View file

@ -163,17 +163,22 @@ function(package_geode_resources_now proname src dest header_dest)
file(GLOB RESOURCE_FILES "${dest}/*.*")
set(HEADER_FILE
"#include <unordered_map>\n\n"
"static const std::unordered_map<std::string, std::string> "
"LOADER_RESOURCE_HASHES {\n"
#[["#include <unordered_map>\n\n"]]
#[["static const std::unordered_map<std::string, std::string> "]]
#[["LOADER_RESOURCE_HASHES {\n"]]
"#include <vector>\n\n"
"static const std::vector<std::string> "
"LOADER_RESOURCE_FILES {\n"
)
foreach(file ${RESOURCE_FILES})
cmake_path(GET file FILENAME FILE_NAME)
if (NOT FILE_NAME STREQUAL ".geode_cache")
file(SHA256 ${file} COMPUTED_HASH)
list(APPEND HEADER_FILE "\t{ \"${FILE_NAME}\", \"${COMPUTED_HASH}\" },\n")
# file(SHA256 ${file} COMPUTED_HASH)
# list(APPEND HEADER_FILE "\t{ \"${FILE_NAME}\", \"${COMPUTED_HASH}\" },\n")
list(APPEND HEADER_FILE "\t\"${FILE_NAME}\",\n")
endif()

View file

@ -29,23 +29,28 @@ namespace geode {
namespace log {
using log_clock = std::chrono::system_clock;
std::string generateLogName();
GEODE_DLL std::string generateLogName();
std::string parse(cocos2d::CCNode*);
GEODE_DLL std::string parse(cocos2d::CCNode*);
template <class T>
requires std::convertible_to<T*, cocos2d::CCNode*>
std::string parse(T* node) {
return parse(static_cast<cocos2d::CCNode*>(node));
}
std::string parse(cocos2d::CCPoint const&);
std::string parse(cocos2d::CCSize const&);
std::string parse(cocos2d::CCRect const&);
std::string parse(cocos2d::CCArray*);
std::string parse(cocos2d::ccColor3B const&);
std::string parse(cocos2d::ccColor4B const&);
std::string parse(cocos2d::ccColor4F const&);
std::string parse(cocos2d::CCObject*);
std::string parse(Mod*);
GEODE_DLL std::string parse(cocos2d::CCPoint const&);
GEODE_DLL std::string parse(cocos2d::CCSize const&);
GEODE_DLL std::string parse(cocos2d::CCRect const&);
GEODE_DLL std::string parse(cocos2d::CCArray*);
GEODE_DLL std::string parse(cocos2d::ccColor3B const&);
GEODE_DLL std::string parse(cocos2d::ccColor4B const&);
GEODE_DLL std::string parse(cocos2d::ccColor4F const&);
GEODE_DLL std::string parse(cocos2d::CCObject*);
template <class T>
requires (std::convertible_to<T*, cocos2d::CCObject*> && !std::convertible_to<T*, cocos2d::CCNode*>)
std::string parse(T* node) {
return parse(static_cast<cocos2d::CCObject*>(node));
}
GEODE_DLL std::string parse(Mod*);
template <typename T>
requires requires(T b) { std::stringstream() << b; }

View file

@ -180,20 +180,23 @@ bool InternalLoader::verifyLoaderResources(IndexUpdateCallback callback) {
for (auto& file : ghc::filesystem::directory_iterator(resourcesDir)) {
auto name = file.path().filename().string();
// skip unknown files
if (!LOADER_RESOURCE_HASHES.count(name)) {
if (/*!LOADER_RESOURCE_HASHES.count(name)*/
std::find(LOADER_RESOURCE_FILES.begin(), LOADER_RESOURCE_FILES.end(), name)
== LOADER_RESOURCE_FILES.end()) {
continue;
}
// verify hash
auto hash = calculateSHA256(file.path());
if (hash != LOADER_RESOURCE_HASHES.at(name)) {
this->downloadLoaderResources(callback);
return false;
}
// auto hash = calculateSHA256(file.path());
// if (hash != LOADER_RESOURCE_HASHES.at(name)) {
// log::debug("compare {} {} {}", file.path().string(), hash, LOADER_RESOURCE_HASHES.at(name));
// this->downloadLoaderResources(callback);
// return false;
// }
coverage += 1;
}
// make sure every file was found
if (coverage != LOADER_RESOURCE_HASHES.size()) {
if (coverage != /*LOADER_RESOURCE_HASHES*/ LOADER_RESOURCE_FILES.size()) {
this->downloadLoaderResources(callback);
return false;
}