Skip to content

Commit

Permalink
remove unneeded functions
Browse files Browse the repository at this point in the history
  • Loading branch information
BernardoGomesNegri committed Dec 1, 2024
1 parent 4f5efbb commit d3d2cf0
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 59 deletions.
2 changes: 0 additions & 2 deletions src/libretro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
17 changes: 0 additions & 17 deletions src/libretro/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ namespace retro {

static char _sysSubdir[PATH_LENGTH] {};
static size_t _sysSubdirLength = 0;

static int64_t _usTime = 0;

static retro_rumble_interface _rumble {};

Expand Down Expand Up @@ -694,14 +692,6 @@ bool retro::set_rumble_state(unsigned port, uint16_t strength) noexcept {
_rumble.set_rumble_state(port, RETRO_RUMBLE_WEAK, strength);
}

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);
Expand All @@ -721,7 +711,6 @@ void retro::env::deinit() noexcept {
_saveSubdirLength = 0;
_sysDirLength = 0;
_sysSubdirLength = 0;
_usTime = 0;
_environment = nullptr;
_log = nullptr;
_supports_bitmasks = false;
Expand Down Expand Up @@ -750,12 +739,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,
Expand Down
2 changes: 0 additions & 2 deletions src/libretro/environment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ namespace retro {
std::optional<std::string_view> get_system_subdirectory() noexcept;
std::optional<std::string> get_system_path(std::string_view name) noexcept;
std::optional<std::string> get_system_subdir_path(std::string_view name) noexcept;

int64_t get_us_time();

namespace env {
void init() noexcept;
Expand Down
38 changes: 0 additions & 38 deletions src/libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
#include <compat/strl.h>
#include <file/file_path.h>
#include <libretro.h>
#define RARCH_INTERNAL
#include <retro_assert.h>
#undef RARCH_INTERNAL
#include <retro_miscellaneous.h>

#undef isnan
Expand Down Expand Up @@ -65,41 +63,6 @@ namespace MelonDsDs {
CoreState& Core = *reinterpret_cast<CoreState*>(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<uint8_t> 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<uint8_t> 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();
Expand All @@ -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) {
Expand Down

0 comments on commit d3d2cf0

Please sign in to comment.