# Trapezoid
[](https://actions-badge.atrox.dev/Amjad50/trapezoid/goto)
[](https://deps.rs/repo/github/Amjad50/trapezoid)
[](./LICENSE)
[](https://crates.io/crates/trapezoid)
**trapezoid** is a [PSX/PS1](https://en.wikipedia.org/wiki/PlayStation_(console)) emulator built from scratch using [Rust].
This is a personal project for fun and to experience emulating hardware and connecting them together.
## Showcase
<img src="assets/psx.png" alt="demo" width="600"/>
## Building and installation
### Installing
You can install `trapezoid` from [`crates.io`](https://crates.io/crates/trapezoid) using `cargo`:
```
cargo install trapezoid
```
### Building
If you want to experience the latest development version, you can build `trapezoid` yourself.
```
cargo build --release
```
> The emulator will be slow without optimization, that's why we have `opt-level = 2` in `debug` profile.
## Emulator core
The emulator core is implemented as a library in [`trapezoid-core`], this library is the emulator core, and contain
all the components. You can easily take the core and build a frontend around it, or use it as a server.
Check the [`trapezoid-core`] for more info and documentation.
## Frontend
### Controls
The Frontend implementations has its own controls mapping, this can be configured
if you decide to use [`trapezoid-core`] directly
#### Keyboard
| Enter | Start |
| Backspace | Select |
| Num1 | L1 |
| Num2 | L2 |
| Num3 | L3 |
| Num0 | R1 |
| Num9 | R2 |
| Num8 | R3 |
| W | Up |
| S | Down |
| D | Right |
| A | Left |
| I | Triangle |
| K | X |
| L | Circle |
| J | Square |
### Debugging
`trapezoid` has a built-in powerfull debugger to help debug games and access to data.
Check [DEBUGGER.md](./DEBUGGER.md) for more information.
#### VRAM
We can view the raw vram state, which you can think of as an image of 1024x512 pixels
This can be triggerd with the keyboard button `v`.

### Contributions and TODO
Check the [`trapezoid-core`] for more information about TODO items related to the emulator.
Also check the [issues](https://github.com/Amjad50/Trapezoid/issues).
Really appreciate any contributions. Thanks!
### License
This project is under [MIT](./LICENSE) license.
NES is a product and/or trademark of Nintendo Co., Ltd. Nintendo Co., Ltd. and is not affiliated in any way with Plastic or its author
### References
Most of the documentation for PSX components can be found in the [consoledev website](https://psx-spx.consoledev.net/)
[Rust]: https://www.rust-lang.org/
[`trapezoid-core`]: ./trapezoid-core/README.md