Exemple #1
0
        public virtual int hleKernelPowerTick(int flag)
        {
            // The PSP is checking each of the lower 8 bits of the flag value to tick different
            // components.
            // Here we check only a few known bits...
            if ((flag & KERNEL_POWER_TICK_SUSPEND) == KERNEL_POWER_TICK_SUSPEND)
            {
                if (log.TraceEnabled)
                {
                    log.trace("IGNORING:sceKernelPowerTick(KERNEL_POWER_TICK_SUSPEND)");
                }
            }

            if ((flag & KERNEL_POWER_TICK_DISPLAY) == KERNEL_POWER_TICK_DISPLAY)
            {
                Screen.hleKernelPowerTick();
                if (log.TraceEnabled)
                {
                    log.trace("IGNORING:sceKernelPowerTick(KERNEL_POWER_TICK_DISPLAY)");
                }
            }

            if (flag == KERNEL_POWER_TICK_SUSPEND_AND_DISPLAY)
            {
                Screen.hleKernelPowerTick();
                if (log.TraceEnabled)
                {
                    log.trace("IGNORING:sceKernelPowerTick(KERNEL_POWER_TICK_SUSPEND_AND_DISPLAY)");
                }
            }

            return(0);
        }
Exemple #2
0
        public override int ioDevctl(string deviceName, int command, TPointer inputPointer, int inputLength, TPointer outputPointer, int outputLength)
        {
            switch (command)
            {
            case EMULATOR_DEVCTL_GET_HAS_DISPLAY:
                if (!outputPointer.AddressGood || outputLength < 4)
                {
                    return(base.ioDevctl(deviceName, command, inputPointer, inputLength, outputPointer, outputLength));
                }
                outputPointer.setValue32(Screen.hasScreen());
                break;

            case EMULATOR_DEVCTL_SEND_OUTPUT:
                sbyte[]       input        = new sbyte[inputLength];
                IMemoryReader memoryReader = MemoryReader.getMemoryReader(inputPointer.Address, inputLength, 1);
                for (int i = 0; i < inputLength; i++)
                {
                    input[i] = (sbyte)memoryReader.readNext();
                }
                string outputString = StringHelper.NewString(input);
                //if (log.DebugEnabled)
                {
                    Console.WriteLine(outputString);
                }
                AutoTestsOutput.appendString(outputString);
                break;

            case EMULATOR_DEVCTL_IS_EMULATOR:
                break;

            case EMULATOR_DEVCTL_EMIT_SCREENSHOT:
                BufferInfo   fb           = Modules.sceDisplayModule.BufferInfoFb;
                Buffer       buffer       = Memory.Instance.getBuffer(fb.topAddr, fb.bufferWidth * fb.height * getPixelFormatBytes(fb.pixelFormat));
                CaptureImage captureImage = new CaptureImage(fb.topAddr, 0, buffer, fb.width, fb.height, fb.bufferWidth, fb.pixelFormat, false, 0, false, true, null);
                captureImage.FileName   = ScreenshotFileName;
                captureImage.FileFormat = ScreenshotFormat;
                try
                {
                    captureImage.write();
                    //if (log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("Screenshot 0x{0:X8}-0x{1:X8} saved under '{2}'", fb.topAddr, fb.bottomAddr, captureImage.FileName));
                    }
                }
                catch (IOException e)
                {
                    Console.WriteLine("Emit Screenshot", e);
                }
                break;

            default:
                // Unknown command
                return(base.ioDevctl(deviceName, command, inputPointer, inputLength, outputPointer, outputLength));
            }

            return(0);
        }