dolphin/Source/Core/Core/HW/GCMemcardRaw.h
Shawn Hoffman 96d7b642f4 raw memcards: revert last change so flushes are still time-driven.
It turns out the actual slowdown was from memcpy'ing the entire
memcard buffer...not synchronization overhead or the flush itself.
2014-09-05 21:16:59 -07:00

38 lines
923 B
C++

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include "Common/Event.h"
#include "Common/Flag.h"
#include "Common/Thread.h"
#include "Core/HW/GCMemcard.h"
class PointerWrap;
class MemoryCard : public MemoryCardBase
{
public:
MemoryCard(std::string filename, int _card_index, u16 sizeMb = MemCard2043Mb);
~MemoryCard();
void FlushThread();
void MakeDirty();
s32 Read(u32 address, s32 length, u8 *destaddress) override;
s32 Write(u32 destaddress, s32 length, u8 *srcaddress) override;
void ClearBlock(u32 address) override;
void ClearAll() override;
void DoState(PointerWrap &p) override;
private:
std::string m_filename;
std::unique_ptr<u8[]> m_memcard_data;
std::unique_ptr<u8[]> m_flush_buffer;
std::thread m_flush_thread;
std::mutex m_flush_mutex;
Common::Event m_flush_trigger;
Common::Flag m_dirty;
};