Well you need to Read Hex where the header is, and store it to a variable, its different in every generation of ROM, so open them up in a HEX editor and see where it says which ROM it is, usually in the first line...
As for editing a listbox's contents with IFs, I haven't been able to figure this out yet, but I'll let you know if I do. If you're familiar with Torrent programs, then search for them in there. Its the easiest way to get a ROM and emulator...