diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/chibi/event_stream_chibi.cpp | 13 | ||||
-rw-r--r-- | drivers/chibi/event_stream_chibi.h | 2 | ||||
-rw-r--r-- | drivers/dds/texture_loader_dds.cpp | 10 | ||||
-rw-r--r-- | drivers/dds/texture_loader_dds.h | 2 | ||||
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 22 | ||||
-rw-r--r-- | drivers/mpc/audio_stream_mpc.cpp | 5 | ||||
-rw-r--r-- | drivers/mpc/audio_stream_mpc.h | 2 | ||||
-rw-r--r-- | drivers/pvr/texture_loader_pvr.cpp | 9 | ||||
-rw-r--r-- | drivers/pvr/texture_loader_pvr.h | 2 | ||||
-rw-r--r-- | drivers/speex/audio_stream_speex.cpp | 5 | ||||
-rw-r--r-- | drivers/speex/audio_stream_speex.h | 2 | ||||
-rw-r--r-- | drivers/theora/video_stream_theora.h | 2 | ||||
-rwxr-xr-x | drivers/theoraplayer/src/YUV/libyuv/src/cpu_id.cc | 2 | ||||
-rw-r--r-- | drivers/theoraplayer/video_stream_theoraplayer.cpp | 4 | ||||
-rw-r--r-- | drivers/theoraplayer/video_stream_theoraplayer.h | 2 | ||||
-rw-r--r-- | drivers/vorbis/audio_stream_ogg_vorbis.cpp | 4 | ||||
-rw-r--r-- | drivers/vorbis/audio_stream_ogg_vorbis.h | 2 |
17 files changed, 62 insertions, 28 deletions
diff --git a/drivers/chibi/event_stream_chibi.cpp b/drivers/chibi/event_stream_chibi.cpp index e87e0a9aaa..ecb5c3f22b 100644 --- a/drivers/chibi/event_stream_chibi.cpp +++ b/drivers/chibi/event_stream_chibi.cpp @@ -779,8 +779,10 @@ EventStreamChibi::EventStreamChibi() { -RES ResourceFormatLoaderChibi::load(const String &p_path,const String& p_original_path) { +RES ResourceFormatLoaderChibi::load(const String &p_path, const String& p_original_path, Error *r_error) { + if (r_error) + *r_error=ERR_FILE_CANT_OPEN; String el = p_path.extension().to_lower(); CPFileAccessWrapperImpl f; @@ -791,6 +793,8 @@ RES ResourceFormatLoaderChibi::load(const String &p_path,const String& p_origina CPLoader_IT loader(&f); CPLoader::Error err = loader.load_song(p_path.utf8().get_data(),&esc->song,false); ERR_FAIL_COND_V(err!=CPLoader::FILE_OK,RES()); + if (r_error) + *r_error=OK; return esc; @@ -800,6 +804,8 @@ RES ResourceFormatLoaderChibi::load(const String &p_path,const String& p_origina CPLoader_XM loader(&f); CPLoader::Error err=loader.load_song(p_path.utf8().get_data(),&esc->song,false); ERR_FAIL_COND_V(err!=CPLoader::FILE_OK,RES()); + if (r_error) + *r_error=OK; return esc; } else if (el=="s3m") { @@ -808,6 +814,9 @@ RES ResourceFormatLoaderChibi::load(const String &p_path,const String& p_origina CPLoader_S3M loader(&f); CPLoader::Error err=loader.load_song(p_path.utf8().get_data(),&esc->song,false); ERR_FAIL_COND_V(err!=CPLoader::FILE_OK,RES()); + if (r_error) + *r_error=OK; + return esc; } else if (el=="mod") { @@ -816,6 +825,8 @@ RES ResourceFormatLoaderChibi::load(const String &p_path,const String& p_origina CPLoader_MOD loader(&f); CPLoader::Error err=loader.load_song(p_path.utf8().get_data(),&esc->song,false); ERR_FAIL_COND_V(err!=CPLoader::FILE_OK,RES()); + if (r_error) + *r_error=OK; return esc; } diff --git a/drivers/chibi/event_stream_chibi.h b/drivers/chibi/event_stream_chibi.h index 7b2ee4b471..b564c16018 100644 --- a/drivers/chibi/event_stream_chibi.h +++ b/drivers/chibi/event_stream_chibi.h @@ -301,7 +301,7 @@ public: class ResourceFormatLoaderChibi : public ResourceFormatLoader { public: - virtual RES load(const String &p_path,const String& p_original_path=""); + 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; diff --git a/drivers/dds/texture_loader_dds.cpp b/drivers/dds/texture_loader_dds.cpp index 8e6c3b62e6..9b2e401fd9 100644 --- a/drivers/dds/texture_loader_dds.cpp +++ b/drivers/dds/texture_loader_dds.cpp @@ -64,8 +64,10 @@ static const DDSFormatInfo dds_format_info[DDS_MAX]={ }; -RES ResourceFormatDDS::load(const String &p_path,const String& p_original_path) { +RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, Error *r_error) { + if (r_error) + *r_error=ERR_CANT_OPEN; Error err; FileAccess *f = FileAccess::open(p_path,FileAccess::READ,&err); @@ -73,6 +75,8 @@ RES ResourceFormatDDS::load(const String &p_path,const String& p_original_path) return RES(); FileAccessRef fref(f); + if (r_error) + *r_error=ERR_FILE_CORRUPT; ERR_EXPLAIN("Unable to open DDS texture file: "+p_path); ERR_FAIL_COND_V(err!=OK,RES()); @@ -427,6 +431,10 @@ RES ResourceFormatDDS::load(const String &p_path,const String& p_original_path) Ref<ImageTexture> texture = memnew( ImageTexture ); texture->create_from_image(img); + if (r_error) + *r_error=OK; + + return texture; } diff --git a/drivers/dds/texture_loader_dds.h b/drivers/dds/texture_loader_dds.h index 18a1485073..c8b3610063 100644 --- a/drivers/dds/texture_loader_dds.h +++ b/drivers/dds/texture_loader_dds.h @@ -7,7 +7,7 @@ class ResourceFormatDDS : public ResourceFormatLoader{ public: - virtual RES load(const String &p_path,const String& p_original_path=""); + 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; diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 157f2e398b..d57512c936 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -132,18 +132,18 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a SL::BlockNode *bnode=(SL::BlockNode*)p_node; //variables - code+="{"ENDL; + code+="{" ENDL; for(Map<StringName,SL::DataType>::Element *E=bnode->variables.front();E;E=E->next()) { - code+=_mktab(p_level)+_typestr(E->value())+" "+replace_string(E->key())+";"ENDL; + code+=_mktab(p_level)+_typestr(E->value())+" "+replace_string(E->key())+";" ENDL; } for(int i=0;i<bnode->statements.size();i++) { - code+=_mktab(p_level)+dump_node_code(bnode->statements[i],p_level)+";"ENDL; + code+=_mktab(p_level)+dump_node_code(bnode->statements[i],p_level)+";" ENDL; } - code+="}"ENDL; + code+="}" ENDL; } break; case SL::Node::TYPE_VARIABLE: { @@ -489,15 +489,15 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a SL::ControlFlowNode *cfnode=(SL::ControlFlowNode*)p_node; if (cfnode->flow_op==SL::FLOW_OP_IF) { - code+="if ("+dump_node_code(cfnode->statements[0],p_level)+") {"ENDL; + code+="if ("+dump_node_code(cfnode->statements[0],p_level)+") {" ENDL; code+=dump_node_code(cfnode->statements[1],p_level+1); if (cfnode->statements.size()==3) { - code+="} else {"ENDL; + code+="} else {" ENDL; code+=dump_node_code(cfnode->statements[2],p_level+1); } - code+="}"ENDL; + code+="}" ENDL; } else if (cfnode->flow_op==SL::FLOW_OP_RETURN) { @@ -560,7 +560,7 @@ Error ShaderCompilerGLES2::compile_node(SL::ProgramNode *p_program) { ubase=uniforms->size(); for(Map<StringName,SL::Uniform>::Element *E=p_program->uniforms.front();E;E=E->next()) { - String uline="uniform "+_typestr(E->get().type)+" _"+E->key().operator String()+";"ENDL; + String uline="uniform "+_typestr(E->get().type)+" _"+E->key().operator String()+";" ENDL; global_code+=uline; if (uniforms) { @@ -593,10 +593,10 @@ Error ShaderCompilerGLES2::compile_node(SL::ProgramNode *p_program) { header+=_typestr(fnode->arguments[i].type)+" "+replace_string(fnode->arguments[i].name); } - header+=") {"ENDL; + header+=") {" ENDL; String fcode=header; fcode+=dump_node_code(fnode->body,1); - fcode+="}"ENDL; + fcode+="}" ENDL; global_code+=fcode; } @@ -605,7 +605,7 @@ Error ShaderCompilerGLES2::compile_node(SL::ProgramNode *p_program) { StringName varname=E->key(); String newvarname=replace_string(varname); - global_code+="uniform "+_typestr(E->get())+" "+newvarname+";"ENDL; + global_code+="uniform "+_typestr(E->get())+" "+newvarname+";" ENDL; }*/ code=dump_node_code(p_program,0); diff --git a/drivers/mpc/audio_stream_mpc.cpp b/drivers/mpc/audio_stream_mpc.cpp index cd8125c9af..67f21f922c 100644 --- a/drivers/mpc/audio_stream_mpc.cpp +++ b/drivers/mpc/audio_stream_mpc.cpp @@ -366,8 +366,9 @@ AudioStreamMPC::~AudioStreamMPC() { -RES ResourceFormatLoaderAudioStreamMPC::load(const String &p_path,const String& p_original_path) { - +RES ResourceFormatLoaderAudioStreamMPC::load(const String &p_path, const String& p_original_path, Error *r_error) { + if (r_error) + *r_error=OK; //streamed so it will always work.. AudioStreamMPC *mpc_stream = memnew(AudioStreamMPC); mpc_stream->set_file(p_path); return Ref<AudioStreamMPC>(mpc_stream); diff --git a/drivers/mpc/audio_stream_mpc.h b/drivers/mpc/audio_stream_mpc.h index fa949acd00..8fb0ed13de 100644 --- a/drivers/mpc/audio_stream_mpc.h +++ b/drivers/mpc/audio_stream_mpc.h @@ -88,7 +88,7 @@ public: class ResourceFormatLoaderAudioStreamMPC : public ResourceFormatLoader { public: - virtual RES load(const String &p_path,const String& p_original_path=""); + 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; diff --git a/drivers/pvr/texture_loader_pvr.cpp b/drivers/pvr/texture_loader_pvr.cpp index 5268b953f4..eb67dad8cf 100644 --- a/drivers/pvr/texture_loader_pvr.cpp +++ b/drivers/pvr/texture_loader_pvr.cpp @@ -22,8 +22,10 @@ enum PVRFLags { -RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path) { +RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,Error *r_error) { + if (r_error) + *r_error=ERR_CANT_OPEN; Error err; FileAccess *f = FileAccess::open(p_path,FileAccess::READ,&err); @@ -34,6 +36,8 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path) ERR_FAIL_COND_V(err,RES()); + if (r_error) + *r_error=ERR_FILE_CORRUPT; uint32_t hsize = f->get_32(); @@ -135,6 +139,9 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path) Ref<ImageTexture> texture = memnew( ImageTexture ); texture->create_from_image(image,tex_flags); + if (r_error) + *r_error=OK; + return texture; } diff --git a/drivers/pvr/texture_loader_pvr.h b/drivers/pvr/texture_loader_pvr.h index ad86660aa1..735cb2b48b 100644 --- a/drivers/pvr/texture_loader_pvr.h +++ b/drivers/pvr/texture_loader_pvr.h @@ -9,7 +9,7 @@ class ResourceFormatPVR : public ResourceFormatLoader{ public: - virtual RES load(const String &p_path,const String& p_original_path); + 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; diff --git a/drivers/speex/audio_stream_speex.cpp b/drivers/speex/audio_stream_speex.cpp index bcf4c515f8..2cffb17049 100644 --- a/drivers/speex/audio_stream_speex.cpp +++ b/drivers/speex/audio_stream_speex.cpp @@ -530,7 +530,10 @@ AudioStreamSpeex::~AudioStreamSpeex() { unload(); } -RES ResourceFormatLoaderAudioStreamSpeex::load(const String &p_path,const String& p_original_path) { +RES ResourceFormatLoaderAudioStreamSpeex::load(const String &p_path, const String& p_original_path, Error *r_error) { + + if (r_error) + *r_error=OK; AudioStreamSpeex *stream = memnew(AudioStreamSpeex); stream->set_file(p_path); diff --git a/drivers/speex/audio_stream_speex.h b/drivers/speex/audio_stream_speex.h index 9557ebe0b8..f9e0fce666 100644 --- a/drivers/speex/audio_stream_speex.h +++ b/drivers/speex/audio_stream_speex.h @@ -91,7 +91,7 @@ public: class ResourceFormatLoaderAudioStreamSpeex : public ResourceFormatLoader { public: - virtual RES load(const String &p_path,const String& p_original_path=""); + 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; diff --git a/drivers/theora/video_stream_theora.h b/drivers/theora/video_stream_theora.h index b408f9db13..12aac731fc 100644 --- a/drivers/theora/video_stream_theora.h +++ b/drivers/theora/video_stream_theora.h @@ -102,7 +102,7 @@ public: class ResourceFormatLoaderVideoStreamTheora : public ResourceFormatLoader { public: - virtual RES load(const String &p_path,const String& p_original_path=""); + 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; diff --git a/drivers/theoraplayer/src/YUV/libyuv/src/cpu_id.cc b/drivers/theoraplayer/src/YUV/libyuv/src/cpu_id.cc index f52bd95551..aac7390b32 100755 --- a/drivers/theoraplayer/src/YUV/libyuv/src/cpu_id.cc +++ b/drivers/theoraplayer/src/YUV/libyuv/src/cpu_id.cc @@ -174,7 +174,7 @@ int cpu_info_ = kCpuInit; // cpu_info is not initialized yet. #if !defined(__native_client__) && !defined(_M_ARM) static LIBYUV_BOOL TestEnv(const char* name) { -#ifndef _WINRT +#if !defined(_WINRT) && !defined(ORBIS_ENABLED) const char* var = getenv(name); if (var) { if (var[0] != '0') { diff --git a/drivers/theoraplayer/video_stream_theoraplayer.cpp b/drivers/theoraplayer/video_stream_theoraplayer.cpp index ef1f5651ab..876cac3425 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.cpp +++ b/drivers/theoraplayer/video_stream_theoraplayer.cpp @@ -525,7 +525,9 @@ VideoStreamTheoraplayer::VideoStreamTheoraplayer() { }; -RES ResourceFormatLoaderVideoStreamTheoraplayer::load(const String &p_path,const String& p_original_path) { +RES ResourceFormatLoaderVideoStreamTheoraplayer::load(const String &p_path, const String& p_original_path, Error *r_error) { + if (r_error) + *r_error=OK; VideoStreamTheoraplayer *stream = memnew(VideoStreamTheoraplayer); stream->set_file(p_path); diff --git a/drivers/theoraplayer/video_stream_theoraplayer.h b/drivers/theoraplayer/video_stream_theoraplayer.h index d43c12609f..69cae7c4a2 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.h +++ b/drivers/theoraplayer/video_stream_theoraplayer.h @@ -54,7 +54,7 @@ public: class ResourceFormatLoaderVideoStreamTheoraplayer : public ResourceFormatLoader { public: - virtual RES load(const String &p_path,const String& p_original_path=""); + 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; diff --git a/drivers/vorbis/audio_stream_ogg_vorbis.cpp b/drivers/vorbis/audio_stream_ogg_vorbis.cpp index 249059e2c1..ee9ba8da4d 100644 --- a/drivers/vorbis/audio_stream_ogg_vorbis.cpp +++ b/drivers/vorbis/audio_stream_ogg_vorbis.cpp @@ -385,7 +385,9 @@ AudioStreamOGGVorbis::~AudioStreamOGGVorbis() { -RES ResourceFormatLoaderAudioStreamOGGVorbis::load(const String &p_path,const String& p_original_path) { +RES ResourceFormatLoaderAudioStreamOGGVorbis::load(const String &p_path, const String& p_original_path, Error *r_error) { + if (r_error) + *r_error=OK; AudioStreamOGGVorbis *ogg_stream = memnew(AudioStreamOGGVorbis); ogg_stream->set_file(p_path); diff --git a/drivers/vorbis/audio_stream_ogg_vorbis.h b/drivers/vorbis/audio_stream_ogg_vorbis.h index 8a35fc09cb..5e3649d980 100644 --- a/drivers/vorbis/audio_stream_ogg_vorbis.h +++ b/drivers/vorbis/audio_stream_ogg_vorbis.h @@ -111,7 +111,7 @@ public: class ResourceFormatLoaderAudioStreamOGGVorbis : public ResourceFormatLoader { public: - virtual RES load(const String &p_path,const String& p_original_path=""); + 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; |