mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Merge branch 'aram-dma-fixes' into FIFO-BP
# By Pierre Bourdon # Via Pierre Bourdon * aram-dma-fixes: Simulate a small delay on GC Memcard operations
This commit is contained in:
commit
ae566d6b3c
@ -47,6 +47,14 @@ void CEXIMemoryCard::FlushCallback(u64 userdata, int cyclesLate)
|
||||
pThis->Flush();
|
||||
}
|
||||
|
||||
void CEXIMemoryCard::CmdDoneCallback(u64 userdata, int cyclesLate)
|
||||
{
|
||||
int card_index = (int)userdata;
|
||||
CEXIMemoryCard* pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index);
|
||||
if (pThis)
|
||||
pThis->CmdDone();
|
||||
}
|
||||
|
||||
CEXIMemoryCard::CEXIMemoryCard(const int index)
|
||||
: card_index(index)
|
||||
, m_bDirty(false)
|
||||
@ -56,7 +64,8 @@ CEXIMemoryCard::CEXIMemoryCard(const int index)
|
||||
m_strFilename = "Movie.raw";
|
||||
|
||||
// we're potentially leaking events here, since there's no UnregisterEvent until emu shutdown, but I guess it's inconsequential
|
||||
et_this_card = CoreTiming::RegisterEvent((card_index == 0) ? "memcardA" : "memcardB", FlushCallback);
|
||||
et_this_card = CoreTiming::RegisterEvent((card_index == 0) ? "memcardFlushA" : "memcardFlushB", FlushCallback);
|
||||
et_cmd_done = CoreTiming::RegisterEvent((card_index == 0) ? "memcardDoneA" : "memcardDoneB", CmdDoneCallback);
|
||||
|
||||
interruptSwitch = 0;
|
||||
m_bInterruptSet = 0;
|
||||
@ -178,6 +187,21 @@ bool CEXIMemoryCard::IsPresent()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEXIMemoryCard::CmdDone()
|
||||
{
|
||||
status |= MC_STATUS_READY;
|
||||
status &= ~MC_STATUS_BUSY;
|
||||
|
||||
m_bInterruptSet = 1;
|
||||
m_bDirty = true;
|
||||
}
|
||||
|
||||
void CEXIMemoryCard::CmdDoneLater(u64 cycles)
|
||||
{
|
||||
CoreTiming::RemoveEvent(et_cmd_done);
|
||||
CoreTiming::ScheduleEvent(cycles, et_cmd_done, (u64)card_index);
|
||||
}
|
||||
|
||||
void CEXIMemoryCard::SetCS(int cs)
|
||||
{
|
||||
// So that memory card won't be invalidated during flushing
|
||||
@ -201,11 +225,7 @@ void CEXIMemoryCard::SetCS(int cs)
|
||||
|
||||
//???
|
||||
|
||||
status |= MC_STATUS_READY;
|
||||
status &= ~MC_STATUS_BUSY;
|
||||
|
||||
m_bInterruptSet = 1;
|
||||
m_bDirty = true;
|
||||
CmdDoneLater(5000);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -232,11 +252,7 @@ void CEXIMemoryCard::SetCS(int cs)
|
||||
address = (address & ~0x1FF) | ((address+1) & 0x1FF);
|
||||
}
|
||||
|
||||
status |= MC_STATUS_READY;
|
||||
status &= ~MC_STATUS_BUSY;
|
||||
|
||||
m_bInterruptSet = 1;
|
||||
m_bDirty = true;
|
||||
CmdDoneLater(5000);
|
||||
}
|
||||
|
||||
// Page written to memory card, not just to buffer - let's schedule a flush 0.5b cycles into the future (1 sec)
|
||||
|
@ -47,9 +47,18 @@ private:
|
||||
// through the userdata parameter, so that it can then call Flush on the right card.
|
||||
static void FlushCallback(u64 userdata, int cyclesLate);
|
||||
|
||||
// Scheduled when a command that required delayed end signaling is done.
|
||||
static void CmdDoneCallback(u64 userdata, int cyclesLate);
|
||||
|
||||
// Flushes the memory card contents to disk.
|
||||
void Flush(bool exiting = false);
|
||||
|
||||
// Signals that the command that was previously executed is now done.
|
||||
void CmdDone();
|
||||
|
||||
// Variant of CmdDone which schedules an event later in the future to complete the command.
|
||||
void CmdDoneLater(u64 cycles);
|
||||
|
||||
enum
|
||||
{
|
||||
cmdNintendoID = 0x00,
|
||||
@ -71,7 +80,7 @@ private:
|
||||
|
||||
std::string m_strFilename;
|
||||
int card_index;
|
||||
int et_this_card;
|
||||
int et_this_card, et_cmd_done;
|
||||
//! memory card state
|
||||
|
||||
// STATE_TO_SAVE
|
||||
|
Loading…
x
Reference in New Issue
Block a user