[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-114055":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":15,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":23,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},114055,"civ7-fs-kaihen","s8n\u002Fciv7-fs-kaihen","s8n","CivSwitch + CivSwitch-kit + civ7-fs + kaiHEN","",null,"JavaScript",111,16,1,4,0,17,58,54.99,false,"main",[],"2026-11-15 20:17:02","2026-11-22 15:43:05","# civ7-fs-kaihen\n\n\n> [!IMPORTANT]\n> Consider using [CivSwitchFS-kaiHEN](https:\u002F\u002Fgithub.com\u002Fs8n\u002FCivSwitchFS-kaiHEN) instead! It's much faster and runs fully on device, doesn't require ethernet either. Semi-untethered, even!\n\nBoots kaiHEN 20261114c on a Switch 2 through Civilization VII.\n\n[kaiHEN](https:\u002F\u002Fgithub.com\u002Founcebrew\u002Fkaihen) is a homebrew enabler (HEN)\nfor Switch 2: once it runs, holding R while opening a game starts\nhomebrew menu instead. kaiHEN normally starts from the game SmileBASIC.\nThis repository starts it from Civilization VII instead, using the fs\nexploit from [civ7-fs](https:\u002F\u002Fgithub.com\u002FHerXayah\u002Fciv7-fs) and Gezine's\n[CivSwitch](https:\u002F\u002Fgithub.com\u002FGezine\u002FCivSwitch) as the way in.\n\n## What you need\n\n- A Switch 2 \u003C= 23.0.1. Only tested on firmware 23.0.1, does not work on any lower\n  right now. It's much slower without the exFAT update as that's what wave\n  timing is tuned for, but [it'll work given enough tries](https:\u002F\u002Ftheonion.com\u002Fstudy-83-of-gamblers-quit-right-before-they-would-hav-1819575092\u002F).\n- Civilization VII on cartridge and CivSwitch set up,\n  so that the game shows `Awaiting payload at \u003Cconsole-ip>:9026` when started.\n- An SD card in the console. A non-express microSD card will work too, press\n  home when you get the micronag (telling you this card isn't supported).\n- A computer on the same network, preferably running Linux or macOS, with a\n  recent Node.js (tested with 24). No `npm install` is needed.\n- The [kaiHEN](https:\u002F\u002Fgithub.com\u002Founcebrew\u002Fkaihen) 20261114c release, unpacked.\n\n## Booting kaiHEN\n\n0. Set up your save file with CivSwitch. You may need to go to Data Management\n   to delete your save file and reinstall it occasionally. [This esp32 LDN\n   approach](https:\u002F\u002Fgithub.com\u002FSeanHeuc\u002FCivSwitch\u002Ftree\u002Fmain\u002Fesp32-ldn-civ7)\n   is highly recommended. Insert your microSD card before you start.\n1. Set up a wired connection that won't get you Nintendo server access.\n   Be very careful with this. If you don't know how to do this right,\n   DO NOT USE THIS YET. It's not worth the risk of getting the blacklist\n   update that'll lock you out of Civ 7 without a reboot. If you will set up\n   90DNS, follow the [instructions on Gitlab](https:\u002F\u002Fa.gitlab.io\u002F90dns\u002F)\n   precisely, do not skip any steps.\n2. Boot into CivSwitch console by going to Civ 7 -> Load Game.\n   Wait for `Awaiting payload`.\n3. From this repository's folder, run the launcher with your console's IP\n   address:\n\n   ```sh\n   node engine\u002Fhen.cjs 192.168.2.118 --dir \u002Fpath\u002Fto\u002Fextracted\u002Fkaihen\n   ```\n\n4. Wait, usually a few minutes. The run goes through four phases:\n\n   1. checking the console\n   2. acquiring FS memory\n   3. starting the native helper\n   4. connecting to the RO frontend (kaiHEN's replacement for the console's\n      RO service)\n\n   It then copies hbmenu, the game loader, the programs and HEN to the SD\n   card and starts kaiHEN's bootstrap. A successful run ends like this:\n\n   ```\n   RO frontend verified. ...\n   Staging HEN\n   Starting native bootstrap\n   HEN PID 210; startup record: ...\u002Fswitch2\u002Fro\u002Fhen-startup.json\n   HEN is running. Close Civilization VII normally; hold R while opening a native game.\n   ```\n\n5. Close Civilization VII normally. The launcher exits once the game closes.\n   HEN keeps running on the console, and the computer is no longer needed until you restart.\n6. Hold R while opening a different game. The first time, HEN only records\n   the game's signing policy and the game starts as usual. The next R-held\n   launch opens hbmenu.\n7. HEN lasts until the console restarts. Restarting also puts the console's\n   own RO service back. To use homebrew again after a restart, run the\n   launcher again.\n\nLauncher options:\n\n| Option | Effect |\n|---|---|\n| `--dir DIR` | the kaiHEN folder that contains e.g. bootstrap.bin |\n| `--restore-save DIR` | restore the CivSwitch save before starting (see below); `DIR` is the `save-tools` folder of [civswitch-kit](https:\u002F\u002Fgitee.com\u002Fmza1010\u002Fcivswitch-kit) |\n| `--no-hbmenu` | do not copy `hbmenu.nro` |\n| `--no-programs` | do not copy `programs\u002F` to `\u002Fswitch\u002F` on the SD card |\n\nThe computer listens on port 39380 for the console to connect. If something\nelse uses that port, set `NS2_PC_PORT` to another one; the launcher sends the\nsame port to the console.\n\n## When it fails\n\nMost failed runs stop in phase 2 with `Positive canary verification failed`,\nor in phase 3 at `find-metadata` or `install-retained`. Getting FS memory is a\nrace and often takes several tries. kaiHEN has not run at that point.\n\nPhase 2 tries up to 30 waves (race attempts) before it gives up. No test run on\nmy console has succeeded after wave 10, so `NS2_WAVE_ATTEMPTS=10` may be the better\nsetting to save time and fail early.\n\nAfter a failed run:\n\n1. Restart the console. Make one attempt per console boot.\n2. Start again from step 1 of *Booting kaiHEN*.\n3. If failing too long, you may want to re-do your save file.\n\nEvery run writes a folder under `runs\u002F`. `run.log` has the full output. After\na HEN attempt, `switch2\u002Fro\u002Fhen-startup.json` has the bootstrap's result:\n`operation` 10 with `result` 0 means HEN started, and any other value names\nthe step that failed.\n\nA wired network helps. To stop a run, press Ctrl-C, which releases the\nconsole side cleanly. Do not close the game during a run.\n\n## FS only\n\n`node engine\u002Frun.cjs \u003Cconsole-ip>` runs civ7-fs's own FS test without kaiHEN\nand keeps the connection open for debugging tools. `--help` lists the options.\n\n## Porting notes\n\nYou only need this if you are porting kaiHEN to another game.\n\nkaiHEN's bootstrap gets three thread functions from the computer side:\n`pthread_create`, a try-wait, and `pthread_join`. In SmileBASIC a thread\nhandle is the `nn::os::ThreadType` pointer itself. Civilization VII returns\nthe pointer with its low three bits set (`ThreadType | 7`): `pthread_join`\nrequires that tag and `TryWaitThread` needs it removed. So `engine\u002F` waits on\nthe untagged pointer, joins the tagged one, and places a 24-byte try-wait\nadapter after kaiHEN's unmodified `bootstrap.bin`.\n`targets\u002Fciv7\u002Fapp\u002Fthread-code.json` has the disassembly references.\n\n## Standing on the shoulders of giants\n\n- [Gezine](https:\u002F\u002Fgithub.com\u002FGezine\u002FCivSwitch) for CivSwitch, the Civ7\n  entrypoint.\n- [civswitch-kit](https:\u002F\u002Fgitee.com\u002Fmza1010\u002Fcivswitch-kit), the original Civ7\n  FS kit, based on slapah\u002FHokage's work, which is itself based on ns2jb.\n- [civ7-fs](https:\u002F\u002Fgithub.com\u002FHerXayah\u002Fciv7-fs), the Civ7 FS port this\n  repository builds on.\n- [kurumuz](https:\u002F\u002Fgithub.com\u002Fkurumuz) for kaiHEN and his ns2jb fork.\n- [pepsipu](https:\u002F\u002Fgitlab.com\u002Fpepsipu\u002Fns2jb) for discovering nsj2b vuln, and the ns2jb codebase.\n- LLMs were involved in the development of this. Please don't use it if you don't trust it.\n","这是一个为 Nintendo Switch 2（固件 ≤23.0.1）提供基于《文明VII》游戏的 kaiHEN 家用软件启动器（HEN）的工具链。它复用 civ7-fs 内存漏洞与 CivSwitch 框架，通过网络向主机推送 payload，绕过 SmileBASIC 启动依赖，实现从《文明VII》卡带触发 kaiHEN 20261114c 的半非绑定式运行。项目基于 Node.js 实现轻量级控制逻辑，无需 npm 依赖，支持本地网络部署与 SD 卡自动写入。适用于已拥有 Civ 7 实体卡、具备基础网络隔离能力（如 90DNS）且需在不直连任天堂服务器前提下安全加载自制软件的 Switch 2 用户。",2,"2026-11-24 04:47:49","CREATED_QUERY"]