Start wiring up some CD+G instructions

This commit is contained in:
Matt Nadareski
2021-11-29 21:12:50 -08:00
parent 15b39e8cff
commit 3e44c11502
3 changed files with 241 additions and 30 deletions

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using RedBookPlayer.Models.Hardware.Karaoke;
namespace RedBookPlayer.Models.Hardware
{
@@ -106,30 +105,6 @@ namespace RedBookPlayer.Models.Hardware
return lowerSixBits == 0x09;
}
/// <summary>
/// Read packet data according to the instruction, if possible
/// </summary>
/// <returns>Supported object created from data, null on error</returns>
public object ReadData()
{
if(!IsCDGPacket())
return null;
return (this.Instruction) switch
{
SubchannelInstruction.MemoryPreset => new MemPreset(this.Data),
SubchannelInstruction.BorderPreset => new BorderPreset(this.Data),
SubchannelInstruction.TileBlockNormal => new TileBlock(this.Data),
SubchannelInstruction.ScrollPreset => new Scroll(this.Data),
SubchannelInstruction.ScrollCopy => new Scroll(this.Data),
SubchannelInstruction.DefineTransparentColor => null, // Undefined in documentation
SubchannelInstruction.LoadColorTableLower => new LoadCLUT(this.Data),
SubchannelInstruction.LoadColorTableUpper => new LoadCLUT(this.Data),
SubchannelInstruction.TileBlockXOR => new TileBlock(this.Data),
_ => null,
};
}
#endregion
}
}