Rev 375 | Rev 511 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 375 | Rev 393 | ||
---|---|---|---|
Line 73... | Line 73... | ||
73 | { |
73 | { |
74 | RemoveResource(h); |
74 | RemoveResource(h); |
75 | 75 | ||
76 | DetachResource(hpipl); |
76 | DetachResource(hpipl); |
77 | 77 | ||
78 | PLstrcpy(title,gdata->parm.title); |
78 | myc2pstrcpy(title,gdata->parm.szTitle); |
79 | if(gdata->parm.popDialog) |
79 | if(gdata->parm.popDialog) |
80 | PLstrcat(title,"\pÉ"); |
80 | PLstrcat(title,"\pÉ"); |
81 | 81 | ||
82 | origsize = GetHandleSize(hpipl); |
82 | origsize = GetHandleSize(hpipl); |
83 | SetHandleSize(hpipl,origsize+0x300); /* some slop for fixup to work with */ |
83 | SetHandleSize(hpipl,origsize+0x300); /* some slop for fixup to work with */ |
Line 86... | Line 86... | ||
86 | HUnlock(hpipl); |
86 | HUnlock(hpipl); |
87 | SetHandleSize(hpipl,newsize); |
87 | SetHandleSize(hpipl,newsize); |
88 | 88 | ||
89 | AddResource(hpipl,'PiPL',16000,"\p"); |
89 | AddResource(hpipl,'PiPL',16000,"\p"); |
90 | 90 | ||
- | 91 | /* convert C strings to Pascal strings */ |
|
- | 92 | PARM_T pascal_parm = (PARM_T)malloc(sizeof(PARM_T)); |
|
- | 93 | memcpy(pascal_parm, gdata->parm, sizeof(PARM_T)); |
|
- | 94 | myc2pstr(pascal_parm->szCategory); |
|
- | 95 | myc2pstr(pascal_parm->szTitle); |
|
- | 96 | myc2pstr(pascal_parm->szCopyright); |
|
- | 97 | myc2pstr(pascal_parm->szAuthor); |
|
- | 98 | for (i = 0; i < 4; ++i) |
|
- | 99 | myc2pstr(pascal_parm->szMap[i]); |
|
- | 100 | for (i = 0; i < 8; ++i) |
|
- | 101 | myc2pstr(pascal_parm->szCtl[i]); |
|
- | 102 | ||
91 | if( !(e = ResError()) ){ |
103 | if( !(e = ResError()) ){ |
92 | /* do a similar trick with the terminology resource, |
104 | /* do a similar trick with the terminology resource, |
93 | so the scripting system can distinguish the standalone plugin */ |
105 | so the scripting system can distinguish the standalone plugin */ |
94 | 106 | ||
95 | if( (h = Get1Resource(typeAETE,AETE_ID)) ){ |
107 | if( (h = Get1Resource(typeAETE,AETE_ID)) ){ |
96 | SetHandleSize(h,4096); |
108 | SetHandleSize(h,4096); |
97 | HLock(h); |
109 | HLock(h); |
98 | newsize = aete_generate((unsigned char*)*h, &gdata->parm, event_id); |
110 | newsize = aete_generate((unsigned char*)*h, &pascal_parm, event_id); |
99 | HUnlock(h); |
111 | HUnlock(h); |
100 | SetHandleSize(h,newsize); |
112 | SetHandleSize(h,newsize); |
101 | 113 | ||
102 | ChangedResource(h); |
114 | ChangedResource(h); |
103 | 115 | ||
104 | if( !(e = ResError()) ){ |
116 | if( !(e = ResError()) ){ |
105 | /* add PARM resource */ |
117 | /* add PARM resource */ |
106 | if( !(e = PtrToHand(&gdata->parm,&h,sizeof(PARM_T))) ){ |
118 | if( !(e = PtrToHand(&pascal_parm,&h,sizeof(PARM_T))) ){ |
107 | if(gdata->obfusc){ |
119 | if(gdata->obfusc){ |
108 | HLock(h); |
120 | HLock(h); |
109 | obfusc((PARM_T*)*h); |
121 | obfusc((PARM_T*)*h); |
110 | HUnlock(h); |
122 | HUnlock(h); |
111 | parm_type = OBFUSCDATA_TYPE_NEW; |
123 | parm_type = OBFUSCDATA_TYPE_NEW; |
Line 130... | Line 142... | ||
130 | } |
142 | } |
131 | 143 | ||
132 | return e; |
144 | return e; |
133 | } |
145 | } |
134 | 146 | ||
135 | static int copyletters(char *dst,StringPtr src){ |
147 | static int copyletters(char *dst,char* src){ |
136 | int i, n; |
148 | int i, n; |
137 | 149 | ||
138 | for(i = src[0], n = 0; i--;) |
150 | for(i=0; i<strlen(src); ++i) { |
139 | if(isalpha(*++src)){ |
151 | if(isalpha(src[i])){ |
140 | *dst++ = *src; |
152 | *dst++ = src[i]; |
141 | ++n; |
153 | ++n; |
142 | } |
154 | } |
- | 155 | } |
|
- | 156 | ||
143 | return n; |
157 | return n; |
144 | } |
158 | } |
145 | 159 | ||
146 | // Info.plist in new standalone copy needs to be edited - |
160 | // Info.plist in new standalone copy needs to be edited - |
147 | // at least the CFBundleIdentifier property must be unique |
161 | // at least the CFBundleIdentifier property must be unique |
Line 165... | Line 179... | ||
165 | p += strlen(key); |
179 | p += strlen(key); |
166 | // store text after matched string |
180 | // store text after matched string |
167 | strcpy(save,p); |
181 | strcpy(save,p); |
168 | 182 | ||
169 | *p++ = '.'; |
183 | *p++ = '.'; |
170 | n = copyletters(p,gdata->parm.category); |
184 | n = copyletters(p,gdata->parm.szCategory); |
171 | p += n; |
185 | p += n; |
172 | if(n) *p++ = '.'; |
186 | if(n) *p++ = '.'; |
173 | m = copyletters(p,gdata->parm.title); |
187 | m = copyletters(p,gdata->parm.szTitle); |
174 | p += m; |
188 | p += m; |
175 | if(!m){ |
189 | if(!m){ |
176 | // generate a random ASCII identifier |
190 | // generate a random ASCII identifier |
177 | srand(TICKCOUNT()); |
191 | srand(TICKCOUNT()); |
178 | for(i = 8; i--;) |
192 | for(i = 8; i--;) |