/PyBroma

A Cython Embed of Broma from Geode Used for Parsing Broma Files and Generating code.

Primary LanguageC++MIT LicenseMIT

PyBroma

A Python embed of broma from geode used to parse C++ like files from the geometry dash bindings.

How To Use

from pybroma import Root


# test.bro:
# class BindedClass {
# 	void bindedFunction() = mac 0xd5db0, win 0x3c8d, ios 0xa83bc;

# 	int m_member1;
# 	int m_member2;
# }

# class OtherBindedClass : BindedClass {
# 	virtual void otherBindedFunction() = mac 0x7e3bc, win 0x5a1c, ios 0x8e412;

# 	// win and ios addresses have not been found yet, will not generate
# 	static int staticFunction(int a, bool c) = mac 0x74bd3;

# 	// Embed c++ code
# 	inline int getIndex(int index) {
# 		return m_myVector[index];
# 	} 

# 	// templates supported
# 	std::vector<int> m_myVector;
# }

root = Root("test.bro")
for c in root.classes:
    for f in c.fields:
        # NOTE: functions that aren't a Function Bind Field do not return...
        if func := f.getAsFunctionBindField():
            # This will make a dictionary mainly to make iteration a bit easier...
            print(func.prototype.args)
# output        
# {}
# {}
# {'a': <pybroma.PyBroma.Type object at 0x0000018C6D507B70>, 'c': <pybroma.PyBroma.Type object at 0x0000018C6D507B30>}

why?

  • I wrote this library because it's slower to write C++ code and I felt like I needed something that could be easily aborted and easy to test when something doesn't run right.
  • To use a language that I was more familliar and comfortable with and has releativly good code safety features.
  • To generate code to automate the creation of mods and be able to reverse engineer geometry dash a little bit more efficiently. Including creating ghidra headerfiles that ghidra can understand and parse.
  • For other programmers (especially beginner programmers) to try out this wonderful library that I have just recently made a bridge for in one full day. (I would expect that you have a bit of knowlege on how C++ works first.)
  • To go far beyond the scope of what broma is actually being used for such as reverse engineering.

Cool When Pypi Release?

I may not get to that due to the required 2FA stuff because scammers were using pypi to host malicious malware.

How To Install

There's 2 ways to do this but the conventional way is to install GIT and use it locally.

git clone https://github.com/CallocGD
python setup.py build_ext --inplace

The other way is to install this package globally as a zip file such as for example

pip install https://github.com/CallocGD/PyBroma/archive/refs/heads/main.zip

Also Some parsing Error Features may not be avalible just yet so don't complain to me if it crashes broma does not have a clean way to handle errors yet to my knowlege.

Cool Will Geode Add This Library To Their Repositories?

I don't know, I sure hope so, I see the project's overall potential to be useful for that criteria but I doubt it. You'll just have to ask them and be paitient about it.

Anything else

Might make a version of this in Rust as practice for binding C/C++ libraries since I am trying to learn how to do that kind of stuff.

Bugs

  • Did not test the new updated version yet...