/trunk/TODO.md |
---|
75,8 → 75,6 |
* Let PIPL have resource ID 16 instead of 16000, so that other apps might be able to recognize it as Filter Factory plugin? |
* Make Filter Foundry ready for translations? In Windows, put all strings in string lists (resources, `LoadStringA`), as well as in Mac resources. |
* Should the compiler flags in `funcs.h` as well as settings like `use_plugin_dll_sliders` be placed as resource (binary bits), so that the behavior can be changed if required? |
/trunk/load_win.c |
---|
69,7 → 69,7 |
deobfusc(copy); |
res = readPARM(&gdata->parm, (Ptr)copy); |
if (!res) { |
*reason = FF_GetMsg_Cpy(MSG_INCOMPATIBLE_OBFUSCATION_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
if (reason) *reason = FF_GetMsg_Cpy(MSG_INCOMPATIBLE_OBFUSCATION_ID); |
} |
free(copy); |
gdata->obfusc = true; |
87,15 → 87,16 |
Boolean loadfile(StandardFileReply* sfr, TCHAR** reason) { |
HMODULE hm; |
TCHAR* reasonstr; |
// The different read-functions will return true if the resource was successfully loaded, |
// or false otherwise. If *reason is set, then the answer is clearly "No". If the result |
// is just false, it means that the program should continue with the next read-function. |
*reason = NULL; |
reasonstr = NULL; |
// First, try to read the file as AFS/PFF/TXT file |
if (*reason == NULL) { |
if (readfile_afs_pff(sfr, reason)) { |
if (reasonstr == NULL) { |
if (readfile_afs_pff(sfr, &reasonstr)) { |
gdata->obfusc = false; |
gdata->parmloaded = false; |
return true; |
103,11 → 104,11 |
} |
// If that didn't work, try to load as Windows image file (Resource API for 8BF/PRM files) |
if (*reason == NULL) { |
if (reasonstr == NULL) { |
if (hm = LoadLibraryEx(sfr->sfFile.szName, NULL, LOAD_LIBRARY_AS_DATAFILE)) { |
if (readPARMresource(hm, reason)) { |
if (readPARMresource(hm, &reasonstr)) { |
if (gdata->parm.iProtected) { |
*reason = FF_GetMsg_Cpy(MSG_FILTER_PROTECTED_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
reasonstr = FF_GetMsg_Cpy(MSG_FILTER_PROTECTED_ID); |
//gdata->parmloaded = false; |
} |
else { |
121,8 → 122,8 |
} |
// Is it a "Filters Unlimited" filter? (Only partially compatible with Filter Factory!!!) |
if (*reason == NULL) { |
if (readfile_ffx(sfr, reason)) { |
if (reasonstr == NULL) { |
if (readfile_ffx(sfr, &reasonstr)) { |
gdata->parmloaded = true; |
return true; |
} |
129,8 → 130,8 |
} |
// Is it a "Filters Unlimited" filter? (Only partially compatible with Filter Factory!!!) |
if (*reason == NULL) { |
if (readfile_picotxt(sfr, reason)) { |
if (reasonstr == NULL) { |
if (readfile_picotxt(sfr, &reasonstr)) { |
gdata->parmloaded = true; |
return true; |
} |
138,11 → 139,11 |
// If nothing worked, we will try to find a PARM resource (MacOS plugin, or 64 bit 8BF on Win32 OS) |
// Note that we cannot detect obfuscated filters here! |
if (*reason == NULL) { |
if (readfile_8bf(sfr, reason)) { |
if (reasonstr == NULL) { |
if (readfile_8bf(sfr, &reasonstr)) { |
if (gdata->parm.iProtected) { |
// This is for purely protected filters before the time when obfuscation and protection was merged |
*reason = FF_GetMsg_Cpy(MSG_FILTER_PROTECTED_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
reasonstr = FF_GetMsg_Cpy(MSG_FILTER_PROTECTED_ID); |
} |
else { |
gdata->parmloaded = true; |
153,8 → 154,11 |
// We didn't had success. If we have a clear reason, return false and the reason. |
// If we don't have a clear reason, set a generic reason and return false. |
if (*reason == NULL) { |
*reason = FF_GetMsg_Cpy(MSG_LOADFILE_UNKNOWN_FORMAT_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
if (reasonstr == NULL) { |
reasonstr = FF_GetMsg_Cpy(MSG_LOADFILE_UNKNOWN_FORMAT_ID); |
} |
if (reason) *reason = reasonstr; |
return false; |
} |
/trunk/main.c |
---|
203,7 → 203,6 |
void ENTRYPOINT(short selector, FilterRecordPtr pb, intptr_t *data, short *result){ |
static Boolean wantdialog = false; |
static Boolean premiereWarnedOnce = false; |
TCHAR*reason; |
#ifdef SHOW_HOST_DEBUG |
char* tmp; |
312,7 → 311,7 |
gdata = (globals_t*)malloc(sizeof(globals_t)); |
if (!gdata) break; |
gdata->hWndMainDlg = (HWND)((PlatformData*)((AboutRecordPtr)pb)->platformData)->hwnd; // so that simplealert() works |
gdata->standalone = gdata->parmloaded = readPARMresource((HMODULE)hDllInstance,&reason); |
gdata->standalone = gdata->parmloaded = readPARMresource((HMODULE)hDllInstance, NULL); |
if (gdata->parmloaded && (gdata->parm.cbSize != PARM_SIZE) && (gdata->parm.cbSize != PARM_SIZE_PREMIERE) && (gdata->parm.cbSize != PARM_SIG_MAC)) { |
if (gdata->obfusc) { |
simplealert_id(MSG_INCOMPATIBLE_OBFUSCATION_ID); |
449,7 → 448,6 |
} |
int checkandinitparams(Handle params){ |
TCHAR*reasonstr,*reason; |
int i; |
Boolean bUninitializedParams; |
Boolean showdialog; |
468,7 → 466,7 |
// We need to set gdata->standalone after loadfile(), but we must call readPARMresource() before loadfile() |
// Reason: readPARMresource() reads parameters from the DLL while loadfile() reads parameters from the AFS file |
// But loadfile() will reset gdata->standalone ... |
isStandalone = readPARMresource((HMODULE)hDllInstance, &reason); |
isStandalone = readPARMresource((HMODULE)hDllInstance, NULL); |
if (isStandalone && (gdata->parm.cbSize != PARM_SIZE) && (gdata->parm.cbSize != PARM_SIZE_PREMIERE) && (gdata->parm.cbSize != PARM_SIG_MAC)) { |
if (gdata->obfusc) { |
simplealert_id(MSG_INCOMPATIBLE_OBFUSCATION_ID); |
495,7 → 493,7 |
} |
} |
if (loadfile(&sfr, &reason)) { |
if (loadfile(&sfr, NULL)) { |
gdata->standalone = gdata->parmloaded = isStandalone; |
if (isStandalone) { |
509,12 → 507,12 |
} |
} |
if( (bUninitializedParams = !(params && readparams_afs_pff(params,&reasonstr))) ){ |
if( (bUninitializedParams = !(params && readparams_afs_pff(params, NULL))) ){ |
/* either the parameter handle was uninitialised, |
or the parameter data couldn't be read; set default values */ |
// see if saved parameters exist |
gdata->standalone = gdata->parmloaded = readPARMresource((HMODULE)hDllInstance,&reason); |
gdata->standalone = gdata->parmloaded = readPARMresource((HMODULE)hDllInstance, NULL); |
if (gdata->parmloaded && (gdata->parm.cbSize != PARM_SIZE) && (gdata->parm.cbSize != PARM_SIZE_PREMIERE) && (gdata->parm.cbSize != PARM_SIG_MAC)) { |
if (gdata->obfusc) { |
simplealert_id(MSG_INCOMPATIBLE_OBFUSCATION_ID); |
/trunk/make.c |
---|
280,7 → 280,7 |
strcpy(tmp, str); |
*aeteptr = (void*)((unsigned char*)tmp + strlen(str)); |
} |
#define AETE_WRITE_C2PSTR(s) _aete_write_c2pstr(&aeteptr, (s)); |
#define AETE_WRITE_C2PSTR(s) _aete_write_c2pstr(&aeteptr, (char*)(s)); |
void _aete_write_p2pstr(void** aeteptr, char* str) { |
char* tmp; |
323,7 → 323,7 |
AETE_ALIGN_WORD(); |
AETE_WRITE_DWORD(key); |
AETE_WRITE_DWORD(typeSInt32); |
AETE_WRITE_C2PSTR(_strdup("")); |
AETE_WRITE_C2PSTR(""); |
AETE_ALIGN_WORD(); |
AETE_WRITE_WORD(0x8000); /* FLAGS_1_OPT_PARAM / flagsOptionalSingleParameter */ |
} |
355,7 → 355,7 |
AETE_WRITE_WORD(1); /* 1 suite */ |
{ |
AETE_WRITE_C2PSTR(pparm->szAuthor); /* vendor suite name */ |
AETE_WRITE_C2PSTR(_strdup("")); /* optional description */ |
AETE_WRITE_C2PSTR(""); /* optional description */ |
AETE_ALIGN_WORD(); |
AETE_WRITE_DWORD(plugInSuiteID); /* suite ID */ |
AETE_WRITE_WORD(1); /* suite code, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */ |
363,18 → 363,18 |
AETE_WRITE_WORD(1); /* 1 event (structure for filters) */ |
{ |
AETE_WRITE_C2PSTR(pparm->szTitle); /* event name */ |
AETE_WRITE_C2PSTR(_strdup("")); /* event description */ |
AETE_WRITE_C2PSTR(""); /* event description */ |
AETE_ALIGN_WORD(); |
AETE_WRITE_DWORD(plugInClassID); /* event class */ |
AETE_WRITE_DWORD(/*plugInEventID*/event_id); /* event ID */ |
/* NO_REPLY: */ |
AETE_WRITE_DWORD(noReply); /* noReply='null' */ |
AETE_WRITE_C2PSTR(_strdup("")); /* reply description */ |
AETE_WRITE_C2PSTR(""); /* reply description */ |
AETE_ALIGN_WORD(); |
AETE_WRITE_WORD(0); |
/* IMAGE_DIRECT_PARAM: */ |
AETE_WRITE_DWORD(typeImageReference); /* typeImageReference='#ImR' */ |
AETE_WRITE_C2PSTR(_strdup("")); /* direct parm description */ |
AETE_WRITE_C2PSTR(""); /* direct parm description */ |
AETE_ALIGN_WORD(); |
AETE_WRITE_WORD(0xB000); |
391,35 → 391,35 |
{ |
// Standalone filters don't need RGBA expressions |
/* |
AETE_WRITE_C2PSTR(_strdup("R")); |
AETE_WRITE_C2PSTR("R"); |
AETE_ALIGN_WORD(); |
AETE_WRITE_DWORD(PARAM_R_KEY); |
AETE_WRITE_DWORD(typeText); |
AETE_WRITE_C2PSTR(_strdup("R channel expression")); |
AETE_WRITE_C2PSTR("R channel expression"); |
AETE_ALIGN_WORD(); |
AETE_WRITE_WORD(0x8000); |
AETE_WRITE_C2PSTR(_strdup("G")); |
AETE_WRITE_C2PSTR("G"); |
AETE_ALIGN_WORD(); |
AETE_WRITE_DWORD(PARAM_G_KEY); |
AETE_WRITE_DWORD(typeText); |
AETE_WRITE_C2PSTR(_strdup("G channel expression")); |
AETE_WRITE_C2PSTR("G channel expression"); |
AETE_ALIGN_WORD(); |
AETE_WRITE_WORD(0x8000); |
AETE_WRITE_C2PSTR(_strdup("B")); |
AETE_WRITE_C2PSTR("B"); |
AETE_ALIGN_WORD(); |
AETE_WRITE_DWORD(PARAM_B_KEY); |
AETE_WRITE_DWORD(typeText); |
AETE_WRITE_C2PSTR(_strdup("B channel expression")); |
AETE_WRITE_C2PSTR("B channel expression"); |
AETE_ALIGN_WORD(); |
AETE_WRITE_WORD(0x8000); |
AETE_WRITE_C2PSTR(_strdup("A")); |
AETE_WRITE_C2PSTR("A"); |
AETE_ALIGN_WORD(); |
AETE_WRITE_DWORD(PARAM_A_KEY); |
AETE_WRITE_DWORD(typeText); |
AETE_WRITE_C2PSTR(_strdup("A channel expression")); |
AETE_WRITE_C2PSTR("A channel expression"); |
AETE_ALIGN_WORD(); |
AETE_WRITE_WORD(0x8000); |
*/ |
/trunk/read.c |
---|
54,7 → 54,6 |
q = curexpr; |
linecnt = exprcnt = lineptr = 0; |
//*reason = _strdup("File was too short."); // TODO (Not so important): TRANSLATE |
while(p < dataend){ |
c = *p++; |
70,7 → 69,8 |
/* process complete line */ |
if(linecnt==0){ |
if(strcmp(linebuf,"%RGB-1.0")){ |
// *reason = _strdup("This doesn't look like a Filter Factory file (first line is not \"%RGB-1.0\")."); // TODO (Not so important): TRANSLATE |
// Note: We don't set *reason, because we cannot be sure if it is a valid file in regards to a different data type |
// We only set *Reason, if we are sure that it is an AFS file which is indeed wrong. |
break; |
} |
}else if(linecnt<=8){ |
84,7 → 84,7 |
/* it's not an empty line; append it to current expr string */ |
if( q+lineptr > curexpr+MAXEXPR ){ |
// TODO: isn't the limit 1024?! (because we need to have the NUL too?) |
*reason = FF_GetMsg_Cpy(MSG_EXPRESSION1024_FOUND_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
if (reason) *reason = FF_GetMsg_Cpy(MSG_EXPRESSION1024_FOUND_ID); |
break; |
} |
q = cat(q,linebuf); |
94,7 → 94,7 |
free(expr[exprcnt]); |
*q = 0; |
if(!(expr[exprcnt] = my_strdup(curexpr))){ |
*reason = FF_GetMsg_Cpy(MSG_EXPRESSION_OOM_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
if (reason) *reason = FF_GetMsg_Cpy(MSG_EXPRESSION_OOM_ID); |
break; |
} |
351,7 → 351,7 |
} // else no point in proceeding |
FSClose(refnum); |
}else |
*reason = FF_GetMsg_Cpy(MSG_CANNOT_OPEN_FILE_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
if (reason) *reason = FF_GetMsg_Cpy(MSG_CANNOT_OPEN_FILE_ID); |
if (res) gdata->obfusc = false; |
return res; |
816,7 → 816,7 |
FSClose(r); |
} |
else |
*reason = FF_GetMsg_Cpy(MSG_CANNOT_OPEN_FILE_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
if (reason) *reason = FF_GetMsg_Cpy(MSG_CANNOT_OPEN_FILE_ID); |
return res; |
} |
/trunk/save.c |
---|
90,7 → 90,7 |
p = cat(p,outbuf); |
} |
else |
p = cat(p,_strdup("(null expr)\r")); // this shouldn't happen |
p = cat(p,(char*)("(null expr)\r")); // this shouldn't happen |
*p++ = CR; |
} |
252,12 → 252,14 |
} |
FSClose(r); |
}else reasonstr = FF_GetMsg_Cpy(MSG_CANNOT_OPEN_FILE_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
else reasonstr = FF_GetMsg_Cpy(MSG_CANNOT_CREATE_FILE_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()... |
}else reasonstr = FF_GetMsg_Cpy(MSG_CANNOT_OPEN_FILE_ID); |
else reasonstr = FF_GetMsg_Cpy(MSG_CANNOT_CREATE_FILE_ID); |
if (!res) { |
alertuser_id(MSG_CANNOT_SAVE_SETTINGS_ID, reasonstr); |
} |
if (reasonstr) FF_GetMsg_Free(reasonstr); |
return res; |
} |
/trunk/ui.c |
---|
343,7 → 343,7 |
StandardFileReply sfr; |
NavReplyRecord reply; |
static OSType types[] = {TEXT_FILETYPE,PS_FILTER_FILETYPE}; |
TCHAR*reason; |
TCHAR*reason = NULL; |
HINSTANCE hShellRes; |
InternalState bakState; |
411,7 → 411,7 |
loadDlgRet = !gdata->standalone && choosefiletypes( |
#ifdef MAC_ENV |
(StringPtr)_strdup("\pChoose filter settings"), // "\p" means "Pascal string" // TODO (Not important yet): TRANSLATE |
"\pChoose filter settings", // "\p" means "Pascal string" // TODO (Not important yet): TRANSLATE |
&sfr, &reply, types, 2, |
filters |
#else |
437,6 → 437,7 |
// Restore |
restoreInternalState(bakState); |
} |
if (reason) FF_GetMsg_Free(reason); |
} |
break; |
} |
478,8 → 479,8 |
saveDlgRet = !gdata->standalone && putfile( |
#ifdef MAC_ENV |
(StringPtr)_strdup("\pSave filter settings"), // "\p" means "Pascal string" // TODO (Not important yet): TRANSLATE |
(StringPtr)_strdup("\0"), |
"\pSave filter settings", // "\p" means "Pascal string" // TODO (Not important yet): TRANSLATE |
"\0", |
TEXT_FILETYPE, SIG_SIMPLETEXT, &reply, &sfr, |
"afs", |
filters, 1 |
/trunk/ui_build.c |
---|
281,8 → 281,8 |
makeDlgRet = putfile( |
#ifdef MAC_ENV |
(StringPtr)_strdup("\pMake standalone filter"), // "\p" means "Pascal string" // TODO (Not important yet): TRANSLATE |
(StringPtr)myc2pstr(_strdup(fname)), |
"\pMake standalone filter", // "\p" means "Pascal string" // TODO (Not important yet): TRANSLATE |
myc2pstr(_strdup(fname)), // TODO: memory leak? |
PS_FILTER_FILETYPE, kPhotoshopSignature, &reply, &sfr, |
"8bf", &filters[0], 1 |
#else |