Added code to properly check the CHD SHA-1. Turns out the SHA-1 is one of the fields in the header... the only issue is which one :|
Wrote the rest of the CHD code. For some reason, MAME is bailing out after failing to find the CHD in the uppermost ROM directory, even though ? says that we should be placing the CHDs in game-specific directories... explicitly returning ENOENT on the uppermost ROM directory doesn't work...
Derp I was using basename... but turns out that was just a lingering bug because MAME was using the basename too argh