snes-make hex editor faster

This commit is contained in:
zeromus 2012-12-26 18:25:45 +00:00
parent 8a69a4ebe0
commit 0545cb64fa
2 changed files with 15 additions and 29 deletions

View File

@ -728,42 +728,26 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
{ {
int size = api.snes_get_memory_size(id); int size = api.snes_get_memory_size(id);
int mask = size - 1; int mask = size - 1;
byte* blockptr = api.snes_get_memory_data(id);
MemoryDomain md; MemoryDomain md;
////have to bitmask these somehow because it's unmanaged memory and we would hate to clobber things or make them nondeterministic if(id == LibsnesApi.SNES_MEMORY.OAM)
//if (Util.IsPowerOfTwo(size))
//{
// //can &mask for speed
// md = new MemoryDomain(name, size, endian,
// (addr) => blockptr[addr & mask],
// (addr, value) => blockptr[addr & mask] = value);
//}
//else
//{
// //have to use % (only OAM needs this, it seems)
// //(OAM is actually two differently sized banks of memory which arent truly considered adjacent. maybe a better way to visualize it would be with an empty bus and adjacent banks)
// md = new MemoryDomain(name, size, endian,
// (addr) => blockptr[addr % size],
// (addr, value) => blockptr[addr % size] = value);
//}
//EXTERNAL PROCESS CONVERSION: MUST MAKE THIS SAFE
//speed it up later
if (Util.IsPowerOfTwo(size))
{ {
//can &mask for speed //OAM is actually two differently sized banks of memory which arent truly considered adjacent.
//maybe a better way to visualize it is with an empty bus and adjacent banks
//so, we just throw away everything above its size of 544 bytes
if (size != 544) throw new InvalidOperationException("oam size isnt 544 bytes.. wtf?");
md = new MemoryDomain(name, size, endian, md = new MemoryDomain(name, size, endian,
(addr) => api.peek(id, (uint)(addr & mask)), (addr) => (addr < 544) ? blockptr[addr] : (byte)0x00,
(addr, value) => api.poke(id, (uint)(addr & mask), value)); (addr, value) => { if (addr < 544) blockptr[addr] = value; }
);
} }
else else
{
//have to use % (only OAM needs this, it seems)
//(OAM is actually two differently sized banks of memory which arent truly considered adjacent. maybe a better way to visualize it would be with an empty bus and adjacent banks)
md = new MemoryDomain(name, size, endian, md = new MemoryDomain(name, size, endian,
(addr) => api.peek(id, (uint)(addr % size)), (addr) => blockptr[addr & mask],
(addr, value) => api.poke(id, (uint)(addr % size), value)); (addr, value) => blockptr[addr & mask] = value);
}
MemoryDomains.Add(md); MemoryDomains.Add(md);

View File

@ -4,6 +4,8 @@ using System.Collections.Generic;
namespace BizHawk.DiscSystem namespace BizHawk.DiscSystem
{ {
//TBD CCD format //TBD CCD format
//check out ccd2iso linux program?
//https://wiki.archlinux.org/index.php/CD_Burning#TOC.2FCUE.2FBIN_for_mixed-mode_disks advice here
public class CCDFormat public class CCDFormat
{ {
} }