Basic implementation of Global.ActiveController, uses an ORAdapter to OR against Active Controller. Still TODO: setting up autofire controllers for platforms and a UI in the Controller Config

This commit is contained in:
andres.delikat 2011-08-09 00:51:46 +00:00
parent 0d01af5c7b
commit 9b2ba5c85c
4 changed files with 213 additions and 155 deletions

View File

@ -24,6 +24,8 @@ namespace BizHawk.MultiClient
public static Controller NullControls; public static Controller NullControls;
public static CheatList CheatList; public static CheatList CheatList;
public static Controller autofireNESControls;
//the movie will be spliced inbetween these if it is present //the movie will be spliced inbetween these if it is present
public static CopyControllerAdapter MovieInputSourceAdapter = new CopyControllerAdapter(); public static CopyControllerAdapter MovieInputSourceAdapter = new CopyControllerAdapter();
public static CopyControllerAdapter MovieOutputAdapter = new CopyControllerAdapter(); public static CopyControllerAdapter MovieOutputAdapter = new CopyControllerAdapter();
@ -44,6 +46,9 @@ namespace BizHawk.MultiClient
//the original source controller, bound to the user, sort of the "input" port for the chain, i think //the original source controller, bound to the user, sort of the "input" port for the chain, i think
public static Controller ActiveController; public static Controller ActiveController;
//rapid fire version on the user controller, has its own key bindings and is OR'ed against ActiveController
public static Controller AutoFireController;
//the "output" port for the controller chain. //the "output" port for the controller chain.
public static CopyControllerAdapter ControllerOutput = new CopyControllerAdapter(); public static CopyControllerAdapter ControllerOutput = new CopyControllerAdapter();
@ -60,6 +65,11 @@ namespace BizHawk.MultiClient
/// </summary> /// </summary>
public static StickyXORAdapter StickyXORAdapter = new StickyXORAdapter(); public static StickyXORAdapter StickyXORAdapter = new StickyXORAdapter();
/// <summary>
/// will OR together two IControllers
/// </summary>
public static ORAdapter OrControllerAdapter = new ORAdapter();
/// <summary> /// <summary>
/// fire off one-frame logical button clicks here. useful for things like ti-83 virtual pad and reset buttons /// fire off one-frame logical button clicks here. useful for things like ti-83 virtual pad and reset buttons
/// </summary> /// </summary>

View File

@ -77,7 +77,7 @@ namespace BizHawk.MultiClient
Global.CheatList = new CheatList(); Global.CheatList = new CheatList();
UpdateStatusSlots(); UpdateStatusSlots();
//in order to allow late construction of this database, we hook up a delegate here to dearchive the data and provide it on demand //in order to allow late construction of this database, we hook up a delegate here to dearchive the data and provide it on demand
//we could background thread this later instead if we wanted to be real clever //we could background thread this later instead if we wanted to be real clever
NES.BootGodDB.GetDatabaseBytes = () => NES.BootGodDB.GetDatabaseBytes = () =>
@ -129,6 +129,7 @@ namespace BizHawk.MultiClient
InitControls(); InitControls();
Global.Emulator = new NullEmulator(); Global.Emulator = new NullEmulator();
Global.ActiveController = Global.NullControls; Global.ActiveController = Global.NullControls;
Global.AutoFireController = Global.NullControls;
Global.Sound = new Sound(Handle, Global.DSound); Global.Sound = new Sound(Handle, Global.DSound);
Global.Sound.StartSound(); Global.Sound.StartSound();
RewireInputChain(); RewireInputChain();
@ -305,6 +306,7 @@ namespace BizHawk.MultiClient
Global.ClientControls.LatchFromPhysical(Global.HotkeyCoalescer); Global.ClientControls.LatchFromPhysical(Global.HotkeyCoalescer);
Global.ActiveController.LatchFromPhysical(Global.ControllerInputCoalescer); Global.ActiveController.LatchFromPhysical(Global.ControllerInputCoalescer);
Global.ActiveController.OR_FromLogical(Global.ClickyVirtualPadController); Global.ActiveController.OR_FromLogical(Global.ClickyVirtualPadController);
Global.AutoFireController.LatchFromPhysical(Global.ControllerInputCoalescer);
Global.ClickyVirtualPadController.FrameTick(); Global.ClickyVirtualPadController.FrameTick();
@ -531,6 +533,22 @@ namespace BizHawk.MultiClient
} }
Global.NESControls = nesControls; Global.NESControls = nesControls;
var anesControls = new Controller(NES.NESController);
anesControls.Autofire = true;
for (int i = 0; i < 1 /*TODO make 2*/; i++)
{
anesControls.BindMulti("P" + (i + 1) + " Up", "");
anesControls.BindMulti("P" + (i + 1) + " Down", "");
anesControls.BindMulti("P" + (i + 1) + " Left", "");
anesControls.BindMulti("P" + (i + 1) + " Right", "");
anesControls.BindMulti("P" + (i + 1) + " A", "D");
anesControls.BindMulti("P" + (i + 1) + " B", "F");
anesControls.BindMulti("P" + (i + 1) + " Select", "");
anesControls.BindMulti("P" + (i + 1) + " Start", "");
}
Global.autofireNESControls = anesControls;
var gbControls = new Controller(Gameboy.GbController); var gbControls = new Controller(Gameboy.GbController);
gbControls.BindMulti("Up", Global.Config.GBController.Up); gbControls.BindMulti("Up", Global.Config.GBController.Up);
gbControls.BindMulti("Down", Global.Config.GBController.Down); gbControls.BindMulti("Down", Global.Config.GBController.Down);
@ -620,7 +638,7 @@ namespace BizHawk.MultiClient
case ".TAS": //Bizhawk case ".TAS": //Bizhawk
case ".FM2": //FCUEX case ".FM2": //FCUEX
case ".MC2": //PCEjin case ".MC2": //PCEjin
return true; return true;
default: default:
return false; return false;
} }
@ -777,6 +795,7 @@ namespace BizHawk.MultiClient
break; break;
case "NES": case "NES":
Global.ActiveController = Global.NESControls; Global.ActiveController = Global.NESControls;
Global.AutoFireController = Global.autofireNESControls;
break; break;
case "GB": case "GB":
break; break;
@ -791,15 +810,19 @@ namespace BizHawk.MultiClient
void RewireInputChain() void RewireInputChain()
{ {
Global.ControllerInputCoalescer = new InputCoalescer(); Global.ControllerInputCoalescer = new InputCoalescer();
Global.ControllerInputCoalescer.Type = Global.ActiveController.Type; Global.ControllerInputCoalescer.Type = Global.ActiveController.Type;
Global.UD_LR_ControllerAdapter.Source = Global.ActiveController; Global.OrControllerAdapter.Source = Global.ActiveController;
Global.StickyXORAdapter.Source = Global.UD_LR_ControllerAdapter; Global.OrControllerAdapter.SourceOr = Global.AutoFireController;
Global.UD_LR_ControllerAdapter.Source = Global.OrControllerAdapter;
Global.StickyXORAdapter.Source = Global.UD_LR_ControllerAdapter;
Global.MultitrackRewiringControllerAdapter.Source = Global.StickyXORAdapter; Global.MultitrackRewiringControllerAdapter.Source = Global.StickyXORAdapter;
Global.MovieInputSourceAdapter.Source = Global.MultitrackRewiringControllerAdapter; Global.MovieInputSourceAdapter.Source = Global.MultitrackRewiringControllerAdapter;
Global.ControllerOutput.Source = Global.MovieOutputAdapter; Global.ControllerOutput.Source = Global.MovieOutputAdapter;
Global.Emulator.Controller = Global.ControllerOutput; Global.Emulator.Controller = Global.ControllerOutput;
Global.MovieSession.MovieControllerAdapter.Type = Global.MovieInputSourceAdapter.Type; Global.MovieSession.MovieControllerAdapter.Type = Global.MovieInputSourceAdapter.Type;
@ -841,105 +864,105 @@ namespace BizHawk.MultiClient
IEmulator nextEmulator = null; IEmulator nextEmulator = null;
RomGame rom = null; RomGame rom = null;
GameInfo game = null; GameInfo game = null;
try try
{ {
if (file.Extension.ToLower() == ".iso") if (file.Extension.ToLower() == ".iso")
{ {
if (Global.PsxCoreLibrary.IsOpen) if (Global.PsxCoreLibrary.IsOpen)
{ {
// sorry zero ;'( I leave de-RomGameifying this to you // sorry zero ;'( I leave de-RomGameifying this to you
//PsxCore psx = new PsxCore(Global.PsxCoreLibrary); //PsxCore psx = new PsxCore(Global.PsxCoreLibrary);
//nextEmulator = psx; //nextEmulator = psx;
//game = new RomGame(); //game = new RomGame();
//var disc = Disc.FromIsoPath(path); //var disc = Disc.FromIsoPath(path);
//Global.DiscHopper.Clear(); //Global.DiscHopper.Clear();
//Global.DiscHopper.Enqueue(disc); //Global.DiscHopper.Enqueue(disc);
//Global.DiscHopper.Insert(); //Global.DiscHopper.Insert();
//psx.SetDiscHopper(Global.DiscHopper); //psx.SetDiscHopper(Global.DiscHopper);
} }
} }
else if (file.Extension.ToLower() == ".cue") else if (file.Extension.ToLower() == ".cue")
{ {
Disc disc = Disc.FromCuePath(path); Disc disc = Disc.FromCuePath(path);
var hash = disc.GetHash(); var hash = disc.GetHash();
game = Database.CheckDatabase(hash); game = Database.CheckDatabase(hash);
if (game == null) if (game == null)
{ {
// Game was not found in DB. For now we're going to send it to the PCE-CD core. // Game was not found in DB. For now we're going to send it to the PCE-CD core.
// In the future we need to do something smarter, possibly including simply asking the user // In the future we need to do something smarter, possibly including simply asking the user
// what system the game is for. // what system the game is for.
game = new GameInfo(); game = new GameInfo();
game.System = "PCE"; game.System = "PCE";
game.Name = file.Name; game.Name = file.Name;
} }
switch (game.System) switch (game.System)
{ {
case "PCE": case "PCE":
if (File.Exists(Global.Config.PathPCEBios) == false) if (File.Exists(Global.Config.PathPCEBios) == false)
{ {
MessageBox.Show("PCE-CD System Card not found. Please check the BIOS path in Config->Paths."); MessageBox.Show("PCE-CD System Card not found. Please check the BIOS path in Config->Paths.");
return false; return false;
} }
rom = new RomGame(new HawkFile(Global.Config.PathPCEBios)); rom = new RomGame(new HawkFile(Global.Config.PathPCEBios));
nextEmulator = new PCEngine(game, disc, rom.RomData); nextEmulator = new PCEngine(game, disc, rom.RomData);
break; break;
} }
} }
else else
{ {
rom = new RomGame(file); rom = new RomGame(file);
game = rom.GameInfo; game = rom.GameInfo;
switch (game.System) switch (game.System)
{ {
case "SMS": case "SMS":
case "SG": case "SG":
if (Global.Config.SmsEnableFM) game.AddOption("UseFM"); if (Global.Config.SmsEnableFM) game.AddOption("UseFM");
if (Global.Config.SmsAllowOverlock) game.AddOption("AllowOverclock"); if (Global.Config.SmsAllowOverlock) game.AddOption("AllowOverclock");
if (Global.Config.SmsForceStereoSeparation) game.AddOption("ForceStereo"); if (Global.Config.SmsForceStereoSeparation) game.AddOption("ForceStereo");
nextEmulator = new SMS(game, rom.RomData); nextEmulator = new SMS(game, rom.RomData);
break; break;
case "GG": case "GG":
if (Global.Config.SmsAllowOverlock) game.AddOption("AllowOverclock"); if (Global.Config.SmsAllowOverlock) game.AddOption("AllowOverclock");
nextEmulator = new SMS(game, rom.RomData); nextEmulator = new SMS(game, rom.RomData);
break; break;
case "PCE": case "PCE":
case "SGX": case "SGX":
nextEmulator = new PCEngine(game, rom.RomData); nextEmulator = new PCEngine(game, rom.RomData);
break; break;
case "GEN": case "GEN":
nextEmulator = new Genesis(true); //TODO nextEmulator = new Genesis(true); //TODO
break; break;
case "TI83": case "TI83":
nextEmulator = new TI83(game, rom.RomData); nextEmulator = new TI83(game, rom.RomData);
if (Global.Config.TI83autoloadKeyPad) if (Global.Config.TI83autoloadKeyPad)
LoadTI83KeyPad(); LoadTI83KeyPad();
break; break;
case "NES": case "NES":
{ {
NES nes = new NES(game, rom.FileData); NES nes = new NES(game, rom.FileData);
Global.Game.Status = nes.RomStatus; Global.Game.Status = nes.RomStatus;
nextEmulator = nes; nextEmulator = nes;
if (Global.Config.NESAutoLoadPalette && Global.Config.NESPaletteFile.Length > 0 && if (Global.Config.NESAutoLoadPalette && Global.Config.NESPaletteFile.Length > 0 &&
HawkFile.ExistsAt(Global.Config.NESPaletteFile)) HawkFile.ExistsAt(Global.Config.NESPaletteFile))
{ {
nes.SetPalette( nes.SetPalette(
NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(Global.Config.NESPaletteFile))); NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(Global.Config.NESPaletteFile)));
} }
} }
break; break;
case "GB": case "GB":
nextEmulator = new Gameboy(); nextEmulator = new Gameboy();
break; break;
} }
} }
if (nextEmulator == null) if (nextEmulator == null)
throw new Exception(); throw new Exception();
nextEmulator.CoreInputComm = Global.CoreInputComm; nextEmulator.CoreInputComm = Global.CoreInputComm;
} }
catch (Exception ex) catch (Exception ex)
@ -947,7 +970,7 @@ namespace BizHawk.MultiClient
MessageBox.Show("Exception during loadgame:\n\n" + ex.ToString()); MessageBox.Show("Exception during loadgame:\n\n" + ex.ToString());
return false; return false;
} }
if (nextEmulator == null) throw new Exception(); if (nextEmulator == null) throw new Exception();
@ -971,7 +994,7 @@ namespace BizHawk.MultiClient
//setup the throttle based on platform's specifications //setup the throttle based on platform's specifications
//(one day later for some systems we will need to modify it at runtime as the display mode changes) //(one day later for some systems we will need to modify it at runtime as the display mode changes)
{ {
throttle.SetCoreFps( Global.Emulator.CoreOutputComm.VsyncRate); throttle.SetCoreFps(Global.Emulator.CoreOutputComm.VsyncRate);
SyncThrottle(); SyncThrottle();
} }
RamSearch1.Restart(); RamSearch1.Restart();
@ -1051,42 +1074,44 @@ namespace BizHawk.MultiClient
private void LoadSaveRam() private void LoadSaveRam()
{ {
try try
{ {
using (var reader = new BinaryReader(new FileStream(PathManager.SaveRamPath(Global.Game), FileMode.Open, FileAccess.Read))) using (var reader = new BinaryReader(new FileStream(PathManager.SaveRamPath(Global.Game), FileMode.Open, FileAccess.Read)))
reader.Read(Global.Emulator.SaveRam, 0, Global.Emulator.SaveRam.Length); reader.Read(Global.Emulator.SaveRam, 0, Global.Emulator.SaveRam.Length);
} catch { } }
catch { }
} }
private void CloseGame() private void CloseGame()
{ {
if (Global.Emulator.SaveRamModified) if (Global.Emulator.SaveRamModified)
SaveRam(); SaveRam();
Global.Emulator.Dispose(); Global.Emulator.Dispose();
Global.Emulator = new NullEmulator(); Global.Emulator = new NullEmulator();
Global.ActiveController = Global.NullControls; Global.ActiveController = Global.NullControls;
Global.AutoFireController = Global.NESControls;
UserMovie.StopMovie(); UserMovie.StopMovie();
} }
private static void SaveRam() private static void SaveRam()
{ {
string path = PathManager.SaveRamPath(Global.Game); string path = PathManager.SaveRamPath(Global.Game);
var f = new FileInfo(path); var f = new FileInfo(path);
if (f.Directory.Exists == false) if (f.Directory.Exists == false)
f.Directory.Create(); f.Directory.Create();
var writer = new BinaryWriter(new FileStream(path, FileMode.Create, FileAccess.Write)); var writer = new BinaryWriter(new FileStream(path, FileMode.Create, FileAccess.Write));
int len = Util.SaveRamBytesUsed(Global.Emulator.SaveRam); int len = Util.SaveRamBytesUsed(Global.Emulator.SaveRam);
writer.Write(Global.Emulator.SaveRam, 0, len); writer.Write(Global.Emulator.SaveRam, 0, len);
writer.Close(); writer.Close();
} }
void OnSelectSlot(int num) void OnSelectSlot(int num)
{ {
SaveSlot = num; SaveSlot = num;
SaveSlotSelectedMessage(); SaveSlotSelectedMessage();
UpdateStatusSlots(); UpdateStatusSlots();
} }
/// <summary> /// <summary>
@ -1098,11 +1123,11 @@ namespace BizHawk.MultiClient
{ {
//the main form gets input //the main form gets input
if (Form.ActiveForm == this) return true; if (Form.ActiveForm == this) return true;
//modals that need to capture input for binding purposes get input, of course //modals that need to capture input for binding purposes get input, of course
if (Form.ActiveForm is InputConfig) return true; if (Form.ActiveForm is InputConfig) return true;
if (Form.ActiveForm is tools.HotkeyWindow) return true; if (Form.ActiveForm is tools.HotkeyWindow) return true;
//if no form is active on this process, then the background input setting applies //if no form is active on this process, then the background input setting applies
if (Form.ActiveForm == null && Global.Config.AcceptBackgroundInput) return true; if (Form.ActiveForm == null && Global.Config.AcceptBackgroundInput) return true;
@ -1112,11 +1137,11 @@ namespace BizHawk.MultiClient
public void ProcessInput() public void ProcessInput()
{ {
for(;;) for (; ; )
{ {
//loop through all available events //loop through all available events
var ie = Input.Instance.DequeueEvent(); var ie = Input.Instance.DequeueEvent();
if(ie == null) break; if (ie == null) break;
//useful debugging: //useful debugging:
//Console.WriteLine(ie); //Console.WriteLine(ie);
@ -1135,7 +1160,7 @@ namespace BizHawk.MultiClient
if (ie.LogicalButton.Alt && ie.LogicalButton.Button.Length == 1) if (ie.LogicalButton.Alt && ie.LogicalButton.Button.Length == 1)
{ {
char c = ie.LogicalButton.Button.ToLower()[0]; char c = ie.LogicalButton.Button.ToLower()[0];
if (c >= 'a' && c <= 'z' || c==' ') if (c >= 'a' && c <= 'z' || c == ' ')
{ {
SendAltKeyChar(c); SendAltKeyChar(c);
sys_hotkey = true; sys_hotkey = true;
@ -1148,7 +1173,7 @@ namespace BizHawk.MultiClient
} }
} }
//ordinarily, an alt release with nothing else would move focus to the menubar. but that is sort of useless, and hard to implement exactly right. //ordinarily, an alt release with nothing else would move focus to the menubar. but that is sort of useless, and hard to implement exactly right.
//no hotkeys or system keys bound this, so mutate it to an unmodified key and assign it for use as a game controller input //no hotkeys or system keys bound this, so mutate it to an unmodified key and assign it for use as a game controller input
//(we have a rule that says: modified events may be used for game controller inputs but not hotkeys) //(we have a rule that says: modified events may be used for game controller inputs but not hotkeys)
if (!sys_hotkey) if (!sys_hotkey)
@ -1175,7 +1200,7 @@ namespace BizHawk.MultiClient
{ {
Global.HotkeyCoalescer.Receive(ie); Global.HotkeyCoalescer.Receive(ie);
} }
} //foreach event } //foreach event
} }
@ -1197,7 +1222,7 @@ namespace BizHawk.MultiClient
case "ToolBox": case "ToolBox":
LoadToolBox(); LoadToolBox();
break; break;
case "Quick Save State": case "Quick Save State":
if (!IsNullEmulator()) if (!IsNullEmulator())
SaveState("QuickSave" + SaveSlot.ToString()); SaveState("QuickSave" + SaveSlot.ToString());
@ -1241,20 +1266,20 @@ namespace BizHawk.MultiClient
case "LoadSlot7": if (!IsNullEmulator()) LoadState("QuickSave7"); break; case "LoadSlot7": if (!IsNullEmulator()) LoadState("QuickSave7"); break;
case "LoadSlot8": if (!IsNullEmulator()) LoadState("QuickSave8"); break; case "LoadSlot8": if (!IsNullEmulator()) LoadState("QuickSave8"); break;
case "LoadSlot9": if (!IsNullEmulator()) LoadState("QuickSave9"); break; case "LoadSlot9": if (!IsNullEmulator()) LoadState("QuickSave9"); break;
case "SelectSlot0": case "SelectSlot0":
OnSelectSlot(0); OnSelectSlot(0);
break; break;
case "SelectSlot1": case "SelectSlot1":
OnSelectSlot(1); OnSelectSlot(1);
break; break;
case "SelectSlot2": case "SelectSlot2":
OnSelectSlot(2); OnSelectSlot(2);
break; break;
case "SelectSlot3": case "SelectSlot3":
OnSelectSlot(3); OnSelectSlot(3);
break; break;
case "SelectSlot4": case "SelectSlot4":
OnSelectSlot(4); OnSelectSlot(4);
break; break;
case "SelectSlot5": OnSelectSlot(5); break; case "SelectSlot5": OnSelectSlot(5); break;
case "SelectSlot6": OnSelectSlot(6); break; case "SelectSlot6": OnSelectSlot(6); break;
@ -1290,14 +1315,14 @@ namespace BizHawk.MultiClient
} }
case "Close ROM": CloseROM(); break; case "Close ROM": CloseROM(); break;
case "Display FPS": ToggleFPS(); break; case "Display FPS": ToggleFPS(); break;
case "Display FrameCounter": ToggleFrameCounter(); break; case "Display FrameCounter": ToggleFrameCounter(); break;
case "Display LagCounter": ToggleLagCounter(); break; case "Display LagCounter": ToggleLagCounter(); break;
case "Display Input": ToggleInputDisplay(); break; case "Display Input": ToggleInputDisplay(); break;
case "Toggle Read Only": ToggleReadOnly(); break; case "Toggle Read Only": ToggleReadOnly(); break;
case "Play Movie": case "Play Movie":
{ {
PlayMovie(); PlayMovie();
break; break;
@ -1323,7 +1348,7 @@ namespace BizHawk.MultiClient
Global.RenderPanel.MT = "Recording None"; Global.RenderPanel.MT = "Recording None";
} }
else else
Global.RenderPanel.AddMessage("MultiTrack Disabled"); Global.RenderPanel.AddMessage("MultiTrack Disabled");
Global.MovieSession.MultiTrack.RecordAll = false; Global.MovieSession.MultiTrack.RecordAll = false;
Global.MovieSession.MultiTrack.CurrentPlayer = 0; Global.MovieSession.MultiTrack.CurrentPlayer = 0;
break; break;
@ -1336,7 +1361,7 @@ namespace BizHawk.MultiClient
{ {
Global.MovieSession.MultiTrack.CurrentPlayer = 1; Global.MovieSession.MultiTrack.CurrentPlayer = 1;
} }
Global.RenderPanel.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer.ToString(); Global.RenderPanel.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer.ToString();
break; break;
} }
@ -1344,11 +1369,11 @@ namespace BizHawk.MultiClient
{ {
Global.MovieSession.MultiTrack.CurrentPlayer--; Global.MovieSession.MultiTrack.CurrentPlayer--;
Global.MovieSession.MultiTrack.RecordAll = false; Global.MovieSession.MultiTrack.RecordAll = false;
if (Global.MovieSession.MultiTrack.CurrentPlayer < 1) if (Global.MovieSession.MultiTrack.CurrentPlayer < 1)
{ {
Global.MovieSession.MultiTrack.CurrentPlayer = 5;//TODO: Replace with console's maximum or current maximum players??! Global.MovieSession.MultiTrack.CurrentPlayer = 5;//TODO: Replace with console's maximum or current maximum players??!
} }
Global.RenderPanel.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer.ToString(); Global.RenderPanel.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer.ToString();
break; break;
} }
case "Record All": case "Record All":
@ -1362,7 +1387,7 @@ namespace BizHawk.MultiClient
{ {
Global.MovieSession.MultiTrack.CurrentPlayer = 0; Global.MovieSession.MultiTrack.CurrentPlayer = 0;
Global.MovieSession.MultiTrack.RecordAll = false; Global.MovieSession.MultiTrack.RecordAll = false;
Global.RenderPanel.MT = "Recording None"; Global.RenderPanel.MT = "Recording None";
break; break;
} }
case "Emulator Pause": case "Emulator Pause":
@ -1384,7 +1409,7 @@ namespace BizHawk.MultiClient
throttle.Step(true, -1); throttle.Step(true, -1);
} }
void StepRunLoop_Core() void StepRunLoop_Core()
{ {
bool runFrame = false; bool runFrame = false;
@ -1494,7 +1519,7 @@ namespace BizHawk.MultiClient
{ {
session.LatchInputFromPlayer(Global.MovieInputSourceAdapter); session.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
} }
if (UserMovie.Mode == MOVIEMODE.PLAY) if (UserMovie.Mode == MOVIEMODE.PLAY)
{ {
if (UserMovie.Length() == Global.Emulator.Frame) if (UserMovie.Length() == Global.Emulator.Frame)
@ -1513,7 +1538,7 @@ namespace BizHawk.MultiClient
session.LatchInputFromLog(); session.LatchInputFromLog();
} }
} }
//TODO: adelikat: don't know what this should do so leaving it commented out //TODO: adelikat: don't know what this should do so leaving it commented out
//if (UserMovie.Mode == MOVIEMODE.RECORD && Global.MovieSession.MultiTrack.IsActive) //if (UserMovie.Mode == MOVIEMODE.RECORD && Global.MovieSession.MultiTrack.IsActive)
//{ //{
@ -1521,16 +1546,16 @@ namespace BizHawk.MultiClient
//} //}
//======================================= //=======================================
MemoryPulse.Pulse(); MemoryPulse.Pulse();
Global.Emulator.FrameAdvance(!throttle.skipnextframe); Global.Emulator.FrameAdvance(!throttle.skipnextframe);
MemoryPulse.Pulse(); MemoryPulse.Pulse();
//======================================= //=======================================
if (CurrAviWriter != null) if (CurrAviWriter != null)
{ {
//TODO - this will stray over time! have AviWriter keep an accumulation! //TODO - this will stray over time! have AviWriter keep an accumulation!
int samples = (int)(44100 / Global.Emulator.CoreOutputComm.VsyncRate); int samples = (int)(44100 / Global.Emulator.CoreOutputComm.VsyncRate);
short[] temp = new short[samples*2]; short[] temp = new short[samples * 2];
Global.Emulator.SoundProvider.GetSamples(temp); Global.Emulator.SoundProvider.GetSamples(temp);
genSound = false; genSound = false;
@ -1723,7 +1748,7 @@ namespace BizHawk.MultiClient
} }
} }
public void LoadRamSearch() public void LoadRamSearch()
{ {
if (!RamSearch1.IsHandleCreated || RamSearch1.IsDisposed) if (!RamSearch1.IsHandleCreated || RamSearch1.IsDisposed)
{ {
@ -1976,10 +2001,10 @@ namespace BizHawk.MultiClient
private void CloseROM() private void CloseROM()
{ {
CloseGame(); CloseGame();
Global.Emulator = new NullEmulator(); Global.Emulator = new NullEmulator();
Global.Game = new GameInfo(); Global.Game = new GameInfo();
MemoryPulse.Clear(); MemoryPulse.Clear();
RamSearch1.Restart(); RamSearch1.Restart();
RamWatch1.Restart(); RamWatch1.Restart();
HexEditor1.Restart(); HexEditor1.Restart();
@ -2178,7 +2203,7 @@ namespace BizHawk.MultiClient
if (result == DialogResult.Cancel) if (result == DialogResult.Cancel)
return; return;
//TODO - cores should be able to specify exact values for these instead of relying on this to calculate them //TODO - cores should be able to specify exact values for these instead of relying on this to calculate them
int fps = (int)(Global.Emulator.CoreOutputComm.VsyncRate * 0x01000000); int fps = (int)(Global.Emulator.CoreOutputComm.VsyncRate * 0x01000000);
AviWriter aw = new AviWriter(); AviWriter aw = new AviWriter();

View File

@ -23,9 +23,9 @@ namespace BizHawk.MultiClient
public static string[] GenesisControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "C", "Start", "X,T,0", "Y=", "Z" }; public static string[] GenesisControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "C", "Start", "X,T,0", "Y=", "Z" };
public static string[] NESControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "Select", "Start" }; public static string[] NESControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "Select", "Start" };
public static string[] TI83ControlList = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "ON", public static string[] TI83ControlList = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "ON",
"ENTER", "Up", "Down", "Left", "Right", "+", "-", "Multiply", "Divide", "CLEAR", "^", "-", "(", ")", "TAN", "VARS", "ENTER", "Up", "Down", "Left", "Right", "+", "-", "Multiply", "Divide", "CLEAR", "^", "-", "(", ")", "TAN", "VARS",
"COS", "PRGM", "STAT", "Matrix", "X", "STO->", "LN", "LOG", "^2", "^-1", "MATH", "ALPHA", "GRAPH", "TRACE", "ZOOM", "WINDOW", "COS", "PRGM", "STAT", "Matrix", "X", "STO->", "LN", "LOG", "^2", "^-1", "MATH", "ALPHA", "GRAPH", "TRACE", "ZOOM", "WINDOW",
"Y", "2nd", "MODE", "Del", ",", "SIN"}; //TODO: display shift / alpha names too, Also order these like on the calculator "Y", "2nd", "MODE", "Del", ",", "SIN"}; //TODO: display shift / alpha names too, Also order these like on the calculator
private ArrayList Labels; private ArrayList Labels;
private ArrayList TextBoxes; private ArrayList TextBoxes;
private string CurSelectConsole; private string CurSelectConsole;

View File

@ -93,6 +93,29 @@ namespace BizHawk.MultiClient
} }
} }
public class ORAdapter : IController
{
public bool IsPressed(string button) { return this[button]; }
public float GetFloat(string name) { return 0.0f; } //TODO
public void UpdateControls(int frame) { }
public bool Autofire { get { return false; } set { } } //TODO: sticky autofire buttons?
public IController Source;
public IController SourceOr;
public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } }
public bool this[string button]
{
get
{
bool source = Source[button] | SourceOr[button];
return source;
}
set { throw new InvalidOperationException(); }
}
}
public class StickyXORAdapter : IController public class StickyXORAdapter : IController
{ {
private HashSet<string> stickySet = new HashSet<string>(); private HashSet<string> stickySet = new HashSet<string>();