| 909 | } |
| 910 | |
| 911 | error_code cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr<u32> arg1, vm::ptr<u32> arg2) |
| 912 | { |
| 913 | const auto attr_name = get_camera_attr_name(attrib); |
| 914 | cellCamera.notice("cellCameraGetAttribute(dev_num=%d, attrib=%d=%s, arg1=*0x%x, arg2=*0x%x)", dev_num, attrib, attr_name, arg1, arg2); |
| 915 | |
| 916 | auto& g_camera = g_fxo->get<camera_thread>(); |
| 917 | |
| 918 | if (!g_camera.init) |
| 919 | { |
| 920 | return CELL_CAMERA_ERROR_NOT_INIT; |
| 921 | } |
| 922 | |
| 923 | if (!check_dev_num(dev_num)) |
| 924 | { |
| 925 | return CELL_CAMERA_ERROR_PARAM; |
| 926 | } |
| 927 | |
| 928 | if (g_cfg.io.camera == camera_handler::null) |
| 929 | { |
| 930 | return not_an_error(CELL_CAMERA_ERROR_NOT_OPEN); |
| 931 | } |
| 932 | |
| 933 | // actually compares <= 0x63 which is equivalent |
| 934 | if (attrib < CELL_CAMERA_FORMATCAP && !g_camera.is_open) |
| 935 | { |
| 936 | return CELL_CAMERA_ERROR_NOT_OPEN; |
| 937 | } |
| 938 | |
| 939 | if (!arg1) |
| 940 | { |
| 941 | return CELL_CAMERA_ERROR_PARAM; |
| 942 | } |
| 943 | |
| 944 | if (error_code error = check_resolution(dev_num)) |
| 945 | { |
| 946 | return error; |
| 947 | } |
| 948 | |
| 949 | std::lock_guard lock(g_camera.mutex); |
| 950 | |
| 951 | if (!g_camera.is_attached) |
| 952 | { |
| 953 | return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; |
| 954 | } |
| 955 | |
| 956 | if (!attr_name) // invalid attributes don't have a name |
| 957 | { |
| 958 | return CELL_CAMERA_ERROR_PARAM; |
| 959 | } |
| 960 | |
| 961 | if (arg1) |
| 962 | { |
| 963 | *arg1 = g_camera.attr[attrib].v1; |
| 964 | } |
| 965 | |
| 966 | if (arg2) |
| 967 | { |
| 968 | *arg2 = g_camera.attr[attrib].v2; |
no test coverage detected