Initial
This commit is contained in:
109
image/HARDWARE.HPP
Normal file
109
image/HARDWARE.HPP
Normal file
@@ -0,0 +1,109 @@
|
||||
#ifndef _IMAGE_HARDWARE_HPP_
|
||||
#define _IMAGE_HARDWARE_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_PUREVIEWOFFILE_HPP_
|
||||
#include <common/pview.hpp>
|
||||
#endif
|
||||
|
||||
class Hardware
|
||||
{
|
||||
public:
|
||||
enum CPUType{CPUUnknown=0x0000,CPU80386=0x014C,CPU80486=0x14D,CPU80586,
|
||||
CPUMIPSR3000=0x0162,CPUMIPSMARKII=0x0163,CPUMIPSMARKIII=0x164,
|
||||
CPUMIPSR4000=0x0166,CPUMIPS10000=0x0168,CPUDECALPHAAXP=0x0184,
|
||||
CPUPOWERPC=0x01F0,CPUMOTOROLA68000=0x0268,CPUPARISC=0x0290};
|
||||
Hardware(CPUType cpuType=CPUUnknown);
|
||||
Hardware(const Hardware &someHardware);
|
||||
Hardware(WORD machine);
|
||||
~Hardware();
|
||||
Hardware &operator=(const Hardware &someHardware);
|
||||
WORD operator==(const Hardware &someHardware)const;
|
||||
WORD operator<<(PureViewOfFile &pureView);
|
||||
WORD isValid(void)const;
|
||||
CPUType cpuType(void)const;
|
||||
void cpuType(CPUType cpuType);
|
||||
operator String(void)const;
|
||||
private:
|
||||
CPUType mCPUType;
|
||||
};
|
||||
|
||||
inline
|
||||
Hardware::Hardware(CPUType cpuType)
|
||||
: mCPUType(cpuType)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Hardware::Hardware(WORD machine)
|
||||
{
|
||||
mCPUType=(CPUType)machine;
|
||||
}
|
||||
|
||||
inline
|
||||
Hardware::Hardware(const Hardware &someHardware)
|
||||
{
|
||||
*this=someHardware;
|
||||
}
|
||||
|
||||
inline
|
||||
Hardware::~Hardware()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Hardware &Hardware::operator=(const Hardware &someHardware)
|
||||
{
|
||||
cpuType(someHardware.cpuType());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Hardware::operator==(const Hardware &someHardware)const
|
||||
{
|
||||
return cpuType()==someHardware.cpuType();
|
||||
}
|
||||
|
||||
inline
|
||||
Hardware::CPUType Hardware::cpuType(void)const
|
||||
{
|
||||
return mCPUType;
|
||||
}
|
||||
|
||||
inline
|
||||
void Hardware::cpuType(CPUType cpuType)
|
||||
{
|
||||
mCPUType=cpuType;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Hardware::operator<<(PureViewOfFile &pureView)
|
||||
{
|
||||
WORD cpuType;
|
||||
|
||||
pureView.read(cpuType);
|
||||
mCPUType=(CPUType)cpuType;
|
||||
if(!isValid())return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Hardware::isValid(void)const
|
||||
{
|
||||
if(CPUUnknown==cpuType())return TRUE;
|
||||
if(CPU80386==cpuType())return TRUE;
|
||||
if(CPU80486==cpuType())return TRUE;
|
||||
if(CPU80586==cpuType())return TRUE;
|
||||
if(CPUMIPSR3000==cpuType())return TRUE;
|
||||
if(CPUMIPSMARKII==cpuType())return TRUE;
|
||||
if(CPUMIPSMARKIII==cpuType())return TRUE;
|
||||
if(CPUMIPSR4000==cpuType())return TRUE;
|
||||
if(CPUDECALPHAAXP==cpuType())return TRUE;
|
||||
if(CPUPOWERPC==cpuType())return TRUE;
|
||||
if(CPUMOTOROLA68000==cpuType())return TRUE;
|
||||
if(CPUPARISC==cpuType())return TRUE;
|
||||
if(CPUMIPS10000==cpuType())return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user