honeylab's blog

各種ハードウェアの改造、主にファミコンミニなどをやってます(ました)

NES Classic MiniでFlashAirの認識に成功

I have succeeded to "access" FlashAir on NES Classic Mini , but I could NOT "boot" from SDCard have not yet.

 

ごめん、FlashAirの中の人…先にやっちゃった…

とりあえず、USBからのu-bootでFlashAirが認識されました。
8Gもあるので、なんでも入ります。セルフコンパイルだって可能でしょう。

今のところまだ、SDカードからダイレクトにu-bootが起動してないので、
もしかしたらu-bootをFlashに書いたり、どうせ開発と割り切ってUSBから起動するようにしててもいいのかもしれません。

 

f:id:honeylab:20170122123819p:plain f:id:honeylab:20170122123843p:plain

ディスクシステムいただきました!

f:id:honeylab:20170116183511j:plain

フォロワーさんになんとディスクシステムを送っていただきました!

ハードオフで全く動作未確認なのに3000円とかの値付けになってて買えなくて困ってたので助かりました。

なんかのネタに使わせていただきます。


早速分解。

f:id:honeylab:20170116182809j:plain

f:id:honeylab:20170116183834j:plain


こんなんなってるんやね。


title.fntを入れ替える

何かに付属するtitle.fntを日本語に対応させる方法です。
ほんとは何かのソースにコミットして、実際に使用しているタイトルから抽出しようかと思ったんですが、いまいち連携がうまくいかなかったので、とりあえずやり方と、最低限の日本語が入ったファイルを置いておいてみます。

http://honey.lovepop.jp/font/

 上から落としたファイルを解凍して、例のヤツのフォルダの中を探すとtitle.fntってのがあるので、それと入れ替えればいいです。

 

f:id:honeylab:20170116130743p:plain

上記の文字が入っています。
選定理由は、英数字、カタカナ、ひらがな、もともと日本版に入っているタイトルの文字、日本語タイトルリストから集計した上位100位ぐらいの感じです。
ちなみに最上位はこんな感じ。
文字の右側の数字が、タイトル1700本ぐらいで使われている漢字の個数です。

f:id:honeylab:20170116130904p:plain

すでにほとんど内蔵されてる気もしますね。

そこそこ入ってるので、どうしても出ないのはひらがなで対応するか、↓の方法で置き換えましょう。
自分用のツールは作りましたが、めんどいので置きません。頑張って作りましょう。

作成元のフォントはIPAフォントです。
IPAフォントを使ったデジタルコンテンツの作成と配布、で利用条件に合致してるはずです。
それ以外のフォントを使いたければ、下のほうにあるやり方で作ってみましょう。

 

FNTファイルの作り方

BMFont - AngelCode.com

こちらからBMFontをダウンロード→いろいろやり方を調べて文字セットを作る

FontSettingsはこんな感じ。これ以外でも入れば通ると思います。

f:id:honeylab:20170116130732p:plain

Export Settingはこの通りにしないとたぶんちゃんと出ません。

f:id:honeylab:20170116131137p:plain

 

これでSave Bitmap Fontで "title" とつけると、title.fnttitle_0.pngができます。
ここで、title_0に収まらない場合、title_1ができてしまいます。
この場合、データ化できませんので使う文字を減らし、[Visualization]を使って
preview:1/1 と表示されるように調整しましょう。

さて、title.fntとtitle_0.pngができましたが、このtitle.fntはそのままではだめです。
例のヤツのフォントファイルは。

 

0x00 : 必ず 0x01

0x01 - 0x04 : 元のtitle.fntのサイズ (LSB 32bit)

0x05 - 0x08 : title.png のサイズ (LSB 32bit)

0x09 - xxxx 元のtitle.fntの実データ

xxxx- yyyy 元のpngの実データ

zzzz : 最終バイト必ず0

の構造になります。

このようにファイルをバイナリエディタかなんかで作るか、適当にツールを作ってpackしましょう。

出来上がったファイルを、最初のtitle.fntをは別のフォルダに title.fnt として保存しておきます。
このファイルを例のヤツのフォルダの中にある title.fnt に上書きします。
(前のは適当に取っておきましょう)

これでUse custom font してる状態でSyncすれば生成したfntが使えます。
fntファイルの作成に失敗した場合起動しなくなるので、とりあえず元のtitle.fntに戻しつつ、どこが間違ってるかを確認しましょう。
上に置いてあるファイルを参考にしてもいいかもしれません。

あと、このページは適当に書きなぐっているので、もっと詳しくやりたい人は
わかる人に聞いてみるか、誰かがわかるサイトを作ってくれるまで待ちましょう。

まぁ、全然調べてないのでもしかしたらとっくに本家が対応してたりして(わかんない

NES Classic Miniにいろいろなコントローラを繋いでみる

f:id:honeylab:20170114142157p:plain

適当に変換して突っ込んでやればキーボードとかつながるよね、と
コネクタの代わりにするつもりでたくさん買ってきたんだけど、とりあえず直接繋いでみると

 

[ 174.140538] input: Nintendo Clovercon - controller2 as /devices/platform/twi.2/i2c-2/2-0052/input/input6
[ 174.158326] Clovercon error: failed to set data format, value is 0
[ 174.169819] Clovercon error: controller setup failed with error 5
[ 174.181076] Clovercon info: opened controller 2, controller in error state after failed setup
[ 174.195189] Clovercon info: probed controller 2
[ 174.204667] Clovercon info: added device for controller 2
[ 175.055227] Clovercon error: failed to set data format, value is 0
[ 175.066473] Clovercon error: controller setup failed with error 5
[ 176.785226] Clovercon error: failed to set data format, value is 0
[ 176.796386] Clovercon error: controller setup failed with error 5
[ 178.473550] Clovercon info: removed controller 2
[ 178.483106] Clovercon info: removed device for controller 2

[ 187.293857] input: Nintendo Clovercon - controller2 as /devices/platform/twi.2/i2c-2/2-0052/input/input7
[ 187.311675] Clovercon error: failed to set data format, value is 1
[ 187.323083] Clovercon error: controller setup failed with error 5
[ 187.334316] Clovercon info: opened controller 2, controller in error state after failed setup
[ 187.348397] Clovercon info: probed controller 2
[ 187.357949] Clovercon info: added device for controller 2
[ 188.208787] Clovercon error: failed to set data format, value is 1
[ 188.220202] Clovercon error: controller setup failed with error 5
[ 189.938798] Clovercon error: failed to set data format, value is 1
[ 189.950118] Clovercon error: controller setup failed with error 5
[ 192.430218] Clovercon info: removed controller 2
[ 192.439832] Clovercon info: removed device for controller 2

 

見たいになって、どうやらこいつが認識するプロトコルでは通信しない、と跳ねられている用だ。
適当にソースを変更すれば何かしらつながるだろう。
cloverconのソースはGPLで公開されてるので誰でもいじれます。

ちなみに、純正ではこうなる

[ 3936.126814] input: Nintendo Clovercon - controller1 as /devices/platform/twi.1/i2c-1/1-0052/input/input8
[ 3936.144365] Clovercon info: opened controller 1, controller in OK state
[ 3936.159912] Clovercon info: probed controller 1
[ 3936.169405] Clovercon info: added device for controller 1

 

 

直接コンソール触れるキーボードがつながれば便利なんだけどなぁ
というか、多分I2Cキーボード、マウスを繋げば(≒作れば)普通に色々動くだろ。

 

追記:

純正のコントローラから帰ってくるcontroller infoは

[ 16.167399] Controller info data: 01 00 a4 20 03 01

動かない二つは下

[ 40.508637] Controller info data: 00 00 a4 20 00 00
[ 62.145529] Controller info data: 00 00 a4 20 01 01

この4バイト目を3にしてくれ、って上位から投げてるんだけど、下位がいやじゃ、って言ってるっぽいのかな。 

ツール配布について

一時的に本ブログおよびリンク先でソフトを配布していましたが、

同様の目的を果たすソフトウェアはすでにもう一つ開発されていて、
一時的に対抗意識を持ちましたが、私の力だけでは開発スピードに追い付かず、
当初の目的である本来の純粋な技術的好奇心を満たせなくなりました。

 個人的な技術的探求心と、副作用のバランスを考えた結果
公開を中止し、今後の配布を行わないことに決めました。

もう一つのほうは悔しくてダウンロードすらしていないので、
どのぐらい使えるかわかんないんですが、もし今ファミコンミニで使えなくても
そのうち使えるようになるんじゃないでしょうか。オープンソースだし。

使っていただいた方、中止後の再配布をお待ちいただいた方には申し訳ありませんが
ご理解いただけると幸いです。

尚、この件について、警告や圧力を受けたことは一切ありません。
発売されてから2か月、スプラトゥーンを我慢してファミコンミニをいじってきて
値段以上の元を取ったと思っています。が、まだまだ遊べるハードだと思うので、
そういった面で記事を書いていきたいと思います。

とりあえず、スプラトゥーンします。


ディスクシステムの引き出しを嫁が買ってくれたので、
これにディスクを実際に差し込めるようにするんじゃー

f:id:honeylab:20170110222318j:plain

 

どうすっかなこれ。

海外版NES届きましたー

もっと早く買っといてもよかったんだろうけど、ぼちぼち手に入れなければいけなくてヤフオクでぽちっとね…

f:id:honeylab:20170110110604p:plain

 

さて、基板のほうはこんな感じで入ってました。

f:id:honeylab:20170110110451p:plain日本版はこれとは全く裏返しで入っていて、デフォルトのUARTとかSDとかJTAG用の端子が反対面だったんですが、

f:id:honeylab:20170110110507p:plain

こっちは基板をつけたまま配線できますね。

ずいぶん改造がしやすいですね。

 

しかも左のほうにずいぶんスペースがあって、なんでも入りますねこれ。

(何を入れるんだよ…

とりあえず、JP版との違いを確認する作業をちゃっちゃっとするために、
またSDカードコネクタをつける作業でもしますかね…

 

メニューで言語選択できるんですね

f:id:honeylab:20170110110549p:plain


ファームはJP/それ以外 なのか。

Going on...

Little test

・pulled nandb tree on pcDuino(allwinner 10) ,run kachikachi

 # kachikachi  <my nes file>

kachikachi - v30.0.20160830.dev
===============================
updated hinting sdl game controller
added hinting sdl game controller
added hinting sdl game controller
ERROR in Mali driver:
* Mali device driver failed the API version check
* The solution is probably to rebuild the libraries and the Mali device driver.
Could not create window: Could not initialize EGL

Unhandled exception 11:
/home/ubuntu/newroot/usr/bin/kachikachi[0x1c204]
/lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0x0)[0xb6a48ab0]
Result 80150000 at ../../source/kachikachi_application.cpp(2109): BaseApplication::SetupWindowIconAndTitle() failed! Result 80150000 at ../../source/kachikachi_application.cpp(694): SetupWindowIconAndTitle() failed!

 

shit !

 

but I got complete commandline args.

# kachikachi --help

Kachikachi - v30.0.20160830.dev

===============================
Kachikachi
==========
--help, -h Print usage and exit.
--command=<file> Use file as the contents of the command line (one arg per line).
--log=<file> Log to file instead of stdout. Defaults to stdout
--ask, -a Ask for a rom and execute it.
--scale=<1..16> Specify the initial scale of the window.
--topmost Do not put window topmost.
--fullscreen Enable full screen display.
--keep-aspect-ratio Stretch the display while keeping the correct aspect ratio. (default)
--stretch Stretch the display to the maximum size available.
--pixel-perfect Stretch source pixels while keeping an integer target size.
--mute Start ROM with mute sound.
--pause-on-lost-focus Pause the emulator when the window loses focus.
--dont-show-debug-infos Disable debug display on screen.
--sync-guest-with-wall Synchronize emulation with wall time.
--sync-guest-with-host Synchronize emulation with host.
--sync-guest-none Don't synchronize emulation, run as fast as possible.
--load-state-slot=<index>, -lss<index> Load save state by index.
--load-state-file=<filename>, -lsf<filename> Load save state by filename.
--delete-after-load Delete save state after a successful load.
--dim-screen-after=<s> Dim screen after <s> seconds of inactivity.
--volume=<0..100> Set sound volume (default: 100).
--nes-version=[ntsc|pal] Specify the NES version (default is NTSC).
--graphic-filter=<index/name> Specify the graphic filter (refer to code for values).
--mem-init-pattern=[zero|type_1|type_0] Memory initialization pattern.
--fds-auto-disk-side-switch Automatic disk side switch detection
--fds-auto-disk-side-switch-on-keypress When a disk side switch is detected, only insert the other disk side on the next keypress
--fds-initial-disk-insert-delay=<value in frame count> Set initial disk insertion delay
--fds-initial-disk-insert-on-keypress Initial disk insertion on keypress
--fds-bios-file-name=<fds bios file name> Specify bios file to load (default to fds_bios.bin)
--fds-disable-host-guest-sync-on-disk-op disable host/guest synchronization during disk operation
--fds-disk-switch-side-delay=<delay in frames> Delay in frames between disk ejection and insertion
--delete-previous-record, Delete previous input records (if it exists).
--record-inputs=<filename>, Start or resume the specified input capture.
--replay-inputs=<filename>, Replay the specified input capture and exit.
--input-record-checkpoint-period=<period>, Save checkpoints during input recording at the specified period, in number of guest frames.
--input-record-exit-frame=<frame>, Save a checkpoint during input recording at the specified guest frame and exit.
--input-record-cache=<directory>, Enable checkpoint cache during input recording and set its path the specified directory.
--input-replay-screenshot-period=<period>, Take guest screenshots during input replay at the specified period, in number of guest frames.
--input-replay-screenshot-path=<path>, The path where replay auto-screenshots will be saved.
--input-replay-screenshot-to-stdout, Put the screenshot to stdout (works only with build that have no other outputs.
--input-capture-cut-path=<directory>, Set the directory where input capture cuts will be saved.
--input-replay-print-total-duration, Print the duration of the input replay.
--save-data-backing-file=<filename> Use the specified file for save data (SRAM or FDS writes), specifying an empty filename disable save data management.
--save-on-quit=<filename> Save state to the desired location on quit event.
--save-screenshot-on-quit=<filename> Save screenshot to the desired location on quit event.
--enable-crt-scanlines, -sc Enable CRT-like scanlines.
--enable-armet Enable Armet filter.
--armet-threshold=<t> Armet Detection Threshold (default is 20).
--set-dac-filters=[APU_FDS_14kHz|APU_14kHz_FDS_2kHz|none] Set DAC filters (default: APU_FDS_14kHz).
--guest-overscan-dimensions=<l,r,t,b> Set the number of black PPU pixels on the four screen borders.
--initial-fadein-durations=<t0,t1> Set the initial fadein durations in 1/10 of seconds. t0=blackscreen duration, t1=fadein duration.
--ppu-palette=<index/name> Specify the PPU palette (refer to code for values).
--ppu-palette-file=<filename> Specify the .pal palette file.

 

Got it!

They will be impelement to my tools next version.