Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
esp_idf_version: release/v5.4

# (Optional) cppcheck args
cppcheck_args: -i$GITHUB_WORKSPACE/components/gbc/gnuboy -i$GITHUB_WORKSPACE/components/nes/nofrendo -i$GITHUB_WORKSPACE/components/sms/smsplus -i$GITHUB_WORKSPACE/components/genesis/gwenesis -i$GITHUB_WORKSPACE/components/gui/generated -i$GITHUB_WORKSPACE/components/menu/generated -i$GITHUB_WORKSPACE/components/jpegdec --check-level=exhaustive --force --enable=all --inline-suppr --inconclusive --platform=mips32 --std=c++17 --suppressions-list=$GITHUB_WORKSPACE/suppressions.txt
cppcheck_args: -i$GITHUB_WORKSPACE/components/gbc/gnuboy -i$GITHUB_WORKSPACE/components/nes/nofrendo -i$GITHUB_WORKSPACE/components/msx/fmsx -i$GITHUB_WORKSPACE/components/sms/smsplus -i$GITHUB_WORKSPACE/components/genesis/gwenesis -i$GITHUB_WORKSPACE/components/gui/generated -i$GITHUB_WORKSPACE/components/menu/generated -i$GITHUB_WORKSPACE/components/jpegdec --check-level=exhaustive --force --enable=all --inline-suppr --inconclusive --platform=mips32 --std=c++17 --suppressions-list=$GITHUB_WORKSPACE/suppressions.txt
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(SMS_COMPONENTS "sms")
# set(SNES_COMPONENTS "snes")

### MSX ###
# set(MSX_COMPONENTS "msx")
set(MSX_COMPONENTS "msx")

### GENESIS ###
set(GENESIS_COMPONENTS "genesis")
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ESP32-S3-BOX-3 which provides:
- NES Emulator (nofrendo)
- Regular Controls (D-Pad/A/B/Start/Select)
- Unlocked mode (fastest execution), toggled with the X button
- MSX I / II Emulator (fmsx)
- Regular Controls (D-Pad/A/B/Start/Select)
- Gameboy / Gameboy Color emulator (gnuboy)
- Regular Controls (D-Pad/A/B/Start/Select)
- Unlocked mode (fastest execution), toggled with the X button
Expand Down Expand Up @@ -75,13 +77,14 @@ This project has the following features (still WIP):
- [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,a,b,start)
- [x] Shared memory system shared between emulators to allow for many emulators to compile in together while still enabling their main state to be stored in fast internal memory.
- [x] Runnable emulators (automatically selected by rom extension):
- [x] NES emulator
- [x] GB/GBC emulator
- [x] Sega Master System (SMS) / GameGear (GG) emulator
- [ ] MSX emulator (WIP)
- [x] Sega Mega Drive / Genesis emulator (WIP)
- [ ] SNES emulator
- [x] MSX emulator
- [x] Sega Mega Drive / Genesis emulator
- [ ] SNES emulator (WIP)
- [ ] Doom (WIP)
- [x] uSD card (FAT) filesystem over SPI
- [x] TinyUSB MSC device for optionally exposing the uSD to the attached USB host
Expand Down
4 changes: 1 addition & 3 deletions components/gbc/src/gameboy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ std::vector<uint8_t> get_gameboy_video_buffer() {
auto width = GAMEBOY_SCREEN_WIDTH;
auto height = GAMEBOY_SCREEN_HEIGHT;
std::vector<uint8_t> new_frame_buffer(width * 2 * height);
for (int y = 0; y < height; ++y) {
memcpy(&new_frame_buffer[y * width * 2], &frame_buffer[y * width * 2], width * 2);
}
memcpy(new_frame_buffer.data(), frame_buffer, width * 2 * height);
return new_frame_buffer;
}

Expand Down
20 changes: 20 additions & 0 deletions components/msx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
idf_component_register(
INCLUDE_DIRS "include"
SRC_DIRS "src" "fmsx" "fmsx/src/EMULib" "fmsx/src/fMSX" "fmsx/src/Z80"
PRIV_INCLUDE_DIRS "fmsx" "fmsx/src/EMULib" "fmsx/src/fMSX" "fmsx/src/Z80"
REQUIRES box-emu statistics shared_memory
)
# target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-char-subscripts -Wno-attributes -Wno-implicit-fallthrough -Wno-unused-function -Wno-unused-variable -Wno-discarded-qualifiers)
target_compile_options(${COMPONENT_LIB} PRIVATE
-Wno-error=stringop-truncation
-Wno-error=format-overflow
-Wno-implicit-fallthrough
-Wno-format-overflow
-Wno-stringop-truncation
-Wno-unused-but-set-variable
-Wno-unused-variable
-Wno-register
-DBPS16 -DUNIX -DLSB_FIRST -DNARROW -O2
)
file(GLOB_RECURSE c_sources "fmsx/src/*.c")
set_source_files_properties(${c_sources} PROPERTIES COMPILE_FLAGS "-include msxfix.h")
16 changes: 16 additions & 0 deletions components/msx/fmsx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(COMPONENT_SRCDIRS ". src/EMULib src/fMSX src/Z80")
set(COMPONENT_ADD_INCLUDEDIRS ". src/EMULib src/fMSX src/Z80")
set(COMPONENT_REQUIRES "retro-go")
register_component()
rg_setup_compile_options(
-Wno-error=stringop-truncation
-Wno-error=format-overflow
-Wno-implicit-fallthrough
-Wno-format-overflow
-Wno-stringop-truncation
-Wno-unused-but-set-variable
-Wno-unused-variable
-DBPS16 -DUNIX -DLSB_FIRST -DNARROW -O2
)
file(GLOB_RECURSE c_sources "src/*.c")
set_source_files_properties(${c_sources} PROPERTIES COMPILE_FLAGS "-include msxfix.h")
51 changes: 51 additions & 0 deletions components/msx/fmsx/LibUnix.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/** EMULib Emulation Library *********************************/
/** **/
/** LibUnix.h **/
/** **/
/** This file contains Unix-dependent definitions and **/
/** declarations for the emulation library. **/
/** **/
/** Copyright (C) Marat Fayzullin 1996-2021 **/
/** You are not allowed to distribute this software **/
/** commercially. Please, notify me, if you make any **/
/** changes to this file. **/
/*************************************************************/
#ifndef LIBUNIX_H
#define LIBUNIX_H

#define XImage void

#define SND_CHANNELS 16 /* Number of sound channels */
#define SND_BITS 8
#define SND_BUFSIZE (1<<SND_BITS)

/** PIXEL() **************************************************/
/** Unix may use multiple pixel formats. **/
/*************************************************************/
#if defined(BPP32) || defined(BPP24)
#define PIXEL(R,G,B) (pixel)(((int)R<<16)|((int)G<<8)|B)
#define PIXEL2MONO(P) (((P>>16)&0xFF)+((P>>8)&0xFF)+(P&0xFF))/3)
#define RMASK 0xFF0000
#define GMASK 0x00FF00
#define BMASK 0x0000FF

#elif defined(BPP16)
#define PIXEL(R,G,B) (pixel)(((31*(R)/255)<<11)|((63*(G)/255)<<5)|(31*(B)/255))
#define PIXEL2MONO(P) (522*(((P)&31)+(((P)>>5)&63)+(((P)>>11)&31))>>8)
#define RMASK 0xF800
#define GMASK 0x07E0
#define BMASK 0x001F

#elif defined(BPP8)
#define PIXEL(R,G,B) (pixel)(((7*(R)/255)<<5)|((7*(G)/255)<<2)|(3*(B)/255))
#define PIXEL2MONO(P) (3264*((((P)<<1)&7)+(((P)>>2)&7)+(((P)>>5)&7))>>8)
#define RMASK 0xE0
#define GMASK 0x1C
#define BMASK 0x03
#endif

unsigned int InitAudio(unsigned int Rate,unsigned int Latency);
void TrashAudio(void);
int PauseAudio(int Switch);

#endif /* LIBUNIX_H */
3 changes: 3 additions & 0 deletions components/msx/fmsx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
In the `src` folder is unmodified fMSX 6.0 by Marat Fayzullin from https://fms.komkon.org/fMSX/.

`msxfix.c` wraps certain functions to allow it to work well within retro-go/esp-idf.
Loading