Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feature: update for Godot 3.3-stable
  • Loading branch information
Brian West committed Apr 23, 2021
commit d6f7db18d766831161646fa64eee0ae14c8c6aef
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push]
# Global Cache Settings
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
GODOT_BASE_BRANCH: '3.2.3-stable'
GODOT_BASE_BRANCH: '3.3-stable'
BASE_BRANCH: master
SCONS_CACHE_LIMIT: 4096

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You can also get the binaries with lastest commits from the [github build action
### Compilation
* Clone the source code of [godot](https://github.com/godotengine/godot)
* Clone this module and put it into `godot/modules/` and make sure the folder name of this module is `ECMAScript`
* [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>
* [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>

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

Expand Down
1 change: 0 additions & 1 deletion SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,4 @@ if env['tools']:
env_module.add_source_files(env.modules_sources, 'tools/*.cpp')

env_module.Append(CPPPATH=["#modules/ECMAScript"])
env_module.Append(CXXFLAGS=["-std=c++11"])
env_module.add_source_files(env.modules_sources, sources)
9 changes: 5 additions & 4 deletions quickjs/quickjs_binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
#include "editor/editor_settings.h"
#endif

uint32_t QuickJSBinder::global_context_id = 0;
uint64_t QuickJSBinder::global_transfer_id = 0;
SafeNumeric<uint32_t> QuickJSBinder::global_context_id;
SafeNumeric<uint64_t> QuickJSBinder::global_transfer_id;

HashMap<uint64_t, Variant> QuickJSBinder::transfer_deopot;
Map<String, const char *> QuickJSBinder::class_remap;
List<String> compiling_modules;
Expand Down Expand Up @@ -1211,7 +1212,7 @@ void QuickJSBinder::add_godot_globals() {
}

QuickJSBinder::QuickJSBinder() {
context_id = global_context_id++;
context_id = QuickJSBinder::global_context_id.increment();
internal_godot_method_id = 0;
internal_godot_indexed_property_id = 0;
godot_allocator.js_malloc = QuickJSBinder::js_binder_malloc;
Expand Down Expand Up @@ -2320,7 +2321,7 @@ JSValue QuickJSBinder::godot_abandon_value(JSContext *ctx, JSValue this_val, int

uint64_t id = 0;
if (valid) {
id = atomic_increment(&global_transfer_id);
id = QuickJSBinder::global_transfer_id.increment();
GLOBAL_LOCK_FUNCTION
transfer_deopot.set(id, gd_value);
}
Expand Down
4 changes: 2 additions & 2 deletions quickjs/quickjs_binder.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class QuickJSBinder : public ECMAScriptBinder {
QuickJSBuiltinBinder builtin_binder;

protected:
static uint32_t global_context_id;
static uint64_t global_transfer_id;
static SafeNumeric<uint32_t> global_context_id;
static SafeNumeric<uint64_t> global_transfer_id;
JSRuntime *runtime;
JSContext *ctx;
JSMallocFunctions godot_allocator;
Expand Down
11 changes: 4 additions & 7 deletions quickjs/quickjs_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ JSValue QuickJSWorker::global_import_scripts(JSContext *ctx, JSValue this_val, i

QuickJSWorker::QuickJSWorker(const QuickJSBinder *p_host_context) :
QuickJSBinder() {
thread = NULL;
running = false;
host_context = p_host_context;
}
Expand Down Expand Up @@ -156,16 +155,14 @@ void QuickJSWorker::post_message_from_host(const Variant &p_message) {
}

void QuickJSWorker::start(const String &p_path) {
ERR_FAIL_COND(running || thread != NULL);
ERR_FAIL_COND(running || thread.is_started());
entry_script = p_path;
thread = Thread::create(thread_main, this);
thread.start(thread_main, this);
}

void QuickJSWorker::stop() {
if (thread != NULL) {
if (thread.is_started()) {
running = false;
Thread::wait_to_finish(thread);
memdelete(thread);
thread = NULL;
thread.wait_to_finish();
}
}
2 changes: 1 addition & 1 deletion quickjs/quickjs_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "quickjs_binder.h"

class QuickJSWorker : public QuickJSBinder {
Thread *thread;
Thread thread;
bool running = false;
static void thread_main(void *p_self);
String entry_script;
Expand Down