rename all the things

This commit is contained in:
CasualPokePlayer 2024-03-04 18:39:30 -08:00
parent f02080b61b
commit 7cf8c968df
22 changed files with 135 additions and 1186 deletions

4
.gitmodules vendored
View File

@ -59,8 +59,8 @@
[submodule "ExternalProjects/librcheevos/rcheevos"] [submodule "ExternalProjects/librcheevos/rcheevos"]
path = ExternalProjects/librcheevos/rcheevos path = ExternalProjects/librcheevos/rcheevos
url = https://github.com/RetroAchievements/rcheevos.git url = https://github.com/RetroAchievements/rcheevos.git
[submodule "citra/citra"] [submodule "encore/encore"]
path = citra/citra path = encore/encore
url = https://github.com/CasualPokePlayer/encore.git url = https://github.com/CasualPokePlayer/encore.git
branch = headless branch = headless
[submodule "ExternalProjects/SDL2/SDL"] [submodule "ExternalProjects/SDL2/SDL"]

Binary file not shown.

Binary file not shown.

1
citra/.gitignore vendored
View File

@ -1 +0,0 @@
/build

View File

@ -1,12 +0,0 @@
rmdir /s /q build
mkdir build
SET GLSLANG_VALIDATOR_DIR="%cd%\glslangValidator"
cd build
cmake ..\citra -DENABLE_SDL2=OFF -DUSE_SYSTEM_SDL2=OFF -DENABLE_QT=OFF -DENABLE_QT_TRANSLATION=OFF -DENABLE_QT_UPDATER=OFF ^
-DENABLE_TESTS=OFF -DENABLE_DEDICATED_ROOM=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_CUBEB=OFF -DENABLE_OPENAL=OFF ^
-DENABLE_LIBUSB=OFF -DUSE_DISCORD_PRESENCE=OFF -DUSE_SYSTEM_BOOST=OFF -DUSE_SYSTEM_OPENSSL=OFF -DUSE_SYSTEM_LIBUSB=OFF ^
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF -DENABLE_HEADLESS=ON -DCMAKE_PROGRAM_PATH=%GLSLANG_VALIDATOR_DIR% ^
-DCMAKE_BUILD_TYPE=Release -DENABLE_LTO=ON -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl ^
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -G Ninja
ninja
cd ..

View File

@ -1,21 +0,0 @@
#!/bin/sh
set -e
if [ -z "$CC" ]; then export CC="clang"; fi
if [ -z "$CXX" ]; then export CXX="clang++"; fi
# stdlibc++ has a bug in some versions (at least in Ubuntu 22.04, probably Debian 12 too) that will cause compilation to fail for Citra
# Debian 11's stdlibc++ is unaffected (and probably Ubuntu 20.04's too)
# Note that Debian 10's stdlibc++ is too old (nearly no c++20 support), so at least Debian 11 must be used to compile this core
# At least cmake 3.20 must be present too, so get cmake from bullseye-backports
rm -rf build
mkdir build
export GLSLANG_VALIDATOR_DIR=$(realpath ./glslangValidator)
cd build
cmake ../citra -DENABLE_SDL2=OFF -DUSE_SYSTEM_SDL2=OFF -DENABLE_QT=OFF -DENABLE_QT_TRANSLATION=OFF -DENABLE_QT_UPDATER=OFF \
-DENABLE_TESTS=OFF -DENABLE_DEDICATED_ROOM=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_CUBEB=OFF -DENABLE_OPENAL=OFF \
-DENABLE_LIBUSB=OFF -DUSE_DISCORD_PRESENCE=OFF -DUSE_SYSTEM_BOOST=OFF -DUSE_SYSTEM_OPENSSL=OFF -DUSE_SYSTEM_LIBUSB=OFF \
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF -DENABLE_HEADLESS=ON -DCMAKE_PROGRAM_PATH=$GLSLANG_VALIDATOR_DIR \
-DCMAKE_BUILD_TYPE=Release -DENABLE_LTO=ON -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_FLAGS="-Wno-deprecated -include limits.h" -G Ninja
ninja

@ -1 +0,0 @@
Subproject commit e665c6a86b45876cc8267425300c9617c0dc4229

File diff suppressed because it is too large Load Diff

View File

@ -480,7 +480,7 @@ namespace BizHawk.Client.Common
return GlobalEmulator switch return GlobalEmulator switch
{ {
NDS nds => new ScreenControlNDS(nds), NDS nds => new ScreenControlNDS(nds),
Citra citra => new ScreenControl3DS(citra), Encore citra => new ScreenControl3DS(citra),
_ => null _ => null
}; };
} }

View File

@ -207,21 +207,21 @@ namespace BizHawk.Client.Common.Filters
/// </summary> /// </summary>
public class ScreenControl3DS : BaseFilter public class ScreenControl3DS : BaseFilter
{ {
private readonly Citra _citra; private readonly Encore _encore;
public ScreenControl3DS(Citra citra) public ScreenControl3DS(Encore encore)
{ {
_citra = citra; _encore = encore;
} }
public override Vector2 UntransformPoint(string channel, Vector2 point) public override Vector2 UntransformPoint(string channel, Vector2 point)
{ {
if (_citra.TouchScreenEnabled) if (_encore.TouchScreenEnabled)
{ {
var rect = _citra.TouchScreenRectangle; var rect = _encore.TouchScreenRectangle;
var rotated = _citra.TouchScreenRotated; var rotated = _encore.TouchScreenRotated;
var bufferWidth = (float)_citra.AsVideoProvider().BufferWidth; var bufferWidth = (float)_encore.AsVideoProvider().BufferWidth;
var bufferHeight = (float)_citra.AsVideoProvider().BufferHeight; var bufferHeight = (float)_encore.AsVideoProvider().BufferHeight;
// reset the point's origin to the top left of the screen // reset the point's origin to the top left of the screen
point.X -= rect.X; point.X -= rect.X;
@ -248,10 +248,10 @@ namespace BizHawk.Client.Common.Filters
public override Vector2 TransformPoint(string channel, Vector2 point) public override Vector2 TransformPoint(string channel, Vector2 point)
{ {
if (_citra.TouchScreenEnabled) if (_encore.TouchScreenEnabled)
{ {
var rect = _citra.TouchScreenRectangle; var rect = _encore.TouchScreenRectangle;
var rotated = _citra.TouchScreenRotated; var rotated = _encore.TouchScreenRotated;
if (rotated) if (rotated)
{ {

View File

@ -2747,7 +2747,7 @@ namespace BizHawk.Client.EmuHawk
items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.ChannelFHawk, CreateGenericCoreConfigItem<ChannelF>(CoreNames.ChannelFHawk))); items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.ChannelFHawk, CreateGenericCoreConfigItem<ChannelF>(CoreNames.ChannelFHawk)));
// Encore // Encore
items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Encore, CreateGenericCoreConfigItem<Citra>(CoreNames.Encore))); items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Encore, CreateGenericCoreConfigItem<Encore>(CoreNames.Encore)));
// ColecoHawk // ColecoHawk
var colecoHawkGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenColecoHawkGamepadSettingsDialog(GetSettingsAdapterFor<ColecoVision>())); var colecoHawkGamepadSettingsItem = CreateSettingsItem("Controller Settings...", (_, _) => OpenColecoHawkGamepadSettingsDialog(GetSettingsAdapterFor<ColecoVision>()));

View File

@ -2,7 +2,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
public partial class Citra : IEmulator public partial class Encore : IEmulator
{ {
private readonly BasicServiceProvider _serviceProvider; private readonly BasicServiceProvider _serviceProvider;
@ -28,12 +28,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
if (_controller.IsPressed("Reset")) if (_controller.IsPressed("Reset"))
{ {
_core.Citra_Reset(_context); _core.Encore_Reset(_context);
// memory domain pointers are no longer valid, reset them // memory domain pointers are no longer valid, reset them
WireMemoryDomains(); WireMemoryDomains();
} }
_core.Citra_RunFrame(_context); _core.Encore_RunFrame(_context);
OnVideoRefresh(); OnVideoRefresh();
@ -53,10 +53,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
private void OnVideoRefresh() private void OnVideoRefresh()
{ {
_core.Citra_GetVideoDimensions(_context, out _citraVideoProvider.Width, out _citraVideoProvider.Height); _core.Encore_GetVideoDimensions(_context, out _encoreVideoProvider.Width, out _encoreVideoProvider.Height);
_citraVideoProvider.VideoDirty = true; _encoreVideoProvider.VideoDirty = true;
_core.Citra_GetTouchScreenLayout(_context, out var x, out var y, out var width, out var height, out var rotated, out var enabled); _core.Encore_GetTouchScreenLayout(_context, out var x, out var y, out var width, out var height, out var rotated, out var enabled);
TouchScreenRectangle = new(x, y, width, height); TouchScreenRectangle = new(x, y, width, height);
TouchScreenRotated = rotated; TouchScreenRotated = rotated;
TouchScreenEnabled = enabled; TouchScreenEnabled = enabled;
@ -78,7 +78,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
return; return;
} }
_core.Citra_DestroyContext(_context); _core.Encore_DestroyContext(_context);
foreach (var glContext in _glContexts) foreach (var glContext in _glContexts)
{ {

View File

@ -5,7 +5,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
public partial class Citra : IInputPollable public partial class Encore : IInputPollable
{ {
public int LagCount { get; set; } public int LagCount { get; set; }
public bool IsLagFrame { get; set; } public bool IsLagFrame { get; set; }
@ -27,38 +27,38 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
.AddXYPair("Tilt {0}", AxisPairOrientation.RightAndUp, 0.RangeTo(320), 160, 0.RangeTo(240), 120) .AddXYPair("Tilt {0}", AxisPairOrientation.RightAndUp, 0.RangeTo(320), 160, 0.RangeTo(240), 120)
.MakeImmutable(); .MakeImmutable();
private bool GetButtonCallback(LibCitra.Buttons button) => button switch private bool GetButtonCallback(LibEncore.Buttons button) => button switch
{ {
LibCitra.Buttons.A => _controller.IsPressed("A"), LibEncore.Buttons.A => _controller.IsPressed("A"),
LibCitra.Buttons.B => _controller.IsPressed("B"), LibEncore.Buttons.B => _controller.IsPressed("B"),
LibCitra.Buttons.X => _controller.IsPressed("X"), LibEncore.Buttons.X => _controller.IsPressed("X"),
LibCitra.Buttons.Y => _controller.IsPressed("Y"), LibEncore.Buttons.Y => _controller.IsPressed("Y"),
LibCitra.Buttons.Up => _controller.IsPressed("Up"), LibEncore.Buttons.Up => _controller.IsPressed("Up"),
LibCitra.Buttons.Down => _controller.IsPressed("Down"), LibEncore.Buttons.Down => _controller.IsPressed("Down"),
LibCitra.Buttons.Left => _controller.IsPressed("Left"), LibEncore.Buttons.Left => _controller.IsPressed("Left"),
LibCitra.Buttons.Right => _controller.IsPressed("Right"), LibEncore.Buttons.Right => _controller.IsPressed("Right"),
LibCitra.Buttons.L => _controller.IsPressed("L"), LibEncore.Buttons.L => _controller.IsPressed("L"),
LibCitra.Buttons.R => _controller.IsPressed("R"), LibEncore.Buttons.R => _controller.IsPressed("R"),
LibCitra.Buttons.Start => _controller.IsPressed("Start"), LibEncore.Buttons.Start => _controller.IsPressed("Start"),
LibCitra.Buttons.Select => _controller.IsPressed("Select"), LibEncore.Buttons.Select => _controller.IsPressed("Select"),
LibCitra.Buttons.Debug => _controller.IsPressed("Debug"), LibEncore.Buttons.Debug => _controller.IsPressed("Debug"),
LibCitra.Buttons.Gpio14 => _controller.IsPressed("GPIO14"), LibEncore.Buttons.Gpio14 => _controller.IsPressed("GPIO14"),
LibCitra.Buttons.ZL => _controller.IsPressed("ZL"), LibEncore.Buttons.ZL => _controller.IsPressed("ZL"),
LibCitra.Buttons.ZR => _controller.IsPressed("ZR"), LibEncore.Buttons.ZR => _controller.IsPressed("ZR"),
LibCitra.Buttons.Home => false, // not supported (can only be used if Home menu is booted, which is never be the case for us) LibEncore.Buttons.Home => false, // not supported (can only be used if Home menu is booted, which is never be the case for us)
LibCitra.Buttons.Power => false, // not supported (can only be used if Home menu is booted, which is never be the case for us) LibEncore.Buttons.Power => false, // not supported (can only be used if Home menu is booted, which is never be the case for us)
_ => throw new InvalidOperationException(), _ => throw new InvalidOperationException(),
}; };
private void GetAxisCallback(LibCitra.AnalogSticks stick, out float x, out float y) private void GetAxisCallback(LibEncore.AnalogSticks stick, out float x, out float y)
{ {
switch (stick) switch (stick)
{ {
case LibCitra.AnalogSticks.CirclePad: case LibEncore.AnalogSticks.CirclePad:
x = _controller.AxisValue("Circle Pad X") / 128.0f; x = _controller.AxisValue("Circle Pad X") / 128.0f;
y = _controller.AxisValue("Circle Pad Y") / 128.0f; y = _controller.AxisValue("Circle Pad Y") / 128.0f;
break; break;
case LibCitra.AnalogSticks.CStick: case LibEncore.AnalogSticks.CStick:
x = _controller.AxisValue("C-Stick X") / 128.0f; x = _controller.AxisValue("C-Stick X") / 128.0f;
y = _controller.AxisValue("C-Stick Y") / 128.0f; y = _controller.AxisValue("C-Stick Y") / 128.0f;
break; break;

View File

@ -5,7 +5,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
public partial class Citra public partial class Encore
{ {
private IMemoryDomains _memoryDomains; private IMemoryDomains _memoryDomains;
@ -36,17 +36,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
private void WireMemoryDomains() private void WireMemoryDomains()
{ {
void WireDomain(LibCitra.MemoryRegion region, MemoryDomainIntPtr domain) void WireDomain(LibEncore.MemoryRegion region, MemoryDomainIntPtr domain)
{ {
_core.Citra_GetMemoryRegion(_context, region, out var ptr, out var size); _core.Encore_GetMemoryRegion(_context, region, out var ptr, out var size);
domain.Data = ptr; domain.Data = ptr;
domain.SetSize(size); domain.SetSize(size);
} }
WireDomain(LibCitra.MemoryRegion.FCRAM, _fcram); WireDomain(LibEncore.MemoryRegion.FCRAM, _fcram);
WireDomain(LibCitra.MemoryRegion.VRAM, _vram); WireDomain(LibEncore.MemoryRegion.VRAM, _vram);
WireDomain(LibCitra.MemoryRegion.DSP, _dspRam); WireDomain(LibEncore.MemoryRegion.DSP, _dspRam);
WireDomain(LibCitra.MemoryRegion.N3DS, _n3dsExRam); WireDomain(LibEncore.MemoryRegion.N3DS, _n3dsExRam);
} }
} }
} }

View File

@ -10,10 +10,10 @@ using System.Text;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
public partial class Citra : ISettable<Citra.CitraSettings, Citra.CitraSyncSettings> public partial class Encore : ISettable<Encore.EncoreSettings, Encore.EncoreSyncSettings>
{ {
private CitraSettings _settings; private EncoreSettings _settings;
private CitraSyncSettings _syncSettings; private EncoreSyncSettings _syncSettings;
private readonly string _userPath; private readonly string _userPath;
private bool GetBooleanSettingCallback(string label) => label switch private bool GetBooleanSettingCallback(string label) => label switch
@ -36,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
private ulong GetIntegerSettingCallback(string label) => label switch private ulong GetIntegerSettingCallback(string label) => label switch
{ {
"cpu_clock_percentage" => (ulong)_syncSettings.CpuClockPercentage, "cpu_clock_percentage" => (ulong)_syncSettings.CpuClockPercentage,
"graphics_api" => (ulong)CitraSyncSettings.EGraphicsApi.OpenGL,//_supportsOpenGL43 ? (ulong)_syncSettings.GraphicsApi : (ulong)CitraSyncSettings.EGraphicsApi.Software, "graphics_api" => (ulong)EncoreSyncSettings.EGraphicsApi.OpenGL,//_supportsOpenGL43 ? (ulong)_syncSettings.GraphicsApi : (ulong)EncoreSyncSettings.EGraphicsApi.Software,
"region_value" => (ulong)_syncSettings.RegionValue, "region_value" => (ulong)_syncSettings.RegionValue,
"init_clock" => _syncSettings.UseRealTime && !DeterministicEmulation ? 0UL : 1UL, "init_clock" => _syncSettings.UseRealTime && !DeterministicEmulation ? 0UL : 1UL,
"init_time" => (ulong)(_syncSettings.InitialTime - _epoch).TotalSeconds, "init_time" => (ulong)(_syncSettings.InitialTime - _epoch).TotalSeconds,
@ -89,28 +89,28 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
Marshal.WriteByte(buffer, numToCopy, 0); Marshal.WriteByte(buffer, numToCopy, 0);
} }
public CitraSettings GetSettings() public EncoreSettings GetSettings()
=> _settings.Clone(); => _settings.Clone();
public CitraSyncSettings GetSyncSettings() public EncoreSyncSettings GetSyncSettings()
=> _syncSettings.Clone(); => _syncSettings.Clone();
public PutSettingsDirtyBits PutSettings(CitraSettings o) public PutSettingsDirtyBits PutSettings(EncoreSettings o)
{ {
_settings = o; _settings = o;
_core.Citra_ReloadConfig(_context); _core.Encore_ReloadConfig(_context);
return PutSettingsDirtyBits.None; return PutSettingsDirtyBits.None;
} }
public PutSettingsDirtyBits PutSyncSettings(CitraSyncSettings o) public PutSettingsDirtyBits PutSyncSettings(EncoreSyncSettings o)
{ {
var ret = CitraSyncSettings.NeedsReboot(_syncSettings, o); var ret = EncoreSyncSettings.NeedsReboot(_syncSettings, o);
_syncSettings = o; _syncSettings = o;
return ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None; return ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None;
} }
[CoreSettings] [CoreSettings]
public class CitraSettings public class EncoreSettings
{ {
[DisplayName("Resolution Scale Factor")] [DisplayName("Resolution Scale Factor")]
[Description("Scale factor for the 3DS resolution.")] [Description("Scale factor for the 3DS resolution.")]
@ -234,15 +234,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
[TypeConverter(typeof(ConstrainedIntConverter))] [TypeConverter(typeof(ConstrainedIntConverter))]
public int CustomLayoutSecondLayerOpacity { get; set; } public int CustomLayoutSecondLayerOpacity { get; set; }
public CitraSettings Clone() public EncoreSettings Clone()
=> (CitraSettings)MemberwiseClone(); => (EncoreSettings)MemberwiseClone();
public CitraSettings() public EncoreSettings()
=> SettingsUtil.SetDefaultValues(this); => SettingsUtil.SetDefaultValues(this);
} }
[CoreSettings] [CoreSettings]
public class CitraSyncSettings public class EncoreSyncSettings
{ {
[DisplayName("Use CPU JIT")] [DisplayName("Use CPU JIT")]
[Description("Whether to use the Just-In-Time (JIT) compiler for CPU emulation")] [Description("Whether to use the Just-In-Time (JIT) compiler for CPU emulation")]
@ -297,7 +297,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
public bool UseVirtualSd { get; set; } public bool UseVirtualSd { get; set; }
[DisplayName("Is New 3DS")] [DisplayName("Is New 3DS")]
[Description("The system model that Citra will try to emulate.")] [Description("The system model that Encore will try to emulate.")]
[DefaultValue(true)] [DefaultValue(true)]
public bool IsNew3ds { get; set; } public bool IsNew3ds { get; set; }
@ -314,7 +314,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
[DisplayName("Region Value")] [DisplayName("Region Value")]
[Description("The system region that Citra will use during emulation")] [Description("The system region that Encore will use during emulation")]
[DefaultValue(ERegionValue.Autodetect)] [DefaultValue(ERegionValue.Autodetect)]
public ERegionValue RegionValue { get; set; } public ERegionValue RegionValue { get; set; }
@ -330,8 +330,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
public DateTime InitialTime { get; set; } public DateTime InitialTime { get; set; }
[DisplayName("CFG Username")] [DisplayName("CFG Username")]
[Description("The system username that Citra will use during emulation")] [Description("The system username that Encore will use during emulation")]
[DefaultValue("CITRA")] [DefaultValue("ENCORE")]
[MaxLength(10)] [MaxLength(10)]
[TypeConverter(typeof(ConstrainedStringConverter))] [TypeConverter(typeof(ConstrainedStringConverter))]
public string CFGUsername { get; set; } public string CFGUsername { get; set; }
@ -353,12 +353,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
[DisplayName("CFG Birthday Month")] [DisplayName("CFG Birthday Month")]
[Description("The system birthday month that Citra will use during emulation")] [Description("The system birthday month that Encore will use during emulation")]
[DefaultValue(ECFGBirthdayMonth.March)] [DefaultValue(ECFGBirthdayMonth.March)]
public ECFGBirthdayMonth CFGBirthdayMonth { get; set; } public ECFGBirthdayMonth CFGBirthdayMonth { get; set; }
[DisplayName("CFG Birthday Day")] [DisplayName("CFG Birthday Day")]
[Description("The system birthday day that Citra will use during emulation")] [Description("The system birthday day that Encore will use during emulation")]
[DefaultValue(25)] [DefaultValue(25)]
[Range(1, 31)] [Range(1, 31)]
[TypeConverter(typeof(ConstrainedIntConverter))] [TypeConverter(typeof(ConstrainedIntConverter))]
@ -381,7 +381,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
[DisplayName("CFG System Language")] [DisplayName("CFG System Language")]
[Description("The system language that Citra will use during emulation")] [Description("The system language that Encore will use during emulation")]
[DefaultValue(ECFGSystemLanguage.English)] [DefaultValue(ECFGSystemLanguage.English)]
public ECFGSystemLanguage CFGSystemLanguage { get; set; } public ECFGSystemLanguage CFGSystemLanguage { get; set; }
@ -393,22 +393,22 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
[DisplayName("CFG Sound Output Mode")] [DisplayName("CFG Sound Output Mode")]
[Description("The system sound output mode that Citra will use during emulation")] [Description("The system sound output mode that Encore will use during emulation")]
[DefaultValue(ECFGSoundOutputMode.Stereo)] [DefaultValue(ECFGSoundOutputMode.Stereo)]
public ECFGSoundOutputMode CFGSoundOutputMode { get; set; } public ECFGSoundOutputMode CFGSoundOutputMode { get; set; }
[DisplayName("CFG Sound Output Mode")] [DisplayName("CFG Sound Output Mode")]
[Description("The system sound output mode that Citra will use during emulation")] [Description("The system sound output mode that Encore will use during emulation")]
[DefaultValue(typeof(ushort), "42")] [DefaultValue(typeof(ushort), "42")]
public ushort PTMPlayCoins { get; set; } public ushort PTMPlayCoins { get; set; }
public CitraSyncSettings Clone() public EncoreSyncSettings Clone()
=> (CitraSyncSettings)MemberwiseClone(); => (EncoreSyncSettings)MemberwiseClone();
public static bool NeedsReboot(CitraSyncSettings x, CitraSyncSettings y) public static bool NeedsReboot(EncoreSyncSettings x, EncoreSyncSettings y)
=> !DeepEquality.DeepEquals(x, y); => !DeepEquality.DeepEquals(x, y);
public CitraSyncSettings() public EncoreSyncSettings()
=> SettingsUtil.SetDefaultValues(this); => SettingsUtil.SetDefaultValues(this);
} }
} }

View File

@ -5,14 +5,14 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
public partial class Citra : ISoundProvider public partial class Encore : ISoundProvider
{ {
private short[] _sampleBuf = new short[1024 * 2]; private short[] _sampleBuf = new short[1024 * 2];
private int _nsamps; private int _nsamps;
private void ProcessSound() private void ProcessSound()
{ {
_core.Citra_GetAudio(_context, out var buffer, out var frames); _core.Encore_GetAudio(_context, out var buffer, out var frames);
if (frames > _sampleBuf.Length) if (frames > _sampleBuf.Length)
{ {
_sampleBuf = new short[frames]; _sampleBuf = new short[frames];

View File

@ -5,7 +5,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
public partial class Citra : IStatable public partial class Encore : IStatable
{ {
private byte[] _stateBuf = Array.Empty<byte>(); private byte[] _stateBuf = Array.Empty<byte>();
@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(BinaryWriter writer)
{ {
var stateLen = _core.Citra_StartSaveState(_context); var stateLen = _core.Encore_StartSaveState(_context);
writer.Write(stateLen); writer.Write(stateLen);
if (stateLen > _stateBuf.Length) if (stateLen > _stateBuf.Length)
@ -21,7 +21,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
_stateBuf = new byte[stateLen]; _stateBuf = new byte[stateLen];
} }
_core.Citra_FinishSaveState(_context, _stateBuf); _core.Encore_FinishSaveState(_context, _stateBuf);
writer.Write(_stateBuf, 0, stateLen); writer.Write(_stateBuf, 0, stateLen);
// other variables // other variables
@ -57,7 +57,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
reader.Read(_stateBuf, 0, stateLen); reader.Read(_stateBuf, 0, stateLen);
_core.Citra_LoadState(_context, _stateBuf, stateLen); _core.Encore_LoadState(_context, _stateBuf, stateLen);
// other variables // other variables
IsLagFrame = reader.ReadBoolean(); IsLagFrame = reader.ReadBoolean();

View File

@ -4,16 +4,16 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
public class CitraVideoProvider : IVideoProvider public class EncoreVideoProvider : IVideoProvider
{ {
internal int Width = 400; internal int Width = 400;
internal int Height = 480; internal int Height = 480;
internal bool VideoDirty; internal bool VideoDirty;
protected readonly LibCitra _core; protected readonly LibEncore _core;
protected readonly IntPtr _context; protected readonly IntPtr _context;
public CitraVideoProvider(LibCitra core, IntPtr context) public EncoreVideoProvider(LibEncore core, IntPtr context)
{ {
_core = core; _core = core;
_context = context; _context = context;
@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
_vbuf = new int[Width * Height]; _vbuf = new int[Width * Height];
} }
_core.Citra_ReadFrameBuffer(_context, _vbuf); _core.Encore_ReadFrameBuffer(_context, _vbuf);
VideoDirty = false; VideoDirty = false;
} }
@ -47,14 +47,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
} }
public class CitraGLTextureProvider : CitraVideoProvider, IGLTextureProvider public class EncoreGLTextureProvider : EncoreVideoProvider, IGLTextureProvider
{ {
public CitraGLTextureProvider(LibCitra core, IntPtr context) public EncoreGLTextureProvider(LibEncore core, IntPtr context)
: base(core, context) : base(core, context)
{ {
} }
public int GetGLTexture() public int GetGLTexture()
=> _core.Citra_GetGLTexture(_context); => _core.Encore_GetGLTexture(_context);
} }
} }

View File

@ -13,38 +13,38 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
[PortedCore(CoreNames.Encore, "", "nightly-2104", "https://github.com/CasualPokePlayer/encore", singleInstance: true, isReleased: false)] [PortedCore(CoreNames.Encore, "", "nightly-2104", "https://github.com/CasualPokePlayer/encore", singleInstance: true, isReleased: false)]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable) })] [ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable) })]
public partial class Citra public partial class Encore
{ {
private static DynamicLibraryImportResolver _resolver; private static DynamicLibraryImportResolver _resolver;
private static LibCitra _core; private static LibEncore _core;
// This is a hack, largely just so we can forcefully evict file handles Citra keeps open even after shutdown. // This is a hack, largely just so we can forcefully evict file handles Encore keeps open even after shutdown.
// While keeping these file handles open is mostly harmless, this ends up being bad when recording a movie. // While keeping these file handles open is mostly harmless, this ends up being bad when recording a movie.
// These file handles would be in the user folder, and the user folder must be cleared out when recording a movie! // These file handles would be in the user folder, and the user folder must be cleared out when recording a movie!
private static void ResetCitraResolver() private static void ResetEncoreResolver()
{ {
_resolver?.Dispose(); _resolver?.Dispose();
_resolver = new(OSTailoredCode.IsUnixHost ? "libcitra-headless.so" : "citra-headless.dll", hasLimitedLifetime: true); _resolver = new(OSTailoredCode.IsUnixHost ? "libencore-headless.so" : "encore-headless.dll", hasLimitedLifetime: true);
_core = BizInvoker.GetInvoker<LibCitra>(_resolver, CallingConventionAdapters.Native); _core = BizInvoker.GetInvoker<LibEncore>(_resolver, CallingConventionAdapters.Native);
} }
private static Citra CurrentCore; private static Encore CurrentCore;
private readonly IOpenGLProvider _openGLProvider; private readonly IOpenGLProvider _openGLProvider;
private readonly bool _supportsOpenGL43; private readonly bool _supportsOpenGL43;
private readonly List<object> _glContexts = new(); private readonly List<object> _glContexts = new();
private readonly LibCitra.ConfigCallbackInterface _configCallbackInterface; private readonly LibEncore.ConfigCallbackInterface _configCallbackInterface;
private readonly LibCitra.GLCallbackInterface _glCallbackInterface; private readonly LibEncore.GLCallbackInterface _glCallbackInterface;
private readonly LibCitra.InputCallbackInterface _inputCallbackInterface; private readonly LibEncore.InputCallbackInterface _inputCallbackInterface;
private readonly IntPtr _context; private readonly IntPtr _context;
private readonly CitraVideoProvider _citraVideoProvider; private readonly EncoreVideoProvider _encoreVideoProvider;
public Rectangle TouchScreenRectangle { get; private set; } public Rectangle TouchScreenRectangle { get; private set; }
public bool TouchScreenRotated { get; private set; } public bool TouchScreenRotated { get; private set; }
public bool TouchScreenEnabled { get; private set; } public bool TouchScreenEnabled { get; private set; }
[CoreConstructor(VSystemID.Raw.N3DS)] [CoreConstructor(VSystemID.Raw.N3DS)]
public Citra(CoreLoadParameters<CitraSettings, CitraSyncSettings> lp) public Encore(CoreLoadParameters<EncoreSettings, EncoreSyncSettings> lp)
{ {
if (lp.Roms.Exists(r => r.RomPath.Contains("|"))) if (lp.Roms.Exists(r => r.RomPath.Contains("|")))
{ {
@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
CurrentCore?.Dispose(); CurrentCore?.Dispose();
ResetCitraResolver(); ResetEncoreResolver();
CurrentCore = this; CurrentCore = this;
@ -62,7 +62,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
DeterministicEmulation = lp.DeterministicEmulationRequested; DeterministicEmulation = lp.DeterministicEmulationRequested;
_userPath = lp.Comm.CoreFileProvider.GetUserPath(SystemId, temp: DeterministicEmulation) + Path.DirectorySeparatorChar; _userPath = lp.Comm.CoreFileProvider.GetUserPath(SystemId, temp: DeterministicEmulation) + Path.DirectorySeparatorChar;
_userPath = _userPath.Replace('\\', '/'); // Citra doesn't like backslashes in the user folder, for whatever reason _userPath = _userPath.Replace('\\', '/'); // Encore doesn't like backslashes in the user folder, for whatever reason
_configCallbackInterface.GetBoolean = GetBooleanSettingCallback; _configCallbackInterface.GetBoolean = GetBooleanSettingCallback;
_configCallbackInterface.GetInteger = GetIntegerSettingCallback; _configCallbackInterface.GetInteger = GetIntegerSettingCallback;
@ -71,7 +71,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
_openGLProvider = lp.Comm.OpenGLProvider; _openGLProvider = lp.Comm.OpenGLProvider;
_supportsOpenGL43 = _openGLProvider.SupportsGLVersion(4, 3); _supportsOpenGL43 = _openGLProvider.SupportsGLVersion(4, 3);
if (!_supportsOpenGL43/* && _syncSettings.GraphicsApi == CitraSyncSettings.EGraphicsApi.OpenGL*/) if (!_supportsOpenGL43/* && _syncSettings.GraphicsApi == EncoreSyncSettings.EGraphicsApi.OpenGL*/)
{ {
throw new("OpenGL 4.3 is required, but it is not supported on this machine"); throw new("OpenGL 4.3 is required, but it is not supported on this machine");
// lp.Comm.Notify("OpenGL 4.3 is not supported on this machine, falling back to software renderer", null); // lp.Comm.Notify("OpenGL 4.3 is not supported on this machine, falling back to software renderer", null);
@ -87,18 +87,18 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
_inputCallbackInterface.GetTouch = GetTouchCallback; _inputCallbackInterface.GetTouch = GetTouchCallback;
_inputCallbackInterface.GetMotion = GetMotionCallback; _inputCallbackInterface.GetMotion = GetMotionCallback;
_context = _core.Citra_CreateContext(ref _configCallbackInterface, ref _glCallbackInterface, ref _inputCallbackInterface); _context = _core.Encore_CreateContext(ref _configCallbackInterface, ref _glCallbackInterface, ref _inputCallbackInterface);
if (_supportsOpenGL43/* && _syncSettings.GraphicsApi == CitraSyncSettings.EGraphicsApi.OpenGL*/) if (_supportsOpenGL43/* && _syncSettings.GraphicsApi == EncoreSyncSettings.EGraphicsApi.OpenGL*/)
{ {
_citraVideoProvider = new CitraGLTextureProvider(_core, _context); _encoreVideoProvider = new EncoreGLTextureProvider(_core, _context);
} }
else else
{ {
_citraVideoProvider = new(_core, _context); _encoreVideoProvider = new(_core, _context);
} }
_serviceProvider.Register<IVideoProvider>(_citraVideoProvider); _serviceProvider.Register<IVideoProvider>(_encoreVideoProvider);
var sysDataDir = Path.Combine(_userPath, "sysdata"); var sysDataDir = Path.Combine(_userPath, "sysdata");
if (!Directory.Exists(sysDataDir)) if (!Directory.Exists(sysDataDir))
@ -122,7 +122,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
if (lp.Roms[0].Extension.ToLowerInvariant() == ".cia") if (lp.Roms[0].Extension.ToLowerInvariant() == ".cia")
{ {
var message = new byte[1024]; var message = new byte[1024];
var res = _core.Citra_InstallCIA(_context, romPath, message, message.Length); var res = _core.Encore_InstallCIA(_context, romPath, message, message.Length);
var outMsg = Encoding.UTF8.GetString(message).TrimEnd('\0'); var outMsg = Encoding.UTF8.GetString(message).TrimEnd('\0');
if (res) if (res)
{ {
@ -148,20 +148,20 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
throw new("ROMs after the index 0 should be CIAs"); throw new("ROMs after the index 0 should be CIAs");
} }
_core.Citra_InstallCIA(_context, lp.Roms[i].RomPath, dummyBuffer, dummyBuffer.Length); _core.Encore_InstallCIA(_context, lp.Roms[i].RomPath, dummyBuffer, dummyBuffer.Length);
} }
var errorMessage = new byte[1024]; var errorMessage = new byte[1024];
if (!_core.Citra_LoadROM(_context, romPath, errorMessage, errorMessage.Length)) if (!_core.Encore_LoadROM(_context, romPath, errorMessage, errorMessage.Length))
{ {
Dispose(); Dispose();
throw new($"{Encoding.UTF8.GetString(errorMessage).TrimEnd()}"); throw new($"{Encoding.UTF8.GetString(errorMessage).TrimEnd()}");
} }
InitMemoryDomains(); InitMemoryDomains();
// for some reason, if a savestate is created on frame 0, Citra will crash if another savestate is made after loading that state // for some reason, if a savestate is created on frame 0, Encore will crash if another savestate is made after loading that state
// advance one frame to avoid that issue // advance one frame to avoid that issue
_core.Citra_RunFrame(_context); _core.Encore_RunFrame(_context);
OnVideoRefresh(); OnVideoRefresh();
} }

View File

@ -5,7 +5,7 @@ using BizHawk.BizInvoke;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
{ {
public abstract class LibCitra public abstract class LibEncore
{ {
private const CallingConvention cc = CallingConvention.Cdecl; private const CallingConvention cc = CallingConvention.Cdecl;
@ -101,49 +101,49 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
[BizImport(cc, Compatibility = true)] [BizImport(cc, Compatibility = true)]
public abstract IntPtr Citra_CreateContext( public abstract IntPtr Encore_CreateContext(
ref ConfigCallbackInterface configCallbackInterface, ref ConfigCallbackInterface configCallbackInterface,
ref GLCallbackInterface glCallbackInterface, ref GLCallbackInterface glCallbackInterface,
ref InputCallbackInterface inputCallbackInterface); ref InputCallbackInterface inputCallbackInterface);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_DestroyContext(IntPtr context); public abstract void Encore_DestroyContext(IntPtr context);
[BizImport(cc)] [BizImport(cc)]
public abstract bool Citra_InstallCIA(IntPtr context, string ciaPath, byte[] messageBuffer, int messageBufferLen); public abstract bool Encore_InstallCIA(IntPtr context, string ciaPath, byte[] messageBuffer, int messageBufferLen);
[BizImport(cc)] [BizImport(cc)]
public abstract bool Citra_LoadROM(IntPtr context, string romPath, byte[] errorMessageBuffer, int errorMessageBufferLen); public abstract bool Encore_LoadROM(IntPtr context, string romPath, byte[] errorMessageBuffer, int errorMessageBufferLen);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_RunFrame(IntPtr context); public abstract void Encore_RunFrame(IntPtr context);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_Reset(IntPtr context); public abstract void Encore_Reset(IntPtr context);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_GetVideoDimensions(IntPtr context, out int width, out int height); public abstract void Encore_GetVideoDimensions(IntPtr context, out int width, out int height);
[BizImport(cc)] [BizImport(cc)]
public abstract int Citra_GetGLTexture(IntPtr context); public abstract int Encore_GetGLTexture(IntPtr context);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_ReadFrameBuffer(IntPtr context, int[] buffer); public abstract void Encore_ReadFrameBuffer(IntPtr context, int[] buffer);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_GetAudio(IntPtr context, out IntPtr buffer, out int frames); public abstract void Encore_GetAudio(IntPtr context, out IntPtr buffer, out int frames);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_ReloadConfig(IntPtr context); public abstract void Encore_ReloadConfig(IntPtr context);
[BizImport(cc)] [BizImport(cc)]
public abstract int Citra_StartSaveState(IntPtr context); public abstract int Encore_StartSaveState(IntPtr context);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_FinishSaveState(IntPtr context, byte[] buffer); public abstract void Encore_FinishSaveState(IntPtr context, byte[] buffer);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_LoadState(IntPtr context, byte[] buffer, int stateLen); public abstract void Encore_LoadState(IntPtr context, byte[] buffer, int stateLen);
public enum MemoryRegion public enum MemoryRegion
{ {
@ -154,9 +154,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
} }
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_GetMemoryRegion(IntPtr context, MemoryRegion region, out IntPtr ptr, out int size); public abstract void Encore_GetMemoryRegion(IntPtr context, MemoryRegion region, out IntPtr ptr, out int size);
[BizImport(cc)] [BizImport(cc)]
public abstract void Citra_GetTouchScreenLayout(IntPtr context, out int x, out int y, out int width, out int height, out bool rotated, out bool enabled); public abstract void Encore_GetTouchScreenLayout(IntPtr context, out int x, out int y, out int width, out int height, out bool rotated, out bool enabled);
} }
} }