コード例 #1
0
ファイル: Mempak.cpp プロジェクト: Azimer/project64
void CMempak::WriteTo(int32_t Control, uint32_t address, uint8_t * data)
{
    if (address < 0x8000)
    {
        if (!m_Formatted[Control])
        {
            CMempak::Format(Control);
            m_Formatted[Control] = true;
        }
        if (memcmp(&m_Mempaks[Control][address], data, 0x20) != 0)
        {
            if (!m_MempakHandle[Control].IsOpen())
            {
                LoadMempak(Control, true);
            }
            memcpy(&m_Mempaks[Control][address], data, 0x20);

            m_MempakHandle[Control].Seek(address, CFile::begin);
            m_MempakHandle[Control].Write(data, 0x20);
        }
    }
    else
    {
        /* Rumble pack area */
    }
}
コード例 #2
0
ファイル: Mempak.cpp プロジェクト: Azimer/project64
void CMempak::ReadFrom(int32_t Control, uint32_t address, uint8_t * data)
{
    if (address < 0x8000)
    {
        if (m_SaveExists[Control] && !m_MempakHandle[Control].IsOpen())
        {
            LoadMempak(Control, false);
        }

        memcpy(data, &m_Mempaks[Control][address], 0x20);
    }
    else
    {
        memset(data, 0x00, 0x20);
        /* Rumble pack area */
    }
}
コード例 #3
0
ファイル: Mempak.cpp プロジェクト: BenjaminSiskoo/project64
void Mempak::ReadFrom(int Control, int Address, BYTE * Buffer)
{
	if (Address < 0x8000)
	{
		if (hMempakFile[Control] == NULL)
		{
			LoadMempak(Control);
		}
		memcpy(Buffer, &Mempaks[Control][Address], 0x20);
	}
	else
	{
		memset(Buffer, 0, 0x20);
		/* Rumble pack area */
	}

	Buffer[0x20] = CalculateCrc(Buffer);
}
コード例 #4
0
ファイル: Mempak.cpp プロジェクト: Roj13/project64
void Mempak::ReadFrom(int Control, BYTE * command)
{
	DWORD address = (command[3] << 8) | (command[4] & 0xE0);

	if (address < 0x8000)
	{
		if (hMempakFile[Control] == NULL)
		{
			LoadMempak(Control);
		}
		memcpy(&command[5], &Mempaks[Control][address], 0x20);
	}
	else
	{
		memset(&command[5], 0x00, 0x20);
		/* Rumble pack area */
	}
}
コード例 #5
0
ファイル: Mempak.c プロジェクト: TwitchPlaysPokemon/project64
void WriteToMempak(int Control, int Address, BYTE * Buffer) {
	DWORD dwWritten;
	
	if (Address == 0x8001) { Buffer[0x20] = Mempacks_CalulateCrc(Buffer); return; }

	Address &= 0xFFE0;
	if (Address <= 0x7FE0) {
		if (hMempakFile == NULL) {
			LoadMempak();
		}
		memcpy(&Mempak[Control][Address], Buffer, 0x20);

		SetFilePointer(hMempakFile,Control*0x8000,NULL,FILE_BEGIN);
		WriteFile(hMempakFile,&Mempak[Control][0],0x8000,&dwWritten,NULL);
	} else {
		/* Rumble pack area */
	}
	Buffer[0x20] = Mempacks_CalulateCrc(Buffer);
}
コード例 #6
0
ファイル: Mempak.c プロジェクト: TwitchPlaysPokemon/project64
void ReadFromMempak(int Control, int Address, BYTE * Buffer) {	
	if (Address == 0x8001) {
		memset(Buffer, 0, 0x20);
		Buffer[0x20] = Mempacks_CalulateCrc(Buffer);
		return;
	}
	Address &= 0xFFE0;

	if (Address <= 0x7FE0) {
		if (hMempakFile == NULL) {
			LoadMempak();
		}
		memcpy(Buffer, &Mempak[Control][Address], 0x20);
	} else {
		memset(Buffer, 0, 0x20);
		/* Rumble pack area */
	}

	Buffer[0x20] = Mempacks_CalulateCrc(Buffer);
}
コード例 #7
0
ファイル: Mempak.cpp プロジェクト: BenjaminSiskoo/project64
void Mempak::WriteTo(int Control, int Address, BYTE * Buffer)
{
	DWORD dwWritten;

	if (Address < 0x8000)
	{
		if (hMempakFile[Control] == NULL)
		{
			LoadMempak(Control);
		}
		memcpy(&Mempaks[Control][Address], Buffer, 0x20);

		SetFilePointer(hMempakFile[Control], 0,NULL,FILE_BEGIN);
		WriteFile(hMempakFile[Control], &Mempaks[Control][0], 0x8000, &dwWritten, NULL);
	}
	else
	{
		/* Rumble pack area */
	}
	Buffer[0x20] = CalculateCrc(Buffer);
}
コード例 #8
0
ファイル: Mempak.cpp プロジェクト: Roj13/project64
void Mempak::WriteTo(int Control, BYTE * command)
{
	DWORD dwWritten;
	DWORD address = (command[3] << 8) | (command[4] & 0xE0);

	if (address < 0x8000)
	{
		if (hMempakFile[Control] == NULL)
		{
			LoadMempak(Control);
		}
		memcpy(&Mempaks[Control][address], &command[5], 0x20);

		SetFilePointer(hMempakFile[Control], 0,NULL,FILE_BEGIN);
		WriteFile(hMempakFile[Control], &Mempaks[Control][0], 0x8000, &dwWritten, NULL);
	}
	else
	{
		/* Rumble pack area */
	}
}