summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/chibi/event_stream_chibi.cpp13
-rw-r--r--drivers/chibi/event_stream_chibi.h2
-rw-r--r--drivers/dds/texture_loader_dds.cpp10
-rw-r--r--drivers/dds/texture_loader_dds.h2
-rw-r--r--drivers/mpc/audio_stream_mpc.cpp5
-rw-r--r--drivers/mpc/audio_stream_mpc.h2
-rw-r--r--drivers/pvr/texture_loader_pvr.cpp9
-rw-r--r--drivers/pvr/texture_loader_pvr.h2
-rw-r--r--drivers/speex/audio_stream_speex.cpp5
-rw-r--r--drivers/speex/audio_stream_speex.h2
-rw-r--r--drivers/theora/video_stream_theora.h2
-rw-r--r--drivers/theoraplayer/video_stream_theoraplayer.cpp4
-rw-r--r--drivers/theoraplayer/video_stream_theoraplayer.h2
-rw-r--r--drivers/vorbis/audio_stream_ogg_vorbis.cpp4
-rw-r--r--drivers/vorbis/audio_stream_ogg_vorbis.h2
15 files changed, 50 insertions, 16 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/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/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;