Skip to content

Commit 922c273

Browse files
committed
CCControlUtils bindings
1 parent 7ac5eb7 commit 922c273

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

bindings/2.2074/Cocos2d.bro

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5941,10 +5941,21 @@ class cocos2d::ZipUtils {
59415941

59425942
[[link(win, android)]]
59435943
class cocos2d::extension::CCControlUtils {
5944-
static cocos2d::CCSprite* addSpriteToTargetWithPosAndAnchor(char const*, cocos2d::CCNode*, cocos2d::CCPoint, cocos2d::CCPoint) = m1 0x3247f0, imac 0x396590;
5945-
static cocos2d::extension::HSV HSVfromRGB(cocos2d::extension::RGBA) = m1 0x324868, imac 0x3965f0;
5946-
static cocos2d::extension::RGBA RGBfromHSV(cocos2d::extension::HSV) = m1 0x324914, imac 0x3966e0;
5947-
static cocos2d::CCRect CCRectUnion(cocos2d::CCRect const&, cocos2d::CCRect const&) = m1 0x324a34, imac 0x396830;
5944+
static cocos2d::CCSprite* addSpriteToTargetWithPosAndAnchor(char const*, cocos2d::CCNode*, cocos2d::CCPoint, cocos2d::CCPoint) = m1 0x3247f0, imac 0x396590, ios 0x1d4c08;
5945+
static cocos2d::extension::HSV HSVfromRGB(cocos2d::extension::RGBA) = m1 0x324868, imac 0x3965f0, ios 0x1d4c80;
5946+
static cocos2d::extension::RGBA RGBfromHSV(cocos2d::extension::HSV) = m1 0x324914, imac 0x3966e0, ios 0x1d4d28;
5947+
static cocos2d::CCRect CCRectUnion(cocos2d::CCRect const&, cocos2d::CCRect const&) = m1 0x324a34, imac 0x396830, ios inline {
5948+
CCRect result;
5949+
auto x1 = std::min(p0.getMinX(), p1.getMinX());
5950+
auto x2 = std::max(p0.getMaxX(), p1.getMaxX());
5951+
auto y1 = std::min(p0.getMinY(), p1.getMinY());
5952+
auto y2 = std::max(p0.getMaxY(), p1.getMaxY());
5953+
result.origin.x = x1;
5954+
result.origin.y = x2;
5955+
result.size.width = x2 - x1;
5956+
result.size.height = y2 - y1;
5957+
return result;
5958+
}
59485959
}
59495960

59505961
[[link(win, android)]]

scripts/ghidra/ScriptWrapper.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,9 @@ boolean typeIsStruct(DataType type, Platform platform) {
519519
if (platform == Platform.WINDOWS32 || platform == Platform.WINDOWS64) {
520520
return true;
521521
}
522+
if (type.getName().startsWith("RGBA") || type.getName().startsWith("HSV")) {
523+
return false;
524+
}
522525
if (type.getName().startsWith("CCPoint") || type.getName().startsWith("CCSize") || type.getName().startsWith("CCRect")) {
523526
return true;
524527
}
@@ -881,6 +884,27 @@ else if (platform == Platform.ANDROID32 || platform == Platform.ANDROID64) { //
881884
ccHSVValue.setPackingEnabled(true);
882885
manager.addDataType(ccHSVValue, DataTypeConflictHandler.REPLACE_HANDLER);
883886

887+
// cocos2d::extension::RGBA
888+
889+
cat = this.createCategoryAll(category.extend("cocos2d", "extension", "RGBA"));
890+
var rgba = new StructureDataType(cat, cat.getName(), 0x0);
891+
rgba.add(DoubleDataType.dataType, 0x8, "r", "Red component");
892+
rgba.add(DoubleDataType.dataType, 0x8, "g", "Green component");
893+
rgba.add(DoubleDataType.dataType, 0x8, "b", "Blue component");
894+
rgba.add(DoubleDataType.dataType, 0x8, "a", "Alpha component");
895+
rgba.setPackingEnabled(true);
896+
manager.addDataType(rgba, DataTypeConflictHandler.REPLACE_HANDLER);
897+
898+
// cocos2d::extension::HSV
899+
900+
cat = this.createCategoryAll(category.extend("cocos2d", "extension", "HSV"));
901+
var hsv = new StructureDataType(cat, cat.getName(), 0x0);
902+
hsv.add(DoubleDataType.dataType, 0x8, "h", "Hue");
903+
hsv.add(DoubleDataType.dataType, 0x8, "s", "Saturation");
904+
hsv.add(DoubleDataType.dataType, 0x8, "v", "Value");
905+
hsv.setPackingEnabled(true);
906+
manager.addDataType(hsv, DataTypeConflictHandler.REPLACE_HANDLER);
907+
884908
// cocos2d::SEL_MenuHandler
885909

886910
cat = this.createCategoryAll(category.extend("cocos2d", "SEL_MenuHandler"));

0 commit comments

Comments
 (0)