This commit is contained in:
Jasmine 2025-03-11 10:44:38 -04:00
commit 06f7dc1540
5 changed files with 44 additions and 12 deletions
CMakeLists.txt
loader
include/Geode/cocos
actions
support/zip_support
src

View file

@ -15,6 +15,12 @@ endif()
option(GEODE_USE_BREAKPAD "Enables the use of the Breakpad library for crash dumps." ON)
# Check if git is installed, raise a fatal error if not
find_program(GIT_EXECUTABLE git)
if (NOT GIT_EXECUTABLE)
message(FATAL_ERROR "Git not found! Please install Git and try again.\nhttps://git-scm.com/")
endif()
# Read version
file(READ VERSION GEODE_VERSION)
string(STRIP "${GEODE_VERSION}" GEODE_VERSION)
@ -238,7 +244,7 @@ endif()
set(MAT_JSON_AS_INTERFACE ON)
CPMAddPackage("gh:geode-sdk/result@1.3.3")
CPMAddPackage("gh:geode-sdk/json@3.2.1")
CPMAddPackage("gh:fmtlib/fmt#11.0.2")
CPMAddPackage("gh:fmtlib/fmt#11.1.4")
target_compile_definitions(${PROJECT_NAME} INTERFACE MAT_JSON_DYNAMIC=1)

View file

@ -86,6 +86,9 @@ class CC_DLL CCEaseRateAction : public CCActionEase
{
GEODE_FRIEND_MODIFY
public:
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCEaseRateAction, CCActionEase);
CCEaseRateAction() {}
/**
* @js NA
* @lua NA

View file

@ -21,7 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef GEODE_IS_MEMBER_TEST
#ifndef __SUPPORT_ZIPUTILS_H__
#define __SUPPORT_ZIPUTILS_H__
@ -272,5 +271,3 @@ namespace cocos2d
};
} // end of namespace cocos2d
#endif // __SUPPORT_ZIPUTILS_H__
#endif

View file

@ -15,9 +15,30 @@ constexpr auto METADATA_TAG = 0xB324ABC;
struct ProxyCCNode;
static uint64_t fnv1aHash(char const* str) {
uint64_t hash = 0xcbf29ce484222325;
while (*str) {
hash ^= *str++;
hash *= 0x100000001b3;
}
return hash;
}
template <typename T>
class NoHashHasher;
template <>
class NoHashHasher<uint64_t> {
public:
size_t operator()(uint64_t key) const {
return key;
}
};
class GeodeNodeMetadata final : public cocos2d::CCObject {
private:
std::unordered_map<std::string, FieldContainer*> m_classFieldContainers;
// for performance reasons, this key is the hash of the class name
std::unordered_map<uint64_t, FieldContainer*, NoHashHasher<uint64_t>> m_classFieldContainers;
std::string m_id = "";
Ref<Layout> m_layout = nullptr;
Ref<LayoutOptions> m_layoutOptions = nullptr;
@ -63,10 +84,14 @@ public:
}
FieldContainer* getFieldContainer(char const* forClass) {
if (!m_classFieldContainers.count(forClass)) {
m_classFieldContainers[forClass] = new FieldContainer();
auto hash = fnv1aHash(forClass);
auto& container = m_classFieldContainers[hash];
if (!container) {
container = new FieldContainer();
}
return m_classFieldContainers[forClass];
return container;
}
};
@ -78,7 +103,7 @@ struct ProxyCCNode : Modify<ProxyCCNode, CCNode> {
return asNode->getUserObject("");
}
else {
// apparently this function is the same as
// apparently this function is the same as
// CCDirector::getNextScene so yeah
return m_pUserObject;
}
@ -224,7 +249,7 @@ public:
}
collectedID.push_back(c);
}
// Any other character is syntax error due to needing to reserve
// Any other character is syntax error due to needing to reserve
// stuff for possible future features
else {
return Err("Unexpected character '{}' at index {}", c, i);

View file

@ -25,10 +25,11 @@ void GenericContentLayer::setPosition(CCPoint const& pos) {
for (auto child : CCArrayExt<CCNode*>(m_pChildren)) {
float childY = this->getPositionY() + child->getPositionY();
float childTop = childY + (1.f - child->getAnchorPoint().y) * child->getScaledContentSize().height;
auto anchor = child->isIgnoreAnchorPointForPosition() ? CCPoint{ 0, 0 } : child->getAnchorPoint();
float childTop = childY + (1.f - anchor.y) * child->getScaledContentSize().height;
float childBottom = childY - child->getAnchorPoint().y * child->getScaledContentSize().height;
bool visible = childTop > 0 && childBottom < scrollLayerSize.height;
child->setVisible(visible);
}
}