Merge pull request #334 from geode-sdk/1.4-merge-temp

Update 1.4.0 with main commits
This commit is contained in:
mat 2023-11-10 00:19:38 -03:00 committed by GitHub
commit fdd4d61fb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 777 additions and 608 deletions

View file

@ -27,6 +27,18 @@
* Check modified date when unzipping `.geode` files (5c765c6)
* Only hash markdown files on resource checking (f563c46)
## v1.3.6
* Allow error responses in our WebRequest classes (237128bf)
* Display unhandled C++ exceptions in crash log (fdd78aca, 0d091626, 52421d8c, 0472075f)
* Fix GEODE_CLI force caching when not found (0a113744)
* Only write checksum file after unzipping, fixes inconsistent index state (b4fbea51)
* Fix the index notif staying on all the time (c967b520)
* Bump minimum required CMake version in codegen (27ed63e7)
* Only show update indicator if mod is enabled (8762714c)
* Fix FLAlertLayer m_scrollingLayer not being a ScrollingLayer (9694b35d)
* Fix gnustl vector dtor (b55e6465, 0bdb0df7)
* Loads of bindings changes
## v1.3.5
* Follow redirect in web::utils functions (a942a45)
* Lots of bindings

View file

@ -1884,6 +1884,10 @@ class FriendRequestDelegate {}
class FriendsProfilePage : FLAlertLayer, FLAlertLayerProtocol, UploadActionDelegate, UploadPopupDelegate, UserListDelegate {
static FriendsProfilePage* create(UserListType) = win 0x9ce80, mac 0x3a9570;
bool init(UserListType) = win 0x9cf30, mac 0x3a9770;
void getUserListFinished(cocos2d::CCArray* arr, UserListType listType) = win 0x9d800;
void getUserListFailed(UserListType listType, GJErrorCode errorCode) = win 0x9d8e0;
void forceReloadList(UserListType listType) = win 0x9d950;
void setupUsersBrowser(cocos2d::CCArray* users, UserListType listType) = win 0x9d620;
}
[[link(android)]]
@ -2578,6 +2582,7 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol,
void playRainbowEffect() = win 0x12aad0;
void playShadowEffect() = win 0x12a9d0;
PAD = mac 0x10, win 0x8;
CCTextInputNode* m_nameInput;
SimplePlayer* m_playerPreview;
PAD = mac 0x10, win 0x8;
@ -2997,6 +3002,8 @@ class GameLevelManager : cocos2d::CCNode {
void getLevelLeaderboard(GJGameLevel* level, LevelLeaderboardType leaderboardType) = mac 0x2CD6F0, win 0xAED70;
void getOnlineLevels(GJSearchObject*) = mac 0x2C5920, win 0xa7bc0;
void getPageInfo(char const*) = mac 0x2c0050;
void getUserList(UserListType listType) = mac 0x2d74a0, win 0xb6b60;
cocos2d::CCObject* getStoredUserList(UserListType) = win 0xb70d0;
cocos2d::CCArray* getSavedLevels(bool favorite, int levelFolder) = mac 0x2BE910, win 0xa2960;
cocos2d::CCArray* getStoredOnlineLevels(char const*) = mac 0x2bfe80, win 0xa3a90;
void getTopArtists(int, int) = mac 0x2ce3d0;
@ -3092,7 +3099,7 @@ class GameLevelManager : cocos2d::CCNode {
LevelDeleteDelegate* m_levelDeleteDelegate;
UserInfoDelegate* m_userInfoDelegate;
LevelManagerDelegate* m_levelManagerDelegate;
void* m_unkDelegate;
UserListDelegate* m_userListDelegate;
FriendRequestDelegate* m_friendRequestDelegate;
MessageListDelegate* m_messageListDelegate;
DownloadMessageDelegate* m_downloadMessageDelegate;
@ -4248,6 +4255,7 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg
void showUpdateAlert(UpdateResponse) = mac 0x164ED0, win 0x179300;
void updateLabelValues() = mac 0x164090, win 0x17b170;
void onRate(cocos2d::CCObject* sender) = win 0x17a530;
void* m_unk1;
cocos2d::CCMenu* m_playBtnMenu;
@ -5319,7 +5327,6 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
bool m_isHidden;
int m_hasGhostTrail;
GhostTrailEffect* m_ghostTrail;
cocos2d::CCSprite* m_unknownSprite;
cocos2d::CCSprite* m_iconSprite;
cocos2d::CCSprite* m_iconSpriteSecondary;
cocos2d::CCSprite* m_iconSpriteWhitener;
@ -5329,6 +5336,7 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
cocos2d::CCSprite* m_unk500;
cocos2d::CCSprite* m_vehicleSpriteWhitener;
cocos2d::CCSprite* m_vehicleGlow;
cocos2d::CCSprite* m_unk50C;
cocos2d::CCMotionStreak* m_regularTrail;
HardStreak* m_waveTrail;
double m_xVelocity;
@ -5441,8 +5449,21 @@ class PointNode : cocos2d::CCObject {
[[link(android)]]
class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, CommentUploadDelegate, UserInfoDelegate, UploadActionDelegate, UploadPopupDelegate, LeaderboardManagerDelegate {
static ProfilePage* create(int accountID, bool idk) = mac 0x45eed0, win 0x20ee50;
ProfilePage() = win 0x20e920;
bool init(int accountID, bool idk) = mac 0x45f170, win 0x20ef00;
void onYoutube(cocos2d::CCObject*) = mac 0x462360, win 0x212e80;
void onTwitter(cocos2d::CCObject*) = mac 0x462500, win 0x212fe0;
void onTwitch(cocos2d::CCObject*) = mac 0x4626a0, win 0x213140;
void onCommentHistory(cocos2d::CCObject*) = mac 0x462840, win 0x211d10;
void onSendMessage(cocos2d::CCObject*) = mac 0x462870, win 0x211d40;
void onFriend(cocos2d::CCObject*) = mac 0x4628c0, win 0x211f30;
void onBlockUser(cocos2d::CCObject*) = mac 0x462b60, win 0x212130;
void onMyLevels(cocos2d::CCObject*) = mac 0x462d70, win 0x211bb0;
void onMessages(cocos2d::CCObject*) = mac 0x462f10, win 0x2132c0;
void onFriends(cocos2d::CCObject*) = mac 0x462f60, win 0x2132f0;
void onRequests(cocos2d::CCObject*) = mac 0x462fb0, win 0x213320;
void onSettings(cocos2d::CCObject*) = mac 0x463000, win 0x2132a0;
void onComment(cocos2d::CCObject*) = mac 0x463020, win 0x211e10;
void onUpdate(cocos2d::CCObject*) = mac 0x460150, win 0x20fa20;
void onClose(cocos2d::CCObject*) = mac 0x45fd20, win 0x49C60;
void loadPageFromUserInfo(GJUserScore* score) = mac 0x460480, win 0x210040;
@ -5498,8 +5519,8 @@ class RateStarsLayer : FLAlertLayer, UploadPopupDelegate, UploadActionDelegate {
UploadActionPopup* m_rateAction;
RateLevelDelegate* m_rateDelegate;
static RateStarsLayer* create(int levelID, bool isModSuggest) = mac 0x135e50;
bool init(int levelID, bool isModSuggest) = mac 0x136050;
static RateStarsLayer* create(int levelID, bool isModSuggest) = mac 0x135e50, win 0x2155f0;
bool init(int levelID, bool isModSuggest) = mac 0x136050, win 0x2156a0;
}
[[link(android)]]
@ -6178,10 +6199,10 @@ class UserInfoDelegate {
[[link(android)]]
class UserListDelegate {
virtual void forceReloadList(UserListType) {}
virtual void getUserListFailed(UserListType, GJErrorCode) {}
virtual void getUserListFinished(cocos2d::CCArray*, UserListType) {}
virtual void getUserListFailed(UserListType, GJErrorCode) {}
virtual void userListChanged(cocos2d::CCArray*, UserListType) {}
virtual void forceReloadList(UserListType) {}
}
[[link(android)]]

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(Codegen LANGUAGES C CXX)
include(../cmake/CPM.cmake)

View file

@ -0,0 +1,29 @@
// FIXME: This fix ends up breaking some of the vanilla text inputs.
#if 0
#include <Geode/modify/CCTextInputNode.hpp>
using namespace geode::prelude;
// rob only uses `CCTextInputNode`s in mostly-flat hierarchies, which still
// happen to work with the weird vanilla code. this fix makes it work even in
// deep hierarchies, because the vanilla code uses `getParent` and manually
// calculates the child location in the world space based on that rather than
// using `convertToNodeSpace`.
struct CCTextInputNodeFix : Modify<CCTextInputNodeFix, CCTextInputNode> {
bool ccTouchBegan(CCTouch* touch, CCEvent* event) {
auto const touchPos = touch->getLocation();
auto const size = this->getContentSize();
auto const pos = this->convertToNodeSpace(touchPos) + m_textField->getAnchorPoint() * size;
if (pos.x < 0 || pos.x > size.width || pos.y < 0 || pos.y > size.height)
return false;
if (m_delegate && !m_delegate->allowTextInput(this))
return false;
this->onClickTrackNode(true);
return true;
}
};
#endif

View file

@ -20,6 +20,7 @@
#include <iostream>
#include <string>
#include <fmt/core.h>
#include "ehdata_structs.hpp"
using namespace geode::prelude;
@ -199,24 +200,61 @@ static std::string getRegisters(PCONTEXT context) {
static std::string getInfo(LPEXCEPTION_POINTERS info, Mod* faultyMod) {
std::stringstream stream;
stream << "Faulty Module: "
<< getModuleName(handleFromAddress(info->ExceptionRecord->ExceptionAddress), true)
<< "\n"
<< "Faulty Mod: " << (faultyMod ? faultyMod->getID() : "<Unknown>") << "\n"
<< "Exception Code: " << std::hex << info->ExceptionRecord->ExceptionCode << " ("
<< getExceptionCodeString(info->ExceptionRecord->ExceptionCode) << ")" << std::dec
<< "\n"
<< "Exception Flags: " << info->ExceptionRecord->ExceptionFlags << "\n"
<< "Exception Address: " << info->ExceptionRecord->ExceptionAddress << " (";
printAddr(stream, info->ExceptionRecord->ExceptionAddress, false);
stream << ")"
<< "\n"
<< "Number Parameters: " << info->ExceptionRecord->NumberParameters << "\n";
if (info->ExceptionRecord->ExceptionCode == EH_EXCEPTION_NUMBER) {
// This executes when a C++ exception was thrown and not handled.
// https://devblogs.microsoft.com/oldnewthing/20100730-00/?p=13273
// since you can throw virtually anything, we need to figure out if it's an std::exception* or not
bool isStdException = false;
auto* exceptionRecord = info->ExceptionRecord;
auto exceptionObject = exceptionRecord->ExceptionInformation[1];
auto* throwInfo = reinterpret_cast<_ThrowInfo*>(exceptionRecord->ExceptionInformation[2]);
auto* catchableTypeArray = reinterpret_cast<_CatchableTypeArray*>(throwInfo->pCatchableTypeArray);
auto ctaSize = catchableTypeArray->nCatchableTypes;
for (int i = 0; i < ctaSize; i++) {
auto* catchableType = reinterpret_cast<_CatchableType*>(catchableTypeArray->arrayOfCatchableTypes[i]);
auto* ctDescriptor = reinterpret_cast<_TypeDescriptor*>(catchableType->pType);
const char* classname = ctDescriptor->name;
if (strcmp(classname, ".?AVexception@std@@") == 0) {
isStdException = true;
break;
}
}
if (isStdException) {
std::exception* excObject = reinterpret_cast<std::exception*>(exceptionObject);
// stream << "C++ Exception Type: " << typeid(excObject).name() << "\n"; // always const std::exception *
stream << "C++ Exception: " << excObject->what() << "\n";
} else {
stream << "C++ Exception: <Unknown type>\n";
}
stream << "Faulty Mod: " << (faultyMod ? faultyMod->getID() : "<Unknown>") << "\n";
} else {
stream << "Faulty Module: "
<< getModuleName(handleFromAddress(info->ExceptionRecord->ExceptionAddress), true)
<< "\n"
<< "Faulty Mod: " << (faultyMod ? faultyMod->getID() : "<Unknown>") << "\n"
<< "Exception Code: " << std::hex << info->ExceptionRecord->ExceptionCode << " ("
<< getExceptionCodeString(info->ExceptionRecord->ExceptionCode) << ")" << std::dec
<< "\n"
<< "Exception Flags: " << info->ExceptionRecord->ExceptionFlags << "\n"
<< "Exception Address: " << info->ExceptionRecord->ExceptionAddress << " (";
printAddr(stream, info->ExceptionRecord->ExceptionAddress, false);
stream << ")"
<< "\n"
<< "Number Parameters: " << info->ExceptionRecord->NumberParameters << "\n";
}
return stream.str();
}
static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
// init symbols so we can get some juicy debug info
@ -234,8 +272,17 @@ static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
return EXCEPTION_CONTINUE_SEARCH;
}
bool crashlog::setupPlatformHandler() {
static LONG WINAPI exceptionHandlerDummy(LPEXCEPTION_POINTERS info) {
SetUnhandledExceptionFilter(exceptionHandler);
return EXCEPTION_CONTINUE_SEARCH;
}
bool crashlog::setupPlatformHandler() {
// for some reason, on exceptions windows seems to clear SetUnhandledExceptionFilter
// so we attach a VE handler (which runs *earlier*) and inside set our crash handler
AddVectoredExceptionHandler(0, exceptionHandlerDummy);
SetUnhandledExceptionFilter(exceptionHandler);
auto lastCrashedFile = crashlog::getCrashLogDirectory() / "last-crashed";
if (ghc::filesystem::exists(lastCrashedFile)) {
g_lastLaunchCrashed = true;

View file

@ -0,0 +1,55 @@
#pragma once
// _ThrowInfo and all of those other structs are hardcoded into MSVC (the compiler itself, unavailable in any header),
// but don't exist in other compilers like Clang, causing <ehdata.h> to not compile.
//
// We define them manually in order to be able to use them.
// source: https://www.geoffchappell.com/studies/msvc/language/predefined/index.htm
#if defined(__GNUC__) || defined(__clang__) || defined(__INTELLISENSE__)
typedef struct _PMD
{
int mdisp;
int pdisp;
int vdisp;
} _PMD;
typedef void (*_PMFN) (void);
#pragma warning (disable:4200)
#pragma pack (push, _TypeDescriptor, 8)
typedef struct _TypeDescriptor
{
const void *pVFTable;
void *spare;
char name [];
} _TypeDescriptor;
#pragma pack (pop, _TypeDescriptor)
#pragma warning (default:4200)
typedef const struct _s__CatchableType {
unsigned int properties;
_TypeDescriptor *pType;
_PMD thisDisplacement;
int sizeOrOffset;
_PMFN copyFunction;
} _CatchableType;
#pragma warning (disable:4200)
typedef const struct _s__CatchableTypeArray {
int nCatchableTypes;
_CatchableType *arrayOfCatchableTypes [];
} _CatchableTypeArray;
#pragma warning (default:4200)
typedef const struct _s__ThrowInfo {
unsigned int attributes;
_PMFN pmfnUnwind;
int (__cdecl *pForwardCompat) (...);
_CatchableTypeArray *pCatchableTypeArray;
} _ThrowInfo;
#endif // defined(__GNUC__) || defined(__clang__) || defined(__INTELLISENSE__)
#include <ehdata.h> // for EH_EXCEPTION_NUMBER

File diff suppressed because it is too large Load diff