Skip to content

Commit d6f7db1

Browse files
author
Brian West
committed
feature: update for Godot 3.3-stable
1 parent fdbe206 commit d6f7db1

File tree

7 files changed

+14
-17
lines changed

7 files changed

+14
-17
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [push]
55
# Global Cache Settings
66
env:
77
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
8-
GODOT_BASE_BRANCH: '3.2.3-stable'
8+
GODOT_BASE_BRANCH: '3.3-stable'
99
BASE_BRANCH: master
1010
SCONS_CACHE_LIMIT: 4096
1111

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ You can also get the binaries with lastest commits from the [github build action
2121
### Compilation
2222
* Clone the source code of [godot](https://github.com/godotengine/godot)
2323
* Clone this module and put it into `godot/modules/` and make sure the folder name of this module is `ECMAScript`
24-
* [Recompile the godot engine](https://docs.godotengine.org/en/3.2/development/compiling/index.html) <b>(Only MinGW is supported on Windows for now!)</b>
24+
* [Recompile the godot engine](https://docs.godotengine.org/en/3.3/development/compiling/index.html) <b>(Only MinGW is supported on Windows for now!)</b>
2525

2626
![Build Godot with ECMAScript](https://github.com/GodotExplorer/ECMAScript/workflows/Build%20Godot%20with%20ECMAScript/badge.svg)
2727

SCsub

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,4 @@ if env['tools']:
7171
env_module.add_source_files(env.modules_sources, 'tools/*.cpp')
7272

7373
env_module.Append(CPPPATH=["#modules/ECMAScript"])
74-
env_module.Append(CXXFLAGS=["-std=c++11"])
7574
env_module.add_source_files(env.modules_sources, sources)

quickjs/quickjs_binder.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
#include "editor/editor_settings.h"
1717
#endif
1818

19-
uint32_t QuickJSBinder::global_context_id = 0;
20-
uint64_t QuickJSBinder::global_transfer_id = 0;
19+
SafeNumeric<uint32_t> QuickJSBinder::global_context_id;
20+
SafeNumeric<uint64_t> QuickJSBinder::global_transfer_id;
21+
2122
HashMap<uint64_t, Variant> QuickJSBinder::transfer_deopot;
2223
Map<String, const char *> QuickJSBinder::class_remap;
2324
List<String> compiling_modules;
@@ -1211,7 +1212,7 @@ void QuickJSBinder::add_godot_globals() {
12111212
}
12121213

12131214
QuickJSBinder::QuickJSBinder() {
1214-
context_id = global_context_id++;
1215+
context_id = QuickJSBinder::global_context_id.increment();
12151216
internal_godot_method_id = 0;
12161217
internal_godot_indexed_property_id = 0;
12171218
godot_allocator.js_malloc = QuickJSBinder::js_binder_malloc;
@@ -2320,7 +2321,7 @@ JSValue QuickJSBinder::godot_abandon_value(JSContext *ctx, JSValue this_val, int
23202321

23212322
uint64_t id = 0;
23222323
if (valid) {
2323-
id = atomic_increment(&global_transfer_id);
2324+
id = QuickJSBinder::global_transfer_id.increment();
23242325
GLOBAL_LOCK_FUNCTION
23252326
transfer_deopot.set(id, gd_value);
23262327
}

quickjs/quickjs_binder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class QuickJSBinder : public ECMAScriptBinder {
3030
QuickJSBuiltinBinder builtin_binder;
3131

3232
protected:
33-
static uint32_t global_context_id;
34-
static uint64_t global_transfer_id;
33+
static SafeNumeric<uint32_t> global_context_id;
34+
static SafeNumeric<uint64_t> global_transfer_id;
3535
JSRuntime *runtime;
3636
JSContext *ctx;
3737
JSMallocFunctions godot_allocator;

quickjs/quickjs_worker.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ JSValue QuickJSWorker::global_import_scripts(JSContext *ctx, JSValue this_val, i
8989

9090
QuickJSWorker::QuickJSWorker(const QuickJSBinder *p_host_context) :
9191
QuickJSBinder() {
92-
thread = NULL;
9392
running = false;
9493
host_context = p_host_context;
9594
}
@@ -156,16 +155,14 @@ void QuickJSWorker::post_message_from_host(const Variant &p_message) {
156155
}
157156

158157
void QuickJSWorker::start(const String &p_path) {
159-
ERR_FAIL_COND(running || thread != NULL);
158+
ERR_FAIL_COND(running || thread.is_started());
160159
entry_script = p_path;
161-
thread = Thread::create(thread_main, this);
160+
thread.start(thread_main, this);
162161
}
163162

164163
void QuickJSWorker::stop() {
165-
if (thread != NULL) {
164+
if (thread.is_started()) {
166165
running = false;
167-
Thread::wait_to_finish(thread);
168-
memdelete(thread);
169-
thread = NULL;
166+
thread.wait_to_finish();
170167
}
171168
}

quickjs/quickjs_worker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "quickjs_binder.h"
66

77
class QuickJSWorker : public QuickJSBinder {
8-
Thread *thread;
8+
Thread thread;
99
bool running = false;
1010
static void thread_main(void *p_self);
1111
String entry_script;

0 commit comments

Comments
 (0)