mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Merge branch 'master' of https://github.com/godotengine/godot
This commit is contained in:
commit
ab4126f510
@ -69,8 +69,8 @@ addons:
|
||||
before_script:
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install scons; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then
|
||||
brew update; brew install -v android-sdk;
|
||||
brew install -v android-ndk | grep -v "inflating:" | grep -v "creating:";
|
||||
brew update; travis_wait 20 brew install -v android-sdk;
|
||||
travis_wait 20 brew install -v android-ndk | grep -v "inflating:" | grep -v "creating:";
|
||||
export ANDROID_HOME=/usr/local/opt/android-sdk; export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk;
|
||||
fi
|
||||
|
||||
|
115
SConstruct
115
SConstruct
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
EnsureSConsVersion(0,14);
|
||||
|
||||
|
||||
@ -16,7 +18,6 @@ platform_list = [] # list of platforms
|
||||
platform_opts = {} # options for each platform
|
||||
platform_flags = {} # flags for each platform
|
||||
|
||||
|
||||
active_platforms=[]
|
||||
active_platform_ids=[]
|
||||
platform_exporters=[]
|
||||
@ -55,15 +56,17 @@ methods.save_active_platforms(active_platforms,active_platform_ids)
|
||||
|
||||
custom_tools=['default']
|
||||
|
||||
platform_arg = ARGUMENTS.get("platform", False)
|
||||
platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
|
||||
|
||||
if (os.name=="posix"):
|
||||
pass
|
||||
elif (os.name=="nt"):
|
||||
if (os.getenv("VSINSTALLDIR")==None or platform_arg=="android"):
|
||||
if ( os.getenv("VCINSTALLDIR")==None or platform_arg=="android"):
|
||||
custom_tools=['mingw']
|
||||
|
||||
env_base=Environment(tools=custom_tools);
|
||||
if 'TERM' in os.environ:
|
||||
env_base['ENV']['TERM'] = os.environ['TERM']
|
||||
env_base.AppendENVPath('PATH', os.getenv('PATH'))
|
||||
env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
|
||||
env_base.global_defaults=global_defaults
|
||||
@ -98,9 +101,8 @@ env_base.__class__.disable_module = methods.disable_module
|
||||
env_base.__class__.add_source_files = methods.add_source_files
|
||||
env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix
|
||||
|
||||
env_base["x86_opt_gcc"]=False
|
||||
env_base["x86_opt_vc"]=False
|
||||
env_base["armv7_opt_gcc"]=False
|
||||
env_base["x86_libtheora_opt_gcc"]=False
|
||||
env_base["x86_libtheora_opt_vc"]=False
|
||||
|
||||
customs = ['custom.py']
|
||||
|
||||
@ -120,32 +122,30 @@ opts.Add('platform','Platform: '+str(platform_list)+'.',"")
|
||||
opts.Add('p','Platform (same as platform=).',"")
|
||||
opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes')
|
||||
opts.Add('gdscript','Build GDSCript support: (yes/no)','yes')
|
||||
opts.Add('vorbis','Build Ogg Vorbis Support: (yes/no)','yes')
|
||||
opts.Add('opus','Build Opus Audio Format Support: (yes/no)','yes')
|
||||
opts.Add('libogg','Ogg library for ogg container support (system/builtin)','builtin')
|
||||
opts.Add('libvorbis','Ogg Vorbis library for vorbis support (system/builtin)','builtin')
|
||||
opts.Add('libtheora','Theora library for theora module (system/builtin)','builtin')
|
||||
opts.Add('opus','Opus and opusfile library for Opus format support: (system/builtin)','builtin')
|
||||
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
|
||||
opts.Add('squish','Squish BC Texture Compression in editor (yes/no)','yes')
|
||||
opts.Add('theora','Theora Video (yes/no)','yes')
|
||||
opts.Add('theoralib','Theora Video (yes/no)','no')
|
||||
opts.Add('freetype','Freetype support in editor','builtin')
|
||||
opts.Add('speex','Speex Audio (yes/no)','yes')
|
||||
opts.Add('squish','Squish library for BC Texture Compression in editor (system/builtin)','builtin')
|
||||
opts.Add('freetype','Freetype library for TTF support via freetype module (system/builtin)','builtin')
|
||||
opts.Add('xml','XML Save/Load support (yes/no)','yes')
|
||||
opts.Add('png','PNG Image loader support (yes/no)','yes')
|
||||
opts.Add('jpg','JPG Image loader support (yes/no)','yes')
|
||||
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
|
||||
opts.Add('dds','DDS Texture loader support (yes/no)','yes')
|
||||
opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes')
|
||||
opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
|
||||
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
|
||||
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
|
||||
opts.Add('musepack','Musepack Audio (yes/no)','yes')
|
||||
opts.Add("CXX", "Compiler");
|
||||
opts.Add("CCFLAGS", "Custom flags for the C++ compiler");
|
||||
opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
|
||||
opts.Add('libwebp','libwebp library for webp module (system/builtin)','builtin')
|
||||
opts.Add('openssl','OpenSSL library for openssl module (system/builtin)','builtin')
|
||||
opts.Add('libmpcdec','libmpcdec library for mpc module (system/builtin)','builtin')
|
||||
opts.Add('enet','ENet library (system/builtin)','builtin')
|
||||
opts.Add('glew','GLEW library for the gl_context (system/builtin)','builtin')
|
||||
opts.Add('xaudio2','XAudio2 audio driver (yes/no)','no')
|
||||
opts.Add("CXX", "C++ Compiler")
|
||||
opts.Add("CC", "C Compiler")
|
||||
opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler");
|
||||
opts.Add("CFLAGS", "Custom flags for the C compiler");
|
||||
opts.Add("LINKFLAGS", "Custom flags for the linker");
|
||||
opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.','')
|
||||
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
|
||||
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
|
||||
opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no')
|
||||
opts.Add('verbose', 'Enable verbose output for the compilation (yes/no)', 'yes')
|
||||
opts.Add('deprecated','Enable deprecated features (yes/no)','yes')
|
||||
opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
|
||||
opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
|
||||
@ -158,7 +158,7 @@ for k in platform_opts.keys():
|
||||
opts.Add(o[0],o[1],o[2])
|
||||
|
||||
for x in module_list:
|
||||
opts.Add('module_'+x+'_enabled', "Enable module '"+x+"'.", "yes")
|
||||
opts.Add('module_'+x+'_enabled', "Enable module '"+x+"' (yes/no)", "yes")
|
||||
|
||||
opts.Update(env_base) # update environment
|
||||
Help(opts.GenerateHelpText(env_base)) # generate help
|
||||
@ -254,14 +254,6 @@ if selected_platform in platform_list:
|
||||
#must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
|
||||
detect.configure(env)
|
||||
|
||||
|
||||
if (env["freetype"]!="no"):
|
||||
env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
|
||||
if (env["freetype"]=="builtin"):
|
||||
env.Append(CPPPATH=['#drivers/freetype'])
|
||||
env.Append(CPPPATH=['#drivers/freetype/freetype/include'])
|
||||
|
||||
|
||||
#env['platform_libsuffix'] = env['LIBSUFFIX']
|
||||
|
||||
suffix="."+selected_platform
|
||||
@ -272,6 +264,8 @@ if selected_platform in platform_list:
|
||||
sys.exit(255)
|
||||
suffix+=".opt"
|
||||
|
||||
env.Append(CCFLAGS=['-DNDEBUG']);
|
||||
|
||||
elif (env["target"]=="release_debug"):
|
||||
if (env["tools"]=="yes"):
|
||||
suffix+=".opt.tools"
|
||||
@ -322,49 +316,9 @@ if selected_platform in platform_list:
|
||||
if (env.use_ptrcall):
|
||||
env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']);
|
||||
|
||||
if (env['musepack']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DMUSEPACK_ENABLED']);
|
||||
|
||||
#if (env['openssl']!='no'):
|
||||
# env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
|
||||
# if (env['openssl']=="builtin"):
|
||||
# env.Append(CPPPATH=['#drivers/builtin_openssl2'])
|
||||
|
||||
if (env["builtin_zlib"]=='yes'):
|
||||
env.Append(CPPPATH=['#drivers/builtin_zlib/zlib'])
|
||||
|
||||
# to test 64 bits compiltion
|
||||
# env.Append(CPPFLAGS=['-m64'])
|
||||
|
||||
if (env_base['squish']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
|
||||
|
||||
if (env['vorbis']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DVORBIS_ENABLED']);
|
||||
if (env['opus']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DOPUS_ENABLED']);
|
||||
|
||||
|
||||
if (env['theora']=='yes'):
|
||||
env['theoralib']='yes'
|
||||
env.Append(CPPFLAGS=['-DTHEORA_ENABLED']);
|
||||
if (env['theoralib']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);
|
||||
|
||||
if (env['png']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DPNG_ENABLED']);
|
||||
if (env['dds']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DDDS_ENABLED']);
|
||||
if (env['pvr']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DPVR_ENABLED']);
|
||||
if (env['jpg']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DJPG_ENABLED']);
|
||||
if (env['webp']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
|
||||
|
||||
if (env['speex']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DSPEEX_ENABLED']);
|
||||
|
||||
if (env['tools']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
|
||||
if (env['disable_3d']=='yes'):
|
||||
@ -380,11 +334,8 @@ if selected_platform in platform_list:
|
||||
if (env['xml']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DXML_ENABLED'])
|
||||
|
||||
if (env['colored']=='yes'):
|
||||
methods.colored(sys,env)
|
||||
|
||||
if (env['etc1']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DETC1_ENABLED'])
|
||||
if (env['verbose']=='no'):
|
||||
methods.no_verbose(sys,env)
|
||||
|
||||
Export('env')
|
||||
|
||||
@ -432,9 +383,9 @@ if selected_platform in platform_list:
|
||||
release_variants = ['release|Win32']+['release|x64']
|
||||
release_debug_variants = ['release_debug|Win32']+['release_debug|x64']
|
||||
variants = debug_variants + release_variants + release_debug_variants
|
||||
debug_targets = ['Debug']+['Debug']
|
||||
release_targets = ['Release']+['Release']
|
||||
release_debug_targets = ['ReleaseDebug']+['ReleaseDebug']
|
||||
debug_targets = ['bin\\godot.windows.tools.32.exe']+['bin\\godot.windows.tools.64.exe']
|
||||
release_targets = ['bin\\godot.windows.opt.32.exe']+['bin\\godot.windows.opt.64.exe']
|
||||
release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe']+['bin\\godot.windows.opt.tools.64.exe']
|
||||
targets = debug_targets + release_targets + release_debug_targets
|
||||
msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ],
|
||||
incs = env.vs_incs,
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.tests_sources=[]
|
||||
|
@ -516,7 +516,7 @@ MainLoop* test() {
|
||||
|
||||
{
|
||||
|
||||
Vector<int32_t> hashes;
|
||||
Vector<int> hashes;
|
||||
List<StringName> tl;
|
||||
ObjectTypeDB::get_type_list(&tl);
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
//#include "math_funcs.h"
|
||||
#include <stdio.h>
|
||||
#include "os/os.h"
|
||||
#include "drivers/nrex/regex.h"
|
||||
#include "core/io/ip_address.h"
|
||||
|
||||
#include "test_string.h"
|
||||
|
||||
@ -461,18 +461,8 @@ bool test_25() {
|
||||
|
||||
bool test_26() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 26: RegEx\n");
|
||||
RegEx regexp("(.*):(.*)");
|
||||
|
||||
int res = regexp.find("name:password");
|
||||
printf("\tmatch: %s\n", (res>=0)?"true":"false");
|
||||
|
||||
printf("\t%i captures:\n", regexp.get_capture_count());
|
||||
for (int i = 0; i<regexp.get_capture_count(); i++)
|
||||
{
|
||||
printf("%ls\n", regexp.get_capture(i).c_str());
|
||||
}
|
||||
return (res>=0);
|
||||
//TODO: Do replacement RegEx test
|
||||
return true;
|
||||
};
|
||||
|
||||
struct test_27_data {
|
||||
@ -843,6 +833,62 @@ bool test_28() {
|
||||
return state;
|
||||
}
|
||||
|
||||
bool test_29() {
|
||||
|
||||
bool error = false;
|
||||
bool state = true;
|
||||
bool success = false;
|
||||
|
||||
IP_Address ip0("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
|
||||
OS::get_singleton()->print("ip0 is %ls\n", String(ip0).c_str());
|
||||
|
||||
IP_Address ip(0x0123, 0x4567, 0x89ab, 0xcdef, IP_Address::TYPE_IPV6);
|
||||
OS::get_singleton()->print("ip6 is %ls\n", String(ip).c_str());
|
||||
|
||||
IP_Address ip2("fe80::52e5:49ff:fe93:1baf");
|
||||
OS::get_singleton()->print("ip6 is %ls\n", String(ip2).c_str());
|
||||
|
||||
IP_Address ip3("::ffff:192.168.0.1");
|
||||
OS::get_singleton()->print("ip6 is %ls\n", String(ip3).c_str());
|
||||
|
||||
String ip4 = "192.168.0.1";
|
||||
success = ip4.is_valid_ip_address();
|
||||
OS::get_singleton()->print("Is valid ipv4: %ls, %s\n", ip4.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
ip4 = "192.368.0.1";
|
||||
success = (!ip4.is_valid_ip_address());
|
||||
OS::get_singleton()->print("Is invalid ipv4: %ls, %s\n", ip4.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
String ip6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
|
||||
success = ip6.is_valid_ip_address();
|
||||
OS::get_singleton()->print("Is valid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
ip6 = "2001:0db8:85j3:0000:0000:8a2e:0370:7334";
|
||||
success = (!ip6.is_valid_ip_address());
|
||||
OS::get_singleton()->print("Is invalid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
ip6 = "2001:0db8:85f345:0000:0000:8a2e:0370:7334";
|
||||
success = (!ip6.is_valid_ip_address());
|
||||
OS::get_singleton()->print("Is invalid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
ip6 = "2001:0db8::0:8a2e:370:7334";
|
||||
success = (ip6.is_valid_ip_address());
|
||||
OS::get_singleton()->print("Is valid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
ip6 = "::ffff:192.168.0.1";
|
||||
success = (ip6.is_valid_ip_address());
|
||||
OS::get_singleton()->print("Is valid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
return state;
|
||||
};
|
||||
|
||||
typedef bool (*TestFunc)(void);
|
||||
|
||||
TestFunc test_funcs[] = {
|
||||
@ -875,6 +921,7 @@ TestFunc test_funcs[] = {
|
||||
test_26,
|
||||
test_27,
|
||||
test_28,
|
||||
test_29,
|
||||
0
|
||||
|
||||
};
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.core_sources=[]
|
||||
|
@ -276,16 +276,26 @@ void Array::push_front(const Variant& p_value) {
|
||||
_p->array.insert(0,p_value);
|
||||
}
|
||||
|
||||
void Array::pop_back(){
|
||||
Variant Array::pop_back(){
|
||||
|
||||
if (!_p->array.empty())
|
||||
_p->array.resize( _p->array.size() -1 );
|
||||
if (!_p->array.empty()) {
|
||||
int n = _p->array.size() - 1;
|
||||
Variant ret = _p->array.get(n);
|
||||
_p->array.resize(n);
|
||||
return ret;
|
||||
}
|
||||
return Variant();
|
||||
|
||||
}
|
||||
void Array::pop_front(){
|
||||
|
||||
if (!_p->array.empty())
|
||||
Variant Array::pop_front(){
|
||||
|
||||
if (!_p->array.empty()) {
|
||||
Variant ret = _p->array.get(0);
|
||||
_p->array.remove(0);
|
||||
return ret;
|
||||
}
|
||||
return Variant();
|
||||
|
||||
}
|
||||
|
||||
|
@ -80,8 +80,8 @@ public:
|
||||
void erase(const Variant& p_value);
|
||||
|
||||
void push_front(const Variant& p_value);
|
||||
void pop_back();
|
||||
void pop_front();
|
||||
Variant pop_back();
|
||||
Variant pop_front();
|
||||
|
||||
Array(const Array& p_from);
|
||||
Array(bool p_shared=false);
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
|
@ -54,7 +54,7 @@ String Globals::localize_path(const String& p_path) const {
|
||||
if (resource_path=="")
|
||||
return p_path; //not initialied yet
|
||||
|
||||
if (p_path.begins_with("res://") || p_path.begins_with("user://"))
|
||||
if (p_path.begins_with("res://") || p_path.begins_with("user://") || p_path.is_abs_path())
|
||||
return p_path.simplify_path();
|
||||
|
||||
|
||||
|
@ -74,7 +74,10 @@ static inline uint32_t hash_djb2_one_float(float p_in,uint32_t p_prev=5381) {
|
||||
float f;
|
||||
uint32_t i;
|
||||
} u;
|
||||
u.f=p_in;
|
||||
|
||||
// handle -0 case
|
||||
if (p_in==0.0f) u.f=0.0f;
|
||||
else u.f=p_in;
|
||||
|
||||
return ((p_prev<<5)+p_prev)+u.i;
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
|
@ -29,8 +29,9 @@
|
||||
#include "http_client.h"
|
||||
#include "io/stream_peer_ssl.h"
|
||||
|
||||
VARIANT_ENUM_CAST(IP_Address::AddrType);
|
||||
|
||||
Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){
|
||||
Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host, IP_Address::AddrType p_addr_type){
|
||||
|
||||
close();
|
||||
conn_port=p_port;
|
||||
@ -62,7 +63,7 @@ Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_ve
|
||||
status=STATUS_CONNECTING;
|
||||
} else {
|
||||
//is hostname
|
||||
resolving=IP::get_singleton()->resolve_hostname_queue_item(conn_host);
|
||||
resolving=IP::get_singleton()->resolve_hostname_queue_item(conn_host, p_addr_type);
|
||||
status=STATUS_RESOLVING;
|
||||
|
||||
}
|
||||
@ -635,7 +636,7 @@ Error HTTPClient::_get_http_data(uint8_t* p_buffer, int p_bytes,int &r_received)
|
||||
|
||||
void HTTPClient::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true));
|
||||
ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true),DEFVAL(IP_Address::TYPE_ANY));
|
||||
ObjectTypeDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection);
|
||||
ObjectTypeDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection);
|
||||
ObjectTypeDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw);
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
|
||||
|
||||
//Error connect_and_get(const String& p_url,bool p_verify_host=true); //connects to a full url and perform request
|
||||
Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true);
|
||||
Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true, IP_Address::AddrType p_addr_type = IP_Address::TYPE_ANY);
|
||||
|
||||
void set_connection(const Ref<StreamPeer>& p_connection);
|
||||
Ref<StreamPeer> get_connection() const;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "hash_map.h"
|
||||
|
||||
VARIANT_ENUM_CAST(IP::ResolverStatus);
|
||||
VARIANT_ENUM_CAST(IP_Address::AddrType);
|
||||
|
||||
/************* RESOLVER ******************/
|
||||
|
||||
@ -43,10 +44,12 @@ struct _IP_ResolverPrivate {
|
||||
volatile IP::ResolverStatus status;
|
||||
IP_Address response;
|
||||
String hostname;
|
||||
IP_Address::AddrType type;
|
||||
|
||||
void clear() {
|
||||
status = IP::RESOLVER_STATUS_NONE;
|
||||
response = IP_Address();
|
||||
type = IP_Address::TYPE_NONE;
|
||||
hostname="";
|
||||
};
|
||||
|
||||
@ -78,9 +81,9 @@ struct _IP_ResolverPrivate {
|
||||
|
||||
if (queue[i].status!=IP::RESOLVER_STATUS_WAITING)
|
||||
continue;
|
||||
queue[i].response=IP::get_singleton()->resolve_hostname(queue[i].hostname);
|
||||
queue[i].response=IP::get_singleton()->resolve_hostname(queue[i].hostname, queue[i].type);
|
||||
|
||||
if (queue[i].response.host==0)
|
||||
if (queue[i].response.type==IP_Address::TYPE_NONE)
|
||||
queue[i].status=IP::RESOLVER_STATUS_ERROR;
|
||||
else
|
||||
queue[i].status=IP::RESOLVER_STATUS_DONE;
|
||||
@ -109,21 +112,23 @@ struct _IP_ResolverPrivate {
|
||||
|
||||
|
||||
|
||||
IP_Address IP::resolve_hostname(const String& p_hostname) {
|
||||
IP_Address IP::resolve_hostname(const String& p_hostname, IP_Address::AddrType p_type) {
|
||||
|
||||
GLOBAL_LOCK_FUNCTION
|
||||
GLOBAL_LOCK_FUNCTION;
|
||||
|
||||
if (resolver->cache.has(p_hostname))
|
||||
return resolver->cache[p_hostname];
|
||||
if (resolver->cache[p_hostname].type & p_type != 0)
|
||||
return resolver->cache[p_hostname];
|
||||
// requested type is different from type in cache. continue resolution, if successful it'll overwrite cache
|
||||
|
||||
IP_Address res = _resolve_hostname(p_hostname);
|
||||
IP_Address res = _resolve_hostname(p_hostname, p_type);
|
||||
resolver->cache[p_hostname]=res;
|
||||
return res;
|
||||
|
||||
}
|
||||
IP::ResolverID IP::resolve_hostname_queue_item(const String& p_hostname) {
|
||||
IP::ResolverID IP::resolve_hostname_queue_item(const String& p_hostname, IP_Address::AddrType p_type) {
|
||||
|
||||
GLOBAL_LOCK_FUNCTION
|
||||
GLOBAL_LOCK_FUNCTION;
|
||||
|
||||
ResolverID id = resolver->find_empty_id();
|
||||
|
||||
@ -133,7 +138,8 @@ IP::ResolverID IP::resolve_hostname_queue_item(const String& p_hostname) {
|
||||
}
|
||||
|
||||
resolver->queue[id].hostname=p_hostname;
|
||||
if (resolver->cache.has(p_hostname)) {
|
||||
resolver->queue[id].type = p_type;
|
||||
if (resolver->cache.has(p_hostname) && (resolver->cache[p_hostname].type & p_type) != 0) {
|
||||
resolver->queue[id].response=resolver->cache[p_hostname];
|
||||
resolver->queue[id].status=IP::RESOLVER_STATUS_DONE;
|
||||
} else {
|
||||
@ -145,10 +151,6 @@ IP::ResolverID IP::resolve_hostname_queue_item(const String& p_hostname) {
|
||||
resolver->resolve_queues();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -187,6 +189,14 @@ void IP::erase_resolve_item(ResolverID p_id) {
|
||||
|
||||
}
|
||||
|
||||
void IP::clear_cache(const String &p_hostname) {
|
||||
|
||||
if (p_hostname.empty()) {
|
||||
resolver->cache.clear();
|
||||
} else {
|
||||
resolver->cache.erase(p_hostname);
|
||||
}
|
||||
};
|
||||
|
||||
Array IP::_get_local_addresses() const {
|
||||
|
||||
@ -208,6 +218,7 @@ void IP::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("get_resolve_item_address","id"),&IP::get_resolve_item_address);
|
||||
ObjectTypeDB::bind_method(_MD("erase_resolve_item","id"),&IP::erase_resolve_item);
|
||||
ObjectTypeDB::bind_method(_MD("get_local_addresses"),&IP::_get_local_addresses);
|
||||
ObjectTypeDB::bind_method(_MD("clear_cache"),&IP::clear_cache, DEFVAL(""));
|
||||
|
||||
BIND_CONSTANT( RESOLVER_STATUS_NONE );
|
||||
BIND_CONSTANT( RESOLVER_STATUS_WAITING );
|
||||
|
16
core/io/ip.h
16
core/io/ip.h
@ -48,6 +48,14 @@ public:
|
||||
RESOLVER_STATUS_ERROR,
|
||||
};
|
||||
|
||||
enum AddressType {
|
||||
|
||||
ADDRESS_IPV4 = 1,
|
||||
ADDRESS_IPV6 = 2,
|
||||
|
||||
ADDRESS_ANY = 3,
|
||||
};
|
||||
|
||||
enum {
|
||||
RESOLVER_MAX_QUERIES = 32,
|
||||
RESOLVER_INVALID_ID=-1
|
||||
@ -65,7 +73,7 @@ protected:
|
||||
static IP*singleton;
|
||||
static void _bind_methods();
|
||||
|
||||
virtual IP_Address _resolve_hostname(const String& p_hostname)=0;
|
||||
virtual IP_Address _resolve_hostname(const String& p_hostname, IP_Address::AddrType p_type = IP_Address::TYPE_ANY)=0;
|
||||
Array _get_local_addresses() const;
|
||||
|
||||
static IP* (*_create)();
|
||||
@ -73,14 +81,16 @@ public:
|
||||
|
||||
|
||||
|
||||
IP_Address resolve_hostname(const String& p_hostname);
|
||||
IP_Address resolve_hostname(const String& p_hostname, IP_Address::AddrType p_type = IP_Address::TYPE_ANY);
|
||||
// async resolver hostname
|
||||
ResolverID resolve_hostname_queue_item(const String& p_hostname);
|
||||
ResolverID resolve_hostname_queue_item(const String& p_hostname, IP_Address::AddrType p_type = IP_Address::TYPE_ANY);
|
||||
ResolverStatus get_resolve_item_status(ResolverID p_id) const;
|
||||
IP_Address get_resolve_item_address(ResolverID p_id) const;
|
||||
virtual void get_local_addresses(List<IP_Address> *r_addresses) const=0;
|
||||
void erase_resolve_item(ResolverID p_id);
|
||||
|
||||
void clear_cache(const String& p_hostname = "");
|
||||
|
||||
static IP* get_singleton();
|
||||
|
||||
static IP* create();
|
||||
|
@ -32,29 +32,191 @@ IP_Address::operator Variant() const {
|
||||
|
||||
return operator String();
|
||||
}*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
IP_Address::operator String() const {
|
||||
|
||||
return itos(field[0])+"."+itos(field[1])+"."+itos(field[2])+"."+itos(field[3]);
|
||||
if (type == TYPE_NONE)
|
||||
return "0.0.0.0";
|
||||
if (type == TYPE_IPV4)
|
||||
return itos(field8[0])+"."+itos(field8[1])+"."+itos(field8[2])+"."+itos(field8[3]);
|
||||
else {
|
||||
String ret;
|
||||
for (int i=0; i<8; i++) {
|
||||
if (i > 0)
|
||||
ret = ret + ":";
|
||||
uint16_t num = (field8[i*2] << 8) + field8[i*2+1];
|
||||
ret = ret + String::num_int64(num, 16);
|
||||
};
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
IP_Address::IP_Address(const String& p_string) {
|
||||
static void _parse_hex(const String& p_string, int p_start, uint8_t* p_dst) {
|
||||
|
||||
host=0;
|
||||
int slices = p_string.get_slice_count(".");
|
||||
uint16_t ret = 0;
|
||||
for (int i=p_start; i<p_start + 4; i++) {
|
||||
|
||||
if (i >= p_string.length()) {
|
||||
break;
|
||||
};
|
||||
|
||||
int n = 0;
|
||||
CharType c = p_string[i];
|
||||
if (c >= '0' && c <= '9') {
|
||||
|
||||
n = c - '0';
|
||||
} else if (c >= 'a' && c <= 'f') {
|
||||
n = 10 + (c - 'a');
|
||||
} else if (c >= 'A' && c <= 'F') {
|
||||
n = 10 + (c - 'A');
|
||||
} else if (c == ':') {
|
||||
break;
|
||||
} else {
|
||||
ERR_EXPLAIN("Invalid character in ipv6 address: " + p_string);
|
||||
ERR_FAIL();
|
||||
};
|
||||
ret = ret << 4;
|
||||
ret += n;
|
||||
};
|
||||
|
||||
p_dst[0] = ret >> 8;
|
||||
p_dst[1] = ret & 0xff;
|
||||
};
|
||||
|
||||
void IP_Address::_parse_ipv6(const String& p_string) {
|
||||
|
||||
static const int parts_total = 8;
|
||||
int parts[parts_total] = {0};
|
||||
int parts_count = 0;
|
||||
bool part_found = false;
|
||||
bool part_skip = false;
|
||||
bool part_ipv4 = false;
|
||||
int parts_idx = 0;
|
||||
|
||||
for (int i=0; i<p_string.length(); i++) {
|
||||
|
||||
CharType c = p_string[i];
|
||||
if (c == ':') {
|
||||
|
||||
if (i == 0) {
|
||||
continue; // next must be a ":"
|
||||
};
|
||||
if (!part_found) {
|
||||
part_skip = true;
|
||||
parts[parts_idx++] = -1;
|
||||
};
|
||||
part_found = false;
|
||||
} else if (c == '.') {
|
||||
|
||||
part_ipv4 = true;
|
||||
|
||||
} else if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) {
|
||||
if (!part_found) {
|
||||
parts[parts_idx++] = i;
|
||||
part_found = true;
|
||||
++parts_count;
|
||||
};
|
||||
} else {
|
||||
|
||||
ERR_EXPLAIN("Invalid character in IPv6 address: " + p_string);
|
||||
ERR_FAIL();
|
||||
};
|
||||
};
|
||||
|
||||
int parts_extra = 0;
|
||||
if (part_skip) {
|
||||
parts_extra = parts_total - parts_count;
|
||||
};
|
||||
|
||||
int idx = 0;
|
||||
for (int i=0; i<parts_idx; i++) {
|
||||
|
||||
if (parts[i] == -1) {
|
||||
|
||||
for (int j=0; j<parts_extra; j++) {
|
||||
field16[idx++] = 0;
|
||||
};
|
||||
continue;
|
||||
};
|
||||
|
||||
if (part_ipv4 && i == parts_idx - 1) {
|
||||
_parse_ipv4(p_string, parts[i], (uint8_t*)&field16[idx]); // should be the last one
|
||||
} else {
|
||||
_parse_hex(p_string, parts[i], (uint8_t*)&(field16[idx++]));
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
void IP_Address::_parse_ipv4(const String& p_string, int p_start, uint8_t* p_ret) {
|
||||
|
||||
String ip;
|
||||
if (p_start != 0) {
|
||||
ip = p_string.substr(p_start, p_string.length() - p_start);
|
||||
} else {
|
||||
ip = p_string;
|
||||
};
|
||||
|
||||
int slices = ip.get_slice_count(".");
|
||||
if (slices!=4) {
|
||||
ERR_EXPLAIN("Invalid IP Address String: "+p_string);
|
||||
ERR_EXPLAIN("Invalid IP Address String: "+ip);
|
||||
ERR_FAIL();
|
||||
}
|
||||
for(int i=0;i<4;i++) {
|
||||
|
||||
field[i]=p_string.get_slicec('.',i).to_int();
|
||||
p_ret[i]=ip.get_slicec('.',i).to_int();
|
||||
}
|
||||
};
|
||||
|
||||
void IP_Address::clear() {
|
||||
|
||||
memset(&field8[0], 0, sizeof(field8));
|
||||
};
|
||||
|
||||
IP_Address::IP_Address(const String& p_string) {
|
||||
|
||||
clear();
|
||||
if (p_string.find(":") >= 0) {
|
||||
|
||||
_parse_ipv6(p_string);
|
||||
type = TYPE_IPV6;
|
||||
} else {
|
||||
|
||||
_parse_ipv4(p_string, 0, &field8[0]);
|
||||
type = TYPE_IPV4;
|
||||
};
|
||||
}
|
||||
|
||||
IP_Address::IP_Address(uint8_t p_a,uint8_t p_b,uint8_t p_c,uint8_t p_d) {
|
||||
_FORCE_INLINE_ static void _32_to_buf(uint8_t* p_dst, uint32_t p_n) {
|
||||
|
||||
p_dst[0] = (p_n >> 24) & 0xff;
|
||||
p_dst[1] = (p_n >> 16) & 0xff;
|
||||
p_dst[2] = (p_n >> 8) & 0xff;
|
||||
p_dst[3] = (p_n >> 0) & 0xff;
|
||||
};
|
||||
|
||||
IP_Address::IP_Address(uint32_t p_a,uint32_t p_b,uint32_t p_c,uint32_t p_d, IP_Address::AddrType p_type) {
|
||||
|
||||
type = p_type;
|
||||
memset(&field8[0], 0, sizeof(field8));
|
||||
if (p_type == TYPE_IPV4) {
|
||||
field8[0]=p_a;
|
||||
field8[1]=p_b;
|
||||
field8[2]=p_c;
|
||||
field8[3]=p_d;
|
||||
} else if (type == TYPE_IPV6) {
|
||||
|
||||
_32_to_buf(&field8[0], p_a);
|
||||
_32_to_buf(&field8[4], p_b);
|
||||
_32_to_buf(&field8[8], p_c);
|
||||
_32_to_buf(&field8[12], p_d);
|
||||
} else {
|
||||
type = TYPE_NONE;
|
||||
ERR_EXPLAIN("Invalid type specified for IP_Address (use TYPE_IPV4 or TYPE_IPV6");
|
||||
ERR_FAIL();
|
||||
};
|
||||
|
||||
field[0]=p_a;
|
||||
field[1]=p_b;
|
||||
field[2]=p_c;
|
||||
field[3]=p_d;
|
||||
}
|
||||
|
@ -33,22 +33,48 @@
|
||||
|
||||
struct IP_Address {
|
||||
|
||||
union {
|
||||
uint8_t field[4];
|
||||
uint32_t host;
|
||||
public:
|
||||
enum AddrType {
|
||||
TYPE_NONE = 0,
|
||||
TYPE_IPV4 = 1,
|
||||
TYPE_IPV6 = 2,
|
||||
|
||||
TYPE_ANY = 3,
|
||||
};
|
||||
|
||||
AddrType type;
|
||||
|
||||
union {
|
||||
uint8_t field8[16];
|
||||
uint16_t field16[8];
|
||||
uint32_t field32[4];
|
||||
};
|
||||
|
||||
protected:
|
||||
void _parse_ipv6(const String& p_string);
|
||||
void _parse_ipv4(const String& p_string, int p_start, uint8_t* p_ret);
|
||||
|
||||
public:
|
||||
//operator Variant() const;
|
||||
bool operator==(const IP_Address& p_ip) const {
|
||||
return host==p_ip.host;
|
||||
for (int i=0; i<4; i++)
|
||||
if (field32[i] != p_ip.field32[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
bool operator!=(const IP_Address& p_ip) const {
|
||||
return host!=p_ip.host;
|
||||
for (int i=0; i<4; i++)
|
||||
if (field32[i] != p_ip.field32[i])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void clear();
|
||||
|
||||
operator String() const;
|
||||
IP_Address(const String& p_string);
|
||||
IP_Address(uint8_t p_a,uint8_t p_b,uint8_t p_c,uint8_t p_d);
|
||||
IP_Address() { host=0; }
|
||||
IP_Address(uint32_t p_a,uint32_t p_b,uint32_t p_c,uint32_t p_d, AddrType p_type=TYPE_IPV4);
|
||||
IP_Address() { clear(); type=TYPE_NONE; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,14 +29,9 @@
|
||||
#include "packet_peer_udp.h"
|
||||
#include "io/ip.h"
|
||||
|
||||
|
||||
PacketPeerUDP* (*PacketPeerUDP::_create)()=NULL;
|
||||
|
||||
int PacketPeerUDP::_get_packet_address() const {
|
||||
|
||||
IP_Address ip = get_packet_address();
|
||||
return ip.host;
|
||||
}
|
||||
VARIANT_ENUM_CAST(IP_Address::AddrType);
|
||||
|
||||
String PacketPeerUDP::_get_packet_ip() const {
|
||||
|
||||
@ -65,7 +60,7 @@ void PacketPeerUDP::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("wait:Error"),&PacketPeerUDP::wait);
|
||||
ObjectTypeDB::bind_method(_MD("is_listening"),&PacketPeerUDP::is_listening);
|
||||
ObjectTypeDB::bind_method(_MD("get_packet_ip"),&PacketPeerUDP::_get_packet_ip);
|
||||
ObjectTypeDB::bind_method(_MD("get_packet_address"),&PacketPeerUDP::_get_packet_address);
|
||||
//ObjectTypeDB::bind_method(_MD("get_packet_address"),&PacketPeerUDP::_get_packet_address);
|
||||
ObjectTypeDB::bind_method(_MD("get_packet_port"),&PacketPeerUDP::get_packet_port);
|
||||
ObjectTypeDB::bind_method(_MD("set_send_address","host","port"),&PacketPeerUDP::_set_send_address);
|
||||
|
||||
|
@ -40,14 +40,13 @@ protected:
|
||||
static PacketPeerUDP* (*_create)();
|
||||
static void _bind_methods();
|
||||
|
||||
int _get_packet_address() const;
|
||||
String _get_packet_ip() const;
|
||||
|
||||
virtual Error _set_send_address(const String& p_address,int p_port);
|
||||
|
||||
public:
|
||||
|
||||
virtual Error listen(int p_port,int p_recv_buffer_size=65536)=0;
|
||||
virtual Error listen(int p_port, IP_Address::AddrType p_address_type = IP_Address::TYPE_IPV4, int p_recv_buffer_size=65536)=0;
|
||||
virtual void close()=0;
|
||||
virtual Error wait()=0;
|
||||
virtual bool is_listening() const=0;
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
TCP_Server* (*TCP_Server::_create)()=NULL;
|
||||
|
||||
VARIANT_ENUM_CAST(IP_Address::AddrType);
|
||||
|
||||
Ref<TCP_Server> TCP_Server::create_ref() {
|
||||
|
||||
if (!_create)
|
||||
@ -44,19 +46,19 @@ TCP_Server* TCP_Server::create() {
|
||||
return _create();
|
||||
}
|
||||
|
||||
Error TCP_Server::_listen(uint16_t p_port,DVector<String> p_accepted_hosts) {
|
||||
Error TCP_Server::_listen(uint16_t p_port, IP_Address::AddrType p_type, DVector<String> p_accepted_hosts) {
|
||||
|
||||
List<String> hosts;
|
||||
for(int i=0;i<p_accepted_hosts.size();i++)
|
||||
hosts.push_back(p_accepted_hosts.get(i));
|
||||
|
||||
return listen(p_port,hosts.size()?&hosts:NULL);
|
||||
return listen(p_port,p_type, hosts.size()?&hosts:NULL);
|
||||
|
||||
}
|
||||
|
||||
void TCP_Server::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(DVector<String>()));
|
||||
ObjectTypeDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(IP_Address::TYPE_IPV4), DEFVAL(DVector<String>()));
|
||||
ObjectTypeDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available);
|
||||
ObjectTypeDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection);
|
||||
ObjectTypeDB::bind_method(_MD("stop"),&TCP_Server::stop);
|
||||
|
@ -41,11 +41,11 @@ protected:
|
||||
static TCP_Server* (*_create)();
|
||||
|
||||
//bind helper
|
||||
Error _listen(uint16_t p_port,DVector<String> p_accepted_hosts=DVector<String>());
|
||||
Error _listen(uint16_t p_port, IP_Address::AddrType p_type = IP_Address::TYPE_IPV4 ,DVector<String> p_accepted_hosts=DVector<String>());
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
virtual Error listen(uint16_t p_port,const List<String> *p_accepted_hosts=NULL)=0;
|
||||
virtual Error listen(uint16_t p_port, IP_Address::AddrType p_type = IP_Address::TYPE_IPV4, const List<String> *p_accepted_hosts=NULL)=0;
|
||||
virtual bool is_connection_available() const=0;
|
||||
virtual Ref<StreamPeerTCP> take_connection()=0;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
|
@ -424,7 +424,7 @@ Matrix32 Matrix32::inverse() const {
|
||||
|
||||
void Matrix32::affine_invert() {
|
||||
|
||||
float det = elements[0][0]*elements[1][1] - elements[1][0]*elements[0][1];
|
||||
float det = basis_determinant();
|
||||
ERR_FAIL_COND(det==0);
|
||||
float idet = 1.0 / det;
|
||||
|
||||
@ -475,18 +475,18 @@ Matrix32::Matrix32(real_t p_rot, const Vector2& p_pos) {
|
||||
elements[2]=p_pos;
|
||||
}
|
||||
|
||||
Vector2 Matrix32::get_scale() const {
|
||||
Size2 Matrix32::get_scale() const {
|
||||
|
||||
return Vector2( elements[0].length(), elements[1].length() );
|
||||
return Size2( elements[0].length(), elements[1].length() );
|
||||
}
|
||||
|
||||
void Matrix32::scale(const Vector2& p_scale) {
|
||||
void Matrix32::scale(const Size2& p_scale) {
|
||||
|
||||
elements[0]*=p_scale;
|
||||
elements[1]*=p_scale;
|
||||
elements[2]*=p_scale;
|
||||
}
|
||||
void Matrix32::scale_basis(const Vector2& p_scale) {
|
||||
void Matrix32::scale_basis(const Size2& p_scale) {
|
||||
|
||||
elements[0]*=p_scale;
|
||||
elements[1]*=p_scale;
|
||||
@ -501,7 +501,6 @@ void Matrix32::translate( const Vector2& p_translation ) {
|
||||
elements[2]+=basis_xform(p_translation);
|
||||
}
|
||||
|
||||
|
||||
void Matrix32::orthonormalize() {
|
||||
|
||||
// Gram-Schmidt Process
|
||||
@ -550,11 +549,6 @@ void Matrix32::operator*=(const Matrix32& p_transform) {
|
||||
elements[2] = xform(p_transform.elements[2]);
|
||||
|
||||
float x0,x1,y0,y1;
|
||||
/*
|
||||
x0 = p_transform.tdotx(elements[0]);
|
||||
x1 = p_transform.tdoty(elements[0]);
|
||||
y0 = p_transform.tdotx(elements[1]);
|
||||
y1 = p_transform.tdoty(elements[1]);*/
|
||||
|
||||
x0 = tdotx(p_transform.elements[0]);
|
||||
x1 = tdoty(p_transform.elements[0]);
|
||||
@ -576,7 +570,7 @@ Matrix32 Matrix32::operator*(const Matrix32& p_transform) const {
|
||||
|
||||
}
|
||||
|
||||
Matrix32 Matrix32::scaled(const Vector2& p_scale) const {
|
||||
Matrix32 Matrix32::scaled(const Size2& p_scale) const {
|
||||
|
||||
Matrix32 copy=*this;
|
||||
copy.scale(p_scale);
|
||||
@ -584,7 +578,7 @@ Matrix32 Matrix32::scaled(const Vector2& p_scale) const {
|
||||
|
||||
}
|
||||
|
||||
Matrix32 Matrix32::basis_scaled(const Vector2& p_scale) const {
|
||||
Matrix32 Matrix32::basis_scaled(const Size2& p_scale) const {
|
||||
|
||||
Matrix32 copy=*this;
|
||||
copy.scale_basis(p_scale);
|
||||
@ -629,8 +623,8 @@ Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, float p_c) cons
|
||||
real_t r1 = get_rotation();
|
||||
real_t r2 = p_transform.get_rotation();
|
||||
|
||||
Vector2 s1 = get_scale();
|
||||
Vector2 s2 = p_transform.get_scale();
|
||||
Size2 s1 = get_scale();
|
||||
Size2 s2 = p_transform.get_scale();
|
||||
|
||||
//slerp rotation
|
||||
Vector2 v1(Math::cos(r1), Math::sin(r1));
|
||||
|
@ -553,10 +553,8 @@ struct Rect2i {
|
||||
|
||||
struct Matrix32 {
|
||||
|
||||
|
||||
Vector2 elements[3];
|
||||
|
||||
|
||||
_FORCE_INLINE_ float tdotx(const Vector2& v) const { return elements[0][0] * v.x + elements[1][0] * v.y; }
|
||||
_FORCE_INLINE_ float tdoty(const Vector2& v) const { return elements[0][1] * v.x + elements[1][1] * v.y; }
|
||||
|
||||
@ -577,26 +575,25 @@ struct Matrix32 {
|
||||
_FORCE_INLINE_ void set_rotation_and_scale(real_t p_phi,const Size2& p_scale);
|
||||
void rotate(real_t p_phi);
|
||||
|
||||
void scale(const Vector2& p_scale);
|
||||
void scale_basis(const Vector2& p_scale);
|
||||
void scale(const Size2& p_scale);
|
||||
void scale_basis(const Size2& p_scale);
|
||||
void translate( real_t p_tx, real_t p_ty);
|
||||
void translate( const Vector2& p_translation );
|
||||
|
||||
float basis_determinant() const;
|
||||
|
||||
Vector2 get_scale() const;
|
||||
Size2 get_scale() const;
|
||||
|
||||
_FORCE_INLINE_ const Vector2& get_origin() const { return elements[2]; }
|
||||
_FORCE_INLINE_ void set_origin(const Vector2& p_origin) { elements[2]=p_origin; }
|
||||
|
||||
Matrix32 scaled(const Vector2& p_scale) const;
|
||||
Matrix32 basis_scaled(const Vector2& p_scale) const;
|
||||
Matrix32 scaled(const Size2& p_scale) const;
|
||||
Matrix32 basis_scaled(const Size2& p_scale) const;
|
||||
Matrix32 translated(const Vector2& p_offset) const;
|
||||
Matrix32 rotated(float p_phi) const;
|
||||
|
||||
Matrix32 untranslated() const;
|
||||
|
||||
|
||||
void orthonormalize();
|
||||
Matrix32 orthonormalized() const;
|
||||
|
||||
@ -615,7 +612,6 @@ struct Matrix32 {
|
||||
_FORCE_INLINE_ Rect2 xform(const Rect2& p_vec) const;
|
||||
_FORCE_INLINE_ Rect2 xform_inv(const Rect2& p_vec) const;
|
||||
|
||||
|
||||
operator String() const;
|
||||
|
||||
Matrix32(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) {
|
||||
@ -630,7 +626,6 @@ struct Matrix32 {
|
||||
|
||||
Matrix32(real_t p_rot, const Vector2& p_pos);
|
||||
Matrix32() { elements[0][0]=1.0; elements[1][1]=1.0; }
|
||||
|
||||
};
|
||||
|
||||
bool Rect2::intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const {
|
||||
|
@ -41,37 +41,16 @@ static uint32_t Q[4096];
|
||||
#endif
|
||||
|
||||
uint32_t Math::rand_from_seed(uint32_t *seed) {
|
||||
|
||||
#if 1
|
||||
uint32_t k;
|
||||
uint32_t s = (*seed);
|
||||
if (s == 0)
|
||||
s = 0x12345987;
|
||||
k = s / 127773;
|
||||
s = 16807 * (s - k * 127773) - 2836 * k;
|
||||
// if (s < 0)
|
||||
// s += 2147483647;
|
||||
(*seed) = s;
|
||||
return (s & Math::RANDOM_MAX);
|
||||
#else
|
||||
*seed = *seed * 1103515245 + 12345;
|
||||
return (*seed % ((unsigned int)RANDOM_MAX + 1));
|
||||
#endif
|
||||
// Xorshift31 PRNG
|
||||
if ( *seed == 0 ) *seed = Math::RANDOM_MAX;
|
||||
(*seed) ^= (*seed) << 13;
|
||||
(*seed) ^= (*seed) >> 17;
|
||||
(*seed) ^= (*seed) << 5;
|
||||
return (*seed) & Math::RANDOM_MAX;
|
||||
}
|
||||
|
||||
void Math::seed(uint32_t x) {
|
||||
#if 0
|
||||
int i;
|
||||
|
||||
Q[0] = x;
|
||||
Q[1] = x + PHI;
|
||||
Q[2] = x + PHI + PHI;
|
||||
|
||||
for (i = 3; i < 4096; i++)
|
||||
Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i;
|
||||
#else
|
||||
default_seed=x;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Math::randomize() {
|
||||
@ -82,12 +61,12 @@ void Math::randomize() {
|
||||
|
||||
uint32_t Math::rand() {
|
||||
|
||||
return rand_from_seed(&default_seed)&0x7FFFFFFF;
|
||||
return rand_from_seed(&default_seed);
|
||||
}
|
||||
|
||||
double Math::randf() {
|
||||
|
||||
return (double)rand() / (double)RANDOM_MAX;
|
||||
return (double)rand() / (double)Math::RANDOM_MAX;
|
||||
}
|
||||
|
||||
double Math::sin(double p_x) {
|
||||
|
@ -49,13 +49,13 @@ void Vector3::set_axis(int p_axis,real_t p_value) {
|
||||
}
|
||||
real_t Vector3::get_axis(int p_axis) const {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_axis,3,0);
|
||||
return operator[](p_axis);
|
||||
ERR_FAIL_INDEX_V(p_axis,3,0);
|
||||
return operator[](p_axis);
|
||||
}
|
||||
|
||||
int Vector3::min_axis() const {
|
||||
|
||||
return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
|
||||
return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
|
||||
}
|
||||
int Vector3::max_axis() const {
|
||||
|
||||
@ -71,9 +71,9 @@ void Vector3::snap(float p_val) {
|
||||
}
|
||||
Vector3 Vector3::snapped(float p_val) const {
|
||||
|
||||
Vector3 v=*this;
|
||||
v.snap(p_val);
|
||||
return v;
|
||||
Vector3 v=*this;
|
||||
v.snap(p_val);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,77 +63,78 @@ struct Vector3 {
|
||||
return coord[p_axis];
|
||||
}
|
||||
|
||||
void set_axis(int p_axis,real_t p_value);
|
||||
real_t get_axis(int p_axis) const;
|
||||
void set_axis(int p_axis,real_t p_value);
|
||||
real_t get_axis(int p_axis) const;
|
||||
|
||||
int min_axis() const;
|
||||
int max_axis() const;
|
||||
int min_axis() const;
|
||||
int max_axis() const;
|
||||
|
||||
_FORCE_INLINE_ real_t length() const;
|
||||
_FORCE_INLINE_ real_t length_squared() const;
|
||||
_FORCE_INLINE_ real_t length() const;
|
||||
_FORCE_INLINE_ real_t length_squared() const;
|
||||
|
||||
_FORCE_INLINE_ void normalize();
|
||||
_FORCE_INLINE_ Vector3 normalized() const;
|
||||
_FORCE_INLINE_ Vector3 inverse() const;
|
||||
_FORCE_INLINE_ void normalize();
|
||||
_FORCE_INLINE_ Vector3 normalized() const;
|
||||
_FORCE_INLINE_ Vector3 inverse() const;
|
||||
|
||||
_FORCE_INLINE_ void zero();
|
||||
|
||||
void snap(float p_val);
|
||||
Vector3 snapped(float p_val) const;
|
||||
void snap(float p_val);
|
||||
Vector3 snapped(float p_val) const;
|
||||
|
||||
void rotate(const Vector3& p_axis,float p_phi);
|
||||
Vector3 rotated(const Vector3& p_axis,float p_phi) const;
|
||||
|
||||
/* Static Methods between 2 vector3s */
|
||||
/* Static Methods between 2 vector3s */
|
||||
|
||||
_FORCE_INLINE_ Vector3 linear_interpolate(const Vector3& p_b,float p_t) const;
|
||||
_FORCE_INLINE_ Vector3 linear_interpolate(const Vector3& p_b,float p_t) const;
|
||||
Vector3 cubic_interpolate(const Vector3& p_b,const Vector3& p_pre_a, const Vector3& p_post_b,float p_t) const;
|
||||
Vector3 cubic_interpolaten(const Vector3& p_b,const Vector3& p_pre_a, const Vector3& p_post_b,float p_t) const;
|
||||
|
||||
_FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t dot(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t dot(const Vector3& p_b) const;
|
||||
|
||||
_FORCE_INLINE_ Vector3 abs() const;
|
||||
_FORCE_INLINE_ Vector3 floor() const;
|
||||
_FORCE_INLINE_ Vector3 ceil() const;
|
||||
_FORCE_INLINE_ Vector3 abs() const;
|
||||
_FORCE_INLINE_ Vector3 floor() const;
|
||||
_FORCE_INLINE_ Vector3 ceil() const;
|
||||
|
||||
_FORCE_INLINE_ real_t distance_to(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t distance_squared_to(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t distance_to(const Vector3& p_b) const;
|
||||
_FORCE_INLINE_ real_t distance_squared_to(const Vector3& p_b) const;
|
||||
|
||||
_FORCE_INLINE_ real_t angle_to(const Vector3& p_b) const;
|
||||
|
||||
|
||||
_FORCE_INLINE_ Vector3 slide(const Vector3& p_vec) const;
|
||||
_FORCE_INLINE_ Vector3 reflect(const Vector3& p_vec) const;
|
||||
|
||||
|
||||
/* Operators */
|
||||
/* Operators */
|
||||
|
||||
_FORCE_INLINE_ Vector3& operator+=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator+(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator-=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator-(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator*=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator*(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator/=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator/(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator+=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator+(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator-=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator-(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator*=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator*(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ Vector3& operator/=(const Vector3& p_v);
|
||||
_FORCE_INLINE_ Vector3 operator/(const Vector3& p_v) const;
|
||||
|
||||
|
||||
_FORCE_INLINE_ Vector3& operator*=(real_t p_scalar);
|
||||
_FORCE_INLINE_ Vector3 operator*(real_t p_scalar) const;
|
||||
_FORCE_INLINE_ Vector3& operator/=(real_t p_scalar);
|
||||
_FORCE_INLINE_ Vector3 operator/(real_t p_scalar) const;
|
||||
_FORCE_INLINE_ Vector3& operator*=(real_t p_scalar);
|
||||
_FORCE_INLINE_ Vector3 operator*(real_t p_scalar) const;
|
||||
_FORCE_INLINE_ Vector3& operator/=(real_t p_scalar);
|
||||
_FORCE_INLINE_ Vector3 operator/(real_t p_scalar) const;
|
||||
|
||||
_FORCE_INLINE_ Vector3 operator-() const;
|
||||
_FORCE_INLINE_ Vector3 operator-() const;
|
||||
|
||||
_FORCE_INLINE_ bool operator==(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator!=(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator<(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator==(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator!=(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator<(const Vector3& p_v) const;
|
||||
_FORCE_INLINE_ bool operator<=(const Vector3& p_v) const;
|
||||
|
||||
operator String() const;
|
||||
|
||||
_FORCE_INLINE_ Vector3() { x=y=z=0; }
|
||||
_FORCE_INLINE_ Vector3(real_t p_x,real_t p_y,real_t p_z) { x=p_x; y=p_y; z=p_z; }
|
||||
_FORCE_INLINE_ Vector3() { x=y=z=0; }
|
||||
_FORCE_INLINE_ Vector3(real_t p_x,real_t p_y,real_t p_z) { x=p_x; y=p_y; z=p_z; }
|
||||
|
||||
};
|
||||
|
||||
@ -151,11 +152,12 @@ Vector3 Vector3::cross(const Vector3& p_b) const {
|
||||
(x * p_b.y) - (y * p_b.x)
|
||||
);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
real_t Vector3::dot(const Vector3& p_b) const {
|
||||
|
||||
return x*p_b.x + y*p_b.y + z*p_b.z;
|
||||
return x*p_b.x + y*p_b.y + z*p_b.z;
|
||||
}
|
||||
|
||||
Vector3 Vector3::abs() const {
|
||||
@ -180,115 +182,119 @@ Vector3 Vector3::linear_interpolate(const Vector3& p_b,float p_t) const {
|
||||
y+(p_t * (p_b.y-y)),
|
||||
z+(p_t * (p_b.z-z))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
real_t Vector3::distance_to(const Vector3& p_b) const {
|
||||
|
||||
return (p_b-*this).length();
|
||||
}
|
||||
|
||||
real_t Vector3::distance_squared_to(const Vector3& p_b) const {
|
||||
|
||||
return (p_b-*this).length_squared();
|
||||
return (p_b-*this).length_squared();
|
||||
}
|
||||
|
||||
real_t Vector3::angle_to(const Vector3& p_b) const {
|
||||
|
||||
return Math::acos(this->dot(p_b) / Math::sqrt(this->length_squared() * p_b.length_squared()));
|
||||
}
|
||||
|
||||
/* Operators */
|
||||
|
||||
Vector3& Vector3::operator+=(const Vector3& p_v) {
|
||||
|
||||
x+=p_v.x;
|
||||
y+=p_v.y;
|
||||
z+=p_v.z;
|
||||
return *this;
|
||||
x+=p_v.x;
|
||||
y+=p_v.y;
|
||||
z+=p_v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator+(const Vector3& p_v) const {
|
||||
|
||||
return Vector3(x+p_v.x, y+p_v.y, z+ p_v.z);
|
||||
return Vector3(x+p_v.x, y+p_v.y, z+ p_v.z);
|
||||
}
|
||||
|
||||
Vector3& Vector3::operator-=(const Vector3& p_v) {
|
||||
|
||||
x-=p_v.x;
|
||||
y-=p_v.y;
|
||||
z-=p_v.z;
|
||||
return *this;
|
||||
x-=p_v.x;
|
||||
y-=p_v.y;
|
||||
z-=p_v.z;
|
||||
return *this;
|
||||
}
|
||||
Vector3 Vector3::operator-(const Vector3& p_v) const {
|
||||
|
||||
return Vector3(x-p_v.x, y-p_v.y, z- p_v.z);
|
||||
return Vector3(x-p_v.x, y-p_v.y, z- p_v.z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vector3& Vector3::operator*=(const Vector3& p_v) {
|
||||
|
||||
x*=p_v.x;
|
||||
y*=p_v.y;
|
||||
z*=p_v.z;
|
||||
return *this;
|
||||
x*=p_v.x;
|
||||
y*=p_v.y;
|
||||
z*=p_v.z;
|
||||
return *this;
|
||||
}
|
||||
Vector3 Vector3::operator*(const Vector3& p_v) const {
|
||||
|
||||
return Vector3(x*p_v.x, y*p_v.y, z* p_v.z);
|
||||
return Vector3(x*p_v.x, y*p_v.y, z* p_v.z);
|
||||
}
|
||||
|
||||
Vector3& Vector3::operator/=(const Vector3& p_v) {
|
||||
|
||||
x/=p_v.x;
|
||||
y/=p_v.y;
|
||||
z/=p_v.z;
|
||||
return *this;
|
||||
x/=p_v.x;
|
||||
y/=p_v.y;
|
||||
z/=p_v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator/(const Vector3& p_v) const {
|
||||
|
||||
return Vector3(x/p_v.x, y/p_v.y, z/ p_v.z);
|
||||
return Vector3(x/p_v.x, y/p_v.y, z/ p_v.z);
|
||||
}
|
||||
|
||||
Vector3& Vector3::operator*=(real_t p_scalar) {
|
||||
x*=p_scalar;
|
||||
y*=p_scalar;
|
||||
z*=p_scalar;
|
||||
return *this;
|
||||
|
||||
x*=p_scalar;
|
||||
y*=p_scalar;
|
||||
z*=p_scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Vector3 operator*(real_t p_scalar, const Vector3& p_vec) {
|
||||
|
||||
return p_vec * p_scalar;
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator*(real_t p_scalar) const {
|
||||
|
||||
return Vector3( x*p_scalar, y*p_scalar, z*p_scalar);
|
||||
return Vector3( x*p_scalar, y*p_scalar, z*p_scalar);
|
||||
}
|
||||
|
||||
Vector3& Vector3::operator/=(real_t p_scalar) {
|
||||
x/=p_scalar;
|
||||
y/=p_scalar;
|
||||
z/=p_scalar;
|
||||
return *this;
|
||||
|
||||
x/=p_scalar;
|
||||
y/=p_scalar;
|
||||
z/=p_scalar;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator/(real_t p_scalar) const {
|
||||
|
||||
return Vector3( x/p_scalar, y/p_scalar, z/p_scalar);
|
||||
return Vector3( x/p_scalar, y/p_scalar, z/p_scalar);
|
||||
}
|
||||
|
||||
Vector3 Vector3::operator-() const {
|
||||
|
||||
return Vector3( -x, -y, -z );
|
||||
return Vector3( -x, -y, -z );
|
||||
}
|
||||
|
||||
|
||||
bool Vector3::operator==(const Vector3& p_v) const {
|
||||
|
||||
return (x==p_v.x && y==p_v.y && z==p_v.z);
|
||||
return (x==p_v.x && y==p_v.y && z==p_v.z);
|
||||
}
|
||||
|
||||
bool Vector3::operator!=(const Vector3& p_v) const {
|
||||
|
||||
return (x!=p_v.x || y!=p_v.y || z!=p_v.z);
|
||||
return (x!=p_v.x || y!=p_v.y || z!=p_v.z);
|
||||
}
|
||||
|
||||
bool Vector3::operator<(const Vector3& p_v) const {
|
||||
@ -298,9 +304,9 @@ bool Vector3::operator<(const Vector3& p_v) const {
|
||||
return z<p_v.z;
|
||||
else
|
||||
return y<p_v.y;
|
||||
} else
|
||||
} else {
|
||||
return x<p_v.x;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool Vector3::operator<=(const Vector3& p_v) const {
|
||||
@ -310,9 +316,9 @@ bool Vector3::operator<=(const Vector3& p_v) const {
|
||||
return z<=p_v.z;
|
||||
else
|
||||
return y<p_v.y;
|
||||
} else
|
||||
} else {
|
||||
return x<p_v.x;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Vector3 vec3_cross(const Vector3& p_a, const Vector3& p_b) {
|
||||
@ -333,6 +339,7 @@ real_t Vector3::length() const {
|
||||
|
||||
return Math::sqrt(x2+y2+z2);
|
||||
}
|
||||
|
||||
real_t Vector3::length_squared() const {
|
||||
|
||||
real_t x2=x*x;
|
||||
@ -340,27 +347,25 @@ real_t Vector3::length_squared() const {
|
||||
real_t z2=z*z;
|
||||
|
||||
return x2+y2+z2;
|
||||
|
||||
}
|
||||
|
||||
void Vector3::normalize() {
|
||||
|
||||
real_t l=length();
|
||||
if (l==0) {
|
||||
|
||||
real_t l=length();
|
||||
if (l==0) {
|
||||
x=y=z=0;
|
||||
} else {
|
||||
|
||||
} else {
|
||||
x/=l;
|
||||
y/=l;
|
||||
z/=l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 Vector3::normalized() const {
|
||||
|
||||
Vector3 v=*this;
|
||||
v.normalize();
|
||||
return v;
|
||||
Vector3 v=*this;
|
||||
v.normalize();
|
||||
return v;
|
||||
}
|
||||
|
||||
Vector3 Vector3::inverse() const {
|
||||
@ -377,10 +382,10 @@ Vector3 Vector3::slide(const Vector3& p_vec) const {
|
||||
|
||||
return p_vec - *this * this->dot(p_vec);
|
||||
}
|
||||
|
||||
Vector3 Vector3::reflect(const Vector3& p_vec) const {
|
||||
|
||||
return p_vec - *this * this->dot(p_vec) * 2.0;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1215,6 +1215,15 @@ void Object::emit_signal(const StringName& p_name,const Variant** p_args,int p_a
|
||||
|
||||
Signal *s = signal_map.getptr(p_name);
|
||||
if (!s) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_name);
|
||||
//check in script
|
||||
if (!signal_is_valid && !script.is_null() && !Ref<Script>(script)->has_script_signal(p_name)) {
|
||||
ERR_EXPLAIN("Can't emit non-existing signal " + String("\"")+p_name+"\".");
|
||||
ERR_FAIL();
|
||||
}
|
||||
#endif
|
||||
//not connected? just return
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
|
@ -64,6 +64,10 @@ void Input::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string);
|
||||
ObjectTypeDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string);
|
||||
ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0));
|
||||
ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration);
|
||||
ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer);
|
||||
@ -90,7 +94,7 @@ void Input::get_argument_options(const StringName& p_function,int p_idx,List<Str
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
String pf=p_function;
|
||||
if (p_idx==0 && (pf=="is_action_pressed" || pf=="action_press" || pf=="action_release")) {
|
||||
if (p_idx==0 && (pf=="is_action_pressed" || pf=="action_press" || pf=="action_release" || pf=="is_action_just_pressed" || pf=="is_action_just_released")) {
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
Globals::get_singleton()->get_property_list(&pinfo);
|
||||
|
@ -96,6 +96,11 @@ public:
|
||||
virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2())=0;
|
||||
virtual void set_mouse_in_window(bool p_in_window)=0;
|
||||
|
||||
virtual String get_joy_button_string(int p_button)=0;
|
||||
virtual String get_joy_axis_string(int p_axis)=0;
|
||||
virtual int get_joy_button_index_from_string(String p_button)=0;
|
||||
virtual int get_joy_axis_index_from_string(String p_axis)=0;
|
||||
|
||||
Input();
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,8 @@ bool InputEvent::operator==(const InputEvent &p_event) const {
|
||||
case MOUSE_MOTION:
|
||||
return mouse_motion.x == p_event.mouse_motion.x
|
||||
&& mouse_motion.y == p_event.mouse_motion.y
|
||||
&& mouse_motion.relative_x == p_event.mouse_motion.relative_y
|
||||
&& mouse_motion.relative_x == p_event.mouse_motion.relative_x
|
||||
&& mouse_motion.relative_y == p_event.mouse_motion.relative_y
|
||||
&& mouse_motion.button_mask == p_event.mouse_motion.button_mask
|
||||
&& key.mod == p_event.key.mod;
|
||||
case MOUSE_BUTTON:
|
||||
|
@ -372,6 +372,7 @@ public:
|
||||
virtual void set_screen_orientation(ScreenOrientation p_orientation);
|
||||
ScreenOrientation get_screen_orientation() const;
|
||||
|
||||
virtual void enable_for_stealing_focus(ProcessID pid) {}
|
||||
virtual void move_window_to_foreground() {}
|
||||
|
||||
virtual void debug_break();
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "os/input.h"
|
||||
#include "core/io/xml_parser.h"
|
||||
#include "io/http_client.h"
|
||||
#include "io/pck_packer.h"
|
||||
#include "packed_data_container.h"
|
||||
#include "func_ref.h"
|
||||
#include "input_map.h"
|
||||
@ -146,6 +147,8 @@ void register_core_types() {
|
||||
|
||||
ObjectTypeDB::register_type<ConfigFile>();
|
||||
|
||||
ObjectTypeDB::register_type<PCKPacker>();
|
||||
|
||||
ObjectTypeDB::register_type<PackedDataContainer>();
|
||||
ObjectTypeDB::register_virtual_type<PackedDataContainerRef>();
|
||||
ObjectTypeDB::register_type<AStar>();
|
||||
|
@ -134,6 +134,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
|
||||
ERR_FAIL();
|
||||
}
|
||||
|
||||
OS::get_singleton()->enable_for_stealing_focus(Globals::get_singleton()->get("editor_pid"));
|
||||
|
||||
packet_peer_stream->put_var("debug_enter");
|
||||
packet_peer_stream->put_var(2);
|
||||
packet_peer_stream->put_var(p_can_continue);
|
||||
@ -273,6 +275,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
|
||||
|
||||
set_depth(-1);
|
||||
set_lines_left(-1);
|
||||
OS::get_singleton()->move_window_to_foreground();
|
||||
break;
|
||||
} else if (command=="break") {
|
||||
ERR_PRINT("Got break when already broke!");
|
||||
|
@ -779,6 +779,11 @@ Vector<String> TranslationServer::get_all_locale_names(){
|
||||
}
|
||||
|
||||
|
||||
static String get_trimmed_locale(const String& p_locale) {
|
||||
|
||||
return p_locale.substr(0,2);
|
||||
}
|
||||
|
||||
static bool is_valid_locale(const String& p_locale) {
|
||||
|
||||
const char **ptr=locale_list;
|
||||
@ -839,9 +844,20 @@ void Translation::_set_messages(const DVector<String>& p_messages){
|
||||
|
||||
void Translation::set_locale(const String& p_locale) {
|
||||
|
||||
ERR_EXPLAIN("Invalid Locale: "+p_locale);
|
||||
ERR_FAIL_COND(!is_valid_locale(p_locale));
|
||||
locale=p_locale;
|
||||
// replaces '-' with '_' for macOS Sierra-style locales
|
||||
String univ_locale = p_locale.replace("-", "_");
|
||||
|
||||
if(!is_valid_locale(univ_locale)) {
|
||||
String trimmed_locale = get_trimmed_locale(univ_locale);
|
||||
|
||||
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
||||
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
||||
|
||||
locale=trimmed_locale;
|
||||
}
|
||||
else {
|
||||
locale=univ_locale;
|
||||
}
|
||||
}
|
||||
|
||||
void Translation::add_message( const StringName& p_src_text, const StringName& p_xlated_text ) {
|
||||
@ -906,9 +922,20 @@ Translation::Translation() {
|
||||
|
||||
void TranslationServer::set_locale(const String& p_locale) {
|
||||
|
||||
ERR_EXPLAIN("Invalid Locale: "+p_locale);
|
||||
ERR_FAIL_COND(!is_valid_locale(p_locale));
|
||||
locale=p_locale;
|
||||
// replaces '-' with '_' for macOS Sierra-style locales
|
||||
String univ_locale = p_locale.replace("-", "_");
|
||||
|
||||
if(!is_valid_locale(univ_locale)) {
|
||||
String trimmed_locale = get_trimmed_locale(univ_locale);
|
||||
|
||||
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
||||
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
||||
|
||||
locale=trimmed_locale;
|
||||
}
|
||||
else {
|
||||
locale=univ_locale;
|
||||
}
|
||||
}
|
||||
|
||||
String TranslationServer::get_locale() const {
|
||||
|
@ -1543,11 +1543,11 @@ String::String(const StrRange& p_range) {
|
||||
copy_from(p_range.c_str,p_range.len);
|
||||
}
|
||||
|
||||
int String::hex_to_int() const {
|
||||
int String::hex_to_int(bool p_with_prefix) const {
|
||||
|
||||
int l = length();
|
||||
if (l<3)
|
||||
return 0;
|
||||
if (p_with_prefix && l<3)
|
||||
return 0;
|
||||
|
||||
const CharType *s=ptr();
|
||||
|
||||
@ -1556,15 +1556,16 @@ int String::hex_to_int() const {
|
||||
if (sign<0) {
|
||||
s++;
|
||||
l--;
|
||||
if (l<2)
|
||||
if (p_with_prefix && l<2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (s[0]!='0' || s[1]!='x')
|
||||
return 0;
|
||||
|
||||
s+=2;
|
||||
l-=2;
|
||||
if (p_with_prefix) {
|
||||
if (s[0]!='0' || s[1]!='x')
|
||||
return 0;
|
||||
s+=2;
|
||||
l-=2;
|
||||
};
|
||||
|
||||
int hex=0;
|
||||
|
||||
@ -3073,6 +3074,11 @@ String String::simplify_path() const {
|
||||
}
|
||||
|
||||
s =s.replace("\\","/");
|
||||
while(true){ // in case of using 2 or more slash
|
||||
String compare = s.replace("//","/");
|
||||
if (s==compare) break;
|
||||
else s=compare;
|
||||
}
|
||||
Vector<String> dirs = s.split("/",false);
|
||||
|
||||
for(int i=0;i<dirs.size();i++) {
|
||||
@ -3173,7 +3179,7 @@ bool String::is_valid_identifier() const {
|
||||
|
||||
//kind of poor should be rewritten properly
|
||||
|
||||
String String::world_wrap(int p_chars_per_line) const {
|
||||
String String::word_wrap(int p_chars_per_line) const {
|
||||
|
||||
int from=0;
|
||||
int last_space=0;
|
||||
@ -3505,6 +3511,36 @@ bool String::is_valid_integer() const {
|
||||
|
||||
}
|
||||
|
||||
bool String::is_valid_hex_number(bool p_with_prefix) const {
|
||||
|
||||
int from = 0;
|
||||
int len = length();
|
||||
|
||||
if (len!=1 && (operator[](0)=='+' || operator[](0)=='-'))
|
||||
from++;
|
||||
|
||||
if (p_with_prefix) {
|
||||
|
||||
if (len < 2)
|
||||
return false;
|
||||
if (operator[](from) != '0' || operator[](from+1) != 'x') {
|
||||
return false;
|
||||
};
|
||||
from += 2;
|
||||
};
|
||||
|
||||
for (int i=from; i<len; i++) {
|
||||
|
||||
CharType c = operator[](i);
|
||||
if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
|
||||
continue;
|
||||
return false;
|
||||
};
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
bool String::is_valid_float() const {
|
||||
|
||||
int len = length();
|
||||
@ -3641,20 +3677,41 @@ bool String::is_valid_html_color() const {
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool String::is_valid_ip_address() const {
|
||||
|
||||
Vector<String> ip = split(".");
|
||||
if (ip.size()!=4)
|
||||
return false;
|
||||
for(int i=0;i<ip.size();i++) {
|
||||
if (find(":") >= 0) {
|
||||
|
||||
String n = ip[i];
|
||||
if (!n.is_valid_integer())
|
||||
Vector<String> ip = split(":");
|
||||
for (int i=0; i<ip.size(); i++) {
|
||||
|
||||
String n = ip[i];
|
||||
if (n.empty())
|
||||
continue;
|
||||
if (n.is_valid_hex_number(false)) {
|
||||
int nint = n.hex_to_int(false);
|
||||
if (nint < 0 || nint > 0xffff)
|
||||
return false;
|
||||
continue;
|
||||
};
|
||||
if (!n.is_valid_ip_address())
|
||||
return false;
|
||||
};
|
||||
|
||||
} else {
|
||||
Vector<String> ip = split(".");
|
||||
if (ip.size()!=4)
|
||||
return false;
|
||||
int val = n.to_int();
|
||||
if (val<0 || val>255)
|
||||
return false;
|
||||
}
|
||||
for(int i=0;i<ip.size();i++) {
|
||||
|
||||
String n = ip[i];
|
||||
if (!n.is_valid_integer())
|
||||
return false;
|
||||
int val = n.to_int();
|
||||
if (val<0 || val>255)
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
bool is_numeric() const;
|
||||
double to_double() const;
|
||||
float to_float() const;
|
||||
int hex_to_int() const;
|
||||
int hex_to_int(bool p_with_prefix = true) const;
|
||||
int to_int() const;
|
||||
|
||||
int64_t to_int64() const;
|
||||
@ -218,7 +218,7 @@ public:
|
||||
String c_escape() const;
|
||||
String c_unescape() const;
|
||||
String json_escape() const;
|
||||
String world_wrap(int p_chars_per_line) const;
|
||||
String word_wrap(int p_chars_per_line) const;
|
||||
|
||||
String percent_encode() const;
|
||||
String percent_decode() const;
|
||||
@ -226,6 +226,7 @@ public:
|
||||
bool is_valid_identifier() const;
|
||||
bool is_valid_integer() const;
|
||||
bool is_valid_float() const;
|
||||
bool is_valid_hex_number(bool p_with_prefix) const;
|
||||
bool is_valid_html_color() const;
|
||||
bool is_valid_ip_address() const;
|
||||
|
||||
|
@ -429,6 +429,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||
return true;
|
||||
i++;
|
||||
}
|
||||
|
||||
} else if (invalid_types) {
|
||||
|
||||
|
||||
@ -439,6 +440,8 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||
return false;
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -457,7 +460,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||
};
|
||||
|
||||
const Type *valid_types=NULL;
|
||||
const Type *invalid_types=NULL;
|
||||
|
||||
switch(p_type_to) {
|
||||
case BOOL: {
|
||||
@ -679,16 +681,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||
return true;
|
||||
i++;
|
||||
}
|
||||
} else if (invalid_types) {
|
||||
|
||||
|
||||
int i=0;
|
||||
while(invalid_types[i]!=NIL) {
|
||||
|
||||
if (p_type_from==invalid_types[i])
|
||||
return false;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -346,6 +346,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
||||
VCALL_LOCALMEM0R(Vector2,angle);
|
||||
// VCALL_LOCALMEM1R(Vector2,cross);
|
||||
VCALL_LOCALMEM0R(Vector2,abs);
|
||||
VCALL_LOCALMEM1R(Vector2,clamped);
|
||||
|
||||
VCALL_LOCALMEM0R(Rect2,get_area);
|
||||
VCALL_LOCALMEM1R(Rect2,intersects);
|
||||
@ -374,6 +375,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
||||
VCALL_LOCALMEM0R(Vector3, ceil);
|
||||
VCALL_LOCALMEM1R(Vector3, distance_to);
|
||||
VCALL_LOCALMEM1R(Vector3, distance_squared_to);
|
||||
VCALL_LOCALMEM1R(Vector3, angle_to);
|
||||
VCALL_LOCALMEM1R(Vector3, slide);
|
||||
VCALL_LOCALMEM1R(Vector3, reflect);
|
||||
|
||||
@ -464,8 +466,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
||||
VCALL_LOCALMEM0R(Array,hash);
|
||||
VCALL_LOCALMEM1(Array,push_back);
|
||||
VCALL_LOCALMEM1(Array,push_front);
|
||||
VCALL_LOCALMEM0(Array,pop_back);
|
||||
VCALL_LOCALMEM0(Array,pop_front);
|
||||
VCALL_LOCALMEM0R(Array,pop_back);
|
||||
VCALL_LOCALMEM0R(Array,pop_front);
|
||||
VCALL_LOCALMEM1(Array,append);
|
||||
VCALL_LOCALMEM1(Array,resize);
|
||||
VCALL_LOCALMEM2(Array,insert);
|
||||
@ -1457,6 +1459,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
||||
ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray());
|
||||
//ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray());
|
||||
ADDFUNC0(VECTOR2,VECTOR2,Vector2,abs,varray());
|
||||
ADDFUNC1(VECTOR2,VECTOR2,Vector2,clamped,REAL,"length",varray());
|
||||
|
||||
ADDFUNC0(RECT2,REAL,Rect2,get_area,varray());
|
||||
ADDFUNC1(RECT2,BOOL,Rect2,intersects,RECT2,"b",varray());
|
||||
@ -1485,6 +1488,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
||||
ADDFUNC0(VECTOR3,VECTOR3,Vector3,ceil,varray());
|
||||
ADDFUNC1(VECTOR3,REAL,Vector3,distance_to,VECTOR3,"b",varray());
|
||||
ADDFUNC1(VECTOR3,REAL,Vector3,distance_squared_to,VECTOR3,"b",varray());
|
||||
ADDFUNC1(VECTOR3,REAL,Vector3,angle_to,VECTOR3,"to",varray());
|
||||
ADDFUNC1(VECTOR3,VECTOR3,Vector3,slide,VECTOR3,"by",varray());
|
||||
ADDFUNC1(VECTOR3,VECTOR3,Vector3,reflect,VECTOR3,"by",varray());
|
||||
|
||||
@ -1816,6 +1820,11 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
||||
_VariantCall::add_constant(Variant::IMAGE,"INTERPOLATE_NEAREST",Image::INTERPOLATE_NEAREST);
|
||||
_VariantCall::add_constant(Variant::IMAGE,"INTERPOLATE_BILINEAR",Image::INTERPOLATE_BILINEAR);
|
||||
_VariantCall::add_constant(Variant::IMAGE,"INTERPOLATE_CUBIC",Image::INTERPOLATE_CUBIC);
|
||||
|
||||
_VariantCall::add_constant(Variant::INT, "IP_TYPE_NONE", IP_Address::TYPE_NONE);
|
||||
_VariantCall::add_constant(Variant::INT, "IP_TYPE_IPV4", IP_Address::TYPE_IPV4);
|
||||
_VariantCall::add_constant(Variant::INT, "IP_TYPE_IPV6", IP_Address::TYPE_IPV6);
|
||||
_VariantCall::add_constant(Variant::INT, "IP_TYPE_ANY", IP_Address::TYPE_ANY);
|
||||
}
|
||||
|
||||
void unregister_variant_methods() {
|
||||
|
@ -986,7 +986,18 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
|
||||
|
||||
InputEvent ie;
|
||||
|
||||
if (id=="KEY") {
|
||||
if (id=="NONE") {
|
||||
|
||||
ie.type=InputEvent::NONE;
|
||||
|
||||
get_token(p_stream,token,line,r_err_str);
|
||||
|
||||
if (token.type!=TK_PARENTHESIS_CLOSE) {
|
||||
r_err_str="Expected ')'";
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
} else if (id=="KEY") {
|
||||
|
||||
get_token(p_stream,token,line,r_err_str);
|
||||
if (token.type!=TK_COMMA) {
|
||||
@ -1166,16 +1177,16 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
|
||||
|
||||
} else if (id=="IntArray") {
|
||||
|
||||
Vector<int32_t> args;
|
||||
Error err = _parse_construct<int32_t>(p_stream,args,line,r_err_str);
|
||||
Vector<int> args;
|
||||
Error err = _parse_construct<int>(p_stream,args,line,r_err_str);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
DVector<int32_t> arr;
|
||||
DVector<int> arr;
|
||||
{
|
||||
int len=args.size();
|
||||
arr.resize(len);
|
||||
DVector<int32_t>::Write w = arr.write();
|
||||
DVector<int>::Write w = arr.write();
|
||||
for(int i=0;i<len;i++) {
|
||||
w[i]=int(args[i]);
|
||||
}
|
||||
@ -2093,6 +2104,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
|
||||
case InputEvent::JOYSTICK_MOTION: {
|
||||
str+="JAXIS,"+itos(ev.joy_motion.axis)+","+itos(ev.joy_motion.axis_value);
|
||||
} break;
|
||||
case InputEvent::NONE: {
|
||||
str+="NONE";
|
||||
} break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import re
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import codecs
|
||||
|
103
drivers/SCsub
vendored
103
drivers/SCsub
vendored
@ -1,81 +1,50 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env_drivers = env.Clone()
|
||||
|
||||
env.drivers_sources=[]
|
||||
#env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
env_drivers.Append(CPPPATH=["vorbis"])
|
||||
|
||||
Export('env_drivers')
|
||||
if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
|
||||
SConscript("zlib/SCsub");
|
||||
|
||||
# OS drivers
|
||||
SConscript('unix/SCsub');
|
||||
SConscript('windows/SCsub');
|
||||
|
||||
# Sounds drivers
|
||||
SConscript('alsa/SCsub');
|
||||
SConscript('pulseaudio/SCsub');
|
||||
SConscript('windows/SCsub');
|
||||
if (env["platform"] == "windows"):
|
||||
SConscript("rtaudio/SCsub");
|
||||
if (env["xaudio2"] == "yes"):
|
||||
SConscript("xaudio2/SCsub");
|
||||
|
||||
# Graphics drivers
|
||||
SConscript('gles2/SCsub');
|
||||
SConscript('gl_context/SCsub');
|
||||
SConscript('pnm/SCsub');
|
||||
|
||||
if (env['openssl']!='no'):
|
||||
env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
|
||||
env_drivers.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
|
||||
if (env['openssl']=="builtin"):
|
||||
env_drivers.Append(CPPPATH=['#drivers/builtin_openssl2'])
|
||||
SConscript("builtin_openssl2/SCsub");
|
||||
# Core dependencies
|
||||
SConscript("png/SCsub");
|
||||
|
||||
SConscript('openssl/SCsub')
|
||||
|
||||
|
||||
if (env["png"]=="yes"):
|
||||
SConscript("png/SCsub");
|
||||
if (env["jpg"]=="yes"):
|
||||
#SConscript("jpg/SCsub");
|
||||
SConscript("jpegd/SCsub");
|
||||
if (env["webp"]=="yes"):
|
||||
SConscript("webp/SCsub");
|
||||
SConscript("dds/SCsub");
|
||||
SConscript("pvr/SCsub");
|
||||
SConscript("etc1/SCsub")
|
||||
if (env["builtin_zlib"]=="yes"):
|
||||
SConscript("builtin_zlib/SCsub");
|
||||
|
||||
SConscript("rtaudio/SCsub");
|
||||
SConscript("nedmalloc/SCsub");
|
||||
SConscript("nrex/SCsub");
|
||||
SConscript("chibi/SCsub");
|
||||
if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theoralib"]=="yes" or env["opus"]=="yes"):
|
||||
SConscript("ogg/SCsub");
|
||||
if (env["vorbis"]=="yes"):
|
||||
SConscript("vorbis/SCsub");
|
||||
if (env["opus"]=="yes"):
|
||||
SConscript('opus/SCsub');
|
||||
# Tools override
|
||||
# FIXME: Should likely be integrated in the tools/ codebase
|
||||
if (env["tools"]=="yes"):
|
||||
SConscript("convex_decomp/SCsub");
|
||||
|
||||
if (env["theoralib"]=="yes"):
|
||||
SConscript("theora/SCsub");
|
||||
if (env['speex']=='yes'):
|
||||
SConscript("speex/SCsub");
|
||||
if (env['musepack']=='yes'):
|
||||
SConscript("mpc/SCsub");
|
||||
if (env["squish"]=="yes" and env["tools"]=="yes"):
|
||||
SConscript("squish/SCsub");
|
||||
if (env["freetype"]!="no"):
|
||||
SConscript("freetype/SCsub");
|
||||
|
||||
num = 0
|
||||
cur_base = ""
|
||||
total = len(env.drivers_sources)
|
||||
max_src = 64
|
||||
list = []
|
||||
lib_list = []
|
||||
|
||||
import string
|
||||
|
||||
if env['vsproj']=="yes":
|
||||
env.AddToVSProject(env.drivers_sources)
|
||||
|
||||
if (env.split_drivers): #split drivers, this used to be needed for windows until separate builders for windows were created
|
||||
|
||||
# Split drivers, this used to be needed for windows until separate builders for windows were created
|
||||
# FIXME: Check if still needed now that the drivers were made more lightweight
|
||||
if (env.split_drivers):
|
||||
import string
|
||||
|
||||
num = 0
|
||||
cur_base = ""
|
||||
max_src = 64
|
||||
list = []
|
||||
lib_list = []
|
||||
|
||||
for f in env.drivers_sources:
|
||||
fname = ""
|
||||
@ -87,14 +56,14 @@ if (env.split_drivers): #split drivers, this used to be needed for windows until
|
||||
base = string.join(fname.split("/")[:2], "/")
|
||||
if base != cur_base and len(list) > max_src:
|
||||
if num > 0:
|
||||
lib = env_drivers.Library("drivers"+str(num), list)
|
||||
lib = env.Library("drivers"+str(num), list)
|
||||
lib_list.append(lib)
|
||||
list = []
|
||||
num = num+1
|
||||
cur_base = base
|
||||
list.append(f)
|
||||
|
||||
lib = env_drivers.Library("drivers"+str(num), list)
|
||||
lib = env.Library("drivers"+str(num), list)
|
||||
lib_list.append(lib)
|
||||
|
||||
if len(lib_list) > 0:
|
||||
@ -102,15 +71,15 @@ if (env.split_drivers): #split drivers, this used to be needed for windows until
|
||||
if os.name=='posix' and sys.platform=='msys':
|
||||
env.Replace(ARFLAGS=['rcsT'])
|
||||
|
||||
lib = env_drivers.Library("drivers_collated", lib_list)
|
||||
lib = env.Library("drivers_collated", lib_list)
|
||||
lib_list = [lib]
|
||||
|
||||
drivers_base=[]
|
||||
env_drivers.add_source_files(drivers_base,"*.cpp")
|
||||
lib_list.insert(0, env_drivers.Library("drivers", drivers_base))
|
||||
env.add_source_files(drivers_base,"*.cpp")
|
||||
lib_list.insert(0, env.Library("drivers", drivers_base))
|
||||
|
||||
env.Prepend(LIBS=lib_list)
|
||||
else:
|
||||
env_drivers.add_source_files(env.drivers_sources,"*.cpp")
|
||||
lib = env_drivers.Library("drivers",env.drivers_sources)
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
lib = env.Library("drivers",env.drivers_sources)
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
@ -1,662 +0,0 @@
|
||||
Import('env')
|
||||
Import('env_drivers')
|
||||
|
||||
openssl_sources = [
|
||||
"ssl/t1_lib.c",
|
||||
"ssl/t1_ext.c",
|
||||
"ssl/s3_srvr.c",
|
||||
"ssl/t1_enc.c",
|
||||
"ssl/t1_meth.c",
|
||||
"ssl/s23_clnt.c",
|
||||
"ssl/ssl_asn1.c",
|
||||
"ssl/tls_srp.c",
|
||||
"ssl/kssl.c",
|
||||
"ssl/d1_both.c",
|
||||
"ssl/t1_clnt.c",
|
||||
"ssl/bio_ssl.c",
|
||||
"ssl/d1_srtp.c",
|
||||
"ssl/t1_reneg.c",
|
||||
"ssl/ssl_cert.c",
|
||||
"ssl/s3_lib.c",
|
||||
"ssl/d1_srvr.c",
|
||||
"ssl/s23_meth.c",
|
||||
"ssl/ssl_stat.c",
|
||||
"ssl/ssl_err.c",
|
||||
"ssl/ssl_algs.c",
|
||||
"ssl/s3_cbc.c",
|
||||
"ssl/d1_clnt.c",
|
||||
"ssl/s3_pkt.c",
|
||||
"ssl/d1_meth.c",
|
||||
"ssl/s3_both.c",
|
||||
"ssl/s2_enc.c",
|
||||
"ssl/s3_meth.c",
|
||||
"ssl/s3_enc.c",
|
||||
"ssl/s23_pkt.c",
|
||||
"ssl/s2_pkt.c",
|
||||
"ssl/d1_pkt.c",
|
||||
"ssl/ssl_rsa.c",
|
||||
"ssl/s23_srvr.c",
|
||||
"ssl/s2_meth.c",
|
||||
"ssl/s3_clnt.c",
|
||||
"ssl/s23_lib.c",
|
||||
"ssl/t1_srvr.c",
|
||||
"ssl/ssl_lib.c",
|
||||
"ssl/ssl_txt.c",
|
||||
"ssl/s2_srvr.c",
|
||||
"ssl/ssl_sess.c",
|
||||
"ssl/s2_clnt.c",
|
||||
"ssl/d1_lib.c",
|
||||
"ssl/s2_lib.c",
|
||||
"ssl/ssl_err2.c",
|
||||
"ssl/ssl_ciph.c",
|
||||
"crypto/dsa/dsa_lib.c",
|
||||
"crypto/dsa/dsa_pmeth.c",
|
||||
"crypto/dsa/dsa_ossl.c",
|
||||
"crypto/dsa/dsa_gen.c",
|
||||
"crypto/dsa/dsa_asn1.c",
|
||||
"crypto/dsa/dsa_prn.c",
|
||||
"crypto/dsa/dsa_sign.c",
|
||||
"crypto/dsa/dsa_key.c",
|
||||
"crypto/dsa/dsa_vrf.c",
|
||||
"crypto/dsa/dsa_err.c",
|
||||
"crypto/dsa/dsa_ameth.c",
|
||||
"crypto/dsa/dsa_depr.c",
|
||||
"crypto/x509/x509_lu.c",
|
||||
"crypto/x509/x509cset.c",
|
||||
"crypto/x509/x509_set.c",
|
||||
"crypto/x509/x509_d2.c",
|
||||
"crypto/x509/x509_txt.c",
|
||||
"crypto/x509/x509rset.c",
|
||||
"crypto/x509/by_dir.c",
|
||||
"crypto/x509/x509_vpm.c",
|
||||
"crypto/x509/x509_vfy.c",
|
||||
"crypto/x509/x509_trs.c",
|
||||
"crypto/x509/by_file.c",
|
||||
"crypto/x509/x509_obj.c",
|
||||
"crypto/x509/x509spki.c",
|
||||
"crypto/x509/x509_v3.c",
|
||||
"crypto/x509/x509_req.c",
|
||||
"crypto/x509/x509_att.c",
|
||||
"crypto/x509/x_all.c",
|
||||
"crypto/x509/x509_ext.c",
|
||||
"crypto/x509/x509type.c",
|
||||
"crypto/x509/x509_def.c",
|
||||
"crypto/x509/x509_err.c",
|
||||
"crypto/x509/x509name.c",
|
||||
"crypto/x509/x509_r2x.c",
|
||||
"crypto/x509/x509_cmp.c",
|
||||
"crypto/asn1/x_pkey.c",
|
||||
"crypto/asn1/a_gentm.c",
|
||||
"crypto/asn1/x_sig.c",
|
||||
"crypto/asn1/t_req.c",
|
||||
"crypto/asn1/t_pkey.c",
|
||||
"crypto/asn1/p8_pkey.c",
|
||||
"crypto/asn1/a_i2d_fp.c",
|
||||
"crypto/asn1/x_val.c",
|
||||
"crypto/asn1/f_string.c",
|
||||
"crypto/asn1/p5_pbe.c",
|
||||
"crypto/asn1/bio_ndef.c",
|
||||
"crypto/asn1/a_bool.c",
|
||||
"crypto/asn1/asn1_gen.c",
|
||||
"crypto/asn1/x_algor.c",
|
||||
"crypto/asn1/bio_asn1.c",
|
||||
"crypto/asn1/asn_mime.c",
|
||||
"crypto/asn1/t_x509.c",
|
||||
"crypto/asn1/a_strex.c",
|
||||
"crypto/asn1/x_nx509.c",
|
||||
"crypto/asn1/asn1_err.c",
|
||||
"crypto/asn1/x_crl.c",
|
||||
"crypto/asn1/a_print.c",
|
||||
"crypto/asn1/a_type.c",
|
||||
"crypto/asn1/tasn_new.c",
|
||||
"crypto/asn1/n_pkey.c",
|
||||
"crypto/asn1/x_bignum.c",
|
||||
"crypto/asn1/asn_pack.c",
|
||||
"crypto/asn1/evp_asn1.c",
|
||||
"crypto/asn1/t_bitst.c",
|
||||
"crypto/asn1/x_req.c",
|
||||
"crypto/asn1/a_time.c",
|
||||
"crypto/asn1/x_name.c",
|
||||
"crypto/asn1/x_pubkey.c",
|
||||
"crypto/asn1/tasn_typ.c",
|
||||
"crypto/asn1/asn_moid.c",
|
||||
"crypto/asn1/a_utctm.c",
|
||||
"crypto/asn1/asn1_lib.c",
|
||||
"crypto/asn1/x_x509a.c",
|
||||
"crypto/asn1/a_set.c",
|
||||
"crypto/asn1/t_crl.c",
|
||||
"crypto/asn1/p5_pbev2.c",
|
||||
"crypto/asn1/tasn_enc.c",
|
||||
"crypto/asn1/a_mbstr.c",
|
||||
"crypto/asn1/tasn_dec.c",
|
||||
"crypto/asn1/x_x509.c",
|
||||
"crypto/asn1/a_octet.c",
|
||||
"crypto/asn1/x_long.c",
|
||||
"crypto/asn1/a_bytes.c",
|
||||
"crypto/asn1/t_x509a.c",
|
||||
"crypto/asn1/a_enum.c",
|
||||
"crypto/asn1/a_int.c",
|
||||
"crypto/asn1/tasn_prn.c",
|
||||
"crypto/asn1/i2d_pr.c",
|
||||
"crypto/asn1/a_utf8.c",
|
||||
"crypto/asn1/t_spki.c",
|
||||
"crypto/asn1/a_digest.c",
|
||||
"crypto/asn1/a_dup.c",
|
||||
"crypto/asn1/i2d_pu.c",
|
||||
"crypto/asn1/a_verify.c",
|
||||
"crypto/asn1/f_enum.c",
|
||||
"crypto/asn1/a_sign.c",
|
||||
"crypto/asn1/d2i_pr.c",
|
||||
"crypto/asn1/asn1_par.c",
|
||||
"crypto/asn1/x_spki.c",
|
||||
"crypto/asn1/a_d2i_fp.c",
|
||||
"crypto/asn1/f_int.c",
|
||||
"crypto/asn1/x_exten.c",
|
||||
"crypto/asn1/tasn_utl.c",
|
||||
"crypto/asn1/nsseq.c",
|
||||
"crypto/asn1/a_bitstr.c",
|
||||
"crypto/asn1/x_info.c",
|
||||
"crypto/asn1/a_strnid.c",
|
||||
"crypto/asn1/a_object.c",
|
||||
"crypto/asn1/tasn_fre.c",
|
||||
"crypto/asn1/d2i_pu.c",
|
||||
"crypto/asn1/ameth_lib.c",
|
||||
"crypto/asn1/x_attrib.c",
|
||||
"crypto/evp/m_sha.c",
|
||||
"crypto/evp/e_camellia.c",
|
||||
"crypto/evp/e_aes.c",
|
||||
"crypto/evp/bio_b64.c",
|
||||
"crypto/evp/m_sigver.c",
|
||||
"crypto/evp/m_wp.c",
|
||||
"crypto/evp/m_sha1.c",
|
||||
"crypto/evp/p_seal.c",
|
||||
"crypto/evp/c_alld.c",
|
||||
"crypto/evp/p5_crpt.c",
|
||||
"crypto/evp/e_rc4.c",
|
||||
"crypto/evp/m_ecdsa.c",
|
||||
"crypto/evp/bio_enc.c",
|
||||
"crypto/evp/e_des3.c",
|
||||
"crypto/evp/m_null.c",
|
||||
"crypto/evp/bio_ok.c",
|
||||
"crypto/evp/pmeth_gn.c",
|
||||
"crypto/evp/e_rc5.c",
|
||||
"crypto/evp/e_rc2.c",
|
||||
"crypto/evp/p_dec.c",
|
||||
"crypto/evp/p_verify.c",
|
||||
"crypto/evp/e_rc4_hmac_md5.c",
|
||||
"crypto/evp/pmeth_lib.c",
|
||||
"crypto/evp/m_ripemd.c",
|
||||
"crypto/evp/m_md5.c",
|
||||
"crypto/evp/e_bf.c",
|
||||
"crypto/evp/p_enc.c",
|
||||
"crypto/evp/m_dss.c",
|
||||
"crypto/evp/bio_md.c",
|
||||
"crypto/evp/evp_pbe.c",
|
||||
"crypto/evp/e_seed.c",
|
||||
"crypto/evp/e_cast.c",
|
||||
"crypto/evp/p_open.c",
|
||||
"crypto/evp/p5_crpt2.c",
|
||||
"crypto/evp/m_dss1.c",
|
||||
"crypto/evp/names.c",
|
||||
"crypto/evp/evp_acnf.c",
|
||||
"crypto/evp/e_des.c",
|
||||
"crypto/evp/evp_cnf.c",
|
||||
"crypto/evp/evp_lib.c",
|
||||
"crypto/evp/digest.c",
|
||||
"crypto/evp/evp_err.c",
|
||||
"crypto/evp/evp_enc.c",
|
||||
"crypto/evp/e_old.c",
|
||||
"crypto/evp/c_all.c",
|
||||
"crypto/evp/m_md2.c",
|
||||
"crypto/evp/e_xcbc_d.c",
|
||||
"crypto/evp/pmeth_fn.c",
|
||||
"crypto/evp/p_lib.c",
|
||||
"crypto/evp/evp_key.c",
|
||||
"crypto/evp/encode.c",
|
||||
"crypto/evp/e_aes_cbc_hmac_sha1.c",
|
||||
"crypto/evp/e_aes_cbc_hmac_sha256.c",
|
||||
"crypto/evp/m_mdc2.c",
|
||||
"crypto/evp/e_null.c",
|
||||
"crypto/evp/p_sign.c",
|
||||
"crypto/evp/e_idea.c",
|
||||
"crypto/evp/c_allc.c",
|
||||
"crypto/evp/evp_pkey.c",
|
||||
"crypto/evp/m_md4.c",
|
||||
"crypto/ex_data.c",
|
||||
"crypto/pkcs12/p12_p8e.c",
|
||||
"crypto/pkcs12/p12_crt.c",
|
||||
"crypto/pkcs12/p12_utl.c",
|
||||
"crypto/pkcs12/p12_attr.c",
|
||||
"crypto/pkcs12/p12_npas.c",
|
||||
"crypto/pkcs12/p12_decr.c",
|
||||
"crypto/pkcs12/p12_init.c",
|
||||
"crypto/pkcs12/p12_kiss.c",
|
||||
"crypto/pkcs12/p12_add.c",
|
||||
"crypto/pkcs12/p12_p8d.c",
|
||||
"crypto/pkcs12/p12_mutl.c",
|
||||
"crypto/pkcs12/p12_crpt.c",
|
||||
"crypto/pkcs12/pk12err.c",
|
||||
"crypto/pkcs12/p12_asn.c",
|
||||
"crypto/pkcs12/p12_key.c",
|
||||
"crypto/ecdh/ech_key.c",
|
||||
"crypto/ecdh/ech_ossl.c",
|
||||
"crypto/ecdh/ech_lib.c",
|
||||
"crypto/ecdh/ech_err.c",
|
||||
"crypto/ecdh/ech_kdf.c",
|
||||
"crypto/o_str.c",
|
||||
"crypto/conf/conf_api.c",
|
||||
"crypto/conf/conf_err.c",
|
||||
"crypto/conf/conf_def.c",
|
||||
"crypto/conf/conf_lib.c",
|
||||
"crypto/conf/conf_mall.c",
|
||||
"crypto/conf/conf_sap.c",
|
||||
"crypto/conf/conf_mod.c",
|
||||
"crypto/ebcdic.c",
|
||||
"crypto/ecdsa/ecs_lib.c",
|
||||
"crypto/ecdsa/ecs_asn1.c",
|
||||
"crypto/ecdsa/ecs_ossl.c",
|
||||
"crypto/ecdsa/ecs_vrf.c",
|
||||
"crypto/ecdsa/ecs_sign.c",
|
||||
"crypto/ecdsa/ecs_err.c",
|
||||
"crypto/dso/dso_win32.c",
|
||||
"crypto/dso/dso_lib.c",
|
||||
"crypto/dso/dso_dlfcn.c",
|
||||
"crypto/dso/dso_dl.c",
|
||||
"crypto/dso/dso_beos.c",
|
||||
"crypto/dso/dso_null.c",
|
||||
"crypto/dso/dso_vms.c",
|
||||
"crypto/dso/dso_err.c",
|
||||
"crypto/dso/dso_openssl.c",
|
||||
"crypto/cryptlib.c",
|
||||
"crypto/md5/md5_one.c",
|
||||
"crypto/md5/md5_dgst.c",
|
||||
"crypto/pkcs7/pkcs7err.c",
|
||||
"crypto/pkcs7/pk7_smime.c",
|
||||
"crypto/pkcs7/bio_pk7.c",
|
||||
"crypto/pkcs7/pk7_mime.c",
|
||||
"crypto/pkcs7/pk7_lib.c",
|
||||
"crypto/pkcs7/pk7_asn1.c",
|
||||
"crypto/pkcs7/pk7_doit.c",
|
||||
"crypto/pkcs7/pk7_attr.c",
|
||||
"crypto/md4/md4_one.c",
|
||||
"crypto/md4/md4_dgst.c",
|
||||
"crypto/o_dir.c",
|
||||
"crypto/buffer/buf_err.c",
|
||||
"crypto/buffer/buf_str.c",
|
||||
"crypto/buffer/buffer.c",
|
||||
"crypto/cms/cms_lib.c",
|
||||
"crypto/cms/cms_io.c",
|
||||
"crypto/cms/cms_err.c",
|
||||
"crypto/cms/cms_dd.c",
|
||||
"crypto/cms/cms_smime.c",
|
||||
"crypto/cms/cms_att.c",
|
||||
"crypto/cms/cms_pwri.c",
|
||||
"crypto/cms/cms_cd.c",
|
||||
"crypto/cms/cms_sd.c",
|
||||
"crypto/cms/cms_asn1.c",
|
||||
"crypto/cms/cms_env.c",
|
||||
"crypto/cms/cms_enc.c",
|
||||
"crypto/cms/cms_ess.c",
|
||||
"crypto/cms/cms_kari.c",
|
||||
"crypto/mem_dbg.c",
|
||||
"crypto/uid.c",
|
||||
"crypto/stack/stack.c",
|
||||
"crypto/ec/ec_ameth.c",
|
||||
"crypto/ec/ec_err.c",
|
||||
"crypto/ec/ec_lib.c",
|
||||
"crypto/ec/ec_curve.c",
|
||||
"crypto/ec/ec_oct.c",
|
||||
"crypto/ec/ec_asn1.c",
|
||||
"crypto/ec/ecp_oct.c",
|
||||
"crypto/ec/ec_print.c",
|
||||
"crypto/ec/ec2_smpl.c",
|
||||
"crypto/ec/ecp_nistp224.c",
|
||||
"crypto/ec/ec2_oct.c",
|
||||
"crypto/ec/eck_prn.c",
|
||||
"crypto/ec/ec_key.c",
|
||||
"crypto/ec/ecp_nist.c",
|
||||
"crypto/ec/ec_check.c",
|
||||
"crypto/ec/ecp_smpl.c",
|
||||
"crypto/ec/ec2_mult.c",
|
||||
"crypto/ec/ecp_mont.c",
|
||||
"crypto/ec/ecp_nistp521.c",
|
||||
"crypto/ec/ec_mult.c",
|
||||
"crypto/ec/ecp_nistputil.c",
|
||||
"crypto/ec/ec_pmeth.c",
|
||||
"crypto/ec/ec_cvt.c",
|
||||
"crypto/ec/ecp_nistp256.c",
|
||||
"crypto/krb5/krb5_asn.c",
|
||||
"crypto/hmac/hmac.c",
|
||||
"crypto/hmac/hm_ameth.c",
|
||||
"crypto/hmac/hm_pmeth.c",
|
||||
"crypto/comp/c_rle.c",
|
||||
"crypto/comp/c_zlib.c",
|
||||
"crypto/comp/comp_lib.c",
|
||||
"crypto/comp/comp_err.c",
|
||||
"crypto/des/fcrypt.c",
|
||||
"crypto/des/str2key.c",
|
||||
"crypto/des/cbc_cksm.c",
|
||||
"crypto/des/des_enc.c",
|
||||
"crypto/des/ofb_enc.c",
|
||||
"crypto/des/read2pwd.c",
|
||||
"crypto/des/ecb3_enc.c",
|
||||
"crypto/des/rand_key.c",
|
||||
"crypto/des/cfb64ede.c",
|
||||
"crypto/des/rpc_enc.c",
|
||||
"crypto/des/ofb64ede.c",
|
||||
"crypto/des/qud_cksm.c",
|
||||
"crypto/des/enc_writ.c",
|
||||
"crypto/des/set_key.c",
|
||||
"crypto/des/xcbc_enc.c",
|
||||
"crypto/des/fcrypt_b.c",
|
||||
"crypto/des/ede_cbcm_enc.c",
|
||||
"crypto/des/des_old2.c",
|
||||
"crypto/des/cfb_enc.c",
|
||||
"crypto/des/ecb_enc.c",
|
||||
"crypto/des/enc_read.c",
|
||||
"crypto/des/des_old.c",
|
||||
"crypto/des/ofb64enc.c",
|
||||
"crypto/des/pcbc_enc.c",
|
||||
"crypto/des/cbc_enc.c",
|
||||
"crypto/des/cfb64enc.c",
|
||||
"crypto/lhash/lh_stats.c",
|
||||
"crypto/lhash/lhash.c",
|
||||
"crypto/x509v3/v3_genn.c",
|
||||
"crypto/x509v3/pcy_cache.c",
|
||||
"crypto/x509v3/v3_sxnet.c",
|
||||
"crypto/x509v3/v3_scts.c",
|
||||
"crypto/x509v3/v3err.c",
|
||||
"crypto/x509v3/v3_conf.c",
|
||||
"crypto/x509v3/v3_utl.c",
|
||||
"crypto/x509v3/v3_akeya.c",
|
||||
"crypto/x509v3/v3_lib.c",
|
||||
"crypto/x509v3/pcy_lib.c",
|
||||
"crypto/x509v3/v3_cpols.c",
|
||||
"crypto/x509v3/v3_ia5.c",
|
||||
"crypto/x509v3/v3_bitst.c",
|
||||
"crypto/x509v3/v3_skey.c",
|
||||
"crypto/x509v3/v3_info.c",
|
||||
"crypto/x509v3/v3_asid.c",
|
||||
"crypto/x509v3/pcy_tree.c",
|
||||
"crypto/x509v3/v3_pcons.c",
|
||||
"crypto/x509v3/v3_bcons.c",
|
||||
"crypto/x509v3/v3_pku.c",
|
||||
"crypto/x509v3/v3_ocsp.c",
|
||||
"crypto/x509v3/pcy_map.c",
|
||||
"crypto/x509v3/v3_ncons.c",
|
||||
"crypto/x509v3/v3_purp.c",
|
||||
"crypto/x509v3/v3_enum.c",
|
||||
"crypto/x509v3/v3_pmaps.c",
|
||||
"crypto/x509v3/pcy_node.c",
|
||||
"crypto/x509v3/v3_pcia.c",
|
||||
"crypto/x509v3/v3_crld.c",
|
||||
"crypto/x509v3/v3_pci.c",
|
||||
"crypto/x509v3/v3_akey.c",
|
||||
"crypto/x509v3/v3_addr.c",
|
||||
"crypto/x509v3/v3_int.c",
|
||||
"crypto/x509v3/v3_alt.c",
|
||||
"crypto/x509v3/v3_extku.c",
|
||||
"crypto/x509v3/v3_prn.c",
|
||||
"crypto/x509v3/pcy_data.c",
|
||||
"crypto/aes/aes_ofb.c",
|
||||
"crypto/aes/aes_ctr.c",
|
||||
"crypto/aes/aes_ecb.c",
|
||||
"crypto/aes/aes_cfb.c",
|
||||
"crypto/aes/aes_wrap.c",
|
||||
"crypto/aes/aes_ige.c",
|
||||
"crypto/aes/aes_misc.c",
|
||||
"crypto/pqueue/pqueue.c",
|
||||
"crypto/sha/sha_one.c",
|
||||
"crypto/sha/sha_dgst.c",
|
||||
"crypto/sha/sha512.c",
|
||||
"crypto/sha/sha1_one.c",
|
||||
"crypto/sha/sha1dgst.c",
|
||||
"crypto/sha/sha256.c",
|
||||
"crypto/whrlpool/wp_dgst.c",
|
||||
"crypto/objects/obj_xref.c",
|
||||
"crypto/objects/o_names.c",
|
||||
"crypto/objects/obj_err.c",
|
||||
"crypto/objects/obj_dat.c",
|
||||
"crypto/objects/obj_lib.c",
|
||||
"crypto/mem.c",
|
||||
"crypto/fips_ers.c",
|
||||
"crypto/o_fips.c",
|
||||
"crypto/engine/eng_rdrand.c",
|
||||
"crypto/engine/eng_err.c",
|
||||
"crypto/engine/tb_ecdsa.c",
|
||||
"crypto/engine/tb_rsa.c",
|
||||
"crypto/engine/tb_cipher.c",
|
||||
"crypto/engine/tb_dsa.c",
|
||||
"crypto/engine/eng_lib.c",
|
||||
"crypto/engine/tb_asnmth.c",
|
||||
"crypto/engine/tb_ecdh.c",
|
||||
"crypto/engine/tb_dh.c",
|
||||
"crypto/engine/tb_store.c",
|
||||
"crypto/engine/eng_init.c",
|
||||
"crypto/engine/eng_cnf.c",
|
||||
"crypto/engine/eng_all.c",
|
||||
"crypto/engine/tb_digest.c",
|
||||
"crypto/engine/tb_pkmeth.c",
|
||||
"crypto/engine/eng_table.c",
|
||||
"crypto/engine/eng_ctrl.c",
|
||||
"crypto/engine/eng_list.c",
|
||||
"crypto/engine/eng_cryptodev.c",
|
||||
"crypto/engine/eng_pkey.c",
|
||||
"crypto/engine/tb_rand.c",
|
||||
"crypto/engine/eng_openssl.c",
|
||||
"crypto/engine/eng_fat.c",
|
||||
"crypto/engine/eng_dyn.c",
|
||||
"crypto/ts/ts_rsp_verify.c",
|
||||
"crypto/ts/ts_req_print.c",
|
||||
"crypto/ts/ts_verify_ctx.c",
|
||||
"crypto/ts/ts_req_utils.c",
|
||||
"crypto/ts/ts_err.c",
|
||||
"crypto/ts/ts_rsp_print.c",
|
||||
"crypto/ts/ts_rsp_utils.c",
|
||||
"crypto/ts/ts_lib.c",
|
||||
"crypto/ts/ts_conf.c",
|
||||
"crypto/ts/ts_asn1.c",
|
||||
"crypto/ts/ts_rsp_sign.c",
|
||||
"crypto/ocsp/ocsp_ext.c",
|
||||
"crypto/ocsp/ocsp_cl.c",
|
||||
"crypto/ocsp/ocsp_ht.c",
|
||||
"crypto/ocsp/ocsp_lib.c",
|
||||
"crypto/ocsp/ocsp_srv.c",
|
||||
"crypto/ocsp/ocsp_vfy.c",
|
||||
"crypto/ocsp/ocsp_err.c",
|
||||
"crypto/ocsp/ocsp_prn.c",
|
||||
"crypto/ocsp/ocsp_asn.c",
|
||||
"crypto/bf/bf_cfb64.c",
|
||||
"crypto/bf/bf_ecb.c",
|
||||
"crypto/bf/bf_enc.c",
|
||||
"crypto/bf/bf_skey.c",
|
||||
"crypto/bf/bf_ofb64.c",
|
||||
"crypto/idea/i_skey.c",
|
||||
"crypto/idea/i_ofb64.c",
|
||||
"crypto/idea/i_cbc.c",
|
||||
"crypto/idea/i_ecb.c",
|
||||
"crypto/idea/i_cfb64.c",
|
||||
"crypto/cmac/cm_ameth.c",
|
||||
"crypto/cmac/cmac.c",
|
||||
"crypto/cmac/cm_pmeth.c",
|
||||
"crypto/dh/dh_lib.c",
|
||||
"crypto/dh/dh_key.c",
|
||||
"crypto/dh/dh_asn1.c",
|
||||
"crypto/dh/dh_depr.c",
|
||||
"crypto/dh/dh_pmeth.c",
|
||||
"crypto/dh/dh_prn.c",
|
||||
"crypto/dh/dh_gen.c",
|
||||
"crypto/dh/dh_ameth.c",
|
||||
"crypto/dh/dh_check.c",
|
||||
"crypto/dh/dh_err.c",
|
||||
"crypto/dh/dh_kdf.c",
|
||||
"crypto/dh/dh_rfc5114.c",
|
||||
"crypto/modes/ccm128.c",
|
||||
"crypto/modes/ofb128.c",
|
||||
"crypto/modes/cts128.c",
|
||||
"crypto/modes/ctr128.c",
|
||||
"crypto/modes/gcm128.c",
|
||||
"crypto/modes/cbc128.c",
|
||||
"crypto/modes/cfb128.c",
|
||||
"crypto/modes/xts128.c",
|
||||
"crypto/modes/wrap128.c",
|
||||
"crypto/camellia/cmll_cfb.c",
|
||||
"crypto/camellia/cmll_ecb.c",
|
||||
"crypto/camellia/cmll_utl.c",
|
||||
"crypto/camellia/cmll_misc.c",
|
||||
"crypto/camellia/cmll_ofb.c",
|
||||
"crypto/camellia/cmll_ctr.c",
|
||||
"crypto/seed/seed_ecb.c",
|
||||
"crypto/seed/seed_cbc.c",
|
||||
"crypto/seed/seed.c",
|
||||
"crypto/seed/seed_ofb.c",
|
||||
"crypto/seed/seed_cfb.c",
|
||||
"crypto/txt_db/txt_db.c",
|
||||
"crypto/cpt_err.c",
|
||||
"crypto/pem/pem_pk8.c",
|
||||
"crypto/pem/pem_lib.c",
|
||||
"crypto/pem/pem_sign.c",
|
||||
"crypto/pem/pem_all.c",
|
||||
"crypto/pem/pem_info.c",
|
||||
"crypto/pem/pem_pkey.c",
|
||||
"crypto/pem/pem_seal.c",
|
||||
"crypto/pem/pem_err.c",
|
||||
"crypto/pem/pem_xaux.c",
|
||||
"crypto/pem/pvkfmt.c",
|
||||
"crypto/pem/pem_x509.c",
|
||||
"crypto/pem/pem_oth.c",
|
||||
"crypto/rand/rand_lib.c",
|
||||
"crypto/rand/randfile.c",
|
||||
"crypto/rand/rand_os2.c",
|
||||
"crypto/rand/rand_unix.c",
|
||||
"crypto/rand/rand_nw.c",
|
||||
"crypto/rand/md_rand.c",
|
||||
"crypto/rand/rand_err.c",
|
||||
"crypto/rand/rand_win.c",
|
||||
"crypto/rand/rand_egd.c",
|
||||
"crypto/cversion.c",
|
||||
"crypto/cast/c_ecb.c",
|
||||
"crypto/cast/c_skey.c",
|
||||
"crypto/cast/c_ofb64.c",
|
||||
"crypto/cast/c_enc.c",
|
||||
"crypto/cast/c_cfb64.c",
|
||||
"crypto/o_time.c",
|
||||
"crypto/mdc2/mdc2dgst.c",
|
||||
"crypto/mdc2/mdc2_one.c",
|
||||
"crypto/rc4/rc4_utl.c",
|
||||
"crypto/ui/ui_compat.c",
|
||||
"crypto/ui/ui_util.c",
|
||||
"crypto/ui/ui_lib.c",
|
||||
"crypto/ui/ui_err.c",
|
||||
"crypto/ui/ui_openssl.c",
|
||||
"crypto/bio/bf_buff.c",
|
||||
"crypto/bio/bss_null.c",
|
||||
"crypto/bio/bss_acpt.c",
|
||||
"crypto/bio/bss_conn.c",
|
||||
"crypto/bio/bss_fd.c",
|
||||
"crypto/bio/bf_null.c",
|
||||
"crypto/bio/bio_err.c",
|
||||
"crypto/bio/bss_sock.c",
|
||||
"crypto/bio/bss_mem.c",
|
||||
"crypto/bio/b_dump.c",
|
||||
"crypto/bio/b_print.c",
|
||||
"crypto/bio/b_sock.c",
|
||||
"crypto/bio/bss_dgram.c",
|
||||
"crypto/bio/bf_nbio.c",
|
||||
"crypto/bio/bio_lib.c",
|
||||
"crypto/bio/bss_file.c",
|
||||
"crypto/bio/bss_bio.c",
|
||||
"crypto/bio/bss_log.c",
|
||||
"crypto/bio/bio_cb.c",
|
||||
"crypto/o_init.c",
|
||||
"crypto/rc2/rc2_skey.c",
|
||||
"crypto/rc2/rc2_cbc.c",
|
||||
"crypto/rc2/rc2cfb64.c",
|
||||
"crypto/rc2/rc2_ecb.c",
|
||||
"crypto/rc2/rc2ofb64.c",
|
||||
"crypto/bn/bn_x931p.c",
|
||||
"crypto/bn/bn_blind.c",
|
||||
"crypto/bn/bn_gf2m.c",
|
||||
"crypto/bn/bn_const.c",
|
||||
"crypto/bn/bn_sqr.c",
|
||||
"crypto/bn/bn_nist.c",
|
||||
"crypto/bn/bn_rand.c",
|
||||
"crypto/bn/bn_err.c",
|
||||
"crypto/bn/bn_div.c",
|
||||
"crypto/bn/bn_kron.c",
|
||||
"crypto/bn/bn_ctx.c",
|
||||
"crypto/bn/bn_shift.c",
|
||||
"crypto/bn/bn_mod.c",
|
||||
"crypto/bn/bn_exp2.c",
|
||||
"crypto/bn/bn_word.c",
|
||||
"crypto/bn/bn_add.c",
|
||||
"crypto/bn/bn_exp.c",
|
||||
"crypto/bn/bn_mont.c",
|
||||
"crypto/bn/bn_print.c",
|
||||
"crypto/bn/bn_mul.c",
|
||||
"crypto/bn/bn_prime.c",
|
||||
"crypto/bn/bn_depr.c",
|
||||
"crypto/bn/bn_gcd.c",
|
||||
"crypto/bn/bn_mpi.c",
|
||||
"crypto/bn/bn_sqrt.c",
|
||||
"crypto/bn/bn_recp.c",
|
||||
"crypto/bn/bn_lib.c",
|
||||
"crypto/ripemd/rmd_dgst.c",
|
||||
"crypto/ripemd/rmd_one.c",
|
||||
"crypto/rsa/rsa_x931.c",
|
||||
"crypto/rsa/rsa_depr.c",
|
||||
"crypto/rsa/rsa_saos.c",
|
||||
"crypto/rsa/rsa_crpt.c",
|
||||
"crypto/rsa/rsa_pss.c",
|
||||
"crypto/rsa/rsa_oaep.c",
|
||||
"crypto/rsa/rsa_null.c",
|
||||
"crypto/rsa/rsa_gen.c",
|
||||
"crypto/rsa/rsa_prn.c",
|
||||
"crypto/rsa/rsa_pmeth.c",
|
||||
"crypto/rsa/rsa_asn1.c",
|
||||
"crypto/rsa/rsa_ssl.c",
|
||||
"crypto/rsa/rsa_ameth.c",
|
||||
"crypto/rsa/rsa_pk1.c",
|
||||
"crypto/rsa/rsa_err.c",
|
||||
"crypto/rsa/rsa_lib.c",
|
||||
"crypto/rsa/rsa_none.c",
|
||||
"crypto/rsa/rsa_chk.c",
|
||||
"crypto/rsa/rsa_eay.c",
|
||||
"crypto/rsa/rsa_sign.c",
|
||||
"crypto/srp/srp_lib.c",
|
||||
"crypto/srp/srp_vfy.c",
|
||||
"crypto/err/err.c",
|
||||
"crypto/err/err_prn.c",
|
||||
"crypto/err/err_all.c",
|
||||
"crypto/mem_clr.c",
|
||||
"crypto/rc4/rc4_skey.c",
|
||||
"crypto/rc4/rc4_enc.c",
|
||||
"crypto/camellia/camellia.c",
|
||||
"crypto/camellia/cmll_cbc.c",
|
||||
#"crypto/aes/aes_x86core.c",
|
||||
"crypto/aes/aes_core.c",
|
||||
"crypto/aes/aes_cbc.c",
|
||||
"crypto/whrlpool/wp_block.c",
|
||||
"crypto/bn/bn_asm.c",
|
||||
]
|
||||
|
||||
#env.drivers_sources+=openssl_sources
|
||||
|
||||
env.Append(CPPPATH=["#drivers/builtin_openssl2"])
|
||||
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto"])
|
||||
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/openssl"])
|
||||
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/evp"])
|
||||
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/asn1"])
|
||||
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/modes"])
|
||||
#env_ssl.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/store"])
|
||||
env_drivers.Append(CPPFLAGS=["-DOPENSSL_NO_ASM","-DOPENSSL_THREADS","-DL_ENDIAN"])
|
||||
|
||||
if "platform" in env and env["platform"] == "winrt":
|
||||
openssl_sources += ['winrt.cpp']
|
||||
|
||||
# Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
|
||||
import os
|
||||
if not (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None): # not Windows and not MSVC
|
||||
env_drivers.Append(CFLAGS=["-Wno-error=implicit-function-declaration"])
|
||||
|
||||
env_drivers.add_source_files(env.drivers_sources,openssl_sources)
|
@ -1,22 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
zlib_sources = [
|
||||
|
||||
"builtin_zlib/zlib/adler32.c",
|
||||
"builtin_zlib/zlib/compress.c",
|
||||
"builtin_zlib/zlib/crc32.c",
|
||||
"builtin_zlib/zlib/deflate.c",
|
||||
"builtin_zlib/zlib/infback.c",
|
||||
"builtin_zlib/zlib/inffast.c",
|
||||
"builtin_zlib/zlib/inflate.c",
|
||||
"builtin_zlib/zlib/inftrees.c",
|
||||
"builtin_zlib/zlib/trees.c",
|
||||
"builtin_zlib/zlib/uncompr.c",
|
||||
"builtin_zlib/zlib/zutil.c",
|
||||
]
|
||||
|
||||
|
||||
env.drivers_sources+=zlib_sources
|
||||
|
||||
#env.add_source_files("core", png_sources)
|
||||
Export('env')
|
@ -1,5 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
|
||||
Export('env')
|
@ -1,4 +1,7 @@
|
||||
Import('env')
|
||||
Export('env');
|
||||
#!/usr/bin/env python
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
@ -1,10 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
|
||||
dds_sources = [
|
||||
"dds/texture_loader_dds.cpp"
|
||||
]
|
||||
|
||||
env.drivers_sources+=dds_sources
|
||||
|
||||
#env.add_source_files(env.drivers_sources, dds_sources)
|
@ -1,15 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
|
||||
etc_sources = [
|
||||
"etc1/image_etc.cpp",
|
||||
"etc1/rg_etc1.cpp",
|
||||
"etc1/texture_loader_pkm.cpp"
|
||||
]
|
||||
|
||||
if (env["etc1"] != "no"):
|
||||
env.drivers_sources+=etc_sources
|
||||
|
||||
#env.add_source_files(env.drivers_sources, etc_sources)
|
||||
|
||||
Export('env')
|
@ -1,73 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
ft_sources=[\
|
||||
"src/autofit/autofit.c",\
|
||||
"src/base/ftapi.c",\
|
||||
"src/base/ftbase.c",\
|
||||
"src/base/ftbbox.c",\
|
||||
"src/base/ftbdf.c",\
|
||||
"src/base/ftbitmap.c",\
|
||||
"src/base/ftcid.c",\
|
||||
"src/base/ftdebug.c",\
|
||||
"src/base/ftfntfmt.c",\
|
||||
"src/base/ftfstype.c",\
|
||||
"src/base/ftgasp.c",\
|
||||
"src/base/ftglyph.c",\
|
||||
"src/base/ftgxval.c",\
|
||||
"src/base/ftinit.c",\
|
||||
"src/base/ftlcdfil.c",\
|
||||
"src/base/ftmm.c",\
|
||||
"src/base/ftotval.c",\
|
||||
"src/base/ftpatent.c",\
|
||||
"src/base/ftpfr.c",\
|
||||
"src/base/ftpic.c",\
|
||||
"src/base/ftstroke.c",\
|
||||
"src/base/ftsynth.c",\
|
||||
"src/base/ftsystem.c",\
|
||||
"src/base/fttype1.c",\
|
||||
"src/base/ftwinfnt.c",\
|
||||
"src/bdf/bdf.c",\
|
||||
"src/cache/ftcache.c",\
|
||||
"src/cff/cff.c",\
|
||||
"src/cid/type1cid.c",\
|
||||
"src/gxvalid/gxvalid.c",\
|
||||
"src/otvalid/otvalid.c",\
|
||||
"src/pcf/pcf.c",\
|
||||
"src/pfr/pfr.c",\
|
||||
"src/psaux/psaux.c",\
|
||||
"src/pshinter/pshinter.c",\
|
||||
"src/psnames/psnames.c",\
|
||||
"src/raster/raster.c",\
|
||||
"src/sfnt/sfnt.c",\
|
||||
"src/smooth/smooth.c",\
|
||||
"src/truetype/truetype.c",\
|
||||
"src/type1/type1.c",\
|
||||
"src/type42/type42.c",\
|
||||
"src/winfonts/winfnt.c",\
|
||||
]
|
||||
|
||||
|
||||
if (env["freetype"]=="builtin"):
|
||||
|
||||
# Include header for WinRT to fix build issues
|
||||
if "platform" in env and env["platform"] == "winrt":
|
||||
env.Append(CCFLAGS=['/FI', '"drivers/freetype/winrtdef.h"'])
|
||||
|
||||
# fix for Windows' shell miserably failing on long lines, split in two libraries
|
||||
half1=[]
|
||||
half2=[]
|
||||
for x in ft_sources:
|
||||
if (x.find("src/base")==0 or x.find("src/sfnt")==0):
|
||||
half2.append(x)
|
||||
else:
|
||||
half1.append(x)
|
||||
|
||||
lib = env.Library("freetype_builtin1",half2)
|
||||
env.Append(LIBS=[lib])
|
||||
lib = env.Library("freetype_builtin2",half1)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
env.Append(CPPPATH=["#drivers/freetype/include"])
|
||||
|
||||
|
||||
Export('env')
|
@ -1,19 +0,0 @@
|
||||
# FreeType 2 src Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) ;
|
||||
|
||||
for xx in $(FT2_COMPONENTS)
|
||||
{
|
||||
SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ;
|
||||
}
|
||||
|
||||
# end of src Jamfile
|
@ -1,53 +0,0 @@
|
||||
# FreeType 2 src/autofit Jamfile
|
||||
#
|
||||
# Copyright 2003-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP src autofit ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
# define FT2_AUTOFIT2 to enable experimental latin hinter replacement
|
||||
if $(FT2_AUTOFIT2)
|
||||
{
|
||||
CCFLAGS += FT_OPTION_AUTOFIT2 ;
|
||||
}
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = afangles
|
||||
afblue
|
||||
afcjk
|
||||
afdummy
|
||||
afglobal
|
||||
afhints
|
||||
afindic
|
||||
aflatin
|
||||
afloader
|
||||
afmodule
|
||||
afpic
|
||||
afranges
|
||||
afshaper
|
||||
afwarp
|
||||
;
|
||||
|
||||
if $(FT2_AUTOFIT2)
|
||||
{
|
||||
_sources += aflatin2 ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = autofit ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/autofit Jamfile
|
@ -1,88 +0,0 @@
|
||||
# FreeType 2 src/base Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) base ;
|
||||
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = basepic
|
||||
ftadvanc
|
||||
ftcalc
|
||||
ftdbgmem
|
||||
ftgloadr
|
||||
fthash
|
||||
ftobjs
|
||||
ftoutln
|
||||
ftpic
|
||||
ftrfork
|
||||
ftsnames
|
||||
ftstream
|
||||
fttrigon
|
||||
ftutil
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = ftbase ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# Add the optional/replaceable files.
|
||||
#
|
||||
{
|
||||
local _sources = ftapi
|
||||
ftbbox
|
||||
ftbdf
|
||||
ftbitmap
|
||||
ftcid
|
||||
ftdebug
|
||||
ftfntfmt
|
||||
ftfstype
|
||||
ftgasp
|
||||
ftglyph
|
||||
ftgxval
|
||||
ftinit
|
||||
ftlcdfil
|
||||
ftmm
|
||||
ftotval
|
||||
ftpatent
|
||||
ftpfr
|
||||
ftstroke
|
||||
ftsynth
|
||||
ftsystem
|
||||
fttype1
|
||||
ftwinfnt
|
||||
;
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# Add Macintosh-specific file to the library when necessary.
|
||||
#
|
||||
if $(MAC)
|
||||
{
|
||||
Library $(FT2_LIB) : ftmac.c ;
|
||||
}
|
||||
else if $(OS) = MACOSX
|
||||
{
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
Library $(FT2_LIB) : ftmac.c ;
|
||||
}
|
||||
}
|
||||
|
||||
# end of src/base Jamfile
|
@ -1,31 +0,0 @@
|
||||
# FreeType 2 src/bdf Jamfile
|
||||
#
|
||||
# Copyright 2002-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) bdf ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = bdfdrivr
|
||||
bdflib
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = bdf ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/bdf Jamfile
|
37
drivers/freetype/src/cache/Jamfile
vendored
37
drivers/freetype/src/cache/Jamfile
vendored
@ -1,37 +0,0 @@
|
||||
# FreeType 2 src/cache Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) cache ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ftcbasic
|
||||
ftccache
|
||||
ftcglyph
|
||||
ftcimage
|
||||
ftcmanag
|
||||
ftccmap
|
||||
ftcmru
|
||||
ftcsbits
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = ftcache ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/cache Jamfile
|
@ -1,45 +0,0 @@
|
||||
# FreeType 2 src/cff Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) cff ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = cffcmap
|
||||
cffdrivr
|
||||
cffgload
|
||||
cffload
|
||||
cffobjs
|
||||
cffparse
|
||||
cffpic
|
||||
cf2arrst
|
||||
cf2blues
|
||||
cf2error
|
||||
cf2font
|
||||
cf2ft
|
||||
cf2hints
|
||||
cf2intrp
|
||||
cf2read
|
||||
cf2stack
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = cff ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/cff Jamfile
|
@ -1,34 +0,0 @@
|
||||
# FreeType 2 src/cid Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) cid ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = cidgload
|
||||
cidload
|
||||
cidobjs
|
||||
cidparse
|
||||
cidriver
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = type1cid ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/cid Jamfile
|
@ -1,52 +0,0 @@
|
||||
# FreeType 2 src/gxvalid Jamfile
|
||||
#
|
||||
# Copyright 2005-2016 by
|
||||
# suzuki toshiya, Masatake YAMATO and Red Hat K.K.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) gxvalid ;
|
||||
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = gxvbsln
|
||||
gxvcommn
|
||||
gxvfeat
|
||||
gxvjust
|
||||
gxvkern
|
||||
gxvlcar
|
||||
gxvmod
|
||||
gxvmort
|
||||
gxvmort0
|
||||
gxvmort1
|
||||
gxvmort2
|
||||
gxvmort4
|
||||
gxvmort5
|
||||
gxvmorx
|
||||
gxvmorx0
|
||||
gxvmorx1
|
||||
gxvmorx2
|
||||
gxvmorx4
|
||||
gxvmorx5
|
||||
gxvopbd
|
||||
gxvprop
|
||||
gxvtrak
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = gxvalid ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/gxvalid Jamfile
|
@ -1,37 +0,0 @@
|
||||
# FreeType 2 src/otvalid Jamfile
|
||||
#
|
||||
# Copyright 2004-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) otvalid ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = otvbase
|
||||
otvcommn
|
||||
otvgdef
|
||||
otvgpos
|
||||
otvgsub
|
||||
otvjstf
|
||||
otvmath
|
||||
otvmod
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = otvalid ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/otvalid Jamfile
|
@ -1,32 +0,0 @@
|
||||
# FreeType 2 src/pcf Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) pcf ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = pcfdrivr
|
||||
pcfread
|
||||
pcfutil
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = pcf ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/pcf Jamfile
|
@ -1,35 +0,0 @@
|
||||
# FreeType 2 src/pfr Jamfile
|
||||
#
|
||||
# Copyright 2002-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) pfr ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = pfrcmap
|
||||
pfrdrivr
|
||||
pfrgload
|
||||
pfrload
|
||||
pfrobjs
|
||||
pfrsbit
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = pfr ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/pfr Jamfile
|
@ -1,35 +0,0 @@
|
||||
# FreeType 2 src/psaux Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) psaux ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = afmparse
|
||||
psauxmod
|
||||
psconv
|
||||
psobjs
|
||||
t1cmap
|
||||
t1decode
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = psaux ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/psaux Jamfile
|
@ -1,34 +0,0 @@
|
||||
# FreeType 2 src/pshinter Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = pshalgo
|
||||
pshglob
|
||||
pshmod
|
||||
pshpic
|
||||
pshrec
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = pshinter ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/pshinter Jamfile
|
@ -1,31 +0,0 @@
|
||||
# FreeType 2 src/psnames Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) psnames ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = psmodule
|
||||
pspic
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = psnames ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/psnames Jamfile
|
@ -1,32 +0,0 @@
|
||||
# FreeType 2 src/raster Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) raster ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ftraster
|
||||
ftrend1
|
||||
rastpic
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = raster ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/raster Jamfile
|
@ -1,40 +0,0 @@
|
||||
# FreeType 2 src/sfnt Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = pngshim
|
||||
sfdriver
|
||||
sfntpic
|
||||
sfobjs
|
||||
ttbdf
|
||||
ttcmap
|
||||
ttkern
|
||||
ttload
|
||||
ttmtx
|
||||
ttpost
|
||||
ttsbit
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = sfnt ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/sfnt Jamfile
|
@ -1,32 +0,0 @@
|
||||
# FreeType 2 src/smooth Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) smooth ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ftgrays
|
||||
ftsmooth
|
||||
ftspic
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = smooth ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/smooth Jamfile
|
@ -1,37 +0,0 @@
|
||||
# FreeType 2 src/truetype Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) truetype ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ttdriver
|
||||
ttgload
|
||||
ttgxvar
|
||||
ttinterp
|
||||
ttobjs
|
||||
ttpic
|
||||
ttpload
|
||||
ttsubpix
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = truetype ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/truetype Jamfile
|
@ -1,35 +0,0 @@
|
||||
# FreeType 2 src/type1 Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) type1 ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = t1afm
|
||||
t1driver
|
||||
t1gload
|
||||
t1load
|
||||
t1objs
|
||||
t1parse
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = type1 ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/type1 Jamfile
|
@ -1,32 +0,0 @@
|
||||
# FreeType 2 src/type42 Jamfile
|
||||
#
|
||||
# Copyright 2002-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) type42 ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = t42drivr
|
||||
t42objs
|
||||
t42parse
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = type42 ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/type42 Jamfile
|
@ -1,16 +0,0 @@
|
||||
# FreeType 2 src/winfonts Jamfile
|
||||
#
|
||||
# Copyright 2001-2016 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) winfonts ;
|
||||
|
||||
Library $(FT2_LIB) : winfnt.c ;
|
||||
|
||||
# end of src/winfonts Jamfile
|
@ -1,11 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
if (env["platform"] in ["haiku","osx","windows","x11"]):
|
||||
# Thirdparty source files
|
||||
if (env["glew"] != "system"): # builtin
|
||||
thirdparty_dir = "#thirdparty/glew/"
|
||||
thirdparty_sources = [
|
||||
"glew.c",
|
||||
]
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
|
||||
env.add_source_files(env.drivers_sources, thirdparty_sources)
|
||||
env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
|
||||
env.Append(CPPPATH = [thirdparty_dir])
|
||||
|
||||
if (env.get('glew') == 'yes'):
|
||||
env.add_source_files(env.drivers_sources,"glew.c")
|
||||
env.Append(CPPFLAGS = ['-DGLEW_ENABLED'])
|
||||
env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
|
||||
env.Append(CPPPATH = ['.'])
|
||||
|
||||
# Godot source files
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
@ -1,5 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
SConscript("shaders/SCsub")
|
||||
|
||||
Export('env')
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "servers/visual/particle_system_sw.h"
|
||||
#include "gl_context/context_gl.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef GLEW_ENABLED
|
||||
#define _GL_HALF_FLOAT_OES 0x140B
|
||||
@ -1998,7 +1999,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
||||
if (use_VBO) {
|
||||
|
||||
elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort);
|
||||
elem_count=VS::ARRAY_WEIGHTS_SIZE;
|
||||
valid_local=false;
|
||||
bind=true;
|
||||
normalize=true;
|
||||
@ -2007,7 +2007,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
||||
|
||||
} else {
|
||||
elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLfloat);
|
||||
elem_count=VS::ARRAY_WEIGHTS_SIZE;
|
||||
valid_local=false;
|
||||
bind=false;
|
||||
datatype=GL_FLOAT;
|
||||
@ -2019,7 +2018,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
||||
|
||||
if (use_VBO) {
|
||||
elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLubyte);
|
||||
elem_count=VS::ARRAY_WEIGHTS_SIZE;
|
||||
valid_local=false;
|
||||
bind=true;
|
||||
datatype=GL_UNSIGNED_BYTE;
|
||||
@ -2027,7 +2025,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
||||
} else {
|
||||
|
||||
elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort);
|
||||
elem_count=VS::ARRAY_WEIGHTS_SIZE;
|
||||
valid_local=false;
|
||||
bind=false;
|
||||
datatype=GL_UNSIGNED_SHORT;
|
||||
@ -5459,9 +5456,16 @@ void RasterizerGLES2::_setup_light(uint16_t p_light) {
|
||||
}
|
||||
|
||||
|
||||
light_data[VL_LIGHT_ATTENUATION][0]=l->vars[VS::LIGHT_PARAM_ENERGY];
|
||||
light_data[VL_LIGHT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_RADIUS];
|
||||
light_data[VL_LIGHT_ATTENUATION][2]=l->vars[VS::LIGHT_PARAM_ATTENUATION];
|
||||
light_data[VL_LIGHT_ATTENUATION][0] = l->vars[VS::LIGHT_PARAM_ENERGY];
|
||||
|
||||
if (l->type == VS::LIGHT_DIRECTIONAL) {
|
||||
light_data[VL_LIGHT_ATTENUATION][1] = l->directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE];
|
||||
}
|
||||
else{
|
||||
light_data[VL_LIGHT_ATTENUATION][1] = l->vars[VS::LIGHT_PARAM_RADIUS];
|
||||
}
|
||||
|
||||
light_data[VL_LIGHT_ATTENUATION][2] = l->vars[VS::LIGHT_PARAM_ATTENUATION];
|
||||
|
||||
light_data[VL_LIGHT_SPOT_ATTENUATION][0]=Math::cos(Math::deg2rad(l->vars[VS::LIGHT_PARAM_SPOT_ANGLE]));
|
||||
light_data[VL_LIGHT_SPOT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_SPOT_ATTENUATION];
|
||||
@ -7022,6 +7026,10 @@ void RasterizerGLES2::_process_glow_bloom() {
|
||||
|
||||
void RasterizerGLES2::_process_hdr() {
|
||||
|
||||
if (framebuffer.luminance.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.luminance[0].fbo);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, framebuffer.color );
|
||||
@ -10813,14 +10821,52 @@ void RasterizerGLES2::init() {
|
||||
print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION));
|
||||
}
|
||||
|
||||
// Godot makes use of functions from ARB_framebuffer_object extension which is not implemented by all drivers.
|
||||
// On the other hand, these drivers might implement the older EXT_framebuffer_object extension
|
||||
// with which current source code is backward compatible.
|
||||
|
||||
bool framebuffer_object_is_supported = glewIsSupported("GL_ARB_framebuffer_object");
|
||||
|
||||
if ( !framebuffer_object_is_supported ) {
|
||||
WARN_PRINT("GL_ARB_framebuffer_object not supported by your graphics card.");
|
||||
|
||||
if ( glewIsSupported("GL_EXT_framebuffer_object") ) {
|
||||
// falling-back to the older EXT function if present
|
||||
WARN_PRINT("Falling-back to GL_EXT_framebuffer_object.");
|
||||
|
||||
glIsRenderbuffer = glIsRenderbufferEXT;
|
||||
glBindRenderbuffer = glBindRenderbufferEXT;
|
||||
glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
|
||||
glGenRenderbuffers = glGenRenderbuffersEXT;
|
||||
glRenderbufferStorage = glRenderbufferStorageEXT;
|
||||
glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT;
|
||||
glIsFramebuffer = glIsFramebufferEXT;
|
||||
glBindFramebuffer = glBindFramebufferEXT;
|
||||
glDeleteFramebuffers = glDeleteFramebuffersEXT;
|
||||
glGenFramebuffers = glGenFramebuffersEXT;
|
||||
glCheckFramebufferStatus = glCheckFramebufferStatusEXT;
|
||||
glFramebufferTexture1D = glFramebufferTexture1DEXT;
|
||||
glFramebufferTexture2D = glFramebufferTexture2DEXT;
|
||||
glFramebufferTexture3D = glFramebufferTexture3DEXT;
|
||||
glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
|
||||
glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
|
||||
glGenerateMipmap = glGenerateMipmapEXT;
|
||||
|
||||
framebuffer_object_is_supported = true;
|
||||
}
|
||||
else {
|
||||
ERR_PRINT("Framebuffer Object is not supported by your graphics card.");
|
||||
}
|
||||
}
|
||||
|
||||
// Check for GL 2.1 compatibility, if not bail out
|
||||
if (!glewIsSupported("GL_VERSION_2_1")) {
|
||||
if (!(glewIsSupported("GL_VERSION_2_1") && framebuffer_object_is_supported)) {
|
||||
ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
|
||||
"Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
|
||||
"Try a drivers update, buy a new GPU or try software rendering on Linux; Godot is now going to terminate.");
|
||||
OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
|
||||
"Godot Engine will self-destruct as soon as you acknowledge this error message.",
|
||||
"Fatal error: Insufficient OpenGL / GLES drivers");
|
||||
// TODO: If it's even possible, we should stop the execution without segfault and memory leaks :)
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
if env['BUILDERS'].has_key('GLSL120GLES'):
|
||||
@ -6,3 +8,5 @@ if env['BUILDERS'].has_key('GLSL120GLES'):
|
||||
env.GLSL120GLES('canvas_shadow.glsl');
|
||||
env.GLSL120GLES('blur.glsl');
|
||||
env.GLSL120GLES('copy.glsl');
|
||||
|
||||
Export('env')
|
||||
|
@ -980,6 +980,12 @@ FRAGMENT_SHADER_CODE
|
||||
#ifdef LIGHT_USE_SHADOW
|
||||
#ifdef LIGHT_TYPE_DIRECTIONAL
|
||||
|
||||
float shadow_fade_exponent=5.0; //hardcoded for now
|
||||
float shadow_fade=pow(length(vertex_interp)/light_attenuation.g,shadow_fade_exponent);
|
||||
|
||||
// optimization - skip shadows outside visible range
|
||||
if(shadow_fade<1.0){
|
||||
|
||||
#ifdef LIGHT_USE_PSSM
|
||||
|
||||
|
||||
@ -1105,6 +1111,12 @@ FRAGMENT_SHADER_CODE
|
||||
|
||||
shadow_attenuation=SAMPLE_SHADOW_TEX(shadow_coord.xy,shadow_coord.z);
|
||||
#endif
|
||||
|
||||
shadow_attenuation=mix(shadow_attenuation,1.0,shadow_fade);
|
||||
}else{
|
||||
shadow_attenuation=1.0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef LIGHT_TYPE_OMNI
|
||||
|
@ -1,11 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
|
||||
jpg_sources = [
|
||||
"jpegd/jpgd.cpp",
|
||||
"jpegd/image_loader_jpegd.cpp"
|
||||
]
|
||||
|
||||
env.drivers_sources+=jpg_sources
|
||||
|
||||
#env.add_source_files(env.drivers_sources, jpg_sources)
|
@ -1,143 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* image_loader_jpegd.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 "image_loader_jpegd.h"
|
||||
|
||||
#include "print_string.h"
|
||||
#include "os/os.h"
|
||||
#include "jpgd.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_buffer_len) {
|
||||
|
||||
jpgd::jpeg_decoder_mem_stream mem_stream(p_buffer,p_buffer_len);
|
||||
|
||||
jpgd::jpeg_decoder decoder(&mem_stream);
|
||||
|
||||
if (decoder.get_error_code() != jpgd::JPGD_SUCCESS) {
|
||||
return ERR_CANT_OPEN;
|
||||
}
|
||||
|
||||
const int image_width = decoder.get_width();
|
||||
const int image_height = decoder.get_height();
|
||||
int comps = decoder.get_num_components();
|
||||
if (comps==3)
|
||||
comps=4; //weird
|
||||
|
||||
if (decoder.begin_decoding() != jpgd::JPGD_SUCCESS)
|
||||
return ERR_FILE_CORRUPT;
|
||||
|
||||
const int dst_bpl = image_width * comps;
|
||||
|
||||
DVector<uint8_t> data;
|
||||
|
||||
data.resize(dst_bpl * image_height);
|
||||
|
||||
DVector<uint8_t>::Write dw = data.write();
|
||||
|
||||
jpgd::uint8 *pImage_data = (jpgd::uint8*)dw.ptr();
|
||||
|
||||
for (int y = 0; y < image_height; y++)
|
||||
{
|
||||
const jpgd::uint8* pScan_line;
|
||||
jpgd::uint scan_line_len;
|
||||
if (decoder.decode((const void**)&pScan_line, &scan_line_len) != jpgd::JPGD_SUCCESS)
|
||||
{
|
||||
return ERR_FILE_CORRUPT;
|
||||
}
|
||||
|
||||
jpgd::uint8 *pDst = pImage_data + y * dst_bpl;
|
||||
memcpy(pDst, pScan_line, dst_bpl);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//all good
|
||||
|
||||
Image::Format fmt;
|
||||
if (comps==1)
|
||||
fmt=Image::FORMAT_GRAYSCALE;
|
||||
else
|
||||
fmt=Image::FORMAT_RGBA;
|
||||
|
||||
dw = DVector<uint8_t>::Write();
|
||||
p_image->create(image_width,image_height,0,fmt,data);
|
||||
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) {
|
||||
|
||||
|
||||
DVector<uint8_t> src_image;
|
||||
int src_image_len = f->get_len();
|
||||
ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT);
|
||||
src_image.resize(src_image_len);
|
||||
|
||||
DVector<uint8_t>::Write w = src_image.write();
|
||||
|
||||
f->get_buffer(&w[0],src_image_len);
|
||||
|
||||
f->close();
|
||||
|
||||
|
||||
Error err = jpeg_load_image_from_buffer(p_image,w.ptr(),src_image_len);
|
||||
|
||||
w = DVector<uint8_t>::Write();
|
||||
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
void ImageLoaderJPG::get_recognized_extensions(List<String> *p_extensions) const {
|
||||
|
||||
p_extensions->push_back("jpg");
|
||||
p_extensions->push_back("jpeg");
|
||||
}
|
||||
|
||||
|
||||
static Image _jpegd_mem_loader_func(const uint8_t* p_png,int p_size) {
|
||||
|
||||
Image img;
|
||||
Error err = jpeg_load_image_from_buffer(&img,p_png,p_size);
|
||||
if (err)
|
||||
ERR_PRINT("Couldn't initialize ImageLoaderJPG with the given resource.");
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
ImageLoaderJPG::ImageLoaderJPG() {
|
||||
|
||||
Image::_jpg_mem_loader_func=_jpegd_mem_loader_func;
|
||||
}
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
Import('env')
|
||||
|
||||
|
||||
mpc_sources = [
|
||||
"mpc/huffman.c",
|
||||
"mpc/mpc_bits_reader.c",
|
||||
"mpc/mpc_decoder.c",
|
||||
"mpc/mpc_demux.c",
|
||||
"mpc/mpc_reader.c",
|
||||
"mpc/requant.c",
|
||||
"mpc/streaminfo.c",
|
||||
"mpc/synth_filter.c",
|
||||
]
|
||||
|
||||
env.drivers_sources+=mpc_sources
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
|
||||
#env.add_source_files(env.drivers_sources, mpc_sources)
|
||||
|
||||
Export('env')
|
@ -1,147 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* audio_stream_mpc.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_STREAM_MPC_H
|
||||
#define AUDIO_STREAM_MPC_H
|
||||
|
||||
#include "scene/resources/audio_stream.h"
|
||||
#include "os/file_access.h"
|
||||
#include "mpc/mpcdec.h"
|
||||
#include "os/thread_safe.h"
|
||||
#include "io/resource_loader.h"
|
||||
//#include "../libmpcdec/decoder.h"
|
||||
//#include "../libmpcdec/internal.h"
|
||||
|
||||
class AudioStreamPlaybackMPC : public AudioStreamPlayback {
|
||||
|
||||
OBJ_TYPE( AudioStreamPlaybackMPC, AudioStreamPlayback );
|
||||
|
||||
bool preload;
|
||||
FileAccess *f;
|
||||
String file;
|
||||
DVector<uint8_t> data;
|
||||
int data_ofs;
|
||||
int streamlen;
|
||||
|
||||
|
||||
bool active;
|
||||
bool paused;
|
||||
bool loop;
|
||||
int loops;
|
||||
|
||||
// mpc
|
||||
mpc_reader reader;
|
||||
mpc_demux* demux;
|
||||
mpc_streaminfo si;
|
||||
MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH];
|
||||
|
||||
static mpc_int32_t _mpc_read(mpc_reader *p_reader,void *p_dst, mpc_int32_t p_bytes);
|
||||
static mpc_bool_t _mpc_seek(mpc_reader *p_reader,mpc_int32_t p_offset);
|
||||
static mpc_int32_t _mpc_tell(mpc_reader *p_reader);
|
||||
static mpc_int32_t _mpc_get_size(mpc_reader *p_reader);
|
||||
static mpc_bool_t _mpc_canseek(mpc_reader *p_reader);
|
||||
|
||||
int stream_min_size;
|
||||
int stream_rate;
|
||||
int stream_channels;
|
||||
|
||||
protected:
|
||||
Error _open_file();
|
||||
void _close_file();
|
||||
int _read_file(void *p_dst,int p_bytes);
|
||||
bool _seek_file(int p_pos);
|
||||
int _tell_file() const;
|
||||
int _sizeof_file() const;
|
||||
bool _canseek_file() const;
|
||||
|
||||
|
||||
Error _reload();
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
|
||||
void set_file(const String& p_file);
|
||||
String get_file() const;
|
||||
|
||||
virtual void play(float p_offset=0);
|
||||
virtual void stop();
|
||||
virtual bool is_playing() const;
|
||||
|
||||
|
||||
virtual void set_loop(bool p_enable);
|
||||
virtual bool has_loop() const;
|
||||
|
||||
virtual float get_length() const;
|
||||
|
||||
virtual String get_stream_name() const;
|
||||
|
||||
virtual int get_loop_count() const;
|
||||
|
||||
virtual float get_pos() const;
|
||||
virtual void seek_pos(float p_time);
|
||||
|
||||
virtual int get_channels() const { return stream_channels; }
|
||||
virtual int get_mix_rate() const { return stream_rate; }
|
||||
|
||||
virtual int get_minimum_buffer_size() const { return stream_min_size; }
|
||||
virtual int mix(int16_t* p_bufer,int p_frames);
|
||||
|
||||
virtual void set_loop_restart_time(float p_time) { }
|
||||
|
||||
AudioStreamPlaybackMPC();
|
||||
~AudioStreamPlaybackMPC();
|
||||
};
|
||||
|
||||
class AudioStreamMPC : public AudioStream {
|
||||
|
||||
OBJ_TYPE( AudioStreamMPC, AudioStream );
|
||||
|
||||
String file;
|
||||
public:
|
||||
|
||||
Ref<AudioStreamPlayback> instance_playback() {
|
||||
Ref<AudioStreamPlaybackMPC> pb = memnew( AudioStreamPlaybackMPC );
|
||||
pb->set_file(file);
|
||||
return pb;
|
||||
}
|
||||
|
||||
void set_file(const String& p_file) { file=p_file; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
class ResourceFormatLoaderAudioStreamMPC : public ResourceFormatLoader {
|
||||
public:
|
||||
virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String& p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
||||
};
|
||||
|
||||
#endif // AUDIO_STREAM_MPC_H
|
@ -1,23 +0,0 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
@ -1,136 +0,0 @@
|
||||
nedalloc v1.05 15th June 2008:
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
by Niall Douglas (http://www.nedprod.com/programs/portable/nedmalloc/)
|
||||
|
||||
Enclosed is nedalloc, an alternative malloc implementation for multiple
|
||||
threads without lock contention based on dlmalloc v2.8.4. It is more
|
||||
or less a newer implementation of ptmalloc2, the standard allocator in
|
||||
Linux (which is based on dlmalloc v2.7.0) but also contains a per-thread
|
||||
cache for maximum CPU scalability.
|
||||
|
||||
It is licensed under the Boost Software License which basically means
|
||||
you can do anything you like with it. This does not apply to the malloc.c.h
|
||||
file which remains copyright to others.
|
||||
|
||||
It has been tested on win32 (x86), win64 (x64), Linux (x64), FreeBSD (x64)
|
||||
and Apple MacOS X (x86). It works very well on all of these and is very
|
||||
significantly faster than the system allocator on all of these platforms.
|
||||
|
||||
By literally dropping in this allocator as a replacement for your system
|
||||
allocator, you can see real world improvements of up to three times in normal
|
||||
code!
|
||||
|
||||
To use:
|
||||
-=-=-=-
|
||||
Drop in nedmalloc.h, nedmalloc.c and malloc.c.h into your project.
|
||||
Configure using the instructions in nedmalloc.h. Run and enjoy.
|
||||
|
||||
To test, compile test.c. It will run a comparison between your system
|
||||
allocator and nedalloc and tell you how much faster nedalloc is. It also
|
||||
serves as an example of usage.
|
||||
|
||||
Notes:
|
||||
-=-=-=
|
||||
If you want the very latest version of this allocator, get it from the
|
||||
TnFOX SVN repository at svn://svn.berlios.de/viewcvs/tnfox/trunk/src/nedmalloc
|
||||
|
||||
Because of how nedalloc allocates an mspace per thread, it can cause
|
||||
severe bloating of memory usage under certain allocation patterns.
|
||||
You can substantially reduce this wastage by setting MAXTHREADSINPOOL
|
||||
or the threads parameter to nedcreatepool() to a fraction of the number of
|
||||
threads which would normally be in a pool at once. This will reduce
|
||||
bloating at the cost of an increase in lock contention. If allocated size
|
||||
is less than THREADCACHEMAX, locking is avoided 90-99% of the time and
|
||||
if most of your allocations are below this value, you can safely set
|
||||
MAXTHREADSINPOOL to one.
|
||||
|
||||
You will suffer memory leakage unless you call neddisablethreadcache()
|
||||
per pool for every thread which exits. This is because nedalloc cannot
|
||||
portably know when a thread exits and thus when its thread cache can
|
||||
be returned for use by other code. Don't forget pool zero, the system pool.
|
||||
|
||||
For C++ type allocation patterns (where the same sizes of memory are
|
||||
regularly allocated and deallocated as objects are created and destroyed),
|
||||
the threadcache always benefits performance. If however your allocation
|
||||
patterns are different, searching the threadcache may significantly slow
|
||||
down your code - as a rule of thumb, if cache utilisation is below 80%
|
||||
(see the source for neddisablethreadcache() for how to enable debug
|
||||
printing in release mode) then you should disable the thread cache for
|
||||
that thread. You can compile out the threadcache code by setting
|
||||
THREADCACHEMAX to zero.
|
||||
|
||||
Speed comparisons:
|
||||
-=-=-=-=-=-=-=-=-=
|
||||
See Benchmarks.xls for details.
|
||||
|
||||
The enclosed test.c can do two things: it can be a torture test or a speed
|
||||
test. The speed test is designed to be a representative synthetic
|
||||
memory allocator test. It works by randomly mixing allocations with frees
|
||||
with half of the allocation sizes being a two power multiple less than
|
||||
512 bytes (to mimic C++ stack instantiated objects) and the other half
|
||||
being a simple random value less than 16Kb.
|
||||
|
||||
The real world code results are from Tn's TestIO benchmark. This is a
|
||||
heavily multithreaded and memory intensive benchmark with a lot of branching
|
||||
and other stuff modern processors don't like so much. As you'll note, the
|
||||
test doesn't show the benefits of the threadcache mostly due to the saturation
|
||||
of the memory bus being the limiting factor.
|
||||
|
||||
ChangeLog:
|
||||
-=-=-=-=-=
|
||||
v1.05 15th June 2008:
|
||||
* { 1042 } Added error check for TLSSET() and TLSFREE() macros. Thanks to
|
||||
Markus Elfring for reporting this.
|
||||
* { 1043 } Fixed a segfault when freeing memory allocated using
|
||||
nedindependent_comalloc(). Thanks to Pavel Vozenilek for reporting this.
|
||||
|
||||
v1.04 14th July 2007:
|
||||
* Fixed a bug with the new optimised implementation that failed to lock
|
||||
on a realloc under certain conditions.
|
||||
* Fixed lack of thread synchronisation in InitPool() causing pool corruption
|
||||
* Fixed a memory leak of thread cache contents on disabling. Thanks to Earl
|
||||
Chew for reporting this.
|
||||
* Added a sanity check for freed blocks being valid.
|
||||
* Reworked test.c into being a torture test.
|
||||
* Fixed GCC assembler optimisation misspecification
|
||||
|
||||
v1.04alpha_svn915 7th October 2006:
|
||||
* Fixed failure to unlock thread cache list if allocating a new list failed.
|
||||
Thanks to Dmitry Chichkov for reporting this. Futher thanks to Aleksey Sanin.
|
||||
* Fixed realloc(0, <size>) segfaulting. Thanks to Dmitry Chichkov for
|
||||
reporting this.
|
||||
* Made config defines #ifndef so they can be overriden by the build system.
|
||||
Thanks to Aleksey Sanin for suggesting this.
|
||||
* Fixed deadlock in nedprealloc() due to unnecessary locking of preferred
|
||||
thread mspace when mspace_realloc() always uses the original block's mspace
|
||||
anyway. Thanks to Aleksey Sanin for reporting this.
|
||||
* Made some speed improvements by hacking mspace_malloc() to no longer lock
|
||||
its mspace, thus allowing the recursive mutex implementation to be removed
|
||||
with an associated speed increase. Thanks to Aleksey Sanin for suggesting this.
|
||||
* Fixed a bug where allocating mspaces overran its max limit. Thanks to
|
||||
Aleksey Sanin for reporting this.
|
||||
|
||||
v1.03 10th July 2006:
|
||||
* Fixed memory corruption bug in threadcache code which only appeared with >4
|
||||
threads and in heavy use of the threadcache.
|
||||
|
||||
v1.02 15th May 2006:
|
||||
* Integrated dlmalloc v2.8.4, fixing the win32 memory release problem and
|
||||
improving performance still further. Speed is now up to twice the speed of v1.01
|
||||
(average is 67% faster).
|
||||
* Fixed win32 critical section implementation. Thanks to Pavel Kuznetsov
|
||||
for reporting this.
|
||||
* Wasn't locking mspace if all mspaces were locked. Thanks to Pavel Kuznetsov
|
||||
for reporting this.
|
||||
* Added Apple Mac OS X support.
|
||||
|
||||
v1.01 24th February 2006:
|
||||
* Fixed multiprocessor scaling problems by removing sources of cache sloshing
|
||||
* Earl Chew <earl_chew <at> agilent <dot> com> sent patches for the following:
|
||||
1. size2binidx() wasn't working for default code path (non x86)
|
||||
2. Fixed failure to release mspace lock under certain circumstances which
|
||||
caused a deadlock
|
||||
|
||||
v1.00 1st January 2006:
|
||||
* First release
|
@ -1,4 +0,0 @@
|
||||
Import('env')
|
||||
Export('env');
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
File diff suppressed because it is too large
Load Diff
@ -1,163 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* memory_pool_static_nedmalloc.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. */
|
||||
/*************************************************************************/
|
||||
#ifdef NEDMALLOC_ENABLED
|
||||
|
||||
//
|
||||
// C++ Implementation: memory_static_malloc
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Juan Linietsky <red@lunatea>, (C) 2006
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "memory_pool_static_nedmalloc.h"
|
||||
#include "error_macros.h"
|
||||
#include "os/memory.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "os/copymem.h"
|
||||
#include "os/os.h"
|
||||
|
||||
#include "nedmalloc.h"
|
||||
|
||||
/**
|
||||
* NOTE NOTE NOTE NOTE
|
||||
* in debug mode, this appends the memory size before the allocated, returned pointer
|
||||
* so BE CAREFUL!
|
||||
*/
|
||||
|
||||
void* MemoryPoolStaticNedMalloc::alloc(size_t p_bytes,const char *p_description) {
|
||||
|
||||
ERR_FAIL_COND_V(p_bytes==0,0);
|
||||
|
||||
MutexLock lock(mutex);
|
||||
|
||||
void *mem=nedalloc::nedmalloc(p_bytes);
|
||||
|
||||
ERR_FAIL_COND_V(!mem,0); //out of memory, or unreasonable request
|
||||
return mem;
|
||||
}
|
||||
|
||||
|
||||
void* MemoryPoolStaticNedMalloc::realloc(void *p_memory,size_t p_bytes) {
|
||||
|
||||
if (p_memory==NULL) {
|
||||
|
||||
return alloc( p_bytes );
|
||||
}
|
||||
|
||||
if (p_bytes<=0) {
|
||||
|
||||
this->free(p_memory);
|
||||
ERR_FAIL_COND_V( p_bytes < 0 , NULL );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MutexLock lock(mutex);
|
||||
|
||||
return nedalloc::nedrealloc( p_memory, p_bytes );
|
||||
}
|
||||
|
||||
void MemoryPoolStaticNedMalloc::free(void *p_ptr) {
|
||||
|
||||
MutexLock lock(mutex);
|
||||
|
||||
ERR_FAIL_COND(p_ptr==0);
|
||||
|
||||
nedalloc::nedfree(p_ptr);
|
||||
}
|
||||
|
||||
|
||||
size_t MemoryPoolStaticNedMalloc::get_available_mem() const {
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
size_t MemoryPoolStaticNedMalloc::get_total_usage() {
|
||||
|
||||
return nedalloc::nedmalloc_footprint();
|
||||
}
|
||||
|
||||
/* Most likely available only if memory debugger was compiled in */
|
||||
int MemoryPoolStaticNedMalloc::get_alloc_count() {
|
||||
|
||||
return 0;
|
||||
}
|
||||
void * MemoryPoolStaticNedMalloc::get_alloc_ptr(int p_alloc_idx) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
const char* MemoryPoolStaticNedMalloc::get_alloc_description(int p_alloc_idx) {
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
size_t MemoryPoolStaticNedMalloc::get_alloc_size(int p_alloc_idx) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void MemoryPoolStaticNedMalloc::debug_print_all_memory() {
|
||||
|
||||
nedalloc::nedmalloc_stats();
|
||||
}
|
||||
|
||||
MemoryPoolStaticNedMalloc::MemoryPoolStaticNedMalloc() {
|
||||
|
||||
mutex=NULL;
|
||||
#ifndef NO_THREADS
|
||||
|
||||
mutex=Mutex::create(); // at this point, this should work
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
MemoryPoolStaticNedMalloc::~MemoryPoolStaticNedMalloc() {
|
||||
|
||||
Mutex *old_mutex=mutex;
|
||||
mutex=NULL;
|
||||
if (old_mutex)
|
||||
memdelete(old_mutex);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
if (OS::get_singleton()->is_stdout_verbose())
|
||||
nedalloc::nedmalloc_stats();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,77 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* memory_pool_static_nedmalloc.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. */
|
||||
/*************************************************************************/
|
||||
#ifdef NEDMALLOC_ENABLED
|
||||
|
||||
//
|
||||
// C++ Interface: memory_static_malloc
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: Juan Linietsky <red@lunatea>, (C) 2006
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef MEMORY_POOL_STATIC_NEDMALLOC_H
|
||||
#define MEMORY_POOL_STATIC_NEDMALLOC_H
|
||||
|
||||
#include "os/memory_pool_static.h"
|
||||
#include "os/mutex.h"
|
||||
/**
|
||||
@author Juan Linietsky <red@lunatea>
|
||||
*/
|
||||
class MemoryPoolStaticNedMalloc : public MemoryPoolStatic {
|
||||
|
||||
Mutex *mutex;
|
||||
|
||||
public:
|
||||
|
||||
void* alloc(size_t p_bytes,const char *p_description=""); ///< Pointer in p_description shold be to a const char const like "hello"
|
||||
void* realloc(void *p_memory,size_t p_bytes); ///< Pointer in
|
||||
void free(void *p_ptr); ///< Pointer in p_description shold be to a const char const
|
||||
virtual size_t get_available_mem() const;
|
||||
virtual size_t get_total_usage();
|
||||
|
||||
/* Most likely available only if memory debugger was compiled in */
|
||||
virtual int get_alloc_count();
|
||||
virtual void * get_alloc_ptr(int p_alloc_idx);
|
||||
virtual const char* get_alloc_description(int p_alloc_idx);
|
||||
virtual size_t get_alloc_size(int p_alloc_idx);
|
||||
|
||||
virtual void debug_print_all_memory();
|
||||
|
||||
MemoryPoolStaticNedMalloc();
|
||||
~MemoryPoolStaticNedMalloc();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,302 +0,0 @@
|
||||
#ifdef NEDMALLOC_ENABLED
|
||||
|
||||
/* nedalloc, an alternative malloc implementation for multiple threads without
|
||||
lock contention based on dlmalloc v2.8.3. (C) 2005-2009 Niall Douglas
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NEDMALLOC_H
|
||||
#define NEDMALLOC_H
|
||||
|
||||
#include "typedefs.h"
|
||||
#define MALLOC_ALIGNMENT DEFAULT_ALIGNMENT
|
||||
|
||||
#ifdef PSP_ENABLED
|
||||
#define USE_LOCKS 0
|
||||
#define HAVE_MMAP 0
|
||||
#endif
|
||||
|
||||
/* See malloc.c.h for what each function does.
|
||||
|
||||
REPLACE_SYSTEM_ALLOCATOR on POSIX causes nedalloc's functions to be called
|
||||
malloc, free etc. instead of nedmalloc, nedfree etc. You may or may not want
|
||||
this. On Windows it causes nedmalloc to patch all loaded DLLs and binaries
|
||||
to replace usage of the system allocator.
|
||||
|
||||
NO_NED_NAMESPACE prevents the functions from being defined in the nedalloc
|
||||
namespace when in C++ (uses the global namespace instead).
|
||||
|
||||
NEDMALLOCEXTSPEC can be defined to be __declspec(dllexport) or
|
||||
__attribute__ ((visibility("default"))) or whatever you like. It defaults
|
||||
to extern unless NEDMALLOC_DLL_EXPORTS is set as it would be when building
|
||||
nedmalloc.dll.
|
||||
|
||||
USE_LOCKS can be 2 if you want to define your own MLOCK_T, INITIAL_LOCK,
|
||||
ACQUIRE_LOCK, RELEASE_LOCK, TRY_LOCK, IS_LOCKED and NULL_LOCK_INITIALIZER.
|
||||
|
||||
NEDMALLOC_DEBUG can be defined to cause DEBUG to be set differently for nedmalloc
|
||||
than for the rest of the build. Remember to set NDEBUG to disable all assertion
|
||||
checking too.
|
||||
|
||||
USE_MAGIC_HEADERS causes nedalloc to allocate an extra three sizeof(size_t)
|
||||
to each block. nedpfree() and nedprealloc() can then automagically know when
|
||||
to free a system allocated block. Enabling this typically adds 20-50% to
|
||||
application memory usage.
|
||||
|
||||
ENABLE_TOLERANT_NEDMALLOC is automatically turned on if REPLACE_SYSTEM_ALLOCATOR
|
||||
is set or the Windows DLL is being built. This causes nedmalloc to detect when a
|
||||
system allocator block is passed to it and to handle it appropriately. Note that
|
||||
without USE_MAGIC_HEADERS there is a very tiny chance that nedmalloc will segfault
|
||||
on non-Windows builds (it uses Win32 SEH to trap segfaults on Windows and there
|
||||
is no comparable system on POSIX).
|
||||
|
||||
USE_ALLOCATOR can be one of these settings (it defaults to 1):
|
||||
0: System allocator (nedmalloc now simply acts as a threadcache).
|
||||
WARNING: Intended for DEBUG USE ONLY - not all functions work correctly.
|
||||
1: dlmalloc
|
||||
|
||||
ENABLE_LARGE_PAGES enables support for requesting memory from the system in large
|
||||
(typically >=2Mb) pages if the host OS supports this. These occupy just a single
|
||||
TLB entry and can significantly improve performance in large working set applications.
|
||||
|
||||
ENABLE_FAST_HEAP_DETECTION enables special logic to detect blocks allocated
|
||||
by the system heap. This avoids 1.5%-2% overhead when checking for non-nedmalloc
|
||||
blocks, but it assumes that the NT and glibc heaps function in a very specific
|
||||
fashion which may not hold true across OS upgrades.
|
||||
*/
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
|
||||
#ifndef NEDMALLOCEXTSPEC
|
||||
#ifdef NEDMALLOC_DLL_EXPORTS
|
||||
#ifdef WIN32
|
||||
#define NEDMALLOCEXTSPEC extern __declspec(dllexport)
|
||||
#elif defined(__GNUC__)
|
||||
#define NEDMALLOCEXTSPEC extern __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
#ifndef ENABLE_TOLERANT_NEDMALLOC
|
||||
#define ENABLE_TOLERANT_NEDMALLOC 1
|
||||
#endif
|
||||
#else
|
||||
#define NEDMALLOCEXTSPEC extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L /* C99 or better */
|
||||
#define RESTRICT restrict
|
||||
#else
|
||||
#if defined(_MSC_VER) && _MSC_VER>=1400
|
||||
#define RESTRICT __restrict
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#define RESTRICT __restrict
|
||||
#endif
|
||||
#endif
|
||||
#ifndef RESTRICT
|
||||
#define RESTRICT
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER>=1400
|
||||
#define NEDMALLOCPTRATTR __declspec(restrict)
|
||||
#define NEDMALLOCNOALIASATTR __declspec(noalias)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#define NEDMALLOCPTRATTR __attribute__ ((malloc))
|
||||
#endif
|
||||
#ifndef NEDMALLOCPTRATTR
|
||||
#define NEDMALLOCPTRATTR
|
||||
#endif
|
||||
#ifndef NEDMALLOCNOALIASATTR
|
||||
#define NEDMALLOCNOALIASATTR
|
||||
#endif
|
||||
|
||||
#ifndef USE_MAGIC_HEADERS
|
||||
#define USE_MAGIC_HEADERS 0
|
||||
#endif
|
||||
|
||||
#ifndef USE_ALLOCATOR
|
||||
#define USE_ALLOCATOR 1 /* dlmalloc */
|
||||
#endif
|
||||
|
||||
#if !USE_ALLOCATOR && !USE_MAGIC_HEADERS
|
||||
#error If you are using the system allocator then you MUST use magic headers
|
||||
#endif
|
||||
|
||||
#ifdef REPLACE_SYSTEM_ALLOCATOR
|
||||
#if USE_ALLOCATOR==0
|
||||
#error Cannot combine using the system allocator with replacing the system allocator
|
||||
#endif
|
||||
#ifndef ENABLE_TOLERANT_NEDMALLOC
|
||||
#define ENABLE_TOLERANT_NEDMALLOC 1
|
||||
#endif
|
||||
#ifndef WIN32 /* We have a dedicated patcher for Windows */
|
||||
#define nedmalloc malloc
|
||||
#define nedcalloc calloc
|
||||
#define nedrealloc realloc
|
||||
#define nedfree free
|
||||
#define nedmemalign memalign
|
||||
#define nedmallinfo mallinfo
|
||||
#define nedmallopt mallopt
|
||||
#define nedmalloc_trim malloc_trim
|
||||
#define nedmalloc_stats malloc_stats
|
||||
#define nedmalloc_footprint malloc_footprint
|
||||
#define nedindependent_calloc independent_calloc
|
||||
#define nedindependent_comalloc independent_comalloc
|
||||
#ifdef _MSC_VER
|
||||
#define nedblksize _msize
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
struct nedmallinfo {
|
||||
size_t arena; /* non-mmapped space allocated from system */
|
||||
size_t ordblks; /* number of free chunks */
|
||||
size_t smblks; /* always 0 */
|
||||
size_t hblks; /* always 0 */
|
||||
size_t hblkhd; /* space in mmapped regions */
|
||||
size_t usmblks; /* maximum total allocated space */
|
||||
size_t fsmblks; /* always 0 */
|
||||
size_t uordblks; /* total allocated space */
|
||||
size_t fordblks; /* total free space */
|
||||
size_t keepcost; /* releasable (via malloc_trim) space */
|
||||
};
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#if !defined(NO_NED_NAMESPACE)
|
||||
namespace nedalloc {
|
||||
#else
|
||||
extern "C" {
|
||||
#endif
|
||||
#define THROWSPEC throw()
|
||||
#else
|
||||
#define THROWSPEC
|
||||
#endif
|
||||
|
||||
/* These are the global functions */
|
||||
|
||||
/* Gets the usable size of an allocated block. Note this will always be bigger than what was
|
||||
asked for due to rounding etc. Optionally returns 1 in isforeign if the block came from the
|
||||
system allocator - note that there is a small (>0.01%) but real chance of segfault on non-Windows
|
||||
systems when passing non-nedmalloc blocks if you don't use USE_MAGIC_HEADERS.
|
||||
*/
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR size_t nedblksize(int *RESTRICT isforeign, void *RESTRICT mem) THROWSPEC;
|
||||
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void nedsetvalue(void *v) THROWSPEC;
|
||||
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedmalloc(size_t size) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedcalloc(size_t no, size_t size) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedrealloc(void *mem, size_t size) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void nedfree(void *mem) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedmemalign(size_t alignment, size_t bytes) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR struct nedmallinfo nedmallinfo(void) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR int nedmallopt(int parno, int value) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void* nedmalloc_internals(size_t *granularity, size_t *magic) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR int nedmalloc_trim(size_t pad) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC void nedmalloc_stats(void) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR size_t nedmalloc_footprint(void) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC;
|
||||
|
||||
/* Destroys the system memory pool used by the functions above.
|
||||
Useful for when you have nedmalloc in a DLL you're about to unload.
|
||||
If you call ANY nedmalloc functions after calling this you will
|
||||
get a fatal exception!
|
||||
*/
|
||||
NEDMALLOCEXTSPEC void neddestroysyspool() THROWSPEC;
|
||||
|
||||
/* These are the pool functions */
|
||||
struct nedpool_t;
|
||||
typedef struct nedpool_t nedpool;
|
||||
|
||||
/* Creates a memory pool for use with the nedp* functions below.
|
||||
Capacity is how much to allocate immediately (if you know you'll be allocating a lot
|
||||
of memory very soon) which you can leave at zero. Threads specifies how many threads
|
||||
will *normally* be accessing the pool concurrently. Setting this to zero means it
|
||||
extends on demand, but be careful of this as it can rapidly consume system resources
|
||||
where bursts of concurrent threads use a pool at once.
|
||||
*/
|
||||
NEDMALLOCEXTSPEC NEDMALLOCPTRATTR nedpool *nedcreatepool(size_t capacity, int threads) THROWSPEC;
|
||||
|
||||
/* Destroys a memory pool previously created by nedcreatepool().
|
||||
*/
|
||||
NEDMALLOCEXTSPEC void neddestroypool(nedpool *p) THROWSPEC;
|
||||
|
||||
/* Returns a zero terminated snapshot of threadpools existing at the time of call. Call
|
||||
nedfree() on the returned list when you are done. Returns zero if there is only the
|
||||
system pool in existence.
|
||||
*/
|
||||
NEDMALLOCEXTSPEC nedpool **nedpoollist() THROWSPEC;
|
||||
|
||||
/* Sets a value to be associated with a pool. You can retrieve this value by passing
|
||||
any memory block allocated from that pool.
|
||||
*/
|
||||
NEDMALLOCEXTSPEC void nedpsetvalue(nedpool *p, void *v) THROWSPEC;
|
||||
|
||||
/* Gets a previously set value using nedpsetvalue() or zero if memory is unknown.
|
||||
Optionally can also retrieve pool. You can detect an unknown block by the return
|
||||
being zero and *p being unmodifed.
|
||||
*/
|
||||
NEDMALLOCEXTSPEC void *nedgetvalue(nedpool **p, void *mem) THROWSPEC;
|
||||
|
||||
/* Trims the thread cache for the calling thread, returning any existing cache
|
||||
data to the central pool. Remember to ALWAYS call with zero if you used the
|
||||
system pool. Setting disable to non-zero replicates neddisablethreadcache().
|
||||
*/
|
||||
NEDMALLOCEXTSPEC void nedtrimthreadcache(nedpool *p, int disable) THROWSPEC;
|
||||
|
||||
/* Disables the thread cache for the calling thread, returning any existing cache
|
||||
data to the central pool. Remember to ALWAYS call with zero if you used the
|
||||
system pool.
|
||||
*/
|
||||
NEDMALLOCEXTSPEC void neddisablethreadcache(nedpool *p) THROWSPEC;
|
||||
|
||||
|
||||
NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpmalloc(nedpool *p, size_t size) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpcalloc(nedpool *p, size_t no, size_t size) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedprealloc(nedpool *p, void *mem, size_t size) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC void nedpfree(nedpool *p, void *mem) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpmemalign(nedpool *p, size_t alignment, size_t bytes) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC struct nedmallinfo nedpmallinfo(nedpool *p) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC int nedpmallopt(nedpool *p, int parno, int value) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC int nedpmalloc_trim(nedpool *p, size_t pad) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC void nedpmalloc_stats(nedpool *p) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC size_t nedpmalloc_footprint(nedpool *p) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void **nedpindependent_calloc(nedpool *p, size_t elemsno, size_t elemsize, void **chunks) THROWSPEC;
|
||||
NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **chunks) THROWSPEC;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user