Skip to content

Commit 036ef6d

Browse files
Fix global functions (#892)
* Fix global functions * update actions
1 parent cbcecfd commit 036ef6d

File tree

6 files changed

+26
-8
lines changed

6 files changed

+26
-8
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- name: Get changed files in the codegen folder
2222
id: changed
23-
uses: tj-actions/changed-files@v42
23+
uses: tj-actions/changed-files@v45
2424
with:
2525
files: |
2626
.github/workflows/build.yml

.github/workflows/verify.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout repo
10-
uses: actions/checkout@v3
10+
uses: actions/checkout@v4
1111

1212
- name: Restore cache
1313
id: codegen-cache
14-
uses: actions/cache@v3
14+
uses: actions/cache@v4
1515
with:
1616
path: bin
1717
key: codegen-${{ hashFiles('codegen/**') }}
@@ -24,7 +24,7 @@ jobs:
2424
cmake --install build
2525
2626
- name: Upload Codegen binary
27-
uses: actions/upload-artifact@v3
27+
uses: actions/upload-artifact@v4
2828
with:
2929
name: Codegen
3030
path: bin/Codegen
@@ -34,10 +34,10 @@ jobs:
3434
needs: build
3535
steps:
3636
- name: Checkout repo
37-
uses: actions/checkout@v3
37+
uses: actions/checkout@v4
3838

3939
- name: Download Codegen binary
40-
uses: actions/download-artifact@v3
40+
uses: actions/download-artifact@v4
4141
with:
4242
name: Codegen
4343

@@ -128,7 +128,7 @@ jobs:
128128

129129
- name: Set up codegen binary cache
130130
id: codegen-cache
131-
uses: actions/cache@v3
131+
uses: actions/cache@v4
132132
with:
133133
path: build/bindings/codegen
134134
# cache by os since for android32 and 64 the codegen binary is the same

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ scripts/Bindings.json
66
__optcall.xml
77
__membercall.xml
88
/.vs
9+
**/.cache

bindings/2.2074/Cocos2d.bro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3388,6 +3388,11 @@ class cocos2d {
33883388
static float clampf(float, float, float);
33893389
}
33903390

3391+
[[link(win, android)]]
3392+
void kmGLPushMatrix() = m1 0x1aba8c, imac 0x1f5fa0;
3393+
[[link(win, android)]]
3394+
void kmGLPopMatrix() = m1 0x1abad0, imac 0x1f5fe0;
3395+
33913396
[[link(win, android)]]
33923397
class DS_Dictionary {
33933398
DS_Dictionary() = m1 0x135e9c, imac 0x169200;

codegen/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project(Codegen LANGUAGES C CXX)
44
include(../cmake/CPM.cmake)
55

66
CPMAddPackage("gh:fmtlib/fmt#10.1.1")
7-
CPMAddPackage("gh:geode-sdk/Broma#4243065")
7+
CPMAddPackage("gh:geode-sdk/Broma#b8c49c8")
88
CPMAddPackage("gh:geode-sdk/json#3a79c51")
99

1010
target_compile_definitions(fmt PUBLIC -DFMT_CONSTEVAL=)

codegen/src/SourceGen.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ auto {function_name}({parameters}) -> decltype({function_name}({arguments})) {{
158158
}});
159159
return reinterpret_cast<FunctionType>(func)({arguments});
160160
}}
161+
)GEN";
162+
163+
constexpr char const* declare_standalone_definition = R"GEN(
164+
{return} {function_name}({parameters}) {definition}
161165
)GEN";
162166
}}
163167

@@ -166,6 +170,14 @@ std::string generateBindingSource(Root const& root) {
166170

167171
for (auto& f : root.functions) {
168172
if (codegen::getStatus(f) != BindStatus::NeedsBinding) {
173+
if (codegen::getStatus(f) == BindStatus::Inlined) {
174+
output += fmt::format(format_strings::declare_standalone_definition,
175+
fmt::arg("return", f.prototype.ret.name),
176+
fmt::arg("function_name", f.prototype.name),
177+
fmt::arg("parameters", codegen::getParameters(f.prototype)),
178+
fmt::arg("definition", f.inner)
179+
);
180+
}
169181
continue;
170182
}
171183

0 commit comments

Comments
 (0)