meilleur-pkmn
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Dockerで自宅にWi-Fiコネクション代替サーバーを建てる <blockquote class="twitter-tweet"><p lang="ja" dir="ltr">第四世代 Wi-Fiコネクション代替サーバーを提供するDockerfileと、DNSサーバーを抱き合わせたYAMLを公開しています。お手元のPCにサーバーを建てて、無改造のDSからアクセスすることができるものです。「ふしぎなおくりもの」は予め削除しているので受け取れません。 <a href="https://t.co/4y89r4qn5X">pic.twitter.com/4y89r4qn5X</a></p>&mdash; メイユール (@meilleur_pkmn) <a href="https://twitter.com/meilleur_pkmn/status/1488479167385518083?ref_src=twsrc%5Etfw">February 1, 2022</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> 「ふしぎなおくりもの」を受け取れないWi-Fiコネクション代替サーバーを作りました。 ハック要素濃いめの内容なので、苦手な方はブラウザバックをお願いします。伝わる人向けに書いています。 ## はじめに(ぽえむ) > かがくの ちからって すげー! > > いまじゃ むせんを つかって > せかいの ひとびとと つながるんだと ポケモンにおいては第4・5世代にまたがるDS/Wiiの隆盛期に、「ニンテンドーWi-Fiコネクション」というインターネット通信サービスがあったことを覚えていますか。私と同年代の方々には、DS片手にマクドナルドに通った思い出のある方もいらっしゃるかと思います。 ポケモンでは「Wi-Fiひろば」「GTS」「Wi-Fiバトルルーム」「ランダムマッチ」などが提供され、先の台詞に違わない革新的な通信体験でしたが、[2014年5月20日をもって終了](https://www.nintendo.co.jp/support/information/2014/0227.html)し、3DS/Wii U向けの「ニンテンドーネットワーク」へと移行しました。 現在では、アクセスを試みても「このソフトのWi-Fiコネクションサービスは終了しました」とすげなく表示されるのみです。 --- 時に、ポケモンには第3世代より「リボン」という収集要素があります。自分が好きなポケモンに可能な限りのリボンをつけて20年に渡る過去作品を一巡する「リボンコンプ」はやり込みプレイヤーの憧れの的であり、現行世代である剣盾で登場した証や二つ名を鑑みると、開発側としても世代を超えるトロフィーとして推していく意欲があることが窺えます。一説には過去作が値下がりしない原因の一つだとも... いまや80を超えるこれらリボンのうち、ひときわ価値のあるものが第4世代、Wi-Fiバトルルームを勝ち上がることで入手する「ワールドアビリティリボン」だということは、誰もが認めるところでしょう。ポケモンバンクを通過する際に「おもいでバトルリボン」に統合されてしまいますが、全てのバトル施設リボンをコンプした場合(合計8つ)としていない場合で形が変わるという憎い仕様になっています。 前述の通りWi-Fiコネクションが終了した現在では、このリボンをゲーム内で獲得する手段はありません。 ![](https://i.imgur.com/S0NDZwN.jpg) --- Wi-Fiコネクションは終了した、ゲーム内で獲得する手段がないと言いましたが、実際のところ必ずしもそうとも言えません。 ニンテンドーWi-Fiコネクションは人気なサービスであったため、世界中のハッカーがリバースエンジニアリングに[取り組みました](https://gigazine.net/news/20140523-nintendo-wii-wi-fi-connection/)し、サービス終了直後から代替サーバーが建ったと聞きます。その末裔がよく知られた「[Wiimmfi](https://wiimmfi.de/)」であり、現在では本体やソフトに改造を施さずとも接続することができると知られています。 もちろんこれに接続し、過去に挑戦した世界中の人々の記録と競い条件を満たすことによっても、データとしては相違ないワールドアビリティリボンを獲得することは可能です。しかし多くのポケモン愛好家・リボン収集勢たちはこれをよしとはしないでしょう。代表的な理由は、Wiimmfiに限らず海外の有志サーバーはどこも、現在は入手することができないはずの「ふしぎなおくりもの」を配信していることにあると見受けられます。 配布限定の貴重な道具や幻のポケモンなどが入手し放題になっていることについては目に余るものがあると思っていますし、これを擁護するつもりはありません。しかし代替サーバーの技術単体についてなら話が別です。個人的には、既にサービスが終了したゲームであり現行の作品や開発者と利益の衝突がない範囲で黙認される限りで、初代からポケットモンスターというシリーズの核である通信機能が提供されることには価値があると考えます。 だいいち私には、本質は先駆者が「手を汚して」調査開拓した内部値のエミュレーションであるところの乱数調整をはじめとして、マイコンを使用する自動化から筐体改造を伴う偽トロの取り付けまでありがたく利用してきたのに、代替サーバーだけを否定できるうまい道理もないように思われます。 ということで、「ふしぎなおくりもの」をばらまかずWi-Fiバトルルーム機能を提供してくれる、個人の倫理観的に許せる代替サーバーを作り、自分で利用しようというのが今回のテーマです。 ## Wi-Fiバトルルーム 前提としてWi-Fiバトルルームを紹介し、サーバーの役割を確認します。 バトルタワーの右端がWi-Fiバトルルームの受付になっています。出場するポケモンを選択すると接続画面に遷移します。 ![](https://i.imgur.com/Tj3g7Y6.jpg) ルームを選択します。サーバーではルーム毎に戦績を管理しており、その記録から7戦分のデータを選出し配信しています。ダウンロードが終了するとWi-Fiから切断されます。 ![](https://i.imgur.com/rZbRNzZ.jpg) この後の流れは通常のバトルタワーと同じです。この間には通信は行われていません。 退場後、今回の成績をサーバーに送信するかと問われます。「はい」を選択した場合には再び接続画面に遷移し、アップロードが行われます。 ![](https://i.imgur.com/9e92rVF.jpg) 上記の流れの中でサーバーが果たす機能は意外にも僅かです。最低限の機能を提供することだけを考えれば、7戦分のデータ配信だけを正しく行えばWi-Fiバトルルームは成立します。リボンの付与はソフト側にもとより内蔵されている機能であり、受信したコンテンツは関与しません。 ## 技術背景 今回利用するのはDockerです。可搬性に優れ破棄しやすい仮想マシンの親戚という説明でいかがでしょうか。詳しく述べるほど知りません。 全体的な構造としてはDNSサーバー(\*.nintendowifi.netがどこを指しているのかを書き換える)とWebサーバー(書き換え先で稼働しコンテンツを提供する)の合わせ技となっています。dnsmasqとApache+Monoを利用しますが、特にApacheはDSの貧相で脆弱な認証機能に対応させるためにOpenSSL共々自前でビルドする必要がありました。つまり、このサーバーはあくまで個人用であり、広くアドレスを公表するなどして公開すべきものではないことをご理解ください。 サーバー機能を提供するのは[dwc_network_server_emulator](https://github.com/barronwaffles/dwc_network_server_emulator)です。これとは断言されていませんが、前述のWiimmfiもこれに準ずるソフトウェアを利用しているものと考えられます。フォークの利用が[推奨されており](https://github.com/barronwaffles/dwc_network_server_emulator/wiki/Setting-up-a-server-from-a-fresh-installation-of-Linux)、今回構築するものもこれに従います。 ポケモンに限定して、上記サーバーの一部を置換するのが[Poké Classic Framework](https://github.com/mm201/pkmn-classic-framework)です。バトルタワーやGTSなど一部の機能に対応しています。今回対応するのは、この中でも一部のみです。バトルタワーと、GTSに預ける/引き出すくらいしか動作していません。 DSの接続にはWEPあるいはセキュリティなしのネットワークが必要です。これらの設定は問題があるとされ、現在ではデフォルトで無効化されていることのほうが多いです。必要があるのは代替サーバーだからではなく、前述の通りDS当時のハードウェアの限界による事由です。スマートフォンのテザリングなどで利用し、大切なネットワークからは切り離した状態で運用することをお勧めします。 [このページ](https://github.com/barronwaffles/dwc_network_server_emulator/wiki/Troubleshooting)下部の指示に従い、予めPCのポートを解放する必要があります。UDPはDNSサーバーが利用する53番を開けておけば、Wi-Fiバトルルームには十分です。 Windowsでしか動作確認していません。Dockerを利用するので実行時のOSは問わないと思いますが、結構PCのスペックが要求されるものと思ってください。 ## 構築手順 <a href="https://github.com/mukai1011/pkmn-wfc-server"><img src="https://github-link-card.s3.ap-northeast-1.amazonaws.com/mukai1011/pkmn-wfc-server.png" width="460px"></a> 以下は個人的なメモだと心得てください。 1. `dnsmasq/wfc.conf` の `192.168.*.*` を自分の環境のものに変更する。 - Windowsであれば `ipconfig` コマンドで確認できます。 2. Dockerイメージを構築する。 ```shell docker-compose build ``` 3. `http://localhost/?page=admin&section=Dashboard` にアクセスしWhitelistにタイトルを追加する。 - username:'admin', password:'opensesame' - docker-compose.ymlで変更もできます。 | タイトル | コード | | ---- | ---- | | ダイヤモンド | ADA | | パール | APA | | プラチナ | CPU | | ハートゴールド | IPK | | ソウルシルバー | IPG | 4. DS側でDNSサーバーとして先ほど調べたIPアドレスを指定してやる。 ## おわりに 以上の手順で、自宅のPCに比較的クリーンで個人的には倫理観に反しないWi-Fiコネクション代替サーバーを構築することができるようになりました。規定数勝利するとリボンを受け取ることができることも確認しています。 対戦相手として[ここ](https://github.com/mm201/pkmn-classic-framework/blob/master/gts/src/FakeOpponentGenerator4.cs)で確認できるダミーデータを受信しますが、不正なポケモンではないと思います。かなり強いので対策が要ります。 ![](https://i.imgur.com/FMCxwkV.png) 結局私の言うクリーンかそうでないかは自己満足で、正規と呼ぶにはもちろんほど遠く、少なくとも想定されていない遊び方でありグレーというには十分黒いことは理解しています。とはいえいずれにせよ、もう二度と公式のサーバーが建つことはない上に復刻も有り得ないのですから、私はこれで収集していくつもりです。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully