public virtual int scePsmfGetEPWithId(TPointer32 psmf, int id, TPointer32 outAddr) { PSMFHeader header = getPsmfHeader(psmf); PSMFEntry entry = header.getEPMapEntry(id); if (entry == null) { //if (log.DebugEnabled) { Console.WriteLine(string.Format("scePsmfGetEPWithId returning 0x{0:X8}(ERROR_PSMF_INVALID_ID)", SceKernelErrors.ERROR_PSMF_INVALID_ID)); } return(SceKernelErrors.ERROR_PSMF_INVALID_ID); } //if (log.DebugEnabled) { Console.WriteLine(string.Format("scePsmfGetEPWithId returning {0}", entry)); } outAddr.setValue(0, entry.EntryPTS); outAddr.setValue(4, entry.EntryOffset); outAddr.setValue(8, entry.EntryIndex); outAddr.setValue(12, entry.EntryPicOffset); return(0); }
public virtual int _sce_pspnet_thread_enter(TPointer32 errorAddr) { int currentThreadId = Modules.ThreadManForUserModule.CurrentThreadID; if (!allocatedThreadStructures.ContainsKey(currentThreadId)) { int size = 92; int allocateMem = Modules.sceNetIfhandleModule.hleNetMallocInternal(size); if (allocateMem < 0) { errorAddr.setValue(allocateMem); return(0); } RuntimeContext.debugMemory(allocateMem, size); Memory.Instance.memset(allocateMem, (sbyte)0, size); allocatedThreadStructures[currentThreadId] = allocateMem; } errorAddr.setValue(0); return(allocatedThreadStructures[currentThreadId]); }
public virtual int sceCtrlPeekLatch(TPointer32 latchAddr) { latchAddr.setValue(0, uiMake); latchAddr.setValue(4, uiBreak); latchAddr.setValue(8, uiPress); latchAddr.setValue(12, uiRelease); return(latchSamplingCount); }
public virtual int sceNpAuthGetMemoryStat(TPointer32 memStatAddr) { checkInitialized(); memStatAddr.setValue(0, npMemSize); memStatAddr.setValue(4, npMaxMemSize); memStatAddr.setValue(8, npFreeMemSize); return(0); }
public virtual int sceHprmReadLatch(TPointer32 latchAddr) { // Return dummy values latchAddr.setValue(0, 0); latchAddr.setValue(4, 0); latchAddr.setValue(8, 0); latchAddr.setValue(12, 0); return(0); }
public virtual int sceNetGetMallocStat(TPointer32 statAddr) { // Faking. Assume the pool is half free. int freeSize = netMemSize / 2; statAddr.setValue(0, netMemSize); // Poolsize from sceNetInit. statAddr.setValue(4, netMemSize - freeSize); // Currently in use size. statAddr.setValue(8, freeSize); // Free size. return(0); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public bool pollRecv(pspsharp.HLE.TPointer srcMacAddr, pspsharp.HLE.TPointer16 portAddr, pspsharp.HLE.TPointer data, pspsharp.HLE.TPointer32 dataLengthAddr, pspsharp.HLE.kernel.types.SceKernelThreadInfo thread) throws java.io.IOException public virtual bool pollRecv(TPointer srcMacAddr, TPointer16 portAddr, TPointer data, TPointer32 dataLengthAddr, SceKernelThreadInfo thread) { int Length = dataLengthAddr.getValue(); bool completed = false; if (rcvdMessages.Count == 0) { update(); } if (rcvdMessages.Count > 0) { AdhocBufferMessage bufferMessage = rcvdMessages.First.Value; if (Length < bufferMessage.Length) { // Buffer is too small to contain all the available data. // Return the buffer size that would be required. dataLengthAddr.setValue(bufferMessage.Length); setReturnValue(thread, SceKernelErrors.ERROR_NET_BUFFER_TOO_SMALL); } else { // Copy the data already received dataLengthAddr.setValue(bufferMessage.Length); Memory.Instance.memcpy(data.Address, buffer.addr + bufferMessage.offset, bufferMessage.Length); if (srcMacAddr != null && !srcMacAddr.Null) { bufferMessage.macAddress.write(srcMacAddr); } if (portAddr != null && portAddr.NotNull) { portAddr.Value = bufferMessage.port; } removeFirstReceivedMessage(); //if (log.DebugEnabled) { Console.WriteLine(string.Format("Returned received data: {0:D} bytes from {1} on port {2:D}", dataLengthAddr.getValue(), bufferMessage.macAddress, portAddr.Value)); if (log.TraceEnabled) { log.trace(string.Format("Returned data: {0}", Utilities.getMemoryDump(data.Address, dataLengthAddr.getValue()))); } } setReturnValue(thread, 0); } completed = true; } return(completed); }
public virtual int scePsmfPlayerGetPsmfInfo(int psmfPlayer, TPointer32 psmfInfoAddr) { if (psmfPlayerStatus < PSMF_PLAYER_STATUS_STANDBY) { return(ERROR_PSMFPLAYER_NOT_INITIALIZED); } psmfInfoAddr.setValue(0, (int)Modules.sceMpegModule.psmfHeader.mpegLastTimestamp); psmfInfoAddr.setValue(4, psmfAvcStreamNum); psmfInfoAddr.setValue(8, psmfAtracStreamNum); psmfInfoAddr.setValue(12, psmfPcmStreamNum); psmfInfoAddr.setValue(16, psmfPlayerVersion); return(0); }
public virtual int sceKernelSysClock2USecWide(long sysClock, TPointer32 secAddr, TPointer32 microSecAddr) { if (secAddr.Null) { // PSP is copying sysclock value directly to microSecAddr when secAddr is NULL microSecAddr.setValue((int)sysClock); } else { secAddr.setValue((int)(sysClock / 1000000)); microSecAddr.setValue((int)(sysClock % 1000000)); } return(0); }
public virtual int sceUpdateDownloadConnectServer(TPointer32 unknown1, TPointer32 unknown2) { unknown1.setValue(0); unknown2.setValue(0); return(SceKernelErrors.ERROR_LIB_UPDATE_LATEST_VERSION_INSTALLED); }
public virtual int sceParseHttpStatusLine(TPointer header, int headerLength, TPointer32 httpVersionMajorAddr, TPointer32 httpVersionMinorAddr, TPointer32 httpStatusCodeAddr, TPointer32 httpStatusCommentAddr, TPointer32 httpStatusCommentLengthAddr) { IMemoryReader memoryReader = MemoryReader.getMemoryReader(header.Address, headerLength, 1); string headerString = getHeaderString(memoryReader); Pattern pattern = Pattern.compile("HTTP/(\\d)\\.(\\d)\\s+(\\d+)(.*)"); Matcher matcher = pattern.matcher(headerString); if (!matcher.matches()) { return(-1); } int httpVersionMajor = int.Parse(matcher.group(1)); int httpVersionMinor = int.Parse(matcher.group(2)); int httpStatusCode = int.Parse(matcher.group(3)); string httpStatusComment = matcher.group(4); httpVersionMajorAddr.setValue(httpVersionMajor); httpVersionMinorAddr.setValue(httpVersionMinor); httpStatusCodeAddr.setValue(httpStatusCode); httpStatusCommentAddr.setValue(header.Address + headerString.IndexOf(httpStatusComment, StringComparison.Ordinal)); httpStatusCommentLengthAddr.setValue(httpStatusComment.Length); return(0); }
public virtual int scePsmfPlayerGetCurrentPlayMode(int psmfPlayer, TPointer32 playModeAddr, TPointer32 playSpeedAddr) { playModeAddr.setValue(playMode); playSpeedAddr.setValue(playSpeed); return(0); }
public virtual int sceKernelCancelMutex(int uid, int newcount, TPointer32 numWaitThreadAddr) { SceKernelMutexInfo info = mutexMap[uid]; if (info == null) { Console.WriteLine("sceKernelCancelMutex unknown UID " + uid.ToString("x")); return(ERROR_KERNEL_MUTEX_NOT_FOUND); } if (info.lockedCount == 0) { Console.WriteLine("sceKernelCancelMutex UID " + uid.ToString("x") + " not locked"); return(-1); } if (newcount < 0) { newcount = info.initCount; } if (newcount > 1 && (info.attr & PSP_MUTEX_ATTR_ALLOW_RECURSIVE) == 0) { Console.WriteLine(string.Format("sceKernelCancelMutex uid={0:D}, newcount={1:D} - illegal count", uid, newcount)); return(SceKernelErrors.ERROR_KERNEL_ILLEGAL_COUNT); } // Write previous numWaitThreads count. numWaitThreadAddr.setValue(info.NumWaitingThreads); info.threadWaitingList.removeAllWaitingThreads(); // Set new count. info.lockedCount = newcount; onMutexCancelled(uid); return(0); }
public virtual int sceCtrlGetIdleCancelThreshold(TPointer32 idleresetAddr, TPointer32 idlebackAddr) { idleresetAddr.setValue(idlereset); idlebackAddr.setValue(idleback); return(0); }
public virtual int sceLoadCertFromFlash(int unknown1, int unknown2, TPointer32 unknown3, int unknown4, int unknown5, TPointer32 unknown6) { unknown3.setValue(0); unknown6.setValue(7100); return(0); }
public virtual int sceNpGetContentRatingFlag(TPointer32 parentalControlAddr, TPointer32 userAgeAddr) { parentalControlAddr.setValue(parentalControl); userAgeAddr.setValue(UserAge); return(0); }
public virtual int mp4msv_07C60A23(TPointer unknown1, TPointer32 unknown2, TPointer32 unknown3) { unknown1.setValue32(0); unknown2.setValue(0); return(0); }
public virtual int sceKernelCancelSema(int semaid, int newcount, TPointer32 numWaitThreadAddr) { SceKernelSemaInfo sema = semaMap[semaid]; if (newcount > sema.maxCount) { return(ERROR_KERNEL_ILLEGAL_COUNT); } // Write previous numWaitThreads count. numWaitThreadAddr.setValue(sema.NumWaitThreads); sema.threadWaitingList.removeAllWaitingThreads(); // Reset this semaphore's count based on newcount. // Note: If newcount is negative, the count becomes this semaphore's initCount. if (newcount < 0) { sema.currentCount = sema.initCount; } else { sema.currentCount = newcount; } onSemaphoreCancelled(semaid); return(0); }
private bool checkEventFlag(SceKernelEventFlagInfo @event, int bits, int wait, TPointer32 outBitsAddr) { bool matched = false; if (((wait & PSP_EVENT_WAITANDOR_MASK) == PSP_EVENT_WAITAND) && ((@event.currentPattern & bits) == bits)) { matched = true; } else if (((wait & PSP_EVENT_WAITANDOR_MASK) == PSP_EVENT_WAITOR) && ((@event.currentPattern & bits) != 0)) { matched = true; } if (matched) { // Write current pattern. outBitsAddr.setValue(@event.currentPattern); if (log.DebugEnabled && outBitsAddr.NotNull) { Console.WriteLine(string.Format("checkEventFlag returning outBits=0x{0:X} at {1}", outBitsAddr.getValue(), outBitsAddr)); } if ((wait & PSP_EVENT_WAITCLEARALL) == PSP_EVENT_WAITCLEARALL) { @event.currentPattern = 0; } if ((wait & PSP_EVENT_WAITCLEAR) == PSP_EVENT_WAITCLEAR) { @event.currentPattern &= ~bits; } } return(matched); }
private int hleKernelAllocateFpl(int uid, TPointer32 dataAddr, TPointer32 timeoutAddr, bool wait, bool doCallbacks) { SceKernelFplInfo fpl = fplMap[uid]; int addr = tryAllocateFpl(fpl); ThreadManForUser threadMan = Modules.ThreadManForUserModule; if (addr == 0) { //if (log.DebugEnabled) { Console.WriteLine(string.Format("hleKernelAllocateFpl {0} fast check failed", fpl)); } if (!wait) { return(ERROR_KERNEL_WAIT_CAN_NOT_WAIT); } // Go to wait state SceKernelThreadInfo currentThread = threadMan.CurrentThread; fpl.threadWaitingList.addWaitingThread(currentThread); currentThread.wait.Fpl_id = uid; currentThread.wait.Fpl_dataAddr = dataAddr; threadMan.hleKernelThreadEnterWaitState(PSP_WAIT_FPL, uid, fplWaitStateChecker, timeoutAddr.Address, doCallbacks); } else { // Success, do not reschedule the current thread. //if (log.DebugEnabled) { Console.WriteLine(string.Format("hleKernelAllocateFpl {0} fast check succeeded", fpl)); } dataAddr.setValue(addr); } return(0); }
public virtual int sceAudiocodecAlcExtendParameter(TPointer workArea, int codecType, TPointer32 sizeAddr) { int outputBufferSize = getOutputBufferSize(workArea, codecType); sizeAddr.setValue(outputBufferSize); return(0); }
public virtual int sceKernelLibcTime(TPointer32 time_t_addr) { int seconds = (int)(new DateTime().Ticks / 1000); time_t_addr.setValue(seconds); return(seconds); }
public virtual int sceDNASGetState(TPointer32 stateAddr, TPointer32 errorCodeAddr) { stateAddr.setValue(0); errorCodeAddr.setValue(0); Managers.eventFlags.sceKernelSetEventFlag(eventFlagUid, 1); return(0); }
public virtual int scePsmfGetStreamSize(TPointer32 psmf, TPointer32 sizeAddr) { PSMFHeader header = getPsmfHeader(psmf); sizeAddr.setValue(header.StreamSize); return(0); }
public virtual int scePsmfGetAudioInfo(TPointer32 psmf, TPointer32 audioInfoAddr) { PSMFHeader header = getPsmfHeader(psmf); if (!header.ValidCurrentStreamNumber) { //if (log.DebugEnabled) { Console.WriteLine(string.Format("scePsmfGetAudioInfo returning 0x{0:X8}(ERROR_PSMF_INVALID_ID)", SceKernelErrors.ERROR_PSMF_INVALID_ID)); } return(SceKernelErrors.ERROR_PSMF_INVALID_ID); } audioInfoAddr.setValue(0, header.AudioChannelConfig); audioInfoAddr.setValue(4, header.AudioSampleFrequency); return(0); }
public virtual int scePsmfGetVideoInfo(TPointer32 psmf, TPointer32 videoInfoAddr) { PSMFHeader header = getPsmfHeader(psmf); if (!header.ValidCurrentStreamNumber) { //if (log.DebugEnabled) { Console.WriteLine(string.Format("scePsmfGetVideoInfo returning 0x{0:X8}(ERROR_PSMF_INVALID_ID)", SceKernelErrors.ERROR_PSMF_INVALID_ID)); } return(SceKernelErrors.ERROR_PSMF_INVALID_ID); } videoInfoAddr.setValue(0, header.VideoWidth); videoInfoAddr.setValue(4, header.VideoHeight); return(0); }
public virtual int memlmd_EF73E85B(TPointer buffer, int size, TPointer32 resultSize) { resultSize.setValue(size); Modules.LoadCoreForKernelModule.decodeInitModuleData(buffer, size, resultSize); return(0); }
public virtual int scePwm_driver_36F98EBA(int unknown1, TPointer16 unknown2, TPointer16 unknown3, TPointer32 unknown4) { unknown2.Value = 0; unknown3.Value = 0; unknown4.setValue(0); return(0); }
public virtual int scePsmfSetPsmf(TPointer32 psmf, TPointer bufferAddr) { Modules.sceMpegModule.analyseMpeg(bufferAddr.Address); PSMFHeader header = Modules.sceMpegModule.psmfHeader; psmfHeaderMap[bufferAddr.Address] = header; // PSMF struct: // This is an internal system data area which is used to store // several parameters of the file being handled. // It's size ranges from 28 bytes to 52 bytes, since when a pointer to // a certain PSMF area does not exist (NULL), it's omitted from the struct // (e.g.: no mark data or non existant EPMap). psmf.setValue(0, header.Version); // PSMF version. psmf.setValue(4, header.HeaderSize); // The PSMF header size (0x800). psmf.setValue(8, header.StreamSize); // The PSMF stream size. psmf.setValue(12, 0); // Grouping Period ID. psmf.setValue(16, 0); // Group ID. psmf.setValue(20, header.CurrentStreamNumber); // Current stream's number. psmf.setValue(24, bufferAddr.Address); // Pointer to PSMF header. // psmf + 28 - Pointer to current PSMF stream info (video/audio). // psmf + 32 - Pointer to mark data (used for chapters in UMD_VIDEO). // psmf + 36 - Pointer to current PSMF stream grouping period. // psmf + 40 - Pointer to current PSMF stream group. // psmf + 44 - Pointer to current PSMF stream. // psmf + 48 - Pointer to PSMF EPMap. return(0); }
public virtual int scePsmfQueryStreamSize(TPointer bufferAddr, TPointer32 sizeAddr) { // Always let sceMpeg handle the PSMF analysis. Modules.sceMpegModule.analyseMpeg(bufferAddr.Address); sizeAddr.setValue(Modules.sceMpegModule.psmfHeader.mpegStreamSize); return(0); }