Refactor smaller things

This commit is contained in:
SimoneN64
2024-05-14 21:31:50 +02:00
parent e61dc1bfc4
commit 40cee365a9
4 changed files with 5 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.29)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)

View File

@@ -10,7 +10,6 @@ void Core::Stop() {
pause = true; pause = true;
romLoaded = false; romLoaded = false;
cpu->Reset(); cpu->Reset();
cpu->GetMem().Reset();
} }
bool Core::LoadTAS(const fs::path &path) { bool Core::LoadTAS(const fs::path &path) {

View File

@@ -142,7 +142,7 @@ private:
friend struct AI; friend struct AI;
friend struct RSP; friend struct RSP;
friend struct Core; friend struct Core;
u8 isviewer[ISVIEWER_SIZE]{}; std::array<u8, ISVIEWER_SIZE> isviewer{};
std::string sramPath{}; std::string sramPath{};
mio::mmap_sink saveData{}; mio::mmap_sink saveData{};
int mmioSize{}, flashSize{}; int mmioSize{}, flashSize{};

View File

@@ -269,11 +269,9 @@ template <> void PI::BusWrite<u32, false>(u32 addr, u32 val) {
break; break;
case CART_ISVIEWER_FLUSH: { case CART_ISVIEWER_FLUSH: {
if (val < CART_ISVIEWER_SIZE) { if (val < CART_ISVIEWER_SIZE) {
char* message = (char*)malloc(val + 1); std::string message(val + 1, 0);
memcpy(message, mem.isviewer, val); std::copy(mem.isviewer.begin(), mem.isviewer.begin() + val, message.begin());
message[val] = '\0'; Util::print("{}", message);
printf("%s", message);
free(message);
} else { } else {
Util::panic("ISViewer buffer size is emulated at {} bytes, but received a flush command for {} bytes!", CART_ISVIEWER_SIZE, val); Util::panic("ISViewer buffer size is emulated at {} bytes, but received a flush command for {} bytes!", CART_ISVIEWER_SIZE, val);
} }