示例#1
0
	void Done() {
		for (size_t i = 0; i < fonts_.size(); i++) {
			if (isfontopen_[i] == FONT_IS_OPEN) {
				fontMap[fonts_[i]]->Close();
				delete fontMap[fonts_[i]];
				fontMap.erase(fonts_[i]);
			}
		}
		u32 args[2] = { params_.userDataAddr, (u32)handle_ };
		__KernelDirectMipsCall(params_.freeFuncAddr, 0, args, 2, false);
		handle_ = 0;
		fonts_.clear();
		isfontopen_.clear();
	}
示例#2
0
// Program signals that it has written data to the ringbuffer and gets a callback ?
u32 sceMpegRingbufferPut(u32 ringbufferAddr, u32 numPackets, u32 available)
{
	DEBUG_LOG(HLE, "sceMpegRingbufferPut(%08x, %i, %i)", ringbufferAddr, numPackets, available);
	numPackets = std::min(numPackets, available);
	if (numPackets <= 0) {
		ERROR_LOG(HLE, "sub-zero number of packets put");
		return 0;
	}

	SceMpegRingBuffer ringbuffer;
	Memory::ReadStruct(ringbufferAddr, &ringbuffer);

	MpegContext *ctx = getMpegCtx(ringbuffer.mpeg);
	if (!ctx) {
		WARN_LOG(HLE, "sceMpegRingbufferPut(%08x, %i, %i): bad mpeg handle %08x", ringbufferAddr, numPackets, available, ringbuffer.mpeg);
		return 0;
	}

	// Clamp to length of mpeg stream - this seems like a hack as we don't have access to the context here really
	int mpegStreamPackets = (ctx->mpegStreamSize + ringbuffer.packetSize - 1) / ringbuffer.packetSize;
	int remainingPackets = mpegStreamPackets - ringbuffer.packetsRead;
	if (remainingPackets < 0) {
		remainingPackets = 0;
	}
	numPackets = std::min(numPackets, (u32)remainingPackets);

	// Execute callback function as a direct MipsCall, no blocking here so no messing around with wait states etc
	if (ringbuffer.callback_addr) {
		PostPutAction *action = (PostPutAction *) __KernelCreateAction(actionPostPut);
		action->setRingAddr(ringbufferAddr);
		u32 args[3] = {(u32)ringbuffer.data, numPackets, (u32)ringbuffer.callback_args};
		__KernelDirectMipsCall(ringbuffer.callback_addr, action, args, 3, false);
	} else {
		ERROR_LOG(HLE, "sceMpegRingbufferPut: callback_addr zero");
	}
	return 0;
}
示例#3
0
	void Close() {
		__KernelDirectMipsCall(params_.closeFuncAddr, 0, 0, 0, false);
	}