Merge branch '1.4.0-dev' into android

This commit is contained in:
altalk23 2023-09-16 13:56:21 +03:00
commit fdc7e314d1
22 changed files with 109 additions and 89 deletions

17
.gitignore vendored
View file

@ -46,20 +46,29 @@ build2
build-docs/
bin
# Ignore docs folders
docs/**
docs
# Ignore codegenned files
loader/src/internal/about.hpp
loader/src/internal/resources.hpp
loader/resources/mod.json
loader/resources/version
loader/resources/blanks/rename.js
loader/resources/about.md
loader/resources/changelog.md
loader/resources/support.md
# Ignore generated files
installer/mac/*.pkg
installer/windows/*.exe
# Ignore fod's include directories which are stored in this funny file
fods-catgirl-hideout.txt
# Ignore I don't even know what that is probably fod's flash testing script
test-docs.bat
# krita files too because alk is funny
# Ignore krita files too because we don't want our project files shaking my head
**/*.kra
installer/mac/*.pkg
installer/windows/*.exe

View file

@ -1,5 +1,15 @@
# Geode Changelog
## v1.3.2
* Fix alignment of some textures (8f39c38)
* Bring back unknown problems (0663569)
* Fix some Windows 7 incompatibility (2d2bdd1)
* Remove enabled from the crashlogs (5b7d318)
* Make index unzipping async (7c582f1)
* Fix mods by developer crashing when mod was toggled (a6a47bf)
* Fix nested lists in the markdown (2723588)
* Fix search paths (8f39c38, aa55ebe)
## v1.3.1
* Fix TulipHook not relocating RIP relative operands on MacOS (6cad19d)

View file

@ -1 +1 @@
1.4.0
1.4.0

View file

@ -362,6 +362,7 @@ class cocos2d::CCImage {
class cocos2d::CCKeyboardDispatcher {
bool dispatchKeyboardMSG(cocos2d::enumKeyCodes, bool) = mac 0xe8190;
const char* keyToString(cocos2d::enumKeyCodes) = mac 0xe8450;
void updateModifierKeys(bool shft, bool ctrl, bool alt, bool cmd) = mac 0xe8430;
}
[[link(win, android)]]

View file

@ -4496,7 +4496,7 @@ class MoreOptionsLayer : FLAlertLayer, TextInputDelegate, GooglePlayDelegate {
static MoreOptionsLayer* create() = win 0x1de850;
virtual bool init() = mac 0x43f470, win 0x1DE8F0;
void addToggle(const char* name, const char* key, const char* info) = mac 0x440430, win 0x1df6b0;
void onKeybindings(cocos2d::CCObject* sender) = win 0x749d0;
void onKeybindings(cocos2d::CCObject* sender) = mac 0x4410e0, win 0x749d0;
void onToggle(cocos2d::CCObject* sender) = mac 0x441370;
}

View file

@ -307,6 +307,8 @@ function(package_geode_resources_now proname src dest header_dest)
if (NOT FILE_NAME STREQUAL ".geode_cache" AND NOT FILE_SHOULD_HASH EQUAL -1)
file(SHA256 ${file} COMPUTED_HASH)
file(SIZE ${file} FILE_SIZE)
message(STATUS "Hashed ${file} to ${COMPUTED_HASH} (${FILE_SIZE} bytes)")
list(APPEND HEADER_FILE "\t{ \"${FILE_NAME}\", \"${COMPUTED_HASH}\" },\n")
# list(APPEND HEADER_FILE "\t\"${FILE_NAME}\",\n")

View file

@ -185,7 +185,8 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const&
single_output += fmt::format(::format_strings::class_start,
fmt::arg("class_name", cls.name),
fmt::arg("base_classes", supers)
fmt::arg("base_classes", supers)//,
// fmt::arg("hidden", str_if("GEODE_HIDDEN ", (codegen::platform & (Platform::Mac | Platform::iOS)) != Platform::None))
);
// what.

View file

@ -27,10 +27,13 @@ execute_process(
)
# Package info file for internal representation
set(GEODE_RESOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources)
configure_file(resources/mod.json.in ${CMAKE_CURRENT_SOURCE_DIR}/resources/mod.json)
file(READ resources/mod.json LOADER_MOD_JSON)
configure_file(${GEODE_ROOT_PATH}/VERSION ${CMAKE_CURRENT_SOURCE_DIR}/resources/version COPYONLY)
configure_file(${GEODE_ROOT_PATH}/CHANGELOG.md ${CMAKE_CURRENT_SOURCE_DIR}/resources/changelog.md COPYONLY)
configure_file(${GEODE_ROOT_PATH}/VERSION ${GEODE_RESOURCES_PATH}/version COPYONLY)
configure_file(${GEODE_RESOURCES_PATH}/about.md.in ${GEODE_RESOURCES_PATH}/about.md NEWLINE_STYLE LF)
configure_file(${GEODE_ROOT_PATH}/CHANGELOG.md ${GEODE_RESOURCES_PATH}/changelog.md NEWLINE_STYLE LF)
configure_file(${GEODE_RESOURCES_PATH}/support.md.in ${GEODE_RESOURCES_PATH}/support.md NEWLINE_STYLE LF)
configure_file(src/internal/about.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/src/internal/about.hpp)
# Source files

View file

@ -3,12 +3,8 @@
#include <android/log.h>
#ifdef GEODE_EXPORTING
#define CC_DLL __attribute__((visibility("default")))
#else
#define CC_DLL
#endif
#define ACTUAL_CC_DLL CC_DLL
#define CC_DLL
#define ACTUAL_CC_DLL
#define CC_NO_MESSAGE_PSEUDOASSERT(cond) \
if (!(cond)) { \

View file

@ -3,12 +3,8 @@
#include <assert.h>
#ifdef GEODE_EXPORTING
#define CC_DLL __attribute__((visibility("default")))
#else
#define CC_DLL
#endif
#define ACTUAL_CC_DLL CC_DLL
#define CC_DLL //__attribute__((visibility("hidden")))
#define ACTUAL_CC_DLL
#define CC_ASSERT(cond) assert(cond)

View file

@ -3,12 +3,8 @@
#include <assert.h>
#ifdef GEODE_EXPORTING
#define CC_DLL __attribute__((visibility("default")))
#else
#define CC_DLL
#endif
#define ACTUAL_CC_DLL CC_DLL
#define CC_DLL //__attribute__((visibility("hidden")))
#define ACTUAL_CC_DLL
#if CC_DISABLE_ASSERT > 0

View file

@ -13,7 +13,6 @@
#include <Geode/utils/ranges.hpp>
#include <Geode/utils/MiniFunction.hpp>
#include "ModImpl.hpp"
#include <about.hpp>
#include <crashlog.hpp>
#include <mutex>
#include <optional>

View file

@ -592,7 +592,6 @@ ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const {
}
char const* Mod::Impl::expandSpriteName(char const* name) {
log::debug("Expanding sprite name {} for {}", name, m_metadata.getID());
if (m_expandedSprites.count(name)) return m_expandedSprites[name];
auto exp = new char[strlen(name) + 2 + m_metadata.getID().size()];

View file

@ -5,8 +5,9 @@
#include "../list/ModListCell.hpp"
#include "../list/ModListLayer.hpp"
bool DevProfilePopup::setup(std::string const& developer) {
bool DevProfilePopup::setup(std::string const& developer, ModListLayer* list) {
m_noElasticity = true;
m_layer = list;
this->setTitle("Mods by " + developer);
@ -18,7 +19,7 @@ bool DevProfilePopup::setup(std::string const& developer) {
for (auto& mod : Loader::get()->getAllMods()) {
if (mod->getDeveloper() == developer) {
auto cell = ModCell::create(
mod, nullptr, ModListDisplay::Concise, { 358.f, 40.f }
mod, m_layer, ModListDisplay::Concise, { 358.f, 40.f }
);
cell->disableDeveloperButton();
items->addObject(cell);
@ -31,7 +32,7 @@ bool DevProfilePopup::setup(std::string const& developer) {
continue;
}
auto cell = IndexItemCell::create(
item, nullptr, ModListDisplay::Concise, { 358.f, 40.f }
item, m_layer, ModListDisplay::Concise, { 358.f, 40.f }
);
cell->disableDeveloperButton();
items->addObject(cell);
@ -39,18 +40,18 @@ bool DevProfilePopup::setup(std::string const& developer) {
// mods list
auto listSize = CCSize { 358.f, 160.f };
auto list = ListView::create(items, 40.f, listSize.width, listSize.height);
list->setPosition(winSize / 2 - listSize / 2);
m_mainLayer->addChild(list);
auto cellList = ListView::create(items, 40.f, listSize.width, listSize.height);
cellList->setPosition(winSize / 2 - listSize / 2);
m_mainLayer->addChild(cellList);
addListBorders(m_mainLayer, winSize / 2, listSize);
return true;
}
DevProfilePopup* DevProfilePopup::create(std::string const& developer) {
DevProfilePopup* DevProfilePopup::create(std::string const& developer, ModListLayer* list) {
auto ret = new DevProfilePopup();
if (ret && ret->init(420.f, 260.f, developer)) {
if (ret && ret->init(420.f, 260.f, developer, list)) {
ret->autorelease();
return ret;
}

View file

@ -4,10 +4,14 @@
using namespace geode::prelude;
class DevProfilePopup : public Popup<std::string const&> {
class ModListLayer;
class DevProfilePopup : public Popup<std::string const&, ModListLayer*> {
protected:
bool setup(std::string const& developer) override;
ModListLayer* m_layer;
bool setup(std::string const& developer, ModListLayer* list) override;
public:
static DevProfilePopup* create(std::string const& developer);
static DevProfilePopup* create(std::string const& developer, ModListLayer* list);
};

View file

@ -4,6 +4,7 @@
#include "../list/ModListLayer.hpp"
#include "../settings/ModSettingsPopup.hpp"
#include <Geode/loader/Dirs.hpp>
#include <about.hpp>
#include <Geode/binding/ButtonSprite.hpp>
#include <Geode/binding/CCTextInputNode.hpp>

View file

@ -53,24 +53,21 @@ void InstallListCell::setupInfo(
}
this->addChild(m_titleLabel);
m_developerBtn = nullptr;
m_creatorLabel = nullptr;
if (developer) {
auto creatorStr = "by " + *developer;
auto creatorLabel = CCLabelBMFont::create(creatorStr.c_str(), "goldFont.fnt");
creatorLabel->setScale(.34f);
m_creatorLabel = CCLabelBMFont::create(creatorStr.c_str(), "goldFont.fnt");
m_creatorLabel->setScale(.34f);
if (inactive) {
creatorLabel->setColor({ 163, 163, 163 });
m_creatorLabel->setColor({ 163, 163, 163 });
}
m_developerBtn = CCMenuItemSpriteExtra::create(
creatorLabel, this, menu_selector(InstallListCell::onViewDev)
);
m_developerBtn->setPosition(
m_creatorLabel->setPosition(
m_titleLabel->getPositionX() + m_titleLabel->getScaledContentSize().width + 3.f +
creatorLabel->getScaledContentSize().width / 2,
m_creatorLabel->getScaledContentSize().width / 2,
m_height / 2
);
m_menu->addChild(m_developerBtn);
m_menu->addChild(m_creatorLabel);
}
this->setupVersion(version);
@ -96,7 +93,7 @@ void InstallListCell::setupVersion(std::variant<VersionInfo, ComparableVersionIn
m_versionLabel->setScale(.2f);
m_versionLabel->setPosition(
m_titleLabel->getPositionX() + m_titleLabel->getScaledContentSize().width + 3.f +
(m_developerBtn ? m_developerBtn->getScaledContentSize().width + 3.f : 0.f),
(m_creatorLabel ? m_creatorLabel->getScaledContentSize().width + 3.f : 0.f),
m_titleLabel->getPositionY() - 1.f
);
m_versionLabel->setColor({ 0, 255, 0 });
@ -123,7 +120,7 @@ void InstallListCell::setupInfo(ModMetadata const& metadata, bool inactive) {
}
void InstallListCell::onViewDev(CCObject*) {
DevProfilePopup::create(getDeveloper())->show();
// DevProfilePopup::create(getDeveloper(), m_layer)->show();
}
bool InstallListCell::init(InstallListPopup* list, CCSize const& size) {

View file

@ -21,7 +21,7 @@ protected:
float m_height;
InstallListPopup* m_layer = nullptr;
CCMenu* m_menu = nullptr;
CCMenuItemSpriteExtra* m_developerBtn = nullptr;
CCLabelBMFont* m_creatorLabel = nullptr;
CCLabelBMFont* m_titleLabel = nullptr;
CCLabelBMFont* m_versionLabel = nullptr;
TagNode* m_tagLabel = nullptr;

View file

@ -186,7 +186,7 @@ void ModListCell::updateCellLayout() {
}
void ModListCell::onViewDev(CCObject*) {
DevProfilePopup::create(this->getDeveloper())->show();
DevProfilePopup::create(this->getDeveloper(), m_layer)->show();
}
bool ModListCell::init(ModListLayer* list, CCSize const& size) {
@ -233,7 +233,9 @@ void ModCell::onEnable(CCObject* sender) {
else {
tryOrAlert(m_mod->disable(), "Error disabling mod");
}
m_layer->reloadList();
if (m_layer) {
m_layer->reloadList();
}
}
void ModCell::onUnresolvedInfo(CCObject*) {

View file

@ -21,48 +21,51 @@ using namespace geode::prelude;
using namespace geode::utils::file;
Result<std::string> utils::file::readString(ghc::filesystem::path const& path) {
if (!ghc::filesystem::exists(path))
return Err("File does not exist");
#if _WIN32
std::ifstream in(path.wstring(), std::ios::in | std::ios::binary);
#else
std::ifstream in(path.string(), std::ios::in | std::ios::binary);
#endif
if (in) {
std::string contents;
in.seekg(0, std::ios::end);
contents.resize((const size_t)in.tellg());
in.seekg(0, std::ios::beg);
in.read(&contents[0], contents.size());
in.close();
return Ok(contents);
}
return Err("Unable to open file");
if (!in)
return Err("Unable to open file");
std::string contents;
in.seekg(0, std::ios::end);
contents.resize((const size_t)in.tellg());
in.seekg(0, std::ios::beg);
in.read(&contents[0], contents.size());
in.close();
return Ok(contents);
}
Result<json::Value> utils::file::readJson(ghc::filesystem::path const& path) {
auto str = utils::file::readString(path);
if (str) {
try {
return Ok(json::parse(str.value()));
} catch(std::exception const& e) {
return Err("Unable to parse JSON: " + std::string(e.what()));
}
} else {
return Err("Unable to open file");
if (!str)
return Err(str.unwrapErr());
try {
return Ok(json::parse(str.value()));
}
catch(std::exception const& e) {
return Err("Unable to parse JSON: " + std::string(e.what()));
}
}
Result<ByteVector> utils::file::readBinary(ghc::filesystem::path const& path) {
if (!ghc::filesystem::exists(path))
return Err("File does not exist");
#if _WIN32
std::ifstream in(path.wstring(), std::ios::in | std::ios::binary);
#else
std::ifstream in(path.string(), std::ios::in | std::ios::binary);
#endif
if (in) {
return Ok(ByteVector(std::istreambuf_iterator<char>(in), {}));
}
return Err("Unable to open file");
if (!in)
return Err("Unable to open file");
return Ok(ByteVector(std::istreambuf_iterator<char>(in), {}));
}
Result<> utils::file::writeString(ghc::filesystem::path const& path, std::string const& data) {
@ -72,14 +75,14 @@ Result<> utils::file::writeString(ghc::filesystem::path const& path, std::string
#else
file.open(path.string());
#endif
if (file.is_open()) {
file << data;
if (!file.is_open()) {
file.close();
return Ok();
return Err("Unable to open file");
}
file << data;
file.close();
return Err("Unable to open file");
return Ok();
}
Result<> utils::file::writeBinary(ghc::filesystem::path const& path, ByteVector const& data) {
@ -89,14 +92,14 @@ Result<> utils::file::writeBinary(ghc::filesystem::path const& path, ByteVector
#else
file.open(path.string(), std::ios::out | std::ios::binary);
#endif
if (file.is_open()) {
file.write(reinterpret_cast<char const*>(data.data()), data.size());
if (!file.is_open()) {
file.close();
return Ok();
return Err("Unable to open file");
}
file.write(reinterpret_cast<char const*>(data.data()), data.size());
file.close();
return Err("Unable to open file");
return Ok();
}
Result<> utils::file::createDirectory(ghc::filesystem::path const& path) {