fix Disc/Disc name collision
add function to disc-api to get game-ID hash from 1st data track
This commit is contained in:
parent
adc0bf83bb
commit
74a58186df
|
@ -4,7 +4,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
using BizHawk.Emulation.CPUs.H6280;
|
||||
using BizHawk.Emulation.Sound;
|
||||
using BizHawk.Disc;
|
||||
using BizHawk.DiscSystem;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.TurboGrafx
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
public byte[] Ram;
|
||||
|
||||
// Disc
|
||||
//private Disc.Disc disc = Disc.Disc.FromCuePath("d:/lib/roms/Turbo CD/Cosmic Fantasy II/Cosmic Fantasy II [U][CD][WTG990301][Telenet Japan][1992][PCE][thx-1138-darkwater].cue");
|
||||
//private Disc disc = Disc.FromCuePath("D:/lib/roms/Turbo CD/Terra Forming/Syd Mead's Terra Forming [U][CD.SCD][TGXCD1040][Syd Mead][1993][PCE][rigg].cue");
|
||||
|
||||
// PC Engine timings:
|
||||
// 21,477,270 Machine clocks / sec
|
||||
|
@ -50,6 +50,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
|
||||
public PCEngine(NecSystemType type)
|
||||
{
|
||||
//scsi.disc = disc;
|
||||
//Console.WriteLine(disc.GetHash());
|
||||
CoreOutputComm = new CoreOutputComm();
|
||||
Type = type;
|
||||
Controller = NullController.GetNullController();
|
||||
|
@ -85,22 +87,18 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
// In memory, 384k roms look like [1st 256k][Then full 384k]
|
||||
RomData = new byte[0xA0000];
|
||||
var origRom = game.GetRomData();
|
||||
for (int i = 0; i < 0x40000; i++)
|
||||
for (int i=0; i<0x40000; i++)
|
||||
RomData[i] = origRom[i];
|
||||
for (int i = 0; i < 0x60000; i++)
|
||||
RomData[i + 0x40000] = origRom[i];
|
||||
RomData[i+0x40000] = origRom[i];
|
||||
RomLength = RomData.Length;
|
||||
}
|
||||
else if (game.GetRomData().Length > 1024 * 1024)
|
||||
{
|
||||
} else if (game.GetRomData().Length > 1024 * 1024) {
|
||||
// If the rom is bigger than 1 megabyte, switch to Street Fighter 2 mapper
|
||||
Cpu.ReadMemory21 = ReadMemorySF2;
|
||||
Cpu.WriteMemory21 = WriteMemorySF2;
|
||||
RomData = game.GetRomData();
|
||||
RomLength = RomData.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// normal rom.
|
||||
RomData = game.GetRomData();
|
||||
RomLength = RomData.Length;
|
||||
|
@ -158,13 +156,15 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
private bool lagged = true;
|
||||
private bool islag = false;
|
||||
public int Frame { get; set; }
|
||||
public void ResetFrameCounter()
|
||||
{
|
||||
Frame = 0;
|
||||
}
|
||||
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
|
||||
public bool IsLagFrame { get { return islag; } }
|
||||
|
||||
public void ResetFrameCounter()
|
||||
{
|
||||
// this should just be a public setter instead of a new method.
|
||||
Frame = 0;
|
||||
}
|
||||
|
||||
public void FrameAdvance(bool render)
|
||||
{
|
||||
lagged = true;
|
||||
|
@ -192,7 +192,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
|
||||
public IVideoProvider VideoProvider
|
||||
{
|
||||
get { return (IVideoProvider)VPC ?? VDC1; }
|
||||
get { return (IVideoProvider) VPC ?? VDC1; }
|
||||
}
|
||||
|
||||
public ISoundProvider SoundProvider
|
||||
|
@ -299,9 +299,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
VCE.SaveStateBinary(writer);
|
||||
VDC1.SaveStateBinary(writer);
|
||||
PSG.SaveStateBinary(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
writer.Write(Ram);
|
||||
writer.Write(Frame);
|
||||
writer.Write(_lagcount);
|
||||
|
@ -330,9 +328,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
VCE.LoadStateBinary(reader);
|
||||
VDC1.LoadStateBinary(reader);
|
||||
PSG.LoadStateBinary(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Ram = reader.ReadBytes(0x8000);
|
||||
Frame = reader.ReadInt32();
|
||||
_lagcount = reader.ReadInt32();
|
||||
|
@ -380,6 +376,6 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
|
||||
public void Dispose() { }
|
||||
public void Dispose() {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk.Disc
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
//TBD CCD format
|
||||
public class CCDFormat
|
||||
|
|
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||
|
||||
//this rule is not supported correctly: `The first track number can be greater than one, but all track numbers after the first must be sequential.`
|
||||
|
||||
namespace BizHawk.Disc
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
partial class Disc
|
||||
{
|
||||
|
|
|
@ -3,9 +3,8 @@ using System.Collections.Generic;
|
|||
|
||||
//main apis for emulator core routine use
|
||||
|
||||
namespace BizHawk.Disc
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
|
||||
public class DiscHopper
|
||||
{
|
||||
public Disc CurrentDisc;
|
||||
|
@ -83,11 +82,31 @@ namespace BizHawk.Disc
|
|||
return TOC;
|
||||
}
|
||||
|
||||
// converts LBA to minute:second:frame format.
|
||||
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));
|
||||
}
|
||||
|
||||
// gets an identifying hash. hashes the first 512 sectors of
|
||||
// the first data track on the disc.
|
||||
public string GetHash()
|
||||
{
|
||||
byte[] buffer = new byte[512*2353];
|
||||
foreach (var track in TOC.Sessions[0].Tracks)
|
||||
{
|
||||
if (track.TrackType == ETrackType.Audio)
|
||||
continue;
|
||||
|
||||
int lba_len = Math.Min(track.length_lba, 512);
|
||||
for (int s=0; s<512 && s<track.length_lba; s++)
|
||||
ReadLBA_2352(track.Indexes[1].lba + s, buffer, s*2352);
|
||||
|
||||
return Util.Hash_MD5(buffer, 0, lba_len*2352);
|
||||
}
|
||||
return "no data track found";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -66,7 +66,7 @@ using System.Collections.Generic;
|
|||
//mode2_2352 is the only kind of mode2, by necessity
|
||||
//audio is a different mode, seems to be just 2352 bytes with no sync, header or error correction. i guess the CIRC error correction is still there
|
||||
|
||||
namespace BizHawk.Disc
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
public partial class Disc
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Text.RegularExpressions;
|
|||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk.Disc
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
|
||||
public class DiscTOC
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace BizHawk.Disc
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
static class ECM
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.Collections.Generic;
|
|||
//a decent little subcode reference
|
||||
//http://www.jbum.com/cdg_revealed.html
|
||||
|
||||
namespace BizHawk.Disc
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
public class SubcodeStream
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk.Disc
|
||||
namespace BizHawk.DiscSystem
|
||||
{
|
||||
//TBD TOC format
|
||||
public class TOCFormat
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Reflection;
|
|||
using System.Text;
|
||||
using System.Reflection.Emit;
|
||||
using System.Threading;
|
||||
using BizHawk.DiscSystem;
|
||||
|
||||
namespace BizHawk
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ namespace BizHawk
|
|||
base.Dispose();
|
||||
}
|
||||
|
||||
public Disc.DiscHopper DiscHopper;
|
||||
public DiscHopper DiscHopper;
|
||||
|
||||
void SetFp(string name, Delegate del)
|
||||
{
|
||||
|
@ -49,7 +50,7 @@ namespace BizHawk
|
|||
|
||||
struct TrackInfo
|
||||
{
|
||||
public Disc.ETrackType TrackType;
|
||||
public ETrackType TrackType;
|
||||
public int length_lba;
|
||||
public int start_lba;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Diagnostics;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using BizHawk.DiscSystem;
|
||||
|
||||
namespace BizHawk
|
||||
{
|
||||
|
@ -29,7 +30,7 @@ namespace BizHawk
|
|||
}
|
||||
|
||||
DiscInterface mDiscInterface;
|
||||
public void SetDiscHopper(Disc.DiscHopper hopper)
|
||||
public void SetDiscHopper(DiscHopper hopper)
|
||||
{
|
||||
mDiscInterface.DiscHopper = hopper;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using SlimDX.Direct3D9;
|
||||
using BizHawk.DiscSystem;
|
||||
using SlimDX.Direct3D9;
|
||||
using SlimDX.DirectSound;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
|
@ -74,7 +75,7 @@ namespace BizHawk.MultiClient
|
|||
return mg.GetControllersAsMnemonic();
|
||||
}
|
||||
|
||||
public static Disc.DiscHopper DiscHopper = new BizHawk.Disc.DiscHopper();
|
||||
public static DiscHopper DiscHopper = new DiscHopper();
|
||||
|
||||
|
||||
public static CoreAccessor PsxCoreLibrary = new CoreAccessor(new Win32LibAccessor("PsxHawk.Core.dll"));
|
||||
|
|
|
@ -4,9 +4,9 @@ using System.Threading;
|
|||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using BizHawk.Core;
|
||||
using BizHawk.DiscSystem;
|
||||
using BizHawk.Emulation.Consoles.Sega;
|
||||
using BizHawk.Emulation.Consoles.TurboGrafx;
|
||||
using BizHawk.Emulation.Consoles.Calculator;
|
||||
|
@ -847,7 +847,7 @@ namespace BizHawk.MultiClient
|
|||
PsxCore psx = new PsxCore(Global.PsxCoreLibrary);
|
||||
nextEmulator = psx;
|
||||
game = new RomGame();
|
||||
var disc = Disc.Disc.FromIsoPath(path);
|
||||
var disc = Disc.FromIsoPath(path);
|
||||
Global.DiscHopper.Clear();
|
||||
Global.DiscHopper.Enqueue(disc);
|
||||
Global.DiscHopper.Insert();
|
||||
|
|
Loading…
Reference in New Issue