0

Basically, I'm writing a UI mod for the game.

Is supports loading swf files to manipulate UI.

I already have created a fla with AS3 project with text area, that acts like a logger and prints all the stuff I need, the problem is that I have no way to extract data from there.

I've tried:

  1. Clipboard with and without MouseEvent (as it is mentioned in documentation) - it doesn't work.

Clipboard.generalClipboard.formats return an empty array.

Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, 'myData') does literally nothing (with and without serialization).

  1. Writing to file throws an exception, error code is different, based on approach (1001, 1006, etc., don't remember exactly)

  2. Sending HTTP request fails on ioerrorevent 1006

  3. Trying to connect to local DB - MySQL or SQLite also fails

I assume that all of those issues somehow are blocked by the game itself to prevent modders exposing essential data.

The problem is also that literally there are no documentation and most of mod authors don't use interaction with file system and/or http requests.

Those modders who were able to write to file - either ignore or are offline for months.

So, the question: Is there any way to expose some data from the game? Literally anything, that will be working will fit my needs.

For those, who are curious - I want to write a market place for selling in-game items (just for in-game currency) and make my work open-source, once it's done.

Just in case - using any of those approaches in the IDE itself works fine, so I guess it's being blocked by the game somehow.

I had an idea of some kind dll injection or whatever, but google says it's impossible.

SWF file is loaded in runtime in the game..

UPD:

I'm pretty new to ActionScript and Flash itself, literally this is my very first pet project.

None of the AIR is available. For my very first test I've decompiled already created mod and made some custom modification (e.g. renamed text, just to make sure that is works).

Compilation is performed via Adobe Flash CS6, I'm opening FLA file and use publish with FlashPlayer 11.2 and AS3.

Then, compiled swf is bundled in special archive(as it is required by the game) and that's it. Mod is working, but I'm unable to extract the data withing the game itself. Anything that will let me grab the data into the file, clipboard, database, send a socket request, etc. will work for my purpose.

I also have tried compiling with option to access local only and network only - everytime the same thing, for:

  • http I get an IOError, smth like [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2031: Socket Error. URL: http://localhost:4567/testEndpoint?test=myTestData"] - if running application withing Adobe Flash it works perfectly; if running as part of the mod, loaded in the game - nope
  • file just unable to use, since it's part of the of AIR
  • socket - I was able sometimes get file police request on the backend and responded to it as it was mentioned in documentation and then - just nothing comes to the socket
  • database literally doesn't work, I was using pretty old libraries, I've found on github
  • Clipboard - Clipboard.generalClipboard.setData - does nothing; System.setClipboard() - does nothing, no errors at all
  • fscommand('exec', 'sample.exe') - just in case tried, according to documentation - doesn't work (put exe file in the fscommand directory right near executable and mod itself, just in case)

I've also added this:

Security.allowDomain("*");
Security.allowInsecureDomain("*");

The dxgi.dll approach mentioned in the comments works with tons of pain, but it could be the reason why game crashes very often, so I'm afraid, I won't be able to pass mod check before publishing.

So basically I'm out of ideas.

Would appreciate any help on this.

Just in case - there is totally no documentation how to mod the game...

  • Just a bit of thought. I think that game you mentioned provide a custom Flash Player build where they de-select certain classes and capabilities. You an official documentation from the game with all (un)supported features listed. Alternately, if you have any access to the mod with file-writing capability, you can (I can't believe I'm suggesting this) de-compile their SWF and look up for the classes/code they use to write a file. – Organis Jul 23 '20 at 23:38
  • That's thee problem - there is no documentation at all. Officially modding is announced, that it will be launched sometime this year, but the possibility itself already exists with o documentation. I've already dig into all of the swf files (mostly all the UI built on top of them) and there is nothing special or any limitations, so might be it's limited somewhere in a different place, First thing - I've contacted author of the mod that writes to file, it uses some modified dxgi.dll and has no idea how to use it, since writing part was done by a different one, who is gone now. too complicated – Serhii Daskaliesku Jul 24 '20 at 00:18
  • @SerhiiDaskaliesku It's not clear... Did you create the (logger) text area yourself or it is part of some other imported SWF? **(1)** If created, when it has logged all the data you need why not just put the `textArea.text` content into some other var like String and use as needed? (_eg:_ save to disk). **(2)** If imported, you could try finding out (maybe through a decompiler?) the var (or _instance_) name of the text area and then extract with some path like `myString = myLoadedSWF.textArea.text;` ... – VC.One Jul 24 '20 at 07:54
  • @VC.One here is the [gist](https://gist.github.com/sdaskaliesku/61b923bb4febe207547632b38fce1217) MyMod - actually simple mod with single text field as logger, it works perfectly. second one - it's part of the main SWF file, which loads custom(user's) swf files and it works for me in any case except setting data into clipboard, while loaded my mod in game (regular run of my swf works as I expect). The same applies to all other approaches I've been using - db, http, file - nothing works when it's loaded into the parent swf. – Serhii Daskaliesku Jul 24 '20 at 10:12
  • To clarify - I decompile parent SWF into as files and fla file, make needed changes and compile it back to swf. I've done this first time with already created mod just to check whether it works and yep it works, so I don't think the problem is here... – Serhii Daskaliesku Jul 24 '20 at 10:14
  • Didn't you think about putting your mod into the main SWF instead? Loading can put additional restrictions on the external SWF. – Organis Jul 24 '20 at 13:59
  • Same thing, doesn't work :( I'm testing just on clipboard, but literally ANY option extract some specific the data from game in runtime will work. – Serhii Daskaliesku Jul 24 '20 at 14:22

1 Answers1

0

This an extended comment regarding your shown example code.

First test the simplest possible way to get text from the mylogger variable (without clipboard).

Create and run some function extract_LoggerText(); whenever it's needed to bring myLogger text into your String.

Try adjusting BasicModLoader.as like below example :

import flash.display.Loader;
 ...      

public var __myModLoader :Loader;
public var loadedSWF :MovieClip;
public var myString :String = "";  

public function ModLoaderCtr()
{
    ....
    
    __myModLoader = new Loader();
    __myModLoader.addEventListener(Event.COMPLETE, on_SWFLoadComplete);
    __myModLoader.load(new URLRequest("MyAwesomeMod.swf"),new LoaderContext(false,ApplicationDomain.currentDomain));
    //__myModLoader.load( new URLRequest("MyAwesomeMod.swf") ); //# or try basic without ApplicationDomain
}

public function on_SWFLoadComplete (evt:Event)
{   
    loadedSWF = MovieClip(evt.target.content);
    addChild(loadedSWF);
    
    //extract_LoggerText(); //# run this function later when logger has some text content...
}

public function extract_LoggerText() : void
{
    myString = loadedSWF.myLogger.text;
    trace ( " Extracted Text Check : \n" + myString ); //# should be logger text here
}
VC.One
  • 14,790
  • 4
  • 25
  • 57
  • Thanks for your input! Yeah, I was able to receive child's props in parent, but still none of the extracting data options doesn't work. I found a guy, who has written custom `dxdi.dll` file with sockets and file writing for those purposes, in runtime his dll upon loading searches all root scenes for the special named variable and injects actual logic there. At the moment it is the only working option.. – Serhii Daskaliesku Jul 29 '20 at 18:01
  • Unfortunately this is way too complicated. There are tons of swf files which load in runtime another and that one loads another again and so on... Literally I've tried everything I could thought about - while starting a simple application in Adobe Flash everything works perfectly, but once it's being loaded in the game as a mod - nothing works, I guess: somehow all http requests are forbidden; clipboard disabled and so on. If that's true - could this be done withing an swf file? Are there any workarounds? I've also tried all of mentioned action in parent swf - same thing, doesn't work – Serhii Daskaliesku Jul 31 '20 at 12:26