From 92848c8786bace2e0b764910d8b477fb96c4004a Mon Sep 17 00:00:00 2001 From: Bernardo Gomes Negri Date: Sun, 1 Dec 2024 12:30:34 -0300 Subject: [PATCH] remove unneeded functions --- src/libretro/CMakeLists.txt | 2 -- src/libretro/environment.cpp | 17 ---------------- src/libretro/environment.hpp | 2 -- src/libretro/libretro.cpp | 38 ------------------------------------ 4 files changed, 59 deletions(-) diff --git a/src/libretro/CMakeLists.txt b/src/libretro/CMakeLists.txt index cb9c7132..7f1e7d38 100644 --- a/src/libretro/CMakeLists.txt +++ b/src/libretro/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.20) -# 3.20 required for detecting endianness set(CMAKE_CXX_STANDARD 17) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/src/libretro/environment.cpp b/src/libretro/environment.cpp index bd823d2f..4c7c8d6b 100644 --- a/src/libretro/environment.cpp +++ b/src/libretro/environment.cpp @@ -77,8 +77,6 @@ namespace retro { static char _sysSubdir[PATH_LENGTH] {}; static size_t _sysSubdirLength = 0; - - static int64_t _usTime = 0; static void log(enum retro_log_level level, const char* fmt, va_list va) noexcept; static void NormalizePath(std::span buffer, size_t& pathLength) noexcept; @@ -670,14 +668,6 @@ optional retro::get_system_path(string_view name) noexcept { return string(fullpath); } -int64_t retro::get_us_time() { - return _usTime; -} - -PUBLIC_SYMBOL void us_time_callback(retro_usec_t deltaTime) { - retro::_usTime += deltaTime; -} - void retro::env::init() noexcept { ZoneScopedN(TracyFunction); retro_assert(_environment != nullptr); @@ -697,7 +687,6 @@ void retro::env::deinit() noexcept { _saveSubdirLength = 0; _sysDirLength = 0; _sysSubdirLength = 0; - _usTime = 0; _environment = nullptr; _log = nullptr; _supports_bitmasks = false; @@ -720,12 +709,6 @@ PUBLIC_SYMBOL void retro_set_environment(retro_environment_t cb) { retro_core_options_update_display_callback update_display_cb {MelonDsDs::UpdateOptionVisibility}; environment(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK, &update_display_cb); - /*struct retro_frame_time_callback frame_time_cb = { - .callback = &us_time_callback, - .reference = 16667, - }; - bool hasTime = environment(RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK, &frame_time_cb);*/ - retro_netpacket_callback netpacket_callback { .start = &MelonDsDs::MpStarted, .receive = &MelonDsDs::MpReceived, diff --git a/src/libretro/environment.hpp b/src/libretro/environment.hpp index 892204cb..7c968552 100644 --- a/src/libretro/environment.hpp +++ b/src/libretro/environment.hpp @@ -121,8 +121,6 @@ namespace retro { std::optional get_system_subdirectory() noexcept; std::optional get_system_path(std::string_view name) noexcept; std::optional get_system_subdir_path(std::string_view name) noexcept; - - int64_t get_us_time(); namespace env { void init() noexcept; diff --git a/src/libretro/libretro.cpp b/src/libretro/libretro.cpp index 4ccfbf0b..991dc31b 100644 --- a/src/libretro/libretro.cpp +++ b/src/libretro/libretro.cpp @@ -30,9 +30,7 @@ #include #include #include -#define RARCH_INTERNAL #include -#undef RARCH_INTERNAL #include #undef isnan @@ -65,41 +63,6 @@ namespace MelonDsDs { CoreState& Core = *reinterpret_cast(CoreStateBuffer.data()); } -void testEqual(const char *mensagem, uint8_t a, uint8_t b) { - if (a != b) { - retro::error("valores de {} divergem: {} nao e igual a {}", mensagem, a, b); - } -} - -void printBuf(const char *buf, size_t len) { - const uint8_t *bufa = (const uint8_t *)buf; - printf("{ "); - for(int i = 0; i < len; i++) { - printf("%02X, ", bufa[i]); - } - printf(" }\n"); -} - -void testPacket() { - const char *teste = "olá, tudo bem?"; - MelonDsDs::Packet p{teste, strlen(teste) + 1, 50, 2, true}; - std::vector bufBytes = p.ToBuf(); - const char *buf = (const char *)bufBytes.data(); - MelonDsDs::Packet np = MelonDsDs::Packet::parsePk(buf, p.Length() + MelonDsDs::HeaderSize); - - retro_assert(np.Length() == p.Length() && p.Length() == strlen(teste) + 1); - testEqual("aid dos pacotes", p.Aid(), np.Aid()); - testEqual("aid esperada", p.Aid(), 2); - retro_assert(p.Aid() == np.Aid() && p.Aid() == 2); - retro_assert(p.IsReply() == np.IsReply() && p.IsReply()); - retro_assert(p.Timestamp() == np.Timestamp() && p.Timestamp() == 50); - retro_assert(strcmp((const char *)p.Data(), (const char *)np.Data()) == 0 && strcmp((const char *)p.Data(), teste) == 0); - std::vector npBytes = np.ToBuf(); - printBuf(buf, p.Length() + MelonDsDs::HeaderSize); - printBuf((const char *)npBytes.data(), np.Length() + MelonDsDs::HeaderSize); - retro_assert(memcmp(buf, (const char *)npBytes.data(), p.Length() + MelonDsDs::HeaderSize) == 0); -} - PUBLIC_SYMBOL void retro_init(void) { #ifdef HAVE_TRACY tracy::StartupProfiler(); @@ -116,7 +79,6 @@ PUBLIC_SYMBOL void retro_init(void) { memset(MelonDsDs::CoreStateBuffer.data(), 0, MelonDsDs::CoreStateBuffer.size()); new(&MelonDsDs::CoreStateBuffer) MelonDsDs::CoreState(); // placement-new the CoreState retro_assert(MelonDsDs::Core.IsInitialized()); - testPacket(); } PUBLIC_SYMBOL bool retro_load_game(const struct retro_game_info *info) {