Skip to content

Commit 7509cc1

Browse files
committed
update to better work across multiple emulators
1 parent a9dce59 commit 7509cc1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

components/box-emu/include/box-emu.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class BoxEmu : public espp::BaseComponent {
126126
/////////////////////////////////////////////////////////////////////////////
127127

128128
bool initialize_memory();
129+
void deinitialize_memory();
129130
size_t copy_file_to_romdata(const std::string& filename);
130131
uint8_t *romdata() const;
131132

components/box-emu/src/box-emu.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ sdmmc_card_t *BoxEmu::sdcard() const {
182182
// Memory
183183
/////////////////////////////////////////////////////////////////////////////
184184

185-
static constexpr size_t memory_size = 6*1024*1024;
185+
static constexpr size_t memory_size = 4*1024*1024;
186186

187187
extern "C" uint8_t *osd_getromdata() {
188188
auto &emu = BoxEmu::get();
@@ -206,6 +206,14 @@ bool BoxEmu::initialize_memory() {
206206
return true;
207207
}
208208

209+
void BoxEmu::deinitialize_memory() {
210+
if (romdata_) {
211+
logger_.info("Deinitializing memory (romdata)");
212+
free(romdata_);
213+
romdata_ = nullptr;
214+
}
215+
}
216+
209217
size_t BoxEmu::copy_file_to_romdata(const std::string& filename) {
210218
// load the file data and iteratively copy it over
211219
std::ifstream romfile(filename, std::ios::binary | std::ios::ate); //open file at end

0 commit comments

Comments
 (0)