Code cleanup

This commit is contained in:
2015-10-02 06:03:34 +01:00
parent 606b2c76aa
commit 2af0e02f59
4 changed files with 23 additions and 15 deletions

View File

@@ -68,7 +68,7 @@ namespace SubChannelDecoder
CDLG_Write_Font = 4, CDLG_Write_Font = 4,
CDLG_Scroll_Screen = 12 CDLG_Scroll_Screen = 12
} }
public enum CD_G_Instructions : byte public enum CD_G_Instructions : byte
{ {
CDG_Memory_Preset = 1, CDG_Memory_Preset = 1,
@@ -152,7 +152,7 @@ namespace SubChannelDecoder
CDEG_Load_Color_Table_Additional_248_255 CDEG_Load_Color_Table_Additional_248_255
} }
static readonly int[] offsets = new [] static readonly int[] offsets =
{ 0, 66, 125, 191, 100, 50, 150, 175, { 0, 66, 125, 191, 100, 50, 150, 175,
8, 33, 58, 83, 108, 133, 158, 183, 8, 33, 58, 83, 108, 133, 158, 183,
16, 41, 25, 91, 116, 141, 166, 75 16, 41, 25, 91, 116, 141, 166, 75
@@ -167,7 +167,7 @@ namespace SubChannelDecoder
for (int pack = 0; pack < 4; pack++) for (int pack = 0; pack < 4; pack++)
for (int column = 0; column < 24; column++) for (int column = 0; column < 24; column++)
ms.WriteByte(subchannels[(pack*24)+offsets[column]]); ms.WriteByte(subchannels[(pack * 24) + offsets[column]]);
ms.Seek(0, System.IO.SeekOrigin.Begin); ms.Seek(0, System.IO.SeekOrigin.Begin);
byte[] packetized = ms.ToArray(); byte[] packetized = ms.ToArray();

View File

@@ -32,7 +32,7 @@ namespace SubChannelDecoder
public class CRC16CCITTContext public class CRC16CCITTContext
{ {
static UInt16[] table = static UInt16[] table =
{ {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5,
0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b,
0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210,

View File

@@ -1,3 +1,10 @@
2015-10-02 Natalia Portillo <claunia@claunia.com>
* Program.cs:
* CD_RW_Subchannel.cs:
* CRC16CCITTContext.cs:
Code cleanup
2015-10-02 Natalia Portillo <claunia@claunia.com> 2015-10-02 Natalia Portillo <claunia@claunia.com>
* CD_RW_Subchannel.cs: * CD_RW_Subchannel.cs:

View File

@@ -41,19 +41,19 @@ namespace SubChannelDecoder
static readonly char[] ISRCTable = static readonly char[] ISRCTable =
{ {
'0', '1', '2', '3', '4', '0', '1', '2', '3', '4',
'5', '6', '7', '8', '9', '5', '6', '7', '8', '9',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', 'A', 'B', 'C', ' ', ' ', 'A', 'B', 'C',
'D', 'E', 'F', 'G', 'H', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z' 'X', 'Y', 'Z'
}; };
static readonly char[] BCDTable = static readonly char[] BCDTable =
{ {
'0', '1', '2', '3', '0', '1', '2', '3',
'4', '5', '6', '7', '4', '5', '6', '7',
'8', '9', 'A', 'B', '8', '9', 'A', 'B',
@@ -112,6 +112,7 @@ namespace SubChannelDecoder
Subchannel sub = UnpackSubchannel(sectorBytes, interleaved); Subchannel sub = UnpackSubchannel(sectorBytes, interleaved);
Console.WriteLine("Sector {0}", sector); Console.WriteLine("Sector {0}", sector);
Console.WriteLine("\tP: 0x{0:X2}{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}{10:X2}{11:X2}", Console.WriteLine("\tP: 0x{0:X2}{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}{10:X2}{11:X2}",
sub.p[0], sub.p[1], sub.p[2], sub.p[3], sub.p[4], sub.p[5], sub.p[0], sub.p[1], sub.p[2], sub.p[3], sub.p[4], sub.p[5],
sub.p[6], sub.p[7], sub.p[8], sub.p[9], sub.p[10], sub.p[11]); sub.p[6], sub.p[7], sub.p[8], sub.p[9], sub.p[10], sub.p[11]);