Skip to content

Commit

Permalink
only load packet 29 from pages mFF
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXGuesser committed Sep 28, 2017
1 parent f963409 commit 339dca8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
67 changes: 36 additions & 31 deletions packetmag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,36 +235,45 @@ Packet* PacketMag::GetPacket(Packet* p)
}
}

tempLine = _page->GetTxRow(29);
while (tempLine != nullptr)
// Assemble the header. (we can simplify this code or leave it for the optimiser)
thisPageNum=_page->GetPageNumber();
thisPageNum=(thisPageNum/0x100) % 0x100; // Remove this line for Continuous Random Acquisition of Pages.

if ((thisPageNum & 0xFF) == 0xFF)
{
// TODO: we don't want to do this every time the page is encountered. We should do it once then check to see if it has changed
// Other issues include: multiple pages with packets 29 will overwrite each other, and when the page is deleted the packets will remain.
//std::cerr << "page includes packet 29" << std::endl;
switch (tempLine->GetCharAt(0))
// only read packet 29 from page mFF
//std::cerr << "updating packet 29" << std::endl;
// TODO: we needn't do this every time round the carousel
tempLine = _page->GetTxRow(29);
while (tempLine != nullptr)
{
case '@':
Packet29Index = 0;
break;
case 'A':
Packet29Index = 1;
break;
case 'D':
Packet29Index = 2;
break;
default:
Packet29Index = -1;
}
if (Packet29Index > -1)
{
if (_packet29[Packet29Index]==nullptr)
_packet29[Packet29Index]=new TTXLine(tempLine->GetLine(),true); // Didn't exist before
else
_packet29[Packet29Index]->Setm_textline(tempLine->GetLine(), true);
// TODO: when the page is deleted the packets will remain.
//std::cerr << "page includes packet 29" << std::endl;
switch (tempLine->GetCharAt(0))
{
case '@':
Packet29Index = 0;
break;
case 'A':
Packet29Index = 1;
break;
case 'D':
Packet29Index = 2;
break;
default:
Packet29Index = -1;
}
if (Packet29Index > -1)
{
if (_packet29[Packet29Index]==nullptr)
_packet29[Packet29Index]=new TTXLine(tempLine->GetLine(),true); // Didn't exist before
else
_packet29[Packet29Index]->Setm_textline(tempLine->GetLine(), true);
}

tempLine = tempLine->GetNextLine();
// loop until every row 29 is copied
}

tempLine = tempLine->GetNextLine();
// loop until every row 29 is copied
}

if (!(thisStatus & 0x8000))
Expand All @@ -273,10 +282,6 @@ Packet* PacketMag::GetPacket(Packet* p)
return nullptr;
}

// Assemble the header. (we can simplify this code or leave it for the optimiser)
thisPageNum=_page->GetPageNumber();
thisPageNum=(thisPageNum/0x100) % 0x100; // Remove this line for Continuous Random Acquisition of Pages.

// p=new Packet();
p->Header(_magNumber,thisPageNum,thisSubcode,thisStatus);// loads of stuff to do here!

Expand Down
2 changes: 1 addition & 1 deletion ttxpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ int TTXPage::GetLanguage()

void TTXPage::SetPageNumber(int page)
{
if ((page<0x10000) || (page>0x8ff99) || (page&0xFF00) == 0xFF00)
if ((page<0x10000) || (page>0x8ff99))
{
std::cerr << "[TTXPage::SetPageNumber] Page number is out of range: " << std::hex << page << std::endl;
}
Expand Down

0 comments on commit 339dca8

Please sign in to comment.