-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from esp-cpp/feature/sms
Sega Master System / Game Gear support via SMSPlus
- Loading branch information
Showing
102 changed files
with
19,817 additions
and
687 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# esp-box-emu | ||
|
||
|
||
<table style="padding:10px"> | ||
<tr> | ||
<td><img src="./logo/logo.jpeg" alt="Logo" width="250" height="250"></td> | ||
|
@@ -59,17 +58,17 @@ This project has the following features (still WIP): | |
|
||
- [x] Squareline Studio design files for generating boilerplate LVGL ([SLS files](./squareline), [Generated files](./components/gui/generated)) | ||
- [x] LVGL gui for selecting emulators / roms (showing boxart and name) | ||
- [x] LVGL gui for controlling settings (such as volume, video, haptics) (using [gui component](./components/gui)) | ||
- [x] LVGL gui for controlling settings (such as volume, video, haptics) | ||
- [x] Loading of gui data (rom titles and boxart) from metadata file (example [here](./metadata.csv)) | ||
- [x] Audio output (using I2S + es8311 audio codec, [es8311 component](./components/codec)) | ||
- [x] Interaction with d-pad + buttons (using [controller component](./components/controller)) | ||
- [x] User input with d-pad + buttons (a/b/x/y, start/select) (using MCP23x17 [v0 hardware] or AW9523 [v1 hardware]) | ||
- [x] Interaction with touchscreen (using [tt21100 component](./components/tt21100)) | ||
- [x] Navigation of LVGL rom menu with controller (up,down,start) | ||
- [x] Runnable emulators (automatically selected by rom extension): | ||
- [x] NES emulator (~100 FPS running Legend of Zelda) | ||
- [x] GB/GBC emulator (~100 FPS running Link's Awakening DX (GBC)) | ||
- [x] NES emulator | ||
- [x] GB/GBC emulator | ||
- [x] Sega Master System (SMS) / GameGear (GG) emulator | ||
- [ ] MSX emulator (WIP) | ||
- [ ] Sega Master System (SMS) / GameGear (GG) emulator (WIP) | ||
- [ ] Sega Mega Drive / Genesis emulator (WIP) | ||
- [ ] SNES emulator | ||
- [ ] Doom emulator (WIP) | ||
|
@@ -79,12 +78,11 @@ This project has the following features (still WIP): | |
(SPIFLASH) | ||
- [X] Emulator framebuffers on SPIRAM | ||
- [x] Queued transfers of screen data for maximum draw speed while running emulation | ||
- [x] Scaling of GB/GBC display to support original, fit, and fill video scaling modes | ||
- [x] Scaling for NES display to support original (which is fit) and fill video scaling modes | ||
- [x] Scaling of emulator video data to support ORIGINAL, FIT, and FILL modes of display data to screen | ||
- [x] Use mute button to toggle volume output while running the roms | ||
- [x] Feedback through tiny haptic motor (DRV2605) | ||
- [x] Save state (with automated save screenshot creation saved to uSD card) | ||
- [x] Load state | ||
- [x] Load state (up to 5 slots per game) | ||
- [x] State management (UI to select state when loading roms, ui/buttons for | ||
saving/loading states while running, and displaying save screenshots) | ||
- [x] Schematic / Layout for control board peripheral containing | ||
|
@@ -101,7 +99,7 @@ This project has the following features (still WIP): | |
- [x] start / select buttons (same location as GBC) | ||
- [x] ABXY buttons (basically same size / location as GBC) | ||
- [x] Directional Pad (same size / location as GBC) | ||
- [ ] Use same audio + video tasks for both NES and GB/C emulation | ||
- [x] Use same audio + video tasks for all emulators | ||
- [ ] Graphics in black borders next to rom display during NES / GB/C emulation | ||
|
||
## Cloning | ||
|
@@ -110,7 +108,7 @@ Since this repo contains a submodule, you need to make sure you clone it | |
recursively, e.g. with: | ||
|
||
``` sh | ||
git clone --recurse-submodules <your repo name> | ||
git clone --recurse-submodules [email protected]:esp-cpp/esp-box-emu | ||
``` | ||
|
||
Alternatively, you can always ensure the submodules are up to date after cloning | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/queue.h" | ||
|
||
#include "format.hpp" | ||
#include "i2s_audio.h" | ||
#include "task.hpp" | ||
|
||
namespace hal { | ||
void init_audio_task(); | ||
void set_audio_sample_count(size_t count); | ||
void push_audio(const void* audio); | ||
} // namespace hal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/queue.h" | ||
|
||
#include "format.hpp" | ||
#include "spi_lcd.h" | ||
#include "task.hpp" | ||
|
||
namespace hal { | ||
void init_video_task(); | ||
void set_display_size(size_t width, size_t height); | ||
void set_native_size(size_t width, size_t height, int pitch = -1); | ||
void set_palette(const uint16_t* palette, size_t size = 256); | ||
void push_frame(const void* frame); | ||
} // namespace hal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "audio_task.hpp" | ||
|
||
using namespace hal; | ||
|
||
static size_t audio_sample_count = 0; | ||
static std::shared_ptr<espp::Task> audio_task_; | ||
static QueueHandle_t audio_queue_; | ||
|
||
static bool audio_task(std::mutex &m, std::condition_variable& cv); | ||
|
||
void hal::init_audio_task() { | ||
static bool initialized = false; | ||
if (initialized) { | ||
return; | ||
} | ||
// audio_queue_ = xQueueCreate(1, sizeof(uint16_t*)); | ||
// audio_task_ = std::make_shared<espp::Task>(espp::Task::Config{ | ||
// .name = "audio task", | ||
// .callback = audio_task, | ||
// .stack_size_bytes = 4*1024, | ||
// .priority = 20, | ||
// .core_id = 1 | ||
// }); | ||
// audio_task_->start(); | ||
initialized = true; | ||
} | ||
|
||
void hal::set_audio_sample_count(size_t count) { | ||
audio_sample_count = count; | ||
} | ||
|
||
void hal::push_audio(const void* audio) { | ||
// if (audio_queue_ == nullptr) { | ||
// fmt::print("audio queue is null, make sure to call init_audio_task() first\n"); | ||
// return; | ||
// } | ||
// xQueueSend(audio_queue_, &audio, 10 / portTICK_PERIOD_MS); | ||
// we got a valid audio frame, so let's play it | ||
const uint8_t* audio_ptr = (const uint8_t*)audio; | ||
// multiply by 2 since we're 16-bit | ||
audio_play_frame(audio_ptr, audio_sample_count*2); | ||
} | ||
|
||
static bool audio_task(std::mutex &m, std::condition_variable& cv) { | ||
const void *_audio_ptr; | ||
if (xQueuePeek(audio_queue_, &_audio_ptr, 100 / portTICK_PERIOD_MS) != pdTRUE) { | ||
// we couldn't get anything from the queue, return | ||
return false; | ||
} | ||
if (_audio_ptr == nullptr) { | ||
// make sure we clear the queue | ||
xQueueReceive(audio_queue_, &_audio_ptr, 10 / portTICK_PERIOD_MS); | ||
// we got a nullptr, return | ||
return false; | ||
} | ||
// we got a valid audio frame, so let's play it | ||
const uint8_t* audio_ptr = (const uint8_t*)_audio_ptr; | ||
// multiply by 2 since we're 16-bit | ||
audio_play_frame(audio_ptr, audio_sample_count*2); | ||
|
||
// we don't have to worry here since we know there was an item in the queue | ||
// since we peeked earlier. | ||
xQueueReceive(audio_queue_, &_audio_ptr, 10 / portTICK_PERIOD_MS); | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.