Exemple #1
0
error_code cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutState> state)
{
    cellSysutil.trace("cellVideoOutGetState(videoOut=%d, deviceIndex=%d, state=*0x%x)", videoOut, deviceIndex, state);

    if (deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;

    switch (videoOut)
    {
    case CELL_VIDEO_OUT_PRIMARY:
        state->state = CELL_VIDEO_OUT_OUTPUT_STATE_ENABLED;
        state->colorSpace = CELL_VIDEO_OUT_COLOR_SPACE_RGB;
        state->displayMode.resolutionId = g_cfg_video_out_resolution.get(); // TODO
        state->displayMode.scanMode = CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE;
        state->displayMode.conversion = CELL_VIDEO_OUT_DISPLAY_CONVERSION_NONE;
        state->displayMode.aspect = g_cfg_video_out_aspect_ratio.get(); // TODO
        state->displayMode.refreshRates = CELL_VIDEO_OUT_REFRESH_RATE_59_94HZ;
        return CELL_OK;

    case CELL_VIDEO_OUT_SECONDARY:
        *state = { CELL_VIDEO_OUT_OUTPUT_STATE_DISABLED }; // ???
        return CELL_OK;
    }

    return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
}
Exemple #2
0
error_code cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutDeviceInfo> info)
{
    cellSysutil.warning("cellVideoOutGetDeviceInfo(videoOut=%d, deviceIndex=%d, info=*0x%x)", videoOut, deviceIndex, info);

    if (deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;

    // Use standard dummy values for now.
    info->portType = CELL_VIDEO_OUT_PORT_HDMI;
    info->colorSpace = CELL_VIDEO_OUT_COLOR_SPACE_RGB;
    info->latency = 100;
    info->availableModeCount = 1;
    info->state = CELL_VIDEO_OUT_DEVICE_STATE_AVAILABLE;
    info->rgbOutputRange = 1;
    info->colorInfo.blueX = 0xFFFF;
    info->colorInfo.blueY = 0xFFFF;
    info->colorInfo.greenX = 0xFFFF;
    info->colorInfo.greenY = 0xFFFF;
    info->colorInfo.redX = 0xFFFF;
    info->colorInfo.redY = 0xFFFF;
    info->colorInfo.whiteX = 0xFFFF;
    info->colorInfo.whiteY = 0xFFFF;
    info->colorInfo.gamma = 100;
    info->availableModes[0].aspect = g_cfg_video_out_aspect_ratio.get();
    info->availableModes[0].conversion = CELL_VIDEO_OUT_DISPLAY_CONVERSION_NONE;
    info->availableModes[0].refreshRates =  CELL_VIDEO_OUT_REFRESH_RATE_60HZ;
    info->availableModes[0].resolutionId = g_cfg_video_out_resolution.get();
    info->availableModes[0].scanMode = CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE;
    return CELL_OK;
}
Exemple #3
0
error_code cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option)
{
    cellSysutil.warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, aspect=%d, option=%d)", videoOut, resolutionId, aspect, option);

    switch (videoOut)
    {
    case CELL_VIDEO_OUT_PRIMARY:
        return not_an_error(
                   resolutionId == g_cfg_video_out_resolution.get()
                   && (aspect == CELL_VIDEO_OUT_ASPECT_AUTO || aspect == g_cfg_video_out_aspect_ratio.get())
               );
    case CELL_VIDEO_OUT_SECONDARY:
        return not_an_error(0);
    }

    return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
}
Exemple #4
0
s32 cellCameraIsAttached(s32 dev_num)
{
	cellCamera.warning("cellCameraIsAttached(dev_num=%d)", dev_num);

	if (g_cfg_camera.get())
	{
		return 1;
	}

	return 0; // It's not CELL_OK lol
}
Exemple #5
0
s32 cellCameraGetType(s32 dev_num, vm::ptr<s32> type)
{
	cellCamera.warning("cellCameraGetType(dev_num=%d, type=*0x%x)", dev_num, type);

	const auto camera = fxm::get<camera_t>();

	if (!camera)
	{
		return CELL_CAMERA_ERROR_NOT_INIT;
	}

	*type = g_cfg_camera_type.get();
	return CELL_OK;
}
Exemple #6
0
error_code cellVideoOutGetConfiguration(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option)
{
    cellSysutil.warning("cellVideoOutGetConfiguration(videoOut=%d, config=*0x%x, option=*0x%x)", videoOut, config, option);

    if (option) *option = {};
    *config = {};

    switch (videoOut)
    {
    case CELL_VIDEO_OUT_PRIMARY:
        config->resolutionId = g_cfg_video_out_resolution.get();
        config->format = CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8;
        config->aspect = g_cfg_video_out_aspect_ratio.get();
        config->pitch = 4 * g_video_out_resolution_map.at(g_cfg_video_out_resolution.get()).first;

        return CELL_OK;

    case CELL_VIDEO_OUT_SECONDARY:

        return CELL_OK;
    }

    return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
}
Exemple #7
0
error_code cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option, u32 waitForEvent)
{
    cellSysutil.warning("cellVideoOutConfigure(videoOut=%d, config=*0x%x, option=*0x%x, waitForEvent=%d)", videoOut, config, option, waitForEvent);

    switch (videoOut)
    {
    case CELL_VIDEO_OUT_PRIMARY:
        if (config->resolutionId != g_cfg_video_out_resolution.get()
                || config->format != CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8
                || (config->aspect != CELL_VIDEO_OUT_ASPECT_AUTO && config->aspect != g_cfg_video_out_aspect_ratio.get()))
        {
            return CELL_VIDEO_OUT_ERROR_ILLEGAL_CONFIGURATION;
        }
        return CELL_OK;

    case CELL_VIDEO_OUT_SECONDARY:
        return CELL_OK;
    }

    return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
}
Exemple #8
0
bool Rpcs3App::OnInit()
{
	static const wxCmdLineEntryDesc desc[]
	{
		{ wxCMD_LINE_SWITCH, "h", "help", "Command line options:\nh (help): Help and commands\nt (test): For directly executing a (S)ELF", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
		{ wxCMD_LINE_SWITCH, "t", "test", "Run in test mode on (S)ELF", wxCMD_LINE_VAL_NONE },
		{ wxCMD_LINE_PARAM, NULL, NULL, "(S)ELF", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
		{ wxCMD_LINE_NONE }
	};
	
	parser.SetDesc(desc);
	parser.SetCmdLine(argc, argv);

	if (parser.Parse())
	{
		// help was given, terminating
		this->Exit();
	}

	s_gui_cfg.open(fs::get_config_dir() + "/config_gui.yml", fs::read + fs::write + fs::create);
	g_gui_cfg = YAML::Load(s_gui_cfg.to_string());

	EmuCallbacks callbacks;

	callbacks.call_after = [](std::function<void()> func)
	{
		wxGetApp().CallAfter(std::move(func));
	};

	callbacks.process_events = [this]()
	{
		m_MainFrame->Update();
		wxGetApp().ProcessPendingEvents();
	};

	callbacks.exit = [this]()
	{
		wxGetApp().Exit();
	};

	callbacks.send_dbg_command = [](DbgCommand id, cpu_thread* t)
	{
		wxGetApp().SendDbgCommand(id, t);
	};

	callbacks.get_kb_handler = PURE_EXPR(g_cfg_kb_handler.get()());

	callbacks.get_mouse_handler = PURE_EXPR(g_cfg_mouse_handler.get()());

	callbacks.get_pad_handler = PURE_EXPR(g_cfg_pad_handler.get()());

	callbacks.get_gs_frame = [](frame_type type, int w, int h) -> std::unique_ptr<GSFrameBase>
	{
		switch (type)
		{
		case frame_type::OpenGL: return std::make_unique<GLGSFrame>(w, h);
		case frame_type::DX12: return std::make_unique<GSFrame>("DirectX 12", w, h);
		case frame_type::Null: return std::make_unique<GSFrame>("Null", w, h);
		case frame_type::Vulkan: return std::make_unique<GSFrame>("Vulkan", w, h);
		}

		throw EXCEPTION("Invalid Frame Type (0x%x)", type);
	};

	callbacks.get_gs_render = PURE_EXPR(g_cfg_gs_render.get()());

	callbacks.get_audio = PURE_EXPR(g_cfg_audio_render.get()());

	callbacks.get_msg_dialog = []() -> std::shared_ptr<MsgDialogBase>
	{
		return std::make_shared<MsgDialogFrame>();
	};

	callbacks.get_save_dialog = []() -> std::unique_ptr<SaveDialogBase>
	{
		return std::make_unique<SaveDialogFrame>();
	};

	Emu.SetCallbacks(std::move(callbacks));

	TheApp = this;
	SetAppName("RPCS3");
	wxInitAllImageHandlers();

	Emu.Init();

	m_MainFrame = new MainFrame();
	SetTopWindow(m_MainFrame);
	m_MainFrame->Show();
	m_MainFrame->DoSettings(true);

	OnArguments(parser);

	return true;
}
Exemple #9
0
void PPUThread::cpu_task()
{
	//SetHostRoundingMode(FPSCR_RN_NEAR);

	if (custom_task)
	{
		if (check_status()) return;

		return custom_task(*this);
	}

	g_tls_log_prefix = []
	{
		const auto cpu = static_cast<PPUThread*>(get_current_cpu_thread());

		return fmt::format("%s [0x%08x]", cpu->get_name(), cpu->pc);
	};

	const auto base = vm::_ptr<const u8>(0);

	// Select opcode table
	const auto& table = *(
		g_cfg_ppu_decoder.get() == ppu_decoder_type::precise ? &s_ppu_interpreter_precise.get_table() :
		g_cfg_ppu_decoder.get() == ppu_decoder_type::fast ? &s_ppu_interpreter_fast.get_table() :
		throw std::logic_error("Invalid PPU decoder"));

	v128 _op;
	decltype(&ppu_interpreter::UNK) func0, func1, func2, func3;

	while (true)
	{
		if (UNLIKELY(state.load()))
		{
			if (check_status()) return;
		}

		// Reinitialize
		{
			const auto _ops = _mm_shuffle_epi8(_mm_lddqu_si128(reinterpret_cast<const __m128i*>(base + pc)), _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3));
			_op.vi = _ops;
			const v128 _i = v128::fromV(_mm_and_si128(_mm_or_si128(_mm_slli_epi32(_op.vi, 6), _mm_srli_epi32(_op.vi, 26)), _mm_set1_epi32(0x1ffff)));
			func0 = table[_i._u32[0]];
			func1 = table[_i._u32[1]];
			func2 = table[_i._u32[2]];
			func3 = table[_i._u32[3]];
		}

		while (LIKELY(func0(*this, { _op._u32[0] })))
		{
			if (pc += 4, LIKELY(func1(*this, { _op._u32[1] })))
			{
				if (pc += 4, LIKELY(func2(*this, { _op._u32[2] })))
				{
					pc += 4;
					func0 = func3;

					const auto _ops = _mm_shuffle_epi8(_mm_lddqu_si128(reinterpret_cast<const __m128i*>(base + pc + 4)), _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3));
					_op.vi = _mm_alignr_epi8(_ops, _op.vi, 12);
					const v128 _i = v128::fromV(_mm_and_si128(_mm_or_si128(_mm_slli_epi32(_op.vi, 6), _mm_srli_epi32(_op.vi, 26)), _mm_set1_epi32(0x1ffff)));
					func1 = table[_i._u32[1]];
					func2 = table[_i._u32[2]];
					func3 = table[_i._u32[3]];

					if (UNLIKELY(state.load()))
					{
						break;
					}
					continue;
				}
				break;
			}
			break;
		}
	}
}
Exemple #10
0
s32 cellSysutilGetSystemParamInt(s32 id, vm::ptr<s32> value)
{
	cellSysutil.warning("cellSysutilGetSystemParamInt(id=%s, value=*0x%x)", systemparam_id_name(id), value);

	// TODO: load this information from config (preferably "sys/" group)

	switch(id)
	{
	case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
		*value = g_cfg_sys_language.get();
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN:
		*value = CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT:
		*value = CELL_SYSUTIL_DATE_FMT_DDMMYYYY;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT:
		*value = CELL_SYSUTIL_TIME_FMT_CLOCK24;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE:
		*value = 180;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL:
		*value = CELL_SYSUTIL_GAME_PARENTAL_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT:
		*value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ:
		*value = CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE:
		*value = CELL_SYSUTIL_PAD_RUMBLE_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF:
		*value = 0;
	break;

	default:
		return CELL_EINVAL;
	}

	return CELL_OK;
}
Exemple #11
0
s32 cellCameraInit()
{
	cellCamera.warning("cellCameraInit()");

	if (!g_cfg_camera.get())
	{
		return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
	}

	const auto camera = fxm::make<camera_t>();

	if (!camera)
	{
		return CELL_CAMERA_ERROR_ALREADY_INIT;
	}

	switch (g_cfg_camera_type.get())
	{
	case CELL_CAMERA_EYETOY:
	{
		camera->attr[CELL_CAMERA_SATURATION] = { 164 };
		camera->attr[CELL_CAMERA_BRIGHTNESS] = { 96 };
		camera->attr[CELL_CAMERA_AEC] = { 1 };
		camera->attr[CELL_CAMERA_AGC] = { 1 };
		camera->attr[CELL_CAMERA_AWB] = { 1 };
		camera->attr[CELL_CAMERA_ABC] = { 0 };
		camera->attr[CELL_CAMERA_LED] = { 1 };
		camera->attr[CELL_CAMERA_QS] = { 0 };
		camera->attr[CELL_CAMERA_NONZEROCOEFFS] = { 32, 32 };
		camera->attr[CELL_CAMERA_YUVFLAG] = { 0 };
		camera->attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 };
		camera->attr[CELL_CAMERA_MIRRORFLAG] = { 1 };
		camera->attr[CELL_CAMERA_422FLAG] = { 1 };
		camera->attr[CELL_CAMERA_USBLOAD] = { 4 };
	}
	break;

	case CELL_CAMERA_EYETOY2:
	{
		camera->attr[CELL_CAMERA_SATURATION] = { 64 };
		camera->attr[CELL_CAMERA_BRIGHTNESS] = { 8 };
		camera->attr[CELL_CAMERA_AEC] = { 1 };
		camera->attr[CELL_CAMERA_AGC] = { 1 };
		camera->attr[CELL_CAMERA_AWB] = { 1 };
		camera->attr[CELL_CAMERA_LED] = { 1 };
		camera->attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 };
		camera->attr[CELL_CAMERA_MIRRORFLAG] = { 1 };
		camera->attr[CELL_CAMERA_GAMMA] = { 1 };
		camera->attr[CELL_CAMERA_AGCLIMIT] = { 4 };
		camera->attr[CELL_CAMERA_DENOISE] = { 0 };
		camera->attr[CELL_CAMERA_FRAMERATEADJUST] = { 0 };
		camera->attr[CELL_CAMERA_PIXELOUTLIERFILTER] = { 1 };
		camera->attr[CELL_CAMERA_AGCLOW] = { 48 };
		camera->attr[CELL_CAMERA_AGCHIGH] = { 64 };
	}

	break;

	default: break;
	}

	// TODO: Some other default attributes? Need to check the actual behaviour on a real PS3.

	return CELL_OK;
}