Skip to content

Commit

Permalink
feat(sms): initial (somewhat working) smsplus (SMS/GG) emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
finger563 committed Dec 30, 2023
1 parent d4f2d5f commit 6917967
Show file tree
Hide file tree
Showing 27 changed files with 13,634 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(NES_COMPONENTS "nes")
set(GBC_COMPONENTS "gbc")

### SMS ###
# set(SMS_COMPONENTS "sms")
set(SMS_COMPONENTS "sms")

### SNES ###
# set(SNES_COMPONENTS "snes")
Expand Down
4 changes: 4 additions & 0 deletions components/box-emu-hal/include/statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <algorithm>
#include <atomic>

#include "format.hpp"

void update_frame_time(float frame_time);
void reset_frame_time();

Expand All @@ -11,3 +13,5 @@ float get_frame_time();
float get_frame_time_max();
float get_frame_time_min();
float get_frame_time_avg();

void print_statistics();
8 changes: 8 additions & 0 deletions components/box-emu-hal/src/statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,11 @@ float get_frame_time_min() {
float get_frame_time_avg() {
return frame_time_avg;
}

void print_statistics() {
fmt::print("Statistics:\n");
fmt::print("-----------\n");
fmt::print("Frames: {}\n", num_frames);
fmt::print("FPS: {:.1f}\n", get_fps());
fmt::print("Frame Time: [{:.1f}, {:.1f}, {:.1f}]\n", get_frame_time_min(), get_frame_time_avg(), get_frame_time_max());
}
7 changes: 7 additions & 0 deletions components/sms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
idf_component_register(
INCLUDE_DIRS "include"
SRC_DIRS "src" "smsplus"
PRIV_INCLUDE_DIRS "."
REQUIRES box-emu-hal
)
# target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-char-subscripts -Wno-attributes -Wno-implicit-fallthrough -Wno-unused-function -Wno-unused-variable -Wno-discarded-qualifiers)
19 changes: 19 additions & 0 deletions components/sms/include/sms.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <string>
#include <string_view>
#include <vector>

void reset_sms();
void init_sms(uint8_t *romdata, size_t rom_data_size);
void init_gg(uint8_t *romdata, size_t rom_data_size);
void load_sms(std::string_view save_path);
void save_sms(std::string_view save_path);
void start_sms_tasks();
void stop_sms_tasks();
void run_sms_rom();
void deinit_sms();
void set_sms_video_original();
void set_sms_video_fit();
void set_sms_video_fill();
std::vector<uint8_t> get_sms_video_buffer();
Loading

0 comments on commit 6917967

Please sign in to comment.