Skip to content

Commit

Permalink
Made requested changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
eaplatanios committed Jul 19, 2019
1 parent c76ad34 commit f0c96be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Emulator::Emulator() {
}

Emulator::~Emulator() {
if (m_corePath) {
free(m_corePath);
}
if (m_romLoaded) {
unloadRom();
}
Expand Down Expand Up @@ -360,7 +363,10 @@ bool Emulator::cbEnvironment(unsigned cmd, void* data) {
return false;
}
case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY:
*reinterpret_cast<const char**>(data) = strdup(corePath().c_str());
if (!s_loadedEmulator->m_corePath) {
s_loadedEmulator->m_corePath = strdup(corePath().c_str());
}
*reinterpret_cast<const char**>(data) = s_loadedEmulator->m_corePath;
return true;
case RETRO_ENVIRONMENT_GET_CAN_DUPE:
*reinterpret_cast<bool*>(data) = true;
Expand Down
2 changes: 2 additions & 0 deletions src/emulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class Emulator {
retro_system_av_info m_avInfo = {};
std::vector<retro_memory_descriptor> m_map;

char* m_corePath = nullptr;

#ifdef _WIN32
HMODULE m_coreHandle = nullptr;
#else
Expand Down

0 comments on commit f0c96be

Please sign in to comment.