Skip to content

Commit

Permalink
Support 12.x and latest Atmosphere
Browse files Browse the repository at this point in the history
  • Loading branch information
XorTroll committed Apr 17, 2021
1 parent f97b187 commit 77ab09b
Show file tree
Hide file tree
Showing 12 changed files with 404 additions and 126 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

export EMUIIBO_MAJOR := 0
export EMUIIBO_MINOR := 6
export EMUIIBO_MICRO := 2
export EMUIIBO_MICRO := 3

.PHONY: all clean

Expand Down
2 changes: 1 addition & 1 deletion emuiibo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "emuiibo"
version = "0.6.2"
version = "0.6.3"
authors = ["XorTroll"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions emuiibo/src/amiibo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use nx::fs;
use nx::util;
use nx::rand;
use nx::rand::RandomGenerator;
use nx::ipc::sf::mii;
use nx::ipc::sf::nfp;
use nx::ipc::cmif::sf::mii;
use nx::ipc::cmif::sf::nfp;

use crate::fsext;
use crate::miiext;
Expand Down
2 changes: 1 addition & 1 deletion emuiibo/src/area.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use nx::result::*;
use nx::fs;
use nx::ipc::sf::nfp;
use nx::ipc::cmif::sf::nfp;
use alloc::string::String;
use crate::amiibo;
use crate::fsext;
Expand Down
2 changes: 1 addition & 1 deletion emuiibo/src/emu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum VirtualAmiiboStatus {
Disconnected
}

pub const CURRENT_VERSION: Version = Version::from(0, 6, 2, false);
pub const CURRENT_VERSION: Version = Version::from(0, 6, 3, true);

static mut G_EMULATION_STATUS: sync::Locked<EmulationStatus> = sync::Locked::new(false, EmulationStatus::Off);
static mut G_ACTIVE_VIRTUAL_AMIIBO_STATUS: sync::Locked<VirtualAmiiboStatus> = sync::Locked::new(false, VirtualAmiiboStatus::Invalid);
Expand Down
48 changes: 24 additions & 24 deletions emuiibo/src/ipc/emu.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use nx::result::*;
use nx::ipc::sf;
use nx::ipc::server;
use nx::ipc::cmif::sf;
use nx::ipc::cmif::server;
use alloc::string::String;

use crate::resultsext;
Expand All @@ -9,17 +9,17 @@ use crate::amiibo;
use crate::fsext;

pub trait IEmulationService {
ipc_interface_define_command!(get_version: () => (version: emu::Version));
ipc_interface_define_command!(get_virtual_amiibo_directory: (out_path: sf::OutMapAliasBuffer) => ());
ipc_interface_define_command!(get_emulation_status: () => (status: emu::EmulationStatus));
ipc_interface_define_command!(set_emulation_status: (status: emu::EmulationStatus) => ());
ipc_interface_define_command!(get_active_virtual_amiibo: (out_path: sf::OutMapAliasBuffer) => (virtual_amiibo: amiibo::VirtualAmiiboData));
ipc_interface_define_command!(set_active_virtual_amiibo: (path: sf::InMapAliasBuffer) => ());
ipc_interface_define_command!(reset_active_virtual_amiibo: () => ());
ipc_interface_define_command!(get_active_virtual_amiibo_status: () => (status: emu::VirtualAmiiboStatus));
ipc_interface_define_command!(set_active_virtual_amiibo_status: (status: emu::VirtualAmiiboStatus) => ());
ipc_interface_define_command!(is_application_id_intercepted: (application_id: u64) => (is_intercepted: bool));
ipc_interface_define_command!(try_parse_virtual_amiibo: (path: sf::InMapAliasBuffer) => (virtual_amiibo: amiibo::VirtualAmiiboData));
ipc_cmif_interface_define_command!(get_version: () => (version: emu::Version));
ipc_cmif_interface_define_command!(get_virtual_amiibo_directory: (out_path: sf::OutMapAliasBuffer) => ());
ipc_cmif_interface_define_command!(get_emulation_status: () => (status: emu::EmulationStatus));
ipc_cmif_interface_define_command!(set_emulation_status: (status: emu::EmulationStatus) => ());
ipc_cmif_interface_define_command!(get_active_virtual_amiibo: (out_path: sf::OutMapAliasBuffer) => (virtual_amiibo: amiibo::VirtualAmiiboData));
ipc_cmif_interface_define_command!(set_active_virtual_amiibo: (path: sf::InMapAliasBuffer) => ());
ipc_cmif_interface_define_command!(reset_active_virtual_amiibo: () => ());
ipc_cmif_interface_define_command!(get_active_virtual_amiibo_status: () => (status: emu::VirtualAmiiboStatus));
ipc_cmif_interface_define_command!(set_active_virtual_amiibo_status: (status: emu::VirtualAmiiboStatus) => ());
ipc_cmif_interface_define_command!(is_application_id_intercepted: (application_id: u64) => (is_intercepted: bool));
ipc_cmif_interface_define_command!(try_parse_virtual_amiibo: (path: sf::InMapAliasBuffer) => (virtual_amiibo: amiibo::VirtualAmiiboData));
}

pub struct EmulationService {
Expand All @@ -33,17 +33,17 @@ impl sf::IObject for EmulationService {

fn get_command_table(&self) -> sf::CommandMetadataTable {
vec! [
ipc_interface_make_command_meta!(get_version: 0),
ipc_interface_make_command_meta!(get_virtual_amiibo_directory: 1),
ipc_interface_make_command_meta!(get_emulation_status: 2),
ipc_interface_make_command_meta!(set_emulation_status: 3),
ipc_interface_make_command_meta!(get_active_virtual_amiibo: 4),
ipc_interface_make_command_meta!(set_active_virtual_amiibo: 5),
ipc_interface_make_command_meta!(reset_active_virtual_amiibo: 6),
ipc_interface_make_command_meta!(get_active_virtual_amiibo_status: 7),
ipc_interface_make_command_meta!(set_active_virtual_amiibo_status: 8),
ipc_interface_make_command_meta!(is_application_id_intercepted: 9),
ipc_interface_make_command_meta!(try_parse_virtual_amiibo: 10)
ipc_cmif_interface_make_command_meta!(get_version: 0),
ipc_cmif_interface_make_command_meta!(get_virtual_amiibo_directory: 1),
ipc_cmif_interface_make_command_meta!(get_emulation_status: 2),
ipc_cmif_interface_make_command_meta!(set_emulation_status: 3),
ipc_cmif_interface_make_command_meta!(get_active_virtual_amiibo: 4),
ipc_cmif_interface_make_command_meta!(set_active_virtual_amiibo: 5),
ipc_cmif_interface_make_command_meta!(reset_active_virtual_amiibo: 6),
ipc_cmif_interface_make_command_meta!(get_active_virtual_amiibo_status: 7),
ipc_cmif_interface_make_command_meta!(set_active_virtual_amiibo_status: 8),
ipc_cmif_interface_make_command_meta!(is_application_id_intercepted: 9),
ipc_cmif_interface_make_command_meta!(try_parse_virtual_amiibo: 10)
]
}
}
Expand Down
68 changes: 34 additions & 34 deletions emuiibo/src/ipc/nfp.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use nx::result::*;
use nx::results;
use nx::mem;
use nx::ipc::sf;
use nx::ipc::server;
use nx::ipc::sf::applet;
use nx::ipc::sf::nfp;
use nx::ipc::sf::nfp::IUser;
use nx::ipc::sf::nfp::IUserManager;
use nx::ipc::sf::sm;
use nx::ipc::cmif::sf;
use nx::ipc::cmif::server;
use nx::ipc::cmif::sf::applet;
use nx::ipc::cmif::sf::nfp;
use nx::ipc::cmif::sf::nfp::IUser;
use nx::ipc::cmif::sf::nfp::IUserManager;
use nx::ipc::tipc::sf::sm;
use nx::wait;
use nx::sync;
use nx::service::hid;
use nx::service::cmif::hid;
use nx::input;
use nx::thread;

Expand Down Expand Up @@ -99,31 +99,31 @@ impl sf::IObject for User {

fn get_command_table(&self) -> sf::CommandMetadataTable {
vec! [
ipc_interface_make_command_meta!(initialize: 0),
ipc_interface_make_command_meta!(finalize: 1),
ipc_interface_make_command_meta!(list_devices: 2),
ipc_interface_make_command_meta!(start_detection: 3),
ipc_interface_make_command_meta!(stop_detection: 4),
ipc_interface_make_command_meta!(mount: 5),
ipc_interface_make_command_meta!(unmount: 6),
ipc_interface_make_command_meta!(open_application_area: 7),
ipc_interface_make_command_meta!(get_application_area: 8),
ipc_interface_make_command_meta!(set_application_area: 9),
ipc_interface_make_command_meta!(flush: 10),
ipc_interface_make_command_meta!(restore: 11),
ipc_interface_make_command_meta!(create_application_area: 12),
ipc_interface_make_command_meta!(get_tag_info: 13),
ipc_interface_make_command_meta!(get_register_info: 14),
ipc_interface_make_command_meta!(get_common_info: 15),
ipc_interface_make_command_meta!(get_model_info: 16),
ipc_interface_make_command_meta!(attach_activate_event: 17),
ipc_interface_make_command_meta!(attach_deactivate_event: 18),
ipc_interface_make_command_meta!(get_state: 19),
ipc_interface_make_command_meta!(get_device_state: 20),
ipc_interface_make_command_meta!(get_npad_id: 21),
ipc_interface_make_command_meta!(get_application_area_size: 22),
ipc_interface_make_command_meta!(attach_availability_change_event: 23, [(3, 0, 0) =>]),
ipc_interface_make_command_meta!(recreate_application_area: 24, [(3, 0, 0) =>])
ipc_cmif_interface_make_command_meta!(initialize: 0),
ipc_cmif_interface_make_command_meta!(finalize: 1),
ipc_cmif_interface_make_command_meta!(list_devices: 2),
ipc_cmif_interface_make_command_meta!(start_detection: 3),
ipc_cmif_interface_make_command_meta!(stop_detection: 4),
ipc_cmif_interface_make_command_meta!(mount: 5),
ipc_cmif_interface_make_command_meta!(unmount: 6),
ipc_cmif_interface_make_command_meta!(open_application_area: 7),
ipc_cmif_interface_make_command_meta!(get_application_area: 8),
ipc_cmif_interface_make_command_meta!(set_application_area: 9),
ipc_cmif_interface_make_command_meta!(flush: 10),
ipc_cmif_interface_make_command_meta!(restore: 11),
ipc_cmif_interface_make_command_meta!(create_application_area: 12),
ipc_cmif_interface_make_command_meta!(get_tag_info: 13),
ipc_cmif_interface_make_command_meta!(get_register_info: 14),
ipc_cmif_interface_make_command_meta!(get_common_info: 15),
ipc_cmif_interface_make_command_meta!(get_model_info: 16),
ipc_cmif_interface_make_command_meta!(attach_activate_event: 17),
ipc_cmif_interface_make_command_meta!(attach_deactivate_event: 18),
ipc_cmif_interface_make_command_meta!(get_state: 19),
ipc_cmif_interface_make_command_meta!(get_device_state: 20),
ipc_cmif_interface_make_command_meta!(get_npad_id: 21),
ipc_cmif_interface_make_command_meta!(get_application_area_size: 22),
ipc_cmif_interface_make_command_meta!(attach_availability_change_event: 23, [(3, 0, 0) =>]),
ipc_cmif_interface_make_command_meta!(recreate_application_area: 24, [(3, 0, 0) =>])
]
}
}
Expand Down Expand Up @@ -376,7 +376,7 @@ impl sf::IObject for UserManager {

fn get_command_table(&self) -> sf::CommandMetadataTable {
vec! [
ipc_interface_make_command_meta!(create_user_interface: 0)
ipc_cmif_interface_make_command_meta!(create_user_interface: 0)
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion emuiibo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use nx::util;
use nx::thread;
use nx::diag::assert;
use nx::diag::log;
use nx::ipc::server;
use nx::ipc::cmif::server;
use nx::fs;
use core::panic;

Expand Down
10 changes: 5 additions & 5 deletions emuiibo/src/miiext.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use nx::result::*;
use nx::ipc::sf;
use nx::ipc::cmif::sf;
use nx::service;
use nx::service::mii;
use nx::service::mii::IDatabaseService;
use nx::service::mii::IStaticService;
use nx::service::cmif::mii;
use nx::service::cmif::mii::IDatabaseService;
use nx::service::cmif::mii::IStaticService;
use nx::mem;
use nx::fs;
use alloc::vec::Vec;
Expand All @@ -17,7 +17,7 @@ static mut G_INIT: bool = false;
pub fn initialize() -> Result<()> {
unsafe {
if !G_INIT {
G_STATIC_SRV = service::new_service_object()?;
G_STATIC_SRV = service::cmif::new_service_object()?;
G_DB_SRV = G_STATIC_SRV.get().get_database_service(mii::SpecialKeyCode::Normal)?.to::<mii::DatabaseService>();
G_INIT = true;
}
Expand Down
Loading

0 comments on commit 77ab09b

Please sign in to comment.