-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathIsoWriter.cpp
85 lines (71 loc) · 1.66 KB
/
IsoWriter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "StdAfx.h"
#include "isowriter.h"
CIsoWriter::CIsoWriter(void)
{
m_Address = 150;
m_Buffer = nullptr;
m_BufferTail = nullptr;
}
CIsoWriter::~CIsoWriter(void)
{
Close();
}
void CIsoWriter::Close(void)
{
while (m_Buffer != nullptr)
{
m_BufferTail = m_Buffer;
m_Buffer = m_Buffer->Next;
delete m_BufferTail;
}
m_BufferTail = nullptr;
}
void CIsoWriter::WriteHeader(BYTE* Buffer)
{
CreateNewBuffer();
memcpy((m_BufferTail->Data) + 16, Buffer, 2048);
m_EDC.Mode1Raw((m_BufferTail->Data), m_Address.Minute, m_Address.Second, m_Address.Frame);
m_Address = m_Address.GetByLBA() + 1;
}
DWORD CIsoWriter::GetLBA(void)
{
return m_Address.GetByLBA();
}
void CIsoWriter::CreateNewBuffer(void)
{
if (m_Buffer == nullptr || m_BufferTail == nullptr)
{
m_Buffer = new HeaderBuffer;
m_BufferTail = m_Buffer;
}
else
{
m_BufferTail->Next = new HeaderBuffer;
m_BufferTail = m_BufferTail->Next;
}
m_BufferTail->Next = nullptr;
}
bool CIsoWriter::GetHeaderFrame(BYTE* Buffer)
{
HeaderBuffer* p;
if (m_Buffer == nullptr || m_BufferTail == nullptr)
{
return false;
}
memcpy(Buffer, m_Buffer->Data, 2352);
p = m_Buffer;
m_Buffer = m_Buffer->Next;
delete p;
return true;
}
void CIsoWriter::GenerateData(BYTE* Buffer, BYTE* Src)
{
memcpy(Buffer + 16, Src, 2048);
m_EDC.Mode1Raw(Buffer, m_Address.Minute, m_Address.Second, m_Address.Frame);
m_Address = m_Address.GetByLBA() + 1;
}
void CIsoWriter::GenerateRaw(BYTE* Buffer, BYTE* Src)
{
memcpy(Buffer, Src, 2352);
m_Address = m_Address.GetByLBA() + 1;
}