Subversion Repositories filter_foundry

Rev

Rev 554 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 554 Rev 557
Line 86... Line 86...
86
        HMODULE hm;
86
        HMODULE hm;
87
        FFLoadingResult res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
87
        FFLoadingResult res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
88
 
88
 
89
        // First, try to read the file as AFS/PFF/TXT file
89
        // First, try to read the file as AFS/PFF/TXT file
90
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
90
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
91
                if (0 == (res = readfile_afs_pff(sfr))) {
91
                if (LOADING_OK == (res = readfile_afs_pff(sfr))) {
92
                        gdata->obfusc = false;
92
                        gdata->obfusc = false;
93
                        parm_reset(true, false, true, false);
93
                        parm_reset(true, false, true, false);
94
                        return 0;
94
                        return 0;
95
                }
95
                }
96
                if (!fileHasExtension(sfr, TEXT(".afs")) && !fileHasExtension(sfr, TEXT(".pff"))) {
96
                if (!fileHasExtension(sfr, TEXT(".afs")) && !fileHasExtension(sfr, TEXT(".pff"))) {
Line 101... Line 101...
101
                }
101
                }
102
        }
102
        }
103
 
103
 
104
        // Try to read the file as FFL file
104
        // Try to read the file as FFL file
105
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
105
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
106
                if (0 == (res = readfile_ffl(sfr))) {
106
                if (LOADING_OK == (res = readfile_ffl(sfr))) {
107
                        gdata->obfusc = false;
107
                        gdata->obfusc = false;
108
                        parm_reset(true, true, true, true);
108
                        parm_reset(true, true, true, true);
109
                        return 0;
109
                        return 0;
110
                }
110
                }
111
                if (!fileHasExtension(sfr, TEXT(".ffl"))) {
111
                if (!fileHasExtension(sfr, TEXT(".ffl"))) {
Line 116... Line 116...
116
                }
116
                }
117
        }
117
        }
118
 
118
 
119
        // Is it a "Filters Unlimited" FFX filter? (Only partially compatible with Filter Factory!!!)
119
        // Is it a "Filters Unlimited" FFX filter? (Only partially compatible with Filter Factory!!!)
120
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
120
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
121
                if (0 == (res = readfile_ffx(sfr))) {
121
                if (LOADING_OK == (res = readfile_ffx(sfr))) {
122
                        return 0;
122
                        return 0;
123
                }
123
                }
124
                if (!fileHasExtension(sfr, TEXT(".ffx"))) {
124
                if (!fileHasExtension(sfr, TEXT(".ffx"))) {
125
                        // If .ffx files have an invalid signature, then it is a hard error.
125
                        // If .ffx files have an invalid signature, then it is a hard error.
126
                        // If any other file has no "FFX1.0", "FFX1.1", or "FFX1.2" signature, then it is OK and
126
                        // If any other file has no "FFX1.0", "FFX1.1", or "FFX1.2" signature, then it is OK and
Line 130... Line 130...
130
        }
130
        }
131
 
131
 
132
        // If that didn't work, try to load as Windows image file (Resource API for 8BF/PRM files)
132
        // If that didn't work, try to load as Windows image file (Resource API for 8BF/PRM files)
133
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
133
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
134
                if (hm = LoadLibraryEx(sfr->sfFile.szName, NULL, LOAD_LIBRARY_AS_DATAFILE)) {
134
                if (hm = LoadLibraryEx(sfr->sfFile.szName, NULL, LOAD_LIBRARY_AS_DATAFILE)) {
135
                        if (0 == (res = readPARMresource(hm))) {
135
                        if (LOADING_OK == (res = readPARMresource(hm))) {
136
                                gdata->parm.standalone = false; // just because the loaded file is standalone, does not mean that WE are standalone
136
                                gdata->parm.standalone = false; // just because the loaded file is standalone, does not mean that WE are standalone
137
                                if (gdata->parm.iProtected) {
137
                                if (gdata->parm.iProtected) {
138
                                        parm_reset(true, true, true, true);
138
                                        parm_reset(true, true, true, true);
139
                                        res = MSG_FILTER_PROTECTED_ID;
139
                                        res = MSG_FILTER_PROTECTED_ID;
140
                                }
140
                                }
Line 148... Line 148...
148
        }
148
        }
149
 
149
 
150
        // Is it a "Filters Unlimited" TXT filter? (Only partially compatible with Filter Factory!!!)
150
        // Is it a "Filters Unlimited" TXT filter? (Only partially compatible with Filter Factory!!!)
151
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
151
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
152
                if (fileHasExtension(sfr, TEXT(".txt"))) {
152
                if (fileHasExtension(sfr, TEXT(".txt"))) {
153
                        if (0 == (res = readfile_picotxt_or_ffdecomp(sfr))) {
153
                        if (LOADING_OK == (res = readfile_picotxt_or_ffdecomp(sfr))) {
154
                                return 0;
154
                                return 0;
155
                        }
155
                        }
156
                }
156
                }
157
        }
157
        }
158
 
158
 
159
        // Is it a "GIMP UserFilter (GUF)" file? (Only partially compatible with Filter Factory!!!)
159
        // Is it a "GIMP UserFilter (GUF)" file? (Only partially compatible with Filter Factory!!!)
160
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
160
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
161
                if (fileHasExtension(sfr, TEXT(".guf"))) {
161
                if (fileHasExtension(sfr, TEXT(".guf"))) {
162
                        if (0 == (res = readfile_guf(sfr))) {
162
                        if (LOADING_OK == (res = readfile_guf(sfr))) {
163
                                return 0;
163
                                return 0;
164
                        }
164
                        }
165
                }
165
                }
166
        }
166
        }
167
 
167
 
168
        // If nothing worked, we will try to find a PARM resource (MacOS plugin, or 64 bit 8BF on Win32 OS)
168
        // If nothing worked, we will try to find a PARM resource (MacOS plugin, or 64 bit 8BF on Win32 OS)
169
        // Note that we cannot detect obfuscated filters here!
169
        // Note that we cannot detect obfuscated filters here!
170
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
170
        if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
171
                if (0 == (res = readfile_8bf(sfr))) {
171
                if (LOADING_OK == (res = readfile_8bf(sfr))) {
172
                        if (gdata->parm.iProtected) {
172
                        if (gdata->parm.iProtected) {
173
                                // This is for purely protected filters before the time when obfuscation and protection was merged
173
                                // This is for purely protected filters before the time when obfuscation and protection was merged
174
                                parm_reset(true, true, true, true);
174
                                parm_reset(true, true, true, true);
175
                                res = MSG_FILTER_PROTECTED_ID;
175
                                res = MSG_FILTER_PROTECTED_ID;
176
                        }
176
                        }