예제 #1
0
        public static int FileData2SoftImage(byte[] fileData)
        {
            int siHandle = -1;

            DDSystem.PinOn(fileData, p => siHandle = DX.LoadSoftImageToMem(p, fileData.Length));

            if (siHandle == -1)
            {
                throw new DDError();
            }

            int w;
            int h;

            GetSoftImageSize(siHandle, out w, out h);

            // RGB -> RGBA
            {
                int h2 = DX.MakeARGB8ColorSoftImage(w, h);

                if (h2 == -1)                 // ? 失敗
                {
                    throw new DDError();
                }

                if (DX.BltSoftImage(0, 0, w, h, siHandle, 0, 0, h2) != 0)                 // ? 失敗
                {
                    throw new DDError();
                }

                if (DX.DeleteSoftImage(siHandle) != 0)                 // ? 失敗
                {
                    throw new DDError();
                }

                siHandle = h2;
            }

            return(siHandle);
        }
예제 #2
0
        public int GetHandle(int handleIndex)
        {
            if (this.Handles == null)
            {
                this.Handles = new int[this.HandleCount];

                {
                    byte[] fileData = this.Func_GetFileData();
                    int    handle   = -1;

                    DDSystem.PinOn(fileData, p => handle = DX.LoadSoundMemByMemImage(p, fileData.Length));

                    if (handle == -1)                     // ? 失敗
                    {
                        throw new DDError();
                    }

                    this.Handles[0] = handle;
                }

                for (int index = 1; index < this.HandleCount; index++)
                {
                    int handle = DX.DuplicateSoundMem(this.Handles[0]);

                    if (handle == -1)                     // ? 失敗
                    {
                        throw new DDError();
                    }

                    this.Handles[index] = handle;
                }

                this.PostLoaded();
            }
            return(this.Handles[handleIndex]);
        }
예제 #3
0
 //
 //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
 //
 public static void INIT()
 {
     DDSystem.Pin(StatusMap);
 }