示例#1
0
s32 MemoryCard::Read(u32 srcaddress, s32 length, u8* destaddress)
{
  if (!IsAddressInBounds(srcaddress))
  {
    PanicAlertT("MemoryCard: Read called with invalid source address (0x%x)", srcaddress);
    return -1;
  }

  memcpy(destaddress, &m_memcard_data[srcaddress], length);
  return length;
}
void MemoryCard::ClearBlock(u32 address)
{
    if (address & (BLOCK_SIZE - 1) || !IsAddressInBounds(address))
    {
        PanicAlertT("MemoryCard: ClearBlock called on invalid address %x",
                    address);
    }
    else
    {
        memset(&m_memcard_data[address], 0xFF, BLOCK_SIZE);
        TryFlush();
    }
}
s32 MemoryCard::Write(u32 destaddress, s32 length, u8 *srcaddress)
{
    if (!IsAddressInBounds(destaddress))
    {
        PanicAlertT("MemoryCard: Write called with invalid destination address, %x",
                    destaddress);
        return -1;
    }

    memcpy(&m_memcard_data[destaddress], srcaddress, length);
    TryFlush();
    return length;
}
示例#4
0
void MemoryCard::ClearBlock(u32 address)
{
  if (address & (BLOCK_SIZE - 1) || !IsAddressInBounds(address))
  {
    PanicAlertT("MemoryCard: ClearBlock called on invalid address (0x%x)", address);
    return;
  }
  else
  {
    std::unique_lock<std::mutex> l(m_flush_mutex);
    memset(&m_memcard_data[address], 0xFF, BLOCK_SIZE);
  }
  MakeDirty();
}
示例#5
0
s32 MemoryCard::Write(u32 destaddress, s32 length, const u8* srcaddress)
{
  if (!IsAddressInBounds(destaddress))
  {
    PanicAlertT("MemoryCard: Write called with invalid destination address (0x%x)", destaddress);
    return -1;
  }

  {
    std::unique_lock<std::mutex> l(m_flush_mutex);
    memcpy(&m_memcard_data[destaddress], srcaddress, length);
  }
  MakeDirty();
  return length;
}