Skip to content

fix: re-introducing the removed TTarget target properties#565

Open
Torwent wants to merge 1 commit into
Villavu:simba2000from
WaspScripts:TTarget
Open

fix: re-introducing the removed TTarget target properties#565
Torwent wants to merge 1 commit into
Villavu:simba2000from
WaspScripts:TTarget

Conversation

@Torwent

@Torwent Torwent commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I've done this from scratch without following the original so I'm not sure if I did this in a way you would like @ollydev so feel free to edit to your liking or just redo the whole thing.

I'm also not sure if the TTarget.ImageTarget I added makes much sense, but I did it for completion sake.
Personally I only need the Window, EIOS and Plugin.

I can imagine ESimbaTargetKind having some uses but I only bothered with the things I needed so I don't need to be parsing TTarget.ToString() anymore.

I also tested all target kinds and this seems to be working as I would expect but do review please

@Torwent

Torwent commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Test script if you want:

{$loadlib Plugins/wasp-plugins/libremoteinput/libremoteinput}

var
  trgt: Pointer;
  winTrgt: TWindowHandle;
  canvas: TExternalCanvas;  
  pid: TProcessID;

procedure InjectNPair();
var
  timer: TCountDown;
begin
  winTrgt := GetSimbaTargetWindow();
  pid := winTrgt.GetPID();
  RIInject(pid);

  timer.Start(2000);
  repeat
    trgt := EIOS_PairClient(pid);
    if trgt <> nil then
      Break;
    Sleep(100);
  until timer.IsFinished;
end;

procedure PrintTargetInfo();
begin
  WriteLn Target.ToString();
  WriteLn Target.WindowTarget;
  WriteLn Target.ImageTarget;
  WriteLn Target.EIOSTarget;
  WriteLn Target.PluginTarget;
  WriteLn('TARGET: ', trgt);
  WriteLn('WINDOW: ', winTrgt);
end;

var
  img: TImage;
begin
  img := new TImage(500, 500);
  InjectNPair();

  SetWriteColor($00FFFF);
  WriteLn('Window: ');
  PrintTargetInfo();

  Target.SetImage(img);
  SetWriteColor($0000FF);
  WriteLn(LINE_SEP, 'Image: ');
  PrintTargetInfo();

  Target.SetEIOS({$MACRO LOADEDLIB(libremoteinput)}, ToStr(pid));
  SetWriteColor($FF0000);
  WriteLn(LINE_SEP, 'EIOS: ');
  PrintTargetInfo();


  Target.SetPlugin({$MACRO LOADEDLIB(libremoteinput)}, ToStr(pid), canvas);
  SetWriteColor($FFFF00);
  WriteLn(LINE_SEP, 'Plugin: ');
  PrintTargetInfo();
end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant