ROM Checksums and Headers

Categories Programming

NES ROM header

Lately I’ve been futzing around with classic game ROMs a bit more. Since nearly day one of Nesticle hitting the Internet, I’ve been obsessed with emulation of classic computer systems. I love playing old video games, and I love learning more about the internals of the systems I cut my teeth on back in the day.

But this post isn’t about nostalgia; it’s about organizing games, specifically ROM files. While I’m fairly certain I’ve got several discs (and old HDDs) filled with variously-complete ROM sets for various platforms, these were mostly collected from newsgroups waaay back in the day and as a result have a wide variety of headers, possible trainers, and intros. Nowadays, even the Internet Archive maintains full sets of “no-intro” ROMs donated by people who stayed in the scene far longer than I did.

If you intend to organize such a non-trivial amount of games, you’re gonna need some ROM utilities. The most well-known of these are clrmamepro, RomCenter, and RomVault. I’m sure there are others, but these are the big players. I’m not really going to speak about their various strengths/weaknesses, as that’s a little outside the scope of this post.

What I actually want to discuss is how checksums are calculated using the “datfiles” provided by the No-Intro site’s users. I had a hard time finding this information initially, so I’m putting it here for anyone else. Also, if I’m wrong, I’d love to be called out and told what I’m doing wrong.

I’m using the following:

I only found the clrmamepro iNES header config far later than the rest of this info. This specific file is fairly sparse, and only has the following:

<name>No-Intro NES Dat iNES Header Skipper</name>
<rule start_offset="10">
<data offset="0" value="4E4553"/>

Basically, take this to mean we’re starting at offset 0x10 and reading to EOF (NES files aren’t larger than 0x4e4553 bytes). Once I did this, my CRC32 checks started working. I’d normally stop there, but it looks like my MD5 and SHA-1 hashes are wrong. Adding the entire file back in fixes this, so…I’m not really sure why we’re bothering to trim the header for only one check.

To sum up:

CRC32 – 0x10 through EOF
MD5 – entire file
SHA-1 – entire file

Let’s Get Cuddly! (or not, I’m not judging)

Categories Programming

As a personal preference, I’m a fan of cuddly braces. It’s the way I learned, but I feel like it leads to more concise and readable code in most cases. I could go on, but as a topic it’s been beaten to death, and there are arguments with merit on both sides.

That being said, at work we use newline braces, and I don’t like it. A good programmer follows the in-place coding style, so that’s what I’ve been doing. It doesn’t mean I have to like it, though. While I use a separate installation of Visual Studio on an entirely different computer for coding my personal projects, there are times where I’d like to not have to completely switch machines to bang out some lines of code.

After reading that you can export and import Visual Studio settings, I created two settings files trimmed down to only include indentation and newline settings, so now I can simply import a settings file and all the rules I want changed are changed.

Feel free to edit the below files to your needs:

VS_Personal.vssettings (3.6k) – Cuddly style
VS_Work.vssettings (3.6k) – Non-cuddly style (braces on newlines)

These are only for Visual Studio, though. I’ve got nothing to offer for other editors, but feel free to contribute settings files for any other IDE.

PSA: Vertex and Vertices

Categories Uncategorized

Hey everybody, just a quick reminder that the singular form of vertices is vertex. There is no such thing as a “vertice”.

the singular form of "vertices" is "vertex"I’ve heard it pronounced this way in video tutorials (especially from one specific “guru” who knows a lot about Blender ;), but recently I’ve noticed this malapropism being used in written tutorials as well.

The Importance of Order

The order of things is important; even moreso when those things are command line arguments.

After spending way too long (~30 minutes) trying to figure out why my background Blender renders were producing default cubes when that is clearly not what is in the scene, I finally looked at the console output and understood.

blender --background --python myfile.blend

What this command does is tells Blender, “Load into memory as a background process and run (which changes some settings and starts a render). Then load myfile.blend.” Once the file is loaded, background Blender exits.

In the proper order:

blender myfile.blend --background --python

PHP PDF Libraries

Categories Programming

PDFs are easy! Like riding a...oh.

PDFs are easy! Like riding a…oh.

I wanted to do something I figured would be relatively simple. After all, we’re doing it in .Net with a third-party library: Create a PDF with text from a database with vector graphics incorporated in the page. Turns out, it’s pretty easy if you want a paid solution; numerous libraries exist for PHP that are non-free. If you insist on going free-only though, be warned: here be dragons (maybe).

Continue reading this entry ▶

HP Color LaserJet 3600 Windows 7/8/8.1

Categories Miscellany

I honestly don’t know why HP hates its customers. They assume I want to use USB to connect a business printer, or want ~140MB for a driver, or want some other print management software instead of just a driver.

So here you go. The HP Color LaserJet 3600 64-bit driver for Windows 7, 8, and 8.1. (14.2 MB)