Skip to content

Commit

Permalink
docs: update docs and fix some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
arianrhodsandlot committed Jan 3, 2024
1 parent e1ecb84 commit e21b35a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions docs/src/content/docs/apis/launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,13 @@ const nostalgist = await Nostalgist.launch({

**type:** `string | HTMLCanvasElement` **default:** an empty string `''`

Use this option to specify the canvas element you want to launch the emulator with. If it's an `string`, we will look up the element by `documen.querySelector`
Use this option to specify the canvas element you want to launch the emulator with. If it's an `string`, we will look up the element by `document.querySelector`

If it's an empty string, a canvas element will be created automaticlly and this canvas element will be append to `document.body`.
If it's an empty string, a canvas element will be created automatically and this canvas element will be append to `document.body`.

For example,
```js
await Nostalgist.launch({
e
rom: 'flappybird.nes',
core: 'fceumm'
})
Expand Down Expand Up @@ -109,6 +108,8 @@ const nostalgist = await Nostalgist.launch({
The size of the canvas element.
If it's `'auto'`, the canvas element will keep its original size, or it's width and height will be updated as specified.

In most cases, it is recommended to specify the size of the element through CSS or the `style` parameter first.

+ #### `core`

**type:** `string | { name: string, js: string, wasm: string | ArrayBuffer }`
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/guides/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ await Nostalgist.nes(await showOpenFilePicker().then(([fileHandle]) => fileHandl
:::

## Try it in online editors
If you want to take a quick look at Nostalgist.js, it's recommended to use some online editor to give it a try.
You can also use some online editor to give it a try.

You can try Nostalgist.js in [Stackblitz](https://stackblitz.com/edit/js-phxocr) by hacking this example, a homebrew retro game list.
<iframe class="playground-iframe" src="https://stackblitz.com/edit/js-phxocr?embed=1&file=index.js&hideNavigation=1&view=preview" style="aspect-ratio: 4/3;"></iframe>
Expand Down
5 changes: 5 additions & 0 deletions docs/src/content/docs/guides/under-the-hood.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ We use [BrowserFS](https://github.com/jvilk/BrowserFS)'s `MemoryFS` to create a

### Step three
Launch RetroArch with the virtual file system and the canvas element we specified in the code.

After launching, Nostalgist.js can comunicate with RetroArch in these ways:
+ Read or write files to the virtual file system.
+ Call functions exported by Emscripten. If the official builds are being used, the functions are listed in [the `Makefile` for theses builds](https://github.com/libretro/RetroArch/blob/1e572aaa7a32807159d809e29f04a9aa52ed8917/Makefile.emscripten#L83).
+ Send commands to the process of RetroArch. All available commands are listed in [the document of RetroArch](https://docs.libretro.com/development/retroarch/network-control-interface/#commands).
2 changes: 1 addition & 1 deletion docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ await Nostalgist.nes('flappybird.nes')
const rom = 'https://example.com/zelda.sfc'
const nostalgist = await Nostalgist.snes(rom)
const FS = nostalgist.getEmscriptenFS()
FS.readFile('/home/web_user/retroarch/userdata/saves/Snes9x/zelda.srm')
FS.readdir('/')
```
</div>

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Checkout [nostalgist.js.org](https://nostalgist.js.org/) for more online example
const rom = 'https://example.com/zelda.sfc'
const nostalgist = await Nostalgist.snes(rom)
const FS = nostalgist.getEmscriptenFS()
FS.readFile('/home/web_user/retroarch/userdata/saves/Snes9x/zelda.srm')
FS.readdir('/')
```

Related APIs: [`getEmscriptenModule`](https://nostalgist.js.org/apis/get-emscripten-module), [`getEmscriptenFS`](https://nostalgist.js.org/apis/get-emscripten-fs)
Expand Down

0 comments on commit e21b35a

Please sign in to comment.