Пример #1
0
        public void StoreSaveRam(byte[] data)
        {
            if (data.Take(8).SequenceEqual(Encoding.ASCII.GetBytes("GBABATT\0")))
            {
                data = LegacyFix(data);
            }

            int len = LibmGBA.BizGetSaveRamSize(core);

            if (len > data.Length)
            {
                byte[] _tmp = new byte[len];
                Array.Copy(data, _tmp, data.Length);
                for (int i = data.Length; i < len; i++)
                {
                    _tmp[i] = 0xff;
                }
                data = _tmp;
            }
            else if (len < data.Length)
            {
                // we could continue from this, but we don't expect it
                throw new InvalidOperationException("Saveram will be truncated!");
            }
            LibmGBA.BizPutSaveRam(core, data);
        }
Пример #2
0
 public byte[] CloneSaveRam()
 {
     byte[] ret = new byte[LibmGBA.BizGetSaveRamSize(core)];
     if (ret.Length > 0)
     {
         LibmGBA.BizGetSaveRam(core, ret);
         return(ret);
     }
     else
     {
         return(null);
     }
 }