diff options
author | FWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544> | 2011-12-10 12:48:13 +0000 |
---|---|---|
committer | FWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544> | 2011-12-10 12:48:13 +0000 |
commit | 104d1a3ad33468b365d9d79a87d91996f8b370d1 (patch) | |
tree | 3cee7fd4f2a8a2722c173060b9f51b31f485087c /nGenEx/VideoDX9.cpp | |
parent | cb40658d6cbd5867265c5ed2a5921613ca038bb7 (diff) | |
download | starshatter-104d1a3ad33468b365d9d79a87d91996f8b370d1.zip starshatter-104d1a3ad33468b365d9d79a87d91996f8b370d1.tar.gz starshatter-104d1a3ad33468b365d9d79a87d91996f8b370d1.tar.bz2 |
Changing the default behaviour for shader loading to look for files outside of .dat archives first
Diffstat (limited to 'nGenEx/VideoDX9.cpp')
-rw-r--r-- | nGenEx/VideoDX9.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/nGenEx/VideoDX9.cpp b/nGenEx/VideoDX9.cpp index b803c39..821eaf4 100644 --- a/nGenEx/VideoDX9.cpp +++ b/nGenEx/VideoDX9.cpp @@ -647,28 +647,26 @@ VideoDX9::CreateBuffers() hr = d3ddevice->CreateVertexDeclaration(videoDX9NormalVertexElements,
&vertex_declaration);
- if (video_settings.use_effects && !magic_fx_code) {
- if (loader) {
+ // The E - We want to load our shader from the standard filesystem by default, to allow for better modding.
+ if (video_settings.use_effects && !magic_fx_code) {
+ FILE* f;
+ ::fopen_s(&f, "magic.fx", "rb");
+
+ if (f) {
+ ::fseek(f, 0, SEEK_END);
+ magic_fx_code_len = ftell(f);
+ ::fseek(f, 0, SEEK_SET);
+
+ magic_fx_code = new(__FILE__,__LINE__) BYTE[magic_fx_code_len+1];
+ if (magic_fx_code) {
+ ::fread(magic_fx_code, magic_fx_code_len, 1, f);
+ magic_fx_code[magic_fx_code_len] = 0;
+ }
+ } else if (loader) {
magic_fx_code_len = loader->LoadBuffer("magic.fx", magic_fx_code, true, true);
}
- else {
- FILE* f;
- ::fopen_s(&f, "magic.fx", "rb");
-
- if (f) {
- ::fseek(f, 0, SEEK_END);
- magic_fx_code_len = ftell(f);
- ::fseek(f, 0, SEEK_SET);
-
- magic_fx_code = new(__FILE__,__LINE__) BYTE[magic_fx_code_len+1];
- if (magic_fx_code) {
- ::fread(magic_fx_code, magic_fx_code_len, 1, f);
- magic_fx_code[magic_fx_code_len] = 0;
- }
- ::fclose(f);
- }
- }
+ ::fclose(f);
}
if (video_settings.use_effects && magic_fx_code && magic_fx_code_len) {
|