summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar german772022-02-08 16:53:53 -0600
committerGravatar Narr the Reg2022-02-08 18:52:44 -0600
commite35c2fd5d0b58742d5da6682b3fb7ee4bc00204d (patch)
tree2a8df3161f18448e82488bf3ad97ae07063e2173 /src
parentnfp: Validate amiibo files (diff)
downloadyuzu-e35c2fd5d0b58742d5da6682b3fb7ee4bc00204d.tar.gz
yuzu-e35c2fd5d0b58742d5da6682b3fb7ee4bc00204d.tar.xz
yuzu-e35c2fd5d0b58742d5da6682b3fb7ee4bc00204d.zip
nfp: Address compiler issues
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nfp/nfp.cpp51
-rw-r--r--src/yuzu/main.cpp3
2 files changed, 27 insertions, 27 deletions
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp
index 1e91aa340..459fa798f 100644
--- a/src/core/hle/service/nfp/nfp.cpp
+++ b/src/core/hle/service/nfp/nfp.cpp
@@ -20,7 +20,6 @@ namespace ErrCodes {
20constexpr ResultCode DeviceNotFound(ErrorModule::NFP, 64); 20constexpr ResultCode DeviceNotFound(ErrorModule::NFP, 64);
21constexpr ResultCode WrongDeviceState(ErrorModule::NFP, 73); 21constexpr ResultCode WrongDeviceState(ErrorModule::NFP, 73);
22constexpr ResultCode ApplicationAreaIsNotInitialized(ErrorModule::NFP, 128); 22constexpr ResultCode ApplicationAreaIsNotInitialized(ErrorModule::NFP, 128);
23constexpr ResultCode NoApplicationArea(ErrorModule::NFP, 152);
24constexpr ResultCode ApplicationAreaExist(ErrorModule::NFP, 168); 23constexpr ResultCode ApplicationAreaExist(ErrorModule::NFP, 168);
25} // namespace ErrCodes 24} // namespace ErrCodes
26 25
@@ -97,7 +96,7 @@ void IUser::ListDevices(Kernel::HLERequestContext& ctx) {
97 96
98 IPC::ResponseBuilder rb{ctx, 3}; 97 IPC::ResponseBuilder rb{ctx, 3};
99 rb.Push(ResultSuccess); 98 rb.Push(ResultSuccess);
100 rb.Push(devices.size()); 99 rb.Push(static_cast<s32>(devices.size()));
101} 100}
102 101
103void IUser::StartDetection(Kernel::HLERequestContext& ctx) { 102void IUser::StartDetection(Kernel::HLERequestContext& ctx) {
@@ -184,7 +183,8 @@ void IUser::OpenApplicationArea(Kernel::HLERequestContext& ctx) {
184 IPC::RequestParser rp{ctx}; 183 IPC::RequestParser rp{ctx};
185 const auto device_handle{rp.Pop<u64>()}; 184 const auto device_handle{rp.Pop<u64>()};
186 const auto access_id{rp.Pop<u32>()}; 185 const auto access_id{rp.Pop<u32>()};
187 LOG_INFO(Service_NFP, "called, device_handle={}, access_id={}", device_handle, access_id); 186 LOG_WARNING(Service_NFP, "(STUBBED) called, device_handle={}, access_id={}", device_handle,
187 access_id);
188 188
189 // TODO(german77): Loop through all interfaces 189 // TODO(german77): Loop through all interfaces
190 if (device_handle == nfp_interface.GetHandle()) { 190 if (device_handle == nfp_interface.GetHandle()) {
@@ -212,7 +212,7 @@ void IUser::GetApplicationArea(Kernel::HLERequestContext& ctx) {
212 ctx.WriteBuffer(data); 212 ctx.WriteBuffer(data);
213 IPC::ResponseBuilder rb{ctx, 3}; 213 IPC::ResponseBuilder rb{ctx, 3};
214 rb.Push(result); 214 rb.Push(result);
215 rb.PushRaw<u32>(data.size()); 215 rb.Push(static_cast<u32>(data.size()));
216 return; 216 return;
217 } 217 }
218 218
@@ -226,7 +226,8 @@ void IUser::SetApplicationArea(Kernel::HLERequestContext& ctx) {
226 IPC::RequestParser rp{ctx}; 226 IPC::RequestParser rp{ctx};
227 const auto device_handle{rp.Pop<u64>()}; 227 const auto device_handle{rp.Pop<u64>()};
228 const auto data{ctx.ReadBuffer()}; 228 const auto data{ctx.ReadBuffer()};
229 LOG_INFO(Service_NFP, "called, device_handle={}, data_size={}", device_handle, data.size()); 229 LOG_WARNING(Service_NFP, "(STUBBED) called, device_handle={}, data_size={}", device_handle,
230 data.size());
230 231
231 // TODO(german77): Loop through all interfaces 232 // TODO(german77): Loop through all interfaces
232 if (device_handle == nfp_interface.GetHandle()) { 233 if (device_handle == nfp_interface.GetHandle()) {
@@ -247,8 +248,8 @@ void IUser::CreateApplicationArea(Kernel::HLERequestContext& ctx) {
247 const auto device_handle{rp.Pop<u64>()}; 248 const auto device_handle{rp.Pop<u64>()};
248 const auto access_id{rp.Pop<u32>()}; 249 const auto access_id{rp.Pop<u32>()};
249 const auto data{ctx.ReadBuffer()}; 250 const auto data{ctx.ReadBuffer()};
250 LOG_INFO(Service_NFP, "called, device_handle={}, data_size={}, access_id={}", device_handle, 251 LOG_WARNING(Service_NFP, "(STUBBED) called, device_handle={}, data_size={}, access_id={}",
251 access_id, data.size()); 252 device_handle, access_id, data.size());
252 253
253 // TODO(german77): Loop through all interfaces 254 // TODO(german77): Loop through all interfaces
254 if (device_handle == nfp_interface.GetHandle()) { 255 if (device_handle == nfp_interface.GetHandle()) {
@@ -338,7 +339,7 @@ void IUser::GetModelInfo(Kernel::HLERequestContext& ctx) {
338 const auto result = nfp_interface.GetModelInfo(model_info); 339 const auto result = nfp_interface.GetModelInfo(model_info);
339 ctx.WriteBuffer(model_info); 340 ctx.WriteBuffer(model_info);
340 IPC::ResponseBuilder rb{ctx, 2}; 341 IPC::ResponseBuilder rb{ctx, 2};
341 rb.Push(ResultSuccess); 342 rb.Push(result);
342 return; 343 return;
343 } 344 }
344 345
@@ -488,7 +489,7 @@ bool Module::Interface::LoadAmiibo(const std::vector<u8>& buffer) {
488 return false; 489 return false;
489 } 490 }
490 491
491 LOG_INFO(Service_NFP, "New Amiibo detected"); 492 LOG_INFO(Service_NFP, "Amiibo detected");
492 std::memcpy(&amiibo, buffer.data(), sizeof(amiibo)); 493 std::memcpy(&amiibo, buffer.data(), sizeof(amiibo));
493 494
494 if (!IsAmiiboValid()) { 495 if (!IsAmiiboValid()) {
@@ -510,21 +511,21 @@ void Module::Interface::CloseAmiibo() {
510} 511}
511 512
512bool Module::Interface::IsAmiiboValid() const { 513bool Module::Interface::IsAmiiboValid() const {
513 LOG_INFO(Service_NFP, "uuid_lock=0x{0:x}", amiibo.uuid_lock); 514 LOG_DEBUG(Service_NFP, "uuid_lock=0x{0:x}", amiibo.uuid_lock);
514 LOG_INFO(Service_NFP, "compability_container=0x{0:x}", amiibo.compability_container); 515 LOG_DEBUG(Service_NFP, "compability_container=0x{0:x}", amiibo.compability_container);
515 LOG_INFO(Service_NFP, "crypto_init=0x{0:x}", amiibo.crypto_init); 516 LOG_DEBUG(Service_NFP, "crypto_init=0x{0:x}", amiibo.crypto_init);
516 LOG_INFO(Service_NFP, "write_count={}", amiibo.write_count); 517 LOG_DEBUG(Service_NFP, "write_count={}", amiibo.write_count);
517 518
518 LOG_INFO(Service_NFP, "character_id=0x{0:x}", amiibo.model_info.character_id); 519 LOG_DEBUG(Service_NFP, "character_id=0x{0:x}", amiibo.model_info.character_id);
519 LOG_INFO(Service_NFP, "character_variant={}", amiibo.model_info.character_variant); 520 LOG_DEBUG(Service_NFP, "character_variant={}", amiibo.model_info.character_variant);
520 LOG_INFO(Service_NFP, "amiibo_type={}", amiibo.model_info.amiibo_type); 521 LOG_DEBUG(Service_NFP, "amiibo_type={}", amiibo.model_info.amiibo_type);
521 LOG_INFO(Service_NFP, "model_number=0x{0:x}", amiibo.model_info.model_number); 522 LOG_DEBUG(Service_NFP, "model_number=0x{0:x}", amiibo.model_info.model_number);
522 LOG_INFO(Service_NFP, "series={}", amiibo.model_info.series); 523 LOG_DEBUG(Service_NFP, "series={}", amiibo.model_info.series);
523 LOG_INFO(Service_NFP, "fixed_value=0x{0:x}", amiibo.model_info.fixed); 524 LOG_DEBUG(Service_NFP, "fixed_value=0x{0:x}", amiibo.model_info.fixed);
524 525
525 LOG_INFO(Service_NFP, "tag_dynamic_lock=0x{0:x}", amiibo.tag_dynamic_lock); 526 LOG_DEBUG(Service_NFP, "tag_dynamic_lock=0x{0:x}", amiibo.tag_dynamic_lock);
526 LOG_INFO(Service_NFP, "tag_CFG0=0x{0:x}", amiibo.tag_CFG0); 527 LOG_DEBUG(Service_NFP, "tag_CFG0=0x{0:x}", amiibo.tag_CFG0);
527 LOG_INFO(Service_NFP, "tag_CFG1=0x{0:x}", amiibo.tag_CFG1); 528 LOG_DEBUG(Service_NFP, "tag_CFG1=0x{0:x}", amiibo.tag_CFG1);
528 529
529 // Check against all know constants on an amiibo binary 530 // Check against all know constants on an amiibo binary
530 if (amiibo.uuid_lock != 0xE00F) { 531 if (amiibo.uuid_lock != 0xE00F) {
@@ -701,7 +702,7 @@ ResultCode Module::Interface::OpenApplicationArea(u32 access_id) {
701 is_application_area_initialized = true; 702 is_application_area_initialized = true;
702 } 703 }
703 if (!is_application_area_initialized) { 704 if (!is_application_area_initialized) {
704 LOG_ERROR(Service_NFP, "Application area is not initialized"); 705 LOG_WARNING(Service_NFP, "Application area is not initialized");
705 return ErrCodes::ApplicationAreaIsNotInitialized; 706 return ErrCodes::ApplicationAreaIsNotInitialized;
706 } 707 }
707 return ResultSuccess; 708 return ResultSuccess;
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 395527607..a67ab030b 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -2915,8 +2915,7 @@ void GMainWindow::OnLoadAmiibo() {
2915 Service::SM::ServiceManager& sm = system->ServiceManager(); 2915 Service::SM::ServiceManager& sm = system->ServiceManager();
2916 auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); 2916 auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
2917 if (nfc == nullptr) { 2917 if (nfc == nullptr) {
2918 QMessageBox::warning(this, tr("Error"), 2918 QMessageBox::warning(this, tr("Error"), tr("The current game is not looking for amiibos"));
2919 tr("The current game is not looking for amiibos"));
2920 return; 2919 return;
2921 } 2920 }
2922 const auto nfc_state = nfc->GetCurrentState(); 2921 const auto nfc_state = nfc->GetCurrentState();