Merge pull request 'master' (#15) from master into dev_4VirtualNes

Reviewed-on: #15
This commit is contained in:
sin365 2024-07-22 14:23:56 +08:00
commit 275f2c419f
48 changed files with 292 additions and 1 deletions

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal abstract class Bandai : Board
{
private bool irq_enable;

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal struct BankInfo
{
public bool IsRAM;

View File

@ -1,7 +1,11 @@
using System.Collections.Generic;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class BankInfoSorter : IComparer<BankInfo>
{
public int Compare(BankInfo x, BankInfo y)

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class BlankJoypad : IJoypadConnecter
{
public override void Update()

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class BlankShortuctsHandler : IShortcutsHandler
{
public void Update()

View File

@ -1,9 +1,13 @@
using System;
using System.Collections.Generic;
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal abstract class Board
{
protected byte[][] PRG_RAM;

View File

@ -1,7 +1,11 @@
using System;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class BoardInfoAttribute : Attribute
{
public string Name { get; private set; }

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class BoardInfoObject
{
public string Name { get; internal set; }

View File

@ -1,7 +1,11 @@
using System.Security.Cryptography;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class Crc32 : HashAlgorithm
{
public const uint DefaultPolynomial = 3988292384u;

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class EmuSettings : ISettings
{
public string SnapsFolder = "Snaps";

View File

@ -1,8 +1,12 @@
using System;
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class Eprom
{
private enum EpromDevice

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal abstract class FFE : Board
{
protected bool irqEnable;

View File

@ -1,7 +1,11 @@
using System.Collections.Generic;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class GameGenie
{
public string[] LettersTable = new string[16]

View File

@ -1,7 +1,11 @@
using System;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class HassIssuesAttribute : Attribute
{
}

View File

@ -1,8 +1,12 @@
using System.IO;
using System.Security.Cryptography;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class HelperTools
{
public static string GetFileSize(string FilePath)

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public abstract class IJoypadConnecter
{
protected byte DATA;

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public abstract class IRom
{
public bool IsValid { get; set; }

View File

@ -2,9 +2,13 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public abstract class ISettings
{
protected string filePath;

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public abstract class IVSUnisystemDIPConnecter
{
public abstract void Update();

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public abstract class IZapperConnecter
{
protected bool Trigger;

View File

@ -0,0 +1,74 @@
using System;
namespace Unity.IL2CPP.CompilerServices
{
/// <summary>
/// The code generation options available for IL to C++ conversion.
/// Enable or disabled these with caution.
/// </summary>
public enum Option
{
/// <summary>
/// Enable or disable code generation for null checks.
///
/// Global null check support is enabled by default when il2cpp.exe
/// is launched from the Unity editor.
///
/// Disabling this will prevent NullReferenceException exceptions from
/// being thrown in generated code. In *most* cases, code that dereferences
/// a null pointer will crash then. Sometimes the point where the crash
/// happens is later than the location where the null reference check would
/// have been emitted though.
/// </summary>
NullChecks = 1,
/// <summary>
/// Enable or disable code generation for array bounds checks.
///
/// Global array bounds check support is enabled by default when il2cpp.exe
/// is launched from the Unity editor.
///
/// Disabling this will prevent IndexOutOfRangeException exceptions from
/// being thrown in generated code. This will allow reading and writing to
/// memory outside of the bounds of an array without any runtime checks.
/// Disable this check with extreme caution.
/// </summary>
ArrayBoundsChecks = 2,
/// <summary>
/// Enable or disable code generation for divide by zero checks.
///
/// Global divide by zero check support is disabled by default when il2cpp.exe
/// is launched from the Unity editor.
///
/// Enabling this will cause DivideByZeroException exceptions to be
/// thrown in generated code. Most code doesn't need to handle this
/// exception, so it is probably safe to leave it disabled.
/// </summary>
DivideByZeroChecks = 3,
}
/// <summary>
/// Use this attribute on an assembly, struct, class, method, or property to inform the IL2CPP code conversion utility to override the
/// global setting for one of a few different runtime checks.
///
/// Example:
///
/// [Il2CppSetOption(Option.NullChecks, false)]
/// public static string MethodWithNullChecksDisabled()
/// {
/// var tmp = new Object();
/// return tmp.ToString();
/// }
/// </summary>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Delegate, Inherited = false, AllowMultiple = true)]
public class Il2CppSetOptionAttribute : Attribute
{
public Option Option { get; private set; }
public object Value { get; private set; }
public Il2CppSetOptionAttribute(Option option, object value)
{
Option = option;
Value = value;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1fa3bc95a1fade84eb4f44a94a7409b5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal abstract class MMC2 : Board
{
private byte chr_reg0A;

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class MMC5Pcm
{
internal byte output;

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class MMC5Sqr
{
private byte[][] duty_cycle_sequences = new byte[4][]

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class MNInterfaceLanguage
{
public static string Message_RomInfoCanBeOnlyShown = "Rom info can be shown only when emulation is on (i.e. game is loaded)";

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
[BoardInfo("MMC3", 4, true, true)]
internal class Mapper004 : Board
{

View File

@ -1,7 +1,9 @@
{
"name": "MyNes.Core",
"rootNamespace": "",
"references": [],
"references": [
"GUID:1c66728ad60364b82bf095d383b87458"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,

View File

@ -2,9 +2,13 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class MyNesMain
{
public static EmuSettings EmuSettings { get; private set; }

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
[WithExternalSound]
internal abstract class Namcot106 : Board
{

View File

@ -1,9 +1,13 @@
using System.Collections.Generic;
using System.IO;
using System.Xml;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class NesCartDatabase
{
private static List<NesCartDatabaseGameInfo> _databaseRoms = new List<NesCartDatabaseGameInfo>();

View File

@ -1,7 +1,11 @@
using System.Collections.Generic;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class NesCartDatabaseCartridgeInfo
{
public string System;

View File

@ -1,7 +1,11 @@
using System.Collections.Generic;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public struct NesCartDatabaseGameInfo
{
public string Game_Name;

View File

@ -1,3 +1,4 @@
using Google.Protobuf.WellKnownTypes;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -5,9 +6,15 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Xml;
using Unity.IL2CPP.CompilerServices;
using Option = Unity.IL2CPP.CompilerServices.Option;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class NesEmu
{
[StructLayout(LayoutKind.Explicit)]
@ -4063,6 +4070,9 @@ namespace MyNes.Core
ppu_clock_v = 0;
}
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
private static void PPUClock()
{
mem_board.OnPPUClock();

View File

@ -1,7 +1,11 @@
using System;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class PALBPaletteGenerator
{
public const float default_saturation = 1.496f;

View File

@ -1,8 +1,12 @@
using System.Collections.Generic;
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class PaletteFileWrapper
{
public static bool LoadFile(Stream fileStream, out int[] palette)

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class RendererSettings : ISettings
{
public string Video_ProviderID = "";

View File

@ -1,5 +1,10 @@
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class SoundDCBlockerFilter
{
private double R;

View File

@ -1,7 +1,11 @@
using System;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class SoundHighPassFilter
{
private double K;

View File

@ -1,7 +1,11 @@
using System;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class SoundLowPassFilter
{
private double K;

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class Sunsoft5BChnl
{
internal bool Enabled;

View File

@ -1,9 +1,13 @@
#define TRACE
using System;
using Unity.IL2CPP.CompilerServices;
using UnityEngine;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public sealed class Tracer
{
public static event EventHandler<TracerEventArgs> EventRaised;

View File

@ -1,7 +1,11 @@
using System;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class TracerEventArgs : EventArgs
{
public string Message { get; private set; }

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class VRC6Pulse
{
private int dutyForm;

View File

@ -1,7 +1,11 @@
using System.IO;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class VRC6Sawtooth
{
private byte AccumRate;

View File

@ -1,9 +1,13 @@
using System;
using System.IO;
using System.Text;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
public class WaveRecorder
{
private string _fileName;

View File

@ -1,7 +1,11 @@
using System;
using Unity.IL2CPP.CompilerServices;
namespace MyNes.Core
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
internal class WithExternalSoundAttribute : Attribute
{
}

View File

@ -372,6 +372,18 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 8662582775359084755, guid: d75df7d1f5a2c824ab5013cbd79da7a4, type: 3}
propertyPath: m_AnchoredPosition.x
value: -124
objectReference: {fileID: 0}
- target: {fileID: 8662582775359084755, guid: d75df7d1f5a2c824ab5013cbd79da7a4, type: 3}
propertyPath: m_AnchoredPosition.y
value: 109
objectReference: {fileID: 0}
- target: {fileID: 8662582775359084756, guid: d75df7d1f5a2c824ab5013cbd79da7a4, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8662582775964487076, guid: d75df7d1f5a2c824ab5013cbd79da7a4, type: 3}
propertyPath: m_RootOrder
value: 3