SystemInfo object - don't need endian type, Ram Search - remove bi ol system ID switch for defaults in favor of system info and more clever logic. Finish display name refactor

This commit is contained in:
adelikat 2014-05-31 23:05:02 +00:00
parent 23f356d47b
commit da1bc66c0e
4 changed files with 302 additions and 79 deletions

View File

@ -100,6 +100,48 @@ namespace BizHawk.Client.Common
return SystemInfo.Null;
case "NES":
return SystemInfo.Nes;
case "INTV":
return SystemInfo.Intellivision;
case "SG":
return SystemInfo.SG;
case "SMS":
return SystemInfo.SMS;
case "GG":
return SystemInfo.GG;
case "PCECD":
return SystemInfo.PCECD;
case "PCE":
return SystemInfo.PCE;
case "SGX":
return SystemInfo.SGX;
case "GEN":
return SystemInfo.Genesis;
case "TI83":
return SystemInfo.TI83;
case "SNES":
return SystemInfo.SNES;
case "GB":
return SystemInfo.GB;
case "GBC":
return SystemInfo.GBC;
case "A26":
return SystemInfo.Atari2600;
case "A78":
return SystemInfo.Atari7800;
case "C64":
return SystemInfo.C64;
case "Coleco":
return SystemInfo.Coleco;
case "GBA":
return SystemInfo.GBA;
case "N64":
return SystemInfo.N64;
case "SAT":
return SystemInfo.Saturn;
case "DGB":
return SystemInfo.DualGB;
case "WSWAN":
return SystemInfo.WonderSwan;
}
}
}

View File

@ -9,7 +9,6 @@ namespace BizHawk.Client.Common
public string DisplayName { get; set; }
public int ByteSize { get; set; } // For Ram tools, whether it is a 8/16/32 bit system
public MemoryDomain.Endian Endian { get; set; } //Big endian/little endian, etc
public static SystemInfo Null
{
@ -19,7 +18,6 @@ namespace BizHawk.Client.Common
{
DisplayName = "",
ByteSize = 1,
Endian = MemoryDomain.Endian.Little
};
}
}
@ -30,9 +28,260 @@ namespace BizHawk.Client.Common
{
return new SystemInfo
{
DisplayName = "Nintendo",
DisplayName = "NES",
ByteSize = 1,
};
}
}
public static SystemInfo Intellivision
{
get
{
return new SystemInfo
{
DisplayName = "Intellivision",
ByteSize = 2,
};
}
}
public static SystemInfo SMS
{
get
{
return new SystemInfo
{
DisplayName = "Sega Master System",
ByteSize = 1,
};
}
}
public static SystemInfo SG
{
get
{
return new SystemInfo
{
DisplayName = "SG-1000",
ByteSize = 1,
};
}
}
public static SystemInfo GG
{
get
{
return new SystemInfo
{
DisplayName = "Game Gear",
ByteSize = 1,
};
}
}
public static SystemInfo PCE
{
get
{
return new SystemInfo
{
DisplayName = "TurboGrafx-16",
ByteSize = 2,
};
}
}
public static SystemInfo PCECD
{
get
{
return new SystemInfo
{
DisplayName = "TurboGrafx-16 (CD)",
ByteSize = 2,
};
}
}
public static SystemInfo SGX
{
get
{
return new SystemInfo
{
DisplayName = "SuperGrafx",
ByteSize = 2,
};
}
}
public static SystemInfo Genesis
{
get
{
return new SystemInfo
{
DisplayName = "Genesis",
ByteSize = 2,
};
}
}
public static SystemInfo TI83
{
get
{
return new SystemInfo
{
DisplayName = "TI-83",
ByteSize = 1,
};
}
}
public static SystemInfo SNES
{
get
{
return new SystemInfo
{
DisplayName = "SNES",
ByteSize = 2,
};
}
}
public static SystemInfo GB
{
get
{
return new SystemInfo
{
DisplayName = "Gameboy",
ByteSize = 1,
};
}
}
public static SystemInfo GBC
{
get
{
return new SystemInfo
{
DisplayName = "Gameboy Color",
ByteSize = 1,
};
}
}
public static SystemInfo Atari2600
{
get
{
return new SystemInfo
{
DisplayName = "Atari 2600",
ByteSize = 1,
};
}
}
public static SystemInfo Atari7800
{
get
{
return new SystemInfo
{
DisplayName = "Atari 7800",
ByteSize = 1,
};
}
}
public static SystemInfo C64
{
get
{
return new SystemInfo
{
DisplayName = "Commodore 64",
ByteSize = 1,
};
}
}
public static SystemInfo Coleco
{
get
{
return new SystemInfo
{
DisplayName = "ColecoVision",
ByteSize = 1,
};
}
}
public static SystemInfo GBA
{
get
{
return new SystemInfo
{
DisplayName = "Gameboy Advance",
ByteSize = 4,
};
}
}
public static SystemInfo N64
{
get
{
return new SystemInfo
{
DisplayName = "Nintendo 64",
ByteSize = 4,
};
}
}
public static SystemInfo Saturn
{
get
{
return new SystemInfo
{
DisplayName = "Saturn",
ByteSize = 4,
};
}
}
public static SystemInfo DualGB
{
get
{
return new SystemInfo
{
DisplayName = "Game Boy Link",
ByteSize = 1,
};
}
}
public static SystemInfo WonderSwan
{
get
{
return new SystemInfo
{
DisplayName = "WonderSwan",
ByteSize = 1,
Endian = MemoryDomain.Endian.Big
};
}
}

View File

@ -1158,54 +1158,12 @@ namespace BizHawk.Client.Common
public Settings()
{
switch (Global.Emulator.SystemId)
{
case "N64":
Mode = SearchMode.Fast;
Size = Watch.WatchSize.DWord;
Type = Watch.DisplayType.Unsigned;
BigEndian = true;
break;
case "GBA":
Mode = SearchMode.Detailed;
Size = Watch.WatchSize.DWord;
Type = Watch.DisplayType.Unsigned;
BigEndian = false;
break;
case "GEN":
Mode = SearchMode.Detailed;
Size = Watch.WatchSize.Word;
Type = Watch.DisplayType.Unsigned;
BigEndian = true;
break;
case "SNES":
Mode = SearchMode.Detailed;
Size = Watch.WatchSize.Byte;
Type = Watch.DisplayType.Unsigned;
BigEndian = false;
break;
case "SAT":
Mode = SearchMode.Fast;
Size = Watch.WatchSize.DWord;
Type = Watch.DisplayType.Unsigned;
BigEndian = true;
break;
default:
case "NES":
case "A26":
case "A78":
case "TI83":
case "SMS":
case "GG":
case "SG":
case "Coleco":
case "C64":
Mode = SearchMode.Detailed;
Size = Watch.WatchSize.Byte;
Type = Watch.DisplayType.Unsigned;
BigEndian = false;
break;
}
BigEndian = Global.Emulator.MemoryDomains.MainMemory.EndianType == MemoryDomain.Endian.Big;
Size = (Watch.WatchSize)Global.SystemInfo.ByteSize;
Type = Watch.DisplayType.Unsigned;
Mode = Global.Emulator.MemoryDomains.MainMemory.Size > (1024 * 1024) ?
SearchMode.Fast :
SearchMode.Detailed;
Domain = Global.Emulator.MemoryDomains.MainMemory;
CheckMisAligned = false;

View File

@ -1393,33 +1393,7 @@ namespace BizHawk.Client.EmuHawk
private static string DisplayNameForSystem(string system)
{
var str = Global.SystemInfo.DisplayName;
/*
switch (Global.SystemInfo.DisplayName)
{
case "INTV": str = "Intellivision"; break;
case "SG": str = "SG-1000"; break;
case "SMS": str = "Sega Master System"; break;
case "GG": str = "Game Gear"; break;
case "PCECD": str = "TurboGrafx-16 (CD)"; break;
case "PCE": str = "TurboGrafx-16"; break;
case "SGX": str = "SuperGrafx"; break;
case "GEN": str = "Genesis"; break;
case "TI83": str = "TI-83"; break;
case "NES": str = "NES"; break;
case "SNES": str = "SNES"; break;
case "GB": str = "Game Boy"; break;
case "GBC": str = "Game Boy Color"; break;
case "A26": str = "Atari 2600"; break;
case "A78": str = "Atari 7800"; break;
case "C64": str = "Commodore 64"; break;
case "Coleco": str = "ColecoVision"; break;
case "GBA": str = "Game Boy Advance"; break;
case "N64": str = "Nintendo 64"; break;
case "SAT": str = "Saturn"; break;
case "DGB": str = "Game Boy Link"; break;
case "WSWAN": str = "WonderSwan"; break;
}
*/
if (VersionInfo.INTERIM)
{
str += " (interim)";