2016-01-20 00:14:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#include <Common/stdtypes.h>
|
|
|
|
|
|
|
|
class CN64Disk
|
|
|
|
{
|
|
|
|
public:
|
2016-01-20 13:31:29 +00:00
|
|
|
CN64Disk();
|
|
|
|
~CN64Disk();
|
2016-01-20 00:14:18 +00:00
|
|
|
|
2016-01-20 13:31:29 +00:00
|
|
|
bool LoadDiskImage(const char * FileLoc);
|
|
|
|
static bool IsValidDiskImage(uint8_t Test[4]);
|
|
|
|
uint8_t * GetDiskAddress() { return m_DiskImage; }
|
2016-01-20 16:43:23 +00:00
|
|
|
uint8_t * GetDiskAddressBuffer() { return m_DiskImage + m_DiskBufAddress; }
|
|
|
|
void SetDiskAddressBuffer(uint32_t address) { m_DiskBufAddress = address; }
|
2016-01-20 13:31:29 +00:00
|
|
|
void UnallocateDiskImage();
|
2016-01-20 00:14:18 +00:00
|
|
|
|
2016-01-20 16:43:23 +00:00
|
|
|
LanguageStringID GetError() const { return m_ErrorMsg; }
|
|
|
|
|
2016-01-20 00:14:18 +00:00
|
|
|
private:
|
2016-01-20 13:31:29 +00:00
|
|
|
bool AllocateDiskImage(uint32_t DiskFileSize);
|
|
|
|
bool AllocateAndLoadDiskImage(const char * FileLoc);
|
|
|
|
void ByteSwapDisk();
|
|
|
|
void SetError(LanguageStringID ErrorMsg);
|
2016-01-20 00:14:18 +00:00
|
|
|
|
2016-01-20 13:31:29 +00:00
|
|
|
//constant values
|
|
|
|
enum { ReadFromRomSection = 0x400000 };
|
2016-01-20 00:14:18 +00:00
|
|
|
|
2016-01-20 13:31:29 +00:00
|
|
|
//class variables
|
|
|
|
CFile m_DiskFile;
|
|
|
|
uint8_t * m_DiskImage;
|
|
|
|
uint8_t * m_DiskImageBase;
|
|
|
|
uint32_t m_DiskFileSize;
|
2016-01-20 16:43:23 +00:00
|
|
|
uint32_t m_DiskBufAddress;
|
2016-01-20 13:31:29 +00:00
|
|
|
LanguageStringID m_ErrorMsg;
|
|
|
|
stdstr m_FileName, m_DiskIdent;
|
2016-01-20 00:14:18 +00:00
|
|
|
};
|