diff --git a/ctru-sys/src/services/ac.rs b/ctru-sys/src/services/ac.rs index f23369f..926f453 100644 --- a/ctru-sys/src/services/ac.rs +++ b/ctru-sys/src/services/ac.rs @@ -1,8 +1,13 @@ -use ::Result; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { pub fn acInit() -> Result; pub fn acExit(); pub fn acWaitInternetConnection() -> Result; - pub fn ACU_GetWifiStatus(out: *mut u32) -> Result; + pub fn ACU_GetWifiStatus(out: *mut u32_) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/am.rs b/ctru-sys/src/services/am.rs index 971829e..9f7a445 100644 --- a/ctru-sys/src/services/am.rs +++ b/ctru-sys/src/services/am.rs @@ -1,49 +1,186 @@ -use ::{Handle, Result}; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct AM_TitleEntry { - pub titleID: u64, - pub size: u64, - pub version: u16, - pub unk: [u8; 6usize], + pub titleID: u64_, + pub size: u64_, + pub version: u16_, + pub unk: [u8_; 6usize], } - -impl ::core::clone::Clone for AM_TitleEntry { - fn clone(&self) -> Self { *self } -} - impl ::core::default::Default for AM_TitleEntry { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum Enum_Unnamed1 { + AM_STATUS_MASK_INSTALLING = 1, + AM_STATUS_MASK_AWAITING_FINALIZATION = 2, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum AM_InstallStatus { + AM_STATUS_ABORTED = 2, + AM_STATUS_SAVED = 3, + AM_STATUS_INSTALL_IN_PROGRESS = 2050, + AM_STATUS_AWAITING_FINALIZATION = 2051, +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct AM_PendingTitleEntry { + pub titleId: u64_, + pub version: u16_, + pub status: u16_, + pub titleType: u32_, + pub unk: [u8_; 8usize], +} +impl ::core::default::Default for AM_PendingTitleEntry { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum Enum_Unnamed2 { + AM_DELETE_PENDING_NON_SYSTEM = 1, + AM_DELETE_PENDING_SYSTEM = 2, +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct AM_TWLPartitionInfo { + pub capacity: u64_, + pub freeSpace: u64_, + pub titlesCapacity: u64_, + pub titlesFreeSpace: u64_, +} +impl ::core::default::Default for AM_TWLPartitionInfo { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} extern "C" { pub fn amInit() -> Result; + pub fn amAppInit() -> Result; pub fn amExit(); pub fn amGetSessionHandle() -> *mut Handle; - pub fn AM_GetTitleCount(mediatype: u8, count: *mut u32) -> Result; - pub fn AM_GetTitleIdList(mediatype: u8, count: u32, titleIDs: *mut u64) + pub fn AM_GetTitleCount(mediatype: FS_MediaType, count: *mut u32_) + -> Result; + pub fn AM_GetTitleList(titlesRead: *mut u32_, mediatype: FS_MediaType, + titleCount: u32_, titleIds: *mut u64_) -> Result; + pub fn AM_GetTitleInfo(mediatype: FS_MediaType, titleCount: u32_, + titleIds: *mut u64_, titleInfo: *mut AM_TitleEntry) -> Result; - pub fn AM_GetDeviceId(deviceID: *mut u32) -> Result; - pub fn AM_ListTitles(mediatype: u8, titleCount: u32, - titleIdList: *mut u64, titleList: *mut AM_TitleEntry) + pub fn AM_GetTicketCount(count: *mut u32_) -> Result; + pub fn AM_GetTicketList(ticketsRead: *mut u32_, ticketCount: u32_, + skip: u32_, ticketIds: *mut u64_) -> Result; + pub fn AM_GetPendingTitleCount(count: *mut u32_, mediatype: FS_MediaType, + statusMask: u32_) -> Result; + pub fn AM_GetPendingTitleList(titlesRead: *mut u32_, titleCount: u32_, + mediatype: FS_MediaType, statusMask: u32_, + titleIds: *mut u64_) -> Result; + pub fn AM_GetPendingTitleInfo(titleCount: u32_, mediatype: FS_MediaType, + titleIds: *mut u64_, + titleInfo: *mut AM_PendingTitleEntry) -> Result; - pub fn AM_StartCiaInstall(mediatype: u8, ciaHandle: *mut Handle) + pub fn AM_GetDeviceId(deviceID: *mut u32_) -> Result; + pub fn AM_ExportTwlBackup(titleID: u64_, operation: u8_, + workbuf: *mut ::libc::c_void, + workbuf_size: u32_, + filepath: *const ::libc::c_char) -> Result; + pub fn AM_ImportTwlBackup(filehandle: Handle, operation: u8_, + buffer: *mut ::libc::c_void, size: u32_) + -> Result; + pub fn AM_ReadTwlBackupInfo(filehandle: Handle, + outinfo: *mut ::libc::c_void, + outinfo_size: u32_, + workbuf: *mut ::libc::c_void, + workbuf_size: u32_, + banner: *mut ::libc::c_void, + banner_size: u32_) -> Result; + pub fn AM_GetTWLPartitionInfo(info: *mut AM_TWLPartitionInfo) -> Result; + pub fn AM_StartCiaInstall(mediatype: FS_MediaType, ciaHandle: *mut Handle) -> Result; pub fn AM_StartDlpChildCiaInstall(ciaHandle: *mut Handle) -> Result; - pub fn AM_CancelCIAInstall(ciaHandle: *mut Handle) -> Result; - pub fn AM_FinishCiaInstall(mediatype: u8, ciaHandle: *mut Handle) + pub fn AM_CancelCIAInstall(ciaHandle: Handle) -> Result; + pub fn AM_FinishCiaInstall(ciaHandle: Handle) -> Result; + pub fn AM_DeleteTitle(mediatype: FS_MediaType, titleID: u64_) -> Result; + pub fn AM_DeleteAppTitle(mediatype: FS_MediaType, titleID: u64_) -> Result; - pub fn AM_DeleteTitle(mediatype: u8, titleID: u64) -> Result; - pub fn AM_DeleteAppTitle(mediatype: u8, titleID: u64) -> Result; - pub fn AM_InstallNativeFirm() -> Result; - pub fn AM_InstallFirm(titleID: u64) -> Result; - pub fn AM_GetTitleProductCode(mediatype: u8, titleID: u64, - productCode: *mut u8) + pub fn AM_DeleteTicket(ticketId: u64_) -> Result; + pub fn AM_DeletePendingTitle(mediatype: FS_MediaType, titleId: u64_) -> Result; - pub fn AM_GetCiaFileInfo(mediatype: u8, titleEntry: *mut AM_TitleEntry, + pub fn AM_DeletePendingTitles(mediatype: FS_MediaType, flags: u32_) + -> Result; + pub fn AM_DeleteAllPendingTitles(mediatype: FS_MediaType) -> Result; + pub fn AM_InstallNativeFirm() -> Result; + pub fn AM_InstallFirm(titleID: u64_) -> Result; + pub fn AM_GetTitleProductCode(mediatype: FS_MediaType, titleId: u64_, + productCode: *mut ::libc::c_char) -> Result; + pub fn AM_GetTitleExtDataId(extDataId: *mut u64_, mediatype: FS_MediaType, + titleId: u64_) -> Result; + pub fn AM_GetCiaFileInfo(mediatype: FS_MediaType, + titleEntry: *mut AM_TitleEntry, fileHandle: Handle) -> Result; + pub fn AM_GetCiaIcon(icon: *mut ::libc::c_void, fileHandle: Handle) + -> Result; + pub fn AM_GetCiaDependencies(dependencies: *mut u64_, fileHandle: Handle) + -> Result; + pub fn AM_GetCiaMetaOffset(metaOffset: *mut u64_, fileHandle: Handle) + -> Result; + pub fn AM_GetCiaCoreVersion(coreVersion: *mut u32_, fileHandle: Handle) + -> Result; + pub fn AM_GetCiaRequiredSpace(requiredSpace: *mut u64_, + mediaType: FS_MediaType, fileHandle: Handle) + -> Result; + pub fn AM_GetCiaMetaSection(meta: *mut ::libc::c_void, size: u32_, + fileHandle: Handle) -> Result; pub fn AM_InitializeExternalTitleDatabase(overwrite: u8) -> Result; pub fn AM_QueryAvailableExternalTitleDatabase(available: *mut u8) -> Result; + pub fn AM_InstallTicketBegin(ticketHandle: *mut Handle) -> Result; + pub fn AM_InstallTicketAbort(ticketHandle: Handle) -> Result; + pub fn AM_InstallTicketFinish(ticketHandle: Handle) -> Result; + pub fn AM_InstallTitleBegin(mediaType: FS_MediaType, titleId: u64_, + unk: u8) -> Result; + pub fn AM_InstallTitleStop() -> Result; + pub fn AM_InstallTitleResume(mediaType: FS_MediaType, titleId: u64_) + -> Result; + pub fn AM_InstallTitleAbort() -> Result; + pub fn AM_InstallTitleFinish() -> Result; + pub fn AM_CommitImportTitles(mediaType: FS_MediaType, titleCount: u32_, + temp: u8, titleIds: *mut u64_) -> Result; + pub fn AM_InstallTmdBegin(tmdHandle: *mut Handle) -> Result; + pub fn AM_InstallTmdAbort(tmdHandle: Handle) -> Result; + pub fn AM_InstallTmdFinish(tmdHandle: Handle, unk: u8) -> Result; + pub fn AM_CreateImportContentContexts(contentCount: u32_, + contentIndices: *mut u16_) + -> Result; + pub fn AM_InstallContentBegin(contentHandle: *mut Handle, index: u16_) + -> Result; + pub fn AM_InstallContentStop(contentHandle: Handle) -> Result; + pub fn AM_InstallContentResume(contentHandle: *mut Handle, + resumeOffset: *mut u64_, index: u16_) + -> Result; + pub fn AM_InstallContentCancel(contentHandle: Handle) -> Result; + pub fn AM_InstallContentFinish(contentHandle: Handle) -> Result; + pub fn AM_ImportCertificates(cert1Size: u32_, cert1: *mut ::libc::c_void, + cert2Size: u32_, cert2: *mut ::libc::c_void, + cert3Size: u32_, cert3: *mut ::libc::c_void, + cert4Size: u32_, cert4: *mut ::libc::c_void) + -> Result; + pub fn AM_ImportCertificate(certSize: u32_, cert: *mut ::libc::c_void) + -> Result; + pub fn AM_CommitImportTitlesAndUpdateFirmwareAuto(mediaType: FS_MediaType, + titleCount: u32_, + temp: u8, + titleIds: *mut u64_) + -> Result; } +use ::types::*; +use super::fs::FS_MediaType; diff --git a/ctru-sys/src/services/ampxi.rs b/ctru-sys/src/services/ampxi.rs new file mode 100644 index 0000000..4dc27d4 --- /dev/null +++ b/ctru-sys/src/services/ampxi.rs @@ -0,0 +1,18 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +extern "C" { + pub fn ampxiInit(servhandle: Handle) -> Result; + pub fn ampxiExit(); + pub fn AMPXI_WriteTWLSavedata(titleid: u64_, buffer: *mut u8_, size: u32_, + image_filepos: u32_, section_type: u8_, + operation: u8_) -> Result; + pub fn AMPXI_InstallTitlesFinish(mediaType: FS_MediaType, db: u8_, + titlecount: u32_, tidlist: *mut u64_) + -> Result; +} +use ::types::*; +use super::fs::FS_MediaType; diff --git a/ctru-sys/src/services/apt.rs b/ctru-sys/src/services/apt.rs index 8c32e91..22acd27 100644 --- a/ctru-sys/src/services/apt.rs +++ b/ctru-sys/src/services/apt.rs @@ -1,61 +1,121 @@ -use ::{Result, Handle}; -use ::libc::c_void; +/* automatically generated by rust-bindgen */ -#[repr(C)] -#[derive(Clone, Copy)] +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum NS_APPID { - APPID_HOMEMENU = 0x101, // Home Menu - APPID_CAMERA = 0x110, // Camera applet - APPID_FRIENDS_LIST = 0x112, // Friends List applet - APPID_GAME_NOTES = 0x113, // Game Notes applet - APPID_WEB = 0x114, // Internet Browser - APPID_INSTRUCTION_MANUAL = 0x115, // Instruction Manual applet - APPID_NOTIFICATIONS = 0x116, // Notifications applet - APPID_MIIVERSE = 0x117, // Miiverse applet - APPID_MIIVERSE_POSTING = 0x118, - APPID_AMIIBO_SETTINGS = 0x119, - APPID_APPLICATION = 0x300, // Application - APPID_ESHOP = 0x301, - APPID_SOFTWARE_KEYBOARD = 0x401, // Software Keyboard - APPID_APPLETED = 0x402, // appletEd - APPID_PNOTE_AP = 0x404, // PNOTE_AP - APPID_SNOTE_AP = 0x405, // SNOTE_AP - APPID_ERROR = 0x406, // error - APPID_MINT = 0x407, // mint - APPID_EXTRAPAD = 0x408, // extrapad - APPID_MEMOLIB = 0x409, // memolib + APPID_NONE = 0, + APPID_HOMEMENU = 257, + APPID_CAMERA = 272, + APPID_FRIENDS_LIST = 274, + APPID_GAME_NOTES = 275, + APPID_WEB = 276, + APPID_INSTRUCTION_MANUAL = 277, + APPID_NOTIFICATIONS = 278, + APPID_MIIVERSE = 279, + APPID_MIIVERSE_POSTING = 280, + APPID_AMIIBO_SETTINGS = 281, + APPID_APPLICATION = 768, + APPID_ESHOP = 769, + APPID_SOFTWARE_KEYBOARD = 1025, + APPID_APPLETED = 1026, + APPID_PNOTE_AP = 1028, + APPID_SNOTE_AP = 1029, + APPID_ERROR = 1030, + APPID_MINT = 1031, + APPID_EXTRAPAD = 1032, + APPID_MEMOLIB = 1033, } - -#[repr(C)] -#[derive(Clone, Copy)] -pub enum APT_AppStatus { - APP_NOTINITIALIZED = 0, - APP_RUNNING = 1, - APP_SUSPENDED = 2, - APP_EXITING = 3, - APP_SUSPENDING = 4, - APP_SLEEPMODE = 5, - APP_PREPARE_SLEEPMODE = 6, - APP_APPLETSTARTED = 7, - APP_APPLETCLOSED = 8, +#[derive(Copy, Clone)] +#[repr(i32)] +#[derive(Debug)] +pub enum APT_AppletPos { + APTPOS_NONE = -1, + APTPOS_APP = 0, + APTPOS_APPLIB = 1, + APTPOS_SYS = 2, + APTPOS_SYSLIB = 3, + APTPOS_RESIDENT = 4, } - -#[repr(C)] -#[derive(Clone, Copy)] +pub type APT_AppletAttr = u8_; +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum APT_QueryReply { + APTREPLY_REJECT = 0, + APTREPLY_ACCEPT = 1, + APTREPLY_LATER = 2, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum APT_Signal { + APTSIGNAL_NONE = 0, APTSIGNAL_HOMEBUTTON = 1, - APTSIGNAL_PREPARESLEEP = 3, - APTSIGNAL_ENTERSLEEP = 5, - APTSIGNAL_WAKEUP = 6, - APTSIGNAL_ENABLE = 7, + APTSIGNAL_HOMEBUTTON2 = 2, + APTSIGNAL_SLEEP_QUERY = 3, + APTSIGNAL_SLEEP_CANCEL = 4, + APTSIGNAL_SLEEP_ENTER = 5, + APTSIGNAL_SLEEP_WAKEUP = 6, + APTSIGNAL_SHUTDOWN = 7, APTSIGNAL_POWERBUTTON = 8, - APTSIGNAL_UTILITY = 9, - APTSIGNAL_SLEEPSYSTEM = 10, - APTSIGNAL_ERROR = 11, + APTSIGNAL_POWERBUTTON2 = 9, + APTSIGNAL_TRY_SLEEP = 10, + APTSIGNAL_ORDERTOCLOSE = 11, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum APT_Command { + APTCMD_NONE = 0, + APTCMD_WAKEUP = 1, + APTCMD_REQUEST = 2, + APTCMD_RESPONSE = 3, + APTCMD_EXIT = 4, + APTCMD_MESSAGE = 5, + APTCMD_HOMEBUTTON_ONCE = 6, + APTCMD_HOMEBUTTON_TWICE = 7, + APTCMD_DSP_SLEEP = 8, + APTCMD_DSP_WAKEUP = 9, + APTCMD_WAKEUP_EXIT = 10, + APTCMD_WAKEUP_PAUSE = 11, + APTCMD_WAKEUP_CANCEL = 12, + APTCMD_WAKEUP_CANCELALL = 13, + APTCMD_WAKEUP_POWERBUTTON = 14, + APTCMD_WAKEUP_JUMPTOHOME = 15, + APTCMD_SYSAPPLET_REQUEST = 16, + APTCMD_WAKEUP_LAUNCHAPP = 17, } - #[repr(C)] -#[derive(Clone, Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct aptCaptureBufInfo { + pub size: u32_, + pub is3D: u32_, + pub top: Struct_Unnamed1, + pub bottom: Struct_Unnamed1, +} +impl ::core::default::Default for aptCaptureBufInfo { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct Struct_Unnamed1 { + pub leftOffset: u32_, + pub rightOffset: u32_, + pub format: u32_, +} +impl ::core::default::Default for Struct_Unnamed1 { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum APT_HookType { APTHOOK_ONSUSPEND = 0, APTHOOK_ONRESTORE = 1, @@ -64,106 +124,118 @@ pub enum APT_HookType { APTHOOK_ONEXIT = 4, APTHOOK_COUNT = 5, } - -pub type aptHookFn = Option; - +pub type aptHookFn = + ::core::option::Option; #[repr(C)] -#[derive(Copy)] -pub struct aptHookCookie { - pub next: *mut aptHookCookie, +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct tag_aptHookCookie { + pub next: *mut tag_aptHookCookie, pub callback: aptHookFn, - pub param: *mut c_void, -} -impl ::core::clone::Clone for aptHookCookie { - fn clone(&self) -> Self { *self } + pub param: *mut ::libc::c_void, } -impl ::core::default::Default for aptHookCookie { +impl ::core::default::Default for tag_aptHookCookie { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - -extern "C" { - pub static mut aptEvents: [Handle; 3usize]; -} +pub type aptHookCookie = tag_aptHookCookie; +pub type aptMessageCb = + ::core::option::Option; extern "C" { pub fn aptInit() -> Result; pub fn aptExit(); - pub fn aptOpenSession(); - pub fn aptCloseSession(); - pub fn aptSetStatus(status: APT_AppStatus); - pub fn aptGetStatus() -> APT_AppStatus; - pub fn aptGetStatusPower() -> u32; - pub fn aptSetStatusPower(status: u32); - pub fn aptReturnToMenu(); - pub fn aptWaitStatusEvent(); - pub fn aptSignalReadyForSleep(); - pub fn aptGetMenuAppID() -> NS_APPID; + pub fn aptSendCommand(aptcmdbuf: *mut u32_) -> Result; + pub fn aptIsSleepAllowed() -> u8; + pub fn aptSetSleepAllowed(allowed: u8); pub fn aptMainLoop() -> u8; pub fn aptHook(cookie: *mut aptHookCookie, callback: aptHookFn, - param: *mut c_void); + param: *mut ::libc::c_void); pub fn aptUnhook(cookie: *mut aptHookCookie); - pub fn APT_GetLockHandle(flags: u16, lockHandle: *mut Handle) -> Result; - pub fn APT_Initialize(appId: NS_APPID, eventHandle1: *mut Handle, - eventHandle2: *mut Handle) -> Result; + pub fn aptSetMessageCallback(callback: aptMessageCb, + user: *mut ::libc::c_void); + pub fn aptLaunchLibraryApplet(appId: NS_APPID, buf: *mut ::libc::c_void, + bufsize: size_t, handle: Handle) -> u8; + pub fn APT_GetLockHandle(flags: u16_, lockHandle: *mut Handle) -> Result; + pub fn APT_Initialize(appId: NS_APPID, attr: APT_AppletAttr, + signalEvent: *mut Handle, resumeEvent: *mut Handle) + -> Result; pub fn APT_Finalize(appId: NS_APPID) -> Result; pub fn APT_HardwareResetAsync() -> Result; - pub fn APT_Enable(a: u32) -> Result; - pub fn APT_GetAppletManInfo(inval: u8, outval8: *mut u8, - outval32: *mut u32, + pub fn APT_Enable(attr: APT_AppletAttr) -> Result; + pub fn APT_GetAppletManInfo(inpos: APT_AppletPos, + outpos: *mut APT_AppletPos, + req_appid: *mut NS_APPID, menu_appid: *mut NS_APPID, active_appid: *mut NS_APPID) -> Result; - pub fn APT_GetAppletInfo(appID: NS_APPID, pProgramID: *mut u64, - pMediaType: *mut u8, pRegistered: *mut u8, - pLoadState: *mut u8, pAttributes: *mut u32) - -> Result; - pub fn APT_GetAppletProgramInfo(id: u32, flags: u32, - titleversion: *mut u16) -> Result; - pub fn APT_GetProgramID(pProgramID: *mut u64) -> Result; + pub fn APT_GetAppletInfo(appID: NS_APPID, pProgramID: *mut u64_, + pMediaType: *mut u8_, pRegistered: *mut u8, + pLoadState: *mut u8, + pAttributes: *mut APT_AppletAttr) -> Result; + pub fn APT_GetAppletProgramInfo(id: u32_, flags: u32_, + titleversion: *mut u16_) -> Result; + pub fn APT_GetProgramID(pProgramID: *mut u64_) -> Result; pub fn APT_PrepareToJumpToHomeMenu() -> Result; - pub fn APT_JumpToHomeMenu(param: *const u8, paramSize: usize, + pub fn APT_JumpToHomeMenu(param: *const ::libc::c_void, paramSize: size_t, handle: Handle) -> Result; - pub fn APT_PrepareToJumpToApplication(a: u32) -> Result; - pub fn APT_JumpToApplication(param: *const u8, paramSize: usize, - handle: Handle) -> Result; + pub fn APT_PrepareToJumpToApplication(exiting: u8) -> Result; + pub fn APT_JumpToApplication(param: *const ::libc::c_void, + paramSize: size_t, handle: Handle) -> Result; pub fn APT_IsRegistered(appID: NS_APPID, out: *mut u8) -> Result; - pub fn APT_InquireNotification(appID: u32, signalType: *mut APT_Signal) + pub fn APT_InquireNotification(appID: u32_, signalType: *mut APT_Signal) -> Result; pub fn APT_NotifyToWait(appID: NS_APPID) -> Result; - pub fn APT_AppletUtility(out: *mut u32, a: u32, size1: u32, - buf1: *mut u8, size2: u32, buf2: *mut u8) + pub fn APT_AppletUtility(id: ::libc::c_int, out: *mut ::libc::c_void, + outSize: size_t, in_: *const ::libc::c_void, + inSize: size_t) -> Result; + pub fn APT_SleepIfShellClosed() -> Result; + pub fn APT_TryLockTransition(transition: u32_, succeeded: *mut u8) + -> Result; + pub fn APT_UnlockTransition(transition: u32_) -> Result; + pub fn APT_GlanceParameter(appID: NS_APPID, buffer: *mut ::libc::c_void, + bufferSize: size_t, sender: *mut NS_APPID, + command: *mut APT_Command, + actualSize: *mut size_t, + parameter: *mut Handle) -> Result; + pub fn APT_ReceiveParameter(appID: NS_APPID, buffer: *mut ::libc::c_void, + bufferSize: size_t, sender: *mut NS_APPID, + command: *mut APT_Command, + actualSize: *mut size_t, + parameter: *mut Handle) -> Result; + pub fn APT_SendParameter(source: NS_APPID, dest: NS_APPID, + command: APT_Command, + buffer: *const ::libc::c_void, bufferSize: u32_, + parameter: Handle) -> Result; + pub fn APT_CancelParameter(source: NS_APPID, dest: NS_APPID, + success: *mut u8) -> Result; + pub fn APT_SendCaptureBufferInfo(captureBuf: *const aptCaptureBufInfo) -> Result; - pub fn APT_GlanceParameter(appID: NS_APPID, bufferSize: u32, - buffer: *mut u32, actualSize: *mut u32, - signalType: *mut u8) -> Result; - pub fn APT_ReceiveParameter(appID: NS_APPID, bufferSize: u32, - buffer: *mut u32, actualSize: *mut u32, - signalType: *mut u8) -> Result; - pub fn APT_SendParameter(src_appID: NS_APPID, dst_appID: NS_APPID, - bufferSize: u32, buffer: *mut u32, - paramhandle: Handle, signalType: u8) -> Result; - pub fn APT_SendCaptureBufferInfo(bufferSize: u32, buffer: *mut u32) + pub fn APT_ReplySleepQuery(appID: NS_APPID, reply: APT_QueryReply) -> Result; - pub fn APT_ReplySleepQuery(appID: NS_APPID, a: u32) -> Result; pub fn APT_ReplySleepNotificationComplete(appID: NS_APPID) -> Result; - pub fn APT_PrepareToCloseApplication(a: u8) -> Result; - pub fn APT_CloseApplication(param: *const u8, paramSize: usize, - handle: Handle) -> Result; - pub fn APT_SetAppCpuTimeLimit(percent: u32) -> Result; - pub fn APT_GetAppCpuTimeLimit(percent: *mut u32) -> Result; - pub fn APT_CheckNew3DS_Application(out: *mut u8) -> Result; - pub fn APT_CheckNew3DS_System(out: *mut u8) -> Result; + pub fn APT_PrepareToCloseApplication(cancelPreload: u8) -> Result; + pub fn APT_CloseApplication(param: *const ::libc::c_void, + paramSize: size_t, handle: Handle) -> Result; + pub fn APT_SetAppCpuTimeLimit(percent: u32_) -> Result; + pub fn APT_GetAppCpuTimeLimit(percent: *mut u32_) -> Result; pub fn APT_CheckNew3DS(out: *mut u8) -> Result; - pub fn APT_PrepareToDoAppJump(flags: u8, programID: u64, mediatype: u8) - -> Result; - pub fn APT_DoAppJump(NSbuf0Size: u32, NSbuf1Size: u32, - NSbuf0Ptr: *mut u8, NSbuf1Ptr: *mut u8) -> Result; + pub fn APT_PrepareToDoApplicationJump(flags: u8_, programID: u64_, + mediatype: u8_) -> Result; + pub fn APT_DoApplicationJump(param: *const ::libc::c_void, + paramSize: size_t, + hmac: *const ::libc::c_void) -> Result; pub fn APT_PrepareToStartLibraryApplet(appID: NS_APPID) -> Result; - pub fn APT_StartLibraryApplet(appID: NS_APPID, inhandle: Handle, - parambuf: *mut u32, parambufsize: u32) - -> Result; - pub fn APT_LaunchLibraryApplet(appID: NS_APPID, inhandle: Handle, - parambuf: *mut u32, parambufsize: u32) + pub fn APT_StartLibraryApplet(appID: NS_APPID, + param: *const ::libc::c_void, + paramSize: size_t, handle: Handle) -> Result; pub fn APT_PrepareToStartSystemApplet(appID: NS_APPID) -> Result; - pub fn APT_StartSystemApplet(appID: NS_APPID, bufSize: u32, - applHandle: Handle, buf: *mut u8) -> Result; + pub fn APT_StartSystemApplet(appID: NS_APPID, + param: *const ::libc::c_void, + paramSize: size_t, handle: Handle) -> Result; + pub fn APT_GetSharedFont(fontHandle: *mut Handle, mapAddr: *mut u32_) + -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/cam.rs b/ctru-sys/src/services/cam.rs index 5b8398a..872fb39 100644 --- a/ctru-sys/src/services/cam.rs +++ b/ctru-sys/src/services/cam.rs @@ -1,19 +1,21 @@ -// TODO: Determine if anonymous enums are properly represented (they probably aren't) +/* automatically generated by rust-bindgen */ -use ::libc::c_void; -use ::types::*; - -#[derive(Clone, Copy)] -#[repr(C)] +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum Enum_Unnamed1 { PORT_NONE = 0, PORT_CAM1 = 1, PORT_CAM2 = 2, PORT_BOTH = 3, } - -#[derive(Clone, Copy)] -#[repr(C)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum Enum_Unnamed2 { SELECT_NONE = 0, SELECT_OUT1 = 1, @@ -24,30 +26,29 @@ pub enum Enum_Unnamed2 { SELECT_IN1_OUT2 = 6, SELECT_ALL = 7, } -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed3 { +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_Context { CONTEXT_NONE = 0, CONTEXT_A = 1, CONTEXT_B = 2, CONTEXT_BOTH = 3, } - -pub type CAMU_Context = Enum_Unnamed3; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed4 { +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_Flip { FLIP_NONE = 0, FLIP_HORIZONTAL = 1, FLIP_VERTICAL = 2, FLIP_REVERSE = 3, } -pub type CAMU_Flip = Enum_Unnamed4; - -pub const SIZE_CTR_BOTTOM_LCD: Enum_Unnamed5 = Enum_Unnamed5::SIZE_QVGA; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed5 { +pub const SIZE_CTR_BOTTOM_LCD: CAMU_Size = CAMU_Size::SIZE_QVGA; +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_Size { SIZE_VGA = 0, SIZE_QVGA = 1, SIZE_QQVGA = 2, @@ -57,10 +58,9 @@ pub enum Enum_Unnamed5 { SIZE_DS_LCDx4 = 6, SIZE_CTR_TOP_LCD = 7, } -pub type CAMU_Size = Enum_Unnamed5; - -#[derive(Clone, Copy)] -#[repr(C)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum CAMU_FrameRate { FRAME_RATE_15 = 0, FRAME_RATE_15_TO_5 = 1, @@ -76,24 +76,24 @@ pub enum CAMU_FrameRate { FRAME_RATE_20_TO_10 = 11, FRAME_RATE_30_TO_10 = 12, } - -pub const WHITE_BALANCE_NORMAL: Enum_Unnamed7 = - Enum_Unnamed7::WHITE_BALANCE_AUTO; -pub const WHITE_BALANCE_TUNGSTEN: Enum_Unnamed7 = - Enum_Unnamed7::WHITE_BALANCE_3200K; -pub const WHITE_BALANCE_WHITE_FLUORESCENT_LIGHT: Enum_Unnamed7 = - Enum_Unnamed7::WHITE_BALANCE_4150K; -pub const WHITE_BALANCE_DAYLIGHT: Enum_Unnamed7 = - Enum_Unnamed7::WHITE_BALANCE_5200K; -pub const WHITE_BALANCE_CLOUDY: Enum_Unnamed7 = - Enum_Unnamed7::WHITE_BALANCE_6000K; -pub const WHITE_BALANCE_HORIZON: Enum_Unnamed7 = - Enum_Unnamed7::WHITE_BALANCE_6000K; -pub const WHITE_BALANCE_SHADE: Enum_Unnamed7 = - Enum_Unnamed7::WHITE_BALANCE_7000K; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed7 { +pub const WHITE_BALANCE_NORMAL: CAMU_WhiteBalance = + CAMU_WhiteBalance::WHITE_BALANCE_AUTO; +pub const WHITE_BALANCE_TUNGSTEN: CAMU_WhiteBalance = + CAMU_WhiteBalance::WHITE_BALANCE_3200K; +pub const WHITE_BALANCE_WHITE_FLUORESCENT_LIGHT: CAMU_WhiteBalance = + CAMU_WhiteBalance::WHITE_BALANCE_4150K; +pub const WHITE_BALANCE_DAYLIGHT: CAMU_WhiteBalance = + CAMU_WhiteBalance::WHITE_BALANCE_5200K; +pub const WHITE_BALANCE_CLOUDY: CAMU_WhiteBalance = + CAMU_WhiteBalance::WHITE_BALANCE_6000K; +pub const WHITE_BALANCE_HORIZON: CAMU_WhiteBalance = + CAMU_WhiteBalance::WHITE_BALANCE_6000K; +pub const WHITE_BALANCE_SHADE: CAMU_WhiteBalance = + CAMU_WhiteBalance::WHITE_BALANCE_7000K; +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_WhiteBalance { WHITE_BALANCE_AUTO = 0, WHITE_BALANCE_3200K = 1, WHITE_BALANCE_4150K = 2, @@ -101,20 +101,20 @@ pub enum Enum_Unnamed7 { WHITE_BALANCE_6000K = 4, WHITE_BALANCE_7000K = 5, } -pub type CAMU_WhiteBalance = Enum_Unnamed7; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed8 { +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_PhotoMode { PHOTO_MODE_NORMAL = 0, PHOTO_MODE_PORTRAIT = 1, PHOTO_MODE_LANDSCAPE = 2, PHOTO_MODE_NIGHTVIEW = 3, PHOTO_MODE_LETTER = 4, } -pub type CAMU_PhotoMode = Enum_Unnamed8; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed9 { +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_Effect { EFFECT_NONE = 0, EFFECT_MONO = 1, EFFECT_SEPIA = 2, @@ -122,14 +122,13 @@ pub enum Enum_Unnamed9 { EFFECT_NEGAFILM = 4, EFFECT_SEPIA01 = 5, } -pub type CAMU_Effect = Enum_Unnamed9; -pub const CONTRAST_LOW: Enum_Unnamed10 = Enum_Unnamed10::CONTRAST_PATTERN_05; -pub const CONTRAST_NORMAL: Enum_Unnamed10 = - Enum_Unnamed10::CONTRAST_PATTERN_06; -pub const CONTRAST_HIGH: Enum_Unnamed10 = Enum_Unnamed10::CONTRAST_PATTERN_07; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed10 { +pub const CONTRAST_LOW: CAMU_Contrast = CAMU_Contrast::CONTRAST_PATTERN_05; +pub const CONTRAST_NORMAL: CAMU_Contrast = CAMU_Contrast::CONTRAST_PATTERN_06; +pub const CONTRAST_HIGH: CAMU_Contrast = CAMU_Contrast::CONTRAST_PATTERN_07; +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_Contrast { CONTRAST_PATTERN_01 = 0, CONTRAST_PATTERN_02 = 1, CONTRAST_PATTERN_03 = 2, @@ -142,60 +141,57 @@ pub enum Enum_Unnamed10 { CONTRAST_PATTERN_10 = 9, CONTRAST_PATTERN_11 = 10, } -pub type CAMU_Contrast = Enum_Unnamed10; -pub const LENS_CORRECTION_DARK: Enum_Unnamed11 = - Enum_Unnamed11::LENS_CORRECTION_OFF; -pub const LENS_CORRECTION_NORMAL: Enum_Unnamed11 = - Enum_Unnamed11::LENS_CORRECTION_ON_70; -pub const LENS_CORRECTION_BRIGHT: Enum_Unnamed11 = - Enum_Unnamed11::LENS_CORRECTION_ON_90; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed11 { +pub const LENS_CORRECTION_DARK: CAMU_LensCorrection = + CAMU_LensCorrection::LENS_CORRECTION_OFF; +pub const LENS_CORRECTION_NORMAL: CAMU_LensCorrection = + CAMU_LensCorrection::LENS_CORRECTION_ON_70; +pub const LENS_CORRECTION_BRIGHT: CAMU_LensCorrection = + CAMU_LensCorrection::LENS_CORRECTION_ON_90; +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_LensCorrection { LENS_CORRECTION_OFF = 0, LENS_CORRECTION_ON_70 = 1, LENS_CORRECTION_ON_90 = 2, } -pub type CAMU_LensCorrection = Enum_Unnamed11; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed12 { OUTPUT_YUV_422 = 0, OUTPUT_RGB_565 = 1, } -pub type CAMU_OutputFormat = Enum_Unnamed12; -#[derive(Clone, Copy)] -#[repr(C)] -pub enum Enum_Unnamed13 { +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_OutputFormat { OUTPUT_YUV_422 = 0, OUTPUT_RGB_565 = 1, } +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum CAMU_ShutterSoundType { SHUTTER_SOUND_TYPE_NORMAL = 0, SHUTTER_SOUND_TYPE_MOVIE = 1, SHUTTER_SOUND_TYPE_MOVIE_END = 2, } -pub type CAMU_ShutterSoundType = Enum_Unnamed13; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed14 { +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct CAMU_ImageQualityCalibrationData { pub aeBaseTarget: s16, pub kRL: s16, pub kGL: s16, pub kBL: s16, pub ccmPosition: s16, - pub awbCcmL9Right: u16, - pub awbCcmL9Left: u16, - pub awbCcmL10Right: u16, - pub awbCcmL10Left: u16, - pub awbX0Right: u16, - pub awbX0Left: u16, -} -impl ::core::clone::Clone for Struct_Unnamed14 { - fn clone(&self) -> Self { *self } + pub awbCcmL9Right: u16_, + pub awbCcmL9Left: u16_, + pub awbCcmL10Right: u16_, + pub awbCcmL10Left: u16_, + pub awbX0Right: u16_, + pub awbX0Left: u16_, } -impl ::core::default::Default for Struct_Unnamed14 { +impl ::core::default::Default for CAMU_ImageQualityCalibrationData { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type CAMU_ImageQualityCalibrationData = Struct_Unnamed14; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed15 { - pub isValidRotationXY: u8, - pub padding: [u8; 3usize], +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct CAMU_StereoCameraCalibrationData { + pub isValidRotationXY: u8_, + pub padding: [u8_; 3usize], pub scale: f32, pub rotationZ: f32, pub translationX: f32, @@ -208,30 +204,27 @@ pub struct Struct_Unnamed15 { pub distanceCameras: f32, pub imageWidth: s16, pub imageHeight: s16, - pub reserved: [u8; 16usize], + pub reserved: [u8_; 16usize], } -impl ::core::clone::Clone for Struct_Unnamed15 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed15 { +impl ::core::default::Default for CAMU_StereoCameraCalibrationData { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type CAMU_StereoCameraCalibrationData = Struct_Unnamed15; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed16 { - pub camera: u8, +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct CAMU_PackageParameterCameraSelect { + pub camera: u8_, pub exposure: s8, - pub whiteBalance: u8, + pub whiteBalance: u8_, pub sharpness: s8, - pub autoExposureOn: u8, - pub autoWhiteBalanceOn: u8, - pub frameRate: u8, - pub photoMode: u8, - pub contrast: u8, - pub lensCorrection: u8, - pub noiseFilterOn: u8, - pub padding: u8, + pub autoExposureOn: u8_, + pub autoWhiteBalanceOn: u8_, + pub frameRate: u8_, + pub photoMode: u8_, + pub contrast: u8_, + pub lensCorrection: u8_, + pub noiseFilterOn: u8_, + pub padding: u8_, pub autoExposureWindowX: s16, pub autoExposureWindowY: s16, pub autoExposureWindowWidth: s16, @@ -241,36 +234,30 @@ pub struct Struct_Unnamed16 { pub autoWhiteBalanceWindowWidth: s16, pub autoWhiteBalanceWindowHeight: s16, } -impl ::core::clone::Clone for Struct_Unnamed16 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed16 { +impl ::core::default::Default for CAMU_PackageParameterCameraSelect { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type CAMU_PackageParameterCameraSelect = Struct_Unnamed16; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed17 { - pub camera: u8, - pub context: u8, - pub flip: u8, - pub effect: u8, - pub size: u8, +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct CAMU_PackageParameterContext { + pub camera: u8_, + pub context: u8_, + pub flip: u8_, + pub effect: u8_, + pub size: u8_, } -impl ::core::clone::Clone for Struct_Unnamed17 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed17 { +impl ::core::default::Default for CAMU_PackageParameterContext { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type CAMU_PackageParameterContext = Struct_Unnamed17; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed18 { - pub camera: u8, - pub context: u8, - pub flip: u8, - pub effect: u8, +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct CAMU_PackageParameterContextDetail { + pub camera: u8_, + pub context: u8_, + pub flip: u8_, + pub effect: u8_, pub width: s16, pub height: s16, pub cropX0: s16, @@ -278,93 +265,87 @@ pub struct Struct_Unnamed18 { pub cropX1: s16, pub cropY1: s16, } -impl ::core::clone::Clone for Struct_Unnamed18 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed18 { +impl ::core::default::Default for CAMU_PackageParameterContextDetail { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type CAMU_PackageParameterContextDetail = Struct_Unnamed18; - -use services::y2r::Y2RU_StandardCoefficient; extern "C" { pub fn camInit() -> Result; pub fn camExit(); - pub fn CAMU_StartCapture(port: u32) -> Result; - pub fn CAMU_StopCapture(port: u32) -> Result; - pub fn CAMU_IsBusy(busy: *mut u8, port: u32) -> Result; - pub fn CAMU_ClearBuffer(port: u32) -> Result; - pub fn CAMU_GetVsyncInterruptEvent(event: *mut Handle, port: u32) + pub fn CAMU_StartCapture(port: u32_) -> Result; + pub fn CAMU_StopCapture(port: u32_) -> Result; + pub fn CAMU_IsBusy(busy: *mut u8, port: u32_) -> Result; + pub fn CAMU_ClearBuffer(port: u32_) -> Result; + pub fn CAMU_GetVsyncInterruptEvent(event: *mut Handle, port: u32_) + -> Result; + pub fn CAMU_GetBufferErrorInterruptEvent(event: *mut Handle, port: u32_) -> Result; - pub fn CAMU_GetBufferErrorInterruptEvent(event: *mut Handle, port: u32) + pub fn CAMU_SetReceiving(event: *mut Handle, dst: *mut ::libc::c_void, + port: u32_, imageSize: u32_, transferUnit: s16) -> Result; - pub fn CAMU_SetReceiving(event: *mut Handle, - dst: *mut c_void, port: u32, - imageSize: u32, transferUnit: s16) -> Result; - pub fn CAMU_IsFinishedReceiving(finishedReceiving: *mut u8, port: u32) + pub fn CAMU_IsFinishedReceiving(finishedReceiving: *mut u8, port: u32_) -> Result; - pub fn CAMU_SetTransferLines(port: u32, lines: s16, width: s16, + pub fn CAMU_SetTransferLines(port: u32_, lines: s16, width: s16, height: s16) -> Result; pub fn CAMU_GetMaxLines(maxLines: *mut s16, width: s16, height: s16) -> Result; - pub fn CAMU_SetTransferBytes(port: u32, bytes: u32, width: s16, + pub fn CAMU_SetTransferBytes(port: u32_, bytes: u32_, width: s16, height: s16) -> Result; - pub fn CAMU_GetTransferBytes(transferBytes: *mut u32, port: u32) + pub fn CAMU_GetTransferBytes(transferBytes: *mut u32_, port: u32_) -> Result; - pub fn CAMU_GetMaxBytes(maxBytes: *mut u32, width: s16, height: s16) + pub fn CAMU_GetMaxBytes(maxBytes: *mut u32_, width: s16, height: s16) -> Result; - pub fn CAMU_SetTrimming(port: u32, trimming: u8) -> Result; - pub fn CAMU_IsTrimming(trimming: *mut u8, port: u32) -> Result; - pub fn CAMU_SetTrimmingParams(port: u32, xStart: s16, yStart: s16, + pub fn CAMU_SetTrimming(port: u32_, trimming: u8) -> Result; + pub fn CAMU_IsTrimming(trimming: *mut u8, port: u32_) -> Result; + pub fn CAMU_SetTrimmingParams(port: u32_, xStart: s16, yStart: s16, xEnd: s16, yEnd: s16) -> Result; pub fn CAMU_GetTrimmingParams(xStart: *mut s16, yStart: *mut s16, - xEnd: *mut s16, yEnd: *mut s16, port: u32) + xEnd: *mut s16, yEnd: *mut s16, port: u32_) -> Result; - pub fn CAMU_SetTrimmingParamsCenter(port: u32, trimWidth: s16, + pub fn CAMU_SetTrimmingParamsCenter(port: u32_, trimWidth: s16, trimHeight: s16, camWidth: s16, camHeight: s16) -> Result; - pub fn CAMU_Activate(select: u32) -> Result; - pub fn CAMU_SwitchContext(select: u32, context: CAMU_Context) -> Result; - pub fn CAMU_SetExposure(select: u32, exposure: s8) -> Result; - pub fn CAMU_SetWhiteBalance(select: u32, whiteBalance: CAMU_WhiteBalance) + pub fn CAMU_Activate(select: u32_) -> Result; + pub fn CAMU_SwitchContext(select: u32_, context: CAMU_Context) -> Result; + pub fn CAMU_SetExposure(select: u32_, exposure: s8) -> Result; + pub fn CAMU_SetWhiteBalance(select: u32_, whiteBalance: CAMU_WhiteBalance) -> Result; - pub fn CAMU_SetWhiteBalanceWithoutBaseUp(select: u32, + pub fn CAMU_SetWhiteBalanceWithoutBaseUp(select: u32_, whiteBalance: CAMU_WhiteBalance) -> Result; - pub fn CAMU_SetSharpness(select: u32, sharpness: s8) -> Result; - pub fn CAMU_SetAutoExposure(select: u32, autoExposure: u8) -> Result; - pub fn CAMU_IsAutoExposure(autoExposure: *mut u8, select: u32) -> Result; - pub fn CAMU_SetAutoWhiteBalance(select: u32, autoWhiteBalance: u8) + pub fn CAMU_SetSharpness(select: u32_, sharpness: s8) -> Result; + pub fn CAMU_SetAutoExposure(select: u32_, autoExposure: u8) -> Result; + pub fn CAMU_IsAutoExposure(autoExposure: *mut u8, select: u32_) -> Result; + pub fn CAMU_SetAutoWhiteBalance(select: u32_, autoWhiteBalance: u8) -> Result; - pub fn CAMU_IsAutoWhiteBalance(autoWhiteBalance: *mut u8, select: u32) + pub fn CAMU_IsAutoWhiteBalance(autoWhiteBalance: *mut u8, select: u32_) -> Result; - pub fn CAMU_FlipImage(select: u32, flip: CAMU_Flip, + pub fn CAMU_FlipImage(select: u32_, flip: CAMU_Flip, context: CAMU_Context) -> Result; - pub fn CAMU_SetDetailSize(select: u32, width: s16, height: s16, + pub fn CAMU_SetDetailSize(select: u32_, width: s16, height: s16, cropX0: s16, cropY0: s16, cropX1: s16, cropY1: s16, context: CAMU_Context) -> Result; - pub fn CAMU_SetSize(select: u32, size: CAMU_Size, context: CAMU_Context) + pub fn CAMU_SetSize(select: u32_, size: CAMU_Size, context: CAMU_Context) -> Result; - pub fn CAMU_SetFrameRate(select: u32, frameRate: CAMU_FrameRate) + pub fn CAMU_SetFrameRate(select: u32_, frameRate: CAMU_FrameRate) -> Result; - pub fn CAMU_SetPhotoMode(select: u32, photoMode: CAMU_PhotoMode) + pub fn CAMU_SetPhotoMode(select: u32_, photoMode: CAMU_PhotoMode) -> Result; - pub fn CAMU_SetEffect(select: u32, effect: CAMU_Effect, + pub fn CAMU_SetEffect(select: u32_, effect: CAMU_Effect, context: CAMU_Context) -> Result; - pub fn CAMU_SetContrast(select: u32, contrast: CAMU_Contrast) -> Result; - pub fn CAMU_SetLensCorrection(select: u32, + pub fn CAMU_SetContrast(select: u32_, contrast: CAMU_Contrast) -> Result; + pub fn CAMU_SetLensCorrection(select: u32_, lensCorrection: CAMU_LensCorrection) -> Result; - pub fn CAMU_SetOutputFormat(select: u32, format: CAMU_OutputFormat, + pub fn CAMU_SetOutputFormat(select: u32_, format: CAMU_OutputFormat, context: CAMU_Context) -> Result; - pub fn CAMU_SetAutoExposureWindow(select: u32, x: s16, y: s16, + pub fn CAMU_SetAutoExposureWindow(select: u32_, x: s16, y: s16, width: s16, height: s16) -> Result; - pub fn CAMU_SetAutoWhiteBalanceWindow(select: u32, x: s16, y: s16, + pub fn CAMU_SetAutoWhiteBalanceWindow(select: u32_, x: s16, y: s16, width: s16, height: s16) -> Result; - pub fn CAMU_SetNoiseFilter(select: u32, noiseFilter: u8) -> Result; - pub fn CAMU_SynchronizeVsyncTiming(select1: u32, select2: u32) + pub fn CAMU_SetNoiseFilter(select: u32_, noiseFilter: u8) -> Result; + pub fn CAMU_SynchronizeVsyncTiming(select1: u32_, select2: u32_) -> Result; - pub fn CAMU_GetLatestVsyncTiming(timing: *mut s64, port: u32, past: u32) + pub fn CAMU_GetLatestVsyncTiming(timing: *mut s64, port: u32_, past: u32_) -> Result; pub fn CAMU_GetStereoCameraCalibrationData(data: *mut CAMU_StereoCameraCalibrationData) @@ -372,14 +353,14 @@ extern "C" { pub fn CAMU_SetStereoCameraCalibrationData(data: CAMU_StereoCameraCalibrationData) -> Result; - pub fn CAMU_WriteRegisterI2c(select: u32, addr: u16, data: u16) + pub fn CAMU_WriteRegisterI2c(select: u32_, addr: u16_, data: u16_) -> Result; - pub fn CAMU_WriteMcuVariableI2c(select: u32, addr: u16, data: u16) + pub fn CAMU_WriteMcuVariableI2c(select: u32_, addr: u16_, data: u16_) -> Result; - pub fn CAMU_ReadRegisterI2cExclusive(data: *mut u16, select: u32, - addr: u16) -> Result; - pub fn CAMU_ReadMcuVariableI2cExclusive(data: *mut u16, select: u32, - addr: u16) -> Result; + pub fn CAMU_ReadRegisterI2cExclusive(data: *mut u16_, select: u32_, + addr: u16_) -> Result; + pub fn CAMU_ReadMcuVariableI2cExclusive(data: *mut u16_, select: u32_, + addr: u16_) -> Result; pub fn CAMU_SetImageQualityCalibrationData(data: CAMU_ImageQualityCalibrationData) -> Result; @@ -401,9 +382,11 @@ extern "C" { pub fn CAMU_PlayShutterSound(sound: CAMU_ShutterSoundType) -> Result; pub fn CAMU_DriverInitialize() -> Result; pub fn CAMU_DriverFinalize() -> Result; - pub fn CAMU_GetActivatedCamera(select: *mut u32) -> Result; - pub fn CAMU_GetSleepCamera(select: *mut u32) -> Result; - pub fn CAMU_SetSleepCamera(select: u32) -> Result; + pub fn CAMU_GetActivatedCamera(select: *mut u32_) -> Result; + pub fn CAMU_GetSleepCamera(select: *mut u32_) -> Result; + pub fn CAMU_SetSleepCamera(select: u32_) -> Result; pub fn CAMU_SetBrightnessSynchronization(brightnessSynchronization: u8) -> Result; } +use ::types::*; +use super::y2r::*; diff --git a/ctru-sys/src/services/cfgnor.rs b/ctru-sys/src/services/cfgnor.rs index c2c1e44..f85dd02 100644 --- a/ctru-sys/src/services/cfgnor.rs +++ b/ctru-sys/src/services/cfgnor.rs @@ -1,14 +1,19 @@ -use ::Result; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { - pub fn cfgnorInit(value: u8) -> Result; + pub fn cfgnorInit(value: u8_) -> Result; pub fn cfgnorExit(); - pub fn cfgnorDumpFlash(buf: *mut u32, size: u32) -> Result; - pub fn cfgnorWriteFlash(buf: *mut u32, size: u32) -> Result; - pub fn CFGNOR_Initialize(value: u8) -> Result; + pub fn cfgnorDumpFlash(buf: *mut u32_, size: u32_) -> Result; + pub fn cfgnorWriteFlash(buf: *mut u32_, size: u32_) -> Result; + pub fn CFGNOR_Initialize(value: u8_) -> Result; pub fn CFGNOR_Shutdown() -> Result; - pub fn CFGNOR_ReadData(offset: u32, buf: *mut u32, size: u32) + pub fn CFGNOR_ReadData(offset: u32_, buf: *mut u32_, size: u32_) -> Result; - pub fn CFGNOR_WriteData(offset: u32, buf: *mut u32, size: u32) + pub fn CFGNOR_WriteData(offset: u32_, buf: *mut u32_, size: u32_) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/cfgu.rs b/ctru-sys/src/services/cfgu.rs index f1663f0..c4824c2 100644 --- a/ctru-sys/src/services/cfgu.rs +++ b/ctru-sys/src/services/cfgu.rs @@ -1,7 +1,12 @@ -use ::Result; +/* automatically generated by rust-bindgen */ -#[repr(C)] -#[derive(Clone, Copy)] +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum CFG_Region { CFG_REGION_JPN = 0, CFG_REGION_USA = 1, @@ -11,9 +16,9 @@ pub enum CFG_Region { CFG_REGION_KOR = 5, CFG_REGION_TWN = 6, } - -#[repr(C)] -#[derive(Clone, Copy)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum CFG_Language { CFG_LANGUAGE_JP = 0, CFG_LANGUAGE_EN = 1, @@ -28,19 +33,28 @@ pub enum CFG_Language { CFG_LANGUAGE_RU = 10, CFG_LANGUAGE_TW = 11, } - extern "C" { pub fn cfguInit() -> Result; pub fn cfguExit(); - pub fn CFGU_SecureInfoGetRegion(region: *mut u8) -> Result; - pub fn CFGU_GenHashConsoleUnique(appIDSalt: u32, hash: *mut u64) + pub fn CFGU_SecureInfoGetRegion(region: *mut u8_) -> Result; + pub fn CFGU_GenHashConsoleUnique(appIDSalt: u32_, hash: *mut u64_) + -> Result; + pub fn CFGU_GetRegionCanadaUSA(value: *mut u8_) -> Result; + pub fn CFGU_GetSystemModel(model: *mut u8_) -> Result; + pub fn CFGU_GetModelNintendo2DS(value: *mut u8_) -> Result; + pub fn CFGU_GetCountryCodeString(code: u16_, string: *mut u16_) -> Result; + pub fn CFGU_GetCountryCodeID(string: u16_, code: *mut u16_) -> Result; + pub fn CFGU_GetConfigInfoBlk2(size: u32_, blkID: u32_, outData: *mut u8_) + -> Result; + pub fn CFG_GetConfigInfoBlk4(size: u32_, blkID: u32_, outData: *mut u8_) + -> Result; + pub fn CFG_GetConfigInfoBlk8(size: u32_, blkID: u32_, outData: *mut u8_) + -> Result; + pub fn CFG_SetConfigInfoBlk4(size: u32_, blkID: u32_, inData: *mut u8_) -> Result; - pub fn CFGU_GetRegionCanadaUSA(value: *mut u8) -> Result; - pub fn CFGU_GetSystemModel(model: *mut u8) -> Result; - pub fn CFGU_GetModelNintendo2DS(value: *mut u8) -> Result; - pub fn CFGU_GetCountryCodeString(code: u16, string: *mut u16) -> Result; - pub fn CFGU_GetCountryCodeID(string: u16, code: *mut u16) -> Result; - pub fn CFGU_GetConfigInfoBlk2(size: u32, blkID: u32, outData: *mut u8) + pub fn CFG_SetConfigInfoBlk8(size: u32_, blkID: u32_, inData: *mut u8_) -> Result; - pub fn CFGU_GetSystemLanguage(language: *mut u8) -> Result; + pub fn CFG_UpdateConfigNANDSavegame() -> Result; + pub fn CFGU_GetSystemLanguage(language: *mut u8_) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/dsp.rs b/ctru-sys/src/services/dsp.rs index de8241e..fceb935 100644 --- a/ctru-sys/src/services/dsp.rs +++ b/ctru-sys/src/services/dsp.rs @@ -1,48 +1,45 @@ -use ::{Handle, Result}; -use ::libc::c_void; - -#[repr(C)] -#[derive(Clone, Copy)] -pub enum DSP_InterruptType { - DSP_INTERRUPT_PIPE = 2, -} - -#[repr(C)] -#[derive(Clone, Copy)] -pub enum DSP_PipeDirection { - DSP_PIPE_INPUT = 0, - DSP_PIPE_OUTPUT = 1, -} +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum DSP_InterruptType { DSP_INTERRUPT_PIPE = 2, } +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum DSP_PipeDirection { DSP_PIPE_INPUT = 0, DSP_PIPE_OUTPUT = 1, } extern "C" { pub fn dspInit() -> Result; pub fn dspExit(); pub fn DSP_GetHeadphoneStatus(is_inserted: *mut u8) -> Result; - pub fn DSP_FlushDataCache(address: *const c_void, - size: u32) -> Result; - pub fn DSP_InvalidateDataCache(address: *const c_void, - size: u32) -> Result; + pub fn DSP_FlushDataCache(address: *const ::libc::c_void, size: u32_) + -> Result; + pub fn DSP_InvalidateDataCache(address: *const ::libc::c_void, size: u32_) + -> Result; pub fn DSP_GetSemaphoreHandle(semaphore: *mut Handle) -> Result; - pub fn DSP_SetSemaphore(value: u16) -> Result; - pub fn DSP_SetSemaphoreMask(mask: u16) -> Result; - pub fn DSP_LoadComponent(component: *const c_void, - size: u32, prog_mask: u16, data_mask: u16, + pub fn DSP_SetSemaphore(value: u16_) -> Result; + pub fn DSP_SetSemaphoreMask(mask: u16_) -> Result; + pub fn DSP_LoadComponent(component: *const ::libc::c_void, size: u32_, + prog_mask: u16_, data_mask: u16_, is_loaded: *mut u8) -> Result; pub fn DSP_UnloadComponent() -> Result; - pub fn DSP_RegisterInterruptEvents(handle: Handle, interrupt: u32, - channel: u32) -> Result; - pub fn DSP_ReadPipeIfPossible(channel: u32, peer: u32, - buffer: *mut c_void, - length: u16, length_read: *mut u16) - -> Result; - pub fn DSP_WriteProcessPipe(channel: u32, - buffer: *const c_void, - length: u32) -> Result; - pub fn DSP_ConvertProcessAddressFromDspDram(dsp_address: u32, - arm_address: *mut u32) + pub fn DSP_RegisterInterruptEvents(handle: Handle, interrupt: u32_, + channel: u32_) -> Result; + pub fn DSP_ReadPipeIfPossible(channel: u32_, peer: u32_, + buffer: *mut ::libc::c_void, length: u16_, + length_read: *mut u16_) -> Result; + pub fn DSP_WriteProcessPipe(channel: u32_, buffer: *const ::libc::c_void, + length: u32_) -> Result; + pub fn DSP_ConvertProcessAddressFromDspDram(dsp_address: u32_, + arm_address: *mut u32_) -> Result; - pub fn DSP_RecvData(regNo: u16, value: *mut u16) -> Result; - pub fn DSP_RecvDataIsReady(regNo: u16, is_ready: *mut u8) -> Result; - pub fn DSP_SendData(regNo: u16, value: u16) -> Result; - pub fn DSP_SendDataIsEmpty(regNo: u16, is_empty: *mut u8) -> Result; + pub fn DSP_RecvData(regNo: u16_, value: *mut u16_) -> Result; + pub fn DSP_RecvDataIsReady(regNo: u16_, is_ready: *mut u8) -> Result; + pub fn DSP_SendData(regNo: u16_, value: u16_) -> Result; + pub fn DSP_SendDataIsEmpty(regNo: u16_, is_empty: *mut u8) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/gspgpu.rs b/ctru-sys/src/services/gspgpu.rs index f4ea25e..0b76304 100644 --- a/ctru-sys/src/services/gspgpu.rs +++ b/ctru-sys/src/services/gspgpu.rs @@ -1,31 +1,27 @@ -use ::libc::c_void; -use ::types::*; - -#[inline] -pub fn GSPGPU_REBASE_REG(r: u32) { - ((r)-0x1EB00000); -} +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct GSPGPU_FramebufferInfo { - pub active_framebuf: u32, - pub framebuf0_vaddr: *mut u32, - pub framebuf1_vaddr: *mut u32, - pub framebuf_widthbytesize: u32, - pub format: u32, - pub framebuf_dispselect: u32, - pub unk: u32, -} -impl ::core::clone::Clone for GSPGPU_FramebufferInfo { - fn clone(&self) -> Self { *self } + pub active_framebuf: u32_, + pub framebuf0_vaddr: *mut u32_, + pub framebuf1_vaddr: *mut u32_, + pub framebuf_widthbytesize: u32_, + pub format: u32_, + pub framebuf_dispselect: u32_, + pub unk: u32_, } impl ::core::default::Default for GSPGPU_FramebufferInfo { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - -#[derive(Clone, Copy)] -#[repr(C)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum GSPGPU_FramebufferFormats { GSP_RGBA8_OES = 0, GSP_BGR8_OES = 1, @@ -33,35 +29,30 @@ pub enum GSPGPU_FramebufferFormats { GSP_RGB5_A1_OES = 3, GSP_RGBA4_OES = 4, } - #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct GSPGPU_CaptureInfoEntry { - pub framebuf0_vaddr: *mut u32, - pub framebuf1_vaddr: *mut u32, - pub format: u32, - pub framebuf_widthbytesize: u32, -} -impl ::core::clone::Clone for GSPGPU_CaptureInfoEntry { - fn clone(&self) -> Self { *self } + pub framebuf0_vaddr: *mut u32_, + pub framebuf1_vaddr: *mut u32_, + pub format: u32_, + pub framebuf_widthbytesize: u32_, } impl ::core::default::Default for GSPGPU_CaptureInfoEntry { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct GSPGPU_CaptureInfo { pub screencapture: [GSPGPU_CaptureInfoEntry; 2usize], } -impl ::core::clone::Clone for GSPGPU_CaptureInfo { - fn clone(&self) -> Self { *self } -} impl ::core::default::Default for GSPGPU_CaptureInfo { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - -#[repr(C)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum GSPGPU_Event { GSPGPU_EVENT_PSC0 = 0, GSPGPU_EVENT_PSC1 = 1, @@ -72,46 +63,45 @@ pub enum GSPGPU_Event { GSPGPU_EVENT_DMA = 6, GSPGPU_EVENT_MAX = 7, } - extern "C" { pub fn gspInit() -> Result; pub fn gspExit(); pub fn gspSetEventCallback(id: GSPGPU_Event, cb: ThreadFunc, - data: *mut c_void, - oneShot: u8); + data: *mut ::libc::c_void, oneShot: u8); pub fn gspInitEventHandler(gspEvent: Handle, gspSharedMem: *mut vu8, - gspThreadId: u8) -> Result; + gspThreadId: u8_) -> Result; pub fn gspExitEventHandler(); pub fn gspWaitForEvent(id: GSPGPU_Event, nextEvent: u8); pub fn gspWaitForAnyEvent() -> GSPGPU_Event; - pub fn gspSubmitGxCommand(sharedGspCmdBuf: *mut u32, - gxCommand: *mut u32) -> Result; - pub fn GSPGPU_AcquireRight(flags: u8) -> Result; + pub fn gspSubmitGxCommand(sharedGspCmdBuf: *mut u32_, + gxCommand: *mut u32_) -> Result; + pub fn GSPGPU_AcquireRight(flags: u8_) -> Result; pub fn GSPGPU_ReleaseRight() -> Result; pub fn GSPGPU_ImportDisplayCaptureInfo(captureinfo: *mut GSPGPU_CaptureInfo) -> Result; pub fn GSPGPU_SaveVramSysArea() -> Result; pub fn GSPGPU_RestoreVramSysArea() -> Result; - pub fn GSPGPU_SetLcdForceBlack(flags: u8) -> Result; - pub fn GSPGPU_SetBufferSwap(screenid: u32, + pub fn GSPGPU_SetLcdForceBlack(flags: u8_) -> Result; + pub fn GSPGPU_SetBufferSwap(screenid: u32_, framebufinfo: *mut GSPGPU_FramebufferInfo) -> Result; - pub fn GSPGPU_FlushDataCache(adr: *const c_void, - size: u32) -> Result; - pub fn GSPGPU_InvalidateDataCache(adr: *const c_void, - size: u32) -> Result; - pub fn GSPGPU_WriteHWRegs(regAddr: u32, data: *mut u32, size: u8) + pub fn GSPGPU_FlushDataCache(adr: *const ::libc::c_void, size: u32_) + -> Result; + pub fn GSPGPU_InvalidateDataCache(adr: *const ::libc::c_void, size: u32_) -> Result; - pub fn GSPGPU_WriteHWRegsWithMask(regAddr: u32, data: *mut u32, - datasize: u8, maskdata: *mut u32, - masksize: u8) -> Result; - pub fn GSPGPU_ReadHWRegs(regAddr: u32, data: *mut u32, size: u8) + pub fn GSPGPU_WriteHWRegs(regAddr: u32_, data: *mut u32_, size: u8_) + -> Result; + pub fn GSPGPU_WriteHWRegsWithMask(regAddr: u32_, data: *mut u32_, + datasize: u8_, maskdata: *mut u32_, + masksize: u8_) -> Result; + pub fn GSPGPU_ReadHWRegs(regAddr: u32_, data: *mut u32_, size: u8_) -> Result; pub fn GSPGPU_RegisterInterruptRelayQueue(eventHandle: Handle, - flags: u32, + flags: u32_, outMemHandle: *mut Handle, - threadID: *mut u8) -> Result; + threadID: *mut u8_) -> Result; pub fn GSPGPU_UnregisterInterruptRelayQueue() -> Result; pub fn GSPGPU_TriggerCmdReqQueue() -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/gsplcd.rs b/ctru-sys/src/services/gsplcd.rs index 332ebef..5d9188e 100644 --- a/ctru-sys/src/services/gsplcd.rs +++ b/ctru-sys/src/services/gsplcd.rs @@ -1,9 +1,12 @@ -//TODO: Verify if anonymous enum is properly represented +/* automatically generated by rust-bindgen */ -use ::Result; - -#[derive(Clone, Copy)] -#[repr(C)] +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum Enum_Unnamed1 { GSPLCD_SCREEN_TOP = 1, GSPLCD_SCREEN_BOTTOM = 2, @@ -12,6 +15,8 @@ pub enum Enum_Unnamed1 { extern "C" { pub fn gspLcdInit() -> Result; pub fn gspLcdExit(); - pub fn GSPLCD_PowerOnBacklight(screen: u32) -> Result; - pub fn GSPLCD_PowerOffBacklight(screen: u32) -> Result; + pub fn GSPLCD_PowerOnBacklight(screen: u32_) -> Result; + pub fn GSPLCD_PowerOffBacklight(screen: u32_) -> Result; + pub fn GSPLCD_GetVendors(vendors: *mut u8_) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/hb.rs b/ctru-sys/src/services/hb.rs deleted file mode 100644 index 6d6264e..0000000 --- a/ctru-sys/src/services/hb.rs +++ /dev/null @@ -1,13 +0,0 @@ -use ::Result; -use ::libc::c_void; - - -extern "C" { - pub fn hbInit() -> Result; - pub fn hbExit() -> (); - pub fn HB_FlushInvalidateCache() -> Result; - pub fn HB_GetBootloaderAddresses(load3dsx: *mut *mut c_void, setArgv: *mut *mut c_void) - -> Result; - pub fn HB_ReprotectMemory(addr: *mut u32, pages: u32, mode: u32, reprotectedPages: *mut u32) - -> Result; -} diff --git a/ctru-sys/src/services/hid.rs b/ctru-sys/src/services/hid.rs index 129ef7e..2f7f95c 100644 --- a/ctru-sys/src/services/hid.rs +++ b/ctru-sys/src/services/hid.rs @@ -1,8 +1,12 @@ -use ::types::*; - -pub const HID_SHAREDMEM_DEFAULT: u32 = 0x10000000; +/* automatically generated by rust-bindgen */ -#[repr(C)] +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum PAD_KEY { KEY_A = 1, KEY_B = 2, @@ -26,50 +30,57 @@ pub enum PAD_KEY { KEY_CPAD_RIGHT = 268435456, KEY_CPAD_LEFT = 536870912, KEY_CPAD_UP = 1073741824, - KEY_CPAD_DOWN = -2147483648, + KEY_CPAD_DOWN = 2147483648, KEY_UP = 1073741888, - KEY_DOWN = -2147483520, + KEY_DOWN = 2147483776, KEY_LEFT = 536870944, KEY_RIGHT = 268435472, - - // Generic catch-all directions - /*KEY_UP = KEY_DUP | KEY_CPAD_UP, - KEY_DOWN = KEY_DDOWN | KEY_CPAD_DOWN, - KEY_LEFT = KEY_DLEFT | KEY_CPAD_LEFT, - KEY_RIGHT = KEY_DRIGHT | KEY_CPAD_RIGHT,*/ } - #[repr(C)] -#[derive(Clone, Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct touchPosition { - px: u16, - py: u16, + pub px: u16_, + pub py: u16_, +} +impl ::core::default::Default for touchPosition { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - #[repr(C)] -#[derive(Clone, Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct circlePosition { - dx: s16, - dy: s16, + pub dx: s16, + pub dy: s16, +} +impl ::core::default::Default for circlePosition { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - #[repr(C)] -#[derive(Clone, Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct accelVector { - x: s16, - y: s16, - z: s16 + pub x: s16, + pub y: s16, + pub z: s16, +} +impl ::core::default::Default for accelVector { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - #[repr(C)] -#[derive(Clone, Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct angularRate { - x: s16, //roll - z: s16, //yaw - y: s16, //pitch + pub x: s16, + pub z: s16, + pub y: s16, } - -#[repr(C)] +impl ::core::default::Default for angularRate { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum HID_Event { HIDEVENT_PAD0 = 0, HIDEVENT_PAD1 = 1, @@ -77,17 +88,18 @@ pub enum HID_Event { HIDEVENT_Gyro = 3, HIDEVENT_DebugPad = 4, HIDEVENT_MAX = 5, - } - - +extern "C" { + pub static mut hidMemHandle: Handle; + pub static mut hidSharedMem: *mut vu32; +} extern "C" { pub fn hidInit() -> Result; pub fn hidExit(); pub fn hidScanInput(); - pub fn hidKeysHeld() -> u32; - pub fn hidKeysDown() -> u32; - pub fn hidKeysUp() -> u32; + pub fn hidKeysHeld() -> u32_; + pub fn hidKeysDown() -> u32_; + pub fn hidKeysUp() -> u32_; pub fn hidTouchRead(pos: *mut touchPosition); pub fn hidCircleRead(pos: *mut circlePosition); pub fn hidAccelRead(vector: *mut accelVector); @@ -101,9 +113,7 @@ extern "C" { pub fn HIDUSER_DisableAccelerometer() -> Result; pub fn HIDUSER_EnableGyroscope() -> Result; pub fn HIDUSER_DisableGyroscope() -> Result; - pub fn HIDUSER_GetGyroscopeRawToDpsCoefficient(coeff: - *mut f32) - -> Result; - pub fn HIDUSER_GetSoundVolume(volume: *mut u8) -> Result; + pub fn HIDUSER_GetGyroscopeRawToDpsCoefficient(coeff: *mut f32) -> Result; + pub fn HIDUSER_GetSoundVolume(volume: *mut u8_) -> Result; } - +use ::types::*; diff --git a/ctru-sys/src/services/httpc.rs b/ctru-sys/src/services/httpc.rs index ba4eba4..9505f53 100644 --- a/ctru-sys/src/services/httpc.rs +++ b/ctru-sys/src/services/httpc.rs @@ -1,79 +1,126 @@ -use ::{Handle, Result}; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct httpcContext { pub servhandle: Handle, - pub httphandle: u32, -} -impl ::core::clone::Clone for httpcContext { - fn clone(&self) -> Self { *self } + pub httphandle: u32_, } impl ::core::default::Default for httpcContext { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - -#[derive(Clone, Copy)] -#[repr(C)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum HTTPC_RequestMethod { + HTTPC_METHOD_GET = 1, + HTTPC_METHOD_POST = 2, + HTTPC_METHOD_HEAD = 3, + HTTPC_METHOD_PUT = 4, + HTTPC_METHOD_DELETE = 5, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum HTTPC_RequestStatus { HTTPC_STATUS_REQUEST_IN_PROGRESS = 5, HTTPC_STATUS_DOWNLOAD_READY = 7, } - +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum HTTPC_KeepAlive { + HTTPC_KEEPALIVE_DISABLED = 0, + HTTPC_KEEPALIVE_ENABLED = 1, +} extern "C" { - pub fn httpcInit() -> Result; + pub fn httpcInit(sharedmem_size: u32_) -> Result; pub fn httpcExit(); pub fn httpcOpenContext(context: *mut httpcContext, - url: *mut u8, - use_defaultproxy: u32) -> Result; + method: HTTPC_RequestMethod, + url: *const ::libc::c_char, + use_defaultproxy: u32_) -> Result; pub fn httpcCloseContext(context: *mut httpcContext) -> Result; + pub fn httpcCancelConnection(context: *mut httpcContext) -> Result; pub fn httpcAddRequestHeaderField(context: *mut httpcContext, - name: *mut u8, - value: *mut u8) - -> Result; + name: *const ::libc::c_char, + value: *const ::libc::c_char) -> Result; + pub fn httpcAddPostDataAscii(context: *mut httpcContext, + name: *const ::libc::c_char, + value: *const ::libc::c_char) -> Result; + pub fn httpcAddPostDataRaw(context: *mut httpcContext, data: *const u32_, + len: u32_) -> Result; pub fn httpcBeginRequest(context: *mut httpcContext) -> Result; - pub fn httpcReceiveData(context: *mut httpcContext, buffer: *mut u8, - size: u32) -> Result; + pub fn httpcReceiveData(context: *mut httpcContext, buffer: *mut u8_, + size: u32_) -> Result; + pub fn httpcReceiveDataTimeout(context: *mut httpcContext, + buffer: *mut u8_, size: u32_, + timeout: u64_) -> Result; pub fn httpcGetRequestState(context: *mut httpcContext, out: *mut HTTPC_RequestStatus) -> Result; pub fn httpcGetDownloadSizeState(context: *mut httpcContext, - downloadedsize: *mut u32, - contentsize: *mut u32) -> Result; + downloadedsize: *mut u32_, + contentsize: *mut u32_) -> Result; pub fn httpcGetResponseStatusCode(context: *mut httpcContext, - out: *mut u32, delay: u64) -> Result; + out: *mut u32_) -> Result; + pub fn httpcGetResponseStatusCodeTimeout(context: *mut httpcContext, + out: *mut u32_, timeout: u64_) + -> Result; pub fn httpcGetResponseHeader(context: *mut httpcContext, - name: *mut u8, - value: *mut u8, - valuebuf_maxsize: u32) -> Result; - pub fn httpcDownloadData(context: *mut httpcContext, buffer: *mut u8, - size: u32, downloadedsize: *mut u32) -> Result; - pub fn HTTPC_Initialize(handle: Handle) -> Result; - pub fn HTTPC_InitializeConnectionSession(handle: Handle, - contextHandle: Handle) -> Result; - pub fn HTTPC_CreateContext(handle: Handle, - url: *mut u8, - contextHandle: *mut Handle) -> Result; - pub fn HTTPC_CloseContext(handle: Handle, contextHandle: Handle) + name: *const ::libc::c_char, + value: *mut ::libc::c_char, + valuebuf_maxsize: u32_) -> Result; + pub fn httpcAddTrustedRootCA(context: *mut httpcContext, cert: *const u8_, + certsize: u32_) -> Result; + pub fn httpcAddDefaultCert(context: *mut httpcContext, + certID: SSLC_DefaultRootCert) -> Result; + pub fn httpcSelectRootCertChain(context: *mut httpcContext, + RootCertChain_contexthandle: u32_) + -> Result; + pub fn httpcSetClientCert(context: *mut httpcContext, cert: *const u8_, + certsize: u32_, privk: *const u8_, + privk_size: u32_) -> Result; + pub fn httpcSetClientCertDefault(context: *mut httpcContext, + certID: SSLC_DefaultClientCert) + -> Result; + pub fn httpcSetClientCertContext(context: *mut httpcContext, + ClientCert_contexthandle: u32_) + -> Result; + pub fn httpcSetSSLOpt(context: *mut httpcContext, options: u32_) + -> Result; + pub fn httpcSetSSLClearOpt(context: *mut httpcContext, options: u32_) + -> Result; + pub fn httpcCreateRootCertChain(RootCertChain_contexthandle: *mut u32_) + -> Result; + pub fn httpcDestroyRootCertChain(RootCertChain_contexthandle: u32_) -> Result; - pub fn HTTPC_SetProxyDefault(handle: Handle, contextHandle: Handle) + pub fn httpcRootCertChainAddCert(RootCertChain_contexthandle: u32_, + cert: *const u8_, certsize: u32_, + cert_contexthandle: *mut u32_) -> Result; + pub fn httpcRootCertChainAddDefaultCert(RootCertChain_contexthandle: u32_, + certID: SSLC_DefaultRootCert, + cert_contexthandle: *mut u32_) -> Result; - pub fn HTTPC_AddRequestHeaderField(handle: Handle, contextHandle: Handle, - name: *mut u8, - value: *mut u8) + pub fn httpcRootCertChainRemoveCert(RootCertChain_contexthandle: u32_, + cert_contexthandle: u32_) -> Result; + pub fn httpcOpenClientCertContext(cert: *const u8_, certsize: u32_, + privk: *const u8_, privk_size: u32_, + ClientCert_contexthandle: *mut u32_) -> Result; - pub fn HTTPC_BeginRequest(handle: Handle, contextHandle: Handle) + pub fn httpcOpenDefaultClientCertContext(certID: SSLC_DefaultClientCert, + ClientCert_contexthandle: + *mut u32_) -> Result; + pub fn httpcCloseClientCertContext(ClientCert_contexthandle: u32_) -> Result; - pub fn HTTPC_ReceiveData(handle: Handle, contextHandle: Handle, - buffer: *mut u8, size: u32) -> Result; - pub fn HTTPC_GetRequestState(handle: Handle, contextHandle: Handle, - out: *mut HTTPC_RequestStatus) -> Result; - pub fn HTTPC_GetDownloadSizeState(handle: Handle, contextHandle: Handle, - downloadedsize: *mut u32, - contentsize: *mut u32) -> Result; - pub fn HTTPC_GetResponseHeader(handle: Handle, contextHandle: Handle, - name: *mut u8, - value: *mut u8, - valuebuf_maxsize: u32) -> Result; - pub fn HTTPC_GetResponseStatusCode(handle: Handle, contextHandle: Handle, - out: *mut u32) -> Result; + pub fn httpcDownloadData(context: *mut httpcContext, buffer: *mut u8_, + size: u32_, downloadedsize: *mut u32_) -> Result; + pub fn httpcSetKeepAlive(context: *mut httpcContext, + option: HTTPC_KeepAlive) -> Result; } +use ::types::*; +use super::sslc::*; diff --git a/ctru-sys/src/services/ir.rs b/ctru-sys/src/services/ir.rs index 94a626a..e94e93c 100644 --- a/ctru-sys/src/services/ir.rs +++ b/ctru-sys/src/services/ir.rs @@ -1,21 +1,25 @@ -use ::{Result, Handle}; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { - pub fn iruInit(sharedmem_addr: *mut u32, sharedmem_size: u32) -> Result; + pub fn iruInit(sharedmem_addr: *mut u32_, sharedmem_size: u32_) -> Result; pub fn iruExit(); pub fn iruGetServHandle() -> Handle; - pub fn iruSendData(buf: *mut u8, size: u32, wait: u8) -> Result; - pub fn iruRecvData(buf: *mut u8, size: u32, flag: u8, - transfercount: *mut u32, wait: u8) -> Result; + pub fn iruSendData(buf: *mut u8_, size: u32_, wait: u8) -> Result; + pub fn iruRecvData(buf: *mut u8_, size: u32_, flag: u8_, + transfercount: *mut u32_, wait: u8) -> Result; pub fn IRU_Initialize() -> Result; pub fn IRU_Shutdown() -> Result; - pub fn IRU_StartSendTransfer(buf: *mut u8, size: u32) -> Result; + pub fn IRU_StartSendTransfer(buf: *mut u8_, size: u32_) -> Result; pub fn IRU_WaitSendTransfer() -> Result; - pub fn IRU_StartRecvTransfer(size: u32, flag: u8) -> Result; - pub fn IRU_WaitRecvTransfer(transfercount: *mut u32) -> Result; - pub fn IRU_SetBitRate(value: u8) -> Result; - pub fn IRU_GetBitRate(out: *mut u8) -> Result; - pub fn IRU_SetIRLEDState(value: u32) -> Result; - pub fn IRU_GetIRLEDRecvState(out: *mut u32) -> Result; + pub fn IRU_StartRecvTransfer(size: u32_, flag: u8_) -> Result; + pub fn IRU_WaitRecvTransfer(transfercount: *mut u32_) -> Result; + pub fn IRU_SetBitRate(value: u8_) -> Result; + pub fn IRU_GetBitRate(out: *mut u8_) -> Result; + pub fn IRU_SetIRLEDState(value: u32_) -> Result; + pub fn IRU_GetIRLEDRecvState(out: *mut u32_) -> Result; } - +use ::types::*; diff --git a/ctru-sys/src/services/irrst.rs b/ctru-sys/src/services/irrst.rs index 12ebcb4..0ccf43e 100644 --- a/ctru-sys/src/services/irrst.rs +++ b/ctru-sys/src/services/irrst.rs @@ -1,20 +1,24 @@ -use ::types::*; - -use super::hid::circlePosition; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { pub static mut irrstMemHandle: Handle; pub static mut irrstSharedMem: *mut vu32; - +} +extern "C" { pub fn irrstInit() -> Result; pub fn irrstExit(); pub fn irrstScanInput(); - pub fn irrstKeysHeld() -> u32; + pub fn irrstKeysHeld() -> u32_; pub fn irrstCstickRead(pos: *mut circlePosition); pub fn irrstWaitForEvent(nextEvent: u8); pub fn IRRST_GetHandles(outMemHandle: *mut Handle, outEventHandle: *mut Handle) -> Result; - pub fn IRRST_Initialize(unk1: u32, unk2: u8) -> Result; + pub fn IRRST_Initialize(unk1: u32_, unk2: u8_) -> Result; pub fn IRRST_Shutdown() -> Result; - } +use ::types::*; +use super::hid::*; diff --git a/ctru-sys/src/services/mic.rs b/ctru-sys/src/services/mic.rs index 1037698..efc291f 100644 --- a/ctru-sys/src/services/mic.rs +++ b/ctru-sys/src/services/mic.rs @@ -1,42 +1,47 @@ -use ::{Handle, Result}; +/* automatically generated by rust-bindgen */ -#[derive(Clone, Copy)] -#[repr(C)] +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum MICU_Encoding { MICU_ENCODING_PCM8 = 0, MICU_ENCODING_PCM16 = 1, MICU_ENCODING_PCM8_SIGNED = 2, MICU_ENCODING_PCM16_SIGNED = 3, } - -#[derive(Clone, Copy)] -#[repr(C)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum MICU_SampleRate { MICU_SAMPLE_RATE_32730 = 0, MICU_SAMPLE_RATE_16360 = 1, MICU_SAMPLE_RATE_10910 = 2, MICU_SAMPLE_RATE_8180 = 3, } - extern "C" { - pub fn micInit(buffer: *mut u8, bufferSize: u32) -> Result; + pub fn micInit(buffer: *mut u8_, bufferSize: u32_) -> Result; pub fn micExit(); - pub fn micGetSampleDataSize() -> u32; - pub fn micGetLastSampleOffset() -> u32; - pub fn MICU_MapSharedMem(size: u32, handle: Handle) -> Result; + pub fn micGetSampleDataSize() -> u32_; + pub fn micGetLastSampleOffset() -> u32_; + pub fn MICU_MapSharedMem(size: u32_, handle: Handle) -> Result; pub fn MICU_UnmapSharedMem() -> Result; pub fn MICU_StartSampling(encoding: MICU_Encoding, - sampleRate: MICU_SampleRate, offset: u32, - size: u32, _loop: u8) -> Result; + sampleRate: MICU_SampleRate, offset: u32_, + size: u32_, loop_: u8) -> Result; pub fn MICU_AdjustSampling(sampleRate: MICU_SampleRate) -> Result; pub fn MICU_StopSampling() -> Result; pub fn MICU_IsSampling(sampling: *mut u8) -> Result; pub fn MICU_GetEventHandle(handle: *mut Handle) -> Result; - pub fn MICU_SetGain(gain: u8) -> Result; - pub fn MICU_GetGain(gain: *mut u8) -> Result; + pub fn MICU_SetGain(gain: u8_) -> Result; + pub fn MICU_GetGain(gain: *mut u8_) -> Result; pub fn MICU_SetPower(power: u8) -> Result; pub fn MICU_GetPower(power: *mut u8) -> Result; pub fn MICU_SetClamp(clamp: u8) -> Result; pub fn MICU_GetClamp(clamp: *mut u8) -> Result; pub fn MICU_SetAllowShellClosed(allowShellClosed: u8) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/mod.rs b/ctru-sys/src/services/mod.rs index 76b7c35..30d0f68 100644 --- a/ctru-sys/src/services/mod.rs +++ b/ctru-sys/src/services/mod.rs @@ -1,5 +1,6 @@ pub mod ac; pub mod am; +pub mod ampxi; pub mod apt; pub mod cam; pub mod cfgnor; @@ -8,20 +9,24 @@ pub mod dsp; pub mod fs; pub mod gspgpu; pub mod gsplcd; -pub mod hb; pub mod hid; pub mod httpc; pub mod ir; pub mod irrst; pub mod mic; pub mod mvd; +pub mod ndm; pub mod news; +pub mod nfc; pub mod ns; pub mod pm; pub mod ps; pub mod ptmsysm; pub mod ptmu; +pub mod pxidev; pub mod qtm; pub mod soc; pub mod srvpm; +pub mod sslc; +pub mod uds; pub mod y2r; diff --git a/ctru-sys/src/services/mvd.rs b/ctru-sys/src/services/mvd.rs index fe8691c..e69de29 100644 --- a/ctru-sys/src/services/mvd.rs +++ b/ctru-sys/src/services/mvd.rs @@ -1,67 +0,0 @@ -use ::Result; - -#[derive(Clone, Copy)] -#[repr(C)] -pub enum MVDSTD_Mode { - MVDMODE_COLORFORMATCONV = 0, - MVDMODE_VIDEOPROCESSING = 1, -} - -#[derive(Clone, Copy)] -#[repr(C)] -pub enum MVDSTD_InputFormat { - MVD_INPUT_YUYV422 = 65537, - MVD_INPUT_H264 = 131073, -} - -#[derive(Clone, Copy)] -#[repr(C)] -pub enum MVDSTD_OutputFormat { MVD_OUTPUT_RGB565 = 262146, } - -#[repr(C)] -#[derive(Copy)] -pub struct MVDSTD_Config { - pub input_type: MVDSTD_InputFormat, - pub unk_x04: u32, - pub unk_x08: u32, - pub inwidth: u32, - pub inheight: u32, - pub physaddr_colorconv_indata: u32, - pub unk_x18: [u32; 10usize], - pub flag_x40: u32, - pub unk_x44: u32, - pub unk_x48: u32, - pub outheight0: u32, - pub outwidth0: u32, - pub unk_x54: u32, - pub output_type: MVDSTD_OutputFormat, - pub outwidth1: u32, - pub outheight1: u32, - pub physaddr_outdata0: u32, - pub physaddr_outdata1_colorconv: u32, - pub unk_x6c: [u32; 44usize], -} -impl ::core::clone::Clone for MVDSTD_Config { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for MVDSTD_Config { - fn default() -> Self { unsafe { ::core::mem::zeroed() } } -} - -extern "C" { - pub fn mvdstdInit(mode: MVDSTD_Mode, input_type: MVDSTD_InputFormat, - output_type: MVDSTD_OutputFormat, size: u32) -> Result; - pub fn mvdstdExit(); - pub fn mvdstdGenerateDefaultConfig(config: *mut MVDSTD_Config, - input_width: u32, input_height: u32, - output_width: u32, - output_height: u32, - vaddr_colorconv_indata: *mut u32, - vaddr_outdata0: *mut u32, - vaddr_outdata1_colorconv: *mut u32); - pub fn mvdstdProcessFrame(config: *mut MVDSTD_Config, - h264_vaddr_inframe: *mut u32, - h264_inframesize: u32, h264_frameid: u32) - -> Result; - pub fn MVDSTD_SetConfig(config: *mut MVDSTD_Config) -> Result; -} diff --git a/ctru-sys/src/services/ndm.rs b/ctru-sys/src/services/ndm.rs new file mode 100644 index 0000000..be820ca --- /dev/null +++ b/ctru-sys/src/services/ndm.rs @@ -0,0 +1,23 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum NDM_ExclusiveState { + EXCLUSIVE_STATE_NONE = 0, + EXCLUSIVE_STATE_INFRASTRUCTURE = 1, + EXCLUSIVE_STATE_LOCAL_COMMUNICATIONS = 2, + EXCLUSIVE_STATE_STREETPASS = 3, + EXCLUSIVE_STATE_STREETPASS_DATA = 4, +} +extern "C" { + pub fn ndmuInit() -> Result; + pub fn ndmuExit(); + pub fn ndmuEnterExclusiveState(state: NDM_ExclusiveState) -> Result; + pub fn ndmuLeaveExclusiveState() -> Result; +} +use ::types::*; diff --git a/ctru-sys/src/services/news.rs b/ctru-sys/src/services/news.rs index fb34f41..91a1414 100644 --- a/ctru-sys/src/services/news.rs +++ b/ctru-sys/src/services/news.rs @@ -1,11 +1,52 @@ -use ::Result; -use ::libc::c_void; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct NotificationHeader { + pub dataSet: u8, + pub unread: u8, + pub enableJPEG: u8, + pub isSpotPass: u8, + pub isOptedOut: u8, + pub unkData: [u8_; 3usize], + pub processID: u64_, + pub unkData2: [u8_; 8usize], + pub jumpParam: u64_, + pub unkData3: [u8_; 8usize], + pub time: u64_, + pub title: [u16_; 32usize], +} +impl ::core::default::Default for NotificationHeader { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} extern "C" { pub fn newsInit() -> Result; pub fn newsExit(); - pub fn NEWS_AddNotification(title: *const u16, titleLength: u32, - message: *const u16, messageLength: u32, - imageData: *const c_void, - imageSize: u32, jpeg: u8) -> Result; + pub fn NEWS_AddNotification(title: *const u16_, titleLength: u32_, + message: *const u16_, messageLength: u32_, + imageData: *const ::libc::c_void, + imageSize: u32_, jpeg: u8) -> Result; + pub fn NEWS_GetTotalNotifications(num: *mut u32_) -> Result; + pub fn NEWS_SetNotificationHeader(news_id: u32_, + header: *const NotificationHeader) + -> Result; + pub fn NEWS_GetNotificationHeader(news_id: u32_, + header: *mut NotificationHeader) + -> Result; + pub fn NEWS_SetNotificationMessage(news_id: u32_, message: *const u16_, + size: u32_) -> Result; + pub fn NEWS_GetNotificationMessage(news_id: u32_, message: *mut u16_, + size: *mut u32_) -> Result; + pub fn NEWS_SetNotificationImage(news_id: u32_, + buffer: *const ::libc::c_void, + size: u32_) -> Result; + pub fn NEWS_GetNotificationImage(news_id: u32_, + buffer: *mut ::libc::c_void, + size: *mut u32_) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/nfc.rs b/ctru-sys/src/services/nfc.rs new file mode 100644 index 0000000..09a6a63 --- /dev/null +++ b/ctru-sys/src/services/nfc.rs @@ -0,0 +1,127 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum NFC_OpType { NFC_OpType_1 = 1, NFC_OpType_NFCTag = 2, } +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum NFC_TagState { + NFC_TagState_Uninitialized = 0, + NFC_TagState_ScanningStopped = 1, + NFC_TagState_Scanning = 2, + NFC_TagState_InRange = 3, + NFC_TagState_OutOfRange = 4, + NFC_TagState_DataReady = 5, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum Enum_Unnamed1 { + NFC_amiiboFlag_Setup = 16, + NFC_amiiboFlag_AppDataSetup = 32, +} +#[repr(C)] +#[derive(Copy)] +pub struct NFC_TagInfo { + pub id_offset_size: u16_, + pub unk_x2: u8_, + pub unk_x3: u8_, + pub id: [u8_; 40usize], +} +impl ::core::clone::Clone for NFC_TagInfo { + fn clone(&self) -> Self { *self } +} +impl ::core::default::Default for NFC_TagInfo { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy)] +pub struct NFC_AmiiboSettings { + pub mii: [u8_; 96usize], + pub nickname: [u16_; 11usize], + pub flags: u8_, + pub countrycodeid: u8_, + pub setupdate_year: u16_, + pub setupdate_month: u8_, + pub setupdate_day: u8_, + pub unk_x7c: [u8_; 44usize], +} +impl ::core::clone::Clone for NFC_AmiiboSettings { + fn clone(&self) -> Self { *self } +} +impl ::core::default::Default for NFC_AmiiboSettings { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy)] +pub struct NFC_AmiiboConfig { + pub lastwritedate_year: u16_, + pub lastwritedate_month: u8_, + pub lastwritedate_day: u8_, + pub write_counter: u16_, + pub val_x6: u16_, + pub val_x8: u8_, + pub val_x9: u8_, + pub val_xa: u16_, + pub val_xc: u8_, + pub pagex4_byte3: u8_, + pub appdata_size: u8_, + pub zeros: [u8_; 49usize], +} +impl ::core::clone::Clone for NFC_AmiiboConfig { + fn clone(&self) -> Self { *self } +} +impl ::core::default::Default for NFC_AmiiboConfig { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy)] +pub struct NFC_AppDataInitStruct { + pub data_x0: [u8_; 12usize], + pub data_xc: [u8_; 48usize], +} +impl ::core::clone::Clone for NFC_AppDataInitStruct { + fn clone(&self) -> Self { *self } +} +impl ::core::default::Default for NFC_AppDataInitStruct { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct NFC_AppDataWriteStruct { + pub id: [u8_; 10usize], + pub id_size: u8_, + pub unused_xb: [u8_; 21usize], +} +impl ::core::default::Default for NFC_AppDataWriteStruct { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +extern "C" { + pub fn nfcInit(type_: NFC_OpType) -> Result; + pub fn nfcExit(); + pub fn nfcGetSessionHandle() -> Handle; + pub fn nfcStartScanning(inval: u16_) -> Result; + pub fn nfcStopScanning(); + pub fn nfcLoadAmiiboData() -> Result; + pub fn nfcResetTagScanState() -> Result; + pub fn nfcUpdateStoredAmiiboData() -> Result; + pub fn nfcGetTagState(state: *mut NFC_TagState) -> Result; + pub fn nfcGetTagInfo(out: *mut NFC_TagInfo) -> Result; + pub fn nfcOpenAppData(amiibo_appid: u32_) -> Result; + pub fn nfcInitializeWriteAppData(amiibo_appid: u32_, + buf: *const ::libc::c_void, size: size_t) + -> Result; + pub fn nfcReadAppData(buf: *mut ::libc::c_void, size: size_t) -> Result; + pub fn nfcWriteAppData(buf: *const ::libc::c_void, size: size_t, + taginfo: *mut NFC_TagInfo) -> Result; + pub fn nfcGetAmiiboSettings(out: *mut NFC_AmiiboSettings) -> Result; + pub fn nfcGetAmiiboConfig(out: *mut NFC_AmiiboConfig) -> Result; +} +use ::types::*; diff --git a/ctru-sys/src/services/ns.rs b/ctru-sys/src/services/ns.rs index c48e176..67f6d63 100644 --- a/ctru-sys/src/services/ns.rs +++ b/ctru-sys/src/services/ns.rs @@ -1,9 +1,17 @@ -use ::Result; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { pub fn nsInit() -> Result; pub fn nsExit(); - pub fn NS_LaunchTitle(titleid: u64, launch_flags: u32, procid: *mut u32) -> Result; - pub fn NS_RebootToTitle(mediatype: u8, titleid: u64) -> Result; + pub fn NS_LaunchFIRM(titleid: u64_) -> Result; + pub fn NS_LaunchTitle(titleid: u64_, launch_flags: u32_, + procid: *mut u32_) -> Result; + pub fn NS_LaunchApplicationFIRM(titleid: u64_, flags: u32_) -> Result; + pub fn NS_RebootToTitle(mediatype: u8_, titleid: u64_) -> Result; + pub fn NS_TerminateProcessTID(titleid: u64_) -> Result; } - +use ::types::*; diff --git a/ctru-sys/src/services/pm.rs b/ctru-sys/src/services/pm.rs index 958dbc4..34896a9 100644 --- a/ctru-sys/src/services/pm.rs +++ b/ctru-sys/src/services/pm.rs @@ -1,24 +1,19 @@ -use ::{Handle, Result}; -use ::libc::c_void; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { pub fn pmInit() -> Result; pub fn pmExit(); - pub fn PM_LaunchTitle(mediatype: u8, titleid: u64, launch_flags: u32) + pub fn PM_LaunchTitle(mediatype: u8_, titleid: u64_, launch_flags: u32_) -> Result; - pub fn PM_GetTitleExheaderFlags(mediatype: u8, titleid: u64, - out: *mut u8) -> Result; - pub fn PM_SetFIRMLaunchParams(size: u32, _in: *mut u8) -> Result; - pub fn PM_GetFIRMLaunchParams(size: u32, out: *mut u8) -> Result; - pub fn PM_LaunchFIRMSetParams(firm_titleid_low: u32, size: u32, - _in: *mut u8) -> Result; - pub fn srvPmInit() -> Result; - pub fn srvPmExit(); - pub fn SRVPM_PublishToProcess(notificationId: u32, process: Handle) - -> Result; - pub fn SRVPM_PublishToAll(notificationId: u32) -> Result; - pub fn SRVPM_RegisterProcess(procid: u32, count: u32, - serviceaccesscontrol: c_void) -> Result; - pub fn SRVPM_UnregisterProcess(procid: u32) -> Result; + pub fn PM_GetTitleExheaderFlags(mediatype: u8_, titleid: u64_, + out: *mut u8_) -> Result; + pub fn PM_SetFIRMLaunchParams(size: u32_, in_: *mut u8_) -> Result; + pub fn PM_GetFIRMLaunchParams(size: u32_, out: *mut u8_) -> Result; + pub fn PM_LaunchFIRMSetParams(firm_titleid_low: u32_, size: u32_, + in_: *mut u8_) -> Result; } - +use ::types::*; diff --git a/ctru-sys/src/services/pmtsym.rs b/ctru-sys/src/services/pmtsym.rs new file mode 100644 index 0000000..0684f65 --- /dev/null +++ b/ctru-sys/src/services/pmtsym.rs @@ -0,0 +1,8 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] + +use ::types::*; diff --git a/ctru-sys/src/services/ps.rs b/ctru-sys/src/services/ps.rs index e59a08d..8198dbb 100644 --- a/ctru-sys/src/services/ps.rs +++ b/ctru-sys/src/services/ps.rs @@ -1,7 +1,12 @@ -use ::Result; +/* automatically generated by rust-bindgen */ -#[derive(Clone, Copy)] -#[repr(C)] +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum PS_AESAlgorithm { PS_ALGORITHM_CBC_ENC = 0, PS_ALGORITHM_CBC_DEC = 1, @@ -10,9 +15,9 @@ pub enum PS_AESAlgorithm { PS_ALGORITHM_CCM_ENC = 4, PS_ALGORITHM_CCM_DEC = 5, } - -#[derive(Clone, Copy)] -#[repr(C)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum PS_AESKeyType { PS_KEYSLOT_0D = 0, PS_KEYSLOT_2D = 1, @@ -25,22 +30,24 @@ pub enum PS_AESKeyType { PS_KEYSLOT_36 = 8, PS_KEYSLOT_39_NFC = 9, } - extern "C" { pub fn psInit() -> Result; pub fn psExit(); - pub fn PS_EncryptDecryptAes(size: u32, _in: *mut u8, out: *mut u8, + pub fn PS_EncryptDecryptAes(size: u32_, in_: *mut u8_, out: *mut u8_, aes_algo: PS_AESAlgorithm, - key_type: PS_AESKeyType, iv: *mut u8) + key_type: PS_AESKeyType, iv: *mut u8_) -> Result; - pub fn PS_EncryptSignDecryptVerifyAesCcm(_in: *mut u8, in_size: u32, - out: *mut u8, out_size: u32, - data_len: u32, - mac_data_len: u32, - mac_len: u32, + pub fn PS_EncryptSignDecryptVerifyAesCcm(in_: *mut u8_, in_size: u32_, + out: *mut u8_, out_size: u32_, + data_len: u32_, + mac_data_len: u32_, + mac_len: u32_, aes_algo: PS_AESAlgorithm, key_type: PS_AESKeyType, - nonce: *mut u8) -> Result; - pub fn PS_GetLocalFriendCodeSeed(seed: *mut u64) -> Result; - pub fn PS_GetDeviceId(device_id: *mut u32) -> Result; + nonce: *mut u8_) -> Result; + pub fn PS_GetLocalFriendCodeSeed(seed: *mut u64_) -> Result; + pub fn PS_GetDeviceId(device_id: *mut u32_) -> Result; + pub fn PS_GenerateRandomBytes(out: *mut ::libc::c_void, len: size_t) + -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/ptmsym.rs b/ctru-sys/src/services/ptmsym.rs new file mode 100644 index 0000000..f536294 --- /dev/null +++ b/ctru-sys/src/services/ptmsym.rs @@ -0,0 +1,15 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +extern "C" { + pub fn ptmSysmInit() -> Result; + pub fn ptmSysmExit(); + pub fn PTMSYSM_CheckNew3DS() -> Result; + pub fn PTMSYSM_ConfigureNew3DSCPU(value: u8_) -> Result; + pub fn PTMSYSM_ShutdownAsync(timeout: u64_) -> Result; + pub fn PTMSYSM_RebootAsync(timeout: u64_) -> Result; +} +use ::types::*; diff --git a/ctru-sys/src/services/ptmsysm.rs b/ctru-sys/src/services/ptmsysm.rs index 7507fd5..f536294 100644 --- a/ctru-sys/src/services/ptmsysm.rs +++ b/ctru-sys/src/services/ptmsysm.rs @@ -1,7 +1,15 @@ -use ::Result; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { pub fn ptmSysmInit() -> Result; pub fn ptmSysmExit(); - pub fn PTMSYSM_ConfigureNew3DSCPU(value: u8) -> Result; + pub fn PTMSYSM_CheckNew3DS() -> Result; + pub fn PTMSYSM_ConfigureNew3DSCPU(value: u8_) -> Result; + pub fn PTMSYSM_ShutdownAsync(timeout: u64_) -> Result; + pub fn PTMSYSM_RebootAsync(timeout: u64_) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/ptmu.rs b/ctru-sys/src/services/ptmu.rs index e230a37..ab8ab82 100644 --- a/ctru-sys/src/services/ptmu.rs +++ b/ctru-sys/src/services/ptmu.rs @@ -1,11 +1,16 @@ -use ::Result; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { pub fn ptmuInit() -> Result; pub fn ptmuExit(); - pub fn PTMU_GetShellState(out: *mut u8) -> Result; - pub fn PTMU_GetBatteryLevel(out: *mut u8) -> Result; - pub fn PTMU_GetBatteryChargeState(out: *mut u8) -> Result; - pub fn PTMU_GetPedometerState(out: *mut u8) -> Result; - pub fn PTMU_GetTotalStepCount(steps: *mut u32) -> Result; + pub fn PTMU_GetShellState(out: *mut u8_) -> Result; + pub fn PTMU_GetBatteryLevel(out: *mut u8_) -> Result; + pub fn PTMU_GetBatteryChargeState(out: *mut u8_) -> Result; + pub fn PTMU_GetPedometerState(out: *mut u8_) -> Result; + pub fn PTMU_GetTotalStepCount(steps: *mut u32_) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/pxidev.rs b/ctru-sys/src/services/pxidev.rs new file mode 100644 index 0000000..c5cf290 --- /dev/null +++ b/ctru-sys/src/services/pxidev.rs @@ -0,0 +1,50 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum PXIDEV_WaitType { + WAIT_NONE = 0, + WAIT_SLEEP = 1, + WAIT_IREQ_RETURN = 2, + WAIT_IREQ_CONTINUE = 3, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum PXIDEV_DeassertType { + DEASSERT_NONE = 0, + DEASSERT_BEFORE_WAIT = 1, + DEASSERT_AFTER_WAIT = 2, +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct PXIDEV_SPIBuffer { + pub ptr: *mut ::libc::c_void, + pub size: u32_, + pub transferOption: u8_, + pub waitOperation: u64_, +} +impl ::core::default::Default for PXIDEV_SPIBuffer { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +extern "C" { + pub fn pxiDevInit() -> Result; + pub fn pxiDevExit(); + pub fn PXIDEV_SPIMultiWriteRead(header: *mut PXIDEV_SPIBuffer, + writeBuffer1: *mut PXIDEV_SPIBuffer, + readBuffer1: *mut PXIDEV_SPIBuffer, + writeBuffer2: *mut PXIDEV_SPIBuffer, + readBuffer2: *mut PXIDEV_SPIBuffer, + footer: *mut PXIDEV_SPIBuffer) -> Result; + pub fn PXIDEV_SPIWriteRead(bytesRead: *mut u32_, + initialWaitOperation: u64_, + writeBuffer: *mut PXIDEV_SPIBuffer, + readBuffer: *mut PXIDEV_SPIBuffer) -> Result; +} +use ::types::*; diff --git a/ctru-sys/src/services/qtm.rs b/ctru-sys/src/services/qtm.rs index 30d7595..37bc8db 100644 --- a/ctru-sys/src/services/qtm.rs +++ b/ctru-sys/src/services/qtm.rs @@ -1,34 +1,32 @@ -use ::Result; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct QTM_HeadTrackingInfoCoord { pub x: f32, pub y: f32, } -impl ::core::clone::Clone for QTM_HeadTrackingInfoCoord { - fn clone(&self) -> Self { *self } -} impl ::core::default::Default for QTM_HeadTrackingInfoCoord { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] +#[derive(Debug)] pub struct QTM_HeadTrackingInfo { - pub flags: [u8; 5usize], - pub padding: [u8; 3usize], + pub flags: [u8_; 5usize], + pub padding: [u8_; 3usize], pub floatdata_x08: f32, pub coords0: [QTM_HeadTrackingInfoCoord; 4usize], - pub unk_x2c: [u32; 5usize], -} -impl ::core::clone::Clone for QTM_HeadTrackingInfo { - fn clone(&self) -> Self { *self } + pub unk_x2c: [u32_; 5usize], } impl ::core::default::Default for QTM_HeadTrackingInfo { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } - extern "C" { pub fn qtmInit() -> Result; pub fn qtmExit(); @@ -36,9 +34,9 @@ extern "C" { pub fn qtmCheckHeadFullyDetected(info: *mut QTM_HeadTrackingInfo) -> u8; pub fn qtmConvertCoordToScreen(coord: *mut QTM_HeadTrackingInfoCoord, screen_width: *mut f32, - screen_height: - *mut f32, - x: *mut u32, y: *mut u32) -> Result; - pub fn QTM_GetHeadTrackingInfo(val: u64, out: *mut QTM_HeadTrackingInfo) + screen_height: *mut f32, x: *mut u32_, + y: *mut u32_) -> Result; + pub fn QTM_GetHeadTrackingInfo(val: u64_, out: *mut QTM_HeadTrackingInfo) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/soc.rs b/ctru-sys/src/services/soc.rs index 3a1e2ec..8fa7a3d 100644 --- a/ctru-sys/src/services/soc.rs +++ b/ctru-sys/src/services/soc.rs @@ -1,7 +1,108 @@ -use ::Result; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum NetworkOpt { + NETOPT_MAC_ADDRESS = 4100, + NETOPT_ARP_TABLE = 12290, + NETOPT_IP_INFO = 16387, + NETOPT_IP_MTU = 16388, + NETOPT_ROUTING_TABLE = 16390, + NETOPT_UDP_NUMBER = 32770, + NETOPT_UDP_TABLE = 32771, + NETOPT_TCP_NUMBER = 36866, + NETOPT_TCP_TABLE = 36867, + NETOPT_DNS_TABLE = 45059, + NETOPT_DHCP_LEASE_TIME = 49153, +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct SOCU_ARPTableEntry { + pub unk0: u32_, + pub ip: in_addr, + pub mac: [u8_; 6usize], + pub padding: [u8_; 2usize], +} +impl ::core::default::Default for SOCU_ARPTableEntry { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct SOCU_IPInfo { + pub ip: in_addr, + pub netmask: in_addr, + pub broadcast: in_addr, +} +impl ::core::default::Default for SOCU_IPInfo { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct SOCU_RoutingTableEntry { + pub dest_ip: in_addr, + pub netmask: in_addr, + pub gateway: in_addr, + pub flags: u32_, + pub time: u64_, +} +impl ::core::default::Default for SOCU_RoutingTableEntry { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct SOCU_UDPTableEntry { + pub local: sockaddr_storage, + pub remote: sockaddr_storage, +} +impl ::core::default::Default for SOCU_UDPTableEntry { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct SOCU_TCPTableEntry { + pub state: u32_, + pub local: sockaddr_storage, + pub remote: sockaddr_storage, +} +impl ::core::default::Default for SOCU_TCPTableEntry { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct SOCU_DNSTableEntry { + pub family: u32_, + pub ip: in_addr, + pub padding: [u8_; 12usize], +} +impl ::core::default::Default for SOCU_DNSTableEntry { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} extern "C" { - pub fn SOC_Init(context_addr: *mut u32, context_size: u32) -> Result; - pub fn SOC_Exit() -> Result; - pub fn gethostid() -> i32; + pub fn socInit(context_addr: *mut u32_, context_size: u32_) -> Result; + pub fn socExit() -> Result; + pub fn gethostid() -> ::libc::c_long; + pub fn gethostname(name: *mut ::libc::c_char, namelen: size_t) + -> ::libc::c_int; + pub fn SOCU_ShutdownSockets() -> ::libc::c_int; + pub fn SOCU_CloseSockets() -> ::libc::c_int; + pub fn SOCU_GetNetworkOpt(level: ::libc::c_int, optname: NetworkOpt, + optval: *mut ::libc::c_void, + optlen: *mut socklen_t) -> ::libc::c_int; + pub fn SOCU_GetIPInfo(ip: *mut in_addr, netmask: *mut in_addr, + broadcast: *mut in_addr) -> ::libc::c_int; + pub fn SOCU_AddGlobalSocket(sockfd: ::libc::c_int) -> ::libc::c_int; } +use ::types::*; +use sys::socket::*; +use sys::inaddr::*; diff --git a/ctru-sys/src/services/srvpm.rs b/ctru-sys/src/services/srvpm.rs index 47ae21f..f13e8db 100644 --- a/ctru-sys/src/services/srvpm.rs +++ b/ctru-sys/src/services/srvpm.rs @@ -1,12 +1,18 @@ -use ::{Handle, Result}; -use ::libc::c_void; +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] extern "C" { pub fn srvPmInit() -> Result; pub fn srvPmExit(); - pub fn SRVPM_PublishToProcess(notificationId: u32, process: Handle) -> Result; - pub fn SRVPM_PublishToAll(notificationId: u32) -> Result; - pub fn SRVPM_RegisterProcess(procid: u32, count: u32, - serviceaccesscontrol: c_void) -> Result; - pub fn SRVPM_UnregisterProcess(procid: u32) -> Result; + pub fn SRVPM_PublishToProcess(notificationId: u32_, process: Handle) + -> Result; + pub fn SRVPM_PublishToAll(notificationId: u32_) -> Result; + pub fn SRVPM_RegisterProcess(procid: u32_, count: u32_, + serviceaccesscontrol: *mut ::libc::c_void) + -> Result; + pub fn SRVPM_UnregisterProcess(procid: u32_) -> Result; } +use ::types::*; diff --git a/ctru-sys/src/services/sslc.rs b/ctru-sys/src/services/sslc.rs new file mode 100644 index 0000000..5a18e59 --- /dev/null +++ b/ctru-sys/src/services/sslc.rs @@ -0,0 +1,115 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct sslcContext { + pub servhandle: Handle, + pub sslchandle: u32_, + pub sharedmem_handle: Handle, +} +impl ::core::default::Default for sslcContext { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum SSLC_DefaultRootCert { + SSLC_DefaultRootCert_Nintendo_CA = 1, + SSLC_DefaultRootCert_Nintendo_CA_G2 = 2, + SSLC_DefaultRootCert_Nintendo_CA_G3 = 3, + SSLC_DefaultRootCert_Nintendo_Class2_CA = 4, + SSLC_DefaultRootCert_Nintendo_Class2_CA_G2 = 5, + SSLC_DefaultRootCert_Nintendo_Class2_CA_G3 = 6, + SSLC_DefaultRootCert_CyberTrust = 7, + SSLC_DefaultRootCert_AddTrust_External_CA = 8, + SSLC_DefaultRootCert_COMODO = 9, + SSLC_DefaultRootCert_USERTrust = 10, + SSLC_DefaultRootCert_DigiCert_EV = 11, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum SSLC_DefaultClientCert { SSLC_DefaultClientCert_ClCertA = 64, } +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum Enum_Unnamed1 { + SSLCOPT_Default = 0, + SSLCOPT_DisableVerify = 512, + SSLCOPT_TLSv10 = 2048, +} +extern "C" { + pub fn sslcInit(session_handle: Handle) -> Result; + pub fn sslcExit(); + pub fn sslcCreateRootCertChain(RootCertChain_contexthandle: *mut u32_) + -> Result; + pub fn sslcDestroyRootCertChain(RootCertChain_contexthandle: u32_) + -> Result; + pub fn sslcAddTrustedRootCA(RootCertChain_contexthandle: u32_, + cert: *const u8_, certsize: u32_, + cert_contexthandle: *mut u32_) -> Result; + pub fn sslcRootCertChainAddDefaultCert(RootCertChain_contexthandle: u32_, + certID: SSLC_DefaultRootCert, + cert_contexthandle: *mut u32_) + -> Result; + pub fn sslcRootCertChainRemoveCert(RootCertChain_contexthandle: u32_, + cert_contexthandle: u32_) -> Result; + pub fn sslcCreate8CertChain(CertChain_contexthandle: *mut u32_) -> Result; + pub fn sslcDestroy8CertChain(CertChain_contexthandle: u32_) -> Result; + pub fn sslc8CertChainAddCert(CertChain_contexthandle: u32_, + cert: *const u8_, certsize: u32_, + cert_contexthandle: *mut u32_) -> Result; + pub fn sslc8CertChainAddDefaultCert(CertChain_contexthandle: u32_, + certID: u8_, + cert_contexthandle: *mut u32_) + -> Result; + pub fn sslc8CertChainRemoveCert(CertChain_contexthandle: u32_, + cert_contexthandle: u32_) -> Result; + pub fn sslcOpenClientCertContext(cert: *const u8_, certsize: u32_, + key: *const u8_, keysize: u32_, + ClientCert_contexthandle: *mut u32_) + -> Result; + pub fn sslcOpenDefaultClientCertContext(certID: SSLC_DefaultClientCert, + ClientCert_contexthandle: + *mut u32_) -> Result; + pub fn sslcCloseClientCertContext(ClientCert_contexthandle: u32_) + -> Result; + pub fn sslcSeedRNG() -> Result; + pub fn sslcGenerateRandomData(buf: *mut u8_, size: u32_) -> Result; + pub fn sslcCreateContext(context: *mut sslcContext, sockfd: ::libc::c_int, + input_opt: u32_, hostname: *const ::libc::c_char) + -> Result; + pub fn sslcDestroyContext(context: *mut sslcContext) -> Result; + pub fn sslcStartConnection(context: *mut sslcContext, + internal_retval: *mut ::libc::c_int, + out: *mut u32_) -> Result; + pub fn sslcRead(context: *mut sslcContext, buf: *mut ::libc::c_void, + len: size_t, peek: u8) -> Result; + pub fn sslcWrite(context: *mut sslcContext, buf: *const ::libc::c_void, + len: size_t) -> Result; + pub fn sslcContextSetRootCertChain(context: *mut sslcContext, + handle: u32_) -> Result; + pub fn sslcContextSetClientCert(context: *mut sslcContext, handle: u32_) + -> Result; + pub fn sslcContextSetHandle8(context: *mut sslcContext, handle: u32_) + -> Result; + pub fn sslcContextClearOpt(context: *mut sslcContext, bitmask: u32_) + -> Result; + pub fn sslcContextGetProtocolCipher(context: *mut sslcContext, + outprotocols: *mut ::libc::c_char, + outprotocols_maxsize: u32_, + outcipher: *mut ::libc::c_char, + outcipher_maxsize: u32_) -> Result; + pub fn sslcContextGetState(context: *mut sslcContext, out: *mut u32_) + -> Result; + pub fn sslcContextInitSharedmem(context: *mut sslcContext, buf: *mut u8_, + size: u32_) -> Result; + pub fn sslcAddCert(context: *mut sslcContext, buf: *const u8_, size: u32_) + -> Result; +} +use ::types::*; diff --git a/ctru-sys/src/services/uds.rs b/ctru-sys/src/services/uds.rs new file mode 100644 index 0000000..bf49b90 --- /dev/null +++ b/ctru-sys/src/services/uds.rs @@ -0,0 +1,6 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] diff --git a/ctru-sys/src/sys/inaddr.rs b/ctru-sys/src/sys/inaddr.rs new file mode 100644 index 0000000..f16e233 --- /dev/null +++ b/ctru-sys/src/sys/inaddr.rs @@ -0,0 +1,44 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] + +use ::types::*; +use super::socket::*; + +pub type in_port_t = uint16_t; +pub type in_addr_t = uint32_t; +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct in_addr { + pub s_addr: in_addr_t, +} +impl ::core::default::Default for in_addr { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct sockaddr_in { + pub sin_family: sa_family_t, + pub sin_port: in_port_t, + pub sin_addr: in_addr, + pub sin_zero: [::libc::c_uchar; 8usize], +} +impl ::core::default::Default for sockaddr_in { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, +} +impl ::core::default::Default for ip_mreq { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} + diff --git a/ctru-sys/src/sys/mod.rs b/ctru-sys/src/sys/mod.rs index 357a4d6..af15a1c 100644 --- a/ctru-sys/src/sys/mod.rs +++ b/ctru-sys/src/sys/mod.rs @@ -1,2 +1,4 @@ pub mod libc; pub mod lock; +pub mod socket; +pub mod inaddr; diff --git a/ctru-sys/src/sys/socket.rs b/ctru-sys/src/sys/socket.rs new file mode 100644 index 0000000..ec544dc --- /dev/null +++ b/ctru-sys/src/sys/socket.rs @@ -0,0 +1,77 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +pub type socklen_t = uint32_t; +pub type sa_family_t = uint16_t; +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::libc::c_char; 0usize], +} +impl ::core::default::Default for sockaddr { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct sockaddr_storage { + pub ss_family: sa_family_t, + pub __ss_padding: [::libc::c_char; 26usize], +} +impl ::core::default::Default for sockaddr_storage { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct linger { + pub l_onoff: ::libc::c_int, + pub l_linger: ::libc::c_int, +} +impl ::core::default::Default for linger { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +extern "C" { + pub fn accept(sockfd: ::libc::c_int, addr: *mut sockaddr, + addrlen: *mut socklen_t) -> ::libc::c_int; + pub fn bind(sockfd: ::libc::c_int, addr: *const sockaddr, + addrlen: socklen_t) -> ::libc::c_int; + pub fn closesocket(sockfd: ::libc::c_int) -> ::libc::c_int; + pub fn connect(sockfd: ::libc::c_int, addr: *const sockaddr, + addrlen: socklen_t) -> ::libc::c_int; + pub fn getpeername(sockfd: ::libc::c_int, addr: *mut sockaddr, + addrlen: *mut socklen_t) -> ::libc::c_int; + pub fn getsockname(sockfd: ::libc::c_int, addr: *mut sockaddr, + addrlen: *mut socklen_t) -> ::libc::c_int; + pub fn getsockopt(sockfd: ::libc::c_int, level: ::libc::c_int, + optname: ::libc::c_int, optval: *mut ::libc::c_void, + optlen: *mut socklen_t) -> ::libc::c_int; + pub fn listen(sockfd: ::libc::c_int, backlog: ::libc::c_int) + -> ::libc::c_int; + pub fn recv(sockfd: ::libc::c_int, buf: *mut ::libc::c_void, len: size_t, + flags: ::libc::c_int) -> ssize_t; + pub fn recvfrom(sockfd: ::libc::c_int, buf: *mut ::libc::c_void, + len: size_t, flags: ::libc::c_int, + src_addr: *mut sockaddr, addrlen: *mut socklen_t) + -> ssize_t; + pub fn send(sockfd: ::libc::c_int, buf: *const ::libc::c_void, + len: size_t, flags: ::libc::c_int) -> ssize_t; + pub fn sendto(sockfd: ::libc::c_int, buf: *const ::libc::c_void, + len: size_t, flags: ::libc::c_int, + dest_addr: *const sockaddr, addrlen: socklen_t) -> ssize_t; + pub fn setsockopt(sockfd: ::libc::c_int, level: ::libc::c_int, + optname: ::libc::c_int, optval: *const ::libc::c_void, + optlen: socklen_t) -> ::libc::c_int; + pub fn shutdown(sockfd: ::libc::c_int, how: ::libc::c_int) + -> ::libc::c_int; + pub fn socket(domain: ::libc::c_int, type_: ::libc::c_int, + protocol: ::libc::c_int) -> ::libc::c_int; + pub fn sockatmark(sockfd: ::libc::c_int) -> ::libc::c_int; +} + +use ::types::*; diff --git a/ctru-sys/src/types.rs b/ctru-sys/src/types.rs index d5baa88..92534b7 100644 --- a/ctru-sys/src/types.rs +++ b/ctru-sys/src/types.rs @@ -22,6 +22,10 @@ pub type vs32 = s32; pub type vs64 = s64; pub type Handle = u32_; pub type Result = s32; +pub type size_t = usize; +pub type ssize_t = isize; +pub type uint32_t = u32; +pub type uint16_t = u16; pub type ThreadFunc = ::core::option::Option; pub type voidfn = ::core::option::Option; diff --git a/src/services/apt.rs b/src/services/apt.rs index 536f463..6fa95ec 100644 --- a/src/services/apt.rs +++ b/src/services/apt.rs @@ -2,54 +2,6 @@ use std::marker::PhantomData; use libctru::services::apt; -pub enum AppStatus { - NotInitialized, - Running, - Suspended, - Exiting, - Suspending, - SleepMode, - PrepareSleepMode, - AppletStarted, - AppletClosed, -} - -impl From for apt::APT_AppStatus { - fn from(a: AppStatus) -> apt::APT_AppStatus { - use self::AppStatus::*; - use libctru::services::apt::APT_AppStatus::*; - match a { - NotInitialized => APP_NOTINITIALIZED, - Running => APP_RUNNING, - Suspended => APP_SUSPENDED, - Exiting => APP_EXITING, - Suspending => APP_SUSPENDING, - SleepMode => APP_SLEEPMODE, - PrepareSleepMode => APP_PREPARE_SLEEPMODE, - AppletStarted => APP_APPLETSTARTED, - AppletClosed => APP_APPLETCLOSED, - } - } -} - -impl From for AppStatus { - fn from(a: apt::APT_AppStatus) -> AppStatus { - use self::AppStatus::*; - use libctru::services::apt::APT_AppStatus::*; - match a { - APP_NOTINITIALIZED => NotInitialized, - APP_RUNNING => Running, - APP_SUSPENDED => Suspended, - APP_EXITING => Exiting, - APP_SUSPENDING => Suspending, - APP_SLEEPMODE => SleepMode, - APP_PREPARE_SLEEPMODE => PrepareSleepMode, - APP_APPLETSTARTED => AppletStarted, - APP_APPLETCLOSED => AppletClosed, - } - } -} - pub struct Apt { pd: PhantomData }