FDS .qd format?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
jaek_3
Posts: 16
Joined: Fri Oct 02, 2015 9:48 am
Location: Miami, Florida
Contact:

FDS .qd format?

Post by jaek_3 »

If you didn't know, the version of The Legend of Zelda on the Famicom Mini features a prologue that isn't in broken English. Anyways, after a lot of searching, I was finally able to find the game inside of the console - but, it's in Nintendo's .qd format, so I can't actually write it to a physical disk. Is there anyway to convert this to .fds? I've been looking all through the internet, but most of the information available on the subject are in Japanese. I did read that there was a converter (qd2fds) but the link seems to have gone down. Any help would be appreciated!
ccovell
Posts: 1045
Joined: Sun Mar 19, 2006 9:44 pm
Location: Japan
Contact:

Re: FDS .qd format?

Post by ccovell »

You'll have to examine the differences between this format and the FWNES/iNES .FDS format. Could it be similar to the Virtual Console format, as in this thread? viewtopic.php?f=2&t=12169&p=138161


I did modify FDSList to handle the VC dump in this version: http://www.chrismcovell.com/data/FDSLCRC.zip
jaek_3
Posts: 16
Joined: Fri Oct 02, 2015 9:48 am
Location: Miami, Florida
Contact:

Re: FDS .qd format?

Post by jaek_3 »

jaek_3 wrote:If you didn't know, the version of The Legend of Zelda on the Famicom Mini features a prologue that isn't in broken English. Anyways, after a lot of searching, I was finally able to find the game inside of the console - but, it's in Nintendo's .qd format, so I can't actually write it to a physical disk. Is there anyway to convert this to .fds? I've been looking all through the internet, but most of the information available on the subject are in Japanese. I did read that there was a converter (qd2fds) but the link seems to have gone down. Any help would be appreciated!
Well, I converted the .qd into .fds - but now the text is identical to the original unmodified game!
ccovell
Posts: 1045
Joined: Sun Mar 19, 2006 9:44 pm
Location: Japan
Contact:

Re: FDS .qd format?

Post by ccovell »

Without running afoul of copyright, could you

1) Document the QD format and
2) see if a patch (that modifies the text) is somewhere in the .qd or elsewhere in the Famicom Mini?
niconii
Posts: 219
Joined: Sun Mar 27, 2016 7:56 pm

Re: FDS .qd format?

Post by niconii »

I remember hearing something along the lines of Nintendo actually patching this stuff at run-time, rather than modifying the actual game images themselves.

There's already evidence they've done stuff like this with the Virtual Console in things like EarthBound, which mitigates certain screen-flashing effects by fading the screen during them, in a way that isn't possible on a real SNES. There's also Pokémon Yellow on 3DS, which recolors Jynx to be purple in a way that gives the sprite more colors than normally possible on a Game Boy Color.
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: FDS .qd format?

Post by Myask »

Relatedly,
Gamecube (and, I expect, VC) versions of Zelda II: the Adventure of Link have a glaring, not-tile-aligned/sized PAUSE text (kinda like closed-captioning white-on-black) on the overworld…that isn't in the ROM.

(The alterations of the flashing on death are in there, though.)
hex_usr
Posts: 92
Joined: Sat May 09, 2015 7:21 pm

Re: FDS .qd format?

Post by hex_usr »

At a glance: in the .qd format, each side is 65,536 bytes long instead of 65,500 bytes. Also, there is no header. In .fds, the 16-byte header is required by a few emulators and optional in others, but it doesn't exist in .qd. Also, each block ends in the 16-byte CRC that actual Famicom Disks have, but I think the CRC for the *NINTENDO-HVC* header might be bad: it's just 00 00.

It's worth noting that the FDS BIOS in the Famicom Mini is different from the one in the actual Famicom Disk System RAM adapter. Its SHA256 hash is FDC1A76E654FEEA993FCB38366E05EE5F4EB641F86FE6BEBAEEFD412E112DD72.
bsnes-mcfly: the bsnes v073 and bsnes-classic killer (GitLab repository)
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: FDS .qd format?

Post by Pokun »

So in other words, maybe the Famicom Mini BIOS doesn't check the CRC.
hex_usr
Posts: 92
Joined: Sat May 09, 2015 7:21 pm

Re: FDS .qd format?

Post by hex_usr »

I think I found a lead on where the runtime patches are stored.

I did a search on the entire /usr/share/ directory for the byte sequence 10 0A 17 18 17, which spells "GANON" in the game's text encoding. I found only 1 file with this byte string:

/usr/share/games/nes/kachikachi/CLV-P-HAANJ/autoplay/0be33d87903018bde4f01672b434800b89c4fa7e_0.inputs.state

This looks like a save state that the emulator loads every time the game is loaded.

In it, there is a block of data that is exactly 0xB96D 0x1802 bytes long, starting at $013FD2 which patches the .qd image at $008665. It includes the entire intro text and a few other things. Most notably, the font is included in this patch included in a separate patch in this file; the original had "©" copyright symbol glyphs at 0xF0 and 0xFC, but the Famicom Mini version replaces the one at 0xFC with a "," comma glyph, which is the cause of a typo on the ending screen.

Image

=============================
Myask wrote:Gamecube (and, I expect, VC) versions of Zelda II: the Adventure of Link have a glaring, not-tile-aligned/sized PAUSE text (kinda like closed-captioning white-on-black) on the overworld…that isn't in the ROM.
I don't know about the Wii Virtual Console versions, but among the GameCube versions, the first game also has that very same pause graphic:
Image
Image
The Game Boy Advance versions have smaller "PAUSE" graphics instead. They are not in the 3DS or Wii U Virtual Console versions.

EDIT: Crossed out some errors in my patch research.
Last edited by hex_usr on Sat Apr 15, 2017 11:29 am, edited 1 time in total.
bsnes-mcfly: the bsnes v073 and bsnes-classic killer (GitLab repository)
jaek_3
Posts: 16
Joined: Fri Oct 02, 2015 9:48 am
Location: Miami, Florida
Contact:

Re: FDS .qd format?

Post by jaek_3 »

hex_usr wrote:I think I found a lead on where the runtime patches are stored.

I did a search on the entire /usr/share/ directory for the byte sequence 10 0A 17 18 17, which spells "GANON" in the game's text encoding. I found only 1 file with this byte string:

/usr/share/games/nes/kachikachi/CLV-P-HAANJ/autoplay/0be33d87903018bde4f01672b434800b89c4fa7e_0.inputs.state

This looks like a save state that the emulator loads every time the game is loaded.

In it, there is a block of data that is exactly 0xB96D bytes long, starting at $013FD2 which patches the .qd image at $008665. It includes the entire intro text and a few other things. Most notably, the font is included in this patch; the original had "©" copyright symbol glyphs at 0xF0 and 0xFC, but the Famicom Mini version replaces the one at 0xFC with a "," comma glyph, which is the cause of a typo on the ending screen.



=============================
Myask wrote:Gamecube (and, I expect, VC) versions of Zelda II: the Adventure of Link have a glaring, not-tile-aligned/sized PAUSE text (kinda like closed-captioning white-on-black) on the overworld…that isn't in the ROM.
I don't know about the Wii Virtual Console versions, but among the GameCube versions, the first game also has that very same pause graphic:

The Game Boy Advance versions have smaller "PAUSE" graphics instead. They are not in the 3DS or Wii U Virtual Console versions.
Is there any chance that you could post a patched copy of the .qd?
User avatar
Dwedit
Posts: 4922
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: FDS .qd format?

Post by Dwedit »

The giant Pause screens are built into the emulator, not the game itself.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
hex_usr
Posts: 92
Joined: Sat May 09, 2015 7:21 pm

Re: FDS .qd format?

Post by hex_usr »

Do you really want me posting copyrighted ROMs on the NesDev forums? I'll PM it to you instead, and you can share it at your discretion after that.

But unfortunately, I made some errors in my calculations. Both offsets are correct (from inputs.state: $013FD2 to qd: $008665), but the size is actually 0x1802, not 0xB96D. And that section only affects the intro text and not the font, so I think there's another patch section specifically for the font. I'll analyze it further, then create an archive with both .qd and .fds versions of both the unpatched and patched versions to PM to jaek_3.

If you can't find a Famicom Mini for cheap enough and you really want the files it comes with, they have been preserved in torrent form along with the files in the NES Classic Edition. I won't say where to find that torrent, but it's easy if you know where to look.

EDIT: The font is at $008AD2 in the save state/patch, and it patches offset $000161 in the .qd image for 0x2000 bytes. It includes graphics for Link, some of the items he uses, the title screen, the main font, and most importantly, the comma that replaces the copyright symbol.
bsnes-mcfly: the bsnes v073 and bsnes-classic killer (GitLab repository)
eientei95
Posts: 1
Joined: Tue Oct 09, 2018 2:00 am

Re: FDS .qd format?

Post by eientei95 »

Hi, I'm a guy who spent ages looking at this format in its various occurrences.
ccovell wrote:Could it be similar to the Virtual Console format, as in this thread? viewtopic.php?f=2&t=12169&p=138161
The .qd format has been used by Nintendo for FDS games since Animal Crossing on GC. It is the same one used in FDS games on VC for Wii, 3DS and I'm in no way surprised to see it on the Famicom Mini.
hex_usr wrote:At a glance: in the .qd format, each side is 65,536 bytes long instead of 65,500 bytes. Also, there is no header. In .fds, the 16-byte header is required by a few emulators and optional in others, but it doesn't exist in .qd. Also, each block ends in the 16-byte CRC that actual Famicom Disks have, but I think the CRC for the *NINTENDO-HVC* header might be bad: it's just 00 00.
Basically this. Also it should be noted at least one game I looked at had "bad" CRCs for every block (Super Mario Bros. 2 on 3DS VC).
hex_usr wrote:It's worth noting that the FDS BIOS in the Famicom Mini is different from the one in the actual Famicom Disk System RAM adapter. Its SHA256 hash is FDC1A76E654FEEA993FCB38366E05EE5F4EB641F86FE6BEBAEEFD412E112DD72.
I believe it would be identical to the one hacked for 3DS, which bypasses the initial loading screen (for shame) and seems to skip a few things from my bad memory.

Anyway, have a FDS-to-QD (and vice-versa) conversion script https://gist.github.com/einstein95/6545 ... c4cc8ca4f0
Post Reply