From ec606f94dc259cd4d22b11e9147789b87ed73738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 25 Apr 2016 18:55:31 +0200 Subject: [PATCH] Drop NACL platform It's no longer maintained and Chrome-specific, so it's not a viable solution to deploy Godot games in browsers. The current prefered alternative is asm.js (platform/javascript), and we're looking forward to WebAssembly. --- platform/nacl/SCsub | 30 -- platform/nacl/audio_driver_nacl.cpp | 106 ------ platform/nacl/audio_driver_nacl.h | 63 ---- platform/nacl/context_gl_nacl.cpp | 67 ---- platform/nacl/context_gl_nacl.h | 58 --- platform/nacl/detect.py | 71 ---- platform/nacl/geturl_handler.cpp | 150 -------- platform/nacl/geturl_handler.h | 115 ------ platform/nacl/godot_module.cpp | 332 ---------------- platform/nacl/godot_nacl.cpp | 80 ---- platform/nacl/html/check_browser.js | 178 --------- platform/nacl/html/godot_nacl.nmf | 6 - platform/nacl/html/icon_128.png | Bin 11146 -> 0 bytes platform/nacl/html/icon_16.png | Bin 828 -> 0 bytes platform/nacl/html/index.html | 258 ------------- platform/nacl/html/manifest.json | 19 - platform/nacl/logo.png | Bin 2705 -> 0 bytes platform/nacl/nacl_keycodes.h | 422 --------------------- platform/nacl/opengl_context.cpp | 123 ------ platform/nacl/opengl_context.h | 124 ------ platform/nacl/os_nacl.cpp | 566 ---------------------------- platform/nacl/os_nacl.h | 156 -------- platform/nacl/pepper_main.cpp | 541 -------------------------- platform/nacl/platform_config.h | 29 -- 24 files changed, 3494 deletions(-) delete mode 100644 platform/nacl/SCsub delete mode 100644 platform/nacl/audio_driver_nacl.cpp delete mode 100644 platform/nacl/audio_driver_nacl.h delete mode 100644 platform/nacl/context_gl_nacl.cpp delete mode 100644 platform/nacl/context_gl_nacl.h delete mode 100644 platform/nacl/detect.py delete mode 100644 platform/nacl/geturl_handler.cpp delete mode 100644 platform/nacl/geturl_handler.h delete mode 100644 platform/nacl/godot_module.cpp delete mode 100644 platform/nacl/godot_nacl.cpp delete mode 100644 platform/nacl/html/check_browser.js delete mode 100644 platform/nacl/html/godot_nacl.nmf delete mode 100644 platform/nacl/html/icon_128.png delete mode 100644 platform/nacl/html/icon_16.png delete mode 100644 platform/nacl/html/index.html delete mode 100644 platform/nacl/html/manifest.json delete mode 100644 platform/nacl/logo.png delete mode 100644 platform/nacl/nacl_keycodes.h delete mode 100644 platform/nacl/opengl_context.cpp delete mode 100644 platform/nacl/opengl_context.h delete mode 100644 platform/nacl/os_nacl.cpp delete mode 100644 platform/nacl/os_nacl.h delete mode 100644 platform/nacl/pepper_main.cpp delete mode 100644 platform/nacl/platform_config.h diff --git a/platform/nacl/SCsub b/platform/nacl/SCsub deleted file mode 100644 index ac01752dbb8..00000000000 --- a/platform/nacl/SCsub +++ /dev/null @@ -1,30 +0,0 @@ -Import('env') - -nacl_lib = [ - - 'os_nacl.cpp', - 'audio_driver_nacl.cpp', - 'godot_nacl.cpp', - #'pepper_main.cpp', - 'opengl_context.cpp', - 'godot_module.cpp', - 'geturl_handler.cpp', -] - -nacl_posix = [ - - '#drivers/unix/thread_posix.cpp', - '#drivers/unix/mutex_posix.cpp', - '#drivers/unix/semaphore_posix.cpp', -] - -posix_lib = [] -for f in nacl_posix: - posix_lib.append(env.Object(f, CPPFLAGS = env['CPPFLAGS']+['-DUNIX_ENABLED'], OBJSUFFIX = '.posix'+env['OBJSUFFIX'])) - -prog = env.Program('#bin/godot_nacl', nacl_lib + posix_lib) - -if (env['nacl_arch'] == 'i686'): - env.Alias("nacl_32", prog) -if (env['nacl_arch'] == 'x86_64'): - env.Alias("nacl_64", prog) diff --git a/platform/nacl/audio_driver_nacl.cpp b/platform/nacl/audio_driver_nacl.cpp deleted file mode 100644 index dac95214874..00000000000 --- a/platform/nacl/audio_driver_nacl.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************/ -/* audio_driver_nacl.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "audio_driver_nacl.h" - -#include "ppapi/cpp/instance.h" - -extern pp::Instance* godot_instance; - -const char* AudioDriverNacl::get_name() const { - - return "Nacl"; -} - -void AudioDriverNacl::output_callback(void* samples, uint32_t buffer_size, void* data) { - - AudioDriverNacl* ad = (AudioDriverNacl*)data; - int16_t* out = (int16_t*)samples; - - ad->lock(); - ad->audio_server_process(ad->sample_frame_count_, ad->samples_in); - ad->unlock(); - - for (int i=0; isample_count; i++) { - - out[i] = ad->samples_in[i]>>16; - }; - -}; - -Error AudioDriverNacl::init(){ - - int frame_size = 4096; - sample_frame_count_ = pp::AudioConfig::RecommendSampleFrameCount(godot_instance,PP_AUDIOSAMPLERATE_44100, frame_size); - sample_count = sample_frame_count_ * 2; - - audio_ = pp::Audio(godot_instance, - pp::AudioConfig(godot_instance, - PP_AUDIOSAMPLERATE_44100, - sample_frame_count_), - &AudioDriverNacl::output_callback, - this); - - samples_in = memnew_arr(int32_t, sample_frame_count_ * 2); - - return OK; -} -void AudioDriverNacl::start(){ - - audio_.StartPlayback(); -} -int AudioDriverNacl::get_mix_rate() const { - - return 44100; -} -AudioDriverSW::OutputFormat AudioDriverNacl::get_output_format() const{ - - return OUTPUT_STEREO; -} -void AudioDriverNacl::lock(){ - -} -void AudioDriverNacl::unlock() { - - -} -void AudioDriverNacl::finish(){ - - audio_.StopPlayback(); -} - - -AudioDriverNacl::AudioDriverNacl() { -} - -AudioDriverNacl::~AudioDriverNacl() { - - memdelete_arr(samples_in); -} - - diff --git a/platform/nacl/audio_driver_nacl.h b/platform/nacl/audio_driver_nacl.h deleted file mode 100644 index d14e60717a9..00000000000 --- a/platform/nacl/audio_driver_nacl.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************/ -/* audio_driver_nacl.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef AUDIO_DRIVER_NACL_H -#define AUDIO_DRIVER_NACL_H - -#include "servers/audio/audio_server_sw.h" - -#include "ppapi/cpp/audio.h" - -class AudioDriverNacl : public AudioDriverSW { - - static void output_callback(void* samples, uint32_t buffer_size, void* data); - - int32_t* samples_in; - int sample_frame_count_; - int sample_count; - pp::Audio audio_; - -public: - - virtual const char* get_name() const; - - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const ; - virtual OutputFormat get_output_format() const; - virtual void lock(); - virtual void unlock(); - virtual void finish(); - - - AudioDriverNacl(); - ~AudioDriverNacl(); -}; - -#endif // AUDIO_DRIVER_NACL_H - diff --git a/platform/nacl/context_gl_nacl.cpp b/platform/nacl/context_gl_nacl.cpp deleted file mode 100644 index ce2f25b69f2..00000000000 --- a/platform/nacl/context_gl_nacl.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************/ -/* context_gl_nacl.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "context_gl_nacl.h" - -#include -#include -#include -#include -#include -#include - -void ContextGLNacl::make_current() { - -}; - -int ContextGLNacl::get_window_width() { - -}; - -int ContextGLNacl::get_window_height() { - -}; - -void ContextGLNacl::swap_buffers() { - -}; - -Error ContextGLNacl::initialize() { - -}; - - -ContextGLNacl::ContextGLNacl() { - - -}; - -ContextGLNacl::~ContextGLNacl() { - -}; - diff --git a/platform/nacl/context_gl_nacl.h b/platform/nacl/context_gl_nacl.h deleted file mode 100644 index 82b9ba07755..00000000000 --- a/platform/nacl/context_gl_nacl.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************/ -/* context_gl_nacl.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef CONTEXT_GL_NACL_H -#define CONTEXT_GL_NACL_H - -#include "drivers/gl_context/context_gl.h" - -class NPDevice; - -class ContextGLNacl : public ContextGL { - - enum { - COMMAND_BUFFER_SIZE = 1024 * 1024, - }; - - NPDevice* device3d_; - -public: - - virtual void make_current(); - - virtual int get_window_width(); - virtual int get_window_height(); - virtual void swap_buffers(); - - virtual Error initialize(); - - ContextGLNacl(); - ~ContextGLNacl(); -}; - -#endif // CONTEXT_GL_NACL_H diff --git a/platform/nacl/detect.py b/platform/nacl/detect.py deleted file mode 100644 index eedb29746a8..00000000000 --- a/platform/nacl/detect.py +++ /dev/null @@ -1,71 +0,0 @@ -import os -import sys - -def is_active(): - return True - -def get_name(): - return "NaCl" - -def can_build(): - - import os - if not os.environ.has_key("NACLPATH"): - return False - return True - -def get_opts(): - - return [ - ('NACLPATH', 'the path to nacl', os.environ.get("NACLPATH", 0)), - ('nacl_arch', 'The architecture for Nacl build (can be i686 or x86_64', 'i686'), - ] - -def get_flags(): - - return [ - ('nedmalloc', 'no'), - ('tools', 'no'), - ] - - - -def configure(env): - - env.Append(CPPPATH=['#platform/nacl']) - - env['OBJSUFFIX'] = ".nacl.${nacl_arch}.o" - env['LIBSUFFIX'] = ".nacl.${nacl_arch}.a" - env['PROGSUFFIX'] = ".${nacl_arch}.nexe" - - env['ENV']['PATH'] = env['ENV']['PATH']+":"+env['NACLPATH']+"/toolchain/linux_x86_newlib/bin" - - env['CC'] = '${nacl_arch}-nacl-gcc' - env['CXX'] = '${nacl_arch}-nacl-g++' - env['AR'] = '${nacl_arch}-nacl-ar' - - env.Append(CCFLAGS=['-fexceptions', '-Wno-long-long', '-pthread', '-DXP_UNIX']) - - env.Append(CPPPATH=env['NACLPATH']) - - if (env["target"]=="release"): - - env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer', '-ffunction-sections', '-fdata-sections', '-fno-default-inline']) - - elif (env["target"]=="debug"): - - env.Append(CCFLAGS=['-g', '-O0', '-Wall','-DDEBUG_ENABLED']) - - - elif (env["target"]=="profile"): - - env.Append(CCFLAGS=['-g','-pg']) - env.Append(LINKFLAGS=['-pg']) - - env.Append(CCFLAGS=['-DNACL_ENABLED', '-DGLES2_ENABLED']) - - env.Append(LIBFLAGS=['m32']) - env.Append(LIBS=env.Split('ppapi ppapi_cpp pthread srpc ppapi_gles22')) - - import methods - env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) diff --git a/platform/nacl/geturl_handler.cpp b/platform/nacl/geturl_handler.cpp deleted file mode 100644 index 6be82f3f5a2..00000000000 --- a/platform/nacl/geturl_handler.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/*************************************************************************/ -/* geturl_handler.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "geturl_handler.h" - -#include "core/os/copymem.h" - -#include -#include -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/ppb_instance.h" -#include "ppapi/cpp/module.h" -#include "ppapi/cpp/var.h" - -void GetURLHandler::Start() { - pp::CompletionCallback cc = - cc_factory_.NewCallback(&GetURLHandler::OnOpen); - url_loader_.Open(url_request_, cc); -} - -void GetURLHandler::OnOpen(int32_t result) { - if (result != PP_OK) { - status = STATUS_ERROR; - return; - } - // Here you would process the headers. A real program would want to at least - // check the HTTP code and potentially cancel the request. - // pp::URLResponseInfo response = loader_.GetResponseInfo(); - - // Start streaming. - ReadBody(); -} - -void GetURLHandler::AppendDataBytes(const char* buffer, int32_t num_bytes) { - if (num_bytes <= 0) - return; - // Make sure we don't get a buffer overrun. - num_bytes = std::min(READ_BUFFER_SIZE, num_bytes); - int ofs = data.size(); - data.resize(ofs + num_bytes); - copymem(&data[ofs], buffer, num_bytes); -} - -void GetURLHandler::OnRead(int32_t result) { - if (result == PP_OK) { - // Streaming the file is complete. - status = STATUS_COMPLETED; - instance_->HandleMessage("package_finished"); - instance_->HandleMessage(0); - printf("completed!\n"); - } else if (result > 0) { - // The URLLoader just filled "result" number of bytes into our buffer. - // Save them and perform another read. - AppendDataBytes(buffer_, result); - ReadBody(); - } else { - // A read error occurred. - status = STATUS_ERROR; - ERR_FAIL_COND(result < 0); - } -} - -void GetURLHandler::ReadBody() { - // Note that you specifically want an "optional" callback here. This will - // allow ReadBody() to return synchronously, ignoring your completion - // callback, if data is available. For fast connections and large files, - // reading as fast as we can will make a large performance difference - // However, in the case of a synchronous return, we need to be sure to run - // the callback we created since the loader won't do anything with it. - pp::CompletionCallback cc = - cc_factory_.NewOptionalCallback(&GetURLHandler::OnRead); - int32_t result = PP_OK; - do { - result = url_loader_.ReadResponseBody(buffer_, sizeof(buffer_), cc); - // Handle streaming data directly. Note that we *don't* want to call - // OnRead here, since in the case of result > 0 it will schedule - // another call to this function. If the network is very fast, we could - // end up with a deeply recursive stack. - if (result > 0) { - AppendDataBytes(buffer_, result); - } - } while (result > 0); - - if (result != PP_OK_COMPLETIONPENDING) { - // Either we reached the end of the stream (result == PP_OK) or there was - // an error. We want OnRead to get called no matter what to handle - // that case, whether the error is synchronous or asynchronous. If the - // result code *is* COMPLETIONPENDING, our callback will be called - // asynchronously. - cc.Run(result); - } -} - -GetURLHandler::Status GetURLHandler::get_status() const { - - return status; -}; - -Vector GetURLHandler::get_data() const { - - return data; -}; - -int GetURLHandler::get_bytes_read() const { - - return data.size(); -}; - -GetURLHandler::GetURLHandler(pp::Instance* instance, - const String& url) - : instance_(instance), - url_(url), - url_request_(instance), - url_loader_(instance), - cc_factory_(this) { - url_request_.SetURL(std::string(url.utf8().get_data())); - url_request_.SetMethod("GET"); - status = STATUS_NONE; - printf("url handler for url %ls!\n", url.c_str()); -} - -GetURLHandler::~GetURLHandler() { -} - - diff --git a/platform/nacl/geturl_handler.h b/platform/nacl/geturl_handler.h deleted file mode 100644 index c310ed942de..00000000000 --- a/platform/nacl/geturl_handler.h +++ /dev/null @@ -1,115 +0,0 @@ -/*************************************************************************/ -/* geturl_handler.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef EXAMPLES_GETURL_GETURL_HANDLER_H_ -#define EXAMPLES_GETURL_GETURL_HANDLER_H_ - -#include "core/ustring.h" -#include "core/vector.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/url_loader.h" -#include "ppapi/cpp/url_request_info.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/utility/completion_callback_factory.h" - -#define READ_BUFFER_SIZE 32768 - -// GetURLHandler is used to download data from |url|. When download is -// finished or when an error occurs, it posts a message back to the browser -// with the results encoded in the message as a string and self-destroys. -// -// EXAMPLE USAGE: -// GetURLHandler* handler* = GetURLHandler::Create(instance,url); -// handler->Start(); -// -class GetURLHandler { - -public: - - enum Status { - - STATUS_NONE, - STATUS_IN_PROGRESS, - STATUS_COMPLETED, - STATUS_ERROR, - }; - -private: - - Status status; - - // Callback fo the pp::URLLoader::Open(). - // Called by pp::URLLoader when response headers are received or when an - // error occurs (in response to the call of pp::URLLoader::Open()). - // Look at and - // for more information about pp::URLLoader. - void OnOpen(int32_t result); - - // Callback fo the pp::URLLoader::ReadResponseBody(). - // |result| contains the number of bytes read or an error code. - // Appends data from this->buffer_ to this->url_response_body_. - void OnRead(int32_t result); - - // Reads the response body (asynchronously) into this->buffer_. - // OnRead() will be called when bytes are received or when an error occurs. - void ReadBody(); - - // Append data bytes read from the URL onto the internal buffer. Does - // nothing if |num_bytes| is 0. - void AppendDataBytes(const char* buffer, int32_t num_bytes); - - pp::Instance* instance_; // Weak pointer. - String url_; // URL to be downloaded. - pp::URLRequestInfo url_request_; - pp::URLLoader url_loader_; // URLLoader provides an API to download URLs. - char buffer_[READ_BUFFER_SIZE]; // Temporary buffer for reads. - Vector data; // Contains accumulated downloaded data. - pp::CompletionCallbackFactory cc_factory_; - bool complete; - - GetURLHandler(const GetURLHandler&); - void operator=(const GetURLHandler&); - -public: - // Creates instance of GetURLHandler on the heap. - // GetURLHandler objects shall be created only on the heap (they - // self-destroy when all data is in). - // Initiates page (URL) download. - void Start(); - - Status get_status() const; - Vector get_data() const; - - int get_bytes_read() const; - - GetURLHandler(pp::Instance* instance_, const String& url); - ~GetURLHandler(); -}; - -#endif // EXAMPLES_GETURL_GETURL_HANDLER_H_ - diff --git a/platform/nacl/godot_module.cpp b/platform/nacl/godot_module.cpp deleted file mode 100644 index 5c558f5ecea..00000000000 --- a/platform/nacl/godot_module.cpp +++ /dev/null @@ -1,332 +0,0 @@ -/*************************************************************************/ -/* godot_module.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "opengl_context.h" - -#include -#include -#include -#include - -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/module.h" -#include "ppapi/gles2/gl2ext_ppapi.h" - -#include "ppapi/cpp/rect.h" -#include "ppapi/cpp/size.h" -#include "ppapi/cpp/var.h" -#include "geturl_handler.h" - -#include "core/variant.h" -#include "os_nacl.h" - -extern int nacl_main(int argc, const char** argn, const char** argv); -extern void nacl_cleanup(); - -static String pkg_url; - -pp::Instance* godot_instance = NULL; - -struct StateData { - int arg_count; - Array args; - String method; -}; - -extern OSNacl* os_nacl; - -class GodotInstance : public pp::Instance { - - enum State { - STATE_METHOD, - STATE_PARAM_COUNT, - STATE_PARAMS, - STATE_CALL, - }; - - State state; - StateData* sd; - SharedOpenGLContext opengl_context_; - int width; - int height; - - #define MAX_ARGS 64 - uint32_t init_argc; - char* init_argn[MAX_ARGS]; - char* init_argv[MAX_ARGS]; - - bool package_loaded; - GetURLHandler* package_pending; - -public: - explicit GodotInstance(PP_Instance instance) : pp::Instance(instance) { - printf("GodotInstance!\n"); - state = STATE_METHOD; - RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_KEYBOARD | PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_TOUCH); - sd = NULL; - package_pending = NULL; - package_loaded = false; - godot_instance = this; - } - virtual ~GodotInstance() { - - nacl_cleanup(); - } - - /// Called by the browser to handle the postMessage() call in Javascript. - /// Detects which method is being called from the message contents, and - /// calls the appropriate function. Posts the result back to the browser - /// asynchronously. - /// @param[in] var_message The message posted by the browser. The possible - /// messages are 'fortyTwo' and 'reverseText:Hello World'. Note that - /// the 'reverseText' form contains the string to reverse following a ':' - /// separator. - virtual void HandleMessage(const pp::Var& var_message); - - bool HandleInputEvent(const pp::InputEvent& event); - - bool Init(uint32_t argc, const char* argn[], const char* argv[]) { - - printf("******* init! %i, %p, %p\n", argc, argn, argv); - fflush(stdout); - if (opengl_context_ == NULL) { - opengl_context_.reset(new OpenGLContext(this)); - }; - opengl_context_->InvalidateContext(this); - opengl_context_->ResizeContext(pp::Size(0, 0)); - int current = opengl_context_->MakeContextCurrent(this); - printf("current is %i\n", current); - - os_nacl = new OSNacl; - - pkg_url = ""; - for (uint32_t i=0; iStart(); - }; - return true; - }; - - // Called whenever the in-browser window changes size. - virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) { - - if (position.size().width() == width && - position.size().height() == height) - return; // Size didn't change, no need to update anything. - - if (opengl_context_ == NULL) { - opengl_context_.reset(new OpenGLContext(this)); - }; - opengl_context_->InvalidateContext(this); - opengl_context_->ResizeContext(position.size()); - if (!opengl_context_->MakeContextCurrent(this)) - return; - - width = position.size().width(); - height = position.size().height(); - // init gl here? - OS::VideoMode vm; - vm.width = width; - vm.height = height; - vm.resizable = false; - vm.fullscreen = true; - OS::get_singleton()->set_video_mode(vm, 0); - - DrawSelf(); - }; - - // Called to draw the contents of the module's browser area. - void DrawSelf() { - - if (opengl_context_ == NULL) - return; - - opengl_context_->FlushContext(); - }; -}; - -static Variant to_variant(const pp::Var& p_var) { - - if (p_var.is_undefined() || p_var.is_null()) - return Variant(); - if (p_var.is_bool()) - return Variant(p_var.AsBool()); - if (p_var.is_double()) - return Variant(p_var.AsDouble()); - if (p_var.is_int()) - return Variant((int64_t)p_var.AsInt()); - if (p_var.is_string()) - return Variant(String::utf8(p_var.AsString().c_str())); - - return Variant(); -}; - -void GodotInstance::HandleMessage(const pp::Var& var_message) { - - switch (state) { - - case STATE_METHOD: { - - ERR_FAIL_COND(!var_message.is_string()); - sd->method = var_message.AsString().c_str(); - state = STATE_PARAM_COUNT; - } break; - case STATE_PARAM_COUNT: { - - ERR_FAIL_COND(!var_message.is_number()); - sd->arg_count = var_message.AsInt(); - state = sd->arg_count>0?STATE_PARAMS:STATE_CALL; - - } break; - case STATE_PARAMS: { - - Variant p = to_variant(var_message); - sd->args.push_back(p); - if (sd->args.size() >= sd->arg_count) - state = STATE_CALL; - } break; - default: - break; - }; - - if (state == STATE_CALL) { - - // call - state = STATE_METHOD; - - - if (sd->method == "package_finished") { - - GetURLHandler::Status status = package_pending->get_status(); - printf("status is %i, %i, %i\n", status, GetURLHandler::STATUS_ERROR, GetURLHandler::STATUS_COMPLETED); - if (status == GetURLHandler::STATUS_ERROR) { - printf("Error fetching package!\n"); - }; - if (status == GetURLHandler::STATUS_COMPLETED) { - - OSNacl* os = (OSNacl*)OS::get_singleton(); - os->add_package(pkg_url, package_pending->get_data()); - }; - memdelete(package_pending); - package_pending = NULL; - - package_loaded = true; - - opengl_context_->MakeContextCurrent(this); - nacl_main(init_argc, (const char**)init_argn, (const char**)init_argv); - for (uint32_t i=0; imethod == "get_package_status") { - - if (package_loaded) { - // post "loaded" - PostMessage("loaded"); - } else if (package_pending == NULL) { - // post "none" - PostMessage("none"); - } else { - // post package_pending->get_bytes_read(); - PostMessage(package_pending->get_bytes_read()); - }; - }; - }; -} - -bool GodotInstance::HandleInputEvent(const pp::InputEvent& event) { - - OSNacl* os = (OSNacl*)OS::get_singleton(); - os->handle_event(event); - return true; -}; - -class GodotModule : public pp::Module { - public: - GodotModule() : pp::Module() {} - virtual ~GodotModule() { - glTerminatePPAPI(); - } - - /// Create and return a GodotInstance object. - /// @param[in] instance a handle to a plug-in instance. - /// @return a newly created GodotInstance. - /// @note The browser is responsible for calling @a delete when done. - virtual pp::Instance* CreateInstance(PP_Instance instance) { - printf("CreateInstance! %x\n", instance); - return new GodotInstance(instance); - } - - /// Called by the browser when the module is first loaded and ready to run. - /// This is called once per module, not once per instance of the module on - /// the page. - virtual bool Init() { - printf("GodotModule::init!\n"); - return glInitializePPAPI(get_browser_interface()); - } -}; - -namespace pp { -/// Factory function called by the browser when the module is first loaded. -/// The browser keeps a singleton of this module. It calls the -/// CreateInstance() method on the object you return to make instances. There -/// is one instance per tag on the page. This is the main binding -/// point for your NaCl module with the browser. -/// @return new GodotModule. -/// @note The browser is responsible for deleting returned @a Module. -Module* CreateModule() { - printf("CreateModule!\n"); - return new GodotModule(); -} -} // namespace pp diff --git a/platform/nacl/godot_nacl.cpp b/platform/nacl/godot_nacl.cpp deleted file mode 100644 index d8447390c1d..00000000000 --- a/platform/nacl/godot_nacl.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************/ -/* godot_nacl.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "os_nacl.h" -#include "main/main.h" - -#include -#include - -OSNacl* os_nacl = NULL; - -int nacl_main(int argc, const char** argn, const char** argv) { - - // os is created in GodotModule::Init for the nacl module - printf("called with %i args, %p, %p\n", argc, argn, argv); - char* nargv[64]; - int nargc = 1; - nargv[0] = (char*)argv[0]; - for (int i=1; i= |minChromeVersion_|. - * @type {integer} - * @private - */ - this.minChromeVersion_ = minChromeVersion; - - /** - * List of Browser plugin objects. - * @type {Ojbect array} - * @private - */ - this.plugins_ = plugins; - - /** - * Application version string from the Browser. - * @type {integer} - * @private - */ - this.appVersion_ = appVersion; - - /** - * Flag used to indicate if the browser has Native Client and is if the - * browser version is recent enough. - * @type {boolean} - * @private - */ - this.isValidBrowser_ = false; - - /** - * Actual major version of Chrome -- found by querying the browser. - * @type {integer} - * @private - */ - this.chromeVersion_ = null; - - /** - * Browser support status. This allows the user to get a detailed status - * rather than using this.browserSupportMessage. - */ - this.browserSupportStatus_ = - browser_version.BrowserChecker.StatusValues.UNKNOWN; -} - -/** - * The values used for BrowserChecker status to indicate success or - * a specific error. - * @enum {id} - */ -browser_version.BrowserChecker.StatusValues = { - UNKNOWN: 0, - NACL_ENABLED: 1, - UNKNOWN_BROWSER: 2, - CHROME_VERSION_TOO_OLD: 3, - NACL_NOT_ENABLED: 4, - NOT_USING_SERVER: 5 -}; - -/** - * Determines if the plugin with name |name| exists in the browser. - * @param {string} name The name of the plugin. - * @param {Object array} plugins The plugins in this browser. - * @return {bool} |true| if the plugin is found. - */ -browser_version.BrowserChecker.prototype.pluginExists = function(name, - plugins) { - for (var index=0; index < plugins.length; index++) { - var plugin = this.plugins_[index]; - var plugin_name = plugin['name']; - // If the plugin is not found, you can use the Javascript console - // to see the names of the plugins that were found when debugging. - if (plugin_name.indexOf(name) != -1) { - return true; - } - } - return false; -} - -/** - * Returns browserSupportStatus_ which indicates if the browser supports - * Native Client. Values are defined as literals in - * browser_version.BrowserChecker.StatusValues. - * @ return {int} Level of NaCl support. - */ -browser_version.BrowserChecker.prototype.getBrowserSupportStatus = function() { - return this.browserSupportStatus_; -} - -/** - * Returns isValidBrowser (true/false) to indicate if the browser supports - * Native Client. - * @ return {bool} If this browser has NativeClient and correct version. - */ -browser_version.BrowserChecker.prototype.getIsValidBrowser = function() { - return this.isValidBrowser_; -} - -/** - * Checks to see if this browser can support Native Client applications. - * For Chrome browsers, checks to see if the "Native Client" plugin is - * enabled. - */ -browser_version.BrowserChecker.prototype.checkBrowser = function() { - var versionPatt = /Chrome\/(\d+)\.(\d+)\.(\d+)\.(\d+)/; - var result = this.appVersion_.match(versionPatt); - - // |result| stores the Chrome version number. - if (!result) { - this.isValidBrowser_ = false; - this.browserSupportStatus_ = - browser_version.BrowserChecker.StatusValues.UNKNOWN_BROWSER; - } else { - this.chromeVersion_ = result[1]; - // We know we have Chrome, check version and/or plugin named Native Client - if (this.chromeVersion_ >= this.minChromeVersion_) { - var found_nacl = this.pluginExists('Native Client', this.plugins_); - if (found_nacl) { - this.isValidBrowser_ = true; - this.browserSupportStatus_ = - browser_version.BrowserChecker.StatusValues.NACL_ENABLED; - } else { - this.isValidBrowser_ = false; - this.browserSupportStatus_ = - browser_version.BrowserChecker.StatusValues.NACL_NOT_ENABLED; - } - } else { - // We are in a version that is less than |minChromeVersion_| - this.isValidBrowser_ = false; - this.browserSupportStatus_ = - browser_version.BrowserChecker.StatusValues.CHROME_VERSION_TOO_OLD; - } - } - var my_protocol = window.location.protocol; - if (my_protocol.indexOf('file') == 0) { - this.isValidBrowser_ = false; - this.browserSupportStatus_ = - browser_version.BrowserChecker.StatusValues.NOT_USING_SERVER; - } -} - diff --git a/platform/nacl/html/godot_nacl.nmf b/platform/nacl/html/godot_nacl.nmf deleted file mode 100644 index eca039ec1ee..00000000000 --- a/platform/nacl/html/godot_nacl.nmf +++ /dev/null @@ -1,6 +0,0 @@ -{ - "program": { - "x86-64": {"url": "godot_nacl.x86_64.nexe"}, - "x86-32": {"url": "godot_nacl.i686.nexe"} - } -} diff --git a/platform/nacl/html/icon_128.png b/platform/nacl/html/icon_128.png deleted file mode 100644 index 653669c38dcdd160a34601873d13ada33e0cd3a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11146 zcmV;5D|OU~P)n}lqJV~-~0Jhb@z=E zHzxoKfXItT03;v=P!f|!Qk>E;eGr%uc#VAGM2f0$#t4vh9;Vu(BA1Hl1;9q27bpS6r6%HA3<}hNCL+T)_d4*h ziK17f)oLqX%Vpwb(*hdDu}jjFO1aE0-f~OVFX>tU{`k&2X~r>uF&JYEsfFBrZU&<4-*fwKyM6W<%o({bq=3QGSb$;ROTbqY zCPl=OrVdpVWBAkwe1j7*>Fzu3@E=k&P6Q|7taG;lUj&wutDLF9oWZHZk@SBa_+^1d z0juB;IiX1~$9wW!n>VA*fvS1OrcEw@&^q@&fi1u?rqsLT4D*)?22Xzl65w*+A%%aQ zMPvq5ff<^729C+NX&*L-IAB0kzXtqN_9DXxgy#&F47ocinLZlBOVH zfE3l=0nX08d|Ivk>8m^xhXM^3us<$xATDw!DR3|;az%NRD@!A^)GSzn6$nK+5EuBH z@zwO$gq2~Fl|hRYL6eG22vAZL5~LHDpC$}*#kO3Lc6$%aCm^e*TU0b$vN=o>8 zK3&lFq>nTZ$NqMaXC?<|si7!oN9}eqxLkF=(W*0L`b5vWr_FuI5gMgn9Ns&XITKItHhOEb zch2wjp1)&9tIAMPAeaa99J%A_D9947{h31ocxN6GcFMR4>wt5o(QZkh2tnT9GVf=2 zEwHmy;b44h`+d9^-T+NCY-{v(z50(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z6W2`h=`QaG;QbC!23PxHnFy< zP!W-0=U%ik=o+e;BGM3JYLl(jB+h9uim>^;wW?M{(n7nfnx?eMWj@`-s-KPpugZHi zZ}tyS#fex%#HhN-YSkrS$l#$v{QPG>yVSIN%i``k?<5)e=Sm4-4I0@9m6A%RicmsIT0UrW$3b}wQ)abRr0{caUx0*d> zT*md|1x|uvtI=aVnoy`I4VnN~9MBQKin@qko~U8qBSc_(Fpova)sU%S5-c_G0HO*W zS#kmr5N;0UXuFKPvPz)_hf=Dc04&OsD0fEFjDzK$Jk|@zp|o9QT+Mjyj#})D>(p!j z4H)%c4Wfz>Pz6JvpBrxZS;oNtu+`{cay2YPW2RjJz9h1iT9T5N0f5pgs!9+?<4j5@ z3u+SRR)z>*3KiNeCzXsij=6lk&byrxR$4It%{W5E^4hB9@_NR_r{*Zjg3i>0fM5jh z2*a#oqdUu^pKtKpmmjm7!nw{gA6!}^Nn%cRw)y6>E4;W8qhcu)09-f?C9OJc|JkG2 zxyVcJt@Fd9oaLtFL4U&D;ehe#%e?yj1-{>TjHt)S{{&OP^RP_Ve7Z}w5ur(&Uy3D; zhB=cWaP!_iGqL6Nf#o1wqh57vo^6vQ^Gxy*H)TbS#>(-D^7iwK-1)oDD`(HpYejV1 z3A_CaqL^w{l> zxb*A-3f%guPZkVKo6A;xA2n8;LQhqAy>;M!9p?NY4SxG~$WOaNYLTT z_`(5qPoMS4MD3zQ{h}MmN_6V!bOE6Vq7$`7(7wQ@!1jOOAW1L2!h`z&0000 - - - - Load Progress Example - - - - - - - -

Native Client Load Event Example

- -

Status

-
NO-STATUS
- -
- - - - - - -
- -

Event Log

-
event log?
- - - - diff --git a/platform/nacl/html/manifest.json b/platform/nacl/html/manifest.json deleted file mode 100644 index 6e271507a99..00000000000 --- a/platform/nacl/html/manifest.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "Capsuleman's Castle Adventure", - "description": "Capsuleman's Castle Adventure", - "version": "1", - "app": { - "launch": { - "local_path": "index.html" - } - }, - "icons": { - "16": "icon_16.png", - "128": "icon_128.png" - }, - "permissions": [ - "unlimitedStorage", - "notifications", - "experimental" - ] -} diff --git a/platform/nacl/logo.png b/platform/nacl/logo.png deleted file mode 100644 index aac72c01b26b7152e26d540dabe5c1e00a891b1c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2705 zcmV;C3U2j@P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_000Sw zNklxp(g6a20oP5haQisfD(q$dVN&QDv+0iU#q66WdMdG)WQn zr472EMIT&bd29RN00oNHMII6qL2b)u5*v|?R8H#1vK>fPq-vo|iIl`eBE@Amcjj*A ze0|`sRSnyb5Ab1tJ2UtH|Mve8KK_ySnbw}`P4=-~cB{YhfC3QQWTpn_fD}k-pLy-s zZzc2F2&@4&0L?%<(0copp$$7WboUoUieX*gU7lN>KRJ2j^3=7tSzxhdD?k;nA4TM& z2pAv)+C^mGiO=pmu&1T|-mUA~cQuJNi?yH@MDUD99u`=rWHaX%OUDnLx%A4hvGLy6$wQsC={F!TE}4Ow)PjWGoML@ZFbQXQF2_=FWq7qYvP>_sdc-$v~**-M#%eia-nS}GyS(Sb>zov=w3$@SMgDN zW5lwly0_37dJJ_p(%;^oVNj6VdCZ$ST@H=RUOUH8P5Gst^XtGe-sDj&A{~W# z2JRaedimYS*JO2ArCu!x?e{%#;8EMB`xldCOkgm+k-+l^B#=*R_$03!KEl{kOt}33 zNiJ+@Z(vhz6TRJyB&m~9lrbBX=?&(jL$C4=&whg~cUJH>G;`hyc_*xsck7Uq=t}Fr z?IWkg$EM%2P%&$x*0nKG%`%)*Tn1TgiSn3g9+O+;MzjdFN>Z(`VwE^^tdvu3EL4c9 z8F6kYCysSliOIxtJut9Gl&ZbWfOsM_{D%QTVQ$i0!y7c8C!}`g&+`0m5lRC2}N6C{=Ks_lHvP; zxC~s5FLT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f -#include "ppapi/gles2/gl2ext_ppapi.h" -#include "os_nacl.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/module.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/utility/completion_callback_factory.h" - - -namespace { -// This is called by the brower when the 3D context has been flushed to the -// browser window. -void FlushCallback(void* data, int32_t result) { - static_cast(data)->set_flush_pending(false); - static_cast(data)->FlushContext(); -} -} // namespace - -OpenGLContext::OpenGLContext(pp::Instance* p_instance) - : pp::Graphics3DClient(p_instance), - flush_pending_(false) { - - instance = p_instance; - pp::Module* module = pp::Module::Get(); - assert(module); - gles2_interface_ = static_cast( - module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE)); - assert(gles2_interface_); -} - -OpenGLContext::~OpenGLContext() { - glSetCurrentContextPPAPI(0); -} - -bool OpenGLContext::MakeContextCurrent(pp::Instance* instance) { - - if (instance == NULL) { - glSetCurrentContextPPAPI(0); - return false; - } - // Lazily create the Pepper context. - if (context_.is_null()) { - int32_t attribs[] = { - PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, - PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24, - PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8, - PP_GRAPHICS3DATTRIB_SAMPLES, 0, - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, - PP_GRAPHICS3DATTRIB_WIDTH, width, - PP_GRAPHICS3DATTRIB_HEIGHT, height, - PP_GRAPHICS3DATTRIB_NONE - }; - - context_ = pp::Graphics3D(instance, pp::Graphics3D(), attribs); - if (context_.is_null()) { - glSetCurrentContextPPAPI(0); - return false; - } - instance->BindGraphics(context_); - } - glSetCurrentContextPPAPI(context_.pp_resource()); - return true; -} - -void OpenGLContext::ResizeContext(const pp::Size& size) { - - width = size.width(); - height = size.height(); - - if (!context_.is_null()) { - context_.ResizeBuffers(size.width(), size.height()); - } -} - - -void OpenGLContext::InvalidateContext(pp::Instance* instance) { - glSetCurrentContextPPAPI(0); -} - -void OpenGLContext::FlushContext() { - if (flush_pending()) { - // A flush is pending so do nothing; just drop this flush on the floor. - return; - } - set_flush_pending(true); - - OSNacl* os = (OSNacl*)OS::get_singleton(); - MakeContextCurrent(instance); - os->iterate(); - - context_.SwapBuffers(pp::CompletionCallback(&FlushCallback, this)); -} - diff --git a/platform/nacl/opengl_context.h b/platform/nacl/opengl_context.h deleted file mode 100644 index f03a4b3e53c..00000000000 --- a/platform/nacl/opengl_context.h +++ /dev/null @@ -1,124 +0,0 @@ -/*************************************************************************/ -/* opengl_context.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef EXAMPLES_TUMBLER_OPENGL_CONTEXT_H_ -#define EXAMPLES_TUMBLER_OPENGL_CONTEXT_H_ - -/// -/// @file -/// OpenGLContext manages the OpenGL context in the browser that is associated -/// with a @a pp::Instance instance. -/// - -#include - -#include -#include - -#include "ppapi/c/ppb_opengles2.h" -//#include "ppapi/cpp/dev/context_3d_dev.h" -#include "ppapi/cpp/graphics_3d_client.h" -#include "ppapi/cpp/graphics_3d.h" -//#include "ppapi/cpp/dev/surface_3d_dev.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/size.h" - -// A convenience wrapper for a shared OpenGLContext pointer type. As other -// smart pointer types are needed, add them here. - -#include - -class OpenGLContext; - -typedef std::tr1::shared_ptr SharedOpenGLContext; - -/// OpenGLContext manages an OpenGL rendering context in the browser. -/// -class OpenGLContext : public pp::Graphics3DClient { - public: - explicit OpenGLContext(pp::Instance* instance); - - /// Release all the in-browser resources used by this context, and make this - /// context invalid. - virtual ~OpenGLContext(); - - /// The Graphics3DClient interfcace. - virtual void Graphics3DContextLost() { - assert(!"Unexpectedly lost graphics context"); - } - - /// Make @a this the current 3D context in @a instance. - /// @param instance The instance of the NaCl module that will receive the - /// the current 3D context. - /// @return success. - bool MakeContextCurrent(pp::Instance* instance); - - /// Flush the contents of this context to the browser's 3D device. - void FlushContext(); - - /// Make the underlying 3D device invalid, so that any subsequent rendering - /// commands will have no effect. The next call to MakeContextCurrent() will - /// cause the underlying 3D device to get rebound and start receiving - /// receiving rendering commands again. Use InvalidateContext(), for - /// example, when resizing the context's viewing area. - void InvalidateContext(pp::Instance* instance); - - void ResizeContext(const pp::Size& size); - - /// The OpenGL ES 2.0 interface. - const struct PPB_OpenGLES2_Dev* gles2() const { - return gles2_interface_; - } - - /// The PP_Resource needed to make GLES2 calls through the Pepper interface. - const PP_Resource gl_context() const { - return context_.pp_resource(); - } - - /// Indicate whether a flush is pending. This can only be called from the - /// main thread; it is not thread safe. - bool flush_pending() const { - return flush_pending_; - } - void set_flush_pending(bool flag) { - flush_pending_ = flag; - } - - private: - pp::Graphics3D context_; - bool flush_pending_; - - int width, height; - - pp::Instance* instance; - - const struct PPB_OpenGLES2_Dev* gles2_interface_; -}; - -#endif // EXAMPLES_TUMBLER_OPENGL_CONTEXT_H_ - diff --git a/platform/nacl/os_nacl.cpp b/platform/nacl/os_nacl.cpp deleted file mode 100644 index e2a92ee8c7b..00000000000 --- a/platform/nacl/os_nacl.cpp +++ /dev/null @@ -1,566 +0,0 @@ -/*************************************************************************/ -/* os_nacl.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "os_nacl.h" - -#include "drivers/unix/memory_pool_static_malloc.h" -#include "os/memory_pool_dynamic_static.h" -#include "main/main.h" -#include -#include -#include -#include - -#include "io/file_access_memory.h" -#include "core/io/file_access_pack.h" -#include "scene/io/scene_loader.h" -#include "scene/main/scene_main_loop.h" - -#include "servers/visual/visual_server_raster.h" - -#include "drivers/gles2/rasterizer_gles2.h" -#include "nacl_keycodes.h" - -#include "core/globals.h" -#include "core/input_map.h" - -#include -#include - -#define UNIX_ENABLED -#include "drivers/unix/thread_posix.h" -#include "drivers/unix/semaphore_posix.h" -#include "drivers/unix/mutex_posix.h" - - -int OSNacl::get_video_driver_count() const { - - return 1; -}; -const char * OSNacl::get_video_driver_name(int p_driver) const { - - return "GLES2"; -}; - -OS::VideoMode OSNacl::get_default_video_mode() const { - - return OS::VideoMode(800,600,false); -}; - -int OSNacl::get_audio_driver_count() const { - - return 1; -}; - -const char * OSNacl::get_audio_driver_name(int p_driver) const { - - return "nacl_audio"; -}; - -static MemoryPoolStaticMalloc *mempool_static=NULL; -static MemoryPoolDynamicStatic *mempool_dynamic=NULL; - -void OSNacl::initialize_core() { - - ticks_start=0; - ticks_start=get_ticks_usec(); -}; - -void OSNacl::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) { - - rasterizer = memnew( RasterizerGLES2 ); - visual_server = memnew( VisualServerRaster(rasterizer) ); - visual_server->init(); - visual_server->cursor_set_visible(false, 0); - - audio_driver = memnew(AudioDriverNacl); - audio_driver->set_singleton(); - audio_driver->init(); - - sample_manager = memnew( SampleManagerMallocSW ); - audio_server = memnew( AudioServerSW(sample_manager) ); - audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false); - audio_server->init(); - - spatial_sound_server = memnew( SpatialSoundServerSW ); - spatial_sound_server->init(); - - spatial_sound_2d_server = memnew( SpatialSound2DServerSW ); - spatial_sound_2d_server->init(); - - // - physics_server = memnew( PhysicsServerSW ); - physics_server->init(); - - physics_2d_server = memnew( Physics2DServerSW ); - physics_2d_server->init(); - - input = memnew(InputDefault); -}; - -void OSNacl::set_main_loop( MainLoop * p_main_loop ) { - - main_loop = p_main_loop; - input->set_main_loop(p_main_loop); - main_loop->init(); -}; - -void OSNacl::delete_main_loop() { - - if (main_loop) - memdelete(main_loop); -}; - -void OSNacl::finalize() { - - -}; -void OSNacl::finalize_core() { - - if (mempool_dynamic) - memdelete( mempool_dynamic ); - delete mempool_static; - -}; - -void OSNacl::alert(const String& p_alert,const String& p_title) { - - fprintf(stderr,"ERROR: %s\n",p_alert.utf8().get_data()); -}; - -void OSNacl::vprint(const char* p_format, va_list p_list, bool p_strerr) { - - vprintf(p_format,p_list); - fflush(stdout); -} - - -String OSNacl::get_stdin_string(bool p_block) { - - char buff[1024]; - return fgets(buff,1024,stdin); -}; - -void OSNacl::set_mouse_show(bool p_show) { - -}; - -void OSNacl::set_mouse_grab(bool p_grab) { - -}; - -bool OSNacl::is_mouse_grab_enabled() const { - - return false; -}; - -int OSNacl::get_mouse_button_state() const { - - return mouse_mask; -}; - - -Point2 OSNacl::get_mouse_pos() const { - - return Point2(); -}; - -void OSNacl::set_window_title(const String& p_title) { -}; - -void OSNacl::set_video_mode(const VideoMode& p_video_mode, int p_screen) { - - video_mode = p_video_mode; -}; - -OS::VideoMode OSNacl::get_video_mode(int p_screen) const { - - return video_mode; -}; - -void OSNacl::get_fullscreen_mode_list(List *p_list,int p_screen) const { - -}; - -Error OSNacl::execute(const String& p_path, const List& p_arguments,bool p_blocking, OS::ProcessID *r_child_id, String* r_pipe, int *r_exitcode) { - - return ERR_UNAVAILABLE; -}; - -Error OSNacl::kill(const ProcessID& p_pid) { - - return ERR_UNAVAILABLE; -}; - -bool OSNacl::has_environment(const String& p_var) const { - - return getenv(p_var.utf8().get_data())!=NULL; -}; - -String OSNacl::get_environment(const String& p_var) const { - - if (getenv(p_var.utf8().get_data())) - return getenv(p_var.utf8().get_data()); - return ""; -}; - -String OSNacl::get_name() { - - return "NaCl"; -}; - -MainLoop *OSNacl::get_main_loop() const { - - return main_loop; -}; - -OS::Date OSNacl::get_date(bool utc) const { - - time_t t=time(NULL); - struct tm *lt; - if (utc) - lt=gmtime(&t); - else - lt=localtime(&t); - Date ret; - ret.year=lt->tm_year; - - // Index starting at 1 to match OS_Unix::get_date - // and Windows SYSTEMTIME and tm_mon follows the typical structure - // of 0-11, noted here: http://www.cplusplus.com/reference/ctime/tm/ - ret.month=(Month)(lt->tm_mon+1); - ret.day=lt->tm_mday; - ret.weekday=(Weekday)lt->tm_wday; - ret.dst=lt->tm_isdst; - - return ret; -}; - -OS::Time OSNacl::get_time(bool utc) const { - - time_t t=time(NULL); - struct tm *lt; - if (utc) - lt=gmtime(&t); - else - lt=localtime(&t); - Time ret; - ret.hour=lt->tm_hour; - ret.min=lt->tm_min; - ret.sec=lt->tm_sec; - return ret; -}; - -OS::TimeZoneInfo OS_Unix::get_time_zone_info() const { - time_t t = time(NULL); - struct tm *lt = localtime(&t); - char name[16]; - strftime(name, 16, "%Z", lt); - name[15] = 0; - TimeZoneInfo ret; - ret.name = name; - - char bias_buf[16]; - strftime(bias_buf, 16, "%z", lt); - int bias; - bias_buf[15] = 0; - sscanf(bias_buf, "%d", &bias); - - // convert from ISO 8601 (1 minute=1, 1 hour=100) to minutes - int hour = (int)bias / 100; - int minutes = bias % 100; - if (bias < 0) - ret.bias = hour * 60 - minutes; - else - ret.bias = hour * 60 + minutes; - - return ret; -}; - -void OSNacl::delay_usec(uint32_t p_usec) const { - - //usleep(p_usec); -}; - -uint64_t OSNacl::get_ticks_usec() const { - - struct timeval tv_now; - gettimeofday(&tv_now,NULL); - - uint64_t longtime = (uint64_t)tv_now.tv_usec + (uint64_t)tv_now.tv_sec*1000000L; - longtime-=ticks_start; - - return longtime; -}; - -bool OSNacl::can_draw() const { - - return minimized != true; -}; - -void OSNacl::queue_event(const InputEvent& p_event) { - - ERR_FAIL_INDEX( event_count, MAX_EVENTS ); - - event_queue[event_count++] = p_event; -}; - -void OSNacl::add_package(String p_name, Vector p_data) { - - FileAccessMemory::register_file(p_name, p_data); - FileAccess::make_default(FileAccess::ACCESS_RESOURCES); - FileAccess::make_default(FileAccess::ACCESS_USERDATA); - FileAccess::make_default(FileAccess::ACCESS_FILESYSTEM); - - if (!PackedData::get_singleton()) - memnew(PackedData); - - printf("adding package %ls, %x\n", p_name.c_str(), PackedData::get_singleton()); - PackedData::get_singleton()->set_disabled(true); - PackedData::get_singleton()->add_pack(p_name); - PackedData::get_singleton()->set_disabled(false); - printf("added\n"); -}; - -void OSNacl::set_cursor_shape(CursorShape p_shape) { - - -}; - -String OSNacl::get_resource_dir() const { - - return "."; -}; - -static int mouse_button(int p_nacl_but) { - - switch (p_nacl_but) { - - case PP_INPUTEVENT_MOUSEBUTTON_LEFT: - return BUTTON_LEFT; - case PP_INPUTEVENT_MOUSEBUTTON_MIDDLE: - return BUTTON_MIDDLE; - case PP_INPUTEVENT_MOUSEBUTTON_RIGHT: - return BUTTON_RIGHT; - }; - - return 0; -}; - -static InputModifierState modifier(uint32_t p_mod) { - - InputModifierState mod_mask; - - mod_mask.shift = p_mod & PP_INPUTEVENT_MODIFIER_SHIFTKEY; - mod_mask.alt = p_mod & PP_INPUTEVENT_MODIFIER_ALTKEY; - mod_mask.control = p_mod & PP_INPUTEVENT_MODIFIER_CONTROLKEY; - mod_mask.meta = p_mod & PP_INPUTEVENT_MODIFIER_METAKEY; - - return mod_mask; -}; - - - -void OSNacl::handle_event(const pp::InputEvent& p_event) { - - int type = p_event.GetType(); - switch (type) { - - case PP_INPUTEVENT_TYPE_MOUSEDOWN: - case PP_INPUTEVENT_TYPE_MOUSEUP: - case PP_INPUTEVENT_TYPE_WHEEL: { - - InputEvent event; - event.ID=++event_id; - event.type = InputEvent::MOUSE_BUTTON; - event.device=0; - - pp::MouseInputEvent mevent(p_event); - if (type == PP_INPUTEVENT_TYPE_WHEEL) { - - pp::WheelInputEvent wevent(p_event);; - float ticks = wevent.GetTicks().y(); - if (ticks == 0) - break; // whut? - - event.mouse_button.pressed = true; - event.mouse_button.button_index = ticks > 0 ? BUTTON_WHEEL_UP : BUTTON_WHEEL_DOWN; - event.mouse_button.doubleclick = false; - - } else { - - event.mouse_button.pressed = (type == PP_INPUTEVENT_TYPE_MOUSEDOWN); - event.mouse_button.button_index = mouse_button(mevent.GetButton()); - event.mouse_button.doubleclick = (mevent.GetClickCount() % 2) == 0; - - mouse_mask &= ~(1<< (event.mouse_button.button_index - 1)); - mouse_mask |= (event.mouse_button.pressed << (event.mouse_button.button_index - 1)); - }; - pp::Point pos = mevent.GetPosition(); - event.mouse_button.button_mask = mouse_mask; - event.mouse_button.global_x = pos.x(); - event.mouse_button.x = pos.x(); - event.mouse_button.global_y = pos.y(); - event.mouse_button.y = pos.y(); - event.mouse_button.pointer_index = 0; - event.mouse_button.mod = modifier(p_event.GetModifiers()); - queue_event(event); - - } break; - - case PP_INPUTEVENT_TYPE_MOUSEMOVE: { - - pp::MouseInputEvent mevent(p_event); - pp::Point pos = mevent.GetPosition(); - - InputEvent event; - event.ID=++event_id; - event.type = InputEvent::MOUSE_MOTION; - event.mouse_motion.pointer_index = 0; - event.mouse_motion.global_x = pos.x(); - event.mouse_motion.global_y = pos.y(); - event.mouse_motion.x = pos.x(); - event.mouse_motion.y = pos.y(); - event.mouse_motion.button_mask = mouse_mask; - event.mouse_motion.mod = modifier(p_event.GetModifiers()); - - event.mouse_motion.relative_x = pos.x() - mouse_last_x; - event.mouse_motion.relative_y = pos.y() - mouse_last_y; - mouse_last_x = pos.x(); - mouse_last_y = pos.y(); - - queue_event(event); - - } break; - - case PP_INPUTEVENT_TYPE_RAWKEYDOWN: - case PP_INPUTEVENT_TYPE_KEYDOWN: - case PP_INPUTEVENT_TYPE_KEYUP: { - - pp::KeyboardInputEvent kevent(p_event); - bool is_char; - uint32_t key = godot_key(kevent.GetKeyCode(), is_char); - if (type != PP_INPUTEVENT_TYPE_KEYUP && is_char) { - - last_scancode = key; - break; - }; - - InputEvent event; - event.ID=++event_id; - event.type = InputEvent::KEY; - event.key.pressed = (type != PP_INPUTEVENT_TYPE_KEYUP); - event.key.scancode = key; - event.key.unicode = key; - - event.key.echo = p_event.GetModifiers() & PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT; - event.key.mod = modifier(p_event.GetModifiers()); - queue_event(event); - } break; - - case PP_INPUTEVENT_TYPE_CHAR: { - - pp::KeyboardInputEvent kevent(p_event); - InputEvent event; - event.ID = ++event_id; - event.type = InputEvent::KEY; - event.key.pressed = true; - event.key.scancode = last_scancode; - event.key.unicode = kevent.GetCharacterText().AsString().c_str()[0]; - event.key.mod = modifier(p_event.GetModifiers()); - event.key.echo = p_event.GetModifiers() & PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT; - queue_event(event); - - } break; - - /* - case NPEventType_Minimize: { - - minimized = p_event->u.minimize.value == 1; - - } break; - - - case NPEventType_Focus: { - - if (p_event->u.focus.value == 1) { - main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); - } else { - main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); - }; - } break; - - */ - - default: - ; - }; -}; - -bool OSNacl::iterate() { - - if (!main_loop) { - event_count = 0; - return true; - }; - - for (int i=0; iparse_input_event(event_queue[i]); - }; - - event_count = 0; - - return Main::iteration(); -}; - - -OSNacl::OSNacl() { - - main_loop=NULL; - mempool_dynamic = NULL; - mempool_static = NULL; - mouse_last_x = 0; - mouse_last_y = 0; - event_count = 0; - event_id = 0; - mouse_mask = 0; - video_mode = get_default_video_mode(); - last_scancode = 0; - minimized = false; - - ThreadPosix::make_default(); - SemaphorePosix::make_default(); - MutexPosix::make_default(); - mempool_static = new MemoryPoolStaticMalloc; - mempool_dynamic = memnew( MemoryPoolDynamicStatic ); -}; - -OSNacl::~OSNacl() { - -}; diff --git a/platform/nacl/os_nacl.h b/platform/nacl/os_nacl.h deleted file mode 100644 index 689aa07e207..00000000000 --- a/platform/nacl/os_nacl.h +++ /dev/null @@ -1,156 +0,0 @@ -/*************************************************************************/ -/* os_nacl.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef OS_NACL_H -#define OS_NACL_H - -#include "core/os/os.h" - -#include "servers/visual_server.h" -#include "servers/visual/rasterizer.h" -#include "servers/physics/physics_server_sw.h" -#include "servers/spatial_sound/spatial_sound_server_sw.h" -#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h" -#include "servers/audio/audio_server_sw.h" -#include "servers/physics_2d/physics_2d_server_sw.h" -#include "audio_driver_nacl.h" -#include "os/input.h" - - -#include - -class OSNacl : OS { - - uint64_t ticks_start; - -protected: - - enum { - MAX_EVENTS = 64, - }; - - MainLoop *main_loop; - - Rasterizer *rasterizer; - VisualServer *visual_server; - PhysicsServer *physics_server; - SpatialSoundServerSW *spatial_sound_server; - - AudioServerSW *audio_server; - SampleManagerMallocSW *sample_manager; - SpatialSound2DServerSW *spatial_sound_2d_server; - Physics2DServer *physics_2d_server; - AudioDriverNacl* audio_driver; - - - // functions used by main to initialize/deintialize the OS - virtual int get_video_driver_count() const; - virtual const char * get_video_driver_name(int p_driver) const; - - virtual VideoMode get_default_video_mode() const; - - virtual int get_audio_driver_count() const; - virtual const char * get_audio_driver_name(int p_driver) const; - - void vprint(const char* p_format, va_list p_list, bool p_stderr); - - virtual void initialize_core(); - virtual void initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver); - - virtual void set_main_loop( MainLoop * p_main_loop ); - virtual void delete_main_loop(); - - virtual void finalize(); - virtual void finalize_core(); - - int mouse_last_x, mouse_last_y; - - InputEvent event_queue[MAX_EVENTS]; - int event_count; - void queue_event(const InputEvent& p_event); - - int event_id; - uint32_t mouse_mask; - - uint32_t last_scancode; - - bool minimized; - - VideoMode video_mode; - - InputDefault *input; - -public: - - void add_package(String p_name, Vector p_data); - - void handle_event(const pp::InputEvent& p_event); - - virtual void alert(const String& p_alert,const String& p_title); - virtual String get_stdin_string(bool p_block); - - virtual void set_mouse_show(bool p_show); - virtual void set_mouse_grab(bool p_grab); - virtual bool is_mouse_grab_enabled() const; - virtual Point2 get_mouse_pos() const; - virtual int get_mouse_button_state() const; - virtual void set_window_title(const String& p_title); - - virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen); - virtual VideoMode get_video_mode(int p_screen) const; - virtual void get_fullscreen_mode_list(List *p_list,int p_screen) const; - - virtual Error execute(const String& p_path, const List& p_arguments,bool p_blocking,ProcessID *r_child_id=NULL,String* r_pipe=NULL,int *r_exitcode=NULL); - virtual Error kill(const ProcessID& p_pid); - - virtual bool has_environment(const String& p_var) const; - virtual String get_environment(const String& p_var) const; - - virtual void set_cursor_shape(CursorShape p_shape); - - virtual String get_name(); - - virtual MainLoop *get_main_loop() const; - - virtual Date get_date(bool utc) const; - virtual Time get_time(bool utc) const; - - virtual void delay_usec(uint32_t p_usec) const; - virtual uint64_t get_ticks_usec() const; - - virtual String get_resource_dir() const; - - virtual bool can_draw() const; - - bool iterate(); - - OSNacl(); - ~OSNacl(); -}; - -#endif // OS_NACL_H diff --git a/platform/nacl/pepper_main.cpp b/platform/nacl/pepper_main.cpp deleted file mode 100644 index 6b817766246..00000000000 --- a/platform/nacl/pepper_main.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/*************************************************************************/ -/* pepper_main.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. - ("Apple") in consideration of your agreement to the following terms, and - your use, installation, modification or redistribution of this Apple software - constitutes acceptance of these terms. If you do not agree with these terms, - please do not use, install, modify or redistribute this Apple software. - - In consideration of your agreement to abide by the following terms, and - subject to these terms, Apple grants you a personal, non-exclusive license, - under Apple's copyrights in this original Apple software - (the "Apple Software"), to use, reproduce, modify and redistribute the Apple - Software, with or without modifications, in source and/or binary forms; - provided that if you redistribute the Apple Software in its entirety and - without modifications, you must retain this notice and the following text and - disclaimers in all such redistributions of the Apple Software. Neither the - name, trademarks, service marks or logos of Apple Computer, Inc. may be used - to endorse or promote products derived from the Apple Software without - specific prior written permission from Apple. Except as expressly stated in - this notice, no other rights or licenses, express or implied, are granted by - Apple herein, including but not limited to any patent rights that may be - infringed by your derivative works or by other works in which the Apple - Software may be incorporated. - - The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO - WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED - WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN - COMBINATION WITH YOUR PRODUCTS. - - IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION - AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER - THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR - OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#include "os_nacl.h" -#include - -#include -#include -#include -#include - -static NPNetscapeFuncs kBrowserFuncs = { 0 }; -static NPNetscapeFuncs* browser = &kBrowserFuncs; - -static NPDevice* device3d_ = NULL; -static PGLContext pgl_context_; -static NPDeviceContext3D context3d_; -static int width_; -static int height_; - -extern int nacl_main(int argc, char** argn, char** argv); -extern void nacl_cleanup(); - -NPExtensions* extensions = NULL; -static NPP npp_; - -const int32_t kCommandBufferSize = 1024 * 1024; - -// Plugin entry points -extern "C" { - -// Plugin entry points - -// Entrypoints ----------------------------------------------------------------- - -NPError NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { - plugin_funcs->version = 11; - plugin_funcs->size = sizeof(plugin_funcs); - plugin_funcs->newp = NPP_New; - plugin_funcs->destroy = NPP_Destroy; - plugin_funcs->setwindow = NPP_SetWindow; - plugin_funcs->newstream = NPP_NewStream; - plugin_funcs->destroystream = NPP_DestroyStream; - plugin_funcs->asfile = NPP_StreamAsFile; - plugin_funcs->writeready = NPP_WriteReady; - plugin_funcs->write = (NPP_WriteUPP)NPP_Write; - plugin_funcs->print = NPP_Print; - plugin_funcs->event = NPP_HandleEvent; - plugin_funcs->urlnotify = NPP_URLNotify; - plugin_funcs->getvalue = NPP_GetValue; - plugin_funcs->setvalue = NPP_SetValue; - - return NPERR_NO_ERROR; -} - -NPError NP_Shutdown() { - pglTerminate(); - return NPERR_NO_ERROR; -} - -NPError NP_GetValue(void* instance, NPPVariable variable, void* value); -char* NP_GetMIMEDescription(); - -NPError NP_Initialize(NPNetscapeFuncs* browser_funcs, - NPPluginFuncs* plugin_funcs) { - printf("NPP_Initialize\n"); - memcpy(&kBrowserFuncs, browser_funcs, sizeof(kBrowserFuncs)); - pglInitialize(); - return NP_GetEntryPoints(plugin_funcs); -} - - -} // extern "C" - -void Initialize3D() { - // Initialize a 3D context. - NPDeviceContext3DConfig config; - config.commandBufferSize = kCommandBufferSize; - NPError err = device3d_->initializeContext(npp_, &config, &context3d_); - if (err != NPERR_NO_ERROR) { - printf("Failed to initialize 3D context\n"); - exit(1); - } - - // Create a PGL context. - pgl_context_ = pglCreateContext(npp_, device3d_, &context3d_); - - // Initialize the demo GL state. - //pglMakeCurrent(pgl_context_); - //GLFromCPPInit(); - //pglMakeCurrent(NULL); -} - -NPError NPP_New(NPMIMEType pluginType, - NPP instance, - uint16_t mode, - int16_t argc, char* argn[], char* argv[], - NPSavedData* saved) { - printf("NPP_New\n"); - if (browser->version >= 14) { - - npp_ = instance; - if (!extensions) { - browser->getvalue(npp_, NPNVPepperExtensions, - reinterpret_cast(&extensions)); - // CHECK(extensions); - } - - printf("%s: %i\n", __FUNCTION__, __LINE__); - - device3d_ = extensions->acquireDevice(npp_, NPPepper3DDevice); - if (device3d_ == NULL) { - printf("Failed to acquire 3DDevice\n"); - exit(1); - } - printf("%s: %i\n", __FUNCTION__, __LINE__); - - /* - deviceaudio_ = extensions->acquireDevice(npp_, NPPepperAudioDevice); - if (deviceaudio_ == NULL) { - printf("Failed to acquire AudioDevice\n"); - exit(1); - } - */ - Initialize3D(); - pglMakeCurrent(pgl_context_); - nacl_main(argc, argn, argv); - pglMakeCurrent(NULL); - }; - - return NPERR_NO_ERROR; -} - -NPError NPP_Destroy(NPP instance, NPSavedData** save) { - - nacl_cleanup(); - - return NPERR_NO_ERROR; -} - -void Destroy3D() { - printf("destroy 3d\n"); - // Destroy the PGL context. - pglDestroyContext(pgl_context_); - pgl_context_ = NULL; - - // Destroy the Device3D context. - device3d_->destroyContext(npp_, &context3d_); -} - -static void iteration(void* data) { - - (void)data; - OSNacl* os = (OSNacl*)OS::get_singleton(); - - if (!pglMakeCurrent(pgl_context_) && pglGetError() == PGL_CONTEXT_LOST) { - printf("******* Lost context! :O\n"); - Destroy3D(); - Initialize3D(); - pglMakeCurrent(pgl_context_); - } - - glViewport(0, 0, width_, height_); - - os->iterate(); - - pglSwapBuffers(); - pglMakeCurrent(NULL); - - browser->pluginthreadasynccall(npp_, iteration, NULL); -}; - -NPError NPP_SetWindow(NPP instance, NPWindow* window) { - - width_ = window->width; - height_ = window->height; - - if (!pgl_context_) - Initialize3D(); - - // Schedule the first call to Draw. - OSNacl* os = (OSNacl*)OS::get_singleton(); - OS::VideoMode vm; - vm.width = width_; - vm.height = height_; - vm.resizable = false; - vm.fullscreen = false; - os->set_video_mode(vm); - - browser->pluginthreadasynccall(npp_, iteration, NULL); - - return NPERR_NO_ERROR; -} - -NPError NPP_NewStream(NPP instance, - NPMIMEType type, - NPStream* stream, - NPBool seekable, - uint16_t* stype) { - *stype = NP_ASFILEONLY; - return NPERR_NO_ERROR; -} - -NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason) { - return NPERR_NO_ERROR; -} - -void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname) { -} - -int32_t NPP_Write(NPP instance, - NPStream* stream, - int32_t offset, - int32_t len, - void* buffer) { - return 0; -} - -int32_t NPP_WriteReady(NPP instance, NPStream* stream) { - return 0; -} - -void NPP_Print(NPP instance, NPPrint* platformPrint) { -} - -int16_t NPP_HandleEvent(NPP instance, void* event) { - - OSNacl* os = (OSNacl*)OS::get_singleton(); - os->handle_event(event); - return 1; -} - -void NPP_URLNotify(NPP instance, - const char* url, - NPReason reason, - void* notify_data) { - // PluginObject* obj = static_cast(instance->pdata); -} - -static NPObject* Allocate(NPP npp, NPClass* npclass) { - return new NPObject; -} - -static void Deallocate(NPObject* object) { - delete object; -} - -// Return |true| if |method_name| is a recognized method. -static bool HasMethod(NPObject* obj, NPIdentifier method_name) { - - char *name = NPN_UTF8FromIdentifier(method_name); - bool is_method = false; - if (strcmp((const char *)name, "start_package") == 0) { - is_method = true; - } else if (strcmp((const char*)name, "add_package_chunk") == 0) { - is_method = true; - } else if (strcmp((const char*)name, "end_package") == 0) { - is_method = true; - } else if (strcmp((const char*)name, "start_scene") == 0) { - is_method = true; - } - NPN_MemFree(name); - return is_method; -} - -// I don't know what this is -static bool InvokeDefault(NPObject *obj, const NPVariant *args, - uint32_t argCount, NPVariant *result) { - if (result) { - NULL_TO_NPVARIANT(*result); - } - return true; -} - -static uint8_t* mem = NULL; -static int pkg_size = 0; -static String pkgname; - -static bool variant_is_number(const NPVariant& v) { - - switch (v.type) { - - case NPVariantType_Int32: - case NPVariantType_Double: - return true; - - default: - return false; - } - return false; -}; - -static double variant_as_number(const NPVariant& v) { - - switch (v.type) { - - case NPVariantType_Int32: - return (double)v.value.intValue; - case NPVariantType_Double: - return (double)v.value.doubleValue; - default: - return 0; - } - - return 0; -}; - -// Invoke() is called by the browser to invoke a function object whose name -// is |method_name|. -static bool Invoke(NPObject* obj, - NPIdentifier method_name, - const NPVariant *args, - uint32_t arg_count, - NPVariant *result) { - NULL_TO_NPVARIANT(*result); - char *name = NPN_UTF8FromIdentifier(method_name); - if (name == NULL) - return false; - bool rval = false; - - OSNacl* os = (OSNacl*)OS::get_singleton(); - - if (strcmp(name, "start_package") == 0) { - - printf("arg count is %i\n", arg_count); - for (int i=0; iadd_package(pkgname, mem, pkg_size); - return true; - }; - - - if (strcmp(name, "start_scene") == 0) { -printf("start_scene!\n"); - if (arg_count != 1) { - return false; - }; - - if (args[0].type != NPVariantType_String) return false; -printf("calling with param %s\n", args[0].value.stringValue.UTF8Characters); - - printf("pepper iteration\n"); - if (!pglMakeCurrent(pgl_context_) && pglGetError() == PGL_CONTEXT_LOST) { - printf("******* Lost context! :O\n"); - Destroy3D(); - Initialize3D(); - pglMakeCurrent(pgl_context_); - } - os->start_scene(String::utf8(args[0].value.stringValue.UTF8Characters)); - pglSwapBuffers(); - pglMakeCurrent(NULL); - -printf("returning true\n"); - return true; - }; - - NPN_MemFree(name); - - return rval; -} - - -static NPClass GodotClass = { - NP_CLASS_STRUCT_VERSION, - Allocate, - Deallocate, - NULL, // Invalidate is not implemented - HasMethod, - Invoke, - InvokeDefault, - NULL, // HasProperty is not implemented - NULL, // GetProperty is not implemented - NULL, // SetProperty is not implemented -}; - -static NPObject* npobject = NULL; - -NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value) { - NPError err = NPERR_NO_ERROR; - - switch (variable) { - case NPPVpluginNameString: - *(reinterpret_cast(value)) = "Pepper Test PlugIn"; - break; - case NPPVpluginDescriptionString: - *(reinterpret_cast(value)) = - "Simple Pepper plug-in for manual testing."; - break; - case NPPVpluginNeedsXEmbed: - *(reinterpret_cast(value)) = 1; - break; - case NPPVpluginScriptableNPObject: { - if (npobject == NULL) { - npobject = NPN_CreateObject(instance, &GodotClass); - } else { - NPN_RetainObject(npobject); - }; - void** v = reinterpret_cast(value); - *v = npobject; - } break; - default: - fprintf(stderr, "Unhandled variable to NPP_GetValue\n"); - err = NPERR_GENERIC_ERROR; - break; - } - - return err; -} - -NPError NPP_SetValue(NPP instance, NPNVariable variable, void* value) { - return NPERR_GENERIC_ERROR; -} - -NPError NP_GetValue(void* instance, NPPVariable variable, void* value) { - return NPP_GetValue(reinterpret_cast(instance), variable, value); -} - -char* NP_GetMIMEDescription() { - return const_cast("pepper-application/x-pepper-test-plugin;"); -} diff --git a/platform/nacl/platform_config.h b/platform/nacl/platform_config.h deleted file mode 100644 index 143f16c1fa7..00000000000 --- a/platform/nacl/platform_config.h +++ /dev/null @@ -1,29 +0,0 @@ -/*************************************************************************/ -/* platform_config.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include