break some stuff. FDS can eject and insert disk sides now
This commit is contained in:
parent
7ee00fbcb8
commit
e6058e6bd8
|
@ -148,6 +148,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
//if (resetSignal)
|
//if (resetSignal)
|
||||||
//Controller.UnpressButton("Reset"); TODO fix this
|
//Controller.UnpressButton("Reset"); TODO fix this
|
||||||
resetSignal = Controller["Reset"];
|
resetSignal = Controller["Reset"];
|
||||||
|
|
||||||
|
if (board is FDS)
|
||||||
|
{
|
||||||
|
var b = board as FDS;
|
||||||
|
if (Controller["FDS Eject"])
|
||||||
|
b.Eject();
|
||||||
|
for (int i = 0; i < b.NumSides; i++)
|
||||||
|
if (Controller["FDS Insert " + i])
|
||||||
|
b.InsertSide(i);
|
||||||
|
}
|
||||||
|
|
||||||
ppu.FrameAdvance();
|
ppu.FrameAdvance();
|
||||||
if (lagged)
|
if (lagged)
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
|
|
||||||
public override void WriteEXP(int addr, byte value)
|
public override void WriteEXP(int addr, byte value)
|
||||||
{
|
{
|
||||||
Console.WriteLine("W{0:x4}:{1:x2} {2:x4}", addr + 0x4000, value, NES.cpu.PC);
|
//Console.WriteLine("W{0:x4}:{1:x2} {2:x4}", addr + 0x4000, value, NES.cpu.PC);
|
||||||
|
|
||||||
if (addr >= 0x0040)
|
if (addr >= 0x0040)
|
||||||
{
|
{
|
||||||
|
@ -177,8 +177,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
diskirq = diskdrive.irq;
|
diskirq = diskdrive.irq;
|
||||||
if (addr != 0x0032)
|
//if (addr != 0x0032)
|
||||||
Console.WriteLine("R{0:x4}:{1:x2} {2:x4}", addr + 0x4000, ret, NES.cpu.PC);
|
// Console.WriteLine("R{0:x4}:{1:x2} {2:x4}", addr + 0x4000, ret, NES.cpu.PC);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sound.Utilities.DCFilter dc = new Sound.Utilities.DCFilter(4096);
|
||||||
|
|
||||||
public void ApplyCustomAudio(short[] samples)
|
public void ApplyCustomAudio(short[] samples)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < samples.Length; i += 2)
|
for (int i = 0; i < samples.Length; i += 2)
|
||||||
|
@ -282,6 +284,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
}
|
}
|
||||||
//Console.WriteLine("##{0}##", samplebuffpos);
|
//Console.WriteLine("##{0}##", samplebuffpos);
|
||||||
samplebuffpos = 0;
|
samplebuffpos = 0;
|
||||||
|
|
||||||
|
dc.PushThroughSamples(samples, samples.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
disk = null;
|
disk = null;
|
||||||
state = RamAdapterState.IDLE;
|
state = RamAdapterState.IDLE;
|
||||||
SetCycles();
|
SetCycles();
|
||||||
|
Console.WriteLine("FDS: Disk ejected");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Insert(byte[] side, int bitlength, bool writeprotect)
|
public void Insert(byte[] side, int bitlength, bool writeprotect)
|
||||||
|
@ -106,6 +107,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
this.writeprotect = writeprotect;
|
this.writeprotect = writeprotect;
|
||||||
state = RamAdapterState.INSERTING;
|
state = RamAdapterState.INSERTING;
|
||||||
SetCycles();
|
SetCycles();
|
||||||
|
Console.WriteLine("FDS: Disk Inserted");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -177,11 +179,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
// control reg
|
// control reg
|
||||||
public void Write4025(byte value)
|
public void Write4025(byte value)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if ((value & 1) != 0) // start motor
|
if ((value & 1) != 0) // start motor
|
||||||
{
|
{
|
||||||
if (state == RamAdapterState.IDLE)
|
if (state == RamAdapterState.IDLE && disk != null) // no spinup when no disk
|
||||||
{
|
{
|
||||||
state = RamAdapterState.SPINUP;
|
state = RamAdapterState.SPINUP;
|
||||||
SetCycles();
|
SetCycles();
|
||||||
|
@ -224,7 +224,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
bytetransferflag = false;
|
bytetransferflag = false;
|
||||||
irq = false; //??
|
irq = false; //??
|
||||||
Console.WriteLine("{0:x2} @{1}", readreglatch, lastreaddiskpos);
|
//Console.WriteLine("{0:x2} @{1}", readreglatch, lastreaddiskpos);
|
||||||
// it seems very hard to avoid this situation, hence the switch to latched shift regs
|
// it seems very hard to avoid this situation, hence the switch to latched shift regs
|
||||||
//if (readregpos != 0)
|
//if (readregpos != 0)
|
||||||
//{
|
//{
|
||||||
|
|
|
@ -25,6 +25,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
SetPalette(Palettes.FCEUX_Standard);
|
SetPalette(Palettes.FCEUX_Standard);
|
||||||
videoProvider = new MyVideoProvider(this);
|
videoProvider = new MyVideoProvider(this);
|
||||||
Init(game, rom, fdsbios);
|
Init(game, rom, fdsbios);
|
||||||
|
ControllerDefinition = new ControllerDefinition(NESController);
|
||||||
|
if (board is FDS)
|
||||||
|
{
|
||||||
|
var b = board as FDS;
|
||||||
|
ControllerDefinition.BoolButtons.Add("FDS Eject");
|
||||||
|
for (int i = 0; i < b.NumSides; i++)
|
||||||
|
ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NES()
|
private NES()
|
||||||
|
@ -222,7 +230,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition { get { return NESController; } }
|
public ControllerDefinition ControllerDefinition { get; private set; }
|
||||||
|
|
||||||
IController controller;
|
IController controller;
|
||||||
public IController Controller
|
public IController Controller
|
||||||
|
|
|
@ -7,6 +7,19 @@ namespace BizHawk
|
||||||
public string Name;
|
public string Name;
|
||||||
public List<string> BoolButtons = new List<string>();
|
public List<string> BoolButtons = new List<string>();
|
||||||
public List<string> FloatControls = new List<string>();
|
public List<string> FloatControls = new List<string>();
|
||||||
|
/// <summary>
|
||||||
|
/// copy
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
public ControllerDefinition(ControllerDefinition source)
|
||||||
|
{
|
||||||
|
this.Name = source.Name;
|
||||||
|
foreach (var s in source.BoolButtons)
|
||||||
|
this.BoolButtons.Add(s);
|
||||||
|
foreach (var s in source.FloatControls)
|
||||||
|
this.FloatControls.Add(s);
|
||||||
|
}
|
||||||
|
public ControllerDefinition() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IController
|
public interface IController
|
||||||
|
|
|
@ -43,6 +43,22 @@ namespace BizHawk.Emulation.Sound.Utilities
|
||||||
buffer.Enqueue(0);
|
buffer.Enqueue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// detached mode
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filterwidth"></param>
|
||||||
|
public DCFilter(int filterwidth)
|
||||||
|
{
|
||||||
|
if (filterwidth < 1 || filterwidth > 65536)
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
this.input = null;
|
||||||
|
this.syncinput = null;
|
||||||
|
this.depth = filterwidth;
|
||||||
|
this.buffer = new Queue<short>(depth * 2);
|
||||||
|
for (int i = 0; i < depth * 2; i++)
|
||||||
|
buffer.Enqueue(0);
|
||||||
|
}
|
||||||
|
|
||||||
public DCFilter(ISyncSoundProvider input, int filterwidth)
|
public DCFilter(ISyncSoundProvider input, int filterwidth)
|
||||||
{
|
{
|
||||||
if (filterwidth < 1 || filterwidth > 65536)
|
if (filterwidth < 1 || filterwidth > 65536)
|
||||||
|
|
|
@ -17,6 +17,8 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControllerDefinition Type { get { return type; } }
|
public ControllerDefinition Type { get { return type; } }
|
||||||
|
/// <summary>don't do this</summary>
|
||||||
|
public void ForceType(ControllerDefinition newtype) { this.type = newtype; }
|
||||||
public bool this[string button] { get { return IsPressed(button); } }
|
public bool this[string button] { get { return IsPressed(button); } }
|
||||||
public bool IsPressed(string button)
|
public bool IsPressed(string button)
|
||||||
{
|
{
|
||||||
|
@ -65,14 +67,17 @@ namespace BizHawk.MultiClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void OR_FromLogical(IController controller)
|
public void OR_FromLogical(IController controller)
|
||||||
{
|
{
|
||||||
foreach (string button in type.BoolButtons)
|
// change: or from each button that the other input controller has
|
||||||
{
|
//foreach (string button in type.BoolButtons)
|
||||||
if (controller.IsPressed(button))
|
if (controller.Type != null)
|
||||||
|
foreach (string button in controller.Type.BoolButtons)
|
||||||
{
|
{
|
||||||
buttons[button] = true;
|
if (controller.IsPressed(button))
|
||||||
//Console.WriteLine(button);
|
{
|
||||||
|
buttons[button] = true;
|
||||||
|
//Console.WriteLine(button);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BindButton(string button, string control)
|
public void BindButton(string button, string control)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1174,6 +1174,7 @@ namespace BizHawk.MultiClient
|
||||||
break;
|
break;
|
||||||
case "NES":
|
case "NES":
|
||||||
NESToolStripMenuItem.Visible = true;
|
NESToolStripMenuItem.Visible = true;
|
||||||
|
NESFDSMenuControls();
|
||||||
break;
|
break;
|
||||||
case "PCE":
|
case "PCE":
|
||||||
case "PCECD":
|
case "PCECD":
|
||||||
|
@ -1212,6 +1213,44 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NESFDSMenuAdd(string name, string button, string msg)
|
||||||
|
{
|
||||||
|
fDSToolStripMenuItem.Visible = true;
|
||||||
|
fDSToolStripMenuItem.DropDownItems.Add(name, null, delegate(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains(button))
|
||||||
|
{
|
||||||
|
if (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished)
|
||||||
|
{
|
||||||
|
Global.ClickyVirtualPadController.Click(button);
|
||||||
|
Global.OSD.AddMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NESFDSMenuControls()
|
||||||
|
{
|
||||||
|
|
||||||
|
// ugly and hacky
|
||||||
|
fDSToolStripMenuItem.Visible = false;
|
||||||
|
fDSToolStripMenuItem.DropDownItems.Clear();
|
||||||
|
var ss = Global.Emulator.ControllerDefinition.BoolButtons;
|
||||||
|
|
||||||
|
if (ss.Contains("FDS Eject"))
|
||||||
|
NESFDSMenuAdd("Eject Disk", "FDS Eject", "FDS Disk Ejected.");
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
string s = "FDS Insert " + i;
|
||||||
|
if (ss.Contains(s))
|
||||||
|
NESFDSMenuAdd("Insert Disk " + i, s, "FDS Disk " + i + " inserted.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SyncControls()
|
void SyncControls()
|
||||||
{
|
{
|
||||||
if (Global.Game == null) return;
|
if (Global.Game == null) return;
|
||||||
|
@ -1267,7 +1306,9 @@ namespace BizHawk.MultiClient
|
||||||
Global.ActiveController = Global.NullControls;
|
Global.ActiveController = Global.NullControls;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// allow propogating controls that are in the current controller definition but not in the prebaked one
|
||||||
|
Global.ActiveController.ForceType(new ControllerDefinition(Global.Emulator.ControllerDefinition));
|
||||||
|
Global.ClickyVirtualPadController.Type = new ControllerDefinition(Global.Emulator.ControllerDefinition);
|
||||||
RewireInputChain();
|
RewireInputChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue