[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-105464":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":12,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":14,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":16,"fork":16,"defaultBranch":17,"hasWiki":18,"hasPages":16,"topics":19,"createdAt":9,"pushedAt":9,"updatedAt":20,"readmeContent":21,"aiSummary":9,"trendingCount":14,"starSnapshotCount":14,"syncStatus":22,"lastSyncTime":23,"discoverSource":24},105464,"sh2-nx","cutarev\u002Fsh2-nx","cutarev","Silent Hill 2 (PC) statically recompiled to run natively on the Nintendo Switch. Bring your own game files.",null,"C",52,3,51,0,34.81,false,"main",true,[],"2026-11-01 00:17:23","\u003Cdiv align=center>\n\n\u003Cimg src=\"docs\u002Fbanner.png\" alt=\"Silent Hill 2\" width=\"70%\">\n\n\u003C\u002Fdiv>\n\u003Ch1 align=center>Silent Hill 2 — Nintendo Switch port\u003C\u002Fh1>\n\n\u003Cp align=center>\u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FH9yb3hSkvf\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-Join%20the%20server-5865F2?logo=discord&logoColor=white\" alt=\"Discord\">\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp align=center>\u003Cb>v1.02\u003C\u002Fb>\u003C\u002Fp>\n\nA native Nintendo Switch port of the PC version of **Silent Hill 2** (Director's Cut \u002F Restless Dreams), with\nsupport for the packs of **[Silent Hill 2: Enhanced Edition](https:\u002F\u002Fenhanced.townofsilenthill.com\u002FSH2\u002F)**.\n\nIt's not an emulator. The game's x86 executable is statically recompiled to C ahead of time and the C is compiled\nfor the Switch's ARM64 CPU. The Windows layer the game expects (Direct3D 8, DirectSound, DirectInput, Bink,\nkernel32...) is reimplemented on top of SDL2, OpenGL and FFmpeg.\n\n> [!NOTE]\n> No game files are included. You need your own copy of the PC game with the Enhanced Edition installed; the NRO\n> from [Releases](https:\u002F\u002Fgithub.com\u002Fcutarev\u002Fsh2-nx\u002Freleases), or one you build yourself\n> ([Building the NRO](#building-the-nro)), runs it.\n\n## Features\n\n- **Native code**: every function of `sh2pc.exe` runs as ARM64 code; no emulator, no Wine.\n- **Launcher**: Play and Options before the game; Options changes the main `sh2e.ini` settings on the console.\n- **Widescreen**: 16:9, drawn at 720p handheld and 1080p docked, or the original 4:3 (ThirteenAG's\n  WidescreenFix, ported).\n- **Enhanced Edition packs**: HD textures and maps, the EE title and save screens, the restored music, voices and sound\n  effects, EE menus, EE's high resolution font (`sh2e\u002Ffont`, which also has the Japanese text), and the FMV pack's 1080p60\n  movies with their subtitles (`movie=1`). Translations made for the Enhanced Edition load from a `lang` folder.\n- **Enhanced Edition fixes**: search camera on the right stick, movement on the d-pad, pause menu fix, vibration\n  fixes.\n- **Controller**: SH2EE's button layout with Nintendo's A\u002FB, HD rumble following the in-game Vibration option.\n- **Saving and loading**, movies with synced audio, every menu.\n- **Shader cache**: shaders are compiled once and kept on the SD card, so areas only stutter the first time.\n- Also builds for Linux (x86-64), which is where most of the debugging happens.\n\n## How to install\n\n1. On your PC, install Silent Hill 2 and run the [Enhanced Edition setup](https:\u002F\u002Fenhanced.townofsilenthill.com\u002FSH2\u002F)\n   with at least the **Enhanced Executable**, **Essential Files**, **Image Enhancement Pack** and **Audio Enhancement\n   Pack**. The port is built for the `sh2pc.exe` it installs: 5,685,248 bytes, SHA-1\n   `3201a5e1029f3ae3b77770255dcbe10360b3cd09`.\n2. Get `sh2-nx.nro` from [Releases](https:\u002F\u002Fgithub.com\u002Fcutarev\u002Fsh2-nx\u002Freleases), or build it from that folder\n   ([Building the NRO](#building-the-nro)).\n3. Copy everything to the SD card. With the card (or its folder) mounted on the PC:\n\n   ```sh\n   .venv\u002Fbin\u002Fpython tools\u002Fmake_sd.py \u002Fpath\u002Fto\u002Fsd --lang en      # en, fr, de, it, es or jp\n   ```\n\n   or by hand. Your `sh2-nx` folder should look like this:\n\n   ```text\n   \u002Fswitch\u002Fsh2-nx\u002F\n     sh2-nx.nro\n     sh2pc.exe        (from your PC install)\n     data\u002F            (from your PC install, about 2.4 GB)\n     sh2e\u002F            (from your PC install, about 6 GB with sh2e\u002Fmovie)\n     sh2e.ini         (which Enhanced Edition packs to use: docs\u002Fsh2e.ini.example)\n     language.ini     (optional: SET DX_CONFIG_LANGUAGE 1 is English)\n     lang\u002F            (optional: a translation for the Enhanced Edition, e.g. Russian)\n     keyconf.dat      (optional: your PC's button mapping)\n   ```\n\n   `sh2e\u002Fpic\u002Fetc` and `sh2e\u002Fmenu\u002Fmc` are needed even with every pack switched off: the title and save screens are laid\n   out for the Enhanced Edition's art.\n\n4. Launch it from the homebrew menu in **title takeover** mode (hold **R** while starting an installed game) or from a\n   forwarder set to a **39-bit address space**. Not from the album: applet mode does not give homebrew enough memory.\n\nSettings, saves (`data\u002Fsave`) and the shader cache are written next to the NRO.\n\n> [!CAUTION]\n> The first time you enter an area its shaders are compiled, so **it can stutter for a moment**. They are kept in\n> `sh2-progs.bin` and later visits are smooth.\n\n## Controls\n\n\u003Cdiv align=\"center\">\n\n| Switch | Xbox (PC) | Action |\n| --- | --- | --- |\n| A | A | Action, confirm |\n| B | B | Cancel, flashlight |\n| Y | X | Run \u002F guard |\n| X | Y | Map |\n| L \u002F R | LB \u002F RB | Cycle target |\n| ZL | LT | Search mode (ready the weapon) |\n| ZR | RT | Aim lock |\n| + | Start | Inventory |\n| − | Back | Skip \u002F pause |\n| Left stick, d-pad | Left stick, d-pad | Move |\n| Right stick | Right stick | Search camera |\n\n\u003C\u002Fdiv>\n\nA confirms and B cancels, as in other Switch games, so those two sit swapped compared with an Xbox pad; every other\nbutton is in the same place as on an Xbox pad with the Enhanced Edition. Remap them in Options > Control Options; a\n`keyconf.dat` from a PC install maps the same buttons.\n\n## Settings\n\n`sh2e.ini`, next to the NRO ([example](docs\u002Fsh2e.ini.example)); the launcher's Options screen sets `resolution`,\n`handheld`, `docked`, `movie`, `PreserveSoundsOnLoad` and `cores`:\n\n| Setting | Effect |\n| --- | --- |\n| `pic=1`, `sound=1`, `bg=1`, ... | read that folder of `data\u002F` from `sh2e\u002F` (the Enhanced Edition pack) |\n| `movie=1` | the FMV pack (`sh2e\u002Fmovie`): its 1080p60 videos play at speed with their subtitles; the Switch drops frames decoding them. `movie=0` plays the original videos |\n| `resolution=1920x1080` | the default; `1280x720` for a lighter game, `960x720` for the original 4:3 |\n| `handheld=720`, `docked=0` | the defaults (720p handheld, 1080p docked): how many lines the screen-sized render targets are drawn with in each mode, then scaled to the screen (the game is still laid out for `resolution`); `0` draws them at the game's resolution. Docking or undocking switches at the next frame |\n| `FlashlightToggleSFX=0` | no click when the flashlight is switched (on by default when `sh2e\u002Fsound\u002Fextra` has the sounds) |\n| `PreserveSoundsOnLoad=0` | the game's own load and save sounds, which loading cuts off (by default the Enhanced Edition's play through) |\n| `cores=1` | every game thread on one core, a fallback if the music ever loops again |\n| `log=1` | write `sh2.log` next to the NRO, for bug reports (off by default: it costs an SD card write per line). Crashes always go to `sh2-crash.log` |\n\n### Movies\n\nThe movie loop no longer waits for the 30 Hz limiter (EE `FixFMVSpeed`), subtitles follow the video's frame rate\n(EE `FmvSubtitlesSyncFix`), and a video the Switch cannot decode in time drops frames to keep up with its sound.\nWith that the FMV pack's 60 fps videos play at speed (`movie=1`). The game itself runs at its original 30 fps.\n\n## Building the NRO\n\nYou need the game (step 1 of [How to install](#how-to-install)): the code generator reads `sh2pc.exe`, applies the\nEnhanced Edition patches to it and recompiles it.\n\nRequirements: Python 3, CMake, Ninja, and for the Switch build podman (or a local devkitPro install with devkitA64,\nlibnx, switch-sdl2, switch-mesa, switch-ffmpeg and switch-pkg-config). For the Linux build, SDL2 and FFmpeg\ndevelopment files (Fedora: `dnf install SDL2-devel ffmpeg-free-devel`).\n\n```sh\ngit clone https:\u002F\u002Fgithub.com\u002Fcutarev\u002Fsh2-nx && cd sh2-nx\npython3 -m venv .venv && .venv\u002Fbin\u002Fpip install -r requirements.txt\nln -s \"\u002Fpath\u002Fto\u002FSilent Hill 2\" game     # the folder holding sh2pc.exe, data\u002F and sh2e\u002F\ntools\u002Fregen.sh                          # patches and recompiles game\u002Fsh2pc.exe into src\u002Frecomp\u002Fgen (~4 min)\n\ntools\u002Fbuild-switch.sh                   # -> build\u002Fswitch\u002Fsh2-nx.nro (devkitPro's container under podman)\ntools\u002Fbuild-switch-local.sh             # the same with a local devkitPro install\n\ncmake -S . -B build\u002Flinux -G Ninja && cmake --build build\u002Flinux    # Linux build\nbuild\u002Flinux\u002Fsh2 game\n```\n\n## How it works\n\n- **The game's code is translated, not emulated.** `tools\u002Fregen.sh` wraps the PE as an XBE for\n  [xboxrecomp](https:\u002F\u002Fgithub.com\u002Fsp00nznet\u002Fxboxrecomp) (patched for this port: flag joins, jump tables, x87\u002FMMX\n  corner cases, setjmp\u002Flongjmp), which turns every function into C.\n- **Enhanced Edition patches.** EE patches the running game from its `d3d8.dll`; here its code byte patches are\n  applied to the exe before recompiling (`tools\u002Fpatch_exe.py`, each site checked against the original bytes) and its\n  hooks become hand-written functions in `src\u002Fgame\u002Fee.c`. Details in [docs\u002FENHANCED.md](docs\u002FENHANCED.md).\n- **The Windows layer.** Direct3D 8 runs on OpenGL 4.3 core with the shaders translated to GLSL (`src\u002Fd3d8`),\n  DirectSound is a software mixer on SDL audio, DirectInput goes through SDL, Bink videos through FFmpeg, and\n  kernel32, user32 and msvcr70 are in `src\u002Fwin32`. `src\u002Fruntime` holds the guest memory, threads and the\n  Linux\u002FHorizon layer.\n\n## Debugging aids (Linux)\n\n| Variable | Effect |\n| --- | --- |\n| `SH2_KEYS=\"12:Return,30:W+5\"` | scripted key presses (seconds, key, optional hold); the window is hidden and the real keyboard ignored |\n| `SH2_SHOW=1` | keep the window visible during a scripted run |\n| `SH2_SHOT=dir`, `SH2_SHOT_EVERY=n` | dump frames as PPM (`tools\u002Fppm2png.py`) |\n| `SH2_WAV=file` | record the audio mix (raw float32 stereo, 44.1 kHz) |\n| `SH2_STATS=1` | frame rate and guest heap |\n| `SH2_TRACE=1` | log every bridged Windows call (`trace=1` with `log=1` in `sh2e.ini` on the Switch) |\n| `SH2_COVER=frame` | with a tracing build (`TRACE=$PWD\u002Fbuild\u002Fdisasm\u002Ffunctions.json tools\u002Fregen.sh --recomp-only`), log each function the first time it runs after that frame |\n| `SH2_ORACLE=va,n` | differential test of one function against Unicorn (`tools\u002Foracle.py`) |\n\n`tools\u002Ffuzz.py` checks the lifter's instruction semantics against Unicorn.\n\n## Credits\n\n- **Konami and Team Silent**: creators of Silent Hill 2. This is an unofficial, fan-made port with no affiliation.\n- **[r4lix](https:\u002F\u002Fgithub.com\u002Fr4lix\u002Fsh2-nx)** and Le Z: the Enhanced Edition support, widescreen, HD rumble, the\n  shader cache and the lifter, save and front buffer fixes in v0.55.\n- **[Silent Hill 2 Enhancements](https:\u002F\u002Fgithub.com\u002Felishacloud\u002FSilent-Hill-2-Enhancements)** by Elisha Riedlinger and\n  contributors (zlib): the patches ported in `src\u002Fgame\u002Fee.c` and `tools\u002Fpatch_exe.py`.\n- **[WidescreenFixesPack](https:\u002F\u002Fgithub.com\u002FThirteenAG\u002FWidescreenFixesPack)** by ThirteenAG (MIT): the widescreen fix.\n- **[xboxrecomp](https:\u002F\u002Fgithub.com\u002Fsp00nznet\u002Fxboxrecomp)** by sp00nznet: the x86 to C lifter.\n- **nfsmw-nx**, the Need for Speed: Most Wanted Switch port, for the Horizon guest-memory technique.\n- **[devkitPro](https:\u002F\u002Fdevkitpro.org) and [switchbrew](https:\u002F\u002Fgithub.com\u002Fswitchbrew\u002Flibnx)**, SDL2, FFmpeg, Mesa.\n\n## Legal\n\nSilent Hill is a trademark of Konami. This project is not affiliated with Konami. This repository contains no assets\nor program code from the original game; users must provide their own copy. Running homebrew requires custom firmware.\n",2,"2026-10-31 04:26:52","CREATED_QUERY"]