Open file .bin

Discussion in 'NDS - ROM Hacking and Translations' started by kinglear2001, Jan 10, 2014.

  1. kinglear2001

    kinglear2001 Newbie

    Oct 6, 2013

    I can not open a file .bin, I want to translate a game that is in jap.
    There is also the file .ospr I do not know how to open? I know the file .spr representing sprites.


    Je n'arrive pas a ouvrir un fichier .bin ,j'ai envie de traduire un jeu qui est en jap.
    Il y a aussi les fichier .ospr que je ne sais pas comment ouvrir?je connais les ficher .spr qui repr├ęsente les sprites.

    The game is Meitantei Conan Kakokara no Zensou Kyoku
    Olden likes this.
  2. FAST6191

    FAST6191 Techromancer

    pip Reporter
    Nov 21, 2005
    .bin is a generic file extension used by any number of formats right across computing. On the DS the only common versions though are the arm9.bin, arm7.bin and overlay????.bin and utility.bin files. The first three types are binaries for the console and usually can not be reduced any further and will need analysis at that level. Utility.bin is a common thing for the download play parts of games to be called.

    I have never seen ospr before.

    Anyway I took a look at the game.

    Whatever is not .bin is .dat (another common/generic extension), .ospr .g2pk and the solitary sdat file for sound.

    As it seems .bin could be used for a variety of formats within the game I might need to look at a bunch of different ones.

    I grabbed a selection of the .bin files for the game.
    Many appeared to start with FARC
    00000000 || 46415243 02000000 01001300 00930100 20000000 || FARC .
    00000014 || B8020000 B8010000 00000000 76600000 00000000 ||  
    00000028 || 80600000 30C80000 14000000 C0280100 3A020000 ||  
    0000003C || 28000000 002B0100 240C0000 3C000000 40370100 ||  
    00000050 || 30080000 50000000 803F0100 3A020000 68000000 ||  
    00000064 || C0410100 24060000 80000000 00480100 30080000 ||  
    00000078 || 98000000 40500100 3A020000 B0000000 80520100 ||  
    0000008C || 24060000 C8000000 C0580100 30080000 E0000000 ||  
    000000A0 || 00610100 3A020000 F8000000 40630100 24060000 ||  
    000000B4 || 10010000 80690100 30100000 28010000 C0790100 ||  
    000000C8 || 3A020000 40010000 007C0100 24060000 58010000 ||  
    000000DC || 40820100 30080000 70010000 808A0100 3A020000 ||  
    000000F0 || 88010000 C08C0100 24060000 A0010000 686F5F62 ||  
    00000104 || 675F3030 305F6474 2E626D70 00000000 686F5F62 ||  
    00000118 || 675F3030 305F6267 2E4E4347 52000000 686F5F62 ||  
    0000012C || 675F3030 305F6267 2E4E434C 52000000 686F5F62 ||  
    00000140 || 675F3030 305F6267 2E4E5343 52000000 686F5F62 ||  
    00000154 || 675F3030 305F3031 5F62672E 4E434752 00000000 || g_000_01_bg.NCGR
    00000168 || 686F5F62 675F3030 305F3031 5F62672E 4E434C52 || ho_bg_000_01_bg.NCLR
    0000017C || 00000000 686F5F62 675F3030 305F3031 5F62672E || ho_bg_000_01_bg.
    00000190 || 4E534352 00000000 686F5F62 675F3030 305F3032 || NSCRho_bg_000_02
    000001A4 || 5F62672E 4E434752 00000000 686F5F62 675F3030 || _bg.NCGRho_bg_00
    000001B8 || 305F3032 5F62672E 4E434C52 00000000 686F5F62 || 0_02_bg.NCLRho_b
    000001CC || 675F3030 305F3032 5F62672E 4E534352 00000000 || g_000_02_bg.NSCR
    000001E0 || 686F5F62 675F3030 305F3033 5F62672E 4E434752 || ho_bg_000_03_bg.NCGR
    000001F4 || 00000000 686F5F62 675F3030 305F3033 5F62672E || ho_bg_000_03_bg.
    00000208 || 4E434C52 00000000 686F5F62 675F3030 305F3033 || NCLRho_bg_000_03
    0000021C || 5F62672E 4E534352 00000000 686F5F62 675F3030 || _bg.NSCRho_bg_00
    00000230 || 305F3034 5F62672E 4E434752 00000000 686F5F62 || 0_04_bg.NCGRho_b
    00000244 || 675F3030 305F3034 5F62672E 4E434C52 00000000 || g_000_04_bg.NCLR
    00000258 || 686F5F62 675F3030 305F3034 5F62672E 4E534352 || ho_bg_000_04_bg.NSCR
    0000026C || 00000000 686F5F62 675F3030 305F3035 5F62672E || ho_bg_000_05_bg.
    00000280 || 4E434752 00000000 686F5F62 675F3030 305F3035 || NCGRho_bg_000_05
    00000294 || 5F62672E 4E434C52 00000000 686F5F62 675F3030 || _bg.NCLRho_bg_00
    000002A8 || 305F3035 5F62672E 4E534352 00000000 11009301 || 0_05_bg.NSCR
    000002BC || 02424D76 60000030 0176A120 0628300A 010000C0 || .BMv`0.v. .(0.
    After that I saw what looked like file names and with common formats.extensions at the end of those (NCLR, NANR, NCER....) though others had ones I have not seen before like STEX. If it is like that from a few random samples I have to warn you that it could get pretty image editing heavy. I see there are also .bin files called script but more on them later.

    farc then
    There is a common archive format called NARC which sometimes also gets seen as ARC and CARC (compressed NARC) but here I am inclined to think the ARC is short for archive and F is just something else as it does not look like normal NARC to me. Custom archive formats are nothing new on the DS though.

    I will start with CHECK_BG_000.bin as I see it had a .BMP as the first file name (ho_bg_000_dt.bmp) and I am a stickler for developer leftovers if it is one.

    Sample of the file as it comes out of the ROM, the file ends at 83E0 hex

    As well a FARC all the files appear to have 020000000100 as the next bytes in the hex section.
    If I was doing better I would have picked another file with a more well known format at the start of it, that said looking at a few of them they might be compressed (type 11 which matches with the OSPR files) anyway so it does not really matter what I do.
    The file would appear to start at 02B8 which is interesting because at 14h is the data B802, this holds for other files as well.

    At 0100 hex there starts file names. There appears to be 19 of them, at the end of each name there appears to be between 6 and 8 00's.
    At offset 000A hex there is a number, this number appears to be a hex value for the amount of files it contains. This also holds for the other files.

    Slicing it off at the start of the file, forcing it through decompression and I do get my bmp image. Sadly it is just a bedroom background with things painted lime green, presumably for sprite work.

    The resulting BMP file is 019300 hex long which fits rather nicely with the 11009301 -- the 11 is for type 11 LZ compression (a common DS compression) and the 009301 when written as the DS would read it is 019300. This also fits nicely with the 00930100 I see at C hex in the header.

    Pondering it for a while and fiddling with some similar files (SEL_CHAR_KAZUHA seems to have uncompressed files in it which is nice) it seems there are three columns to the name thing. One appears to be the location of the names relative to the start of the naming section, one appears to be size and one might be location.

    Script files then.
    Looks slightly different to the other .bin files as it appears to start with scp (though they all seem to be compressed with type 11 LZ compression). Decompressing them I see what looks like it could be a normal file. I am seeing a lot of the 30 hex character which is not the same as either shiftJIS or euc-JP decoding schemes. If you can find a font in the other files (I have not found one but was not looking so hard) that would help.
    Other than at 8 hex there being a file length value, the next value possibly being length of something else and what is often a pointer section being longer for the bigger files (when I start seeing a lot of 30 I figure I am in the main text) I have not done anything yet.

    One decompressed file for others to see
    00000000 || 53435020 01000000 00000386 0000034E 00000024 00000038 00000001 00000020 || SCP ...........N...$...8....... 
    00000020 || 000000E7 00000002 00000002 000001D2 00000004 00000348 00D0E000 E0000000 || .......................H........
    00000040 || 000000D1 0114E000 00000002 E0000002 00000053 0001E000 0000B330 A630B330 || ...................S.......0.0.0
    00000060 || A630BB30 A430BF30 F330C630 A43000E0 01000000 D89A2168 1F75A263 75500130 || .!h.u.cuP.0
    00000080 || 00E00100 0000AF30 C930A630 B730F330 A430C130 00E00100 0000E55D E485B065 || .......]...e
    000000A0 || 004E4C30 0A0000E0 01000000 AA30F330 BB30F330 E430C930 00E00100 0000296E || .NL0.........
    000000C0 || C96CBF5B 6E3000E0 01000000 CF30CA30 00E00100 0000E296 8C306B30 66300130 || .l.[n0.......0.0.........0k0f0.0
    000000E0 || 00E00100 0000A430 BF30A430 00E00100 00007A90 534F6730 8B896430 4B306330 || .......0.0.0......z.SOg0..d0K0c0
    00000100 || 5F302620 0A0000E0 01000000 CF30CA30 00E00100 0000E296 8C306F30 0F5C5530 || _0& .........0.0.........0o0.\U0
    00000120 || 6A3000E0 01000000 C630F330 DE30C930 00E00100 00002959 937A4C30 8B954430 || j0.......
    00000140 || 66304430 8B30D64E 01300A00 00E00100 0000DF30 C330B730 C430B830 E730A630 || f0D0.0.N.0.........
    00000160 || BF30A430 00E00100 0000C65B A45BB672 4B616730 42306330 5F302620 0A0000E0 || .0.0.......[.[.rKag0B0c0_0& ....
    00000180 || 01000000 E130A430 BF30F330 C630A430 00E00100 00000D54 A2637550 013000E0 || .....
    000001A0 || 01000000 E230A630 EA30B330 B430ED30 A63000E0 01000000 DB6B2952 0F5C944E || .....\.N
    000001C0 || CE906E30 00E00100 0000B930 A430EA30 00E00100 0000A863 06744C30 0A0000E0 || ..n0.......0.0.0.......c.tL0....
    000001E0 || 01000000 B53000E0 01000000 B4514830 8F305F30 8B302620 01FF0A00 00E0D300 || .....0.......QH0.0_0.0& ........
    00000200 || 000000E0 24010100 020000E0 14010200 00000400 00E00100 0000B930 A430EA30 || ....$......................0.0.0
    00000220 || 00E00100 0000A863 0674B730 E730FC30 00E00100 0000B830 C430A830 F330B230 || .......c.t.0.0.0.......
    00000240 || AD3000E0 01000000 9F5B146F 87520E30 00E00100 0000AF30 C930A630 B730F330 || .0.......[.o.R.0.......
    00000260 || A430C130 B530C430 B830F330 B830B130 F33000E0 01000000 E55DE485 B065004E || .]...e.N
    00000280 || BA6BBA4E 8B4EF64E 0F300A00 6E30EA30 CF30FC30 B530EB30 9230427D 48300130 || .k.N.N.N.0..n0.}H0.0
    000002A0 || B330CA30 F3306F30 0A0000E0 01000000 E230A630 EA30A430 C330AB30 00E00100 || .0.0.0o0.........
    000002C0 || 0000DB6B 2952004E B65B6830 00E00100 0000CF30 A430D030 E930A230 A43000E0 || ...k)R.N.[h0.......
    000002E0 || 01000000 70709F53 C0546830 00E00100 0000C830 E23000E0 01000000 71516B30 || ....pp.S.Th0.......0.0......qQk0
    00000300 || 01300A00 D530A130 C330B730 E730F330 D630E930 F330C930 0E30A430 C130ED30 || .0...
    00000320 || A630FB30 AA30AA30 0A00EF30 C0300F30 6E3000E0 01000000 CB30B830 E530C330 || .
    00000340 || B730E530 A630CD30 F33000E0 01000000 12FF10FF 6854745E D130FC30 C630A330 || .^.
    00000360 || FC306B30 0A00FA51 4B305130 5F302620 0A0000E0 D3000000 00E02401 01000400 || .0k0...QK0Q0_0& ..........$.....
    00000380 || 00E0D200 0000                                                           || ......
    For a quick look I thought I would have a scan of the ospr stuff.
    The handful I tried underwent serious decompression when I fed them to a decompression program. Anyway opened in a tile viewer and some 256 wide 8bpp GBA format imagery popped out, the ones I picked had a lot of whitespace though so that explains the large size change for decompression.

    Either way it is followed usually by a STEX file which I guess I also saw earlier when looking at the .bin files. I am not sure they have palette onboard yet but between the ospr stuff and the STEX there is some more data which could well be dimensions (256=100hex but I will need to confirm that with smaller files, if there are any, or by trying it in the game. Attached is an image of the bmp I extracted as well as a couple of the ospr files I decoded. I used a grey palette as I have not yet extracted a palette. That is also text as images you see there so if you are going to do this project then be prepared for that.

    It has just gone midnight so I will have to leave it unfinished for the time being. Nothing looks especially outrageous here and it is not as simple as I have seen so enjoy some nice ROM hacking, we should all be so lucky as to find games like this to pull apart.

    Attached Files:

    Olden likes this.
  3. jjjewel

    jjjewel GBAtemp Maniac

    Dec 17, 2009
    United States
    The script files are compressed with LZ type 11 as Fast6191 explained. The text is encoded with Unicode encoding. It will have some control codes in-between text for furigana (the reading for Kanji characters.)

    The game used NFTR fonts (in data/common.bin) but it forced a big gap between English alphabets output. So you'll need to do ASM hacking to reduce that gap, or use dual-tile font. (I tried hacking it when the game came out some years ago, so this info is mostly from my memory.)
    Olden likes this.