1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Modding SDT itself? Decompiling for example

Discussion in 'Help' started by OneQuestion1, Dec 22, 2012.

  1. OneQuestion1

    OneQuestion1 Potential Patron

    Joined:
    Dec 19, 2012
    Messages:
    28
    Likes Received:
    0
    Hi all,

    I saw a thread with what appeared to be the source code of SDT, and I saw a few values I'd like to change just for personal enjoyment. I have a couple questions:

    The setting.txt file has some values that match variables inside the SDT architecture, does anyone know if you can change the value of any public static var value? I'd rather just make the values static so I can access them externally instead of manually having to dissect the file every time.

    Another question is if anyone knows how to decompile it successfully? I am using sothink's decompiler and it crashes when I try to export it into .fla and .as files.

    Note: If anyone could tell me how to change values of HER and HIM without decompiling that'd be great, I've been going at this blind and this was the first way that came to mind.

    Thanks!
     
  2. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    21
    1. If it's public static then surely it's just a class reference away?
    2. No point in this, use the modded SDT.swf with the loader, it has most things public.
    3. No point in this either, decompiling breaks things.
    4. Either write a loader, or hey, use the loader. Loader modding is fairly straightforward:

    Code:
    function initl(l){
    	var her = l.her; //l.eDOM.getDefinition("obj.Her");
    	her.var = value;
    	l.unloadMod();
    }
    That code will probably compile fine using AS3->AS3 SWF Compiler:
    http://superdeepthroat.ryonani.com/index.php?topic=2238.0
     
  3. Osakina

    Osakina Potential Patron

    Joined:
    Dec 11, 2012
    Messages:
    4
    Likes Received:
    2
    Coincidentally I have been messing around with SDT today, I wanted a way to use SDT the same way you can use the loader.

    By creating a blank .swf hair mod and running script from that I am able to get a list of every object in the game, the script is pretty simple

    Code:
    			var main:Object = root.stage;
    			printObjects(root.stage);
    			Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT,fps.text);
    		}
    		private function printObjects(main:Object):void
    		{
    			var parents:String = "";
    			var father:Object = main.parent;
    			while(father != null)
    			{
    				parents = father.name + "." + parents;
    				father = father.parent;
    			}
    			fps.appendText(parents + main.name + "\n");
    			for(var i:uint=0;i<main.numChildren;i++)
    			{
    				if(main.getChildAt(i) is Sprite)
    				{
    					printObjects(main.getChildAt(i));
    				}
    			}
    		}
    
    I don't really see a point in the loader really, you should be able to use "her" and "him" from SDT while loading swf files, however the names are private or something and show up instead as instance***

    After running the above script you get all the objects from SDT put onto your clipboard and it looks like this
    Code:
    null.root1.instance9.instance15.instance62.head.face
    null.root1.instance9.instance15.instance62.head.face.skull
    null.root1.instance9.instance15.instance62.head.face.nose
    null.root1.instance9.instance15.instance62.head.face.nose.tip
    null.root1.instance9.instance15.instance62.head.face.lipOutline
    null.root1.instance9.instance15.instance62.head.face.lipFill
    null.root1.instance9.instance15.instance62.head.face.lipShading
    null.root1.instance9.instance15.instance62.head.face.lipHighlight
    null.root1.instance9.instance15.instance62.head.face.lipHighlight.instance126
    Then after that I wrote a script to find the face object and store it as a variable so I could access it later, however I tried to attach a sprite to the face so I could draw freely on her face but the sprite is invisible and I cannot figure out how to make it visible.

    Adding the sprite to the stage makes it visible
    Adding the sprite to the face makes it invisible, however I know it's there because I had a script telling me when the mouse hit the face and I was able to hit the face from anywhere when I drew a huge circle with the sprite (still invisible though)
    I then added another sprite, this time to the stage which would just change its co-ords to the sprite I added to the face which you can see in the screen shots below.

     

    Attached Files:

  4. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    21
    No offence but your methods are incredibly tedious and won't last between versions.
    But if you're not interested in the loader I can't really help.
    What you're saying to me is that the loader is pointless, whilst at the same time you're reinventing it.

    Good luck.

    EDIT:

    1. You want to write a loader, and use SDT in the same way as the loader... without the loader. Sure k.
    2. This is only what's available on the stage. Objects like "g" will be a bit more difficult to access if not impossible this way.
    3. Loader exposes variable scope, establishes a standard for creating mods and provides a number of functions and objects for streamlining the process.
    4. You plan to search every object each time you want to access a new one? Hey, it it works then sure.
    5. Doesn't SDT still prevent the use of many variables and methods? If you just want to add objects then I must know why you want to do this.

    It may be a bit aggressive but I'm suspicious of this.
    Not to say you're the same guy as before, but there was someone trying to censor the game before, no doubt for monetary gain.
    As in: Here's a shit version of SDT, pay me for the full version.
    Once again I'm not accusing, but the strength of the unwillingness is really something else here.

    Go ahead and explain to me why you want to start modding from the very beginning and why you're so against the loader and I'll lend a hand.
     
  5. Osakina

    Osakina Potential Patron

    Joined:
    Dec 11, 2012
    Messages:
    4
    Likes Received:
    2
    No I don't, I was trying to say that it should just be SDT and the loader would become depreciated.
    SDT would be able to load mods and have an api like the loader.

    Although I haven't yet looked into it I am positive it would be possible a quick google search returns this
    http://stackoverflow.com/questions/640188/how-to-list-all-classes-contained-within-an-swf

    Initially I wanted to run a FPS counter (which I did) because I was getting a low fps and wanted to see what it was, I wanted to load it into SDT just incase there was some over head things (in the loader) that would alter the result between the loader and SDT.

    Then after doing that I was just messing around to see what I could do to increase the FPS, and then I remembered someone requesting drawing on her face, so I tried making that happen which is when I ran into problems.
    After posting yesterday I saw someone had decompiled the SDT swf and uploaded it on the forums so that will probably answer any questions if I feel like looking into modding again.

    btw my FPS is ~16 with all effects on, there's some interesting blogs about using bitmapdata and copy pixel over sprites where there was huge performance increases
    http://blog.ickydime.com/2008/05/sprite-vs-cached-bitmaps-for-game.html
     
  6. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    21
    1. Ah right, don't know why I missed your comment on that already.
    2. I was commenting on your looping through child objects method, this other method is not looping through children and in fact how the loader does it.

    EDIT:
    So you want to improve the performance of SDT via a mod?
    Good idea, but you'd just need to remove tons of stuff or convert it to cached data. Wouldn't that break the customization?
    You'd need to do something like...

    Loop through whatever objects and push them to an array.
    Customize character to whatever.
    For every item in your array: copy to bitmap data and store the serialized object data in something else for reverting.
     
  7. Osakina

    Osakina Potential Patron

    Joined:
    Dec 11, 2012
    Messages:
    4
    Likes Received:
    2
    That's pretty much what I had in mind, I might look into some tests later on.
     
  8. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    21
    Requested to look in to vanilla mods with a little more control, after a while of trying different things I got something working:

    Code:
    private function onFirstFrame(e:Event):void
    {
    	removeEventListener(Event.ENTER_FRAME, onFirstFrame);
    	if (this.parent.parent != null)
    	{
    		var SDT = this.parent.parent;
    		var eDOM;
    		if (SDT["loadedSWF"])
    		{
    			eDOM = SDT.eDOM;	//Loader Environment
    		}
    		else
    		{
    			eDOM = SDT.loaderInfo.applicationDomain;	//Vanilla Environment
    		}
    		var g = eDOM.getDefinition("g");
    		var her = g.her;
    		her.rightArmContainer.upperArmMask.visible=!her.rightArmContainer.upperArmMask.visible;
    	}
    	checkMod();
    }
    Toggles the pentagon of doom:
    http://superdeepthroat.ryonani.com/index.php?topic=3277.msg41492#msg41492

    Replace the onFirstFrame function inside of "ModPackage.as" when compiling a vanilla mod.
    Base:

    Code:
    private function onFirstFrame(e:Event):void
    {
    	removeEventListener(Event.ENTER_FRAME, onFirstFrame);
    	if (this.parent.parent != null)
    	{
    		var SDT = this.parent.parent;
    		var eDOM;
    		if (SDT["loadedSWF"])
    		{
    			eDOM = SDT.eDOM;	//Loader Environment
    		}
    		else
    		{
    			eDOM = SDT.loaderInfo.applicationDomain;	//Vanilla Environment
    		}
    	}
    	//Using eDOM.getDefinition("classPath"); to grab classes, do stuff here.
    	checkMod();
    }
     
  9. sclover13

    sclover13 Avid Affiliate

    Joined:
    Nov 29, 2012
    Messages:
    263
    Likes Received:
    25
    Thanks a million ModMan for picking this apart and putting it together for us modders, major appreciation! From reading the above I got the jist that this was a fix for vanilla (given there already being one for Loader), however, when implemented it the intended results did not show - saying, the pentagon of utter fail remained.

    Although, it did work magnificently in Loader as well as opened up a few new "easy edit" options.

    I have a feeling I may have done something wrong here, could you point me in the right direction? Thanks!
     
  10. Synonymous

    Synonymous Swell Supporter Content Creator

    Joined:
    Jul 23, 2012
    Messages:
    309
    Likes Received:
    22
    [​IMG]
    :o
    brb...
     
  11. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    21
    The weird thing is that the pentagon is actually not initialized until something is loaded.
    Try either loading another mod after your mod, or throwing that chunk of code in afterwards.
    Or if you're feeling crafty, add in a timer object or equivalent delay using setInterval.

    EDIT:

    Should probably note that you should use the first piece of code there and not the second. The second does nothing and is just a base.
    Given that the pentagon isn't implemented until something is loaded I figured that it would have no effect until it exists on stage.
    But then that doesn't make sense because the visible property should still apply, assuming no character shot is being taken (which undoes this property).