Skip to content

Commit

Permalink
make it work with exedit.auf with English patch
Browse files Browse the repository at this point in the history
  • Loading branch information
oov committed Jul 31, 2021
1 parent f33ed5b commit 6bdb197
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/lazarus/main.pas
Expand Up @@ -14,6 +14,7 @@ interface

TGCMZDrops = class
private
FErrorOnInitialize: WideString;
FEntry: TFilterDLL;
FExEdit, FCurrentFilterP: PFilter;
FCurrentEditP: Pointer;
Expand Down Expand Up @@ -103,7 +104,6 @@ implementation
PluginName = 'ごちゃまぜドロップス';
PluginNameANSI = #$82#$b2#$82#$bf#$82#$e1#$82#$dc#$82#$ba#$83#$68#$83#$8d#$83#$62#$83#$76#$83#$58;
PluginInfoANSI = PluginNameANSI + ' ' + Version;
ExEditNameANSI = #$8a#$67#$92#$a3#$95#$d2#$8f#$57; // '拡張編集'
DefaultSaveDir = '%PROJECTDIR%';

const
Expand Down Expand Up @@ -232,6 +232,10 @@ function SetClientSize(Window: THandle; Width, Height: integer): BOOL;
function TGCMZDrops.MainProc(Window: HWND; Message: UINT; WP: WPARAM;
LP: LPARAM; Edit: Pointer; Filter: PFilter): integer;
const
ExEditNameANSI = #$8a#$67#$92#$a3#$95#$d2#$8f#$57;
// '拡張編集'
ExEditENPatchedNameANSI = 'Advanced Editing';

ExTextNameANSI = #$8e#$9a#$96#$8b#$83#$41#$83#$56#$83#$58#$83#$67;
// '字幕アシスト'
AulsTransparenceNameANSI = #$8a#$67#$92#$a3#$95#$d2#$8f#$57#$82#$f0#$94#$bc#$93#$a7#$96#$be#$89#$bb;
Expand Down Expand Up @@ -259,7 +263,7 @@ function TGCMZDrops.MainProc(Window: HWND; Message: UINT; WP: WPARAM;
for Y := 0 to sinfo.FilterN - 1 do
begin
fp := Filter^.ExFunc^.GetFilterP(Y);
if (fp = nil) or (fp^.Name <> ExEditNameANSI) then
if (fp = nil) or ((fp^.Name <> ExEditNameANSI) and (fp^.Name <> ExEditENPatchedNameANSI)) then
continue;
FExEdit := fp;
break;
Expand Down Expand Up @@ -327,7 +331,7 @@ function TGCMZDrops.MainProc(Window: HWND; Message: UINT; WP: WPARAM;
SetClientSize(Window, 8 + 400 + 8, Y + 8);

try
if not Assigned(FExEdit) then
// if not Assigned(FExEdit) then
raise Exception.Create(
'拡張編集プラグインが見つかりません。');

Expand Down Expand Up @@ -381,11 +385,10 @@ function TGCMZDrops.MainProc(Window: HWND; Message: UINT; WP: WPARAM;
SetWindowTextW(Window,
PWideChar(WideString(PluginName +
' - 初期化に失敗したため使用できません')));
MessageBoxW(FExEdit^.Hwnd,
PWideChar(PluginName +
' の初期化中にエラーが発生しました。'#13#10#13#10 +
WideString(E.Message)),
PWideChar('初期化エラー - ' + PluginName), MB_ICONERROR);

// It seems that an error occurs in some plugins when use MessageBox at this timing.
FErrorOnInitialize := WideString(E.Message);
PostMessage(FWindow, WM_GCMZCOMMAND, 2, 0);
end;
end;

Expand Down Expand Up @@ -560,6 +563,9 @@ function TGCMZDrops.MainProc(Window: HWND; Message: UINT; WP: WPARAM;
case WP of
0: Result := CmdAdvanceFrame(integer(LP));
1: Result := CmdUpdateMappedData(LP <> 0);
2: MessageBoxW(Window,
PWideChar(PluginName + ' の初期化中にエラーが発生しました。'#13#10#13#10 + FErrorOnInitialize),
PWideChar('初期化エラー - ' + PluginName), MB_ICONERROR);
end;
end;
WM_GCMZDROP_APIDEFER: begin
Expand Down

0 comments on commit 6bdb197

Please sign in to comment.