Merge branch 'master' into core-macros-1

This commit is contained in:
Daniel Lim Wee Soong 2018-06-11 22:30:21 +08:00 committed by GitHub
commit f0ea96f144
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 717 additions and 480 deletions

View file

@ -3866,6 +3866,8 @@ SWI_INST : {
num_instrs >= cpu->NumInstrsToExecute ? 0 : cpu->NumInstrsToExecute - num_instrs;
num_instrs = 0;
Kernel::CallSVC(inst_cream->num & 0xFFFF);
// The kernel would call ERET to get here, which clears exclusive memory state.
cpu->UnsetExclusiveMemoryAddress();
}
cpu->Reg[15] += cpu->GetInstructionSize();

View file

@ -17,28 +17,29 @@ void RegisterFactory(const std::string& name, std::unique_ptr<CameraFactory> fac
factories[name] = std::move(factory);
}
std::unique_ptr<CameraInterface> CreateCamera(const std::string& name, const std::string& config) {
std::unique_ptr<CameraInterface> CreateCamera(const std::string& name, const std::string& config,
const Service::CAM::Flip& flip) {
auto pair = factories.find(name);
if (pair != factories.end()) {
return pair->second->Create(config);
return pair->second->Create(config, flip);
}
if (name != "blank") {
NGLOG_ERROR(Service_CAM, "Unknown camera \"{}\"", name);
NGLOG_ERROR(Service_CAM, "Unknown camera {}", name);
}
return std::make_unique<BlankCamera>();
}
std::unique_ptr<CameraInterface> CreateCameraPreview(const std::string& name,
const std::string& config, int width,
int height) {
int height, const Service::CAM::Flip& flip) {
auto pair = factories.find(name);
if (pair != factories.end()) {
return pair->second->CreatePreview(config, width, height);
return pair->second->CreatePreview(config, width, height, flip);
}
if (name != "blank") {
NGLOG_ERROR(Service_CAM, "Unknown camera \"{}\"", name);
NGLOG_ERROR(Service_CAM, "Unknown camera {}", name);
}
return std::make_unique<BlankCamera>();
}

View file

@ -18,22 +18,26 @@ public:
* Creates a camera object based on the configuration string.
* @param config Configuration string to create the camera. The implementation can decide the
* meaning of this string.
* @param flip The image flip to apply
* @returns a unique_ptr to the created camera object.
*/
virtual std::unique_ptr<CameraInterface> Create(const std::string& config) const = 0;
virtual std::unique_ptr<CameraInterface> Create(const std::string& config,
const Service::CAM::Flip& flip) = 0;
/**
* Creates a camera object for preview based on the configuration string.
* @param config Configuration string to create the camera. The implementation can decide the
* meaning of this string.
* @param flip The image flip to apply
* @returns a unique_ptr to the created camera object.
* Note: The default implementation for this is to call Create(). Derived classes may have other
* Implementations. For example, A dialog may be used instead of NGLOG_ERROR when error
* occurs.
*/
virtual std::unique_ptr<CameraInterface> CreatePreview(const std::string& config, int width,
int height) const {
return Create(config);
int height,
const Service::CAM::Flip& flip) {
return Create(config, flip);
}
};
@ -50,7 +54,8 @@ void RegisterFactory(const std::string& name, std::unique_ptr<CameraFactory> fac
* @param config Configuration string to create the camera. The meaning of this string is
* defined by the factory.
*/
std::unique_ptr<CameraInterface> CreateCamera(const std::string& name, const std::string& config);
std::unique_ptr<CameraInterface> CreateCamera(const std::string& name, const std::string& config,
const Service::CAM::Flip& flip);
/**
* Creates a camera from the factory for previewing.
@ -60,6 +65,6 @@ std::unique_ptr<CameraInterface> CreateCamera(const std::string& name, const std
*/
std::unique_ptr<CameraInterface> CreateCameraPreview(const std::string& name,
const std::string& config, int width,
int height);
int height, const Service::CAM::Flip& flip);
} // namespace Camera

View file

@ -404,7 +404,7 @@ void ReceiveProperty(Service::Interface* self) {
cmd_buff[0] = IPC::MakeHeader(0x16, 0x2, 0x2);
cmd_buff[1] = RESULT_SUCCESS.raw;
cmd_buff[2] = 0; // stub 0 (32 bit value)
cmd_buff[2] = buff_size; // Should be actual number of read bytes.
cmd_buff[3] = (buff_size << 4 | 0xC);
cmd_buff[4] = buff_addr;

View file

@ -1041,8 +1041,9 @@ void Module::ReloadCameraDevices() {
}
void Module::LoadCameraImplementation(CameraConfig& camera, int camera_id) {
camera.impl = Camera::CreateCamera(Settings::values.camera_name[camera_id],
Settings::values.camera_config[camera_id]);
camera.impl = Camera::CreateCamera(
Settings::values.camera_name[camera_id], Settings::values.camera_config[camera_id],
static_cast<Service::CAM::Flip>(Settings::values.camera_flip[camera_id]));
camera.impl->SetFlip(camera.contexts[0].flip);
camera.impl->SetEffect(camera.contexts[0].effect);
camera.impl->SetFormat(camera.contexts[0].format);

View file

@ -140,6 +140,7 @@ struct Values {
// Camera
std::array<std::string, Service::CAM::NumCameras> camera_name;
std::array<std::string, Service::CAM::NumCameras> camera_config;
std::array<int, Service::CAM::NumCameras> camera_flip;
// Debugging
bool use_gdbstub;