Junk Byte Code for Kicks


Flash-Console repo migrated to GitHub

The new report is @ https://github.com/junkbyte/flash-console

Wiki page formatting still needs work.

Filed under: Console, Console, Flash No Comments

Flash performance ranking ‘framework’

I am writing a simple framework which lets you score the performance of a given piece of code.

The motivation
A lot of the time when I am writing a piece of code that needs to perform really fast (due to it being called so many times per frame, etc) I struggle to figure out which approach is faster.
I am talking something very basic, such as do I use "for each (var num:uint in list)" or "for (var i:uint = 0; i < len; i++)" to loop through a list.

Filed under: Flash Continue reading

Faster Console graphing

New graphing panel seems to run 30 graph lines at 60fps (at least on my machine).
Try it here:
(The actual graph does not mean much to the sound)

Filed under: Console 5 Comments

ASDOC inside SWC

Just learned how to include asdoc inside swc so that it shows up in IDE
(tested with FlashBuilder).

Thanks to http://forums.adobe.com/thread/444791

Added a new console download: Console2.6+asdoc.swc



Console command prompt addon demo

Finally got time to do a simple demo of "CommandPrompt" addon.

I used this addon for a utility AIR app at my work.
The app is a simple command line where you choose what you want to do and it does stuff according to your choices.

Here is a simple greetings demo:
(your selections do not get recorded :)

Filed under: Console Continue reading

Flash String weirdness

A long time ago...

I had this bug report in Console that FPS and memory graph is leaking memory.
Issue: http://code.google.com/p/flash-console/issues/detail?id=89
I was not able to find the exact cause of this other than the fact that if I don't update texts in graph, it doesn't show any memory problems.
I suspected back then that Strings were strange but was not able to pin point what's strange about it.

Fast forward to today

I recently learned that flash keeps 'master string' of strings when they get passed around.
See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sampler/package.html#getMasterString()

For example, if you call String.substr(), the returned string will often actually be implemented as just a pointer into the original string, for the sake of efficiency. In normal usage, this is an implementation detail which is not visible to the user; however, it can be confusing when using a profiler to analyze your program's memory consumption, because the string may be shown as taking less memory than would be needed for the string's value. In addition, a string might be retained in memory solely because it is the master for other strings. getMasterString() allows profilers to show the user an accurate graph of string dependencies.

It sounds good, it is obviously saving memory by not copying the strings and reusing via referencing to original string where possible.

  • What if you only need to keep a tiny part of the string (say downloaded from an external file), will it know to discard the big string?
  • What if you chain a lot of strings together, will it keep references to all its parts?
  • Could it cause memory leaks?

Console 3.0 vs 2.x

This is weird. Still a lot of work left for Console 3.0 and a lot of feature ideas keeps popping up.

Wait till 3.0 or add additional 2.x versions, or addons...

I may go with add-ons for now.

Filed under: Console, Flash No Comments


Finding quite interesting stuff from flash.sampler.



May be adding some cool console addons which use those API.
I do not plan to compete with Flash Builder's profiler nor other profilers.
It will probably just add a few extra niche features others do not support.

Strange thing I find:

If a method has try catch statement, it generates 'NewObjectSample' with "[activation-object]" tag in the stack.
This is also why when using Flash Builder's profiler running an app with Flash Console, it traces many cumulative instances of 'Remoting' and 'Graphing'. Annoying.

Filed under: Console, Flash 6 Comments

How to piggyback Console into flash content on the web

What does it mean?

Add console into flash content that's on the web, letting you use console features as if it was your own.
Ofcourse you may not see logs unless it is hooked up, but you can still do other things such as Display roller, CommandLine, FPS / memory monitor. This is 'not a hack' but a trick, probably a security concern for a lot of the case...
Considering you can do this a lot easier with javascripts AND the fact that you can de-compile swf files, this particular method is not a massive security concern.

What can you do with it?

Mainly just out of curiosity.
Maybe you just want to know how things are structured, how good is the FPS , etc...

You can start the display roller 'RL' and see how the display list is constructed.
Capture the display list and start introspecting the properties and methods of classes.

If you know some of the code base (decompile the game?), you probably also know what classes there are, so you can access them live via console - and even modify values.

If your victim flash content have bad security checks on server end, you can probably hack it out to give your self many points / credit, etc. - or at least on that one session.


Console 3.0 is coming

Just thought I'll post an update about Console.

3.0 is coming with main focus on modularity.
It will make features to be more easily modified or added on top of base console.
No new out-of-the-box functionality will be added.

Replaceable base modules: (replaceable by sub-classing and registering to console)

  • ConsoleLogger - Handles formatting the logs,  add log processors to add custom log output formats
    • IConsoleLogProcessor - adds custom log entry formatting, example, if you want to underline effect on numbers when logging, you can create ConsoleNumberProcessor, which adds <u></u> around number types.
  • ConsoleLogs - Handles keeping logs history and channels
  • MainPanelModule - There will be sub modules under this to handle Menu, Logs and Commandline
  • ChannelsPanelModule
  • TooltipsModule

Modules that can be added:

  • Referencing - handles mapping references to objects via id, for use by other modules
  • CommandLine -  implement ICommandLine to replace behavior
  • Remoting  - implement IRemoting to replace behavior
  • KeyStates - can store the state of key presses, for use by other modules
  • KeyBinder - handles binding keys to function callbacks
  • DisplayRoller
  • RulerModule
  • TraceModule - call trace() on all logs
  • UncaughtErrorsListenerModule - logs when there are uncaught errors
  • UserDataModule - allows other modules to store user data (SharedObject)
  • StayOnTopModule - Keeps console on top
  • GarbageCollectModule - calls System.gc()
  • GarbageCollectionMonitor
  • InspectorModule - allows you to introspect in UI

Not everything is there yet and its very much under construction... The general picture is coming together.

See 'spirit' svn branch for code progress. https://flash-console.googlecode.com/svn/branches/spirit

Filed under: Console, Flash 1 Comment