GameCube USB Adapter for Wii U Dump

November 21st, 2014

I still need to figure out how to get live data, but here’s some connection info.

Plugged the GameCube USB Adapter that comes with Smash Bros for Wii U in to my Laptop. Turns out the black wire is the important wire. Gray wire is probably just additional power.

Nintendo

In my case, the device is attached to BUS 002, so if I do the following:

Then plug the device in, I’ll capture the following:

If I unplug I get this:

More info: https://www.kernel.org/doc/Documentation/usb/usbmon.txt

Outputs more info:

More info: http://www.linuxnix.com/…/lsusb-command.html

EDIT: lsusb is part of the usbutils package. usbhid-dump is a tool that comes with it. So is usb-devices, which is similar to one of the usbmon dump options mentioned in the first linked article.

This will attempt to watch, but I haven’t seen it do anything useful.

PHP Mad Notebook

October 21st, 2014

This isn’t a blog. It’s a notebook.

APCu Functions

Arguments in []’s are optional. Cross reference with APC docs. PECL Page. Github.

Iterator functions are omitted, but also available.

The above is a cleaned up version of what’s output by "php --re apcu".

Perl-like ?: Operator

From Tips.

Data Format: Raw PHP variables (var_export)

To serialize something to disk in the fastest way PHP can read it, you make it source code by calling var_export. Whenever the file changes, it should cause a cache miss with OPcache.

To use it:

Alternatively, if you store it a different way:

But this will cause OPcache to miss every time.

Data Format: JSON (decode, encode)

Apparently this is the fastest encoder, as of PHP 5.3. Benchmarks.

json_decode, json_encode, json_last_error

Data Format: Serialize, Unserialize

A faster decoder (slower encoder), and types/classes persist.

serialize, unserialize

Data Format: IGbinary

An alternative, external binary encoder/decoder. According to benchmarks, the fastest.

https://github.com/igbinary/igbinary (PECL)

Smaller too.

Tips and Tricks:http://ilia.ws/files/zendcon_2010_hidden_features.pdf

Data Format: CSV

Reading Only.

http://php.net/manual/en/function.str-getcsv.php

Data Format: XML

Reading Only (there is writing, but it seems more difficult).

If you prefer Array format (like me), here’s a function.

Then simply

Data Format: HTML

Use Simple HTML DOM parser.

http://simplehtmldom.sourceforge.net/ (Manual)

Data Format: String Delimiter

explode, implode

unset

val and type juggling

Shutting Down ludumdare.com/planet!! (Just the planet)

September 4th, 2014

Most people don’t know we have a blog syndication sub-site on Ludum Dare called the Ludum Dare Planet. It’s an extra WordPress blog and site that eats very few resources, but still needs to be regularly updated.

For the sake of security, I’ll be taking the down the planet website. I’m going to wait a few days first, but if nobody responds, I’ll just take it down. If you need time to grab your favorite RSS feeds, come to my blog (http://toonormal.com) and let me know.

EDIT: And the Planet is now gone. Nothing to see here. Move along.

Phat JS Demo

August 21st, 2014

Here’s something different.

Been working on the HTML5 side of my library code, and I kinda made this little demo for fun. Music is Garth Knight’s track Activate the Cage.

Ludum Dare 30 is this weekend. Hoo boy! Running that crazyfest is keeping me sooo busy. :)

Dialogs as Functions

July 16th, 2014

This is just an idea I’ve had. I wanted to write it down in some meaningful way so that I can rediscover it later. This is less a C++’ism, and more a JavaScript/Squirrel’ism.

* * *

In any situation where your user interface presents a popup dialog, that process of presenting the dialog should be a function call. Here is pseudocode:

The general idea here is that there should be 2 ways to use the function: 1. Without arguments, to bring up the entry dialog; 2. With arguments, to bypass the entry dialog (for macro/scripting use). The data in extracted from the function arguments, or the shown dialog, and the action is taken place.

Args should be the language equivalent of an object (JavaScript, Squirrel, etc). Alternatively, an array of objects could work too, but named elements would result in nicer code. Like above, it’s assumed a Yes/No/Cancel dialog would store a boolean named State to tell you which (Yes or No) was picked.

The above assumes a synchronous environment, where it’s safe to give a function “ShowDialog_YesNoCancel” full control.

In an asynchronous environment, you’ll want to use something like a Deferred or Future. If there are no arguments, the ShowDialog function will provide the object you bind your State handling function to. Otherwise, bind it to one that will succeed.

Alternatively, there are probably nice ways to handle this using coroutines or generators.

Checking Symbols GCC and Clang

June 20th, 2014

Just a short one.

Reference: http://stackoverflow.com/questions/4548702/whats-the-equivalent-of-cpp-dd-for-clang

Gives you list of all symbols defined by compilers. It’s interesting, that you have to feed it something (anything blank) to get this output though. /dev/null, or pipe in a blank echo (echo “” | gcc -dM -E -), etc.

Works with NaCl (pnacl-clang), Emscripten (emcc), and pretty much every GCC toolchain known to man.