odds and ends, pre-commit for turbocd stuff

This commit is contained in:
beirich 2011-08-01 23:18:22 +00:00
parent bfd3956796
commit 1c72c144af
5 changed files with 125 additions and 15 deletions

View File

@ -200,6 +200,7 @@
<Compile Include="Interfaces\Base Implementations\NullEmulator.cs" />
<Compile Include="Interfaces\Base Implementations\SmdGame.cs" />
<Compile Include="Interfaces\CoreComms.cs" />
<Compile Include="QuickCollections.cs" />
<Compile Include="Sound\Utilities\BufferedAsync.cs" />
<Compile Include="Sound\Utilities\Metaspu.cs" />
<Compile Include="Interfaces\IController.cs" />

View File

@ -49,5 +49,12 @@ namespace BizHawk.Disc
{
return TOC;
}
public static void ConvertLBAtoMSF(int lba, out byte m, out byte s, out byte f)
{
m = (byte) (lba / 75 / 60);
s = (byte) ((lba - (m * 75 * 60)) / 75);
f = (byte) (lba - (m * 75 * 60) - (s * 75));
}
}
}

View File

@ -0,0 +1,87 @@
using System;
namespace BizHawk.Emulation
{
// If you're wondering what the point of this is: It's mostly to have .Clear() be fast.
// only intended to be used with value types. If used on references you may get GC issues.
// Also, being in the same assembly means the JITer might inline these calls.
// There is less overhead by not being dynamically resizable and stuff.
public sealed class QuickList<T> where T : struct
{
private T[] buffer;
public int Position;
public QuickList(int capacity)
{
buffer = new T[capacity];
}
public T this[int index]
{
get { return buffer[index]; }
set { buffer[index] = value; }
}
public int Count
{
get { return Position; }
}
public void Add(T item)
{
buffer[Position++] = item;
}
public void Clear()
{
Position = 0;
}
}
// and the point of this one is to be easier to serialize quickly. AND fast to clear.
// only intended to be used with value types. If used on references you may get GC issues.
public class QuickQueue<T> where T : struct
{
private T[] buffer;
private int head;
private int tail;
private int size;
public QuickQueue(int capacity)
{
buffer = new T[capacity];
}
public int Count { get { return tail - head; } }
public void Enqueue(T item)
{
if (size >= buffer.Length)
throw new Exception("QuickQueue capacity breached!");
buffer[tail] = item;
tail = (tail + 1) % buffer.Length;
size++;
}
public T Dequeue()
{
if (size == 0)
throw new Exception("QuickQueue is empty!");
T item = buffer[head];
head = (head + 1) % buffer.Length;
size--;
return item;
}
public void Clear()
{
head = 0;
tail = 0;
size = 0;
}
// TODO serialization functions
}
}

View File

@ -614,6 +614,16 @@ namespace BizHawk
return outStream.ToArray();
}
public static byte BinToBCD(this byte v)
{
return (byte) (((v/10)*16) | (v%10));
}
public static byte BCDtoBin(this byte v)
{
return (byte)(((v / 16) * 10) | (v % 16));
}
public static string FormatFileSize(long filesize)
{
Decimal size = (Decimal)filesize;

View File

@ -1,4 +1,4 @@
;CRC Status Name System ID Notes MetaData Configurations
;Hash Status Name System ID Notes MetaData Configurations
; ************ Sega Master System / Sega Mark III ************
@ -2205,20 +2205,6 @@ D42CF9BDA2B8691A63C3F8337DAA9B1D Cadash (J) PCE HBlankPeriod=87
F5E66069E211FCF1D3CF505322FDEC6B V Cadash (U) [b1] PCE HBlankPeriod=87
617A4254C05E88145110718951039E61 Cadash (U) PCE HBlankPeriod=87
F7B4C203689E354CBC053F77C723DB72 Cadash Sounds PCE
A645A0E7E12AD57C3B34271E6E67590E V CD-ROM System V1.00 (J) [b1] PCE BRAM
2B7CCB3D86BAA18F6402C176F3065082 CD-ROM System V1.00 (J) PCE BRAM
4A2A32A17DF3A9199213C8B9E7437E9C H CD-ROM System V2.00 (J) (reports V1) [h1] PCE BRAM
3A456F0ECCFF039EB5FF045F56EC1C3B V CD-ROM System V2.00 (J) PCE BRAM
FFD159AF6240051B15867476B6A9B808 CD-ROM System V2.01 (U) PCE BRAM
F544FEE6DCD0162A40C2C612DF360B2D H CD-ROM System V2.10 (J) (reports V1) [h1] PCE BRAM
34C93E053615758218FAC19A3900723E V CD-ROM System V2.10 (J) [b1] PCE BRAM
3CDD6614A918616BFC41C862E889DD79 CD-ROM System V2.10 (J) PCE BRAM
FC3D75364EF8CCCB4FA6B633E4BD5258 V Super CD-ROM2 System V3.00 (J) [o1] PCE BRAM
CB65B86FAABF0F4717CF8C84230B187C V Super CD-ROM2 System V3.00 (J) [o2] PCE BRAM
0FD6A4CFD78F2242025370D39AA3F287 V Super CD-ROM2 System V3.00 (J) [o3] PCE BRAM
D3A12A001E22EFB1436EC509D453A10F V Super CD-ROM2 System V3.00 (J) [o4] PCE BRAM
38179DF8F4AC870017DB21EBCBF53114 Super CD-ROM2 System V3.00 (J) PCE BRAM
98D43A097A165B03DF170FD5C2AD2C2F Super CD-ROM2 System V3.01 (U) PCE BRAM
B062D0060E2008A8D8ED3DB3C2A56203 V Champion Wrestler (J) [b1] PCE
DF1EFDAE03DA170EE57ED1278FCA777E V Champion Wrestler (J) [o1] PCE
337B0AA40E3C133B6242AA0B71A4FD20 Champion Wrestler (J) PCE
@ -3587,6 +3573,25 @@ C52D23DE777B1A6ADD4DA0CD559EF1F7 Daimakaimura Sounds SGX
7E1E489C50FC6213196E6DBB704F6671 Madouou Granzort (J) SGX ForceSpriteLimit
81D6C718657CF261935B21E8403D501D Madouou Granzort Sounds SGX
; ************ TurboCD System Cards ************
A645A0E7E12AD57C3B34271E6E67590E V CD-ROM System V1.00 (J) [b1] PCE BRAM
2B7CCB3D86BAA18F6402C176F3065082 I CD-ROM System V1.00 (J) PCE BRAM
4A2A32A17DF3A9199213C8B9E7437E9C H CD-ROM System V2.00 (J) (reports V1) [h1] PCE BRAM
3A456F0ECCFF039EB5FF045F56EC1C3B V CD-ROM System V2.00 (J) PCE BRAM
94279F315E8B52904F65AB3108542AFE I CD-ROM System V2.00 (U) PCE BRAM
FFD159AF6240051B15867476B6A9B808 I CD-ROM System V2.01 (U) PCE BRAM
F544FEE6DCD0162A40C2C612DF360B2D H CD-ROM System V2.10 (J) (reports V1) [h1] PCE BRAM
34C93E053615758218FAC19A3900723E V CD-ROM System V2.10 (J) [b1] PCE BRAM
3CDD6614A918616BFC41C862E889DD79 I CD-ROM System V2.10 (J) PCE BRAM
FC3D75364EF8CCCB4FA6B633E4BD5258 V Super CD-ROM2 System V3.00 (J) [o1] PCE BRAM
CB65B86FAABF0F4717CF8C84230B187C V Super CD-ROM2 System V3.00 (J) [o2] PCE BRAM
0FD6A4CFD78F2242025370D39AA3F287 V Super CD-ROM2 System V3.00 (J) [o3] PCE BRAM
D3A12A001E22EFB1436EC509D453A10F V Super CD-ROM2 System V3.00 (J) [o4] PCE BRAM
38179DF8F4AC870017DB21EBCBF53114 I Super CD-ROM2 System V3.00 (J) PCE BRAM
0754F903B52E3B3342202BDAFB13EFA5 I Super CD-ROM2 System V3.00 (U) PCE BRAM
98D43A097A165B03DF170FD5C2AD2C2F I Super CD-ROM2 System V3.01 (U) PCE BRAM
; ************ TI-83 ************
D4448D09BBFDE687C04F9E3310E023AB ti83_1.rom TI83 initPC=6ce