|
SASC-NG
DVBSoftCAM
|
Inheritance diagram for cEmu:Public Member Functions | |
| cEmu (void) | |
| virtual | ~cEmu () |
| bool | Init (int RomNr, int Id) |
| bool | GetOpKeys (const unsigned char *Emm, unsigned char *id, unsigned char *key0, unsigned char *key1) |
| bool | GetPkKeys (const unsigned char *select, unsigned char *pkset) |
| bool | Matches (int RomNr, int Id) |
Protected Member Functions | |
| bool | AddRom (unsigned short addr, unsigned short size, const char *name) |
| bool | AddEeprom (unsigned short addr, unsigned short size, unsigned short otpSize, const char *name) |
| virtual bool | InitSetup (void) |
| virtual bool | UpdateSetup (const unsigned char *emm) |
| virtual bool | MathMapHandler (void) |
Protected Attributes | |
| int | romNr |
| int | id |
| char * | romName |
| char * | romExtName |
| char * | eepromName |
| int | InitStart |
| int | InitEnd |
| int | EmmStart |
| int | EmmEnd |
| int | EmmKey0 |
| int | EmmKey1 |
| int | FindKeyStart |
| int | FindKeyEnd |
| int | MapAddr |
| int | Rc1H |
| int | Rc1L |
| int | EnsIrdChk |
| int | Cmd83Chk |
| int | SoftInt |
| int | StackHigh |
| cEmu::cEmu | ( | void | ) |
Definition at line 68 of file nagra1.c.
References eepromName, romExtName, and romName.
{
romName=romExtName=eepromName=0;
}
| cEmu::~cEmu | ( | ) | [virtual] |
Definition at line 73 of file nagra1.c.
References eepromName, free, romExtName, and romName.
{
free(romName);
free(romExtName);
free(eepromName);
}
| bool cEmu::AddEeprom | ( | unsigned short | addr, |
| unsigned short | size, | ||
| unsigned short | otpSize, | ||
| const char * | name | ||
| ) | [protected] |
Definition at line 86 of file nagra1.c.
References c6805::AddMapper().
Referenced by cEmuRom10Core::DoMaps(), and cEmuRom3Core::DoMaps().
{
cMap *map=new cMapEeprom(addr,name,otpSize);
return AddMapper(map,addr,size);
}
| bool cEmu::AddRom | ( | unsigned short | addr, |
| unsigned short | size, | ||
| const char * | name | ||
| ) | [protected] |
Definition at line 80 of file nagra1.c.
References c6805::AddMapper().
Referenced by cEmuRom10Core::DoMaps(), and cEmuRom3Core::DoMaps().
| bool cEmu::GetOpKeys | ( | const unsigned char * | Emm, |
| unsigned char * | id, | ||
| unsigned char * | key0, | ||
| unsigned char * | key1 | ||
| ) |
Definition at line 120 of file nagra1.c.
References c6805::AddBreakpoint(), c6805::ClearBreakpoints(), EmmEnd, EmmKey0, EmmKey1, EmmStart, c6805::GetMem(), c6805::GetPc(), keys, MapAddr, MathMapHandler(), MAX_COUNT, c6805::PopPc(), c6805::Run(), c6805::SetMem(), c6805::SetPc(), and UpdateSetup().
Referenced by cTestNagra::Process(), and cSystemNagra::ProcessEMM().
{
int keys=0;
if(UpdateSetup(Emm)) {
SetMem(0x0080,&Emm[0],64);
SetMem(0x00F8,&Emm[1],2);
SetPc(EmmStart);
ClearBreakpoints();
AddBreakpoint(EmmEnd);
AddBreakpoint(MapAddr);
AddBreakpoint(EmmKey0);
AddBreakpoint(EmmKey1);
while(!Run(MAX_COUNT)) {
unsigned short pc=GetPc();
if(pc==EmmKey0) {
GetMem(0x82,key0,8);
keys++;
}
if(pc==EmmKey1) {
GetMem(0x82,key1,8);
keys++;
}
if(pc==MapAddr) {
if(!MathMapHandler()) break;
PopPc(); // remove return address from stack
}
if(pc==EmmEnd) {
GetMem(0x00F8,id,2);
break;
}
}
}
return (keys==2);
}
| bool cEmu::GetPkKeys | ( | const unsigned char * | select, |
| unsigned char * | pkset | ||
| ) |
Definition at line 155 of file nagra1.c.
References c6805::AddBreakpoint(), c6805::CC::c, c6805::cc, c6805::ClearBreakpoints(), FindKeyEnd, FindKeyStart, c6805::Get(), c6805::GetMem(), c6805::GetPc(), i, L_SYS_EMU, MAX_COUNT, PRINTF, Rc1H, Rc1L, c6805::Run(), c6805::Set(), c6805::SetMem(), and c6805::SetPc().
Referenced by cTestNagra::Process(), and cSystemNagra::ProcessEMM().
{
Set(0x0081,select[2]<<7);
SetMem(0x00F8,select,3);
SetPc(FindKeyStart);
ClearBreakpoints();
AddBreakpoint(FindKeyEnd);
while(!Run(MAX_COUNT)) {
unsigned short pc=GetPc();
if(pc==FindKeyEnd) {
if(!cc.c) {
PRINTF(L_SYS_EMU,"Updating PK keys");
unsigned short loc=(Get(Rc1H)<<8)+Get(Rc1L);
for(int i=0; i<45; i+=15) GetMem(loc+4+i,pkset+i,15);
return true;
}
else {
PRINTF(L_SYS_EMU,"Updating PK keys failed. Used a correct EEPROM image for provider %04x ?",((select[0]<<8)|select[1]));
break;
}
}
}
return false;
}
| bool cEmu::Init | ( | int | RomNr, |
| int | Id | ||
| ) |
Definition at line 97 of file nagra1.c.
References c6805::AddBreakpoint(), bprintf(), c6805::ClearBreakpoints(), Cmd83Chk, eepromName, EnsIrdChk, c6805::ForceSet(), InitEnd, InitSetup(), InitStart, MAX_COUNT, romExtName, romName, romNr, c6805::Run(), c6805::Set(), c6805::SetPc(), c6805::SetSp(), SoftInt, and StackHigh.
Referenced by cTestNagra::Process(), and cSystemNagra::ProcessEMM().
{
romNr=RomNr; id=Id;
romName=bprintf("ROM%d.bin",romNr);
romExtName=bprintf("ROM%dext.bin",romNr);
eepromName=bprintf("eep%i_%02x.bin",romNr,(id&0xff00)>>8);
if(InitSetup()) {
ForceSet(EnsIrdChk, 0x81,true);
ForceSet(Cmd83Chk+0,0x98,true);
ForceSet(Cmd83Chk+1,0x9d,true);
if(SoftInt) {
Set(0x1ffc,SoftInt>>8);
Set(0x1ffd,SoftInt&0xff);
}
SetSp(StackHigh,0);
SetPc(InitStart);
ClearBreakpoints();
AddBreakpoint(InitEnd);
if(!Run(MAX_COUNT)) return true;
}
return false;
}
| virtual bool cEmu::InitSetup | ( | void | ) | [inline, protected, virtual] |
| bool cEmu::Matches | ( | int | RomNr, |
| int | Id | ||
| ) |
Definition at line 92 of file nagra1.c.
References romNr.
Referenced by cTestNagra::Process(), and cSystemNagra::ProcessEMM().
{
return (romNr==RomNr && id==Id);
}
| bool cEmu::MathMapHandler | ( | void | ) | [protected, virtual] |
| virtual bool cEmu::UpdateSetup | ( | const unsigned char * | emm | ) | [inline, protected, virtual] |
int cEmu::Cmd83Chk [protected] |
Definition at line 50 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and Init().
char * cEmu::eepromName [protected] |
Definition at line 43 of file nagra1.c.
Referenced by cEmu(), cEmuRom10Core::DoMaps(), cEmuRom3Core::DoMaps(), Init(), and ~cEmu().
int cEmu::EmmEnd [protected] |
Definition at line 46 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetOpKeys().
int cEmu::EmmKey0 [protected] |
Definition at line 46 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetOpKeys().
int cEmu::EmmKey1 [protected] |
Definition at line 46 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetOpKeys().
int cEmu::EmmStart [protected] |
Definition at line 46 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetOpKeys().
int cEmu::EnsIrdChk [protected] |
Definition at line 50 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and Init().
int cEmu::FindKeyEnd [protected] |
Definition at line 47 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetPkKeys().
int cEmu::FindKeyStart [protected] |
Definition at line 47 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetPkKeys().
int cEmu::InitEnd [protected] |
Definition at line 45 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and Init().
int cEmu::InitStart [protected] |
Definition at line 45 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and Init().
int cEmu::MapAddr [protected] |
Definition at line 48 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetOpKeys().
int cEmu::Rc1H [protected] |
Definition at line 49 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetPkKeys().
int cEmu::Rc1L [protected] |
Definition at line 49 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and GetPkKeys().
char * cEmu::romExtName [protected] |
Definition at line 43 of file nagra1.c.
Referenced by cEmu(), cEmuRom10Core::DoMaps(), cEmuRom3Core::DoMaps(), Init(), and ~cEmu().
char* cEmu::romName [protected] |
Definition at line 43 of file nagra1.c.
Referenced by cEmu(), cEmuRom10Core::DoMaps(), cEmuRom3Core::DoMaps(), Init(), and ~cEmu().
int cEmu::romNr [protected] |
Definition at line 42 of file nagra1.c.
Referenced by Init(), Matches(), and MathMapHandler().
int cEmu::SoftInt [protected] |
Definition at line 51 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and Init().
int cEmu::StackHigh [protected] |
Definition at line 51 of file nagra1.c.
Referenced by cEmuRom10::cEmuRom10(), cEmuRom11::cEmuRom11(), cEmuRom3::cEmuRom3(), cEmuRom7::cEmuRom7(), and Init().