BenLand100 / SMART

SMART Minimizing Autoing Resource Thing --- A tool to run the RuneScape Client in a sandbox
https://ben.land
GNU General Public License v3.0
55 stars 17 forks source link

See link... #4

Closed smithtrenton closed 12 years ago

smithtrenton commented 12 years ago

http://villavu.com/forum/showthread.php?p=1011389#post1011389

smithtrenton commented 12 years ago

Run this, I'm getting access errors: http://paste.villavu.com/raw/2836/

smithtrenton commented 12 years ago

Are we still required to write a wrapper for the Smart I/O functions(ie. SmartSendKeys)? I thought the EIOS functionality didn't require that.

BenLand100 commented 12 years ago

I'll look at this once 1) I'm done moving my stuff to a new apartment 2) presented my research at DAMO :|

BenLand100 commented 12 years ago

I looked at this briefly. To answer your question, no, you do not need to override anything when using EIOS. I think what is happening here is that lape's pugin interface is not passing strings correctly to plugin imported functions. Should notify those maintainers. If you wanted to test further, you could try a pre v7.1alpha EIOS version of SMART with pascalscript.

MerlijnWajer commented 12 years ago

Ben, doesn't the same happen with Pascalscript?

MerlijnWajer commented 12 years ago

Regardless, you should not pass Strings to FPC from C; why not just use PChar?

BenLand100 commented 12 years ago

Well, I can't open the link with the access violation script, so I don't really know what to test, but he mentioned the SmartSendKeys. However if he's using EIOS it shouldn't be using the plugin calling framework anyway. That being said, it's still probably related to strings.

BenLand100 commented 12 years ago

Further, are the same methods producing the same error for both of the links, or has the first link been resolved? Just because it causes an 'access violation' does not mean it's the same problem or even related.

smithtrenton commented 12 years ago

First error: It would get an access violation when a smart client was already spawned, on the SmartGetClients function. Second error: The access violation came on the second letter of anything it tried to type using EIOS.

BenLand100 commented 12 years ago

Is the first error solved now? For the second error, does it happen with anything else besides SendString? I'll build a version using PChar instead of String since I broke pascalscript compatibility anyway, and see if that fixes things. In the mean time, could you re-post that program that you pasted earlier? The link no longer works.

MerlijnWajer commented 12 years ago

On 22/05/12 19:27, Benjamin Land wrote:

Is the first error solved now? For the second error, does it happen with anything else besides SendString? I'll build a version using PChar instead of String since I broke pascalscript compatibility anyway, and see if that fixes things. In the mean time, could you re-post that program that you pasted earlier? The link no longer works.


Reply to this email directly or view it on GitHub: https://github.com/BenLand100/SMART/issues/4#issuecomment-5853268 Let me just point out that PascalScript supports PChar.

smithtrenton commented 12 years ago

http://pastebin.com/7aHhFvsM

BenLand100 commented 12 years ago

I cannot reproduce; the pasted code works fine for me. What version of Simba/SMART are you using?

smithtrenton commented 12 years ago

Smart from here, and the auto-build from that day. Let me try with today's build.

smithtrenton commented 12 years ago

It now works. Odd.

smithtrenton commented 12 years ago

Sidenote: both lape and ps work.

MerlijnWajer commented 12 years ago

:-)

smithtrenton commented 12 years ago

Getting this again. Running using lape and build 200 of simba.

http://pastebin.com/E6HW1pwZ

smithtrenton commented 12 years ago

To be more clear, it types whatever SendKeys() has as the string, then gives the access violation at SendKeys().

smithtrenton commented 12 years ago

Use this instead: http://pastebin.com/BG1aqt22

BenLand100 commented 12 years ago

Second link doesn't appear to function properly. Doesn't give an access violation but also doesn't seem to do anything useful, e.g. doesn't seem to invoke SMART with the appropriate arguments. I'll attempt to correct and diagnose the problem

BenLand100 commented 12 years ago

I changed the parameter grabbing function to the following. The test script did not use SendKeys, but I will add that in to test.

procedure GetSmartParams(var root,params: string);
var
  path: String;
  loc: integer;
begin
  path:= Between('<iframe id="game" src="', '" frameborder', GetPage('http://www.runescape.com/game.ws?j=1'));
  loc:= pos('runescape.com/',path);
  root:= Copy(path,0,loc+13);
  params:= Copy(path,loc+14,length(path)-loc+14);
  writeln(root)
  writeln(params);
end;
BenLand100 commented 12 years ago

The following main loop did not give any problems when tested on x86_64 linux

begin
  SetupSmart;
  SendKeys('LOL TEST',100,30);
end.

However, the same program failed to recognize that SMART was loaded in wine. When that check was removed, SendKeys did in fact produce an access violation. I'll look into this further

BenLand100 commented 12 years ago

Problem was not in SMART, but in Simba. https://github.com/MerlijnWajer/Simba/commit/3861cf96196ca4b0832ceb9656e28b03647c39df broke binary compatibility with EIOS_SendString which resulted in stack corruption and then the access violation. I adjusted SMART to use this new form, but it should be noted that EIOS methods should never break binary compatibility. Fixed in v7.1beta2