Fix TI83 screenshots. Fix screenshot naming code to use the filesystemsafe name, fix bug in screenshotas function

This commit is contained in:
andres.delikat 2011-07-10 01:55:37 +00:00
parent f89070f6ad
commit de1a3fdc50
4 changed files with 291 additions and 278 deletions

View File

@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
if (addr < 0x4000) if (addr < 0x4000)
return rom[addr]; //ROM zero-page return rom[addr]; //ROM zero-page
else if (addr < 0x8000) else if (addr < 0x8000)
return rom[romPage*0x4000+addr-0x4000]; //other rom page return rom[romPage * 0x4000 + addr - 0x4000]; //other rom page
else return ram[addr - 0x8000]; else return ram[addr - 0x8000];
} }
@ -83,7 +83,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
switch (addr) switch (addr)
{ {
case 0: //PORT_LINK case 0: //PORT_LINK
return (byte)((romPageHighBit << 4) | (m_LinkState<<2) | m_LinkOutput); return (byte)((romPageHighBit << 4) | (m_LinkState << 2) | m_LinkOutput);
case 1: //PORT_KEYBOARD: case 1: //PORT_KEYBOARD:
//Console.WriteLine("read PORT_KEYBOARD"); //Console.WriteLine("read PORT_KEYBOARD");
return ReadKeyboard(); return ReadKeyboard();
@ -347,21 +347,23 @@ namespace BizHawk.Emulation.Consoles.Calculator
this.emu = emu; this.emu = emu;
} }
public int[] GetVideoBuffer() { public int[] GetVideoBuffer()
{
//unflatten bit buffer //unflatten bit buffer
int[] pixels = new int[96*64]; int[] pixels = new int[96 * 64];
int i=0; int i = 0;
for(int y=0;y<64;y++) for (int y = 0; y < 64; y++)
for (int x = 0; x < 96; x++) for (int x = 0; x < 96; x++)
{ {
int offset = y * 96 + x; int offset = y * 96 + x;
int bufbyte = offset >> 3; int bufbyte = offset >> 3;
int bufbit = offset & 7; int bufbit = offset & 7;
int bit = ((emu.vram[bufbyte] >> (7 - bufbit)) & 1); int bit = ((emu.vram[bufbyte] >> (7 - bufbit)) & 1);
if(bit==0) if (bit == 0)
pixels[i++] = 0xFFFFFF; unchecked { pixels[i++] = (int)0xFFFFFFFF; }
else else
pixels[i++] = 0; pixels[i++] = 0;
} }
return pixels; return pixels;
} }
@ -369,7 +371,8 @@ namespace BizHawk.Emulation.Consoles.Calculator
public int BufferHeight { get { return 64; } } public int BufferHeight { get { return 64; } }
public int BackgroundColor { get { return 0; } } public int BackgroundColor { get { return 0; } }
} }
public IVideoProvider VideoProvider { get { return new MyVideoProvider(this); } } public IVideoProvider VideoProvider {
get { return new MyVideoProvider(this); } }
public ISoundProvider SoundProvider { get { return NullSound.SilenceProvider; } } public ISoundProvider SoundProvider { get { return NullSound.SilenceProvider; } }
@ -441,7 +444,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
{ {
cpu.Reset(); cpu.Reset();
ram = new byte[0x8000]; ram = new byte[0x8000];
for(int i=0;i<0x8000;i++) for (int i = 0; i < 0x8000; i++)
ram[i] = 0xFF; ram[i] = 0xFF;
cpu.RegisterPC = startPC; cpu.RegisterPC = startPC;
@ -462,7 +465,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
private int _lagcount = 0; private int _lagcount = 0;
private bool lagged = true; private bool lagged = true;
private bool islag = false; private bool islag = false;
public int Frame {get; set;} public int Frame { get; set; }
public int LagCount { get { return _lagcount; } set { _lagcount = value; } } public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
public bool IsLagFrame { get { return islag; } } public bool IsLagFrame { get { return islag; } }
@ -482,7 +485,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
cpu.SaveStateText(writer); cpu.SaveStateText(writer);
writer.Write("RAM "); writer.Write("RAM ");
ram.SaveAsHex(writer); ram.SaveAsHex(writer);
writer.WriteLine ("romPageLow3Bits {0}", romPageLow3Bits); writer.WriteLine("romPageLow3Bits {0}", romPageLow3Bits);
writer.WriteLine("romPageHighBit {0}", romPageHighBit); writer.WriteLine("romPageHighBit {0}", romPageHighBit);
writer.WriteLine("disp_mode {0}", disp_mode); writer.WriteLine("disp_mode {0}", disp_mode);
writer.WriteLine("disp_move {0}", disp_move); writer.WriteLine("disp_move {0}", disp_move);

View File

@ -670,8 +670,6 @@ namespace BizHawk.MultiClient
if (result != DialogResult.OK) if (result != DialogResult.OK)
return; return;
MakeScreenshot(sfd.FileName); MakeScreenshot(sfd.FileName);
MakeScreenshot(path);
} }
private void runInBackgroundToolStripMenuItem_Click(object sender, EventArgs e) private void runInBackgroundToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -1352,7 +1352,18 @@ namespace BizHawk.MultiClient
var framebuf = video.GetVideoBuffer(); var framebuf = video.GetVideoBuffer();
for (int y = 0; y < video.BufferHeight; y++) for (int y = 0; y < video.BufferHeight; y++)
for (int x = 0; x < video.BufferWidth; x++) for (int x = 0; x < video.BufferWidth; x++)
image.SetPixel(x, y, Color.FromArgb(framebuf[(y * video.BufferWidth) + x])); {
int col = framebuf[(y * video.BufferWidth) + x];
if (Global.Emulator is TI83)
{
if (col == 0)
col = Color.Black.ToArgb();
else
col = Color.White.ToArgb();
}
image.SetPixel(x, y, Color.FromArgb(col));
}
var f = new FileInfo(path); var f = new FileInfo(path);
if (f.Directory.Exists == false) if (f.Directory.Exists == false)

View File

@ -16,7 +16,7 @@ namespace BizHawk.MultiClient
private List<string> options; private List<string> options;
private const int BankSize = 4096; private const int BankSize = 4096;
public RomGame(HawkFile file) : this(file, null){} public RomGame(HawkFile file) : this(file, null) { }
public RomGame(HawkFile file, string patch) public RomGame(HawkFile file, string patch)
{ {
@ -53,7 +53,7 @@ namespace BizHawk.MultiClient
using (var patchFile = new HawkFile(patch)) using (var patchFile = new HawkFile(patch))
{ {
patchFile.BindFirstOf("IPS"); patchFile.BindFirstOf("IPS");
if(patchFile.IsBound) if (patchFile.IsBound)
IPS.Patch(RomData, patchFile.GetStream()); IPS.Patch(RomData, patchFile.GetStream());
} }
} }
@ -103,7 +103,8 @@ namespace BizHawk.MultiClient
} }
} }
} }
} catch (Exception) { } // No need for errors in patching to propagate. }
catch (Exception) { } // No need for errors in patching to propagate.
} }
public byte[] GetRomData() { return RomData; } public byte[] GetRomData() { return RomData; }
@ -141,14 +142,14 @@ namespace BizHawk.MultiClient
Bind += " - " + Path.GetFileNameWithoutExtension(Global.MainForm.UserMovie.GetFilePath()); Bind += " - " + Path.GetFileNameWithoutExtension(Global.MainForm.UserMovie.GetFilePath());
switch (System) switch (System)
{ {
case "SMS": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS") ,filesystemSafeName + Bind); case "SMS": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), filesystemSafeName + Bind);
case "GG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGGSavestates, "GG") ,filesystemSafeName + Bind); case "GG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGGSavestates, "GG"), filesystemSafeName + Bind);
case "SG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSGSavestates, "SG") ,filesystemSafeName + Bind); case "SG": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"), filesystemSafeName + Bind);
case "PCE": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE") ,filesystemSafeName + Bind); case "PCE": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), filesystemSafeName + Bind);
case "SGX": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE") ,filesystemSafeName + Bind); case "SGX": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), filesystemSafeName + Bind);
case "GB": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGBSavestates, "GB") ,filesystemSafeName + Bind); case "GB": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"), filesystemSafeName + Bind);
case "GEN": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN") ,filesystemSafeName + Bind); case "GEN": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"), filesystemSafeName + Bind);
case "NES": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathNESSavestates, "NES") ,filesystemSafeName + Bind); case "NES": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), filesystemSafeName + Bind);
case "TI83": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), filesystemSafeName + Bind); case "TI83": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathTI83Savestates, "TI83"), filesystemSafeName + Bind);
default: return ""; default: return "";
} }
@ -183,15 +184,15 @@ namespace BizHawk.MultiClient
{ {
switch (System) switch (System)
{ {
case "SMS": return PathManager.MakeAbsolutePath(Global.Config.PathSMSScreenshots, "SMS") + "/" + Name; case "SMS": return PathManager.MakeAbsolutePath(Global.Config.PathSMSScreenshots, "SMS") + "/" + filesystemSafeName;
case "GG": return PathManager.MakeAbsolutePath(Global.Config.PathGGScreenshots, "GG") + "/" + Name; case "GG": return PathManager.MakeAbsolutePath(Global.Config.PathGGScreenshots, "GG") + "/" + filesystemSafeName;
case "SG": return PathManager.MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG") + "/" + Name; case "SG": return PathManager.MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG") + "/" + filesystemSafeName;
case "PCE": return PathManager.MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE") + "/" + Name; case "PCE": return PathManager.MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE") + "/" + filesystemSafeName;
case "SGX": return PathManager.MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE") + "/" + Name; case "SGX": return PathManager.MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE") + "/" + filesystemSafeName;
case "GB": return PathManager.MakeAbsolutePath(Global.Config.PathGBScreenshots, "GB") + "/" + Name; case "GB": return PathManager.MakeAbsolutePath(Global.Config.PathGBScreenshots, "GB") + "/" + filesystemSafeName;
case "GEN": return PathManager.MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN") + "/" + Name; case "GEN": return PathManager.MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN") + "/" + filesystemSafeName;
case "NES": return PathManager.MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES") + "/" + Name; case "NES": return PathManager.MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES") + "/" + filesystemSafeName;
case "TI83": return PathManager.MakeAbsolutePath(Global.Config.PathTI83Screenshots, "TI83") + "/" + Name; case "TI83": return PathManager.MakeAbsolutePath(Global.Config.PathTI83Screenshots, "TI83") + "/" + filesystemSafeName;
default: return ""; default: return "";
} }
} }