koin.js 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Mudit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # koin.js
2
+
3
+ ## Browser Retro Game Emulation for React
4
+
5
+ > **27 systems. Cloud saves. Zero backend required.**
6
+
7
+ [![Try the Demo](https://img.shields.io/badge/PLAY-TRY%20THE%20DEMO-FFD600?style=for-the-badge&logoColor=black&labelColor=black)](https://koin.js.org/)
8
+ [![NPM Version](https://img.shields.io/npm/v/koin.js?style=for-the-badge&color=white&labelColor=black)](https://www.npmjs.com/package/koin.js)
9
+ [![License](https://img.shields.io/npm/l/koin.js?style=for-the-badge&color=white&labelColor=black)](LICENSE)
10
+
11
+ The drop-in React component for browser-based retro game emulation. Built on [Nostalgist.js](https://github.com/arianrhodsandlot/nostalgist), adding production-ready features like cloud saves, touch controls, gameplay recording, and RetroAchievements.
12
+
13
+ ![koin.js](./koin-player.png)
14
+
15
+ ## Features
16
+
17
+ - 🎮 **27 Systems** — NES to PlayStation, Game Boy to Arcade
18
+ - ☁️ **Cloud-Ready Saves** — Slot-based saves with screenshots, auto-save, emergency saves
19
+ - ⏪ **Rewind Time** — Go back in time (auto-enabled for 8/16-bit systems)
20
+ - 🏆 **RetroAchievements** — Official RA integration with hardcore mode
21
+ - 📱 **Touch Controls** — GPU-accelerated virtual D-pad and buttons
22
+ - 📹 **Gameplay Recording** — VP9 WebM capture at 30fps
23
+ - 🎨 **10 CRT Shaders** — Lottes, Geom, zFast, LCD Grid, and more
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install koin.js
29
+ # or
30
+ yarn add koin.js
31
+ # or
32
+ pnpm add koin.js
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ ```tsx
38
+ import { GamePlayer } from 'koin.js';
39
+
40
+ export default function App() {
41
+ return (
42
+ <GamePlayer
43
+ romId="game-123"
44
+ romUrl="/roms/mario.nes"
45
+ system="NES"
46
+ title="Super Mario Bros."
47
+ />
48
+ );
49
+ }
50
+ ```
51
+
52
+ ## Cloud Integration
53
+
54
+ ```tsx
55
+ import { GamePlayer } from 'koin.js';
56
+
57
+ <GamePlayer
58
+ romId="game-123"
59
+ romUrl="/roms/game.nes"
60
+ system="NES"
61
+ title="My Game"
62
+
63
+ // Your backend handlers
64
+ onSaveState={async (slot, blob, screenshot) => { /* save to your API */ }}
65
+ onLoadState={async (slot) => { /* return Blob or null */ }}
66
+ onAutoSave={async (blob, screenshot) => { /* periodic save */ }}
67
+
68
+ // Optional theming
69
+ systemColor="#FF3333"
70
+ shader="crt/crt-lottes"
71
+ />
72
+ ```
73
+
74
+ ## Web Component
75
+
76
+ ```html
77
+ <script src="https://unpkg.com/koin.js/dist/web-component.global.js"></script>
78
+
79
+ <retro-game-player
80
+ rom-url="./game.nes"
81
+ system="nes"
82
+ title="My Game"
83
+ rom-id="game-1"
84
+ ></retro-game-player>
85
+ ```
86
+
87
+ ## Supported Systems
88
+
89
+ | System | Key | Core |
90
+ |--------|-----|------|
91
+ | NES / Famicom | `NES` | fceumm |
92
+ | Super Nintendo | `SNES` | snes9x |
93
+ | Nintendo 64 | `N64` | mupen64plus_next |
94
+ | Game Boy / Color / Advance | `GB`, `GBC`, `GBA` | gambatte, mgba |
95
+ | Nintendo DS | `NDS` | desmume |
96
+ | PlayStation | `PS1` | pcsx_rearmed |
97
+ | PSP | `PSP` | ppsspp |
98
+ | Genesis / Mega Drive | `GENESIS` | genesis_plus_gx |
99
+ | Master System | `MASTER_SYSTEM` | gearsystem |
100
+ | Game Gear | `GAME_GEAR` | gearsystem |
101
+ | Saturn | `SATURN` | yabasanshiro |
102
+ | Dreamcast | `DREAMCAST` | flycast |
103
+ | Neo Geo | `NEOGEO` | fbalpha2012_neogeo |
104
+ | Arcade (MAME) | `ARCADE` | mame2003_plus |
105
+ | ...and 13 more | [See full list](https://koin.js.org/docs/systems) |
106
+
107
+ ## Requirements
108
+
109
+ **COOP/COEP Headers Required** for `SharedArrayBuffer`:
110
+
111
+ ```js
112
+ // next.config.js
113
+ async headers() {
114
+ return [{
115
+ source: '/:path*',
116
+ headers: [
117
+ { key: 'Cross-Origin-Opener-Policy', value: 'same-origin' },
118
+ { key: 'Cross-Origin-Embedder-Policy', value: 'require-corp' },
119
+ ],
120
+ }];
121
+ }
122
+ ```
123
+
124
+ ## Documentation
125
+
126
+ Full documentation at **[koin.js.org](https://koin.js.org/docs)**
127
+
128
+ ## License
129
+
130
+ MIT © Mudit Juneja