OSDN Git Service

[General][VM] Add Casio FX-9000P, truely merge upstream 2022-04-05.
[csp-qt/common_source_project-fm7.git] / source / src / winplugin / Scripts / pyuta_unity.cs
index 9144409..5ca9c9a 100644 (file)
@@ -1,84 +1,84 @@
-using UnityEngine;
-using System;
-using System.Collections;
-using System.Runtime.InteropServices;
-
-public class pyuta_unity : MonoBehaviour
-{
-    [DllImport("pyuta_unity")]
-    private static extern IntPtr Init();
-    [DllImport("pyuta_unity")]
-    private static extern void Exec();
-    [DllImport("pyuta_unity")]
-    private static extern void StopEmulation();
-    [DllImport("pyuta_unity")]
-    private static extern IntPtr CheckResident();
-    [DllImport("pyuta_unity")]
-    private static extern int GetEmulWidth(IntPtr ptr);
-    [DllImport("pyuta_unity")]
-    private static extern int GetEmulHeight(IntPtr ptr);
-    [DllImport("pyuta_unity")]
-    private static extern void SetEmulTexturePtr(IntPtr ptr, IntPtr texture);
-    [DllImport("pyuta_unity")]
-    private static extern void SetEmulPause(IntPtr ptr, bool fPause);
-
-    [DllImport("pyuta_unity")]
-    private static extern IntPtr GetRenderEventFunc();
-
-    private IntPtr _emul = IntPtr.Zero;
-
-    void Start()
-    {
-        Debug.Log("***Start");
-
-        _emul = CheckResident();
-
-        var tex = new Texture2D(
-            GetEmulWidth(_emul),
-            GetEmulHeight(_emul),
-            TextureFormat.ARGB32,
-            false);
-        GetComponent<Renderer>().material.mainTexture = tex;
-
-        SetEmulTexturePtr(_emul, tex.GetNativeTexturePtr());
-
-        SetEmulPause(_emul, false);
-        Exec();
-        StartCoroutine(OnRender());
-
-    }
-
-    void OnDisable()
-    {
-        Debug.Log("***OnDisable");
-        if (_emul == IntPtr.Zero) return;
-
-        Debug.Log("**Disable:Pause On");       // エディタでの停止
-        SetEmulPause(_emul, true);
-    }
-
-    void OnEnable()
-    {
-        Debug.Log("***OnEnable");
-        if (_emul == IntPtr.Zero) return;
-
-        Debug.Log("**Enable:Pause Off");       // エディタでの再開
-        SetEmulPause(_emul, false);
-    }
-
-    private void OnDestroy()
-    {
-        Debug.Log("***OnDestroy");
-        StopEmulation();
-    }
-
-
-
-    IEnumerator OnRender()
-       {
-               for (;;) {
-                       yield return new WaitForEndOfFrame();
-                       GL.IssuePluginEvent(GetRenderEventFunc(), 0);
-               }
-       }
-}
+using UnityEngine;\r
+using System;\r
+using System.Collections;\r
+using System.Runtime.InteropServices;\r
+\r
+public class pyuta_unity : MonoBehaviour\r
+{\r
+    [DllImport("pyuta_unity")]\r
+    private static extern IntPtr Init();\r
+    [DllImport("pyuta_unity")]\r
+    private static extern void Exec();\r
+    [DllImport("pyuta_unity")]\r
+    private static extern void StopEmulation();\r
+    [DllImport("pyuta_unity")]\r
+    private static extern IntPtr CheckResident();\r
+    [DllImport("pyuta_unity")]\r
+    private static extern int GetEmulWidth(IntPtr ptr);\r
+    [DllImport("pyuta_unity")]\r
+    private static extern int GetEmulHeight(IntPtr ptr);\r
+    [DllImport("pyuta_unity")]\r
+    private static extern void SetEmulTexturePtr(IntPtr ptr, IntPtr texture);\r
+    [DllImport("pyuta_unity")]\r
+    private static extern void SetEmulPause(IntPtr ptr, bool fPause);\r
+\r
+    [DllImport("pyuta_unity")]\r
+    private static extern IntPtr GetRenderEventFunc();\r
+\r
+    private IntPtr _emul = IntPtr.Zero;\r
+\r
+    void Start()\r
+    {\r
+        Debug.Log("***Start");\r
+\r
+        _emul = CheckResident();\r
+\r
+        var tex = new Texture2D(\r
+            GetEmulWidth(_emul),\r
+            GetEmulHeight(_emul),\r
+            TextureFormat.ARGB32,\r
+            false);\r
+        GetComponent<Renderer>().material.mainTexture = tex;\r
+\r
+        SetEmulTexturePtr(_emul, tex.GetNativeTexturePtr());\r
+\r
+        SetEmulPause(_emul, false);\r
+        Exec();\r
+        StartCoroutine(OnRender());\r
+\r
+    }\r
+\r
+    void OnDisable()\r
+    {\r
+        Debug.Log("***OnDisable");\r
+        if (_emul == IntPtr.Zero) return;\r
+\r
+        Debug.Log("**Disable:Pause On");       // エディタでの停止\r
+        SetEmulPause(_emul, true);\r
+    }\r
+\r
+    void OnEnable()\r
+    {\r
+        Debug.Log("***OnEnable");\r
+        if (_emul == IntPtr.Zero) return;\r
+\r
+        Debug.Log("**Enable:Pause Off");       // エディタでの再開\r
+        SetEmulPause(_emul, false);\r
+    }\r
+\r
+    private void OnDestroy()\r
+    {\r
+        Debug.Log("***OnDestroy");\r
+        StopEmulation();\r
+    }\r
+\r
+\r
+\r
+    IEnumerator OnRender()\r
+       {\r
+               for (;;) {\r
+                       yield return new WaitForEndOfFrame();\r
+                       GL.IssuePluginEvent(GetRenderEventFunc(), 0);\r
+               }\r
+       }\r
+}\r