BizHawk/DiscoHawk/DiscoHawk.cs

130 lines
4.5 KiB
C#
Raw Normal View History

2011-05-08 09:07:46 +00:00
using System;
2011-08-08 01:48:31 +00:00
using System.Reflection;
2011-05-08 09:07:46 +00:00
using System.Collections.Generic;
using System.IO;
2011-06-20 09:09:21 +00:00
//cue format preferences notes
//pcejin -
//does not like session commands
//it can handle binpercue
//it seems not to be able to handle binpertrack, or maybe i am doing something wrong (still havent ruled it out)
2011-05-08 09:07:46 +00:00
namespace BizHawk
{
class DiscoHawk
{
2011-08-08 01:48:31 +00:00
public static string GetExeDirectoryAbsolute()
{
string p = Path.GetDirectoryName(Assembly.GetEntryAssembly().GetName().CodeBase);
if (p.Substring(0, 6) == "file:\\")
p = p.Remove(0, 6);
string z = p;
return p;
}
2011-08-07 03:21:03 +00:00
[STAThread]
2011-05-08 09:07:46 +00:00
static void Main(string[] args)
{
2011-08-08 01:48:31 +00:00
DiscSystem.FFMpeg.FFMpegPath = Path.Combine(GetExeDirectoryAbsolute(), "ffmpeg.exe");
2011-05-08 09:07:46 +00:00
new DiscoHawk().Run(args);
}
void Run(string[] args)
{
2011-08-07 03:22:41 +00:00
bool gui = true;
2011-08-07 03:21:03 +00:00
foreach (var arg in args)
{
2011-08-07 03:22:41 +00:00
if (arg.ToUpper() == "COMMAND") gui = false;
2011-08-07 03:21:03 +00:00
}
if (gui)
{
var dialog = new DiscoHawkDialog();
dialog.ShowDialog();
return;
2011-08-07 03:21:03 +00:00
}
2011-06-20 09:09:21 +00:00
//string exedir = BizHawk.MultiClient.PathManager.GetExeDirectoryAbsolute();
//ffMpeg.Converter._ffExe = Path.Combine(exedir, "ffmpeg.exe");
////cue+bin+mp3 tests
//var conv = new ffMpeg.Converter();
////conv.WorkingPath = Environment.GetEnvironmentVariable("TEMP");
////var vf = conv.GetVideoInfo(@"D:\isos\scd\persia\Prince of Persia 01.mp3");
//var o = conv.ConvertToFLV(@"D:\isos\scd\persia\Prince of Persia 01.mp3");
////-i mp3file.mp3 -f wav outfile.wav
//Disc.CueBin munged;
//Disc.CueBinPrefs prefs = new Disc.CueBinPrefs();
//prefs.SingleSession = true;
//Disc.Disc disc;
//string testfile = @"D:\isos\pcecd\cosmicfantasy2\Cosmic Fantasy II [U][CD][WTG990301][Telenet Japan][1992][PCE][thx-1138-darkwater].cue";
//disc = Disc.Disc.FromCuePath(testfile);
//prefs.ReallyDumpBin = true;
//prefs.AnnotateCue = false;
//prefs.OneBinPerTrack = true;
//munged = disc.DumpCueBin("test", prefs);
//munged.Dump("d:\\test", prefs);
//File.WriteAllText("d:\\test\\redump.txt", munged.CreateRedumpReport());
//try roundtripping back to one file
//disc = Disc.Disc.FromCuePath("d:\\test\\test.cue");
//prefs.ReallyDumpBin = false;
//prefs.OneBinPerTrack = false;
//munged = disc.DumpCueBin("one", prefs);
//munged.Dump("d:\\test", prefs);
2011-05-08 09:07:46 +00:00
//string testfile = @"r:\isos\memtest86-3.2.iso";
//var disc = Disc.Disc.FromIsoPath(testfile);
//Console.WriteLine(disc.ReadTOC().DebugPrint());
//disc.DumpBin_2352("d:\\test.2352");
2011-06-20 09:09:21 +00:00
////test reading the subcode data. unfortunately we don't have lead-in subcode so we have no TOC
2011-05-14 21:56:54 +00:00
//using (FileStream fs = File.OpenRead("c:\\bof4.sub"))
//{
// Disc.SubcodeStream stream = new Disc.SubcodeStream(fs, 0);
// stream.Channel = 'q';
// using (FileStream fsOut = File.OpenWrite("c:\\bof4.sub.q"))
// {
// for (; ; )
// {
// int ret = stream.ReadByte();
// if (ret == -1) break;
// fsOut.WriteByte((byte)ret);
// }
// }
//}
2011-05-08 09:07:46 +00:00
//DiscSystem.Disc disc = DiscSystem.Disc.FromCuePath(@"D:\discs\Bomberman_'94_Taikenban_(SCD)(JPN)_-_wav'd\Bomberman '94 Taikenban (SCD)(JPN)_hawked.cue");
2011-08-08 01:48:31 +00:00
//DiscSystem.Disc disc = DiscSystem.Disc.FromCuePath(@"D:\discs\Bomberman_'94_Taikenban_(SCD)(JPN)_-_wav'd\Bomberman '94 Taikenban (SCD)(JPN).cue");
//var prefs = new DiscSystem.CueBinPrefs();
//prefs.AnnotateCue = false;
//prefs.OneBlobPerTrack = false;
//prefs.ReallyDumpBin = true;
//prefs.OmitRedundantIndex0 = true;
//prefs.SingleSession = true;
////var cueBin = disc.DumpCueBin("Bomberman '94 Taikenban (SCD)(JPN)_hawked_hawked", prefs);
//var cueBin = disc.DumpCueBin("Bomberman '94 Taikenban (SCD)(JPN)_hawked", prefs);
//cueBin.Dump(@"D:\discs\Bomberman_'94_Taikenban_(SCD)(JPN)_-_wav'd", prefs);
DiscSystem.Disc disc = DiscSystem.Disc.FromCuePath(@"D:\discs\Angels II - Holy Night (J)[Prototype]\Angels II - Holy Night (J)[Prototype].cue");
var prefs = new DiscSystem.CueBinPrefs();
prefs.AnnotateCue = false;
prefs.OneBlobPerTrack = false;
prefs.ReallyDumpBin = true;
prefs.OmitRedundantIndex0 = true;
prefs.SingleSession = true;
//var cueBin = disc.DumpCueBin("Bomberman '94 Taikenban (SCD)(JPN)_hawked_hawked", prefs);
2011-08-08 01:48:31 +00:00
var cueBin = disc.DumpCueBin("test", prefs);
cueBin.Dump(@"D:\discs\Angels II - Holy Night (J)[Prototype]", prefs);
2011-05-08 09:07:46 +00:00
}
}
}