Monday, December 26, 2011

Migrating your Droid X to CyanogenMod

I recently migrated from a stock Gingerbread Moto Blur install of Android on my VZW Droid X to CyanogenMod7 (specifically RevNumbers's CM4DX-GB kang, if you happen to care) and found it to be a rather arduous task to carry all of my data and settings to the new ROM.  I was talking to my cousin over Christmas break and she was curious to learn how to go about doing it as she had never installed a custom ROM before and needed step-by-step instructions (as she didn't feel like bricking like I did a good dozen times or so while I was figuring all of this out).  So I figured I would try to compile a step-by-step guide of how to go from stock to CM7 with *almost* everything still intact.

I will start by outlining the process and then going back and filling in the details as I get the chance, so this may be a bit sparse in some steps until I get more time.  I'll probably do a ToC section link block too eventually, but it's late and I'm just throwing this all down before I go to bed.  Also, there are steps in here specific to the Droid X because that's what I have, but some of this information may be useful to other phones as well.

Update your device
NOTE: If you are currently on Froyo and have already rooted your phone, you need to back up your apps and data first, then sbf to a fresh install of Froyo, then continue.  Updating to stock GB from rooted Froyo messes up your ability to root on GB.  If you have never rooted before, these aren't the warnings you're looking for, move along.

To begin with, you want to make sure you are running the most up-to-date version of Android available from Verizon.  The reason for using an official update is that there are some things that cannot be updated (or are more difficult to update) from unofficial sources.  These include the kernel and the baseband (the firmware for your phone's radio), and perhaps other things I don't know about.  You can check what version you are currently running by pressing the Menu key and selecting Settings>About Phone.

As of this posting, the current Android System version available from Verizon for the Droid X is 2.3.3, and the current Baseband version is BP_C_01.09.13P.  If you have these versions, you're set.  Otherwise, hit Check For Updates.  Go ahead and let the update finish and your phone should reboot.

Root your device
Once you're running stock Gingerbread, you can go ahead and root your phone.  Read up on how to do that here (it says it's for the Droid 3, but it works just fine for the Droid X).  NOTE:  DO NOT TRY THIS IF YOU PREVIOUSLY HAD ROOT ON FROYO WHEN YOU UPDATED TO GB.  If this is the case, you will have to sbf before rooting, meaning you won't be able to do a full backup.  Backup what you can, sbf, and then root.

Install useful tools
The 3 most useful applications I have found for dealing with data backup, ROM customization, and other stuff here are ROM Manager, ROM Toolbox, and Titanium Backup.  All 3 of these have free versions and are available in the Android Market.  I suggest purchasing the Pro versions of each, they have additional features and plus you'll be supporting the developers that make this stuff possible.  If you don't want to purchase them all, I would say ROM Toolbox and Titanium Backup are the most worth it.  Regardless, install whichever version you wish but get all 3 apps.

Install ClockworkMod Recovery
Open ROM Manager and click Flash ClockworkMod Recovery. If you're on the Droid X, when it asks you to confirm phone model, you have the choice between Droid X and Droid X (2nd init).  Select the one that says 2nd init.  The other option is currently useless because 2nd-init is required since the bootloader is locked and it won't work without 2nd-init.  If it prompts you for superuser access, say yes and check the box to remember (basically just do this any time you get this prompt as long as you trust the app; the 3 apps I am using in this guide are all trustworthy).

Understanding each type of backup
There are two main backups going on here, a NANDroid backup and a Titanium Backup, then there is the SMS backup.  There is a reason you are doing both of these.  The NANDroid backup is a system image that allows you to restore your entire phone back to the state it was in at the moment you create the backup.  The Titanium backup backs up all of your applications and associated data in a format that you can then reinstall once you have flashed your new ROM.  This allows you to reinstall all of your apps without having to download them all, and also retains all of your data like game saves and such.  Backing up your SMS allows you to keep all of your text messages (but so far there doesn't seem to be a way to back up your MMS, so you'll need to have saved any photos to your SD card manually).  The SMS database in the stock ROM is incompatible with the one that CyanogenMod uses, so you'll have to use a 3rd party backup solution that stores the messages in a separate format.

Create a Nandroid (system image) backup
Note:  The size of a Nandroid backup will vary, but I would suggest having at least 1.5-2GB free on your SD card before attempting this
Once you have flashed ClockworkMod Recovery, click Reboot into Recovery.  Your phone should reboot and you will be in a text based menu.  You navigate the menu with the volume up/down buttons, the camera button to select, and the hardware "back" button to return to the previous menu.  The power button just turns the screen on and off so if you accidentally hit it and the screen goes off, just hit it again and it will come back.  Select backup and restore->backup and then just wait for it to complete.  Once it's done, back out to the main menu and select reboot phone now.

Backup your applications and data
Note:  The size of the backup will vary greatly depending on how many apps you have installed and what you choose to back up.  Again, I suggest having at least 1GB free on your SD card before attempting the backup.
Open Titanium Backup and press the hardware Menu button and select Batch.  At the very least, select Backup all user apps, but you can backup system data if you want too.  You won't be able to restore the system data into an incompatible ROM, but if it gives you peace of mind to have it backed up, go for it.

Backup your text messages
There are many ways to backup SMS messages, but if you use a 3rd party SMS client, it may very likely have the option to back up your messages.  I use GoSMS Pro, and the option is found by pressing the hardware Menu button and going to the Services tab and selecting SMS B&R.

Install CyanogenMod (CM4DX-GB)
Because the Droid X has still not received a stable release of CyanogenMod, you're stuck installing a nightly release.  Also, the mainline CM7 does not support the Gingerbread kernel, so you'll want to install the RevNumbers releases, which do support the GB kernel.  The kernel does not get updated when you install a ROM, so you need to already have the correct kernel installed before you flash the ROM or you will brick your phone.  Open ROM Toolbox (since the RevNumbers Nightlies in ROM Manager are not kept up-to-date) and select ROM Manager (the button inside of ROM Toolbox, not the app named ROM Manager).  Under the ROM list select RevNumbers CM7 Nightlies (you can pick any ROM you want, but I highly suggest CM7, at least for your first ROM).  Pick the newest version and select download.  Wait for the download to finish.  Also download the latest version of Google Apps, or you won't have an Android Market.

Update: For more up-to-date releases of CM4DX-GB, follow this thread, as ROM Toolbox hasn't updated their list in quite awhile.

I'm going to outline how to install the ROM manually, since ROM Toolbox hasn't been working right with automating ClockworkMod Recovery tasks, although they may have fixed that, I don't know...

In the main menu of ROM Toolbox, select Rebooter, then Reboot Recovery, and you should be back to the text menu of ClockworkMod Recovery.  Select Factory Reset/wipe data, then select install update zip.  Choose select zip from sd card and browse to romtoolbox/downloads/RevNumbers and select the zip in that folder (or browse to the location where you downloaded it, if you got an updated release from the forum thread above).  Repeat with romtoolbox/downloads/gapps.  Now reboot your phone and (if all goes well), it should boot into CyanogenMod.  The first boot WILL take a long time, but if it just plain doesn't boot, check out the troubleshooting guide below.

Restore your applications
Install Titanium Backup.  Batch>Restore User Apps (NOT system data)

Restore your text messages
Use the same app you used to back them up in the first place

TROUBLESHOOTING

Unbricking
It's late, I'm getting tired, for now, Google "[your phone model] Gingerbread sbf" to get the files and  probably a guide.  You'll also need an app called RSD Lite, the latest version (AFAIK) is 4.9.  There is a bug in the software resulting in an error, something like invalid file or filename or something I don't remember, but that error is bogus and there is a workaround I'll get around to posting later... bah... should be enough info to get started, so for now goodnight.

Friday, June 3, 2011

Build and install custom Rock Band DLC on an unmodded XBox 360

UPDATE: RB3Maker can do a lot of this automatically, including album art conversion.  I still prefer doing it manually so that I can pack it for RB2 instead, but it's a really nice tool, and if he ever adds support for outputting RB2 .con's then I may convert to that method entirely.  If you want to continue to use this guide, I believe RB3Maker can be used in place of MahoppianGoon's DLC Tools to extract the .rba, and you can also use it to convert the album art for you.

I have been a long-time user of RawkSD for custom Rock Band DLC (user-made songs) on the Wii, but just recently heard that it was possible to install custom DLC on an un-modded XBox 360.  I got really excited about this, since the Wii version of Rock Band 3 is so full of software bugs that it never should have been released in its current state, and because of the way the Wii is, it will most likely (99% certainty) never receive an update to fix these bugs.  With XBox 360 customs possible on an unmodded console, I can enjoy customs, a better engine, and the improvements made in the newest installment of the game, all without wanting to tear my hair out on a regular basis.  Also, since the XBox 360 already supports the internal HD for saving DLC, I also get that particular upgrade over the Wii without any need for additional hacks (which tend to increase the frequency of Rock Band entirely freezing on my Wii).

Anyway, enough random backstory and on to the actual build-and-install.  MahoppianGoon has a great tutorial already, but many of the steps require manually creating files that you could just use Harmonix's official tools to create for you, so this guide will show you step-by-step how to set up and use Magma, Harmonix's official Rock Band Network tool, to create the files necessary for custom DLC and then how to repack and install them.

Note:  This is for Rock Band 2 DLC, not Rock Band 3.  Really the only reason you would need to create RB3 DLC is if you want to chart keyboard or PRO Guitar, as you can play Rock Band 2 DLC in Rock Band 3 as-is.  Also, since this is RB2 DLC, you will need Magma v1, which is no longer available on the RBN download site, so I have mirrored it.

First of all, here are the programs you will need:
Magma v1.20
Audacity 1.3.13 beta
MahoppianGoon's DLC Tools
Le Fluffie
Modio
GH2ImageCon

Now to start building your custom DLC.

Skip to:
Chart/MIDI
Audio
     -Recording a dryvox track (for lipsync animations)
Magma
Extracting the RBA
DTA Editing
Album Art
Building the DLC file
Installing


Chart/MIDI
For the purpose of this tutorial, I am going to assume you already have your .mid file created.  If not, check out the Rock Band section of ScoreHero for tips on charting, or download one from someone else.

Some things to note:
Magma v1.20 introduced the requirement that all difficulties of guitar use all 5 gems.  If your chart does not do this, it won't pass the midi check stage of the compiler.  You can try v1.10 if this is your chart's only issue.

If you absolutely don't want to get your chart up to Magma's specs (which is usually a crash waiting to happen), you can use this .mid in Magma to get your song to compile.  Just be sure to use your real .mid in the final .con file.  Also, if you use that .mid and your song has a vocals track, use this file for your dryvox audio.

If you want lipsync animations, in addition to creating the dryvox audio (described in the audio section), you WILL have to fix your chart to pass Magma's checks, and you will need to have charted vocals.  Otherwise, Magma won't be able to generate lipsync animations.


Audio
UPDATE: I have come up with a method for creating .mogg files longer than Magma's normal 12 minute limit.  Magma still won't allow a MIDI file longer than that, but you can get around that by feeding Magma a dummy MIDI file then swapping it out in the final .con.  However, you lose Magma's validity parsing ability if you don't feed the real .mid to it, so proceed with caution.  The tool is here.

If you somehow happen to possess actual master tracks for the song you're working with, you simply need to mix down each instrument's track into a stereo, 44.1kHz WAV file.  If you're not so lucky and are just using a stereo audio file for your song, you will need to do the same, but most likely it will require a few extra steps.

First, open your audio file in Audacity.

Next, you need to determine whether or not the song requires an audio delay (this will most likely have been indicated on the page where you got the chart).

If your audio needs a delay, make sure the cursor is at the beginning of the song (by pressing the <|<| button while the song is stopped) and select Generate>Silence.  Type in the length of silence (you may have to change the time breakdown in the drop-down menu to allow you to enter milliseconds) and press Ok.

Select File>Export and select WAV under Save As type.

Next, if you don't have master tracks, you're going to need blank audio tracks.  First, delete the current audio tracks by clicking the X in the upper left corner of the track.  Then select Tracks>Add New>Stereo Track.  Then select Generate>Silence and enter 60 seconds.  Export this track as WAV.


Finally, the dryvox track.  If you don't care about lipsync animations, or your chart doesn't have a vocals track, you can skip this part.  If you want lipsync animations, you need to record yourself singing along to the song.  If you can't sing very well, I suggest you get a friend who can to do it for you, or just skip this part.  Also, you MUST HAVE A VOCALS CHART or else you can't generate lipsync animations, so just skip this.

First of all, open the first WAV you exported from Audacity back into Audacity (remove any other tracks that might be there).

Open the Device Toolbar (View>Toolbars>Device Toolbar) and next to the microphone icon, select the input you are going to use (Note: the Logitech universal USB microphone works as a plug-and-play microphone on Windows).

Hit the record button and make some noise into your microphone to test that it's working.  Hit stop to stop recording, then delete the recording you just made.

Make sure that you can actually hear the song playing while you are recording.  If not, select Edit>Preferences>Recording and check the box that says "Overdub: Play other tracks while recording new one"

Now, hit record and sing along to the song and hit stop when the song is done.

Tips:
-Enunciate well.  You actually have to sing the words.  If you just hum along, the animations are going to do the same thing and that defeats the purpos.

-Sing the right notes.  If you don't sing the right notes, the weights compiler will factor that into the scoring for the song

-Use headphones.  That way you won't get the audio from the song itself bleeding into your recording.

Once you have your track recorded, remove the song track from Audacity, leaving only your recording.  Next, select the drop-down box in the lower-left corner of the window labeled "Project Rate (Hz)" and select 16000.

Export as WAV.


Magma
Now, we're going to set up Magma.  Open Magma and under the Information tab fill in all of the fields for Artist, Title, Album, etc.  Don't worry about album art, you won't be able to use it anyway.  Under the Build To field, put it wherever you want, but name it after the song ID that you are going to use for this custom.  A simple song ID is the song title in all lowercase with no spaces or punctuation.  If it's a really long title, you can shorten it for the ID.  The main thing is that every song needs a unique ID, so just make sure it's unique (i.e. "My Cool Song" could have the song ID "mycoolsong").  Remember this ID for later.

Next, under the Audio tab, if you have master tracks, put them in here.  If not, put your song track in as the backing, and the silence track in for every instrument that has a chart.  If you have vocals, you'll need to have the dryvox track made.

Under the Game Data tab, put your .mid in and set the difficulty for each instrument.

Now, save your .rbproj and try to build.  If you get errors with your chart, fix them.  If you get other errors that you don't understand, try the Rock Band section of the ScoreHero forums.  Rinse, lather, and repeat until you successfully generate an .rba file.


Extracting the RBA
Open MahoppianGoon's Rock Band DLC Tools to the RBA Extractor tab.  Open your .rba file and click "Extract All", then close Rock Band DLC Tools.

Rename the extracted files according to the song ID your chose.  The files should be named like this (assuming my song ID is "mycoolsong")

mycoolsong.mid
mycoolsong.milo_xbox
mycoolsong.mogg (it will originally be .ogg, you need to rename the extension as well)
mycoolsong_weights.bin
songs.dta

Now you will need to create an empty .pan file.  Right-click in Windows Explorer and select New>Text File (not any other file type) and rename the file mycoolsong.pan.  Right-click on it and select Properties and the size should be 0 bytes.


Editing the DTA
The songs.dta generated by Magma needs a few changes to make it work for DLC.  Open it in your favorite text editor, it's just a text file.  First of all, at the very top of the file you should see:

(
   'song'

Here, you need to replace 'song' with your song ID:

(
   'mycoolsong'

A bit further down you will find

(
   'song'
   (
      'name'
      "songs/song/song"

Here, you will leave 'song' but change the line after 'name' to reflect your song ID:

(
   'song'
   (
      'name'
      "songs/mycoolsong/mycoolsong"

Scroll down again and find:

(
   'midi_file'
   "songs/song/song.mid"

Again, replace the word song with your song ID:


(
   'midi_file'
   "songs/mycoolsong/mycoolsong.mid"

Now, if you want to fine-tune the difficulty ratings for your song, find the following lines (the numbers will be different):

(
   'rank'
   ('drum' 123)
   ('guitar' 123)
   ('bass' 123)
   ('vocals' 123)
   ('band' 123)
)

Change these to set the exact difficulty you want.  Check out this page for comparison with existing songs.

Finally, find the following line

('ugc' 1)

and delete the line entirely.  Now save and close the file.


Album Art
Update: Technicolor over at ScoreHero has implemented this info into an all-in-one tool that converts an RBA to a CON.  It's only for RB3, but if you just want the album art, it leaves all intermediate files, so you can just grab the artwork from there.  Get RB3Maker here

Album art is possible using Nachyoz's GH2 Image Converter, but the colors are all messed up. I HAVE figured how to fix the colors, but for now it requires manually hex-editing the image so for now I'm going to wait to post here until I can type up a decent explanation or code my own converter. Sorry...

If you are willing to try it, the basic steps (with no explanation yet, you'll have to figure it out yourself) are:

-Save the image as a 256-color, indexed bitmap (also known as 8-bit bitmap)
-Use Nachyoz's GH2ImageCon to convert to .bmp_ps2
-Manually hex-edit the color index in the .bmp_ps2. You need to make 2 changes.
   *.bmp_ps2 images store the color index as RGBA, .png_xbox expects ARGB. Just shuffle the values around.
   *change the alpha channel values to 0xFF (the default value is 0x80)
-Save the file as [songid]_keep.png_xbox (i.e. mycoolsong_keep.png_xbox) and place it in the gen folder

Here is a working example


Building the XBox DLC file
Open Le Fluffie and select File>Package Creation and choose STFS from the drop-down menu and click OK.  Enter the following information:

Package Type (the drop-down menu that says "None" by default): SavedGame
Title ID: 45410869
Description (Be sure to select the radio button for "Description" instead of "Display Title"): "My Cool Song" (Replace this with whatever the song title actually is, include the quotes).
Internal Title: Rock Band 2

Now, right-click on each of the two small white squares to the right of the info pane and click Add Image.  This is where you select the image you'll see in the XBox System Settings menu.  You can use any 64x64 .png image (official DLC uses a scaled down copy of the song's album art), but here's the official RB package icons if you prefer:

RB1 Icon:






RB2 Icon:






RB3 Icon:






A couple of RawkSD icons I made:








Next, in the upper-left pane, right-click on the word "root" and select Add Folder.  Name this folder "songs" (no quotes).  Now click the '+' next to root and right-click on "songs" and Add Folder.  Name the folder your song ID with no quotes.  Click the '+' next to your song ID, and add a folder named "gen" (again, no quotes).  Click the '+', then select "gen".

Right-click in the right-hand pane under where it says "file" and select Add Files.  Select the .milo_xbox and the _weights.bin files.  Next select the song ID folder and add the .mid, .mogg, and .pan.  Select the songs folder and add the .dta.  Your files should be in this hierarchy:

\songs\songs.dta
\songs\mycoolsong\mycoolsong.mid
\songs\mycoolsong\mycoolsong.mogg
\songs\mycoolsong\mycoolsong.pan
\songs\mycoolsong\gen\mycoolsong.milo_xbox
\songs\mycoolsong\gen\mycoolsong_weights.bin

Now click on the Finalization tab.  Select STFS Type 0 in the drop-down box and the radio button for CON (Provided KV) and click Create Package.  Name it whatever you want, but I suggest [song ID].con (i.e. mycoolsong.con).


Installing
The easiest way to install is if you have a spare flash drive at least 1GB in size.  Clear everything off of the flash drive, then format it by going to the XBox 360 System Settings menu>Memory>USB Storage Device>Configure Now (or Customize if you want to manually specify how much of the flash drive to devote to XBox storage).  Note: This will delete everything off of the flash drive.  You have been warned!

Once it is configured, navigate to your data for Rock Band 2 (either on the hard drive or the internal memory) and copy the Rock Band 2 Song Cache to the flash drive you just configured (nothing special about the song cache, you just need SOME file from RB2 on the flash drive in order to create the proper folder on the flash drive)

Unplug the flash drive from the XBox and plug it in to your PC, then open Modio and select Explore a device

In the new window that comes up, select File>Open/Close Drive.

Navigate to Content\Downloads\Rock Band 2\Game Saves.

Right-click in the right-hand pane and select Insert File.  Browse to and select your .con file.

Select File>Open/Close Drive to close the drive, then eject it and insert it into the XBox.  If you did everything correctly, the song should show up on the flash drive and in the Rock Band 2 song list.  If it works, you can copy it off of the flash drive to your hard drive or internal memory if you like.

Have fun :)

Sunday, January 30, 2011

SNES to USB controller with internal flash memory mod

I've been toying around with the idea of an SNES controller USB mod for awhile now, but I finally broke down and decided to get my hands dirty and actually make one.  I found this awesome site with all sorts of neat controller mods and decided to go with his SNES/NES gamepad (and mouse) to USB adapter guide for my build.  After looking into the necessary parts for building the adapter, I decided it would just be simpler (and actually cheaper too) to buy a pre-assembled and pre-programmed circuit board.  Once I had the adapter circuit, I decided to take things one step further and combine this mod with a mod one of the guys in my hall had done with an NES controller in which he converted a nonfunctional NES controller into a USB flash drive.

The first step was finding an appropriate USB hub for this mod.  I settled for this IOGear hub:

 

I would guess any hub with this sort of design where there is a recess in the case for the cable would work well, because all of the circuitry gets shoved over to the other side of the board to make room for the recess, leaving the two ports next to the recess as just long traces on the board without any circuitry, which is perfect later on when I cut the hub's board in half to fit it into the controller shell.

I had also considered this Targus hub because it was cheap and it was the only one at Wal-Mart, but decided against it because of the circuitboard design.  Because of the shell design (without any recess for cable storage), the circuitry is laid throughout the length of the entire board, making it impossible to remove the two unneeded USB ports.


Here's the internals of the hub I used:

 

You can see from the picture above how the two rightmost ports have no vital circuitry anywhere near them.  This became important later on.  The first thing I did was to desolder and remove one of the USB ports.  (I practiced this on one of the two ports I later cut off of the hub's board entirely.  I then soldered wires in place of the port (26 gauge ended up being just about perfect.  To be honest, cleanly removing the USB port from the hub board was the hardest part of the entire mod.  I first removed as much solder as I could from all 4 through-board leads and the through-board anchor tabs, then I used a pair of needle-nosed pliers to break the leads in the rear of the port, then finally used the pliers to break the port off of the board by bending back and forth until the anchor tabs broke.  This then left me with leads and anchors poking through the board still anchored with solder.  I intentionally left enough of each lead intact poking out from the board so I could grip each lead with the needle-nosed pliers, then I picked up the entire board by the pliers and carefully applied the soldering iron to the opposite side of the board and let gravity pull the board off of the lead when the solder softened.
 
I then soldered wires through the lead holes and attached them to the adapter circuit according to the instructions in the conveniently provided owner's manual (you have to get it from the site, it doesn't come with a hardcopy when you order it).  Once I had tested that the hub still functioned and that the controller adapter was properly detected (even without soldering the adapter to the controller itself, the chip itself will be detected so you can test your soldering at this point before you continue).  Once it was tested, I sawed off the extra two ports, just to the right of the LED (since I didn't know if the LED was required or not, and it didn't take up that much extra space anyway...).


Next, I picked up this flash drive for my internal memory (shop around, the OIT bookstore had these for half the price they're asking for on Amazon).  Here's another even smaller drive, if you're interested.
 

Here's the complete package:


Next, I had to Dremel out the back side of the controller case in order to accommodate for this extra circuitry.


After I finished adding extra real estate inside the controller shell, all I had left to do was wire the adapter into the controller itself.  I decided to leave the original cable connector intact and instead soldered wires onto the backside of the cable connector.  I also had to resolder the chip to the hub using longer wires, since I ended up changing the arrangement of the chips from my original plan after everything started coming together.  At this point, I tested it and after an initial mishap with two wires being accidentally switched, it worked, so I closed up the case.  The only thing left to do is replace the USB cable with a full-length one, but that will have to wait until the order comes in from NewEgg sometime next week.  For now, I have a 6' USB extension cable that works just fine.


The final result (sans full-length cable): 


Screenshots of the controller in action:



Update:

I've begun the process of loading up all of the software I plan to use on my newly converted controller.  To start off with, I'm using the latest beta of the PortableApps.com Menu, along with a fixed version of ZSNES Portable.  I also decided to load up FCEUX as well so I can play NES games as well as SNES.  I'm also including a few utilities, such as Nach's SNES ROM Tool, GoodTools, JoyToKey and Xpadder.  I may also install WinAmp Portable along with the ChipAmp plugin pack for chiptune playback, we'll see (I have 4GB to work with, so I have way more than I'll be taking up with ROMs and saves...).