saveram stuff

This commit is contained in:
goyuken 2014-06-02 16:33:08 +00:00
parent f72b13bed3
commit 239eb5b268
7 changed files with 31 additions and 4 deletions

View File

@ -108,7 +108,7 @@ namespace BizHawk.Client.Common
// If Starting a new recording requires clearing sram it shoudl be done at a higher layer and not rely on all IMovies doing this
// Haven't removed it yet because I coudln't guarantee that power-on movies coudl live without it
// And the immediate fire is that Savestate movies are breaking
if (!Header.StartsFromSavestate && Global.Emulator.SystemId != "WSWAN")
if (!Header.StartsFromSavestate) // && Global.Emulator.SystemId != "WSWAN")
{
Global.Emulator.ClearSaveRam();
}
@ -126,7 +126,7 @@ namespace BizHawk.Client.Common
public void StartNewPlayback()
{
// See StartNewRecording for details as to why this savestate check is here
if (!Header.StartsFromSavestate && Global.Emulator.SystemId != "WSWAN")
if (!Header.StartsFromSavestate) // && Global.Emulator.SystemId != "WSWAN")
{
Global.Emulator.ClearSaveRam();
}

View File

@ -191,7 +191,7 @@ namespace BizHawk.Client.Common
public void StartNewPlayback()
{
_mode = Moviemode.Play;
Global.Emulator.ClearSaveRam();
Global.Emulator.ClearSaveRam(); // should this exist??
}
public void Stop(bool saveChanges = true)

View File

@ -86,6 +86,14 @@ namespace BizHawk.Emulation.Cores.WonderSwan
[DllImport(dd, CallingConvention = cc)]
public static extern bool bizswan_saveramsave(IntPtr core, byte[] data, int maxsize);
/// <summary>
/// bad function
/// </summary>
/// <param name="core"></param>
/// <param name="settings">pass EXACTLY the same syncsettings you originally passed on core load, else DRAGONS</param>
[DllImport(dd, CallingConvention = cc)]
public static extern void bizswan_saveramclearhacky(IntPtr core, [In] ref SyncSettings settings);
/// <summary>
/// put non-sync settings, can be done at any time
/// </summary>

View File

@ -64,6 +64,9 @@ namespace BizHawk.Emulation.Cores.WonderSwan
if (!BizSwan.bizswan_load(Core, rom, rom.Length, ref ss, ref rotate))
throw new InvalidOperationException("bizswan_load() returned FALSE!");
// for future uses of ClearSaveRam(), it's important that we save this
_DONTTOUCHME = ss;
CoreComm.VsyncNum = 3072000; // master CPU clock, also pixel clock
CoreComm.VsyncDen = (144 + 15) * (224 + 32); // 144 vislines, 15 vblank lines; 224 vispixels, 32 hblank pixels
@ -149,7 +152,8 @@ namespace BizHawk.Emulation.Cores.WonderSwan
public void ClearSaveRam()
{
throw new InvalidOperationException("A new core starts with a clear saveram. Instantiate a new core if you want this.");
BizSwan.bizswan_saveramclearhacky(Core, ref _DONTTOUCHME);
//throw new InvalidOperationException("A new core starts with a clear saveram. Instantiate a new core if you want this.");
}
public bool SaveRamModified
@ -307,6 +311,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
Settings _Settings;
SyncSettings _SyncSettings;
BizSwan.SyncSettings _DONTTOUCHME;
public class Settings
{

Binary file not shown.

View File

@ -308,6 +308,13 @@ namespace MDFN_IEN_WSWAN
NSS(rotate);
}
void System::SaveRamClearHacky(const SyncSettings &s)
{
// this really shouldn't be done
// be sure to pass the same SyncSettings that the core was originally initialized with!
memory.Init(s);
}
EXPORT System *bizswan_new()
{
return new System();
@ -397,4 +404,9 @@ namespace MDFN_IEN_WSWAN
NewStateExternalFunctions loader(ff);
s->SyncState<true>(&loader);
}
EXPORT void bizswan_saveramclearhacky(System *s, const SyncSettings *settings)
{
s->SaveRamClearHacky(*settings);
}
}

View File

@ -45,6 +45,8 @@ public:
bool GetMemoryArea(int index, const char *&name, int &size, uint8 *&data);
void SaveRamClearHacky(const SyncSettings &s);
public:
GFX gfx;
Memory memory;