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

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

View File

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