bizswan: settings and syncsettings, random cleanup, include mingw makefile (we're building from msvs here though)
This commit is contained in:
parent
5ce23c815d
commit
fb4bd18fe1
|
@ -415,7 +415,8 @@ namespace BizHawk.Client.Common
|
||||||
nextEmulator = new N64(nextComm, game, rom.RomData, GetCoreSyncSettings<N64>());
|
nextEmulator = new N64(nextComm, game, rom.RomData, GetCoreSyncSettings<N64>());
|
||||||
break;
|
break;
|
||||||
case "WSWAN":
|
case "WSWAN":
|
||||||
nextEmulator = new WonderSwan(nextComm, rom.RomData, Deterministic);
|
nextEmulator = new WonderSwan(nextComm, rom.RomData, Deterministic,
|
||||||
|
GetCoreSettings<WonderSwan>(), GetCoreSyncSettings<WonderSwan>());
|
||||||
break;
|
break;
|
||||||
case "DEBUG":
|
case "DEBUG":
|
||||||
if (VersionInfo.INTERIM)
|
if (VersionInfo.INTERIM)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1318,6 +1318,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
SaturnSubMenu.Visible = false;
|
SaturnSubMenu.Visible = false;
|
||||||
DGBSubMenu.Visible = false;
|
DGBSubMenu.Visible = false;
|
||||||
GenesisSubMenu.Visible = false;
|
GenesisSubMenu.Visible = false;
|
||||||
|
wonderSwanToolStripMenuItem.Visible = false;
|
||||||
|
|
||||||
switch (system)
|
switch (system)
|
||||||
{
|
{
|
||||||
|
@ -1381,6 +1382,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
case "DGB":
|
case "DGB":
|
||||||
DGBSubMenu.Visible = true;
|
DGBSubMenu.Visible = true;
|
||||||
break;
|
break;
|
||||||
|
case "WSWAN":
|
||||||
|
wonderSwanToolStripMenuItem.Visible = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3234,5 +3238,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
BizHawk.Client.EmuHawk.config.GB.GBPrefs.DoGBPrefsDialog(this);
|
BizHawk.Client.EmuHawk.config.GB.GBPrefs.DoGBPrefsDialog(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
GenericCoreConfig.DoDialog(this, "WonderSwan Settings");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,15 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
[DllImport(dd, CallingConvention = cc)]
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
public static extern bool bizswan_saveramsave(IntPtr core, byte[] data, int maxsize);
|
public static extern bool bizswan_saveramsave(IntPtr core, byte[] data, int maxsize);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// put non-sync settings, can be done at any time
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="core"></param>
|
||||||
|
/// <param name="settings"></param>
|
||||||
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
|
public static extern void bizswan_putsettings(IntPtr core, [In] ref Settings settings);
|
||||||
|
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Buttons : ushort
|
public enum Buttons : ushort
|
||||||
{
|
{
|
||||||
|
@ -101,13 +110,13 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
B = 0x0400,
|
B = 0x0400,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Language : byte
|
public enum Language : uint
|
||||||
{
|
{
|
||||||
Japanese = 0,
|
Japanese = 0,
|
||||||
English = 1
|
English = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Bloodtype : byte
|
public enum Bloodtype : uint
|
||||||
{
|
{
|
||||||
A = 1,
|
A = 1,
|
||||||
B = 2,
|
B = 2,
|
||||||
|
@ -115,7 +124,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
AB = 4
|
AB = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Gender : byte
|
public enum Gender : uint
|
||||||
{
|
{
|
||||||
Male = 1,
|
Male = 1,
|
||||||
Female = 2
|
Female = 2
|
||||||
|
@ -124,19 +133,23 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||||
public struct SyncSettings
|
public struct SyncSettings
|
||||||
{
|
{
|
||||||
public ushort byear;
|
public ulong initialtime; // inital time in unix format; only used when userealtime = false
|
||||||
public byte bmonth;
|
|
||||||
public byte bday;
|
public uint byear;
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
|
public uint bmonth;
|
||||||
public byte[] name;
|
public uint bday;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.Bool)]
|
||||||
|
public bool color; // true for color system
|
||||||
|
[MarshalAs(UnmanagedType.Bool)]
|
||||||
|
public bool userealtime; // true for use real real RTC instead of emulation pegged time
|
||||||
|
|
||||||
public Language language;
|
public Language language;
|
||||||
public Gender sex;
|
public Gender sex;
|
||||||
public Bloodtype blood;
|
public Bloodtype blood;
|
||||||
[MarshalAs(UnmanagedType.U1)]
|
|
||||||
public bool color; // true for color system
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
|
||||||
[MarshalAs(UnmanagedType.U1)]
|
public byte[] name;
|
||||||
public bool userealtime; // true for use real real RTC instead of emulation pegged time
|
|
||||||
public ulong initialtime; // inital time in unix format; only used when userealtime = false
|
|
||||||
|
|
||||||
public void SetName(string newname)
|
public void SetName(string newname)
|
||||||
{
|
{
|
||||||
|
@ -145,5 +158,19 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
Buffer.BlockCopy(data, 0, name, 0, Math.Min(data.Length, name.Length));
|
Buffer.BlockCopy(data, 0, name, 0, Math.Min(data.Length, name.Length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum LayerFlags : uint
|
||||||
|
{
|
||||||
|
BG = 1,
|
||||||
|
FG = 2,
|
||||||
|
Sprite = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||||
|
public struct Settings
|
||||||
|
{
|
||||||
|
public LayerFlags LayerMask; // 1 = show
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ using System.Text;
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.WonderSwan
|
namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
{
|
{
|
||||||
|
@ -40,25 +42,19 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public WonderSwan(CoreComm comm, byte[] rom, bool deterministicEmulation)
|
public WonderSwan(CoreComm comm, byte[] rom, bool deterministicEmulation, object Settings, object SyncSettings)
|
||||||
{
|
{
|
||||||
this.CoreComm = comm;
|
CoreComm = comm;
|
||||||
|
_Settings = (Settings)Settings ?? new Settings();
|
||||||
|
_SyncSettings = (SyncSettings)SyncSettings ?? new SyncSettings();
|
||||||
|
|
||||||
DeterministicEmulation = deterministicEmulation; // when true, remember to force the RTC flag!
|
DeterministicEmulation = deterministicEmulation; // when true, remember to force the RTC flag!
|
||||||
Core = BizSwan.bizswan_new();
|
Core = BizSwan.bizswan_new();
|
||||||
if (Core == IntPtr.Zero)
|
if (Core == IntPtr.Zero)
|
||||||
throw new InvalidOperationException("bizswan_new() returned NULL!");
|
throw new InvalidOperationException("bizswan_new() returned NULL!");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var ss = new BizSwan.SyncSettings
|
var ss = _SyncSettings.GetNativeSettings();
|
||||||
{
|
|
||||||
sex = BizSwan.Gender.Male,
|
|
||||||
blood = BizSwan.Bloodtype.A,
|
|
||||||
language = BizSwan.Language.Japanese,
|
|
||||||
bday = 5,
|
|
||||||
bmonth = 12,
|
|
||||||
byear = 1968
|
|
||||||
};
|
|
||||||
ss.SetName("LaForge");
|
|
||||||
|
|
||||||
bool rotate = false;
|
bool rotate = false;
|
||||||
|
|
||||||
|
@ -71,6 +67,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
saverambuff = new byte[BizSwan.bizswan_saveramsize(Core)];
|
saverambuff = new byte[BizSwan.bizswan_saveramsize(Core)];
|
||||||
|
|
||||||
InitVideo(rotate);
|
InitVideo(rotate);
|
||||||
|
PutSettings(_Settings);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -202,24 +199,133 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
|
|
||||||
#region Settings
|
#region Settings
|
||||||
|
|
||||||
|
Settings _Settings;
|
||||||
|
SyncSettings _SyncSettings;
|
||||||
|
|
||||||
|
public class Settings
|
||||||
|
{
|
||||||
|
[Description("True to display the selected layer.")]
|
||||||
|
[DefaultValue(true)]
|
||||||
|
public bool EnableBG { get; set; }
|
||||||
|
[Description("True to display the selected layer.")]
|
||||||
|
[DefaultValue(true)]
|
||||||
|
public bool EnableFG { get; set; }
|
||||||
|
[Description("True to display the selected layer.")]
|
||||||
|
[DefaultValue(true)]
|
||||||
|
public bool EnableSprites { get; set; }
|
||||||
|
|
||||||
|
public BizSwan.Settings GetNativeSettings()
|
||||||
|
{
|
||||||
|
var ret = new BizSwan.Settings();
|
||||||
|
if (EnableBG) ret.LayerMask |= BizSwan.LayerFlags.BG;
|
||||||
|
if (EnableFG) ret.LayerMask |= BizSwan.LayerFlags.FG;
|
||||||
|
if (EnableSprites) ret.LayerMask |= BizSwan.LayerFlags.Sprite;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Settings()
|
||||||
|
{
|
||||||
|
SettingsUtil.SetDefaultValues(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Settings Clone()
|
||||||
|
{
|
||||||
|
return (Settings)MemberwiseClone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SyncSettings
|
||||||
|
{
|
||||||
|
[Description("Initial time of emulation. Only relevant when UseRealTime is false.")]
|
||||||
|
[DefaultValue(typeof(DateTime), "2010-01-01")]
|
||||||
|
public DateTime InitialTime { get; set; }
|
||||||
|
|
||||||
|
[Description("Your birthdate. Stored in EEPROM and used by some games.")]
|
||||||
|
[DefaultValue(typeof(DateTime), "1968-05-13")]
|
||||||
|
public DateTime BirthDate { get; set; }
|
||||||
|
|
||||||
|
[Description("True to emulate a color system.")]
|
||||||
|
[DefaultValue(true)]
|
||||||
|
public bool Color { get; set; }
|
||||||
|
|
||||||
|
[Description("If true, RTC clock will be based off of real time instead of emulated time. Ignored (set to false) when recording a movie.")]
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool UseRealTime { get; set; }
|
||||||
|
|
||||||
|
[Description("Your gender. Stored in EEPROM and used by some games.")]
|
||||||
|
[DefaultValue(BizSwan.Gender.Female)]
|
||||||
|
public BizSwan.Gender Gender { get; set; }
|
||||||
|
|
||||||
|
[Description("Language to play games in. Most games ignore this.")]
|
||||||
|
[DefaultValue(BizSwan.Language.Japanese)]
|
||||||
|
public BizSwan.Language Language { get; set; }
|
||||||
|
|
||||||
|
[Description("Your blood type. Stored in EEPROM and used by some games.")]
|
||||||
|
[DefaultValue(BizSwan.Bloodtype.AB)]
|
||||||
|
public BizSwan.Bloodtype BloodType { get; set; }
|
||||||
|
|
||||||
|
[Description("Your name. Stored in EEPROM and used by some games. Maximum of 16 characters")]
|
||||||
|
[DefaultValue("Lady Ashelia")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public BizSwan.SyncSettings GetNativeSettings()
|
||||||
|
{
|
||||||
|
var ret = new BizSwan.SyncSettings
|
||||||
|
{
|
||||||
|
color = Color,
|
||||||
|
userealtime = UseRealTime,
|
||||||
|
sex = Gender,
|
||||||
|
language = Language,
|
||||||
|
blood = BloodType
|
||||||
|
};
|
||||||
|
ret.SetName(Name);
|
||||||
|
ret.bday = (uint)BirthDate.Day;
|
||||||
|
ret.bmonth = (uint)BirthDate.Month;
|
||||||
|
ret.byear = (uint)BirthDate.Year;
|
||||||
|
ret.initialtime = (ulong)((InitialTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SyncSettings()
|
||||||
|
{
|
||||||
|
SettingsUtil.SetDefaultValues(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SyncSettings Clone()
|
||||||
|
{
|
||||||
|
return (SyncSettings)MemberwiseClone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool NeedsReboot(SyncSettings x, SyncSettings y)
|
||||||
|
{
|
||||||
|
return x != y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public object GetSettings()
|
public object GetSettings()
|
||||||
{
|
{
|
||||||
return null;
|
return _Settings.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public object GetSyncSettings()
|
public object GetSyncSettings()
|
||||||
{
|
{
|
||||||
return null;
|
return _SyncSettings.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PutSettings(object o)
|
public bool PutSettings(object o)
|
||||||
{
|
{
|
||||||
|
_Settings = (Settings)o;
|
||||||
|
var native = _Settings.GetNativeSettings();
|
||||||
|
BizSwan.bizswan_putsettings(Core, ref native);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PutSyncSettings(object o)
|
public bool PutSyncSettings(object o)
|
||||||
{
|
{
|
||||||
return false;
|
var newsettings = (SyncSettings)o;
|
||||||
|
bool ret = SyncSettings.NeedsReboot(newsettings, _SyncSettings);
|
||||||
|
_SyncSettings = newsettings;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Binary file not shown.
|
@ -87,7 +87,6 @@
|
||||||
<ClInclude Include="..\eeprom.h" />
|
<ClInclude Include="..\eeprom.h" />
|
||||||
<ClInclude Include="..\gfx.h" />
|
<ClInclude Include="..\gfx.h" />
|
||||||
<ClInclude Include="..\interrupt.h" />
|
<ClInclude Include="..\interrupt.h" />
|
||||||
<ClInclude Include="..\mednafen\state.h" />
|
|
||||||
<ClInclude Include="..\mednafen\types.h" />
|
<ClInclude Include="..\mednafen\types.h" />
|
||||||
<ClInclude Include="..\memory.h" />
|
<ClInclude Include="..\memory.h" />
|
||||||
<ClInclude Include="..\msvc\inttypes.h" />
|
<ClInclude Include="..\msvc\inttypes.h" />
|
||||||
|
|
|
@ -98,9 +98,6 @@
|
||||||
<ClInclude Include="..\mednafen\types.h">
|
<ClInclude Include="..\mednafen\types.h">
|
||||||
<Filter>Header Files\mednafen</Filter>
|
<Filter>Header Files\mednafen</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\mednafen\state.h">
|
|
||||||
<Filter>Header Files\mednafen</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\blip\Blip_Buffer.h">
|
<ClInclude Include="..\blip\Blip_Buffer.h">
|
||||||
<Filter>Header Files\blip</Filter>
|
<Filter>Header Files\blip</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#ifndef _STATE_H
|
|
||||||
#define _STATE_H
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -27,95 +27,6 @@ typedef uint16_t uint16;
|
||||||
typedef uint32_t uint32;
|
typedef uint32_t uint32;
|
||||||
typedef uint64_t uint64;
|
typedef uint64_t uint64;
|
||||||
|
|
||||||
|
|
||||||
#if !defined(HAVE_NATIVE64BIT) && (SIZEOF_VOID_P >= 8 || defined(__x86_64__))
|
|
||||||
#define HAVE_NATIVE64BIT 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
#define MDFN_MAKE_GCCV(maj,min,pl) (((maj)*100*100) + ((min) * 100) + (pl))
|
|
||||||
#define MDFN_GCC_VERSION MDFN_MAKE_GCCV(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
|
|
||||||
|
|
||||||
#define INLINE inline __attribute__((always_inline))
|
|
||||||
#define NO_INLINE __attribute__((noinline))
|
|
||||||
|
|
||||||
//
|
|
||||||
// Just avoid using fastcall with gcc before 4.1.0, as it(and similar regparm)
|
|
||||||
// tend to generate bad code on the older versions(between about 3.1.x and 4.0.x, at least)
|
|
||||||
//
|
|
||||||
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12236
|
|
||||||
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7574
|
|
||||||
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17025
|
|
||||||
//
|
|
||||||
#if MDFN_GCC_VERSION >= MDFN_MAKE_GCCV(4,1,0)
|
|
||||||
#if defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386)
|
|
||||||
#define MDFN_FASTCALL __attribute__((fastcall))
|
|
||||||
#else
|
|
||||||
#define MDFN_FASTCALL
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define MDFN_FASTCALL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MDFN_ALIGN(n) __attribute__ ((aligned (n)))
|
|
||||||
#define MDFN_FORMATSTR(a,b,c) __attribute__ ((format (a, b, c)));
|
|
||||||
#define MDFN_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
|
|
||||||
#define MDFN_NOWARN_UNUSED __attribute__((unused))
|
|
||||||
|
|
||||||
#define MDFN_UNLIKELY(n) __builtin_expect((n) != 0, 0)
|
|
||||||
#define MDFN_LIKELY(n) __builtin_expect((n) != 0, 1)
|
|
||||||
|
|
||||||
#if MDFN_GCC_VERSION >= MDFN_MAKE_GCCV(4,3,0)
|
|
||||||
#define MDFN_COLD __attribute__((cold))
|
|
||||||
#else
|
|
||||||
#define MDFN_COLD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef MDFN_MAKE_GCCV
|
|
||||||
#undef MDFN_GCC_VERSION
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
|
|
||||||
|
|
||||||
#define INLINE __forceinline
|
|
||||||
#define NO_INLINE __declspec(noinline)
|
|
||||||
|
|
||||||
#define MDFN_FASTCALL __fastcall
|
|
||||||
|
|
||||||
#define MDFN_ALIGN(n) __declspec(align(n))
|
|
||||||
|
|
||||||
#define MDFN_FORMATSTR(a,b,c)
|
|
||||||
|
|
||||||
#define MDFN_WARN_UNUSED_RESULT
|
|
||||||
|
|
||||||
#define MDFN_NOWARN_UNUSED
|
|
||||||
|
|
||||||
#define MDFN_UNLIKELY(n) ((n) != 0)
|
|
||||||
#define MDFN_LIKELY(n) ((n) != 0)
|
|
||||||
|
|
||||||
#define MDFN_COLD
|
|
||||||
#else
|
|
||||||
#error "Not compiling with GCC nor MSVC"
|
|
||||||
#define INLINE inline
|
|
||||||
#define NO_INLINE
|
|
||||||
|
|
||||||
#define MDFN_FASTCALL
|
|
||||||
|
|
||||||
#define MDFN_ALIGN(n) // hence the #error.
|
|
||||||
|
|
||||||
#define MDFN_FORMATSTR(a,b,c)
|
|
||||||
|
|
||||||
#define MDFN_WARN_UNUSED_RESULT
|
|
||||||
|
|
||||||
#define MDFN_NOWARN_UNUSED
|
|
||||||
|
|
||||||
#define MDFN_UNLIKELY(n) ((n) != 0)
|
|
||||||
#define MDFN_LIKELY(n) ((n) != 0)
|
|
||||||
|
|
||||||
#define MDFN_COLD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
CXX = g++
|
||||||
|
CXXFLAGS = -Wall -DLSB_FIRST -I.. -Wno-multichar -O3
|
||||||
|
TARGET = bizswan.dll
|
||||||
|
LDFLAGS = -shared -static-libgcc -static-libstdc++
|
||||||
|
RM = rm
|
||||||
|
CP = cp
|
||||||
|
|
||||||
|
SRCS = \
|
||||||
|
../eeprom.cpp \
|
||||||
|
../gfx.cpp \
|
||||||
|
../interrupt.cpp \
|
||||||
|
../main.cpp \
|
||||||
|
../memory.cpp \
|
||||||
|
../rtc.cpp \
|
||||||
|
../sound.cpp \
|
||||||
|
../system.cpp \
|
||||||
|
../tcache.cpp \
|
||||||
|
../v30mz.cpp \
|
||||||
|
../Blip/Blip_Buffer.cpp
|
||||||
|
|
||||||
|
OBJS = $(SRCS:.cpp=.o)
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
$(CXX) -c -o $@ $< $(CXXFLAGS)
|
||||||
|
|
||||||
|
$(TARGET) : $(OBJS)
|
||||||
|
$(CXX) -o $@ $(LDFLAGS) $(OBJS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OBJS)
|
||||||
|
$(RM) $(TARGET)
|
||||||
|
|
||||||
|
install:
|
||||||
|
$(CP) $(TARGET) ../../output/dll
|
|
@ -97,7 +97,7 @@ namespace MDFN_IEN_WSWAN
|
||||||
|
|
||||||
// Source: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
|
// Source: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
|
||||||
// Rounds up to the nearest power of 2.
|
// Rounds up to the nearest power of 2.
|
||||||
static INLINE uint32 round_up_pow2(uint32 v)
|
static inline uint32 round_up_pow2(uint32 v)
|
||||||
{
|
{
|
||||||
v--;
|
v--;
|
||||||
v |= v >> 1;
|
v |= v >> 1;
|
||||||
|
@ -200,7 +200,6 @@ namespace MDFN_IEN_WSWAN
|
||||||
|
|
||||||
rotate = header[6] & 1;
|
rotate = header[6] & 1;
|
||||||
|
|
||||||
|
|
||||||
memory.Init(settings);
|
memory.Init(settings);
|
||||||
gfx.Init(settings.color);
|
gfx.Init(settings.color);
|
||||||
rtc.Init(settings.initialtime, settings.userealtime);
|
rtc.Init(settings.initialtime, settings.userealtime);
|
||||||
|
@ -270,6 +269,12 @@ namespace MDFN_IEN_WSWAN
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void System::PutSettings(const Settings &s)
|
||||||
|
{
|
||||||
|
gfx.SetLayerEnableMask(s.LayerMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EXPORT System *bizswan_new()
|
EXPORT System *bizswan_new()
|
||||||
{
|
{
|
||||||
return new System();
|
return new System();
|
||||||
|
@ -312,4 +317,9 @@ namespace MDFN_IEN_WSWAN
|
||||||
return s->SaveRamSave(dest, maxsize);
|
return s->SaveRamSave(dest, maxsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXPORT void bizswan_putsettings(System *s, const Settings *settings)
|
||||||
|
{
|
||||||
|
s->PutSettings(*settings);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
void Reset();
|
void Reset();
|
||||||
bool Advance(uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize);
|
bool Advance(uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize);
|
||||||
bool Load(const uint8 *data, int length, const SyncSettings &s);
|
bool Load(const uint8 *data, int length, const SyncSettings &s);
|
||||||
|
void PutSettings(const Settings &s);
|
||||||
|
|
||||||
int SaveRamSize() const;
|
int SaveRamSize() const;
|
||||||
bool SaveRamLoad(const uint8 *data, int size);
|
bool SaveRamLoad(const uint8 *data, int size);
|
||||||
|
@ -51,16 +52,16 @@ public:
|
||||||
|
|
||||||
struct SyncSettings
|
struct SyncSettings
|
||||||
{
|
{
|
||||||
uint16 byear; // birth year, 0000-9999
|
|
||||||
uint8 bmonth; // birth month, 1-12
|
|
||||||
uint8 bday; // birth day, 1-31
|
|
||||||
char name[17]; // up to 16 chars long, most chars don't work (conversion from ascii is internal)
|
|
||||||
uint8 language; // 0 = J, 1 = E; only affects "Digimon Tamers - Battle Spirit"
|
|
||||||
uint8 sex; // sex, 1 = male, 2 = female
|
|
||||||
uint8 blood; // 1 = a, 2 = b, 3 = o, 4 = ab
|
|
||||||
bool color; // true if wonderswan is in color mode
|
|
||||||
bool userealtime; // true to use the system's actual clock; false to use an emulation pegged clock
|
|
||||||
uint64 initialtime; // when userealtime is false, the initial time in unix format
|
uint64 initialtime; // when userealtime is false, the initial time in unix format
|
||||||
|
uint32 byear; // birth year, 0000-9999
|
||||||
|
uint32 bmonth; // birth month, 1-12
|
||||||
|
uint32 bday; // birth day, 1-31
|
||||||
|
uint32 color; // true if wonderswan is in color mode
|
||||||
|
uint32 userealtime; // true to use the system's actual clock; false to use an emulation pegged clock
|
||||||
|
uint32 language; // 0 = J, 1 = E; only affects "Digimon Tamers - Battle Spirit"
|
||||||
|
uint32 sex; // sex, 1 = male, 2 = female
|
||||||
|
uint32 blood; // 1 = a, 2 = b, 3 = o, 4 = ab
|
||||||
|
char name[17]; // up to 16 chars long, most chars don't work (conversion from ascii is internal)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Settings
|
struct Settings
|
||||||
|
|
|
@ -105,13 +105,13 @@ namespace MDFN_IEN_WSWAN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_pushf()
|
inline void V30MZ::i_real_pushf()
|
||||||
{
|
{
|
||||||
PUSH( CompressFlags() );
|
PUSH( CompressFlags() );
|
||||||
CLK(2);
|
CLK(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_popf()
|
inline void V30MZ::i_real_popf()
|
||||||
{
|
{
|
||||||
uint32 tmp;
|
uint32 tmp;
|
||||||
POP(tmp);
|
POP(tmp);
|
||||||
|
@ -230,14 +230,14 @@ namespace MDFN_IEN_WSWAN
|
||||||
/* OPCODES */
|
/* OPCODES */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_insb()
|
inline void V30MZ::i_real_insb()
|
||||||
{
|
{
|
||||||
PutMemB(DS1,I.regs.w[IY], read_port(I.regs.w[DW]));
|
PutMemB(DS1,I.regs.w[IY], read_port(I.regs.w[DW]));
|
||||||
I.regs.w[IY]+= -2 * I.DF + 1;
|
I.regs.w[IY]+= -2 * I.DF + 1;
|
||||||
CLK(6);
|
CLK(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_insw()
|
inline void V30MZ::i_real_insw()
|
||||||
{
|
{
|
||||||
PutMemB(DS1,I.regs.w[IY],read_port(I.regs.w[DW]));
|
PutMemB(DS1,I.regs.w[IY],read_port(I.regs.w[DW]));
|
||||||
PutMemB(DS1,(I.regs.w[IY]+1)&0xffff,read_port((I.regs.w[DW]+1)&0xffff));
|
PutMemB(DS1,(I.regs.w[IY]+1)&0xffff,read_port((I.regs.w[DW]+1)&0xffff));
|
||||||
|
@ -245,14 +245,14 @@ namespace MDFN_IEN_WSWAN
|
||||||
CLK(6);
|
CLK(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_outsb()
|
inline void V30MZ::i_real_outsb()
|
||||||
{
|
{
|
||||||
write_port(I.regs.w[DW],GetMemB(DS0,I.regs.w[IX]));
|
write_port(I.regs.w[DW],GetMemB(DS0,I.regs.w[IX]));
|
||||||
I.regs.w[IX]+= -2 * I.DF + 1;
|
I.regs.w[IX]+= -2 * I.DF + 1;
|
||||||
CLK(7);
|
CLK(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_outsw()
|
inline void V30MZ::i_real_outsw()
|
||||||
{
|
{
|
||||||
write_port(I.regs.w[DW],GetMemB(DS0,I.regs.w[IX]));
|
write_port(I.regs.w[DW],GetMemB(DS0,I.regs.w[IX]));
|
||||||
write_port((I.regs.w[DW]+1)&0xffff,GetMemB(DS0,(I.regs.w[IX]+1)&0xffff));
|
write_port((I.regs.w[DW]+1)&0xffff,GetMemB(DS0,(I.regs.w[IX]+1)&0xffff));
|
||||||
|
@ -260,7 +260,7 @@ namespace MDFN_IEN_WSWAN
|
||||||
CLK(7);
|
CLK(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_movsb()
|
inline void V30MZ::i_real_movsb()
|
||||||
{
|
{
|
||||||
uint32 tmp = GetMemB(DS0,I.regs.w[IX]);
|
uint32 tmp = GetMemB(DS0,I.regs.w[IX]);
|
||||||
PutMemB(DS1,I.regs.w[IY], tmp);
|
PutMemB(DS1,I.regs.w[IY], tmp);
|
||||||
|
@ -269,51 +269,51 @@ namespace MDFN_IEN_WSWAN
|
||||||
CLK(5);
|
CLK(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_movsw()
|
inline void V30MZ::i_real_movsw()
|
||||||
{
|
{
|
||||||
uint32 tmp = GetMemW(DS0,I.regs.w[IX]); PutMemW(DS1,I.regs.w[IY], tmp); I.regs.w[IY] += -4 * I.DF + 2;
|
uint32 tmp = GetMemW(DS0,I.regs.w[IX]); PutMemW(DS1,I.regs.w[IY], tmp); I.regs.w[IY] += -4 * I.DF + 2;
|
||||||
I.regs.w[IX] += -4 * I.DF + 2; CLK(5);
|
I.regs.w[IX] += -4 * I.DF + 2; CLK(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_cmpsb()
|
inline void V30MZ::i_real_cmpsb()
|
||||||
{
|
{
|
||||||
uint32 src = GetMemB(DS1, I.regs.w[IY]); uint32 dst = GetMemB(DS0, I.regs.w[IX]); SUBB; I.regs.w[IY] += -2 * I.DF + 1;
|
uint32 src = GetMemB(DS1, I.regs.w[IY]); uint32 dst = GetMemB(DS0, I.regs.w[IX]); SUBB; I.regs.w[IY] += -2 * I.DF + 1;
|
||||||
I.regs.w[IX] += -2 * I.DF + 1; CLK(6);
|
I.regs.w[IX] += -2 * I.DF + 1; CLK(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_cmpsw()
|
inline void V30MZ::i_real_cmpsw()
|
||||||
{
|
{
|
||||||
uint32 src = GetMemW(DS1, I.regs.w[IY]); uint32 dst = GetMemW(DS0, I.regs.w[IX]); SUBW; I.regs.w[IY] += -4 * I.DF + 2;
|
uint32 src = GetMemW(DS1, I.regs.w[IY]); uint32 dst = GetMemW(DS0, I.regs.w[IX]); SUBW; I.regs.w[IY] += -4 * I.DF + 2;
|
||||||
I.regs.w[IX] += -4 * I.DF + 2; CLK(6);
|
I.regs.w[IX] += -4 * I.DF + 2; CLK(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_stosb()
|
inline void V30MZ::i_real_stosb()
|
||||||
{
|
{
|
||||||
PutMemB(DS1,I.regs.w[IY],I.regs.b[AL]); I.regs.w[IY] += -2 * I.DF + 1; CLK(3);
|
PutMemB(DS1,I.regs.w[IY],I.regs.b[AL]); I.regs.w[IY] += -2 * I.DF + 1; CLK(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_stosw()
|
inline void V30MZ::i_real_stosw()
|
||||||
{
|
{
|
||||||
PutMemW(DS1,I.regs.w[IY],I.regs.w[AW]); I.regs.w[IY] += -4 * I.DF + 2; CLK(3);
|
PutMemW(DS1,I.regs.w[IY],I.regs.w[AW]); I.regs.w[IY] += -4 * I.DF + 2; CLK(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_lodsb()
|
inline void V30MZ::i_real_lodsb()
|
||||||
{
|
{
|
||||||
I.regs.b[AL] = GetMemB(DS0,I.regs.w[IX]); I.regs.w[IX] += -2 * I.DF + 1; CLK(3);
|
I.regs.b[AL] = GetMemB(DS0,I.regs.w[IX]); I.regs.w[IX] += -2 * I.DF + 1; CLK(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_lodsw()
|
inline void V30MZ::i_real_lodsw()
|
||||||
{
|
{
|
||||||
I.regs.w[AW] = GetMemW(DS0,I.regs.w[IX]); I.regs.w[IX] += -4 * I.DF + 2; CLK(3);
|
I.regs.w[AW] = GetMemW(DS0,I.regs.w[IX]); I.regs.w[IX] += -4 * I.DF + 2; CLK(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_scasb()
|
inline void V30MZ::i_real_scasb()
|
||||||
{
|
{
|
||||||
uint32 src = GetMemB(DS1, I.regs.w[IY]); uint32 dst = I.regs.b[AL]; SUBB;
|
uint32 src = GetMemB(DS1, I.regs.w[IY]); uint32 dst = I.regs.b[AL]; SUBB;
|
||||||
I.regs.w[IY] += -2 * I.DF + 1; CLK(4);
|
I.regs.w[IY] += -2 * I.DF + 1; CLK(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void V30MZ::i_real_scasw()
|
inline void V30MZ::i_real_scasw()
|
||||||
{
|
{
|
||||||
uint32 src = GetMemW(DS1, I.regs.w[IY]); uint32 dst = I.regs.w[AW]; SUBW;
|
uint32 src = GetMemW(DS1, I.regs.w[IY]); uint32 dst = I.regs.w[AW]; SUBW;
|
||||||
I.regs.w[IY] += -4 * I.DF + 2; CLK(4);
|
I.regs.w[IY] += -4 * I.DF + 2; CLK(4);
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define __WSWAN_H
|
#define __WSWAN_H
|
||||||
|
|
||||||
#include <mednafen/types.h>
|
#include <mednafen/types.h>
|
||||||
#include <mednafen/state.h>
|
|
||||||
|
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue