Compare commits
No commits in common. "master" and "v1.1.0" have entirely different histories.
21
.github/workflows/build.yaml
vendored
21
.github/workflows/build.yaml
vendored
@ -1,21 +0,0 @@
|
||||
name: Build libctru
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test build
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: 'devkitpro/devkitarm'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: build
|
||||
run: make -C libctru
|
40
.github/workflows/doxygen.yaml
vendored
40
.github/workflows/doxygen.yaml
vendored
@ -1,40 +0,0 @@
|
||||
name: Build documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: [ v* ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build documentation
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Get current tag
|
||||
id: vars
|
||||
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
|
||||
|
||||
- name: Set up Doxygen
|
||||
run: sudo apt-get install -y doxygen
|
||||
|
||||
- name: Display Doxygen version
|
||||
run: echo "Doxygen version $(doxygen -v)"
|
||||
|
||||
- name: Build documentation
|
||||
run: |
|
||||
git clone --branch=master --single-branch --depth 1 https://github.com/devkitPro/3ds-examples examples
|
||||
cd libctru
|
||||
CTRU_VERSION=${{ steps.vars.outputs.tag }} doxygen Doxyfile
|
||||
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@3.7.1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages
|
||||
FOLDER: libctru/docs/html
|
||||
CLEAN: true
|
||||
SINGLE_COMMIT: true
|
47
.travis.yml
Normal file
47
.travis.yml
Normal file
@ -0,0 +1,47 @@
|
||||
language: c
|
||||
|
||||
sudo: false
|
||||
|
||||
#Cache devkitArm and doxygen
|
||||
cache:
|
||||
directories:
|
||||
- /home/travis/devkitPro
|
||||
- /home/travis/doxygen/doxygen-1.8.10/bin
|
||||
|
||||
before_install:
|
||||
# Travis has an OLD doxygen build, so we fetch a recent one
|
||||
- export DOXY_BINPATH=/home/travis/doxygen/doxygen-1.8.10/bin
|
||||
- if [ ! -e "$DOXY_BINPATH/doxygen" ]; then mkdir -p ~/doxygen && cd ~/doxygen; fi
|
||||
- if [ ! -e "$DOXY_BINPATH/doxygen" ]; then wget http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.10.linux.bin.tar.gz; fi
|
||||
- if [ ! -e "$DOXY_BINPATH/doxygen" ]; then tar xzf doxygen-1.8.10.linux.bin.tar.gz; fi
|
||||
- export PATH=$PATH:$DOXY_BINPATH
|
||||
# Prepare devkitArm update
|
||||
- export DEVKITPRO=/home/travis/devkitPro
|
||||
- export DEVKITARM=${DEVKITPRO}/devkitARM
|
||||
- mkdir -p $DEVKITPRO
|
||||
- cd $DEVKITPRO
|
||||
- wget -N http://sourceforge.net/projects/devkitpro/files/Automated%20Installer/devkitARMupdate.pl
|
||||
-
|
||||
|
||||
install:
|
||||
- cd $DEVKITPRO
|
||||
# Install or update devkitArm if it's cached
|
||||
- perl devkitARMupdate.pl
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "BkEGbVRearmBLntY9WSuFkaiO2qAMMN43qocbkCL18dGbIDJA7vlUXXCKkahdsS5TU9j7xdcybCokmPBuvMCNRvQcDVwDcYbuh+ASmqG8Br1hphUScWPZNkcVSgTcHqNHh2k+05NP6d3vm3utOLgGZt/V5p+XcdGHti86KMeY34="
|
||||
|
||||
script:
|
||||
- cd $TRAVIS_BUILD_DIR/libctru
|
||||
- make
|
||||
|
||||
|
||||
after_success:
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
- #Build the doxygen files and upload to GH pages
|
||||
- git config --global user.email "travis@travis-ci.org"
|
||||
- git config --global user.name "TravisCI-DocBuilder"
|
||||
# Build the doxygen documentation and push it to gh-pages if current branch is great-refactor
|
||||
- sh exportdoc.sh
|
411
Changelog.md
411
Changelog.md
@ -1,414 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## Version 2.4.0
|
||||
|
||||
- **Added full support of all QTM services**, with extensive documentation and technical details in `qtm.h` and `qtmc.h`** (breaking change); examples have been updated for this
|
||||
- Added MCUHWC_SetInfoLedPattern
|
||||
- Added ndspChnGetFormat
|
||||
- Fixed PTMSYSM_CheckNew3DS
|
||||
- Fixed NDMU_QueryStatus
|
||||
- Fixed a few service commands improperly deserializing boolean output
|
||||
- Fixed documentation of ACU_GetWifiStatus and ACU_SetAllowApType
|
||||
- Fixed shaderInstanceInit to initialize all fields
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 2.3.0
|
||||
|
||||
- Fix typo in docs by @DeltaF1 in https://github.com/devkitPro/libctru/pull/525
|
||||
- Add GPU_DOT3_RGBA texture combiner function by @oreo639 in https://github.com/devkitPro/libctru/pull/528
|
||||
- FSUSER_GetLegacyBannerData: Fix documentation typo by @Tekito-256 in https://github.com/devkitPro/libctru/pull/526
|
||||
- Add CTR_ prefix to ALIGN,PACKED,DEPRECATED macros by @glebm in https://github.com/devkitPro/libctru/pull/532
|
||||
- Buffer console control sequences by @piepie62 in https://github.com/devkitPro/libctru/pull/522
|
||||
- Prevent CPU from postponing threadOnException memory writes
|
||||
- Add SSID-related ac:i functions
|
||||
- ACI_LoadNetworkSetting, ACI_GetNetworkWirelessEssidSecuritySsid and acGetSessionHandle.
|
||||
- Prevent double call of destructors on exit.
|
||||
- Added experimental support for standard threading APIs (pthread, C threads, C++ std::thread)
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## New Contributors
|
||||
- @DeltaF1 made their first contribution in https://github.com/devkitPro/libctru/pull/525
|
||||
- @Tekito-256 made their first contribution in https://github.com/devkitPro/libctru/pull/526
|
||||
- @glebm made their first contribution in https://github.com/devkitPro/libctru/pull/532
|
||||
|
||||
## Version 2.2.2
|
||||
|
||||
- archive_dev: Ensure path separator for local path
|
||||
- adjust struct hostent for compatibilty
|
||||
|
||||
## Version 2.2.1
|
||||
|
||||
- add `_SOCKLEN_T_DECLARED`
|
||||
|
||||
## Version 2.2.0
|
||||
|
||||
- apt: add deliver arg support to chainloader
|
||||
|
||||
## Version 2.1.2
|
||||
|
||||
- Added cdc:CHK service wrappers
|
||||
- Added support for `clock_gettime` (#495)
|
||||
- svc: Fixed svcGetDmaState writing out-of-bounds data
|
||||
- svc: Changed svcCreateCodeSet address parameters to pointer-sized integers, improve documentation
|
||||
- fspxi: Fixed FSPXI_CreateFile and FSPXI_WriteFile (#496)
|
||||
- ndsp: Added various ndspGet\* and ndspChnGet\* methods (#505, #506, #507)
|
||||
- ir: Added IRU_GetSend/RecvFinishedEvent (#513)
|
||||
- errf: Added ERRF_SetUserString and clarify documentation
|
||||
- mcuhwc: Added mcuHwcGetSessionHandle
|
||||
- apt: Fixed dirty homebrew chainload bug (used when Home Menu hasn't been started)
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 2.1.1
|
||||
|
||||
- FPSCR is now initialized with a predictable value in all threads (including the main thread).
|
||||
- Added gspGetSessionHandle and gspLcdGetSessionHandle.
|
||||
- Fixed bugs related to uninitialized data in srv/errf service wrappers.
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 2.1.0
|
||||
|
||||
**The #define for the 3DS platform has been changed to `__3DS__` (previously it was `_3DS`) - please update your Makefiles and your code**
|
||||
|
||||
### graphics
|
||||
|
||||
- Refactored VRAM allocators:
|
||||
- Added proper handling for VRAM banks (A and B, 3 MiB each)
|
||||
- Allocations no longer cross VRAM bank boundaries
|
||||
- Added vramAllocAt, vramMemAlignAt
|
||||
- Add gspIsPresentPending.
|
||||
- Add return value to gspPresentBuffer.
|
||||
- libctru console now supports SGR 38 and 48 escape sequences (needed by fmtlib).
|
||||
- Fixed GPU_TEXFACE enum.
|
||||
|
||||
### filesystem
|
||||
|
||||
- Changed rename to replace existing files, for better compatibility with POSIX (#483)
|
||||
- Added SDMMC speed info types, and more clock rates (#480).
|
||||
|
||||
### miscellaneous
|
||||
|
||||
- Added support for 3dslink stdio redirection (#488).
|
||||
- Added ptm:gets, ptm:sets and more ptm service commands.
|
||||
- Added AM_ContentInfo, AM_ContentInfoFlags structs.
|
||||
- Added AMAPP_GetDLCContentInfoCount, AMAPP_ListDLCContentInfos.
|
||||
- Fixed bug in Huffman decoder.
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 2.0.1
|
||||
|
||||
- Added CFG_SystemModel enum.
|
||||
- Fixed bug in condvar code.
|
||||
- Fixed bug in srvpm code.
|
||||
- Fixed const correctness issues in gspgpu code.
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 2.0.0
|
||||
|
||||
**This is a major release. Many essential components have been overhauled, although breaking changes are minimal and only affect rarely used functionality.**
|
||||
|
||||
### system
|
||||
|
||||
- Added support for userAppInit/userAppExit (backported from libnx).
|
||||
- Changed default heap allocation logic to be more robust:
|
||||
- Resource limit SVCs are now used to detect available memory.
|
||||
- The heap size calculation algorithm was tweaked so that 32MB of linear heap are available for normal apps running under the default appmemtype layout on Old 3DS, as it was the case prior to libctru 1.8.0.
|
||||
- SVC enhancements:
|
||||
- Added svcControlPerformanceCounter with corresponding enums.
|
||||
- Overhauled support for DMA related SVCs:
|
||||
- Added svcRestartDma.
|
||||
- Added enums and structures needed for DMA SVCs.
|
||||
- Added dmaDeviceConfigInitDefault, dmaConfigInitDefault.
|
||||
- Added svcArbitrateAddressNoTimeout (minor ABI optimization for the svcArbitrateAddress syscall when the timeout parameter is not used).
|
||||
- Changed process memory SVCs to use u32 parameters instead of void\* for foreign-process addresses.
|
||||
- Major refactor of OS related functions:
|
||||
- Added defines for Arm11 userland memory region addresses/sizes.
|
||||
- Added struct definitions for the kernel/system shared config pages: osKernelConfig_s, osSharedConfig_s.
|
||||
- Added macros to access the kernel/system shared config pages: OS_KernelConfig, OS_SharedConfig.
|
||||
- Fixed return type of osGetMemRegionUsed, osGetMemRegionFree (s64 -> u32).
|
||||
- Refactored osConvertVirtToPhys and added support for the missing linearly mapped memory regions.
|
||||
- Rewritten RTC time reading support to improve accuracy and match official logic more closely.
|
||||
- Time drift correction is now implemented.
|
||||
- Added osGetTimeRef function for reading the current reference timepoint published by the PTM sysmodule.
|
||||
- Fixed osStrError to actually work properly.
|
||||
- Cleaned up osGetSystemVersionData implementation.
|
||||
- Other miscellaneous internal cleanup.
|
||||
|
||||
### synchronization
|
||||
|
||||
- Improved safety of usermode synchronization primitives when used in intercore contexts.
|
||||
- Added CondVar synchronization primitive implementation.
|
||||
- Added syncArbitrateAddress, syncArbitrateAddressWithTimeout.
|
||||
- These functions replace \_\_sync\_get\_arbiter (which has been removed).
|
||||
- Added \_\_dmb (Data Memory Barrier) intrinsic.
|
||||
- Added LightEvent_WaitTimeout.
|
||||
- Added LightSemaphore_TryAcquire.
|
||||
- Changed LightLock to support 0 as a valid initial (unlocked) state.
|
||||
- This effectively adds support for trivially initialized/zerofilled locks.
|
||||
- Fixed bug in LightSemaphore_Acquire.
|
||||
|
||||
### graphics
|
||||
|
||||
- Major refactor of the GSP service wrapper. It should now be possible to use GSP directly without the gfx API, if the user so desires.
|
||||
- Major internal refactor of the gfx wrapper API that increases maintainability.
|
||||
- Added support for 800px wide mode with non-square pixels on the top screen - usable on every 3DS model except for Old 2DS (but *including* New 2DS XL).
|
||||
- Added support for 800px wide mode to the libctru console.
|
||||
- Transferred most of the GSP initialization duties to gspInit/gspExit (previously done by the gfx wrapper).
|
||||
- Added defines for screen IDs and screen dimensions.
|
||||
- Added gspPresentBuffer for pushing a framebuffer to the internal GSP swap queue (previously this was an internal function in the gfx wrapper).
|
||||
- Added gspGetBytesPerPixel, gspHasGpuRight.
|
||||
- Added gfxScreenSwapBuffers, with support for duplicating left->right eye content during stereoscopic 3D mode.
|
||||
- Fixed LCD configuration mode when using framebuffers on VRAM with the gfx wrapper.
|
||||
- Changed gfxExit to set LCD force-black status to true.
|
||||
- Changed the gfx wrapper to always use gspPresentBuffer during swap. This means the immediate parameter of gfxConfigScreen no longer has any effect, and gfxSwapBuffers/gfxSwapBuffersGpu now do the same thing - that is, present the rendered content during the next VBlank.
|
||||
- Renamed GSPGPU_FramebufferFormats enum to GSPGPU_FramebufferFormat.
|
||||
- Deprecated gfxConfigScreen (use gfxScreenSwapBuffers instead).
|
||||
- Removed gspInitEventHandler, gspExitEventHandler (now handled automatically inside gspInit/gspExit).
|
||||
- Removed sharedGspCmdBuf param from gspSubmitGxCommand (now uses the proper GSP shared memory address automatically).
|
||||
- Removed GSPGPU_REBASE_REG define (leftover from early 3DS homebrew).
|
||||
- Removed numerous internal fields that were previously publicly accessible.
|
||||
|
||||
### audio
|
||||
|
||||
- DSP access rights are now managed using a hook mechanism, similar to the APT hook.
|
||||
- This fixes audio playback during libapplet invocations, as they no longer relinquish DSP rights.
|
||||
- Changed NDSP to use the DSP hook instead of the APT hook.
|
||||
- Added dspIsComponentLoaded, dspHook, dspUnhook.
|
||||
- Fixed and improved robustness of wavebuf handling in NDSP code.
|
||||
- Fixed and refactored NDSP sleep/wakeup code to improve accuracy compared to official logic.
|
||||
|
||||
### filesystem
|
||||
|
||||
- Reduced TLS footprint of the archive/romfs devices by sharing buffers.
|
||||
- Reduced the maximum number of concurrently registered archive devices from 32 to 8 in order to save memory.
|
||||
- Backported multi-mount romfs system from libnx, with additional optimizations (breaking API change).
|
||||
- Added romfsMountFromTitle.
|
||||
- Fixed stat for romfs device to return -1 for non-existent files/directories.
|
||||
|
||||
### applet
|
||||
|
||||
- Major internal refactor of the APT service wrapper that should improve accuracy compared to official logic.
|
||||
- Fixed sleep handling when the app is inactive (i.e. app is suspended).
|
||||
- Added support for screen capture during libapplet transitions.
|
||||
- Added support for proper DSP access right management.
|
||||
- aptLaunchLibraryApplet no longer calls aptMainLoop internally. Library applet calls no longer return a bool value, users are advised to check APT state manually afterwards.
|
||||
- Added functions for checking APT state: aptIsActive, aptShouldClose, aptShouldJumpToHome, aptCheckHomePressRejected (replaces aptIsHomePressed).
|
||||
- Added functions for handling incoming requests: aptHandleSleep, aptHandleJumpToHome.
|
||||
- Added aptJumpToHomeMenu.
|
||||
- Changed aptMainLoop to use the new wrapper functions (this means aptMainLoop can now be replaced by custom logic if desired).
|
||||
- Changed APTHOOK_ONEXIT to be invoked during aptExit instead of during aptMainLoop.
|
||||
- Added aptClearChainloader, aptSetChainloaderToSelf.
|
||||
|
||||
### miscellaneous
|
||||
|
||||
- Fix decompress out-of-bounds access.
|
||||
- Added NDM_ prefix to NDM enum members in order to avoid name collisions.
|
||||
- Corrected parameter type in several CFGU functions.
|
||||
- Corrected return value of GSPLCD_GetBrightness.
|
||||
- Removed obsolete support for ninjhax 1.x's fake hb:HB service.
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 1.9.0
|
||||
|
||||
- hid: Added hidKeysDownRepeat, hidWaitForAnyEvent. Allow user override of irsst usage.
|
||||
- Add ptm rtc time commands
|
||||
- Add sleep state FSM handling service commands
|
||||
- Revamp mappableAlloc
|
||||
- Fixed stat on romfs for directories, implemented lstat via stat (FAT32 has no symlinks)
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 1.8.0
|
||||
|
||||
- Added support for environments where the home menu is not launched (such as running under SAFE_FIRM)
|
||||
- Added FSPXI service wrappers
|
||||
- Changed heap allocation logic to be more flexible; this fixes support for certain system memory layouts
|
||||
- Cleaned up and optimized light lock locking code
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 1.7.0
|
||||
|
||||
- fix FIONBIO ioctl
|
||||
- Fix CAMU_GetLatestVsyncTiming
|
||||
- Add archive STDIO device driver
|
||||
- Add AC commands that allow forcing a wifi connection
|
||||
- Fix dspInit() error handling in ndspInit()
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 1.6.0
|
||||
|
||||
- Major overhaul to font loading code in order to support loading external fonts.
|
||||
- Major overhaul to PM service wrappers, now with separate support for pm:app and pm:dbg.
|
||||
- Added Rosalina GDB host IO (gdbhio) support.
|
||||
- Added support for the fs:REG service.
|
||||
- Added support for the PxiPM service.
|
||||
- Added PM launch flag definitions.
|
||||
- Added SO_BROADCAST.
|
||||
- Added new APT helper functions: aptIsHomeAllowed, aptSetHomeAllowed, aptIsHomePressed.
|
||||
- Added support for the Mii selector libapplet, and other improvements to Mii support.
|
||||
- Renamed IPC_Desc_CurProcessHandle to IPC_Desc_CurProcessId.
|
||||
- Changed signature of LOADER_RegisterProgram to use FS_ProgramInfo structs.
|
||||
- Fixed IPC bugs in the Loader service.
|
||||
- Fixed svcCreateResourceLimit.
|
||||
- Fixed corner case bug in GPUCMD_Add.
|
||||
- Fixed bugs in select and herror.
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 1.5.1
|
||||
|
||||
- Added support for the FRD service.
|
||||
- Added gas-related GPU definitions.
|
||||
- Implemented nanosleep.
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 1.5.0
|
||||
|
||||
- Added new decompression API which supports LZSS/LZ10, LZ11, RLE & Huffman formats, and which can read compressed data from memory or from a file.
|
||||
- Added srvSetBlockingPolicy, which controls whether srvGetServiceHandle blocks when the service isn't yet registered (or returns an error otherwise).
|
||||
- Added ACU commands: ACU_GetStatus, ACU_GetSecurityMode, ACU_GetSSIDLength, ACU_GetSecurityMode, ACU_GetProxyEnable, ACU_GetProxyPort, ACU_GetProxyUserName, ACU_GetProxyPassword, ACU_GetLastErrorCode, ACU_GetLastDetailErrorCode.
|
||||
- Added CFGI commands: CFGI_SecureInfoGetSerialNumber, CFGU_IsNFCSupported, CFGI_GetLocalFriendCodeSeed, CFGI_GetLocalFriendCodeSeedData, CFGI_GetSecureInfoData, CFGI_GetSecureInfoSignature.
|
||||
- Added MCUHWC commands: MCUHWC_SetWifiLedState, MCUHWC_SetPowerLedState, MCUHWC_Get3dSliderLevel, MCUHWC_GetFwVerHigh, MCUHWC_GetFwVerLow.
|
||||
- Added NS commands: NS_TerminateTitle, NS_TerminateProcessTID (with timeout), NS_RebootSystem.
|
||||
- Added PM commands: PM_TerminateCurrentApplication, PM_TerminateProcess, PM_UnregisterProcess.
|
||||
- Overhauled NDMU service support and added many commands that were previously missing.
|
||||
- Fixed bugs in srv:pm implementation.
|
||||
- Fixed calculation of vertical texture coordinates in fontCalcGlyphPos.
|
||||
- Fixed shaderProgramSetGshInputPermutation.
|
||||
- Fixed and added clock speed constants (affects system clock and NDSP).
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 1.4.0
|
||||
|
||||
- Added LightSemaphore synchronization primitive.
|
||||
- Added exheader definitions.
|
||||
- Added support for the Loader service.
|
||||
- Added support for the mcu::HWC service.
|
||||
- Added support for the Mii selector applet.
|
||||
- Added ResourceLimitType.
|
||||
- Added AM commands: AM_DeleteAllTemporaryTitles, AM_DeleteAllExpiredTitles, AM_DeleteAllTwlTitles.
|
||||
- Added CFGI commands: CFGI_RestoreLocalFriendCodeSeed, CFGI_RestoreSecureInfo, CFGI_DeleteConfigSavefile, CFGI_FormatConfig, CFGI_ClearParentalControls, CFGI_VerifySigLocalFriendCodeSeed, CFGI_VerifySigSecureInfo.
|
||||
- Added GSPGPU commands: GSPGPU_SetLedForceOff.
|
||||
- Added GSPLCD commands: GSPLCD_SetBrightness, GSPLCD_SetBrightnessRaw, GSPLCD_PowerOnAllBacklights, GSPLCD_PowerOffAllBacklights, GSPLCD_SetLedForceOff.
|
||||
- Fixed srv:pm handling in pre-7.x system versions.
|
||||
- Fixed GPU_LIGHTPERM macro definition.
|
||||
- Removed the remaining deprecated GPUCMD commands.
|
||||
- Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
|
||||
|
||||
## Version 1.3.0
|
||||
|
||||
- Implement more svc calls
|
||||
- svcCreateResourceLimit
|
||||
- svcSetResourceLimitValues
|
||||
- svcSetProcessResourceLimits
|
||||
- svcCreateSession
|
||||
- svcCreateSessionToPort
|
||||
- svcSetGpuProt
|
||||
- svcSetWifiEnabled
|
||||
- Additional functions
|
||||
- implement httpcAddPostDataBinary
|
||||
- implement PTMU_GetAdapterState
|
||||
- implement GSPLCD_GetBrightness
|
||||
- add threadDetach
|
||||
- srv fixes
|
||||
- Fix srvPublishToSubscriber documentation
|
||||
- Fix handling of service/named port names of length 8
|
||||
- Fix srvRegisterPort
|
||||
- debugging support
|
||||
- Add support for user-specified exception handlers
|
||||
- Rename debugDevice_3DMOO to debugDevice_SVC
|
||||
- created debug version of library
|
||||
- Implement error applet
|
||||
- GPU updates
|
||||
- Add GX command queue system for batching GX commands
|
||||
- Correct GPU_PROCTEX_LUTID definition
|
||||
- Add GPU_FOGMODE, GPU_GASMODE and GPU_GASLUTINPUT
|
||||
- Other improvements and minor adjustments for overall system stability to enhance the user experience
|
||||
|
||||
## Version 1.2.1
|
||||
|
||||
- Added NFC support
|
||||
- Update and renamed NFC_AmiiboConfig members
|
||||
- Added TickCounter for measuring performance
|
||||
- Added (linear/vram/mappable)GetSize for retrieving allocated buffer size
|
||||
- Added nim:s client implementation.
|
||||
- Correct bus clock used for time calulations
|
||||
- Default to file write without internal copy buffer
|
||||
- GPUCMD_Add: allow NULL for adding zerofilled parameter data
|
||||
- Clarify threadFree usage in documentation
|
||||
- Add GPU_TEXFACE enumeration
|
||||
|
||||
## Version 1.2.0
|
||||
|
||||
* New features:
|
||||
- Added support for the nfc:m/nfc:u service.
|
||||
- Added support for the ssl:C service.
|
||||
- Added support for the nwm::UDS service (Local wireless).
|
||||
- Added support for the boss:P/boss:U service (SpotPass).
|
||||
- Added support for using the err:f global port.
|
||||
- Added support for using and parsing the shared system font.
|
||||
- Added support for using the 3DS' built-in software keyboard applet.
|
||||
- Added support for using Light Events, a lightweight alternative to normal events that doesn't consume handles.
|
||||
- Added NDSP commands for setting up per-channel monopole & biquad filters.
|
||||
|
||||
* Major breaking changes:
|
||||
- Major revamp of the APT code; some old deprecated functions were completely removed, homebrew code abiding by recent standards shouldn't be affected though.
|
||||
- Major revamp of the HTTPC code, including both additions and bugfixes.
|
||||
- Major revamp of the AM code, with some enhancements.
|
||||
- Major revamp of FSUSER code, archive handle handling has been refactored. fs(End)UseSession replaced with fsExemptFromSession.
|
||||
- Major revamp of MVD code to support video processing.
|
||||
- Major revamp of the GPU shader code to fully support geometry shaders.
|
||||
- The old deprecated GPU wrapper commands have been removed. Use direct GPU register writes or a separate GPU wrapper library (such as citro3d) instead.
|
||||
- Major revamp and update of the SVC debugger API.
|
||||
- Heap size management has been simplified and made more flexible. All applications now default to 32MB of linear heap and all remaining APPLICATION memory is allocated as the application heap, regardless of entrypoint or application format.
|
||||
|
||||
* Miscellaneous additions:
|
||||
- Several enhancements to SOC:u support:
|
||||
- Added getaddrinfo, getnameinfo, gethostname, gai_strerror.
|
||||
- Added SOCU_ShutdownSockets, SOCU_CloseSockets, SOCU_GetIPInfo, SOCU_GetNetworkOpt, SOCU_AddGlobalSocket.
|
||||
- Added several missing flags.
|
||||
- Minor am:net corrections and additions.
|
||||
- Added sdmcWriteSafe to disable copying data to temporary RW buffers before calling FSFILE_Write.
|
||||
- Added sdmc_getmtime to retrieve the modification time for a file.
|
||||
- Added opendir/readdir/rewinddir/closedir/stat support to romfs.
|
||||
- Added support for multiple RomFS mounts.
|
||||
- Added macros for console color codes (ANSI escape sequences).
|
||||
- Added support for specifying a fallback RomFS path for when argv isn't available.
|
||||
- Added aptIsSleepAllowed/aptSetSleepAllowed.
|
||||
- Added ResetType enum for use with svcCreateEvent and svcCreateTimer.
|
||||
- Added psInitHandle and psGetSessionHandle.
|
||||
- Added AM commands: AM_ExportTwlBackup, AM_ImportTwlBackup, AM_ReadTwlBackupInfo, AM_DeleteAllDemoLaunchInfos, AM_FinishCiaInstallWithoutCommit, AM_CommitImportPrograms.
|
||||
- Added AMPXI commands: AMPXI_WriteTWLSavedata, AMPXI_InstallTitlesFinish.
|
||||
- Added APT commands: APT_ReceiveDeliverArg.
|
||||
- Added CFG commands: CFG_GetConfigInfoBlk4, CFG_GetConfigInfoBlk8, CFG_SetConfigInfoBlk4, CFG_SetConfigInfoBlk8, CFG_UpdateConfigNANDSavegame.
|
||||
- Added GSPLCD commands: GSPLCD_GetVendors
|
||||
- Added FSUSER commands: FSUSER_UpdateSha256Context.
|
||||
- Added NEWS commands: NEWS_GetTotalNotifications, NEWS_SetNotificationHeader, NEWS_GetNotificationHeader, NEWS_GetNotificationMessage, NEWS_GetNotificationImage, NEWS_SetNotificationMessage, NEWS_SetNotificationImage.
|
||||
- Added NS commands: NS_TerminateProcessTID, NS_LaunchFIRM, NS_LaunchApplicationFIRM.
|
||||
- Added PS commands: PS_SignRsaSha256, PS_VerifyRsaSha256.
|
||||
- Added PTMSYSM commands: PTMSYSM_CheckNew3DS, PTMSYSM_ShutdownAsync, PTMSYSM_RebootAsync.
|
||||
- Added PXIDEV commands: PXIDEV_SPIMultiWriteRead, PXIDEV_SPIWriteRead.
|
||||
- Added system calls: svcCreateCodeSet, svcCreateProcess, svcGetResourceLimit, svcGetResourceLimitValues, svcGetResourceLimitCurrentValues, svcSetProcessAffinityMask, svcSetProcessIdealProcessor, svcRun, svcBindInterrupt, svcUnbindInterrupt, svcGetHandleInfo, svcBreakRO, svcGetThreadList.
|
||||
- Added result module codes.
|
||||
- Added GPU A4 texture format enum.
|
||||
|
||||
* Miscellaneous changes and bug fixes:
|
||||
- Optimized sdmc's readdir to batch directory entries.
|
||||
- APT, GSPGPU and NDSP code was tuned to take advantage of Light Events.
|
||||
- Moved am:app init to a separate function.
|
||||
- Several issues concerning IPC static buffer saving/restoring were fixed.
|
||||
- Several issues concerning sdmc/RomFS devoptabs were fixed.
|
||||
- Several issues concerning SOC:u were fixed.
|
||||
- An issue concerning cam:u was fixed.
|
||||
- An issue concerning HID was fixed.
|
||||
- An issue concerning news:u was fixed.
|
||||
- The GPU ETC1 texture format enums were fixed.
|
||||
- usleep was fixed.
|
||||
- Fixed incorrect bool return values from services.
|
||||
- Fixed buffer overflow after gfxSetScreenFormat.
|
||||
- Fixed home menu display of suspended 2D applications.
|
||||
- Fixed buffer overrun in console code.
|
||||
- Fixed PS_EncryptDecryptAes and PS_EncryptSignDecryptVerifyAesCcm.
|
||||
- Fixed the implementation of svcGetProcessList.
|
||||
- Corrected svcKernelSetState function signature.
|
||||
|
||||
## Version 1.1.0
|
||||
|
||||
* Additions:
|
||||
@ -422,7 +13,7 @@
|
||||
- Added support for usleep.
|
||||
|
||||
* Changes:
|
||||
- NDSP thread priority has been increased, therefore mitigating potential sound issues due to high CPU usage on the main thread.
|
||||
- NDSP thread priority has been increasing, therefore mitigating potential sound issues due to high CPU usage on the main thread.
|
||||
- RomFS initialization no longer makes romfs:/ the default device.
|
||||
|
||||
* Bug fixes:
|
||||
|
@ -1,25 +1,21 @@
|
||||
# libctru - CTR User Library
|
||||
|
||||

|
||||
|
||||
Library for writing user mode ARM11 code for the 3DS (CTR)
|
||||
|
||||
This library aims to provide the foundations necessary to write 3DS Homebrew, and straightforwardly access the different functionalities provided by the 3DS operating system.
|
||||
It is not meant to provide higher level functions; to put things in perspective, the purpose of libctru would be to sit between the OS and a possible port of SDL rather than replace it.
|
||||
|
||||
*(Originally located at github.com/smealum/ctrulib)*
|
||||
|
||||
# Setup
|
||||
|
||||
libctru is just a library and needs a toolchain to function. devkitARM (created by [devkitPro](http://devkitpro.org)) is the officially supported ARM cross compiling toolchain, which provides the framework necessary to supply a usable POSIX-like environment, with working C and C++ standard libraries; as well as the tools required to compile homebrew in the 3DSX format, and assemble GPU shaders. The use of other ARM toolchains is severely discouraged.
|
||||
|
||||
The most recent version of devkitARM is always recommended. The [installers/setup scripts](https://devkitpro.org/wiki/devkitPro_pacman) supplied by devkitPro install a prebuilt copy of the latest stable version of libctru, which is recommended for general use. Please note that devkitPro has a policy of keeping legacy code to a minimum, so a library upgrade may result in older code failing to compile or behave properly. Developers are encouraged to keep their code working with the latest versions of the tools and libraries.
|
||||
The most recent version of devkitARM (r45 at the time of writing) is always recommended. The installers/setup scripts supplied by devkitPro install a prebuilt copy of the latest stable version of libctru, which is recommended for general use. Please note that devkitPro has a policy of keeping legacy code to a minimum, so a library upgrade may result in older code failing to compile or behave properly. Developers are encouraged to keep their code working with the latest versions of the tools and libraries.
|
||||
|
||||
You may find instructions on how to install devkitARM on [the devkitPro Wiki](http://devkitpro.org/wiki/Getting_Started).
|
||||
|
||||
# Documentation
|
||||
|
||||
The documentation is automatically built upon release and can be found at the following url: https://devkitpro.github.io/libctru/
|
||||
The documentation is automatically built upon release and can be found at the following url: [http://smealum.github.io/ctrulib](http://smealum.github.io/ctrulib)
|
||||
|
||||
# License
|
||||
|
||||
|
14
exportdoc.sh
Normal file
14
exportdoc.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
if [ "$TRAVIS_REPO_SLUG" = "smealum/ctrulib" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ -n "$TRAVIS_TAG" ]; then
|
||||
git clone --branch=gh-pages --single-branch --depth 1 https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG docs
|
||||
git rm -rf docs/*
|
||||
git clone --branch=master --single-branch --depth 1 https://github.com/devkitPro/3ds-examples examples
|
||||
cd libctru
|
||||
doxygen Doxyfile
|
||||
mv ./docs/html/* ../docs
|
||||
cd ../docs
|
||||
git add --all
|
||||
git commit -m"Doc generated from commit $TRAVIS_COMMIT"
|
||||
git push -f origin gh-pages
|
||||
|
||||
fi
|
7
libctru/.gitignore
vendored
7
libctru/.gitignore
vendored
@ -1,10 +1,5 @@
|
||||
debug
|
||||
release
|
||||
deps
|
||||
build
|
||||
lib
|
||||
docs
|
||||
internal_docs
|
||||
*.bz2
|
||||
.*/
|
||||
*.tag
|
||||
*.bz2
|
414
libctru/Doxyfile
414
libctru/Doxyfile
@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.8.11
|
||||
# Doxyfile 1.8.6
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@ -38,7 +38,7 @@ PROJECT_NAME = "libctru"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = "$(CTRU_VERSION)"
|
||||
PROJECT_NUMBER = "$(TRAVIS_TAG)"
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@ -46,10 +46,10 @@ PROJECT_NUMBER = "$(CTRU_VERSION)"
|
||||
|
||||
PROJECT_BRIEF =
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||
# the logo to the output directory.
|
||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
|
||||
# the documentation. The maximum height of the logo should not exceed 55 pixels
|
||||
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
|
||||
# to the output directory.
|
||||
|
||||
PROJECT_LOGO =
|
||||
|
||||
@ -60,7 +60,7 @@ PROJECT_LOGO =
|
||||
|
||||
OUTPUT_DIRECTORY = docs
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
|
||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
|
||||
# directories (in 2 levels) under the output directory of each output format and
|
||||
# will distribute the generated files over these directories. Enabling this
|
||||
# option can be useful when feeding doxygen a huge amount of source files, where
|
||||
@ -70,14 +70,6 @@ OUTPUT_DIRECTORY = docs
|
||||
|
||||
CREATE_SUBDIRS = NO
|
||||
|
||||
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
|
||||
# characters to appear in the names of generated files. If set to NO, non-ASCII
|
||||
# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
|
||||
# U+3044.
|
||||
# The default value is: NO.
|
||||
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
|
||||
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
||||
# documentation generated by doxygen is written. Doxygen will use this
|
||||
# information to generate all constant output in the proper language.
|
||||
@ -93,14 +85,14 @@ ALLOW_UNICODE_NAMES = NO
|
||||
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
|
||||
# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
|
||||
# descriptions after the members that are listed in the file and class
|
||||
# documentation (similar to Javadoc). Set to NO to disable this.
|
||||
# The default value is: YES.
|
||||
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
|
||||
# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
|
||||
# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
|
||||
# description of a member or function before the detailed description
|
||||
#
|
||||
# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
|
||||
@ -135,7 +127,7 @@ ALWAYS_DETAILED_SEC = NO
|
||||
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
|
||||
# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
|
||||
# before files name in the file list and in the header files. If set to NO the
|
||||
# shortest path that makes the file name unique will be used
|
||||
# The default value is: YES.
|
||||
@ -205,9 +197,9 @@ MULTILINE_CPP_IS_BRIEF = NO
|
||||
|
||||
INHERIT_DOCS = YES
|
||||
|
||||
# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
|
||||
# page for each member. If set to NO, the documentation of a member will be part
|
||||
# of the file/class/namespace that contains it.
|
||||
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
|
||||
# new page for each member. If set to NO, the documentation of a member will be
|
||||
# part of the file/class/namespace that contains it.
|
||||
# The default value is: NO.
|
||||
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
@ -269,14 +261,11 @@ OPTIMIZE_OUTPUT_VHDL = NO
|
||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
|
||||
# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
|
||||
# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
|
||||
# Fortran. In the later case the parser tries to guess whether the code is fixed
|
||||
# or free formatted code, this is the default for Fortran type files), VHDL. For
|
||||
# instance to make doxygen treat .inc files as Fortran files (default is PHP),
|
||||
# and .f files as C (default is Fortran), use: inc=Fortran f=C.
|
||||
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
|
||||
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
|
||||
# (default is Fortran), use: inc=Fortran f=C.
|
||||
#
|
||||
# Note: For files without extension you can use no_extension as a placeholder.
|
||||
# Note For files without extension you can use no_extension as a placeholder.
|
||||
#
|
||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||
# the files are not read by doxygen.
|
||||
@ -295,8 +284,8 @@ MARKDOWN_SUPPORT = YES
|
||||
|
||||
# When enabled doxygen tries to link words that correspond to documented
|
||||
# classes, or namespaces to their corresponding documentation. Such a link can
|
||||
# be prevented in individual cases by putting a % sign in front of the word or
|
||||
# globally by setting AUTOLINK_SUPPORT to NO.
|
||||
# be prevented in individual cases by by putting a % sign in front of the word
|
||||
# or globally by setting AUTOLINK_SUPPORT to NO.
|
||||
# The default value is: YES.
|
||||
|
||||
AUTOLINK_SUPPORT = YES
|
||||
@ -336,20 +325,13 @@ SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
|
||||
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
|
||||
# tag is set to YES then doxygen will reuse the documentation of the first
|
||||
# tag is set to YES, then doxygen will reuse the documentation of the first
|
||||
# member in the group (if any) for the other members of the group. By default
|
||||
# all members of a group must be documented explicitly.
|
||||
# The default value is: NO.
|
||||
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
|
||||
# If one adds a struct or class to a group and this option is enabled, then also
|
||||
# any nested class or struct is added to the same group. By default this option
|
||||
# is disabled and one has to add nested compounds explicitly via \ingroup.
|
||||
# The default value is: NO.
|
||||
|
||||
GROUP_NESTED_COMPOUNDS = NO
|
||||
|
||||
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
|
||||
# (for instance a group of public functions) to be put as a subgroup of that
|
||||
# type (e.g. under the Public Functions section). Set it to NO to prevent
|
||||
@ -408,7 +390,7 @@ LOOKUP_CACHE_SIZE = 0
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
|
||||
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
|
||||
# documentation are documented, even if no documentation was available. Private
|
||||
# class members and static file members will be hidden unless the
|
||||
# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
|
||||
@ -418,35 +400,35 @@ LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
EXTRACT_ALL = NO
|
||||
|
||||
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
|
||||
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
|
||||
# be included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
EXTRACT_PRIVATE = NO
|
||||
|
||||
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
|
||||
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
|
||||
# scope will be included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
EXTRACT_PACKAGE = NO
|
||||
|
||||
# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
|
||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
|
||||
# included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
EXTRACT_STATIC = YES
|
||||
|
||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
|
||||
# locally in source files will be included in the documentation. If set to NO,
|
||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
|
||||
# locally in source files will be included in the documentation. If set to NO
|
||||
# only classes defined in header files are included. Does not have any effect
|
||||
# for Java sources.
|
||||
# The default value is: YES.
|
||||
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
|
||||
# This flag is only useful for Objective-C code. If set to YES, local methods,
|
||||
# This flag is only useful for Objective-C code. When set to YES local methods,
|
||||
# which are defined in the implementation section but not in the interface are
|
||||
# included in the documentation. If set to NO, only methods in the interface are
|
||||
# included in the documentation. If set to NO only methods in the interface are
|
||||
# included.
|
||||
# The default value is: NO.
|
||||
|
||||
@ -471,21 +453,21 @@ HIDE_UNDOC_MEMBERS = NO
|
||||
|
||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
|
||||
# undocumented classes that are normally visible in the class hierarchy. If set
|
||||
# to NO, these classes will be included in the various overviews. This option
|
||||
# has no effect if EXTRACT_ALL is enabled.
|
||||
# to NO these classes will be included in the various overviews. This option has
|
||||
# no effect if EXTRACT_ALL is enabled.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
|
||||
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
|
||||
# (class|struct|union) declarations. If set to NO, these declarations will be
|
||||
# (class|struct|union) declarations. If set to NO these declarations will be
|
||||
# included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
|
||||
# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
|
||||
# documentation blocks found inside the body of a function. If set to NO, these
|
||||
# documentation blocks found inside the body of a function. If set to NO these
|
||||
# blocks will be appended to the function's detailed documentation block.
|
||||
# The default value is: NO.
|
||||
|
||||
@ -499,7 +481,7 @@ HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
|
||||
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
|
||||
# names in lower-case letters. If set to YES, upper-case letters are also
|
||||
# names in lower-case letters. If set to YES upper-case letters are also
|
||||
# allowed. This is useful if you have classes or files whose names only differ
|
||||
# in case and if your file system supports case sensitive file names. Windows
|
||||
# and Mac users are advised to set this option to NO.
|
||||
@ -508,19 +490,12 @@ INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
|
||||
# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
|
||||
# their full class and namespace scopes in the documentation. If set to YES, the
|
||||
# their full class and namespace scopes in the documentation. If set to YES the
|
||||
# scope will be hidden.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
|
||||
# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
|
||||
# append additional text to a page's title, such as Class Reference. If set to
|
||||
# YES the compound reference will be hidden.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
|
||||
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
|
||||
# the files that are included by a file in the documentation of that file.
|
||||
# The default value is: YES.
|
||||
@ -548,14 +523,14 @@ INLINE_INFO = YES
|
||||
|
||||
# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
|
||||
# (detailed) documentation of file and class members alphabetically by member
|
||||
# name. If set to NO, the members will appear in declaration order.
|
||||
# name. If set to NO the members will appear in declaration order.
|
||||
# The default value is: YES.
|
||||
|
||||
SORT_MEMBER_DOCS = YES
|
||||
|
||||
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
|
||||
# descriptions of file, namespace and class members alphabetically by member
|
||||
# name. If set to NO, the members will appear in declaration order. Note that
|
||||
# name. If set to NO the members will appear in declaration order. Note that
|
||||
# this will also influence the order of the classes in the class list.
|
||||
# The default value is: NO.
|
||||
|
||||
@ -600,25 +575,27 @@ SORT_BY_SCOPE_NAME = NO
|
||||
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
|
||||
# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
|
||||
# list. This list is created by putting \todo commands in the documentation.
|
||||
# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
|
||||
# todo list. This list is created by putting \todo commands in the
|
||||
# documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_TODOLIST = YES
|
||||
|
||||
# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
|
||||
# list. This list is created by putting \test commands in the documentation.
|
||||
# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
|
||||
# test list. This list is created by putting \test commands in the
|
||||
# documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_TESTLIST = YES
|
||||
|
||||
# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
|
||||
# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
|
||||
# list. This list is created by putting \bug commands in the documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_BUGLIST = YES
|
||||
|
||||
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
|
||||
# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
|
||||
# the deprecated list. This list is created by putting \deprecated commands in
|
||||
# the documentation.
|
||||
# The default value is: YES.
|
||||
@ -643,8 +620,8 @@ ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
|
||||
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
|
||||
# the bottom of the documentation of classes and structs. If set to YES, the
|
||||
# list will mention the files that were used to generate the documentation.
|
||||
# the bottom of the documentation of classes and structs. If set to YES the list
|
||||
# will mention the files that were used to generate the documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
SHOW_USED_FILES = YES
|
||||
@ -692,7 +669,8 @@ LAYOUT_FILE =
|
||||
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
|
||||
# For LaTeX the style of the bibliography can be controlled using
|
||||
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
|
||||
# search path. See also \cite for info how to create references.
|
||||
# search path. Do not use file names with spaces, bibtex cannot handle them. See
|
||||
# also \cite for info how to create references.
|
||||
|
||||
CITE_BIB_FILES =
|
||||
|
||||
@ -708,7 +686,7 @@ CITE_BIB_FILES =
|
||||
QUIET = NO
|
||||
|
||||
# The WARNINGS tag can be used to turn on/off the warning messages that are
|
||||
# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
|
||||
# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
|
||||
# this implies that the warnings are on.
|
||||
#
|
||||
# Tip: Turn warnings on while writing the documentation.
|
||||
@ -716,7 +694,7 @@ QUIET = NO
|
||||
|
||||
WARNINGS = YES
|
||||
|
||||
# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
|
||||
# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
|
||||
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
|
||||
# will automatically be disabled.
|
||||
# The default value is: YES.
|
||||
@ -733,18 +711,12 @@ WARN_IF_DOC_ERROR = YES
|
||||
|
||||
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
|
||||
# are documented, but have no documentation for their parameters or return
|
||||
# value. If set to NO, doxygen will only warn about wrong or incomplete
|
||||
# parameter documentation, but not about the absence of documentation.
|
||||
# value. If set to NO doxygen will only warn about wrong or incomplete parameter
|
||||
# documentation, but not about the absence of documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_NO_PARAMDOC = NO
|
||||
|
||||
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
||||
# a warning is encountered.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_AS_ERROR = NO
|
||||
|
||||
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
|
||||
# can produce. The string should contain the $file, $line, and $text tags, which
|
||||
# will be replaced by the file and line number from which the warning originated
|
||||
@ -768,12 +740,10 @@ WARN_LOGFILE =
|
||||
# The INPUT tag is used to specify the files and/or directories that contain
|
||||
# documented source files. You may enter file names like myfile.cpp or
|
||||
# directories like /usr/src/myproject. Separate the files or directories with
|
||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||
# spaces.
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = include \
|
||||
../README.md \
|
||||
../Changelog.md
|
||||
INPUT = include ../README.md ../Changelog.md
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@ -786,22 +756,14 @@ INPUT_ENCODING = UTF-8
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
|
||||
# *.h) to filter out the source-files in the directories.
|
||||
#
|
||||
# Note that for custom extensions or not directly supported extensions you also
|
||||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||
# read by doxygen.
|
||||
#
|
||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
||||
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
||||
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
|
||||
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
|
||||
# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
|
||||
# *.h) to filter out the source-files in the directories. If left blank the
|
||||
# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
|
||||
# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
|
||||
# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
|
||||
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
|
||||
# *.qsf, *.as and *.js.
|
||||
|
||||
FILE_PATTERNS = *.h \
|
||||
*.c \
|
||||
*.cpp \
|
||||
*.s
|
||||
FILE_PATTERNS = *.h *.c *.cpp *.s
|
||||
|
||||
# The RECURSIVE tag can be used to specify whether or not subdirectories should
|
||||
# be searched for input files as well.
|
||||
@ -885,10 +847,6 @@ IMAGE_PATH =
|
||||
# Note that the filter must not add or remove lines; it is applied before the
|
||||
# code is scanned, but not when the output code is generated. If lines are added
|
||||
# or removed, the anchors will not be placed correctly.
|
||||
#
|
||||
# Note that for custom extensions or not directly supported extensions you also
|
||||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||
# properly processed by doxygen.
|
||||
|
||||
INPUT_FILTER =
|
||||
|
||||
@ -898,15 +856,11 @@ INPUT_FILTER =
|
||||
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
|
||||
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
|
||||
# patterns match the file name, INPUT_FILTER is applied.
|
||||
#
|
||||
# Note that for custom extensions or not directly supported extensions you also
|
||||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||
# properly processed by doxygen.
|
||||
|
||||
FILTER_PATTERNS =
|
||||
|
||||
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
|
||||
# INPUT_FILTER) will also be used to filter the input files that are used for
|
||||
# INPUT_FILTER ) will also be used to filter the input files that are used for
|
||||
# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
|
||||
# The default value is: NO.
|
||||
|
||||
@ -966,7 +920,7 @@ REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
|
||||
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
|
||||
# to YES then the hyperlinks from functions in REFERENCES_RELATION and
|
||||
# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
|
||||
# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
|
||||
# link to the documentation.
|
||||
# The default value is: YES.
|
||||
@ -1043,7 +997,7 @@ IGNORE_PREFIX =
|
||||
# Configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
|
||||
# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_HTML = YES
|
||||
@ -1105,15 +1059,13 @@ HTML_FOOTER =
|
||||
|
||||
HTML_STYLESHEET =
|
||||
|
||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
|
||||
# cascading style sheets that are included after the standard style sheets
|
||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
|
||||
# defined cascading style sheet that is included after the standard style sheets
|
||||
# created by doxygen. Using this option one can overrule certain style aspects.
|
||||
# This is preferred over using HTML_STYLESHEET since it does not replace the
|
||||
# standard style sheet and is therefore more robust against future updates.
|
||||
# Doxygen will copy the style sheet files to the output directory.
|
||||
# Note: The order of the extra style sheet files is of importance (e.g. the last
|
||||
# style sheet in the list overrules the setting of the previous ones in the
|
||||
# list). For an example see the documentation.
|
||||
# standard style sheet and is therefor more robust against future updates.
|
||||
# Doxygen will copy the style sheet file to the output directory. For an example
|
||||
# see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
@ -1129,7 +1081,7 @@ HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_FILES =
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the style sheet and background images according to
|
||||
# will adjust the colors in the stylesheet and background images according to
|
||||
# this color. Hue is specified as an angle on a colorwheel, see
|
||||
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
||||
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
|
||||
@ -1160,9 +1112,8 @@ HTML_COLORSTYLE_GAMMA = 80
|
||||
|
||||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to YES can help to show when doxygen was last run and thus if the
|
||||
# documentation is up to date.
|
||||
# The default value is: NO.
|
||||
# to NO can help when comparing the output of multiple runs.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_TIMESTAMP = NO
|
||||
@ -1258,29 +1209,28 @@ GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
|
||||
# The HHC_LOCATION tag can be used to specify the location (absolute path
|
||||
# including file name) of the HTML help compiler (hhc.exe). If non-empty,
|
||||
# including file name) of the HTML help compiler ( hhc.exe). If non-empty
|
||||
# doxygen will try to run the HTML help compiler on the generated index.hhp.
|
||||
# The file has to be specified with full path.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
HHC_LOCATION =
|
||||
|
||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated
|
||||
# (YES) or that it should be included in the master .chm file (NO).
|
||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated (
|
||||
# YES) or that it should be included in the master .chm file ( NO).
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
GENERATE_CHI = NO
|
||||
|
||||
# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
|
||||
# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
|
||||
# and project file content.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
CHM_INDEX_ENCODING =
|
||||
|
||||
# The BINARY_TOC flag controls whether a binary table of contents is generated
|
||||
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
|
||||
# enables the Previous and Next buttons.
|
||||
# The BINARY_TOC flag controls whether a binary table of contents is generated (
|
||||
# YES) or a normal table of contents ( NO) in the .chm file.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
@ -1393,7 +1343,7 @@ DISABLE_INDEX = NO
|
||||
# index structure (just like the one that is generated for HTML Help). For this
|
||||
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
|
||||
# (i.e. any modern browser). Windows users are probably better off using the
|
||||
# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
|
||||
# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
|
||||
# further fine-tune the look of the index. As an example, the default style
|
||||
# sheet generated by doxygen has an example that shows how to put an image at
|
||||
# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
|
||||
@ -1421,7 +1371,7 @@ ENUM_VALUES_PER_LINE = 1
|
||||
|
||||
TREEVIEW_WIDTH = 250
|
||||
|
||||
# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
|
||||
# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
|
||||
# external symbols imported via tag files in a separate window.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
@ -1450,7 +1400,7 @@ FORMULA_TRANSPARENT = YES
|
||||
|
||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||
# http://www.mathjax.org) which uses client side Javascript for the rendering
|
||||
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
|
||||
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
|
||||
# installed or if you want to formulas look prettier in the HTML output. When
|
||||
# enabled you may also need to install MathJax separately and configure the path
|
||||
# to it using the MATHJAX_RELPATH option.
|
||||
@ -1520,11 +1470,11 @@ SEARCHENGINE = YES
|
||||
|
||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||
# implemented using a web server instead of a web client using Javascript. There
|
||||
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
|
||||
# setting. When disabled, doxygen will generate a PHP script for searching and
|
||||
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
|
||||
# and searching needs to be provided by external tools. See the section
|
||||
# "External Indexing and Searching" for details.
|
||||
# are two flavours of web server based searching depending on the
|
||||
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
||||
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
||||
# enabled the indexing and searching needs to be provided by external tools. See
|
||||
# the section "External Indexing and Searching" for details.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
@ -1536,7 +1486,7 @@ SERVER_BASED_SEARCH = NO
|
||||
# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
|
||||
# search results.
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# Doxygen ships with an example indexer ( doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see: http://xapian.org/).
|
||||
#
|
||||
@ -1549,7 +1499,7 @@ EXTERNAL_SEARCH = NO
|
||||
# The SEARCHENGINE_URL should point to a search engine hosted by a web server
|
||||
# which will return the search results when EXTERNAL_SEARCH is enabled.
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# Doxygen ships with an example indexer ( doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see: http://xapian.org/). See the section "External Indexing and
|
||||
# Searching" for details.
|
||||
@ -1587,7 +1537,7 @@ EXTRA_SEARCH_MAPPINGS =
|
||||
# Configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
|
||||
# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_LATEX = NO
|
||||
@ -1618,7 +1568,7 @@ LATEX_CMD_NAME = latex
|
||||
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
|
||||
# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
|
||||
# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
|
||||
# documents. This may be useful for small projects and may help to save some
|
||||
# trees in general.
|
||||
# The default value is: NO.
|
||||
@ -1636,12 +1586,9 @@ COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4
|
||||
|
||||
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
|
||||
# that should be included in the LaTeX output. The package can be specified just
|
||||
# by its name or with the correct syntax as to be used with the LaTeX
|
||||
# \usepackage command. To get the times font for instance you can specify :
|
||||
# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
|
||||
# To use the option intlimits with the amsmath package you can specify:
|
||||
# EXTRA_PACKAGES=[intlimits]{amsmath}
|
||||
# that should be included in the LaTeX output. To get the times font for
|
||||
# instance you can specify
|
||||
# EXTRA_PACKAGES=times
|
||||
# If left blank no extra packages will be included.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
@ -1655,36 +1602,23 @@ EXTRA_PACKAGES =
|
||||
#
|
||||
# Note: Only use a user-defined header if you know what you are doing! The
|
||||
# following commands have a special meaning inside the header: $title,
|
||||
# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
|
||||
# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
|
||||
# string, for the replacement values of the other commands the user is referred
|
||||
# to HTML_HEADER.
|
||||
# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
|
||||
# replace them by respectively the title of the page, the current date and time,
|
||||
# only the current date, the version number of doxygen, the project name (see
|
||||
# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_HEADER =
|
||||
|
||||
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
|
||||
# generated LaTeX document. The footer should contain everything after the last
|
||||
# chapter. If it is left blank doxygen will generate a standard footer. See
|
||||
# LATEX_HEADER for more information on how to generate a default footer and what
|
||||
# special commands can be used inside the footer.
|
||||
# chapter. If it is left blank doxygen will generate a standard footer.
|
||||
#
|
||||
# Note: Only use a user-defined footer if you know what you are doing!
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_FOOTER =
|
||||
|
||||
# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
|
||||
# LaTeX style sheets that are included after the standard style sheets created
|
||||
# by doxygen. Using this option one can overrule certain style aspects. Doxygen
|
||||
# will copy the style sheet files to the output directory.
|
||||
# Note: The order of the extra style sheet files is of importance (e.g. the last
|
||||
# style sheet in the list overrules the setting of the previous ones in the
|
||||
# list).
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
|
||||
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the LATEX_OUTPUT output
|
||||
# directory. Note that the files will be copied as-is; there are no commands or
|
||||
@ -1702,8 +1636,8 @@ LATEX_EXTRA_FILES =
|
||||
|
||||
PDF_HYPERLINKS = YES
|
||||
|
||||
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
|
||||
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
|
||||
# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
|
||||
# the PDF file directly from the LaTeX files. Set this option to YES to get a
|
||||
# higher quality PDF documentation.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
@ -1744,19 +1678,11 @@ LATEX_SOURCE_CODE = NO
|
||||
|
||||
LATEX_BIB_STYLE = plain
|
||||
|
||||
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to NO can help when comparing the output of multiple runs.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_TIMESTAMP = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
|
||||
# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
|
||||
# RTF output is optimized for Word 97 and may not look too pretty with other RTF
|
||||
# readers/editors.
|
||||
# The default value is: NO.
|
||||
@ -1771,7 +1697,7 @@ GENERATE_RTF = NO
|
||||
|
||||
RTF_OUTPUT = rtf
|
||||
|
||||
# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
|
||||
# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
|
||||
# documents. This may be useful for small projects and may help to save some
|
||||
# trees in general.
|
||||
# The default value is: NO.
|
||||
@ -1808,21 +1734,11 @@ RTF_STYLESHEET_FILE =
|
||||
|
||||
RTF_EXTENSIONS_FILE =
|
||||
|
||||
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
|
||||
# with syntax highlighting in the RTF output.
|
||||
#
|
||||
# Note that which sources are shown also depends on other settings such as
|
||||
# SOURCE_BROWSER.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_RTF is set to YES.
|
||||
|
||||
RTF_SOURCE_CODE = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
|
||||
# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
|
||||
# classes and files.
|
||||
# The default value is: NO.
|
||||
|
||||
@ -1846,13 +1762,6 @@ MAN_OUTPUT = man
|
||||
|
||||
MAN_EXTENSION = .3
|
||||
|
||||
# The MAN_SUBDIR tag determines the name of the directory created within
|
||||
# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
|
||||
# MAN_EXTENSION with the initial . removed.
|
||||
# This tag requires that the tag GENERATE_MAN is set to YES.
|
||||
|
||||
MAN_SUBDIR =
|
||||
|
||||
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
|
||||
# will generate one additional man file for each entity documented in the real
|
||||
# man page(s). These additional files only source the real man page, but without
|
||||
@ -1866,7 +1775,7 @@ MAN_LINKS = NO
|
||||
# Configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
|
||||
# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
|
||||
# captures the structure of the code including all documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
@ -1880,7 +1789,19 @@ GENERATE_XML = NO
|
||||
|
||||
XML_OUTPUT = xml
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
|
||||
# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
|
||||
# validating XML parser to check the syntax of the XML files.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
|
||||
# validating XML parser to check the syntax of the XML files.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
XML_DTD =
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
|
||||
# listings (including syntax highlighting and cross-referencing information) to
|
||||
# the XML output. Note that enabling this will significantly increase the size
|
||||
# of the XML output.
|
||||
@ -1893,7 +1814,7 @@ XML_PROGRAMLISTING = YES
|
||||
# Configuration options related to the DOCBOOK output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
|
||||
# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
|
||||
# that can be used to generate PDF.
|
||||
# The default value is: NO.
|
||||
|
||||
@ -1907,23 +1828,14 @@ GENERATE_DOCBOOK = NO
|
||||
|
||||
DOCBOOK_OUTPUT = docbook
|
||||
|
||||
# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
|
||||
# program listings (including syntax highlighting and cross-referencing
|
||||
# information) to the DOCBOOK output. Note that enabling this will significantly
|
||||
# increase the size of the DOCBOOK output.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
|
||||
|
||||
DOCBOOK_PROGRAMLISTING = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
|
||||
# AutoGen Definitions (see http://autogen.sf.net) file that captures the
|
||||
# structure of the code including all documentation. Note that this feature is
|
||||
# still experimental and incomplete at the moment.
|
||||
# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
|
||||
# Definitions (see http://autogen.sf.net) file that captures the structure of
|
||||
# the code including all documentation. Note that this feature is still
|
||||
# experimental and incomplete at the moment.
|
||||
# The default value is: NO.
|
||||
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
@ -1932,7 +1844,7 @@ GENERATE_AUTOGEN_DEF = NO
|
||||
# Configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
|
||||
# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
|
||||
# file that captures the structure of the code including all documentation.
|
||||
#
|
||||
# Note that this feature is still experimental and incomplete at the moment.
|
||||
@ -1940,7 +1852,7 @@ GENERATE_AUTOGEN_DEF = NO
|
||||
|
||||
GENERATE_PERLMOD = NO
|
||||
|
||||
# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
|
||||
# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
|
||||
# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
|
||||
# output from the Perl module output.
|
||||
# The default value is: NO.
|
||||
@ -1948,9 +1860,9 @@ GENERATE_PERLMOD = NO
|
||||
|
||||
PERLMOD_LATEX = NO
|
||||
|
||||
# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
|
||||
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
|
||||
# formatted so it can be parsed by a human reader. This is useful if you want to
|
||||
# understand what is going on. On the other hand, if this tag is set to NO, the
|
||||
# understand what is going on. On the other hand, if this tag is set to NO the
|
||||
# size of the Perl module output will be much smaller and Perl will parse it
|
||||
# just the same.
|
||||
# The default value is: YES.
|
||||
@ -1970,20 +1882,20 @@ PERLMOD_MAKEVAR_PREFIX =
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
|
||||
# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
|
||||
# C-preprocessor directives found in the sources and include files.
|
||||
# The default value is: YES.
|
||||
|
||||
ENABLE_PREPROCESSING = YES
|
||||
|
||||
# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
|
||||
# in the source code. If set to NO, only conditional compilation will be
|
||||
# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
|
||||
# in the source code. If set to NO only conditional compilation will be
|
||||
# performed. Macro expansion can be done in a controlled way by setting
|
||||
# EXPAND_ONLY_PREDEF to YES.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
MACRO_EXPANSION = YES
|
||||
MACRO_EXPANSION = NO
|
||||
|
||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
|
||||
# the macro expansion is limited to the macros specified with the PREDEFINED and
|
||||
@ -1991,9 +1903,9 @@ MACRO_EXPANSION = YES
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
|
||||
# If the SEARCH_INCLUDES tag is set to YES, the include files in the
|
||||
# If the SEARCH_INCLUDES tag is set to YES the includes files in the
|
||||
# INCLUDE_PATH will be searched if a #include is found.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
@ -2023,7 +1935,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED = CTR_PACKED
|
||||
PREDEFINED =
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
@ -2035,9 +1947,9 @@ PREDEFINED = CTR_PACKED
|
||||
EXPAND_AS_DEFINED =
|
||||
|
||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||
# remove all references to function-like macros that are alone on a line, have
|
||||
# an all uppercase name, and do not end with a semicolon. Such function macros
|
||||
# are typically used for boiler-plate code, and will confuse the parser if not
|
||||
# remove all refrences to function-like macros that are alone on a line, have an
|
||||
# all uppercase name, and do not end with a semicolon. Such function macros are
|
||||
# typically used for boiler-plate code, and will confuse the parser if not
|
||||
# removed.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
@ -2057,7 +1969,7 @@ SKIP_FUNCTION_MACROS = YES
|
||||
# where loc1 and loc2 can be relative or absolute paths or URLs. See the
|
||||
# section "Linking to external documentation" for more information about the use
|
||||
# of tag files.
|
||||
# Note: Each tag file must have a unique name (where the name does NOT include
|
||||
# Note: Each tag file must have an unique name (where the name does NOT include
|
||||
# the path). If a tag file is not located in the directory in which doxygen is
|
||||
# run, you must also specify the path to the tagfile here.
|
||||
|
||||
@ -2067,23 +1979,22 @@ TAGFILES =
|
||||
# tag file that is based on the input files it reads. See section "Linking to
|
||||
# external documentation" for more information about the usage of tag files.
|
||||
|
||||
GENERATE_TAGFILE = libctru.tag
|
||||
GENERATE_TAGFILE =
|
||||
|
||||
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
|
||||
# the class index. If set to NO, only the inherited external classes will be
|
||||
# listed.
|
||||
# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
|
||||
# class index. If set to NO only the inherited external classes will be listed.
|
||||
# The default value is: NO.
|
||||
|
||||
ALLEXTERNALS = NO
|
||||
|
||||
# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
|
||||
# in the modules index. If set to NO, only the current project's groups will be
|
||||
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
|
||||
# the modules index. If set to NO, only the current project's groups will be
|
||||
# listed.
|
||||
# The default value is: YES.
|
||||
|
||||
EXTERNAL_GROUPS = YES
|
||||
|
||||
# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
|
||||
# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
|
||||
# the related pages index. If set to NO, only the current project's pages will
|
||||
# be listed.
|
||||
# The default value is: YES.
|
||||
@ -2100,7 +2011,7 @@ PERL_PATH = /usr/bin/perl
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
|
||||
# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
|
||||
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
|
||||
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
|
||||
# disabled, but it is recommended to install and use dot, since it yields more
|
||||
@ -2125,7 +2036,7 @@ MSCGEN_PATH =
|
||||
|
||||
DIA_PATH =
|
||||
|
||||
# If set to YES the inheritance and collaboration graphs will hide inheritance
|
||||
# If set to YES, the inheritance and collaboration graphs will hide inheritance
|
||||
# and usage relations if the target is undocumented or is not a class.
|
||||
# The default value is: YES.
|
||||
|
||||
@ -2150,7 +2061,7 @@ HAVE_DOT = NO
|
||||
|
||||
DOT_NUM_THREADS = 0
|
||||
|
||||
# When you want a differently looking font in the dot files that doxygen
|
||||
# When you want a differently looking font n the dot files that doxygen
|
||||
# generates you can specify the font name using DOT_FONTNAME. You need to make
|
||||
# sure dot is able to find the font, which can be done by putting it in a
|
||||
# standard location or by setting the DOTFONTPATH environment variable or by
|
||||
@ -2198,7 +2109,7 @@ COLLABORATION_GRAPH = YES
|
||||
|
||||
GROUP_GRAPHS = YES
|
||||
|
||||
# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
|
||||
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
|
||||
# collaboration diagrams in a style similar to the OMG's Unified Modeling
|
||||
# Language.
|
||||
# The default value is: NO.
|
||||
@ -2250,8 +2161,7 @@ INCLUDED_BY_GRAPH = YES
|
||||
#
|
||||
# Note that enabling this option will significantly increase the time of a run.
|
||||
# So in most cases it will be better to enable call graphs for selected
|
||||
# functions only using the \callgraph command. Disabling a call graph can be
|
||||
# accomplished by means of the command \hidecallgraph.
|
||||
# functions only using the \callgraph command.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@ -2262,8 +2172,7 @@ CALL_GRAPH = NO
|
||||
#
|
||||
# Note that enabling this option will significantly increase the time of a run.
|
||||
# So in most cases it will be better to enable caller graphs for selected
|
||||
# functions only using the \callergraph command. Disabling a caller graph can be
|
||||
# accomplished by means of the command \hidecallergraph.
|
||||
# functions only using the \callergraph command.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@ -2286,15 +2195,11 @@ GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
|
||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||
# generated by dot. For an explanation of the image formats see the section
|
||||
# output formats in the documentation of the dot tool (Graphviz (see:
|
||||
# http://www.graphviz.org/)).
|
||||
# generated by dot.
|
||||
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
|
||||
# to make the SVG files visible in IE 9+ (other browsers do not have this
|
||||
# requirement).
|
||||
# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
|
||||
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
|
||||
# png:gdiplus:gdiplus.
|
||||
# Possible values are: png, jpg, gif and svg.
|
||||
# The default value is: png.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@ -2337,19 +2242,6 @@ MSCFILE_DIRS =
|
||||
|
||||
DIAFILE_DIRS =
|
||||
|
||||
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
|
||||
# path where java can find the plantuml.jar file. If left blank, it is assumed
|
||||
# PlantUML is not used or called during a preprocessing step. Doxygen will
|
||||
# generate a warning when it encounters a \startuml command in this case and
|
||||
# will not generate output for the diagram.
|
||||
|
||||
PLANTUML_JAR_PATH =
|
||||
|
||||
# When using plantuml, the specified paths are searched for files specified by
|
||||
# the !include statement in a plantuml block.
|
||||
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
|
||||
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
|
||||
# that will be shown in the graph. If the number of nodes in a graph becomes
|
||||
# larger than this value, doxygen will truncate the graph, which is visualized
|
||||
@ -2386,7 +2278,7 @@ MAX_DOT_GRAPH_DEPTH = 0
|
||||
|
||||
DOT_TRANSPARENT = NO
|
||||
|
||||
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
|
||||
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
|
||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
||||
# this, this feature is disabled by default.
|
||||
@ -2403,7 +2295,7 @@ DOT_MULTI_TARGETS = NO
|
||||
|
||||
GENERATE_LEGEND = YES
|
||||
|
||||
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
|
||||
# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
|
||||
# files that are used to generate the various graphs.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
2303
libctru/Doxyfile.internal
Normal file
2303
libctru/Doxyfile.internal
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,8 @@ endif
|
||||
|
||||
include $(DEVKITARM)/base_rules
|
||||
|
||||
export LIBCTRU_MAJOR := 2
|
||||
export LIBCTRU_MINOR := 4
|
||||
export LIBCTRU_MAJOR := 1
|
||||
export LIBCTRU_MINOR := 1
|
||||
export LIBCTRU_PATCH := 0
|
||||
|
||||
|
||||
@ -23,15 +23,13 @@ VERSION := $(LIBCTRU_MAJOR).$(LIBCTRU_MINOR).$(LIBCTRU_PATCH)
|
||||
# INCLUDES is a list of directories containing header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := ctru
|
||||
#BUILD := build
|
||||
BUILD := build
|
||||
SOURCES := source \
|
||||
source/allocator \
|
||||
source/gpu \
|
||||
source/ndsp \
|
||||
source/services \
|
||||
source/services/soc \
|
||||
source/applets \
|
||||
source/util/decompress \
|
||||
source/util/rbtree \
|
||||
source/util/utf \
|
||||
source/system
|
||||
@ -44,17 +42,16 @@ INCLUDES := include
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
|
||||
|
||||
CFLAGS := -g -Wall -Werror -mword-relocations \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
$(ARCH) \
|
||||
$(BUILD_CFLAGS)
|
||||
CFLAGS := -g -Wall -Werror -O2 -mword-relocations \
|
||||
-ffunction-sections -fno-strict-aliasing \
|
||||
-fomit-frame-pointer \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__3DS__
|
||||
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH) $(INCLUDE)
|
||||
ASFLAGS := -g $(ARCH)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
@ -69,9 +66,13 @@ LIBDIRS :=
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
@ -91,61 +92,45 @@ else
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I.
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
.PHONY: clean all
|
||||
.PHONY: $(BUILD) clean all
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: lib/libctru.a lib/libctrud.a
|
||||
all: $(BUILD)
|
||||
|
||||
dist-bin: all
|
||||
@tar --exclude=*~ -cjf libctru-$(VERSION).tar.bz2 include lib default_icon.png
|
||||
|
||||
dist-src:
|
||||
@tar --exclude=*~ -cjf libctru-src-$(VERSION).tar.bz2 include source data Makefile Doxyfile default_icon.png
|
||||
@tar --exclude=*~ -cjf libctru-src-$(VERSION).tar.bz2 include source data Makefile Doxyfile Doxyfile.internal default_icon.png
|
||||
|
||||
dist: dist-src dist-bin
|
||||
|
||||
install: dist-bin
|
||||
mkdir -p $(DESTDIR)$(DEVKITPRO)/libctru
|
||||
bzip2 -cd libctru-$(VERSION).tar.bz2 | tar -xf - -C $(DESTDIR)$(DEVKITPRO)/libctru
|
||||
mkdir -p $(DEVKITPRO)/libctru
|
||||
bzip2 -cd libctru-$(VERSION).tar.bz2 | tar -xf - -C $(DEVKITPRO)/libctru
|
||||
|
||||
dox:
|
||||
@doxygen Doxyfile
|
||||
@doxygen Doxyfile.internal
|
||||
|
||||
lib:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
release:
|
||||
$(BUILD): lib
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
debug:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
lib/libctru.a : lib release $(SOURCES) $(INCLUDES)
|
||||
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
|
||||
BUILD_CFLAGS="-DNDEBUG=1 -O2 -fomit-frame-pointer" \
|
||||
DEPSDIR=$(CURDIR)/release \
|
||||
--no-print-directory -C release \
|
||||
-f $(CURDIR)/Makefile
|
||||
|
||||
lib/libctrud.a : lib debug $(SOURCES) $(INCLUDES)
|
||||
@$(MAKE) BUILD=debug OUTPUT=$(CURDIR)/$@ \
|
||||
BUILD_CFLAGS="-DDEBUG=1 -Og" \
|
||||
DEPSDIR=$(CURDIR)/debug \
|
||||
--no-print-directory -C debug \
|
||||
-f $(CURDIR)/Makefile
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr release debug lib docs libctru.tag
|
||||
@rm -fr $(BUILD) lib docs internal_docs
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
@ -157,10 +142,8 @@ DEPENDS := $(OFILES:.o=.d)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT) : $(OFILES)
|
||||
|
||||
$(OFILES_SRC) : $(HFILES_BIN)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
@ -8,26 +8,18 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_3DS) && !defined(__3DS__)
|
||||
#warning "Please update your Makefile and replace -DARM11 -D_3DS with -D__3DS__"
|
||||
#define __3DS__
|
||||
#endif
|
||||
|
||||
//might be missing some
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/result.h>
|
||||
#include <3ds/ipc.h>
|
||||
#include <3ds/svc.h>
|
||||
#include <3ds/exheader.h>
|
||||
#include <3ds/srv.h>
|
||||
#include <3ds/errf.h>
|
||||
#include <3ds/os.h>
|
||||
#include <3ds/synchronization.h>
|
||||
#include <3ds/thread.h>
|
||||
#include <3ds/gfx.h>
|
||||
#include <3ds/console.h>
|
||||
#include <3ds/env.h>
|
||||
#include <3ds/util/decompress.h>
|
||||
#include <3ds/util/utf.h>
|
||||
|
||||
#include <3ds/allocator/linear.h>
|
||||
@ -36,119 +28,72 @@ extern "C" {
|
||||
|
||||
#include <3ds/services/ac.h>
|
||||
#include <3ds/services/am.h>
|
||||
#include <3ds/services/ampxi.h>
|
||||
#include <3ds/services/apt.h>
|
||||
#include <3ds/services/boss.h>
|
||||
#include <3ds/services/cam.h>
|
||||
#include <3ds/services/cfgnor.h>
|
||||
#include <3ds/services/cfgu.h>
|
||||
#include <3ds/services/csnd.h>
|
||||
#include <3ds/services/dsp.h>
|
||||
#include <3ds/services/fs.h>
|
||||
#include <3ds/services/fspxi.h>
|
||||
#include <3ds/services/fsreg.h>
|
||||
#include <3ds/services/frd.h>
|
||||
#include <3ds/services/gspgpu.h>
|
||||
#include <3ds/services/gsplcd.h>
|
||||
#include <3ds/services/hid.h>
|
||||
#include <3ds/services/irrst.h>
|
||||
#include <3ds/services/sslc.h>
|
||||
#include <3ds/services/httpc.h>
|
||||
#include <3ds/services/uds.h>
|
||||
#include <3ds/services/ndm.h>
|
||||
#include <3ds/services/nim.h>
|
||||
#include <3ds/services/nwmext.h>
|
||||
#include <3ds/services/ir.h>
|
||||
#include <3ds/services/ns.h>
|
||||
#include <3ds/services/pmapp.h>
|
||||
#include <3ds/services/pmdbg.h>
|
||||
#include <3ds/services/pm.h>
|
||||
#include <3ds/services/ps.h>
|
||||
#include <3ds/services/ptmu.h>
|
||||
#include <3ds/services/ptmsysm.h>
|
||||
#include <3ds/services/ptmgets.h>
|
||||
#include <3ds/services/ptmsets.h>
|
||||
#include <3ds/services/pxidev.h>
|
||||
#include <3ds/services/pxipm.h>
|
||||
#include <3ds/services/soc.h>
|
||||
#include <3ds/services/mic.h>
|
||||
#include <3ds/services/mvd.h>
|
||||
#include <3ds/services/nfc.h>
|
||||
#include <3ds/services/news.h>
|
||||
#include <3ds/services/qtm.h>
|
||||
#include <3ds/services/qtmc.h>
|
||||
#include <3ds/services/srvpm.h>
|
||||
#include <3ds/services/loader.h>
|
||||
#include <3ds/services/y2r.h>
|
||||
#include <3ds/services/mcuhwc.h>
|
||||
#include <3ds/services/cdcchk.h>
|
||||
#include <3ds/services/hb.h>
|
||||
|
||||
#include <3ds/gpu/gx.h>
|
||||
#include <3ds/gpu/gpu.h>
|
||||
#include <3ds/gpu/gpu-old.h>
|
||||
#include <3ds/gpu/shbin.h>
|
||||
#include <3ds/gpu/shaderProgram.h>
|
||||
|
||||
#include <3ds/ndsp/ndsp.h>
|
||||
#include <3ds/ndsp/channel.h>
|
||||
|
||||
#include <3ds/applets/swkbd.h>
|
||||
#include <3ds/applets/error.h>
|
||||
|
||||
#include <3ds/applets/miiselector.h>
|
||||
|
||||
#include <3ds/archive.h>
|
||||
#include <3ds/sdmc.h>
|
||||
#include <3ds/romfs.h>
|
||||
#include <3ds/font.h>
|
||||
#include <3ds/mii.h>
|
||||
|
||||
#include <3ds/gdbhio_dev.h>
|
||||
#include <3ds/3dslink.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* @example app_launch/source/main.c
|
||||
* @example audio/filters/source/main.c
|
||||
* @example audio/mic/source/main.c
|
||||
* @example audio/streaming/source/main.c
|
||||
* @example camera/image/source/main.c
|
||||
* @example camera/video/source/main.c
|
||||
* @example get_system_language/source/main.c
|
||||
* @example graphics/bitmap/24bit-color/source/main.c
|
||||
* @example graphics/gpu/both_screens/source/main.c
|
||||
* @example graphics/printing/hello-world/source/main.c
|
||||
* @example graphics/printing/both-screen-text/source/main.c
|
||||
* @example graphics/printing/colored-text/source/main.c
|
||||
* @example graphics/printing/multiple-windows-text/source/main.c
|
||||
* @example graphics/gpu/fragment_light/source/main.c
|
||||
* @example graphics/gpu/geoshader/source/main.c
|
||||
* @example graphics/gpu/gpusprites/source/main.c
|
||||
* @example graphics/gpu/immediate/source/main.c
|
||||
* @example graphics/gpu/lenny/source/main.c
|
||||
* @example graphics/gpu/loop_subdivision/source/main.c
|
||||
* @example graphics/gpu/mipmap_fog/source/main.c
|
||||
* @example graphics/gpu/particles/source/main.c
|
||||
* @example graphics/gpu/proctex/source/main.c
|
||||
* @example graphics/gpu/simple_tri/source/main.c
|
||||
* @example graphics/gpu/textured_cube/source/main.c
|
||||
* @example graphics/gpu/toon_shading/source/main.c
|
||||
* @example graphics/printing/both-screen-text/source/main.c
|
||||
* @example graphics/printing/colored-text/source/main.c
|
||||
* @example graphics/printing/hello-world/source/main.c
|
||||
* @example graphics/printing/multiple-windows-text/source/main.c
|
||||
* @example graphics/printing/system-font/source/main.c
|
||||
* @example http/source/main.c
|
||||
* @example input/read-controls/source/main.c
|
||||
* @example input/software-keyboard/source/main.c
|
||||
* @example input/touch-screen/source/main.c
|
||||
* @example libapplet_launch/source/main.c
|
||||
* @example mvd/source/main.c
|
||||
* @example network/boss/source/main.c
|
||||
* @example network/http/source/main.c
|
||||
* @example network/http_post/source/main.c
|
||||
* @example network/sockets/source/sockets.c
|
||||
* @example network/sslc/source/ssl.c
|
||||
* @example network/uds/source/uds.c
|
||||
* @example nfc/source/main.c
|
||||
* @example qtm/source/main.c
|
||||
* @example romfs/source/main.c
|
||||
* @example sdmc/source/main.c
|
||||
* @example threads/event/source/main.c
|
||||
* @example threads/thread-basic/source/main.c
|
||||
* @example threads/event/source/main.c
|
||||
* @example time/rtc/source/main.c
|
||||
*/
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
/**
|
||||
* @file 3dslink.h
|
||||
* @brief Netloader (3dslink) utilities
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct in_addr;
|
||||
|
||||
/// Address of the host connected through 3dslink
|
||||
extern struct in_addr __3dslink_host;
|
||||
|
||||
#define LINK3DS_COMM_PORT 17491 ///< 3dslink TCP server port
|
||||
|
||||
/**
|
||||
* @brief Connects to the 3dslink host, setting up an output stream.
|
||||
* @param[in] redirStdout Whether to redirect stdout to nxlink output.
|
||||
* @param[in] redirStderr Whether to redirect stderr to nxlink output.
|
||||
* @return Socket fd on success, negative number on failure.
|
||||
* @note The socket should be closed with close() during application cleanup.
|
||||
*/
|
||||
int link3dsConnectToHost(bool redirStdout, bool redirStderr);
|
||||
|
||||
/// Same as \ref link3dsConnectToHost but redirecting both stdout/stderr.
|
||||
static inline int link3dsStdio(void) {
|
||||
return link3dsConnectToHost(true, true);
|
||||
}
|
||||
|
||||
/// Same as \ref link3dsConnectToHost but redirecting only stderr.
|
||||
static inline int link3dsStdioForDebug(void) {
|
||||
return link3dsConnectToHost(false, true);
|
||||
}
|
@ -4,8 +4,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* @brief Allocates a 0x80-byte aligned buffer.
|
||||
* @param size Size of the buffer to allocate.
|
||||
@ -30,12 +28,6 @@ void* linearMemAlign(size_t size, size_t alignment);
|
||||
*/
|
||||
void* linearRealloc(void* mem, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the allocated size of a buffer.
|
||||
* @return The size of the buffer.
|
||||
*/
|
||||
size_t linearGetSize(void* mem);
|
||||
|
||||
/**
|
||||
* @brief Frees a buffer.
|
||||
* @param mem Buffer to free.
|
||||
|
@ -4,24 +4,21 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/**
|
||||
* @brief Initializes the mappable allocator.
|
||||
* @param addrMin Minimum address.
|
||||
* @param addrMax Maxium address.
|
||||
*/
|
||||
void mappableInit(u32 addrMin, u32 addrMax);
|
||||
|
||||
/**
|
||||
* @brief Finds a mappable memory area.
|
||||
* @param size Size of the area to find.
|
||||
* @return The mappable area.
|
||||
* @brief Allocates a page-aligned buffer.
|
||||
* @param size Size of the buffer to allocate.
|
||||
* @return The allocated buffer.
|
||||
*/
|
||||
void* mappableAlloc(size_t size);
|
||||
|
||||
/**
|
||||
* @brief Frees a mappable area (stubbed).
|
||||
* @param mem Mappable area to free.
|
||||
* @brief Frees a buffer.
|
||||
* @param mem Buffer to free.
|
||||
*/
|
||||
void mappableFree(void* mem);
|
||||
|
||||
/**
|
||||
* @brief Gets the current mappable free space.
|
||||
* @return The current mappable free space.
|
||||
*/
|
||||
u32 mappableSpaceFree(void);
|
||||
|
@ -4,13 +4,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
typedef enum vramAllocPos
|
||||
{
|
||||
VRAM_ALLOC_A = BIT(0),
|
||||
VRAM_ALLOC_B = BIT(1),
|
||||
VRAM_ALLOC_ANY = VRAM_ALLOC_A | VRAM_ALLOC_B,
|
||||
} vramAllocPos;
|
||||
|
||||
/**
|
||||
* @brief Allocates a 0x80-byte aligned buffer.
|
||||
* @param size Size of the buffer to allocate.
|
||||
@ -18,14 +11,6 @@ typedef enum vramAllocPos
|
||||
*/
|
||||
void* vramAlloc(size_t size);
|
||||
|
||||
/**
|
||||
* @brief Allocates a 0x80-byte aligned buffer in the given VRAM bank.
|
||||
* @param size Size of the buffer to allocate.
|
||||
* @param pos VRAM bank to use (see \ref vramAllocPos).
|
||||
* @return The allocated buffer.
|
||||
*/
|
||||
void* vramAllocAt(size_t size, vramAllocPos pos);
|
||||
|
||||
/**
|
||||
* @brief Allocates a buffer aligned to the given size.
|
||||
* @param size Size of the buffer to allocate.
|
||||
@ -34,15 +19,6 @@ void* vramAllocAt(size_t size, vramAllocPos pos);
|
||||
*/
|
||||
void* vramMemAlign(size_t size, size_t alignment);
|
||||
|
||||
/**
|
||||
* @brief Allocates a buffer aligned to the given size in the given VRAM bank.
|
||||
* @param size Size of the buffer to allocate.
|
||||
* @param alignment Alignment to use.
|
||||
* @param pos VRAM bank to use (see \ref vramAllocPos).
|
||||
* @return The allocated buffer.
|
||||
*/
|
||||
void* vramMemAlignAt(size_t size, size_t alignment, vramAllocPos pos);
|
||||
|
||||
/**
|
||||
* @brief Reallocates a buffer.
|
||||
* Note: Not implemented yet.
|
||||
@ -52,12 +28,6 @@ void* vramMemAlignAt(size_t size, size_t alignment, vramAllocPos pos);
|
||||
*/
|
||||
void* vramRealloc(void* mem, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the allocated size of a buffer.
|
||||
* @return The size of the buffer.
|
||||
*/
|
||||
size_t vramGetSize(void* mem);
|
||||
|
||||
/**
|
||||
* @brief Frees a buffer.
|
||||
* @param mem Buffer to free.
|
||||
|
@ -1,91 +0,0 @@
|
||||
/**
|
||||
* @file error.h
|
||||
* @brief Error applet.
|
||||
*/
|
||||
#pragma once
|
||||
#include <3ds/types.h>
|
||||
|
||||
enum
|
||||
{
|
||||
ERROR_LANGUAGE_FLAG = 0x100, ///<??-Unknown flag
|
||||
ERROR_WORD_WRAP_FLAG = 0x200 ///<??-Unknown flag
|
||||
};
|
||||
|
||||
|
||||
///< Type of Error applet to be called
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ERROR_CODE = 0, ///< Displays the infrastructure communications-related error message corresponding to the error code.
|
||||
ERROR_TEXT, ///< Displays text passed to this applet.
|
||||
ERROR_EULA, ///< Displays the EULA
|
||||
ERROR_TYPE_EULA_FIRST_BOOT, ///< Use prohibited.
|
||||
ERROR_TYPE_EULA_DRAW_ONLY, ///< Use prohibited.
|
||||
ERROR_TYPE_AGREE, ///< Use prohibited.
|
||||
ERROR_CODE_LANGUAGE = ERROR_CODE | ERROR_LANGUAGE_FLAG, ///< Displays a network error message in a specified language.
|
||||
ERROR_TEXT_LANGUAGE = ERROR_TEXT | ERROR_LANGUAGE_FLAG, ///< Displays text passed to this applet in a specified language.
|
||||
ERROR_EULA_LANGUAGE = ERROR_EULA | ERROR_LANGUAGE_FLAG, ///< Displays EULA in a specified language.
|
||||
ERROR_TEXT_WORD_WRAP = ERROR_TEXT | ERROR_WORD_WRAP_FLAG,///< Displays the custom error message passed to this applet with automatic line wrapping
|
||||
ERROR_TEXT_LANGUAGE_WORD_WRAP = ERROR_TEXT | ERROR_LANGUAGE_FLAG | ERROR_WORD_WRAP_FLAG ///< Displays the custom error message with automatic line wrapping and in the specified language.
|
||||
}errorType;
|
||||
|
||||
///< Flags for the Upper Screen.Does nothing even if specified.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ERROR_NORMAL = 0,
|
||||
ERROR_STEREO
|
||||
}errorScreenFlag;
|
||||
|
||||
///< Return code of the Error module.Use UNKNOWN for simple apps.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ERROR_UNKNOWN = -1,
|
||||
ERROR_NONE = 0,
|
||||
ERROR_SUCCESS,
|
||||
ERROR_NOT_SUPPORTED,
|
||||
ERROR_HOME_BUTTON = 10,
|
||||
ERROR_SOFTWARE_RESET,
|
||||
ERROR_POWER_BUTTON
|
||||
}errorReturnCode;
|
||||
|
||||
///< Structure to be passed to the applet.Shouldn't be modified directly.
|
||||
|
||||
typedef struct
|
||||
{
|
||||
errorType type;
|
||||
int errorCode;
|
||||
errorScreenFlag upperScreenFlag;
|
||||
u16 useLanguage;
|
||||
u16 Text[1900];
|
||||
bool homeButton;
|
||||
bool softwareReset;
|
||||
bool appJump;
|
||||
errorReturnCode returnCode;
|
||||
u16 eulaVersion;
|
||||
}errorConf;
|
||||
/**
|
||||
* @brief Init the error applet.
|
||||
* @param err Pointer to errorConf.
|
||||
* @param type errorType Type of error.
|
||||
* @param lang CFG_Language Lang of error.
|
||||
*/
|
||||
void errorInit(errorConf* err, errorType type, CFG_Language lang);
|
||||
/**
|
||||
* @brief Sets error code to display.
|
||||
* @param err Pointer to errorConf.
|
||||
* @param error Error-code to display.
|
||||
*/
|
||||
void errorCode(errorConf* err, int error);
|
||||
/**
|
||||
* @brief Sets error text to display.
|
||||
* @param err Pointer to errorConf.
|
||||
* @param text Error-text to display.
|
||||
*/
|
||||
void errorText(errorConf* err, const char* text);
|
||||
/**
|
||||
* @brief Displays the error applet.
|
||||
* @param err Pointer to errorConf.
|
||||
*/
|
||||
void errorDisp(errorConf* err);
|
@ -1,188 +0,0 @@
|
||||
/**
|
||||
* @file miiselector.h
|
||||
* @brief Mii Selector Applet (appletEd).
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/mii.h>
|
||||
|
||||
/// Magic value needed to launch the applet.
|
||||
#define MIISELECTOR_MAGIC 0x13DE28CF
|
||||
|
||||
/// Maximum length of title to be displayed at the top of the Mii selector applet
|
||||
#define MIISELECTOR_TITLE_LEN 64
|
||||
|
||||
/// Number of Guest Miis available for selection
|
||||
#define MIISELECTOR_GUESTMII_SLOTS 6
|
||||
|
||||
/// Maximum number of user Miis available for selection
|
||||
#define MIISELECTOR_USERMII_SLOTS 100
|
||||
|
||||
/// Parameter structure passed to AppletEd
|
||||
typedef struct
|
||||
{
|
||||
u8 enable_cancel_button; ///< Enables canceling of selection if nonzero.
|
||||
u8 enable_selecting_guests; ///< Makes Guets Miis selectable if nonzero.
|
||||
u8 show_on_top_screen; ///< Shows applet on top screen if nonzero,
|
||||
///< otherwise show it on the bottom screen.
|
||||
u8 _unk0x3[5]; ///< @private
|
||||
u16 title[MIISELECTOR_TITLE_LEN]; ///< UTF16-LE string displayed at the top of the applet. If
|
||||
///< set to the empty string, a default title is displayed.
|
||||
u8 _unk0x88[4]; ///< @private
|
||||
u8 show_guest_page; ///< If nonzero, the applet shows a page with Guest
|
||||
///< Miis on launch.
|
||||
u8 _unk0x8D[3]; ///< @private
|
||||
u32 initial_index; ///< Index of the initially selected Mii. If
|
||||
///< @ref MiiSelectorConf.show_guest_page is
|
||||
///< set, this is the index of a Guest Mii,
|
||||
///< otherwise that of a user Mii.
|
||||
u8 mii_guest_whitelist[MIISELECTOR_GUESTMII_SLOTS]; ///< Each byte set to a nonzero value
|
||||
///< enables its corresponding Guest
|
||||
///< Mii to be enabled for selection.
|
||||
u8 mii_whitelist[MIISELECTOR_USERMII_SLOTS]; ///< Each byte set to a nonzero value enables
|
||||
///< its corresponding user Mii to be enabled
|
||||
///< for selection.
|
||||
u16 _unk0xFE; ///< @private
|
||||
u32 magic; ///< Will be set to @ref MIISELECTOR_MAGIC before launching the
|
||||
///< applet.
|
||||
} MiiSelectorConf;
|
||||
|
||||
/// Maximum length of the localized name of a Guest Mii
|
||||
#define MIISELECTOR_GUESTMII_NAME_LEN 12
|
||||
|
||||
/// Structure written by AppletEd
|
||||
typedef struct
|
||||
{
|
||||
u32 no_mii_selected; ///< 0 if a Mii was selected, 1 if the selection was
|
||||
///< canceled.
|
||||
u32 guest_mii_was_selected; ///< 1 if a Guest Mii was selected, 0 otherwise.
|
||||
u32 guest_mii_index; ///< Index of the selected Guest Mii,
|
||||
///< 0xFFFFFFFF if no guest was selected.
|
||||
MiiData mii; ///< Data of selected Mii.
|
||||
u16 _pad0x68; ///< @private
|
||||
u16 checksum; ///< Checksum of the returned Mii data.
|
||||
///< Stored as a big-endian value; use
|
||||
///< @ref miiSelectorChecksumIsValid to
|
||||
///< verify.
|
||||
u16 guest_mii_name[MIISELECTOR_GUESTMII_NAME_LEN]; ///< Localized name of a Guest Mii,
|
||||
///< if one was selected (UTF16-LE
|
||||
///< string). Zeroed otherwise.
|
||||
} MiiSelectorReturn;
|
||||
|
||||
/// AppletEd options
|
||||
enum
|
||||
{
|
||||
MIISELECTOR_CANCEL = BIT(0), ///< Show the cancel button
|
||||
MIISELECTOR_GUESTS = BIT(1), ///< Make Guets Miis selectable
|
||||
MIISELECTOR_TOP = BIT(2), ///< Show AppletEd on top screen
|
||||
MIISELECTOR_GUESTSTART = BIT(3), ///< Start on guest page
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initialize Mii selector config
|
||||
* @param conf Pointer to Miiselector config.
|
||||
*/
|
||||
void miiSelectorInit(MiiSelectorConf *conf);
|
||||
|
||||
/**
|
||||
* @brief Launch the Mii selector library applet
|
||||
*
|
||||
* @param conf Configuration determining how the applet should behave
|
||||
*/
|
||||
void miiSelectorLaunch(const MiiSelectorConf *conf, MiiSelectorReturn* returnbuf);
|
||||
|
||||
/**
|
||||
* @brief Sets title of the Mii selector library applet
|
||||
*
|
||||
* @param conf Pointer to miiSelector configuration
|
||||
* @param text Title text of Mii selector
|
||||
*/
|
||||
void miiSelectorSetTitle(MiiSelectorConf *conf, const char* text);
|
||||
|
||||
/**
|
||||
* @brief Specifies which special options are enabled in the Mii selector
|
||||
*
|
||||
* @param conf Pointer to miiSelector configuration
|
||||
* @param options Options bitmask
|
||||
*/
|
||||
void miiSelectorSetOptions(MiiSelectorConf *conf, u32 options);
|
||||
|
||||
/**
|
||||
* @brief Specifies which guest Miis will be selectable
|
||||
*
|
||||
* @param conf Pointer to miiSelector configuration
|
||||
* @param index Index of the guest Miis that will be whitelisted.
|
||||
* @ref MIISELECTOR_GUESTMII_SLOTS can be used to whitelist all the guest Miis.
|
||||
*/
|
||||
void miiSelectorWhitelistGuestMii(MiiSelectorConf *conf, u32 index);
|
||||
|
||||
/**
|
||||
* @brief Specifies which guest Miis will be unselectable
|
||||
*
|
||||
* @param conf Pointer to miiSelector configuration
|
||||
* @param index Index of the guest Miis that will be blacklisted.
|
||||
* @ref MIISELECTOR_GUESTMII_SLOTS can be used to blacklist all the guest Miis.
|
||||
*/
|
||||
void miiSelectorBlacklistGuestMii(MiiSelectorConf *conf, u32 index);
|
||||
|
||||
/**
|
||||
* @brief Specifies which user Miis will be selectable
|
||||
*
|
||||
* @param conf Pointer to miiSelector configuration
|
||||
* @param index Index of the user Miis that will be whitelisted.
|
||||
* @ref MIISELECTOR_USERMII_SLOTS can be used to whitlist all the user Miis
|
||||
*/
|
||||
void miiSelectorWhitelistUserMii(MiiSelectorConf *conf, u32 index);
|
||||
|
||||
/**
|
||||
* @brief Specifies which user Miis will be selectable
|
||||
*
|
||||
* @param conf Pointer to miiSelector configuration
|
||||
* @param index Index of the user Miis that will be blacklisted.
|
||||
* @ref MIISELECTOR_USERMII_SLOTS can be used to blacklist all the user Miis
|
||||
*/
|
||||
void miiSelectorBlacklistUserMii(MiiSelectorConf *conf, u32 index);
|
||||
|
||||
/**
|
||||
* @brief Specifies which Mii the cursor should start from
|
||||
*
|
||||
* @param conf Pointer to miiSelector configuration
|
||||
* @param index Indexed number of the Mii that the cursor will start on.
|
||||
* If there is no mii with that index, the the cursor will start at the Mii
|
||||
* with the index 0 (the personal Mii).
|
||||
*/
|
||||
static inline void miiSelectorSetInitialIndex(MiiSelectorConf *conf, u32 index)
|
||||
{
|
||||
conf->initial_index = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Mii name
|
||||
*
|
||||
* @param returnbuf Pointer to miiSelector return
|
||||
* @param out String containing a Mii's name
|
||||
* @param max_size Size of string. Since UTF8 characters range in size from 1-3 bytes
|
||||
* (assuming that no non-BMP characters are used), this value should be 36 (or 30 if you are not
|
||||
* dealing with guest miis).
|
||||
*/
|
||||
void miiSelectorReturnGetName(const MiiSelectorReturn *returnbuf, char* out, size_t max_size);
|
||||
|
||||
/**
|
||||
* @brief Get Mii Author
|
||||
*
|
||||
* @param returnbuf Pointer to miiSelector return
|
||||
* @param out String containing a Mii's author
|
||||
* @param max_size Size of string. Since UTF8 characters range in size from 1-3 bytes
|
||||
* (assuming that no non-BMP characters are used), this value should be 30.
|
||||
*/
|
||||
void miiSelectorReturnGetAuthor(const MiiSelectorReturn *returnbuf, char* out, size_t max_size);
|
||||
|
||||
/**
|
||||
* @brief Verifies that the Mii data returned from the applet matches its
|
||||
* checksum
|
||||
*
|
||||
* @param returnbuf Buffer filled by Mii selector applet
|
||||
* @return `true` if `returnbuf->checksum` is the same as the one computed from `returnbuf`
|
||||
*/
|
||||
bool miiSelectorChecksumIsValid(const MiiSelectorReturn *returnbuf);
|
@ -1,321 +0,0 @@
|
||||
/**
|
||||
* @file swkbd.h
|
||||
* @brief Software keyboard applet.
|
||||
*/
|
||||
#pragma once
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Keyboard types.
|
||||
typedef enum
|
||||
{
|
||||
SWKBD_TYPE_NORMAL = 0, ///< Normal keyboard with several pages (QWERTY/accents/symbol/mobile)
|
||||
SWKBD_TYPE_QWERTY, ///< QWERTY keyboard only.
|
||||
SWKBD_TYPE_NUMPAD, ///< Number pad.
|
||||
SWKBD_TYPE_WESTERN, ///< On JPN systems, a text keyboard without Japanese input capabilities, otherwise same as SWKBD_TYPE_NORMAL.
|
||||
} SwkbdType;
|
||||
|
||||
/// Accepted input types.
|
||||
typedef enum
|
||||
{
|
||||
SWKBD_ANYTHING = 0, ///< All inputs are accepted.
|
||||
SWKBD_NOTEMPTY, ///< Empty inputs are not accepted.
|
||||
SWKBD_NOTEMPTY_NOTBLANK, ///< Empty or blank inputs (consisting solely of whitespace) are not accepted.
|
||||
SWKBD_NOTBLANK_NOTEMPTY = SWKBD_NOTEMPTY_NOTBLANK,
|
||||
SWKBD_NOTBLANK, ///< Blank inputs (consisting solely of whitespace) are not accepted, but empty inputs are.
|
||||
SWKBD_FIXEDLEN, ///< The input must have a fixed length (specified by maxTextLength in swkbdInit).
|
||||
} SwkbdValidInput;
|
||||
|
||||
/// Keyboard dialog buttons.
|
||||
typedef enum
|
||||
{
|
||||
SWKBD_BUTTON_LEFT = 0, ///< Left button (usually Cancel)
|
||||
SWKBD_BUTTON_MIDDLE, ///< Middle button (usually I Forgot)
|
||||
SWKBD_BUTTON_RIGHT, ///< Right button (usually OK)
|
||||
SWKBD_BUTTON_CONFIRM = SWKBD_BUTTON_RIGHT,
|
||||
SWKBD_BUTTON_NONE, ///< No button (returned by swkbdInputText in special cases)
|
||||
} SwkbdButton;
|
||||
|
||||
/// Keyboard password modes.
|
||||
typedef enum
|
||||
{
|
||||
SWKBD_PASSWORD_NONE = 0, ///< Characters are not concealed.
|
||||
SWKBD_PASSWORD_HIDE, ///< Characters are concealed immediately.
|
||||
SWKBD_PASSWORD_HIDE_DELAY, ///< Characters are concealed a second after they've been typed.
|
||||
} SwkbdPasswordMode;
|
||||
|
||||
/// Keyboard input filtering flags.
|
||||
enum
|
||||
{
|
||||
SWKBD_FILTER_DIGITS = BIT(0), ///< Disallow the use of more than a certain number of digits (0 or more)
|
||||
SWKBD_FILTER_AT = BIT(1), ///< Disallow the use of the @ sign.
|
||||
SWKBD_FILTER_PERCENT = BIT(2), ///< Disallow the use of the % sign.
|
||||
SWKBD_FILTER_BACKSLASH = BIT(3), ///< Disallow the use of the \ sign.
|
||||
SWKBD_FILTER_PROFANITY = BIT(4), ///< Disallow profanity using Nintendo's profanity filter.
|
||||
SWKBD_FILTER_CALLBACK = BIT(5), ///< Use a callback in order to check the input.
|
||||
};
|
||||
|
||||
/// Keyboard features.
|
||||
enum
|
||||
{
|
||||
SWKBD_PARENTAL = BIT(0), ///< Parental PIN mode.
|
||||
SWKBD_DARKEN_TOP_SCREEN = BIT(1), ///< Darken the top screen when the keyboard is shown.
|
||||
SWKBD_PREDICTIVE_INPUT = BIT(2), ///< Enable predictive input (necessary for Kanji input in JPN systems).
|
||||
SWKBD_MULTILINE = BIT(3), ///< Enable multiline input.
|
||||
SWKBD_FIXED_WIDTH = BIT(4), ///< Enable fixed-width mode.
|
||||
SWKBD_ALLOW_HOME = BIT(5), ///< Allow the usage of the HOME button.
|
||||
SWKBD_ALLOW_RESET = BIT(6), ///< Allow the usage of a software-reset combination.
|
||||
SWKBD_ALLOW_POWER = BIT(7), ///< Allow the usage of the POWER button.
|
||||
SWKBD_DEFAULT_QWERTY = BIT(9), ///< Default to the QWERTY page when the keyboard is shown.
|
||||
};
|
||||
|
||||
/// Keyboard filter callback return values.
|
||||
typedef enum
|
||||
{
|
||||
SWKBD_CALLBACK_OK = 0, ///< Specifies that the input is valid.
|
||||
SWKBD_CALLBACK_CLOSE, ///< Displays an error message, then closes the keyboard.
|
||||
SWKBD_CALLBACK_CONTINUE, ///< Displays an error message and continues displaying the keyboard.
|
||||
} SwkbdCallbackResult;
|
||||
|
||||
/// Keyboard return values.
|
||||
typedef enum
|
||||
{
|
||||
SWKBD_NONE = -1, ///< Dummy/unused.
|
||||
SWKBD_INVALID_INPUT = -2, ///< Invalid parameters to swkbd.
|
||||
SWKBD_OUTOFMEM = -3, ///< Out of memory.
|
||||
|
||||
SWKBD_D0_CLICK = 0, ///< The button was clicked in 1-button dialogs.
|
||||
SWKBD_D1_CLICK0, ///< The left button was clicked in 2-button dialogs.
|
||||
SWKBD_D1_CLICK1, ///< The right button was clicked in 2-button dialogs.
|
||||
SWKBD_D2_CLICK0, ///< The left button was clicked in 3-button dialogs.
|
||||
SWKBD_D2_CLICK1, ///< The middle button was clicked in 3-button dialogs.
|
||||
SWKBD_D2_CLICK2, ///< The right button was clicked in 3-button dialogs.
|
||||
|
||||
SWKBD_HOMEPRESSED = 10, ///< The HOME button was pressed.
|
||||
SWKBD_RESETPRESSED, ///< The soft-reset key combination was pressed.
|
||||
SWKBD_POWERPRESSED, ///< The POWER button was pressed.
|
||||
|
||||
SWKBD_PARENTAL_OK = 20, ///< The parental PIN was verified successfully.
|
||||
SWKBD_PARENTAL_FAIL, ///< The parental PIN was incorrect.
|
||||
|
||||
SWKBD_BANNED_INPUT = 30, ///< The filter callback returned SWKBD_CALLBACK_CLOSE.
|
||||
} SwkbdResult;
|
||||
|
||||
/// Maximum dictionary word length, in UTF-16 code units.
|
||||
#define SWKBD_MAX_WORD_LEN 40
|
||||
/// Maximum button text length, in UTF-16 code units.
|
||||
#define SWKBD_MAX_BUTTON_TEXT_LEN 16
|
||||
/// Maximum hint text length, in UTF-16 code units.
|
||||
#define SWKBD_MAX_HINT_TEXT_LEN 64
|
||||
/// Maximum filter callback error message length, in UTF-16 code units.
|
||||
#define SWKBD_MAX_CALLBACK_MSG_LEN 256
|
||||
|
||||
/// Keyboard dictionary word for predictive input.
|
||||
typedef struct
|
||||
{
|
||||
u16 reading[SWKBD_MAX_WORD_LEN+1]; ///< Reading of the word (that is, the string that needs to be typed).
|
||||
u16 word[SWKBD_MAX_WORD_LEN+1]; ///< Spelling of the word.
|
||||
u8 language; ///< Language the word applies to.
|
||||
bool all_languages; ///< Specifies if the word applies to all languages.
|
||||
} SwkbdDictWord;
|
||||
|
||||
/// Keyboard filter callback function.
|
||||
typedef SwkbdCallbackResult (* SwkbdCallbackFn)(void* user, const char** ppMessage, const char* text, size_t textlen);
|
||||
/// Keyboard status data.
|
||||
typedef struct { u32 data[0x11]; } SwkbdStatusData;
|
||||
/// Keyboard predictive input learning data.
|
||||
typedef struct { u32 data[0x291B]; } SwkbdLearningData;
|
||||
|
||||
/// Internal libctru book-keeping structure for software keyboards.
|
||||
typedef struct
|
||||
{
|
||||
const char* initial_text;
|
||||
const SwkbdDictWord* dict;
|
||||
SwkbdStatusData* status_data;
|
||||
SwkbdLearningData* learning_data;
|
||||
SwkbdCallbackFn callback;
|
||||
void* callback_user;
|
||||
} SwkbdExtra;
|
||||
|
||||
/// Software keyboard parameter structure, it shouldn't be modified directly.
|
||||
typedef struct
|
||||
{
|
||||
int type;
|
||||
int num_buttons_m1;
|
||||
int valid_input;
|
||||
int password_mode;
|
||||
int is_parental_screen;
|
||||
int darken_top_screen;
|
||||
u32 filter_flags;
|
||||
u32 save_state_flags;
|
||||
u16 max_text_len;
|
||||
u16 dict_word_count;
|
||||
u16 max_digits;
|
||||
u16 button_text[3][SWKBD_MAX_BUTTON_TEXT_LEN+1];
|
||||
u16 numpad_keys[2];
|
||||
u16 hint_text[SWKBD_MAX_HINT_TEXT_LEN+1];
|
||||
bool predictive_input;
|
||||
bool multiline;
|
||||
bool fixed_width;
|
||||
bool allow_home;
|
||||
bool allow_reset;
|
||||
bool allow_power;
|
||||
bool unknown; // XX: what is this supposed to do? "communicateWithOtherRegions"
|
||||
bool default_qwerty;
|
||||
bool button_submits_text[4];
|
||||
u16 language; // XX: not working? supposedly 0 = use system language, CFG_Language+1 = pick language
|
||||
int initial_text_offset;
|
||||
int dict_offset;
|
||||
int initial_status_offset;
|
||||
int initial_learning_offset;
|
||||
size_t shared_memory_size;
|
||||
u32 version;
|
||||
SwkbdResult result;
|
||||
int status_offset;
|
||||
int learning_offset;
|
||||
int text_offset;
|
||||
u16 text_length;
|
||||
int callback_result;
|
||||
u16 callback_msg[SWKBD_MAX_CALLBACK_MSG_LEN+1];
|
||||
bool skip_at_check;
|
||||
union
|
||||
{
|
||||
u8 reserved[171];
|
||||
SwkbdExtra extra;
|
||||
};
|
||||
} SwkbdState;
|
||||
|
||||
/**
|
||||
* @brief Initializes software keyboard status.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param type Keyboard type.
|
||||
* @param numButtons Number of dialog buttons to display (1, 2 or 3).
|
||||
* @param maxTextLength Maximum number of UTF-16 code units that input text can have (or -1 to let libctru use a big default).
|
||||
*/
|
||||
void swkbdInit(SwkbdState* swkbd, SwkbdType type, int numButtons, int maxTextLength);
|
||||
|
||||
/**
|
||||
* @brief Configures password mode in a software keyboard.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param mode Password mode.
|
||||
*/
|
||||
static inline void swkbdSetPasswordMode(SwkbdState* swkbd, SwkbdPasswordMode mode)
|
||||
{
|
||||
swkbd->password_mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures input validation in a software keyboard.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param validInput Specifies which inputs are valid.
|
||||
* @param filterFlags Bitmask specifying which characters are disallowed (filtered).
|
||||
* @param maxDigits In case digits are disallowed, specifies how many digits are allowed at maximum in input strings (0 completely restricts digit input).
|
||||
*/
|
||||
static inline void swkbdSetValidation(SwkbdState* swkbd, SwkbdValidInput validInput, u32 filterFlags, int maxDigits)
|
||||
{
|
||||
swkbd->valid_input = validInput;
|
||||
swkbd->filter_flags = filterFlags;
|
||||
swkbd->max_digits = (filterFlags & SWKBD_FILTER_DIGITS) ? maxDigits : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures what characters will the two bottom keys in a numpad produce.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param left Unicode codepoint produced by the leftmost key in the bottom row (0 hides the key).
|
||||
* @param left Unicode codepoint produced by the rightmost key in the bottom row (0 hides the key).
|
||||
*/
|
||||
static inline void swkbdSetNumpadKeys(SwkbdState* swkbd, int left, int right)
|
||||
{
|
||||
swkbd->numpad_keys[0] = left;
|
||||
swkbd->numpad_keys[1] = right;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Specifies which special features are enabled in a software keyboard.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param features Feature bitmask.
|
||||
*/
|
||||
void swkbdSetFeatures(SwkbdState* swkbd, u32 features);
|
||||
|
||||
/**
|
||||
* @brief Sets the hint text of a software keyboard (that is, the help text that is displayed when the textbox is empty).
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param text Hint text.
|
||||
*/
|
||||
void swkbdSetHintText(SwkbdState* swkbd, const char* text);
|
||||
|
||||
/**
|
||||
* @brief Configures a dialog button in a software keyboard.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param button Specifies which button to configure.
|
||||
* @param text Button text.
|
||||
* @param submit Specifies whether pushing the button will submit the text or discard it.
|
||||
*/
|
||||
void swkbdSetButton(SwkbdState* swkbd, SwkbdButton button, const char* text, bool submit);
|
||||
|
||||
/**
|
||||
* @brief Sets the initial text that a software keyboard will display on launch.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param text Initial text.
|
||||
*/
|
||||
void swkbdSetInitialText(SwkbdState* swkbd, const char* text);
|
||||
|
||||
/**
|
||||
* @brief Configures a word in a predictive dictionary for use with a software keyboard.
|
||||
* @param word Pointer to dictionary word structure.
|
||||
* @param reading Reading of the word, that is, the sequence of characters that need to be typed to trigger the word in the predictive input system.
|
||||
* @param text Spelling of the word, that is, the actual characters that will be produced when the user decides to select the word.
|
||||
*/
|
||||
void swkbdSetDictWord(SwkbdDictWord* word, const char* reading, const char* text);
|
||||
|
||||
/**
|
||||
* @brief Sets the custom word dictionary to be used with the predictive input system of a software keyboard.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param dict Pointer to dictionary words.
|
||||
* @param wordCount Number of words in the dictionary.
|
||||
*/
|
||||
void swkbdSetDictionary(SwkbdState* swkbd, const SwkbdDictWord* dict, int wordCount);
|
||||
|
||||
/**
|
||||
* @brief Configures software keyboard internal status management.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param data Pointer to internal status structure (can be in, out or both depending on the other parameters).
|
||||
* @param in Specifies whether the data should be read from the structure when the keyboard is launched.
|
||||
* @param out Specifies whether the data should be written to the structure when the keyboard is closed.
|
||||
*/
|
||||
void swkbdSetStatusData(SwkbdState* swkbd, SwkbdStatusData* data, bool in, bool out);
|
||||
|
||||
/**
|
||||
* @brief Configures software keyboard predictive input learning data management.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param data Pointer to learning data structure (can be in, out or both depending on the other parameters).
|
||||
* @param in Specifies whether the data should be read from the structure when the keyboard is launched.
|
||||
* @param out Specifies whether the data should be written to the structure when the keyboard is closed.
|
||||
*/
|
||||
void swkbdSetLearningData(SwkbdState* swkbd, SwkbdLearningData* data, bool in, bool out);
|
||||
|
||||
/**
|
||||
* @brief Configures a custom function to be used to check the validity of input when it is submitted in a software keyboard.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param callback Filter callback function.
|
||||
* @param user Custom data to be passed to the callback function.
|
||||
*/
|
||||
void swkbdSetFilterCallback(SwkbdState* swkbd, SwkbdCallbackFn callback, void* user);
|
||||
|
||||
/**
|
||||
* @brief Launches a software keyboard in order to input text.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @param buf Pointer to output buffer which will hold the inputted text.
|
||||
* @param bufsize Maximum number of UTF-8 code units that the buffer can hold (including null terminator).
|
||||
* @return The identifier of the dialog button that was pressed, or SWKBD_BUTTON_NONE if a different condition was triggered - in that case use swkbdGetResult to check the condition.
|
||||
*/
|
||||
SwkbdButton swkbdInputText(SwkbdState* swkbd, char* buf, size_t bufsize);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the result condition of a software keyboard after it has been used.
|
||||
* @param swkbd Pointer to swkbd state.
|
||||
* @return The result value.
|
||||
*/
|
||||
static inline SwkbdResult swkbdGetResult(SwkbdState* swkbd)
|
||||
{
|
||||
return swkbd->result;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/**
|
||||
* @file archive.h
|
||||
* @brief FS_Archive driver
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/services/fs.h>
|
||||
|
||||
#define ARCHIVE_DIRITER_MAGIC 0x68637261 /* "arch" */
|
||||
|
||||
/*! Open directory struct */
|
||||
typedef struct
|
||||
{
|
||||
u32 magic; /*! "arch" */
|
||||
Handle fd; /*! CTRU handle */
|
||||
ssize_t index; /*! Current entry index */
|
||||
size_t size; /*! Current batch size */
|
||||
FS_DirectoryEntry entry_data[32]; /*! Temporary storage for reading entries */
|
||||
} archive_dir_t;
|
||||
|
||||
/// Mounts the SD
|
||||
Result archiveMountSdmc(void);
|
||||
|
||||
/// Mounts and opens an archive as deviceName
|
||||
/// Returns either an archive open error code, or -1 for generic failure
|
||||
Result archiveMount(FS_ArchiveID archiveID, FS_Path archivePath, const char *deviceName);
|
||||
|
||||
/// Uses FSUSER_ControlArchive with control action ARCHIVE_ACTION_COMMIT_SAVE_DATA on the opened archive. Not done automatically at unmount.
|
||||
/// Returns -1 if the specified device is not found
|
||||
Result archiveCommitSaveData(const char *deviceName);
|
||||
|
||||
/// Unmounts the specified device, closing its archive in the process
|
||||
/// Returns -1 if the specified device was not found
|
||||
Result archiveUnmount(const char *deviceName);
|
||||
|
||||
/// Unmounts all devices and cleans up any resources used by the driver
|
||||
Result archiveUnmountAll(void);
|
||||
|
||||
/// Get a file's mtime
|
||||
Result archive_getmtime(const char *name, u64 *mtime);
|
@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if !__ASSEMBLER__
|
||||
#error This header file is only for use in assembly files!
|
||||
#endif // !__ASSEMBLER__
|
||||
|
||||
.macro BEGIN_ASM_FUNC name, linkage=global, section=text
|
||||
.section .\section\().\name, "ax", %progbits
|
||||
.align 2
|
||||
.\linkage \name
|
||||
.type \name, %function
|
||||
.func \name
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
\name:
|
||||
.endm
|
||||
|
||||
.macro END_ASM_FUNC
|
||||
.cfi_endproc
|
||||
.endfunc
|
||||
.endm
|
@ -1,176 +1,162 @@
|
||||
/**
|
||||
* @file console.h
|
||||
* @brief 3ds stdio support.
|
||||
*
|
||||
* Provides stdio integration for printing to the 3DS screen as well as debug print
|
||||
* functionality provided by stderr.
|
||||
*
|
||||
* General usage is to initialize the console by:
|
||||
* @code
|
||||
* consoleDemoInit()
|
||||
* @endcode
|
||||
* or to customize the console usage by:
|
||||
* @code
|
||||
* consoleInit()
|
||||
* @endcode
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/gfx.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CONSOLE_ESC(x) "\x1b[" #x
|
||||
#define CONSOLE_RESET CONSOLE_ESC(0m)
|
||||
#define CONSOLE_BLACK CONSOLE_ESC(30m)
|
||||
#define CONSOLE_RED CONSOLE_ESC(31;1m)
|
||||
#define CONSOLE_GREEN CONSOLE_ESC(32;1m)
|
||||
#define CONSOLE_YELLOW CONSOLE_ESC(33;1m)
|
||||
#define CONSOLE_BLUE CONSOLE_ESC(34;1m)
|
||||
#define CONSOLE_MAGENTA CONSOLE_ESC(35;1m)
|
||||
#define CONSOLE_CYAN CONSOLE_ESC(36;1m)
|
||||
#define CONSOLE_WHITE CONSOLE_ESC(37;1m)
|
||||
|
||||
/// A callback for printing a character.
|
||||
typedef bool(*ConsolePrint)(void* con, int c);
|
||||
|
||||
/// A font struct for the console.
|
||||
typedef struct ConsoleFont
|
||||
{
|
||||
u8* gfx; ///< A pointer to the font graphics
|
||||
u16 asciiOffset; ///< Offset to the first valid character in the font table
|
||||
u16 numChars; ///< Number of characters in the font graphics
|
||||
}ConsoleFont;
|
||||
|
||||
/**
|
||||
* @brief Console structure used to store the state of a console render context.
|
||||
*
|
||||
* Default values from consoleGetDefault();
|
||||
* @code
|
||||
* PrintConsole defaultConsole =
|
||||
* {
|
||||
* //Font:
|
||||
* {
|
||||
* (u8*)default_font_bin, //font gfx
|
||||
* 0, //first ascii character in the set
|
||||
* 128, //number of characters in the font set
|
||||
* },
|
||||
* 0,0, //cursorX cursorY
|
||||
* 0,0, //prevcursorX prevcursorY
|
||||
* 40, //console width
|
||||
* 30, //console height
|
||||
* 0, //window x
|
||||
* 0, //window y
|
||||
* 32, //window width
|
||||
* 24, //window height
|
||||
* 3, //tab size
|
||||
* 0, //font character offset
|
||||
* 0, //print callback
|
||||
* false //console initialized
|
||||
* };
|
||||
* @endcode
|
||||
*/
|
||||
typedef struct PrintConsole
|
||||
{
|
||||
ConsoleFont font; ///< Font of the console
|
||||
|
||||
u16 *frameBuffer; ///< Framebuffer address
|
||||
|
||||
int cursorX; ///< Current X location of the cursor (as a tile offset by default)
|
||||
int cursorY; ///< Current Y location of the cursor (as a tile offset by default)
|
||||
|
||||
int prevCursorX; ///< Internal state
|
||||
int prevCursorY; ///< Internal state
|
||||
|
||||
int consoleWidth; ///< Width of the console hardware layer in characters
|
||||
int consoleHeight; ///< Height of the console hardware layer in characters
|
||||
|
||||
int windowX; ///< Window X location in characters (not implemented)
|
||||
int windowY; ///< Window Y location in characters (not implemented)
|
||||
int windowWidth; ///< Window width in characters (not implemented)
|
||||
int windowHeight; ///< Window height in characters (not implemented)
|
||||
|
||||
int tabSize; ///< Size of a tab
|
||||
u16 fg; ///< Foreground color
|
||||
u16 bg; ///< Background color
|
||||
int flags; ///< Reverse/bright flags
|
||||
|
||||
ConsolePrint PrintChar; ///< Callback for printing a character. Should return true if it has handled rendering the graphics (else the print engine will attempt to render via tiles).
|
||||
|
||||
bool consoleInitialised; ///< True if the console is initialized
|
||||
}PrintConsole;
|
||||
|
||||
#define CONSOLE_COLOR_BOLD (1<<0) ///< Bold text
|
||||
#define CONSOLE_COLOR_FAINT (1<<1) ///< Faint text
|
||||
#define CONSOLE_ITALIC (1<<2) ///< Italic text
|
||||
#define CONSOLE_UNDERLINE (1<<3) ///< Underlined text
|
||||
#define CONSOLE_BLINK_SLOW (1<<4) ///< Slow blinking text
|
||||
#define CONSOLE_BLINK_FAST (1<<5) ///< Fast blinking text
|
||||
#define CONSOLE_COLOR_REVERSE (1<<6) ///< Reversed color text
|
||||
#define CONSOLE_CONCEAL (1<<7) ///< Concealed text
|
||||
#define CONSOLE_CROSSED_OUT (1<<8) ///< Crossed out text
|
||||
#define CONSOLE_FG_CUSTOM (1<<9) ///< Foreground custom color
|
||||
#define CONSOLE_BG_CUSTOM (1<<10) ///< Background custom color
|
||||
|
||||
/// Console debug devices supported by libnds.
|
||||
typedef enum {
|
||||
debugDevice_NULL, ///< Swallows prints to stderr
|
||||
debugDevice_SVC, ///< Outputs stderr debug statements using svcOutputDebugString, which can then be captured by interactive debuggers
|
||||
debugDevice_CONSOLE, ///< Directs stderr debug statements to 3DS console window
|
||||
debugDevice_3DMOO = debugDevice_SVC,
|
||||
} debugDevice;
|
||||
|
||||
/**
|
||||
* @brief Loads the font into the console.
|
||||
* @param console Pointer to the console to update, if NULL it will update the current console.
|
||||
* @param font The font to load.
|
||||
*/
|
||||
void consoleSetFont(PrintConsole* console, ConsoleFont* font);
|
||||
|
||||
/**
|
||||
* @brief Sets the print window.
|
||||
* @param console Console to set, if NULL it will set the current console window.
|
||||
* @param x X location of the window.
|
||||
* @param y Y location of the window.
|
||||
* @param width Width of the window.
|
||||
* @param height Height of the window.
|
||||
*/
|
||||
void consoleSetWindow(PrintConsole* console, int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the console with the default values.
|
||||
* This should only be used when using a single console or without changing the console that is returned, otherwise use consoleInit().
|
||||
* @return A pointer to the console with the default values.
|
||||
*/
|
||||
PrintConsole* consoleGetDefault(void);
|
||||
|
||||
/**
|
||||
* @brief Make the specified console the render target.
|
||||
* @param console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)).
|
||||
* @return A pointer to the previous console.
|
||||
*/
|
||||
PrintConsole *consoleSelect(PrintConsole* console);
|
||||
|
||||
/**
|
||||
* @brief Initialise the console.
|
||||
* @param screen The screen to use for the console.
|
||||
* @param console A pointer to the console data to initialize (if it's NULL, the default console will be used).
|
||||
* @return A pointer to the current console.
|
||||
*/
|
||||
PrintConsole* consoleInit(gfxScreen_t screen, PrintConsole* console);
|
||||
|
||||
/**
|
||||
* @brief Initializes debug console output on stderr to the specified device.
|
||||
* @param device The debug device (or devices) to output debug print statements to.
|
||||
*/
|
||||
void consoleDebugInit(debugDevice device);
|
||||
|
||||
/// Clears the screen by using iprintf("\x1b[2J");
|
||||
void consoleClear(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* @file console.h
|
||||
* @brief 3ds stdio support.
|
||||
*
|
||||
* Provides stdio integration for printing to the 3DS screen as well as debug print
|
||||
* functionality provided by stderr.
|
||||
*
|
||||
* General usage is to initialize the console by:
|
||||
* @code
|
||||
* consoleDemoInit()
|
||||
* @endcode
|
||||
* or to customize the console usage by:
|
||||
* @code
|
||||
* consoleInit()
|
||||
* @endcode
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/gfx.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// A callback for printing a character.
|
||||
typedef bool(*ConsolePrint)(void* con, int c);
|
||||
|
||||
/// A font struct for the console.
|
||||
typedef struct ConsoleFont
|
||||
{
|
||||
u8* gfx; ///< A pointer to the font graphics
|
||||
u16 asciiOffset; ///< Offset to the first valid character in the font table
|
||||
u16 numChars; ///< Number of characters in the font graphics
|
||||
}ConsoleFont;
|
||||
|
||||
/**
|
||||
* @brief Console structure used to store the state of a console render context.
|
||||
*
|
||||
* Default values from consoleGetDefault();
|
||||
* @code
|
||||
* PrintConsole defaultConsole =
|
||||
* {
|
||||
* //Font:
|
||||
* {
|
||||
* (u8*)default_font_bin, //font gfx
|
||||
* 0, //first ascii character in the set
|
||||
* 128, //number of characters in the font set
|
||||
* },
|
||||
* 0,0, //cursorX cursorY
|
||||
* 0,0, //prevcursorX prevcursorY
|
||||
* 40, //console width
|
||||
* 30, //console height
|
||||
* 0, //window x
|
||||
* 0, //window y
|
||||
* 32, //window width
|
||||
* 24, //window height
|
||||
* 3, //tab size
|
||||
* 0, //font character offset
|
||||
* 0, //print callback
|
||||
* false //console initialized
|
||||
* };
|
||||
* @endcode
|
||||
*/
|
||||
typedef struct PrintConsole
|
||||
{
|
||||
ConsoleFont font; ///< Font of the console
|
||||
|
||||
u16 *frameBuffer; ///< Framebuffer address
|
||||
|
||||
int cursorX; ///< Current X location of the cursor (as a tile offset by default)
|
||||
int cursorY; ///< Current Y location of the cursor (as a tile offset by default)
|
||||
|
||||
int prevCursorX; ///< Internal state
|
||||
int prevCursorY; ///< Internal state
|
||||
|
||||
int consoleWidth; ///< Width of the console hardware layer in characters
|
||||
int consoleHeight; ///< Height of the console hardware layer in characters
|
||||
|
||||
int windowX; ///< Window X location in characters (not implemented)
|
||||
int windowY; ///< Window Y location in characters (not implemented)
|
||||
int windowWidth; ///< Window width in characters (not implemented)
|
||||
int windowHeight; ///< Window height in characters (not implemented)
|
||||
|
||||
int tabSize; ///< Size of a tab
|
||||
int fg; ///< Foreground color
|
||||
int bg; ///< Background color
|
||||
int flags; ///< Reverse/bright flags
|
||||
|
||||
ConsolePrint PrintChar; ///< Callback for printing a character. Should return true if it has handled rendering the graphics (else the print engine will attempt to render via tiles).
|
||||
|
||||
bool consoleInitialised; ///< True if the console is initialized
|
||||
}PrintConsole;
|
||||
|
||||
#define CONSOLE_COLOR_BOLD (1<<0) ///< Bold text
|
||||
#define CONSOLE_COLOR_FAINT (1<<1) ///< Faint text
|
||||
#define CONSOLE_ITALIC (1<<2) ///< Italic text
|
||||
#define CONSOLE_UNDERLINE (1<<3) ///< Underlined text
|
||||
#define CONSOLE_BLINK_SLOW (1<<4) ///< Slow blinking text
|
||||
#define CONSOLE_BLINK_FAST (1<<5) ///< Fast blinking text
|
||||
#define CONSOLE_COLOR_REVERSE (1<<6) ///< Reversed color text
|
||||
#define CONSOLE_CONCEAL (1<<7) ///< Concealed text
|
||||
#define CONSOLE_CROSSED_OUT (1<<8) ///< Crossed out text
|
||||
|
||||
/// Console debug devices supported by libnds.
|
||||
typedef enum {
|
||||
debugDevice_NULL, ///< Swallows prints to stderr
|
||||
debugDevice_3DMOO, ///< Directs stderr debug statements to 3dmoo
|
||||
debugDevice_CONSOLE, ///< Directs stderr debug statements to 3DS console window
|
||||
} debugDevice;
|
||||
|
||||
/**
|
||||
* @brief Loads the font into the console.
|
||||
* @param console Pointer to the console to update, if NULL it will update the current console.
|
||||
* @param font The font to load.
|
||||
*/
|
||||
void consoleSetFont(PrintConsole* console, ConsoleFont* font);
|
||||
|
||||
/**
|
||||
* @brief Sets the print window.
|
||||
* @param console Console to set, if NULL it will set the current console window.
|
||||
* @param x X location of the window.
|
||||
* @param y Y location of the window.
|
||||
* @param width Width of the window.
|
||||
* @param height Height of the window.
|
||||
*/
|
||||
void consoleSetWindow(PrintConsole* console, int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the console with the default values.
|
||||
* This should only be used when using a single console or without changing the console that is returned, otherwise use consoleInit().
|
||||
* @return A pointer to the console with the default values.
|
||||
*/
|
||||
PrintConsole* consoleGetDefault(void);
|
||||
|
||||
/**
|
||||
* @brief Make the specified console the render target.
|
||||
* @param console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)).
|
||||
* @return A pointer to the previous console.
|
||||
*/
|
||||
PrintConsole *consoleSelect(PrintConsole* console);
|
||||
|
||||
/**
|
||||
* @brief Initialise the console.
|
||||
* @param screen The screen to use for the console.
|
||||
* @param console A pointer to the console data to initialize (if it's NULL, the default console will be used).
|
||||
* @return A pointer to the current console.
|
||||
*/
|
||||
PrintConsole* consoleInit(gfxScreen_t screen, PrintConsole* console);
|
||||
|
||||
/**
|
||||
* @brief Initializes debug console output on stderr to the specified device.
|
||||
* @param device The debug device (or devices) to output debug print statements to.
|
||||
*/
|
||||
void consoleDebugInit(debugDevice device);
|
||||
|
||||
/// Clears the screan by using iprintf("\x1b[2J");
|
||||
void consoleClear(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -8,7 +8,6 @@
|
||||
enum {
|
||||
RUNFLAG_APTWORKAROUND = BIT(0), ///< Use APT workaround.
|
||||
RUNFLAG_APTREINIT = BIT(1), ///< Reinitialize APT.
|
||||
RUNFLAG_APTCHAINLOAD = BIT(2), ///< Chainload APT on return.
|
||||
};
|
||||
|
||||
/**
|
||||
@ -37,21 +36,21 @@ static inline u32 envGetAptAppId(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the size of the application heap.
|
||||
* @return The application heap size.
|
||||
* @brief Gets the environment-recommended heap size.
|
||||
* @return The heap size.
|
||||
*/
|
||||
static inline u32 envGetHeapSize(void) {
|
||||
extern u32 __ctru_heap_size;
|
||||
return __ctru_heap_size;
|
||||
extern u32 __heap_size;
|
||||
return __heap_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the size of the linear heap.
|
||||
* @brief Gets the environment-recommended linear heap size.
|
||||
* @return The linear heap size.
|
||||
*/
|
||||
static inline u32 envGetLinearHeapSize(void) {
|
||||
extern u32 __ctru_linear_heap_size;
|
||||
return __ctru_linear_heap_size;
|
||||
extern u32 __linear_heap_size;
|
||||
return __linear_heap_size;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,137 +0,0 @@
|
||||
/**
|
||||
* @file errf.h
|
||||
* @brief Error Display API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Types of errors that can be thrown by err:f.
|
||||
typedef enum {
|
||||
ERRF_ERRTYPE_GENERIC = 0, ///< Generic fatal error. Shows miscellaneous info, including the address of the caller
|
||||
ERRF_ERRTYPE_NAND_DAMAGED = 1, ///< Damaged NAND (CC_ERROR after reading CSR)
|
||||
ERRF_ERRTYPE_CARD_REMOVED = 2, ///< Game content storage medium (cartridge and/or SD card) ejected. Not logged
|
||||
ERRF_ERRTYPE_EXCEPTION = 3, ///< CPU or VFP exception
|
||||
ERRF_ERRTYPE_FAILURE = 4, ///< Fatal error with a message instead of the caller's address
|
||||
ERRF_ERRTYPE_LOG_ONLY = 5, ///< Log-level failure. Does not display the exception and does not force the system to reboot
|
||||
} ERRF_ErrType;
|
||||
|
||||
/// Types of 'Exceptions' thrown for ERRF_ERRTYPE_EXCEPTION
|
||||
typedef enum {
|
||||
ERRF_EXCEPTION_PREFETCH_ABORT = 0, ///< Prefetch Abort
|
||||
ERRF_EXCEPTION_DATA_ABORT = 1, ///< Data abort
|
||||
ERRF_EXCEPTION_UNDEFINED = 2, ///< Undefined instruction
|
||||
ERRF_EXCEPTION_VFP = 3, ///< VFP (floating point) exception.
|
||||
} ERRF_ExceptionType;
|
||||
|
||||
typedef struct {
|
||||
ERRF_ExceptionType type; ///< Type of the exception. One of the ERRF_EXCEPTION_* values.
|
||||
u8 reserved[3];
|
||||
u32 fsr; ///< ifsr (prefetch abort) / dfsr (data abort)
|
||||
u32 far; ///< pc = ifar (prefetch abort) / dfar (data abort)
|
||||
u32 fpexc;
|
||||
u32 fpinst;
|
||||
u32 fpinst2;
|
||||
} ERRF_ExceptionInfo;
|
||||
|
||||
typedef struct {
|
||||
ERRF_ExceptionInfo excep; ///< Exception info struct
|
||||
CpuRegisters regs; ///< CPU register dump.
|
||||
} ERRF_ExceptionData;
|
||||
|
||||
typedef struct {
|
||||
ERRF_ErrType type; ///< Type, one of the ERRF_ERRTYPE_* enum
|
||||
u8 revHigh; ///< High revison ID
|
||||
u16 revLow; ///< Low revision ID
|
||||
u32 resCode; ///< Result code
|
||||
u32 pcAddr; ///< PC address at exception
|
||||
u32 procId; ///< Process ID of the caller
|
||||
u64 titleId; ///< Title ID of the caller
|
||||
u64 appTitleId; ///< Title ID of the running application
|
||||
union {
|
||||
ERRF_ExceptionData exception_data; ///< Data for when type is ERRF_ERRTYPE_EXCEPTION
|
||||
char failure_mesg[0x60]; ///< String for when type is ERRF_ERRTYPE_FAILURE
|
||||
} data; ///< The different types of data for errors.
|
||||
} ERRF_FatalErrInfo;
|
||||
|
||||
/// Initializes ERR:f. Unless you plan to call ERRF_Throw yourself, do not use this.
|
||||
Result errfInit(void);
|
||||
|
||||
/// Exits ERR:f. Unless you plan to call ERRF_Throw yourself, do not use this.
|
||||
void errfExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current err:f API session handle.
|
||||
* @return The current err:f API session handle.
|
||||
*/
|
||||
Handle *errfGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Throws a system error and possibly logs it.
|
||||
* @param[in] error Error to throw.
|
||||
*
|
||||
* ErrDisp may convert the error info to \ref ERRF_ERRTYPE_NAND_DAMAGED or \ref ERRF_ERRTYPE_CARD_REMOVED
|
||||
* depending on the error code.
|
||||
*
|
||||
* Except with \ref ERRF_ERRTYPE_LOG_ONLY, the system will panic and will need to be rebooted.
|
||||
* Fatal error information will also be logged into a file, unless the type either \ref ERRF_ERRTYPE_NAND_DAMAGED
|
||||
* or \ref ERRF_ERRTYPE_CARD_REMOVED.
|
||||
*
|
||||
* No error will be shown if the system is asleep.
|
||||
*
|
||||
* On retail units with vanilla firmware, no detailed information will be displayed on screen.
|
||||
*
|
||||
* You may wish to use ERRF_ThrowResult() or ERRF_ThrowResultWithMessage() instead of
|
||||
* constructing the ERRF_FatalErrInfo struct yourself.
|
||||
*/
|
||||
Result ERRF_Throw(const ERRF_FatalErrInfo* error);
|
||||
|
||||
/**
|
||||
* @brief Throws (and logs) a system error with the given Result code.
|
||||
* @param[in] failure Result code to throw.
|
||||
*
|
||||
* This calls \ref ERRF_Throw with error type \ref ERRF_ERRTYPE_GENERIC and fills in the required data.
|
||||
*
|
||||
* This function \em does fill in the address where this function was called from.
|
||||
*/
|
||||
Result ERRF_ThrowResult(Result failure);
|
||||
|
||||
/**
|
||||
* @brief Logs a system error with the given Result code.
|
||||
* @param[in] failure Result code to log.
|
||||
*
|
||||
* Similar to \ref ERRF_Throw, except that it does not display anything on the screen,
|
||||
* nor does it force the system to reboot.
|
||||
*
|
||||
* This function \em does fill in the address where this function was called from.
|
||||
*/
|
||||
Result ERRF_LogResult(Result failure);
|
||||
|
||||
/**
|
||||
* @brief Throws a system error with the given Result code and message.
|
||||
* @param[in] failure Result code to throw.
|
||||
* @param[in] message The message to display.
|
||||
*
|
||||
* This calls \ref ERRF_Throw with error type \ref ERRF_ERRTYPE_FAILURE and fills in the required data.
|
||||
*
|
||||
* This function does \em not fill in the address where this function was called from because it
|
||||
* would not be displayed.
|
||||
*/
|
||||
Result ERRF_ThrowResultWithMessage(Result failure, const char* message);
|
||||
|
||||
/**
|
||||
* @brief Specify an additional user string to use for error reporting.
|
||||
* @param[in] user_string User string (up to 256 bytes, not including NUL byte)
|
||||
*/
|
||||
Result ERRF_SetUserString(const char* user_string);
|
||||
|
||||
/**
|
||||
* @brief Handles an exception using ErrDisp.
|
||||
* @param excep Exception information
|
||||
* @param regs CPU registers
|
||||
*
|
||||
* You might want to clear ENVINFO's bit0 to be able to see any debugging information.
|
||||
* @sa threadOnException
|
||||
*/
|
||||
void ERRF_ExceptionHandler(ERRF_ExceptionInfo* excep, CpuRegisters* regs) __attribute__((noreturn));
|
@ -1,199 +0,0 @@
|
||||
/**
|
||||
* @file exheader.h
|
||||
* @brief NCCH extended header definitions.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// ARM9 descriptor flags
|
||||
enum
|
||||
{
|
||||
ARM9DESC_MOUNT_NAND = BIT(0), ///< Mount "nand:/"
|
||||
ARM9DESC_MOUNT_NANDRO_RW = BIT(1), ///< Mount nand:/ro/ as read-write
|
||||
ARM9DESC_MOUNT_TWLN = BIT(2), ///< Mount "twln:/"
|
||||
ARM9DESC_MOUNT_WNAND = BIT(3), ///< Mount "wnand:/"
|
||||
ARM9DESC_MOUNT_CARDSPI = BIT(4), ///< Mount "cardspi:/"
|
||||
ARM9DESC_USE_SDIF3 = BIT(5), ///< Use SDIF3
|
||||
ARM9DESC_CREATE_SEED = BIT(6), ///< Create seed (movable.sed)
|
||||
ARM9DESC_USE_CARD_SPI = BIT(7), ///< Use card SPI, required by multiple pxi:dev commands
|
||||
ARM9DESC_SD_APPLICATION = BIT(8), ///< SD application (not checked)
|
||||
ARM9DESC_MOUNT_SDMC_RW = BIT(9), ///< Mount "sdmc:/" as read-write
|
||||
};
|
||||
|
||||
/// Filesystem access flags
|
||||
enum
|
||||
{
|
||||
FSACCESS_CATEGORY_SYSTEM_APPLICATION = BIT(0), ///< Category "system application"
|
||||
FSACCESS_CATEGORY_HARDWARE_CHECK = BIT(1), ///< Category "hardware check"
|
||||
FSACCESS_CATEGORY_FILESYSTEM_TOOL = BIT(2), ///< Category "filesystem tool"
|
||||
FSACCESS_DEBUG = BIT(3), ///< Debug
|
||||
FSACCESS_TWLCARD_BACKUP = BIT(4), ///< TWLCARD backup
|
||||
FSACCESS_TWLNAND_DATA = BIT(5), ///< TWLNAND data
|
||||
FSACCESS_BOSS = BIT(6), ///< BOSS (SpotPass)
|
||||
FSACCESS_SDMC_RW = BIT(7), ///< SDMC (read-write)
|
||||
FSACCESS_CORE = BIT(8), ///< Core
|
||||
FSACCESS_NANDRO_RO = BIT(9), ///< nand:/ro/ (read-only)
|
||||
FSACCESS_NANDRW = BIT(10), ///< nand:/rw/
|
||||
FSACCESS_NANDRO_RW = BIT(11), ///< nand:/ro/ (read-write)
|
||||
FSACCESS_CATEGORY_SYSTEM_SETTINGS = BIT(12), ///< Category "System Settings"
|
||||
FSACCESS_CARDBOARD = BIT(13), ///< Cardboard (System Transfer)
|
||||
FSACCESS_EXPORT_IMPORT_IVS = BIT(14), ///< Export/Import IVs (movable.sed)
|
||||
FSACCESS_SDMC_WO = BIT(15), ///< SDMC (write-only)
|
||||
FSACCESS_SWITCH_CLEANUP = BIT(16), ///< "Switch cleanup" (3.0+)
|
||||
FSACCESS_SAVEDATA_MOVE = BIT(17), ///< Savedata move (5.0+)
|
||||
FSACCESS_SHOP = BIT(18), ///< Shop (5.0+)
|
||||
FSACCESS_SHELL = BIT(19), ///< Shop (5.0+)
|
||||
FSACCESS_CATEGORY_HOME_MENU = BIT(20), ///< Category "Home Menu" (6.0+)
|
||||
FSACCESS_SEEDDB = BIT(21), ///< Seed DB (9.6+)
|
||||
};
|
||||
|
||||
/// The resource limit category of a title
|
||||
typedef enum
|
||||
{
|
||||
RESLIMIT_CATEGORY_APPLICATION = 0, ///< Regular application
|
||||
RESLIMIT_CATEGORY_SYS_APPLET = 1, ///< System applet
|
||||
RESLIMIT_CATEGORY_LIB_APPLET = 2, ///< Library applet
|
||||
RESLIMIT_CATEGORY_OTHER = 3, ///< System modules running inside the BASE memregion
|
||||
} ResourceLimitCategory;
|
||||
|
||||
/// The system mode a title should be launched under
|
||||
typedef enum
|
||||
{
|
||||
SYSMODE_O3DS_PROD = 0, ///< 64MB of usable application memory
|
||||
SYSMODE_N3DS_PROD = 1, ///< 124MB of usable application memory. Unusable on O3DS
|
||||
SYSMODE_DEV1 = 2, ///< 97MB/178MB of usable application memory
|
||||
SYSMODE_DEV2 = 3, ///< 80MB/124MB of usable application memory
|
||||
SYSMODE_DEV3 = 4, ///< 72MB of usable application memory. Same as "Prod" on N3DS
|
||||
SYSMODE_DEV4 = 5, ///< 32MB of usable application memory. Same as "Prod" on N3DS
|
||||
} SystemMode;
|
||||
|
||||
|
||||
/// The system info flags and remaster version of a title
|
||||
typedef struct
|
||||
{
|
||||
u8 reserved[5]; ///< Reserved
|
||||
bool compress_exefs_code : 1; ///< Whether the ExeFS's .code section is compressed
|
||||
bool is_sd_application : 1; ///< Whether the title is meant to be used on an SD card
|
||||
u16 remaster_version; ///< Remaster version
|
||||
} ExHeader_SystemInfoFlags;
|
||||
|
||||
/// Information about a title's section
|
||||
typedef struct
|
||||
{
|
||||
u32 address; ///< The address of the section
|
||||
u32 num_pages; ///< The number of pages the section occupies
|
||||
u32 size; ///< The size of the section
|
||||
} ExHeader_CodeSectionInfo;
|
||||
|
||||
/// The name of a title and infomation about its section
|
||||
typedef struct
|
||||
{
|
||||
char name[8]; ///< Title name
|
||||
ExHeader_SystemInfoFlags flags; ///< System info flags, see @ref ExHeader_SystemInfoFlags
|
||||
ExHeader_CodeSectionInfo text; ///< .text section info, see @ref ExHeader_CodeSectionInfo
|
||||
u32 stack_size; ///< Stack size
|
||||
ExHeader_CodeSectionInfo rodata; ///< .rodata section info, see @ref ExHeader_CodeSectionInfo
|
||||
u32 reserved; ///< Reserved
|
||||
ExHeader_CodeSectionInfo data; ///< .data section info, see @ref ExHeader_CodeSectionInfo
|
||||
u32 bss_size; ///< .bss section size
|
||||
} ExHeader_CodeSetInfo;
|
||||
|
||||
/// The savedata size and jump ID of a title
|
||||
typedef struct
|
||||
{
|
||||
u64 savedata_size; ///< Savedata size
|
||||
u64 jump_id; ///< Jump ID
|
||||
u8 reserved[0x30]; ///< Reserved
|
||||
} ExHeader_SystemInfo;
|
||||
|
||||
/// The code set info, dependencies and system info of a title (SCI)
|
||||
typedef struct
|
||||
{
|
||||
ExHeader_CodeSetInfo codeset_info; ///< Code set info, see @ref ExHeader_CodeSetInfo
|
||||
u64 dependencies[48]; ///< Title IDs of the titles that this program depends on
|
||||
ExHeader_SystemInfo system_info; ///< System info, see @ref ExHeader_SystemInfo
|
||||
} ExHeader_SystemControlInfo;
|
||||
|
||||
/// The ARM11 filesystem info of a title
|
||||
typedef struct
|
||||
{
|
||||
u64 extdata_id; ///< Extdata ID
|
||||
u32 system_savedata_ids[2]; ///< IDs of the system savedata accessible by the title
|
||||
u64 accessible_savedata_ids; ///< IDs of the savedata accessible by the title, 20 bits each, followed by "Use other variation savedata"
|
||||
u32 fs_access_info; ///< FS access flags
|
||||
u32 reserved : 24; ///< Reserved
|
||||
bool no_romfs : 1; ///< Don't use any RomFS
|
||||
bool use_extended_savedata_access : 1; ///< Use the "extdata_id" field to store 3 additional accessible savedata IDs
|
||||
} ExHeader_Arm11StorageInfo;
|
||||
|
||||
/// The CPU-related and memory-layout-related info of a title
|
||||
typedef struct
|
||||
{
|
||||
u32 core_version; ///< The low title ID of the target firmware
|
||||
bool use_cpu_clockrate_804MHz : 1; ///< Whether to start the title with the 804MHz clock rate
|
||||
bool enable_l2c : 1; ///< Whether to start the title with the L2C-310 enabled enabled
|
||||
u8 flag1_unused : 6; ///< Unused
|
||||
SystemMode n3ds_system_mode : 4; ///< The system mode to use on N3DS
|
||||
u8 flag2_unused : 4; ///< Unused
|
||||
u8 ideal_processor : 2; ///< The ideal processor to start the title on
|
||||
u8 affinity_mask : 2; ///< The affinity mask of the title
|
||||
SystemMode o3ds_system_mode : 4; ///< The system mode to use on N3DS
|
||||
u8 priority; ///< The priority of the title's main thread
|
||||
} ExHeader_Arm11CoreInfo;
|
||||
|
||||
/// The ARM11 system-local capabilities of a title
|
||||
typedef struct
|
||||
{
|
||||
u64 title_id; ///< Title ID
|
||||
ExHeader_Arm11CoreInfo core_info; ///< Core info, see @ref ExHeader_Arm11CoreInfo
|
||||
u16 reslimits[16]; ///< Resource limit descriptors, only "CpuTime" (first byte) sems to be used
|
||||
ExHeader_Arm11StorageInfo storage_info; ///< Storage info, see @ref ExHeader_Arm11StorageInfo
|
||||
char service_access[34][8]; ///< List of the services the title has access to. Limited to 32 prior to system version 9.3
|
||||
u8 reserved[15]; ///< Reserved
|
||||
ResourceLimitCategory reslimit_category; ///< Resource limit category, see @ref ExHeader_Arm11SystemLocalCapabilities
|
||||
} ExHeader_Arm11SystemLocalCapabilities;
|
||||
|
||||
/// The ARM11 kernel capabilities of a title
|
||||
typedef struct
|
||||
{
|
||||
u32 descriptors[28]; ///< ARM11 kernel descriptors, see 3dbrew
|
||||
u8 reserved[16]; ///< Reserved
|
||||
} ExHeader_Arm11KernelCapabilities;
|
||||
|
||||
/// The ARM9 access control of a title
|
||||
typedef struct
|
||||
{
|
||||
u8 descriptors[15]; ///< Process9 FS descriptors, see 3dbrew
|
||||
u8 descriptor_version; ///< Descriptor version
|
||||
} ExHeader_Arm9AccessControl;
|
||||
|
||||
/// The access control information of a title
|
||||
typedef struct
|
||||
{
|
||||
ExHeader_Arm11SystemLocalCapabilities local_caps; ///< ARM11 system-local capabilities, see @ref ExHeader_Arm11SystemLocalCapabilities
|
||||
ExHeader_Arm11KernelCapabilities kernel_caps; ///< ARM11 kernel capabilities, see @ref ExHeader_Arm11SystemLocalCapabilities
|
||||
ExHeader_Arm9AccessControl access_control; ///< ARM9 access control, see @ref ExHeader_Arm9AccessControl
|
||||
} ExHeader_AccessControlInfo;
|
||||
|
||||
/// Main extended header data, as returned by PXIPM, Loader and FSREG service commands
|
||||
typedef struct
|
||||
{
|
||||
ExHeader_SystemControlInfo sci; ///< System control info, see @ref ExHeader_SystemControlInfo
|
||||
ExHeader_AccessControlInfo aci; ///< Access control info, see @ref ExHeader_AccessControlInfo
|
||||
} ExHeader_Info;
|
||||
|
||||
/// Extended header access descriptor
|
||||
typedef struct
|
||||
{
|
||||
u8 signature[0x100]; ///< The signature of the access descriptor (RSA-2048-SHA256)
|
||||
u8 ncchModulus[0x100]; ///< The modulus used for the above signature, with 65537 as public exponent
|
||||
ExHeader_AccessControlInfo acli; ///< This is compared for equality with the first ACI by Process9, see @ref ExHeader_AccessControlInfo
|
||||
} ExHeader_AccessDescriptor;
|
||||
|
||||
/// The NCCH Extended Header of a title
|
||||
typedef struct
|
||||
{
|
||||
ExHeader_Info info; ///< Main extended header data, see @ref ExHeader_Info
|
||||
ExHeader_AccessDescriptor access_descriptor; ///< Access descriptor, see @ref ExHeader_AccessDescriptor
|
||||
} ExHeader;
|
@ -1,236 +0,0 @@
|
||||
/**
|
||||
* @file font.h
|
||||
* @brief Shared font support.
|
||||
*/
|
||||
#pragma once
|
||||
#include <3ds/types.h>
|
||||
|
||||
///@name Data types
|
||||
///@{
|
||||
|
||||
/// Character width information structure.
|
||||
typedef struct
|
||||
{
|
||||
s8 left; ///< Horizontal offset to draw the glyph with.
|
||||
u8 glyphWidth; ///< Width of the glyph.
|
||||
u8 charWidth; ///< Width of the character, that is, horizontal distance to advance.
|
||||
} charWidthInfo_s;
|
||||
|
||||
/// Font texture sheet information.
|
||||
typedef struct
|
||||
{
|
||||
u8 cellWidth; ///< Width of a glyph cell.
|
||||
u8 cellHeight; ///< Height of a glyph cell.
|
||||
u8 baselinePos; ///< Vertical position of the baseline.
|
||||
u8 maxCharWidth; ///< Maximum character width.
|
||||
|
||||
u32 sheetSize; ///< Size in bytes of a texture sheet.
|
||||
u16 nSheets; ///< Number of texture sheets.
|
||||
u16 sheetFmt; ///< GPU texture format (GPU_TEXCOLOR).
|
||||
|
||||
u16 nRows; ///< Number of glyphs per row per sheet.
|
||||
u16 nLines; ///< Number of glyph rows per sheet.
|
||||
|
||||
u16 sheetWidth; ///< Texture sheet width.
|
||||
u16 sheetHeight; ///< Texture sheet height.
|
||||
u8* sheetData; ///< Pointer to texture sheet data.
|
||||
} TGLP_s;
|
||||
|
||||
/// Font character width information block type.
|
||||
typedef struct tag_CWDH_s CWDH_s;
|
||||
|
||||
/// Font character width information block structure.
|
||||
struct tag_CWDH_s
|
||||
{
|
||||
u16 startIndex; ///< First Unicode codepoint the block applies to.
|
||||
u16 endIndex; ///< Last Unicode codepoint the block applies to.
|
||||
CWDH_s* next; ///< Pointer to the next block.
|
||||
|
||||
charWidthInfo_s widths[0]; ///< Table of character width information structures.
|
||||
};
|
||||
|
||||
/// Font character map methods.
|
||||
enum
|
||||
{
|
||||
CMAP_TYPE_DIRECT = 0, ///< Identity mapping.
|
||||
CMAP_TYPE_TABLE = 1, ///< Mapping using a table.
|
||||
CMAP_TYPE_SCAN = 2, ///< Mapping using a list of mapped characters.
|
||||
};
|
||||
|
||||
/// Font character map type.
|
||||
typedef struct tag_CMAP_s CMAP_s;
|
||||
|
||||
/// Font character map structure.
|
||||
struct tag_CMAP_s
|
||||
{
|
||||
u16 codeBegin; ///< First Unicode codepoint the block applies to.
|
||||
u16 codeEnd; ///< Last Unicode codepoint the block applies to.
|
||||
u16 mappingMethod; ///< Mapping method.
|
||||
u16 reserved;
|
||||
CMAP_s* next; ///< Pointer to the next map.
|
||||
|
||||
union
|
||||
{
|
||||
u16 indexOffset; ///< For CMAP_TYPE_DIRECT: index of the first glyph.
|
||||
u16 indexTable[0]; ///< For CMAP_TYPE_TABLE: table of glyph indices.
|
||||
/// For CMAP_TYPE_SCAN: Mapping data.
|
||||
struct
|
||||
{
|
||||
u16 nScanEntries; ///< Number of pairs.
|
||||
/// Mapping pairs.
|
||||
struct
|
||||
{
|
||||
u16 code; ///< Unicode codepoint.
|
||||
u16 glyphIndex; ///< Mapped glyph index.
|
||||
} scanEntries[0];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/// Font information structure.
|
||||
typedef struct
|
||||
{
|
||||
u32 signature; ///< Signature (FINF).
|
||||
u32 sectionSize; ///< Section size.
|
||||
|
||||
u8 fontType; ///< Font type
|
||||
u8 lineFeed; ///< Line feed vertical distance.
|
||||
u16 alterCharIndex; ///< Glyph index of the replacement character.
|
||||
charWidthInfo_s defaultWidth; ///< Default character width information.
|
||||
u8 encoding; ///< Font encoding (?)
|
||||
|
||||
TGLP_s* tglp; ///< Pointer to texture sheet information.
|
||||
CWDH_s* cwdh; ///< Pointer to the first character width information block.
|
||||
CMAP_s* cmap; ///< Pointer to the first character map.
|
||||
|
||||
u8 height; ///< Font height.
|
||||
u8 width; ///< Font width.
|
||||
u8 ascent; ///< Font ascent.
|
||||
u8 padding;
|
||||
} FINF_s;
|
||||
|
||||
/// Font structure.
|
||||
typedef struct
|
||||
{
|
||||
u32 signature; ///< Signature (CFNU).
|
||||
u16 endianness; ///< Endianness constant (0xFEFF).
|
||||
u16 headerSize; ///< Header size.
|
||||
u32 version; ///< Format version.
|
||||
u32 fileSize; ///< File size.
|
||||
u32 nBlocks; ///< Number of blocks.
|
||||
|
||||
FINF_s finf; ///< Font information.
|
||||
} CFNT_s;
|
||||
|
||||
/// Font glyph position structure.
|
||||
typedef struct
|
||||
{
|
||||
int sheetIndex; ///< Texture sheet index to use to render the glyph.
|
||||
float xOffset; ///< Horizontal offset to draw the glyph width.
|
||||
float xAdvance; ///< Horizontal distance to advance after drawing the glyph.
|
||||
float width; ///< Glyph width.
|
||||
/// Texture coordinates to use to render the glyph.
|
||||
struct
|
||||
{
|
||||
float left, top, right, bottom;
|
||||
} texcoord;
|
||||
/// Vertex coordinates to use to render the glyph.
|
||||
struct
|
||||
{
|
||||
float left, top, right, bottom;
|
||||
} vtxcoord;
|
||||
} fontGlyphPos_s;
|
||||
|
||||
/// Flags for use with fontCalcGlyphPos.
|
||||
enum
|
||||
{
|
||||
GLYPH_POS_CALC_VTXCOORD = BIT(0), ///< Calculates vertex coordinates in addition to texture coordinates.
|
||||
GLYPH_POS_AT_BASELINE = BIT(1), ///< Position the glyph at the baseline instead of at the top-left corner.
|
||||
GLYPH_POS_Y_POINTS_UP = BIT(2), ///< Indicates that the Y axis points up instead of down.
|
||||
};
|
||||
|
||||
///@}
|
||||
|
||||
///@name Initialization and basic operations
|
||||
///@{
|
||||
|
||||
/// Ensures the shared system font is mapped.
|
||||
Result fontEnsureMapped(void);
|
||||
|
||||
/**
|
||||
* @brief Fixes the pointers internal to a just-loaded font
|
||||
* @param font Font to fix
|
||||
* @remark Should never be run on the system font, and only once on any other font.
|
||||
*/
|
||||
void fontFixPointers(CFNT_s* font);
|
||||
|
||||
/// Gets the currently loaded system font
|
||||
static inline CFNT_s* fontGetSystemFont(void)
|
||||
{
|
||||
extern CFNT_s* g_sharedFont;
|
||||
if (!g_sharedFont)
|
||||
fontEnsureMapped();
|
||||
return g_sharedFont;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the font information structure of a font.
|
||||
* @param font Pointer to font structure. If NULL, the shared system font is used.
|
||||
*/
|
||||
static inline FINF_s* fontGetInfo(CFNT_s* font)
|
||||
{
|
||||
if (!font)
|
||||
font = fontGetSystemFont();
|
||||
return &font->finf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the texture sheet information of a font.
|
||||
* @param font Pointer to font structure. If NULL, the shared system font is used.
|
||||
*/
|
||||
static inline TGLP_s* fontGetGlyphInfo(CFNT_s* font)
|
||||
{
|
||||
if (!font)
|
||||
font = fontGetSystemFont();
|
||||
return fontGetInfo(font)->tglp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the pointer to texture data for the specified texture sheet.
|
||||
* @param font Pointer to font structure. If NULL, the shared system font is used.
|
||||
* @param sheetIndex Index of the texture sheet.
|
||||
*/
|
||||
static inline void* fontGetGlyphSheetTex(CFNT_s* font, int sheetIndex)
|
||||
{
|
||||
if (!font)
|
||||
font = fontGetSystemFont();
|
||||
TGLP_s* tglp = fontGetGlyphInfo(font);
|
||||
return &tglp->sheetData[sheetIndex*tglp->sheetSize];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the glyph index of the specified Unicode codepoint.
|
||||
* @param font Pointer to font structure. If NULL, the shared system font is used.
|
||||
* @param codePoint Unicode codepoint.
|
||||
*/
|
||||
int fontGlyphIndexFromCodePoint(CFNT_s* font, u32 codePoint);
|
||||
|
||||
/**
|
||||
* @brief Retrieves character width information of the specified glyph.
|
||||
* @param font Pointer to font structure. If NULL, the shared system font is used.
|
||||
* @param glyphIndex Index of the glyph.
|
||||
*/
|
||||
charWidthInfo_s* fontGetCharWidthInfo(CFNT_s* font, int glyphIndex);
|
||||
|
||||
/**
|
||||
* @brief Calculates position information for the specified glyph.
|
||||
* @param out Output structure in which to write the information.
|
||||
* @param font Pointer to font structure. If NULL, the shared system font is used.
|
||||
* @param glyphIndex Index of the glyph.
|
||||
* @param flags Calculation flags (see GLYPH_POS_* flags).
|
||||
* @param scaleX Scale factor to apply horizontally.
|
||||
* @param scaleY Scale factor to apply vertically.
|
||||
*/
|
||||
void fontCalcGlyphPos(fontGlyphPos_s* out, CFNT_s* font, int glyphIndex, u32 flags, float scaleX, float scaleY);
|
||||
|
||||
///@}
|
@ -1,29 +0,0 @@
|
||||
/**
|
||||
* @file gdbhio.h
|
||||
* @brief Luma3DS GDB HIO (called File I/O in GDB documentation) functions.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define GDBHIO_STDIN_FILENO 0
|
||||
#define GDBHIO_STDOUT_FILENO 1
|
||||
#define GDBHIO_STDERR_FILENO 2
|
||||
|
||||
int gdbHioOpen(const char *pathname, int flags, mode_t mode);
|
||||
int gdbHioClose(int fd);
|
||||
int gdbHioRead(int fd, void *buf, unsigned int count);
|
||||
int gdbHioWrite(int fd, const void *buf, unsigned int count);
|
||||
off_t gdbHioLseek(int fd, off_t offset, int flag);
|
||||
int gdbHioRename(const char *oldpath, const char *newpath);
|
||||
int gdbHioUnlink(const char *pathname);
|
||||
int gdbHioStat(const char *pathname, struct stat *st);
|
||||
int gdbHioFstat(int fd, struct stat *st);
|
||||
int gdbHioGettimeofday(struct timeval *tv, void *tz);
|
||||
int gdbHioIsatty(int fd);
|
||||
|
||||
///< Host I/O 'system' function, requires 'set remote system-call-allowed 1'.
|
||||
int gdbHioSystem(const char *command);
|
@ -1,37 +0,0 @@
|
||||
/**
|
||||
* @file gdbhio_dev.h
|
||||
* @brief Luma3DS GDB HIO (called File I/O in GDB documentation) devoptab wrapper.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct timeval;
|
||||
|
||||
///< Initializes the GDB HIO devoptab wrapper, returns 0 on success, -1 on failure.
|
||||
int gdbHioDevInit(void);
|
||||
|
||||
///< Deinitializes the GDB HIO devoptab wrapper.
|
||||
void gdbHioDevExit(void);
|
||||
|
||||
///< Returns a file descriptor mapping to the GDB client console's standard input stream.
|
||||
int gdbHioDevGetStdin(void);
|
||||
|
||||
///< Returns a file descriptor mapping to the GDB client console's standard output stream.
|
||||
int gdbHioDevGetStdout(void);
|
||||
|
||||
///< Returns a file descriptor mapping to the GDB client console's standard error stream.
|
||||
int gdbHioDevGetStderr(void);
|
||||
|
||||
///< Redirects 0 to 3 of the application's standard streams to GDB client console's. Returns -1, -2, or -3, resp., on failure; 0 on success.
|
||||
int gdbHioDevRedirectStdStreams(bool in, bool out, bool err);
|
||||
|
||||
///< GDB HIO POSIX function gettimeofday.
|
||||
int gdbHioDevGettimeofday(struct timeval *tv, void *tz);
|
||||
|
||||
///< GDB HIO POSIX function isatty.
|
||||
int gdbHioDevIsatty(int fd);
|
||||
|
||||
///< GDB HIO POSIX function system. Requires 'set remote system-call-allowed 1'.
|
||||
int gdbHioDevSystem(const char *command);
|
@ -1,14 +1,9 @@
|
||||
/**
|
||||
* @file gfx.h
|
||||
* @brief Simple framebuffer API
|
||||
* @brief LCD Screens manipulation
|
||||
*
|
||||
* This API provides basic functionality needed to bring up framebuffers for both screens,
|
||||
* as well as managing display mode (stereoscopic 3D) and double buffering.
|
||||
* This header provides functions to configure and manipulate the two screens, including double buffering and 3D activation.
|
||||
* It is mainly an abstraction over the gsp service.
|
||||
*
|
||||
* Please note that the 3DS uses *portrait* screens rotated 90 degrees counterclockwise.
|
||||
* Width/height refer to the physical dimensions of the screen; that is, the top screen
|
||||
* is 240 pixels wide and 400 pixels tall; while the bottom screen is 240x320.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@ -21,29 +16,36 @@
|
||||
/// Converts packed RGB8 to packed RGB565.
|
||||
#define RGB8_to_565(r,g,b) (((b)>>3)&0x1f)|((((g)>>2)&0x3f)<<5)|((((r)>>3)&0x1f)<<11)
|
||||
|
||||
/// Screen IDs.
|
||||
typedef enum {
|
||||
GFX_TOP = GSP_SCREEN_TOP, ///< Top screen
|
||||
GFX_BOTTOM = GSP_SCREEN_BOTTOM, ///< Bottom screen
|
||||
} gfxScreen_t;
|
||||
/// Available screens.
|
||||
typedef enum
|
||||
{
|
||||
GFX_TOP = 0, ///< Top screen
|
||||
GFX_BOTTOM = 1 ///< Bottom screen
|
||||
}gfxScreen_t;
|
||||
|
||||
/**
|
||||
* @brief Top screen framebuffer side.
|
||||
* @brief Side of top screen framebuffer.
|
||||
*
|
||||
* This is only meaningful when stereoscopic 3D is enabled on the top screen.
|
||||
* In any other case, use \ref GFX_LEFT.
|
||||
* This is to be used only when the 3D is enabled.
|
||||
* Use only GFX_LEFT if this concerns the bottom screen or if 3D is disabled.
|
||||
*/
|
||||
typedef enum {
|
||||
GFX_LEFT = 0, ///< Left eye framebuffer
|
||||
GFX_RIGHT = 1, ///< Right eye framebuffer
|
||||
} gfx3dSide_t;
|
||||
typedef enum
|
||||
{
|
||||
GFX_LEFT = 0, ///< Left eye framebuffer
|
||||
GFX_RIGHT = 1,///< Right eye framebuffer
|
||||
}gfx3dSide_t;
|
||||
|
||||
///@name Initialization and deinitialization
|
||||
|
||||
///@name System related
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Initializes the LCD framebuffers with default parameters
|
||||
* This is equivalent to calling: @code gfxInit(GSP_BGR8_OES,GSP_BGR8_OES,false); @endcode
|
||||
*
|
||||
* By default ctrulib will configure the LCD framebuffers with the @ref GSP_BGR8_OES format in linear memory.
|
||||
* This is the same as calling : @code gfxInit(GSP_BGR8_OES,GSP_BGR8_OES,false); @endcode
|
||||
*
|
||||
* @note You should always call @ref gfxExit once done to free the memory and services
|
||||
*/
|
||||
void gfxInitDefault(void);
|
||||
|
||||
@ -53,128 +55,117 @@ void gfxInitDefault(void);
|
||||
* @param bottomFormat The format of the bottom screen framebuffers.
|
||||
* @param vramBuffers Whether to allocate the framebuffers in VRAM.
|
||||
*
|
||||
* This function allocates memory for the framebuffers in the specified memory region.
|
||||
* Initially, stereoscopic 3D is disabled and double buffering is enabled.
|
||||
* This function will allocate the memory for the framebuffers and open a gsp service session.
|
||||
* It will also bind the newly allocated framebuffers to the LCD screen and setup the VBlank event.
|
||||
*
|
||||
* @note This function internally calls \ref gspInit.
|
||||
* The 3D stereoscopic display is will be disabled.
|
||||
*
|
||||
* @note Even if the double buffering is disabled, it will allocate two buffer per screen.
|
||||
* @note You should always call @ref gfxExit once done to free the memory and services
|
||||
*/
|
||||
void gfxInit(GSPGPU_FramebufferFormat topFormat, GSPGPU_FramebufferFormat bottomFormat, bool vrambuffers);
|
||||
void gfxInit(GSPGPU_FramebufferFormats topFormat, GSPGPU_FramebufferFormats bottomFormat, bool vrambuffers);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes and frees the LCD framebuffers.
|
||||
* @note This function internally calls \ref gspExit.
|
||||
* @brief Closes the gsp service and frees the framebuffers.
|
||||
*
|
||||
* Just call it when you're done.
|
||||
*/
|
||||
void gfxExit(void);
|
||||
|
||||
///@}
|
||||
|
||||
///@name Control
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the 3D stereoscopic effect on the top screen.
|
||||
* @param enable Pass true to enable, false to disable.
|
||||
* @note Stereoscopic 3D is disabled by default.
|
||||
* @brief Enables the 3D stereoscopic effect.
|
||||
* @param enable Enables the 3D effect if true, disables it if false.
|
||||
*/
|
||||
void gfxSet3D(bool enable);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the status of the 3D stereoscopic effect on the top screen.
|
||||
* @brief Retrieves the status of the 3D stereoscopic effect.
|
||||
* @return true if 3D enabled, false otherwise.
|
||||
*/
|
||||
bool gfxIs3D(void);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the status of the 800px (double-height) high resolution display mode of the top screen.
|
||||
* @return true if wide mode enabled, false otherwise.
|
||||
* @brief Changes the color format of a screen
|
||||
* @param screen The screen of which format should be changed
|
||||
* @param format One of the gsp pixel formats.
|
||||
*/
|
||||
bool gfxIsWide(void);
|
||||
void gfxSetScreenFormat(gfxScreen_t screen, GSPGPU_FramebufferFormats format);
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the 800px (double-height) high resolution display mode of the top screen.
|
||||
* @param enable Pass true to enable, false to disable.
|
||||
* @note Wide mode is disabled by default.
|
||||
* @note Wide and stereoscopic 3D modes are mutually exclusive.
|
||||
* @note In wide mode pixels are not square, since scanlines are half as tall as they normally are.
|
||||
* @warning Wide mode does not work on Old 2DS consoles (however it does work on New 2DS XL consoles).
|
||||
* @brief Gets a screen pixel format.
|
||||
* @param screen Screen to get the pixel format of.
|
||||
* @return the pixel format of the chosen screen set by ctrulib.
|
||||
*/
|
||||
void gfxSetWide(bool enable);
|
||||
GSPGPU_FramebufferFormats gfxGetScreenFormat(gfxScreen_t screen);
|
||||
|
||||
/**
|
||||
* @brief Changes the pixel format of a screen.
|
||||
* @param screen Screen ID (see \ref gfxScreen_t)
|
||||
* @param format Pixel format (see \ref GSPGPU_FramebufferFormat)
|
||||
* @note If the currently allocated framebuffers are too small for the specified format,
|
||||
* they are freed and new ones are reallocated.
|
||||
*/
|
||||
void gfxSetScreenFormat(gfxScreen_t screen, GSPGPU_FramebufferFormat format);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the current pixel format of a screen.
|
||||
* @param screen Screen ID (see \ref gfxScreen_t)
|
||||
* @return Pixel format (see \ref GSPGPU_FramebufferFormat)
|
||||
*/
|
||||
GSPGPU_FramebufferFormat gfxGetScreenFormat(gfxScreen_t screen);
|
||||
|
||||
/**
|
||||
* @brief Enables or disables double buffering on a screen.
|
||||
* @param screen Screen ID (see \ref gfxScreen_t)
|
||||
* @param enable Pass true to enable, false to disable.
|
||||
* @note Double buffering is enabled by default.
|
||||
*/
|
||||
void gfxSetDoubleBuffering(gfxScreen_t screen, bool enable);
|
||||
|
||||
///@}
|
||||
|
||||
///@name Rendering and presentation
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Retrieves the framebuffer of the specified screen to which graphics should be rendered.
|
||||
* @param screen Screen ID (see \ref gfxScreen_t)
|
||||
* @param side Framebuffer side (see \ref gfx3dSide_t) (pass \ref GFX_LEFT if not using stereoscopic 3D)
|
||||
* @param width Pointer that will hold the width of the framebuffer in pixels.
|
||||
* @param height Pointer that will hold the height of the framebuffer in pixels.
|
||||
* @return A pointer to the current framebuffer of the chosen screen.
|
||||
* @brief Sets whether to use ctrulib's double buffering
|
||||
* @param screen Screen to toggle double buffering for.
|
||||
* @param doubleBuffering Whether to use double buffering.
|
||||
*
|
||||
* Please remember that the returned pointer will change every frame if double buffering is enabled.
|
||||
* ctrulib is by default using a double buffering scheme.
|
||||
* If you do not want to swap one of the screen framebuffers when @ref gfxSwapBuffers or @ref gfxSwapBuffers is called,
|
||||
* then you have to disable double buffering.
|
||||
*
|
||||
* It is however recommended to call @ref gfxSwapBuffers even if double buffering is disabled
|
||||
* for both screens if you want to keep the gsp configuration up to date.
|
||||
*/
|
||||
u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* height);
|
||||
void gfxSetDoubleBuffering(gfxScreen_t screen, bool doubleBuffering);
|
||||
|
||||
/**
|
||||
* @brief Flushes the data cache for the current framebuffers.
|
||||
* @warning This is **only used during software rendering**. Since this function has significant overhead,
|
||||
* it is preferred to call this only once per frame, after all software rendering is completed.
|
||||
* @brief Flushes the current framebuffers
|
||||
*
|
||||
* Use this if the data within your framebuffers changes a lot and that you want to make sure everything was updated correctly.
|
||||
* This shouldn't be needed and has a significant overhead.
|
||||
*/
|
||||
void gfxFlushBuffers(void);
|
||||
|
||||
/**
|
||||
* @brief Updates the configuration of the specified screen, swapping the buffers if double buffering is enabled.
|
||||
* @param scr Screen ID (see \ref gfxScreen_t)
|
||||
* @param hasStereo For the top screen in 3D mode: true if the framebuffer contains individual images
|
||||
* for both eyes, or false if the left image should be duplicated to the right eye.
|
||||
* @note Previously rendered content will be displayed on the screen after the next VBlank.
|
||||
* @note This function is still useful even if double buffering is disabled, as it must be used to commit configuration changes.
|
||||
* @warning Only call this once per screen per frame, otherwise graphical glitches will occur
|
||||
* since this API does not implement triple buffering.
|
||||
* @brief Updates the configuration of the specified screen (swapping the buffers if double-buffering is enabled).
|
||||
* @param scr Screen to configure.
|
||||
* @param immediate Whether to apply the updated configuration immediately or let GSPGPU apply it after the next GX transfer completes.
|
||||
*/
|
||||
void gfxScreenSwapBuffers(gfxScreen_t scr, bool hasStereo);
|
||||
void gfxConfigScreen(gfxScreen_t scr, bool immediate);
|
||||
|
||||
/**
|
||||
* @brief Same as \ref gfxScreenSwapBuffers, but with hasStereo set to true.
|
||||
* @param scr Screen ID (see \ref gfxScreen_t)
|
||||
* @param immediate This parameter no longer has any effect and is thus ignored.
|
||||
* @deprecated This function has been superseded by \ref gfxScreenSwapBuffers, please use that instead.
|
||||
*/
|
||||
CTR_DEPRECATED void gfxConfigScreen(gfxScreen_t scr, bool immediate);
|
||||
|
||||
/**
|
||||
* @brief Updates the configuration of both screens.
|
||||
* @note This function is equivalent to: \code gfxScreenSwapBuffers(GFX_TOP,true); gfxScreenSwapBuffers(GFX_BOTTOM,true); \endcode
|
||||
* @brief Swaps the buffers and sets the gsp state
|
||||
*
|
||||
* This is to be called to update the gsp state and swap the framebuffers.
|
||||
* LCD rendering should start as soon as the gsp state is set.
|
||||
* When using the GPU, call @ref gfxSwapBuffers instead.
|
||||
*/
|
||||
void gfxSwapBuffers(void);
|
||||
|
||||
/// Same as \ref gfxSwapBuffers (formerly different).
|
||||
/**
|
||||
* @brief Swaps the framebuffers
|
||||
*
|
||||
* This is the version to be used with the GPU since the GPU will use the gsp shared memory,
|
||||
* so the gsp state mustn't be set directly by the user.
|
||||
*/
|
||||
void gfxSwapBuffersGpu(void);
|
||||
|
||||
///@}
|
||||
|
||||
|
||||
///@name Helper
|
||||
///@{
|
||||
/**
|
||||
* @brief Retrieves a framebuffer information.
|
||||
* @param screen Screen to retrieve framebuffer information for.
|
||||
* @param side Side of the screen to retrieve framebuffer information for.
|
||||
* @param width Pointer that will hold the width of the framebuffer in pixels.
|
||||
* @param height Pointer that will hold the height of the framebuffer in pixels.
|
||||
* @return A pointer to the current framebuffer of the choosen screen.
|
||||
*
|
||||
* Please remember that the returned pointer will change after each call to gfxSwapBuffers if double buffering is enabled.
|
||||
*/
|
||||
u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* height);
|
||||
///@}
|
||||
|
||||
//global variables
|
||||
extern u8* gfxTopLeftFramebuffers[2];
|
||||
extern u8* gfxTopRightFramebuffers[2];
|
||||
extern u8* gfxBottomFramebuffers[2];
|
||||
|
@ -73,23 +73,10 @@ typedef enum
|
||||
GPU_A8 = 0x8, ///< 8-bit Alpha
|
||||
GPU_LA4 = 0x9, ///< 4-bit Luminance + 4-bit Alpha
|
||||
GPU_L4 = 0xA, ///< 4-bit Luminance
|
||||
GPU_A4 = 0xB, ///< 4-bit Alpha
|
||||
GPU_ETC1 = 0xC, ///< ETC1 texture compression
|
||||
GPU_ETC1A4 = 0xD, ///< ETC1 texture compression + 4-bit Alpha
|
||||
GPU_ETC1 = 0xB, ///< ETC1 texture compression
|
||||
GPU_ETC1A4 = 0xC, ///< ETC1 texture compression + 4-bit Alpha
|
||||
} GPU_TEXCOLOR;
|
||||
|
||||
/// Texture faces.
|
||||
typedef enum
|
||||
{
|
||||
GPU_TEXFACE_2D = 0, ///< 2D face
|
||||
GPU_POSITIVE_X = 0, ///< +X face
|
||||
GPU_NEGATIVE_X = 1, ///< -X face
|
||||
GPU_POSITIVE_Y = 2, ///< +Y face
|
||||
GPU_NEGATIVE_Y = 3, ///< -Y face
|
||||
GPU_POSITIVE_Z = 4, ///< +Z face
|
||||
GPU_NEGATIVE_Z = 5, ///< -Z face
|
||||
} GPU_TEXFACE;
|
||||
|
||||
/// Procedural texture clamp modes.
|
||||
typedef enum
|
||||
{
|
||||
@ -138,10 +125,10 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
GPU_LUT_NOISE = 0, ///< Noise table
|
||||
GPU_LUT_RGBMAP = 2, ///< RGB mapping function table
|
||||
GPU_LUT_ALPHAMAP = 3, ///< Alpha mapping function table
|
||||
GPU_LUT_COLOR = 4, ///< Color table
|
||||
GPU_LUT_COLORDIF = 5, ///< Color difference table
|
||||
GPU_LUT_RGBMAP = 1, ///< RGB mapping function table
|
||||
GPU_LUT_ALPHAMAP = 2, ///< Alpha mapping function table
|
||||
GPU_LUT_COLOR = 3, ///< Color table
|
||||
GPU_LUT_COLORDIF = 4, ///< Color difference table
|
||||
} GPU_PROCTEX_LUTID;
|
||||
|
||||
/// Supported color buffer formats.
|
||||
@ -184,18 +171,6 @@ typedef enum
|
||||
GPU_EARLYDEPTH_LESS = 3, ///< Pass if less than.
|
||||
} GPU_EARLYDEPTHFUNC;
|
||||
|
||||
/// Gas depth functions.
|
||||
typedef enum
|
||||
{
|
||||
GPU_GAS_NEVER = 0, ///< Never pass (0).
|
||||
GPU_GAS_ALWAYS = 1, ///< Always pass (1).
|
||||
GPU_GAS_GREATER = 2, ///< Pass if greater than (1-X).
|
||||
GPU_GAS_LESS = 3, ///< Pass if less than (X).
|
||||
} GPU_GASDEPTHFUNC;
|
||||
|
||||
/// Converts \ref GPU_TESTFUNC into \ref GPU_GASDEPTHFUNC.
|
||||
#define GPU_MAKEGASDEPTHFUNC(n) (GPU_GASDEPTHFUNC)((0xAF02>>((int)(n)<<1))&3)
|
||||
|
||||
/// Scissor test modes.
|
||||
typedef enum
|
||||
{
|
||||
@ -226,7 +201,7 @@ typedef enum
|
||||
GPU_WRITE_BLUE = 0x04, ///< Write blue.
|
||||
GPU_WRITE_ALPHA = 0x08, ///< Write alpha.
|
||||
GPU_WRITE_DEPTH = 0x10, ///< Write depth.
|
||||
|
||||
|
||||
GPU_WRITE_COLOR = 0x0F, ///< Write all color components.
|
||||
GPU_WRITE_ALL = 0x1F, ///< Write all components.
|
||||
} GPU_WRITEMASK;
|
||||
@ -368,8 +343,7 @@ typedef enum
|
||||
GPU_ADD_SIGNED = 0x03, ///< Signed add.
|
||||
GPU_INTERPOLATE = 0x04, ///< Interpolate.
|
||||
GPU_SUBTRACT = 0x05, ///< Subtract.
|
||||
GPU_DOT3_RGB = 0x06, ///< Dot3. Scalar result is written to RGB only.
|
||||
GPU_DOT3_RGBA = 0x07, ///< Dot3. Scalar result is written to RGBA.
|
||||
GPU_DOT3_RGB = 0x06, ///< Dot3. RGB only.
|
||||
GPU_MULTIPLY_ADD = 0x08, ///< Multiply then add.
|
||||
GPU_ADD_MULTIPLY = 0x09, ///< Add then multiply.
|
||||
} GPU_COMBINEFUNC;
|
||||
@ -398,7 +372,7 @@ typedef enum
|
||||
/// Light distance attenuation disable bits in GPUREG_LIGHT_CONFIG1.
|
||||
#define GPU_LC1_ATTNBIT(n) BIT((n)+24)
|
||||
/// Creates a light permutation parameter.
|
||||
#define GPU_LIGHTPERM(i,n) ((n) << ((i)*4))
|
||||
#define GPU_LIGHTPERM(i,n) ((n) << (i))
|
||||
/// Creates a light LUT input parameter.
|
||||
#define GPU_LIGHTLUTINPUT(i,n) ((n) << ((i)*4))
|
||||
/// Creates a light LUT index parameter.
|
||||
@ -466,28 +440,6 @@ typedef enum
|
||||
GPU_LUTSELECT_DA = 2, ///< Distance attenuation LUT.
|
||||
} GPU_LIGHTLUTSELECT;
|
||||
|
||||
/// Fog modes.
|
||||
typedef enum
|
||||
{
|
||||
GPU_NO_FOG = 0, ///< Fog/Gas unit disabled.
|
||||
GPU_FOG = 5, ///< Fog/Gas unit configured in Fog mode.
|
||||
GPU_GAS = 7, ///< Fog/Gas unit configured in Gas mode.
|
||||
} GPU_FOGMODE;
|
||||
|
||||
/// Gas shading density source values.
|
||||
typedef enum
|
||||
{
|
||||
GPU_PLAIN_DENSITY = 0, ///< Plain density.
|
||||
GPU_DEPTH_DENSITY = 1, ///< Depth density.
|
||||
} GPU_GASMODE;
|
||||
|
||||
/// Gas color LUT inputs.
|
||||
typedef enum
|
||||
{
|
||||
GPU_GAS_DENSITY = 0, ///< Gas density used as input.
|
||||
GPU_GAS_LIGHT_FACTOR = 1, ///< Light factor used as input.
|
||||
} GPU_GASLUTINPUT;
|
||||
|
||||
/// Supported primitives.
|
||||
typedef enum
|
||||
{
|
||||
|
235
libctru/include/3ds/gpu/gpu-old.h
Normal file
235
libctru/include/3ds/gpu/gpu-old.h
Normal file
@ -0,0 +1,235 @@
|
||||
/**
|
||||
* @file gpu-old.h
|
||||
* @brief Deprecated GPU functions which should not be used in new code.
|
||||
* @description These functions have been superseeded by direct GPU register writes, or external GPU libraries.
|
||||
* @deprecated
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "gpu.h"
|
||||
|
||||
/**
|
||||
* @brief Initializes the GPU.
|
||||
* @param gsphandle GSP handle to use.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_Init(Handle *gsphandle) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Resets the GPU.
|
||||
* @param gxbuf GX command buffer to use.
|
||||
* @param gpuBuf GPU command buffer to use.
|
||||
* @param gpuBufSize GPU command buffer size.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_Reset(u32* gxbuf, u32* gpuBuf, u32 gpuBufSize) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets a shader float uniform.
|
||||
* @param type Type of shader to set the uniform of.
|
||||
* @param startreg Start of the uniform register to set.
|
||||
* @param data Data to set.
|
||||
* @param numreg Number of registers to set.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetFloatUniform(GPU_SHADER_TYPE type, u32 startreg, u32* data, u32 numreg) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the viewport.
|
||||
* @param depthBuffer Buffer to output depth data to.
|
||||
* @param colorBuffer Buffer to output color data to.
|
||||
* @param x X of the viewport.
|
||||
* @param y Y of the viewport.
|
||||
* @param w Width of the viewport.
|
||||
* @param h Height of the viewport.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the current scissor test mode.
|
||||
* @param mode Scissor test mode to use.
|
||||
* @param x X of the scissor region.
|
||||
* @param y Y of the scissor region.
|
||||
* @param w Width of the scissor region.
|
||||
* @param h Height of the scissor region.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetScissorTest(GPU_SCISSORMODE mode, u32 left, u32 bottom, u32 right, u32 top) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the depth map.
|
||||
* @param zScale Z scale to use.
|
||||
* @param zOffset Z offset to use.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_DepthMap(float zScale, float zOffset) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the alpha test parameters.
|
||||
* @param enable Whether to enable alpha testing.
|
||||
* @param function Test function to use.
|
||||
* @param ref Reference value to use.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetAlphaTest(bool enable, GPU_TESTFUNC function, u8 ref) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the depth test parameters and pixel write mask.
|
||||
* @note GPU_WRITEMASK values can be ORed together.
|
||||
* @param enable Whether to enable depth testing.
|
||||
* @param function Test function to use.
|
||||
* @param writemask Pixel write mask to use.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetDepthTestAndWriteMask(bool enable, GPU_TESTFUNC function, GPU_WRITEMASK writemask) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the stencil test parameters.
|
||||
* @param enable Whether to enable stencil testing.
|
||||
* @param function Test function to use.
|
||||
* @param ref Reference value to use.
|
||||
* @param input_mask Input mask to use.
|
||||
* @param write_mask Write mask to use.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetStencilTest(bool enable, GPU_TESTFUNC function, u8 ref, u8 input_mask, u8 write_mask) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the stencil test operators.
|
||||
* @param sfail Operator to use on source test failure.
|
||||
* @param dfail Operator to use on destination test failure.
|
||||
* @param pass Operator to use on test passing.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetStencilOp(GPU_STENCILOP sfail, GPU_STENCILOP dfail, GPU_STENCILOP pass) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the face culling mode.
|
||||
* @param mode Face culling mode to use.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetFaceCulling(GPU_CULLMODE mode) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the combiner buffer write parameters.
|
||||
* @note Use GPU_TEV_BUFFER_WRITE_CONFIG to build the parameters.
|
||||
* @note Only the first four TEV stages can write to the combiner buffer.
|
||||
* @param rgb_config RGB configuration to use.
|
||||
* @param alpha_config Alpha configuration to use.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetCombinerBufferWrite(u8 rgb_config, u8 alpha_config) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the alpha blending parameters.
|
||||
* @note Cannot be used with GPU_SetColorLogicOp.
|
||||
* @param colorEquation Blend equation to use for color components.
|
||||
* @param alphaEquation Blend equation to use for the alpha component.
|
||||
* @param colorSrc Source factor of color components.
|
||||
* @param colorDst Destination factor of color components.
|
||||
* @param alphaSrc Source factor of the alpha component.
|
||||
* @param alphaDst Destination factor of the alpha component.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetAlphaBlending(GPU_BLENDEQUATION colorEquation, GPU_BLENDEQUATION alphaEquation,
|
||||
GPU_BLENDFACTOR colorSrc, GPU_BLENDFACTOR colorDst,
|
||||
GPU_BLENDFACTOR alphaSrc, GPU_BLENDFACTOR alphaDst) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the color logic operator.
|
||||
* @note Cannot be used with GPU_SetAlphaBlending.
|
||||
* @param op Operator to set.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetColorLogicOp(GPU_LOGICOP op) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the blending color.
|
||||
* @param r Red component.
|
||||
* @param g Green component.
|
||||
* @param b Blue component.
|
||||
* @param a Alpha component.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetBlendingColor(u8 r, u8 g, u8 b, u8 a) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the VBO attribute buffers.
|
||||
* @param totalAttributes Total number of attributes.
|
||||
* @param baseAddress Base address of the VBO.
|
||||
* @param attributeFormats Attribute format data.
|
||||
* @param attributeMask Attribute mask.
|
||||
* @param attributePermutation Attribute permutations.
|
||||
* @param numBuffers Number of buffers.
|
||||
* @param bufferOffsets Offsets of the buffers.
|
||||
* @param bufferPermutations Buffer permutations.
|
||||
* @param bufferNumAttributes Numbers of attributes of the buffers.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetAttributeBuffers(u8 totalAttributes, u32* baseAddress, u64 attributeFormats, u16 attributeMask, u64 attributePermutation, u8 numBuffers, u32 bufferOffsets[], u64 bufferPermutations[], u8 bufferNumAttributes[]) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the enabled texture units.
|
||||
* @param units Units to enable. OR texture unit values together to create this value.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetTextureEnable(GPU_TEXUNIT units) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the texture data of a texture unit.
|
||||
* @param unit Texture unit to use.
|
||||
* @param data Data to load. Must be in linear memory or VRAM.
|
||||
* @param width Width of the texture.
|
||||
* @param height Height of the texture.
|
||||
* @param Parameters of the texture, such as filters and wrap modes.
|
||||
* @param colorType Color type of the texture.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetTexture(GPU_TEXUNIT unit, u32* data, u16 width, u16 height, u32 param, GPU_TEXCOLOR colorType) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the border color of a texture unit.
|
||||
* @param unit Texture unit to use.
|
||||
* @param borderColor The color used for the border when using the @ref GPU_CLAMP_TO_BORDER wrap mode.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetTextureBorderColor(GPU_TEXUNIT unit,u32 borderColor) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Sets the parameters of a texture combiner.
|
||||
* @param id ID of the combiner.
|
||||
* @param rgbSources RGB source configuration.
|
||||
* @param alphaSources Alpha source configuration.
|
||||
* @param rgbOperands RGB operand configuration.
|
||||
* @param alphaOperands Alpha operand configuration.
|
||||
* @param rgbCombine RGB combiner function.
|
||||
* @param alphaCombine Alpha combiner function.
|
||||
* @param constantColor Constant color to provide.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_SetTexEnv(u8 id, u16 rgbSources, u16 alphaSources, u16 rgbOperands, u16 alphaOperands, GPU_COMBINEFUNC rgbCombine, GPU_COMBINEFUNC alphaCombine, u32 constantColor) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Draws an array of vertex data.
|
||||
* @param primitive Primitive to draw.
|
||||
* @param first First vertex to draw.
|
||||
* @param count Number of vertices to draw.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Draws vertex elements.
|
||||
* @param primitive Primitive to draw.
|
||||
* @param indexArray Array of vertex indices to use.
|
||||
* @param n Number of vertices to draw.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_DrawElements(GPU_Primitive_t primitive, u32* indexArray, u32 n) DEPRECATED;
|
||||
|
||||
/**
|
||||
* @brief Finishes drawing.
|
||||
* @deprecated
|
||||
*/
|
||||
void GPU_FinishDrawing() DEPRECATED;
|
@ -20,41 +20,34 @@ extern u32 gpuCmdBufOffset; ///< GPU command buffer offset.
|
||||
* @param size Size of the command buffer.
|
||||
* @param offset Offset of the command buffer.
|
||||
*/
|
||||
static inline void GPUCMD_SetBuffer(u32* adr, u32 size, u32 offset)
|
||||
{
|
||||
gpuCmdBuf=adr;
|
||||
gpuCmdBufSize=size;
|
||||
gpuCmdBufOffset=offset;
|
||||
}
|
||||
void GPUCMD_SetBuffer(u32* adr, u32 size, u32 offset);
|
||||
|
||||
/**
|
||||
* @brief Sets the offset of the GPU command buffer.
|
||||
* @param offset Offset of the command buffer.
|
||||
*/
|
||||
static inline void GPUCMD_SetBufferOffset(u32 offset)
|
||||
{
|
||||
gpuCmdBufOffset=offset;
|
||||
}
|
||||
void GPUCMD_SetBufferOffset(u32 offset);
|
||||
|
||||
/**
|
||||
* @brief Gets the current GPU command buffer.
|
||||
* @param addr Pointer to output the command buffer to.
|
||||
* @param size Pointer to output the size (in words) of the command buffer to.
|
||||
* @param adr Pointer to output the command buffer to.
|
||||
* @param size Pointer to output the size of the command buffer to.
|
||||
* @param offset Pointer to output the offset of the command buffer to.
|
||||
*/
|
||||
static inline void GPUCMD_GetBuffer(u32** addr, u32* size, u32* offset)
|
||||
{
|
||||
if(addr)*addr=gpuCmdBuf;
|
||||
if(size)*size=gpuCmdBufSize;
|
||||
if(offset)*offset=gpuCmdBufOffset;
|
||||
}
|
||||
void GPUCMD_GetBuffer(u32** adr, u32* size, u32* offset);
|
||||
|
||||
/**
|
||||
* @brief Adds raw GPU commands to the current command buffer.
|
||||
* @param cmd Buffer containing commands to add.
|
||||
* @param size Size of the buffer.
|
||||
*/
|
||||
void GPUCMD_AddRawCommands(const u32* cmd, u32 size);
|
||||
void GPUCMD_AddRawCommands(u32* cmd, u32 size);
|
||||
|
||||
/// Executes the GPU command buffer.
|
||||
void GPUCMD_Run(void);
|
||||
|
||||
/// Flushes linear memory and executes the GPU command buffer.
|
||||
void GPUCMD_FlushAndRun(void);
|
||||
|
||||
/**
|
||||
* @brief Adds a GPU command to the current command buffer.
|
||||
@ -62,14 +55,10 @@ void GPUCMD_AddRawCommands(const u32* cmd, u32 size);
|
||||
* @param param Parameters of the command.
|
||||
* @param paramlength Size of the parameter buffer.
|
||||
*/
|
||||
void GPUCMD_Add(u32 header, const u32* param, u32 paramlength);
|
||||
void GPUCMD_Add(u32 header, u32* param, u32 paramlength);
|
||||
|
||||
/**
|
||||
* @brief Splits the current GPU command buffer.
|
||||
* @param addr Pointer to output the command buffer to.
|
||||
* @param size Pointer to output the size (in words) of the command buffer to.
|
||||
*/
|
||||
void GPUCMD_Split(u32** addr, u32* size);
|
||||
/// Finalizes the GPU command buffer.
|
||||
void GPUCMD_Finalize(void);
|
||||
|
||||
/**
|
||||
* @brief Converts a 32-bit float to a 16-bit float.
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/**
|
||||
* @brief Supported transfer pixel formats.
|
||||
* @sa GSPGPU_FramebufferFormat
|
||||
* @sa GSPGPU_FramebufferFormats
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
@ -60,87 +60,12 @@ typedef enum
|
||||
/// Creates a transfer scaling flag.
|
||||
#define GX_TRANSFER_SCALING(x) ((x)<<24)
|
||||
|
||||
/// Updates gas additive blend results.
|
||||
#define GX_CMDLIST_UPDATE_GAS_ACC BIT(0)
|
||||
/// Command list flag bit 0.
|
||||
#define GX_CMDLIST_BIT0 BIT(0)
|
||||
/// Flushes the command list.
|
||||
#define GX_CMDLIST_FLUSH BIT(1)
|
||||
#define GX_CMDLIST_FLUSH BIT(1)
|
||||
|
||||
/// GX command entry
|
||||
typedef union
|
||||
{
|
||||
u32 data[8]; ///< Raw command data
|
||||
struct
|
||||
{
|
||||
u8 type; ///< Command type
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u32 args[7]; ///< Command arguments
|
||||
};
|
||||
} gxCmdEntry_s;
|
||||
|
||||
/// GX command queue structure
|
||||
typedef struct tag_gxCmdQueue_s
|
||||
{
|
||||
gxCmdEntry_s* entries; ///< Pointer to array of GX command entries
|
||||
u16 maxEntries; ///< Capacity of the command array
|
||||
u16 numEntries; ///< Number of commands in the queue
|
||||
u16 curEntry; ///< Index of the first pending command to be submitted to GX
|
||||
u16 lastEntry; ///< Number of commands completed by GX
|
||||
void (* callback)(struct tag_gxCmdQueue_s*); ///< User callback
|
||||
void* user; ///< Data for user callback
|
||||
} gxCmdQueue_s;
|
||||
|
||||
/**
|
||||
* @brief Clears a GX command queue.
|
||||
* @param queue The GX command queue.
|
||||
*/
|
||||
void gxCmdQueueClear(gxCmdQueue_s* queue);
|
||||
|
||||
/**
|
||||
* @brief Adds a command to a GX command queue.
|
||||
* @param queue The GX command queue.
|
||||
* @param entry The GX command to add.
|
||||
*/
|
||||
void gxCmdQueueAdd(gxCmdQueue_s* queue, const gxCmdEntry_s* entry);
|
||||
|
||||
/**
|
||||
* @brief Runs a GX command queue, causing it to begin processing incoming commands as they arrive.
|
||||
* @param queue The GX command queue.
|
||||
*/
|
||||
void gxCmdQueueRun(gxCmdQueue_s* queue);
|
||||
|
||||
/**
|
||||
* @brief Stops a GX command queue from processing incoming commands.
|
||||
* @param queue The GX command queue.
|
||||
*/
|
||||
void gxCmdQueueStop(gxCmdQueue_s* queue);
|
||||
|
||||
/**
|
||||
* @brief Waits for a GX command queue to finish executing pending commands.
|
||||
* @param queue The GX command queue.
|
||||
* @param timeout Optional timeout (in nanoseconds) to wait (specify -1 for no timeout).
|
||||
* @return false if timeout expired, true otherwise.
|
||||
*/
|
||||
bool gxCmdQueueWait(gxCmdQueue_s* queue, s64 timeout);
|
||||
|
||||
/**
|
||||
* @brief Sets the completion callback for a GX command queue.
|
||||
* @param queue The GX command queue.
|
||||
* @param callback The completion callback.
|
||||
* @param user User data.
|
||||
*/
|
||||
static inline void gxCmdQueueSetCallback(gxCmdQueue_s* queue, void (* callback)(gxCmdQueue_s*), void* user)
|
||||
{
|
||||
queue->callback = callback;
|
||||
queue->user = user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Selects a command queue to which GX_* functions will add commands instead of immediately submitting them to GX.
|
||||
* @param queue The GX command queue. (Pass NULL to remove the bound command queue)
|
||||
*/
|
||||
void GX_BindQueue(gxCmdQueue_s* queue);
|
||||
extern u32* gxCmdBuf; ///< GX command buffer.
|
||||
|
||||
/**
|
||||
* @brief Requests a DMA.
|
||||
@ -195,7 +120,7 @@ Result GX_DisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 fl
|
||||
Result GX_TextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags);
|
||||
|
||||
/**
|
||||
* @brief Flushes the cache regions of three buffers. (This command cannot be queued in a GX command queue)
|
||||
* @brief Flushes the cache regions of three buffers.
|
||||
* @param buf0a Address of the first buffer.
|
||||
* @param buf0s Size of the first buffer.
|
||||
* @param buf1a Address of the second buffer.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,120 +1,137 @@
|
||||
/**
|
||||
* @file shaderProgram.h
|
||||
* @brief Functions for working with shaders.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/gpu/shbin.h>
|
||||
|
||||
/// 24-bit float uniforms.
|
||||
typedef struct
|
||||
{
|
||||
u32 id; ///< Uniform ID.
|
||||
u32 data[3]; ///< Uniform data.
|
||||
}float24Uniform_s;
|
||||
|
||||
/// Describes an instance of either a vertex or geometry shader.
|
||||
typedef struct
|
||||
{
|
||||
DVLE_s* dvle; ///< Shader DVLE.
|
||||
u16 boolUniforms; ///< Boolean uniforms.
|
||||
u16 boolUniformMask; ///< Used boolean uniform mask.
|
||||
u32 intUniforms[4]; ///< Integer uniforms.
|
||||
float24Uniform_s* float24Uniforms; ///< 24-bit float uniforms.
|
||||
u8 intUniformMask; ///< Used integer uniform mask.
|
||||
u8 numFloat24Uniforms; ///< Float uniform count.
|
||||
}shaderInstance_s;
|
||||
|
||||
/// Describes an instance of a full shader program.
|
||||
typedef struct
|
||||
{
|
||||
shaderInstance_s* vertexShader; ///< Vertex shader.
|
||||
shaderInstance_s* geometryShader; ///< Geometry shader.
|
||||
u32 geoShaderInputPermutation[2]; ///< Geometry shader input permutation.
|
||||
u8 geoShaderInputStride; ///< Geometry shader input stride.
|
||||
}shaderProgram_s;
|
||||
|
||||
/**
|
||||
* @brief Initializes a shader instance.
|
||||
* @param si Shader instance to initialize.
|
||||
* @param dvle DVLE to initialize the shader instance with.
|
||||
*/
|
||||
Result shaderInstanceInit(shaderInstance_s* si, DVLE_s* dvle);
|
||||
|
||||
/**
|
||||
* @brief Frees a shader instance.
|
||||
* @param si Shader instance to free.
|
||||
*/
|
||||
Result shaderInstanceFree(shaderInstance_s* si);
|
||||
|
||||
/**
|
||||
* @brief Sets a bool uniform of a shader.
|
||||
* @param si Shader instance to use.
|
||||
* @param id ID of the bool uniform.
|
||||
* @param value Value to set.
|
||||
*/
|
||||
Result shaderInstanceSetBool(shaderInstance_s* si, int id, bool value);
|
||||
|
||||
/**
|
||||
* @brief Gets a bool uniform of a shader.
|
||||
* @param si Shader instance to use.
|
||||
* @param id ID of the bool uniform.
|
||||
* @param value Pointer to output the value to.
|
||||
*/
|
||||
Result shaderInstanceGetBool(shaderInstance_s* si, int id, bool* value);
|
||||
|
||||
/**
|
||||
* @brief Gets the location of a shader's uniform.
|
||||
* @param si Shader instance to use.
|
||||
* @param name Name of the uniform.
|
||||
*/
|
||||
s8 shaderInstanceGetUniformLocation(shaderInstance_s* si, const char* name);
|
||||
|
||||
/**
|
||||
* @brief Initializes a shader program.
|
||||
* @param sp Shader program to initialize.
|
||||
*/
|
||||
Result shaderProgramInit(shaderProgram_s* sp);
|
||||
|
||||
/**
|
||||
* @brief Frees a shader program.
|
||||
* @param sp Shader program to free.
|
||||
*/
|
||||
Result shaderProgramFree(shaderProgram_s* sp);
|
||||
|
||||
/**
|
||||
* @brief Sets the vertex shader of a shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param dvle Vertex shader to set.
|
||||
*/
|
||||
Result shaderProgramSetVsh(shaderProgram_s* sp, DVLE_s* dvle);
|
||||
|
||||
/**
|
||||
* @brief Sets the geometry shader of a shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param dvle Geometry shader to set.
|
||||
* @param stride Input stride of the shader (pass 0 to match the number of outputs of the vertex shader).
|
||||
*/
|
||||
Result shaderProgramSetGsh(shaderProgram_s* sp, DVLE_s* dvle, u8 stride);
|
||||
|
||||
/**
|
||||
* @brief Configures the permutation of the input attributes of the geometry shader of a shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param permutation Attribute permutation to use.
|
||||
*/
|
||||
Result shaderProgramSetGshInputPermutation(shaderProgram_s* sp, u64 permutation);
|
||||
|
||||
/**
|
||||
* @brief Configures the shader units to use the specified shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param sendVshCode When true, the vertex shader's code and operand descriptors are uploaded.
|
||||
* @param sendGshCode When true, the geometry shader's code and operand descriptors are uploaded.
|
||||
*/
|
||||
Result shaderProgramConfigure(shaderProgram_s* sp, bool sendVshCode, bool sendGshCode);
|
||||
|
||||
/**
|
||||
* @brief Same as shaderProgramConfigure, but always loading code/operand descriptors and uploading DVLE constants afterwards.
|
||||
* @param sp Shader program to use.
|
||||
*/
|
||||
Result shaderProgramUse(shaderProgram_s* sp);
|
||||
/**
|
||||
* @file shaderProgram.h
|
||||
* @brief Functions for working with shaders.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/gpu/shbin.h>
|
||||
|
||||
/// 24-bit float uniforms.
|
||||
typedef struct
|
||||
{
|
||||
u32 id; ///< Uniform ID.
|
||||
u32 data[3]; ///< Uniform data.
|
||||
}float24Uniform_s;
|
||||
|
||||
/// Describes an instance of either a vertex or geometry shader.
|
||||
typedef struct
|
||||
{
|
||||
DVLE_s* dvle; ///< Shader DVLE.
|
||||
u16 boolUniforms; ///< Boolean uniforms.
|
||||
u16 boolUniformMask; ///< Used boolean uniform mask.
|
||||
u32 intUniforms[4]; ///< Integer uniforms.
|
||||
float24Uniform_s* float24Uniforms; ///< 24-bit float uniforms.
|
||||
u8 intUniformMask; ///< Used integer uniform mask.
|
||||
u8 numFloat24Uniforms; ///< Float uniform count.
|
||||
}shaderInstance_s;
|
||||
|
||||
/// Describes an instance of a full shader program.
|
||||
typedef struct
|
||||
{
|
||||
shaderInstance_s* vertexShader; ///< Vertex shader.
|
||||
shaderInstance_s* geometryShader; ///< Geometry shader.
|
||||
u32 geoShaderInputPermutation[2]; ///< Geometry shader input permutation.
|
||||
u8 geoShaderInputStride; ///< Geometry shader input stride.
|
||||
u8 geoShaderMode; ///< Geometry shader operation mode.
|
||||
}shaderProgram_s;
|
||||
|
||||
/// Geometry shader operation modes.
|
||||
typedef enum
|
||||
{
|
||||
GSH_NORMAL = 0, ///< Normal operation.
|
||||
GSH_PARTICLE = 1, ///< Particle system.
|
||||
GSH_SUBDIVISION_LOOP = 2, ///< Loop subdivision surface.
|
||||
GSH_SUBDIVISION_CATMULL_CLARK = 3, ///< Catmull-Clark subdivision surface.
|
||||
} geoShaderMode;
|
||||
|
||||
/**
|
||||
* @brief Initializes a shader instance.
|
||||
* @param si Shader instance to initialize.
|
||||
* @param dvle DVLE to initialize the shader instance with.
|
||||
*/
|
||||
Result shaderInstanceInit(shaderInstance_s* si, DVLE_s* dvle);
|
||||
|
||||
/**
|
||||
* @brief Frees a shader instance.
|
||||
* @param si Shader instance to free.
|
||||
*/
|
||||
Result shaderInstanceFree(shaderInstance_s* si);
|
||||
|
||||
/**
|
||||
* @brief Sets a bool uniform of a shader.
|
||||
* @param si Shader instance to use.
|
||||
* @param id ID of the bool uniform.
|
||||
* @param value Value to set.
|
||||
*/
|
||||
Result shaderInstanceSetBool(shaderInstance_s* si, int id, bool value);
|
||||
|
||||
/**
|
||||
* @brief Gets a bool uniform of a shader.
|
||||
* @param si Shader instance to use.
|
||||
* @param id ID of the bool uniform.
|
||||
* @param value Pointer to output the value to.
|
||||
*/
|
||||
Result shaderInstanceGetBool(shaderInstance_s* si, int id, bool* value);
|
||||
|
||||
/**
|
||||
* @brief Gets the location of a shader's uniform.
|
||||
* @param si Shader instance to use.
|
||||
* @param name Name of the uniform.
|
||||
*/
|
||||
s8 shaderInstanceGetUniformLocation(shaderInstance_s* si, const char* name);
|
||||
|
||||
/**
|
||||
* @brief Initializes a shader program.
|
||||
* @param sp Shader program to initialize.
|
||||
*/
|
||||
Result shaderProgramInit(shaderProgram_s* sp);
|
||||
|
||||
/**
|
||||
* @brief Frees a shader program.
|
||||
* @param sp Shader program to free.
|
||||
*/
|
||||
Result shaderProgramFree(shaderProgram_s* sp);
|
||||
|
||||
/**
|
||||
* @brief Sets the vertex shader of a shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param dvle Vertex shader to set.
|
||||
*/
|
||||
Result shaderProgramSetVsh(shaderProgram_s* sp, DVLE_s* dvle);
|
||||
|
||||
/**
|
||||
* @brief Sets the geometry shader of a shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param dvle Geometry shader to set.
|
||||
* @param stride Stride of the geometry shader.
|
||||
*/
|
||||
Result shaderProgramSetGsh(shaderProgram_s* sp, DVLE_s* dvle, u8 stride);
|
||||
|
||||
/**
|
||||
* @brief Configures the permutation of the input attributes of the geometry shader of a shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param permutation Attribute permutation to use.
|
||||
*/
|
||||
Result shaderProgramSetGshInputPermutation(shaderProgram_s* sp, u64 permutation);
|
||||
|
||||
/**
|
||||
* @brief Configures the operation mode of the geometry shader of a shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param mode Operation mode to use.
|
||||
*/
|
||||
Result shaderProgramSetGshMode(shaderProgram_s* sp, geoShaderMode mode);
|
||||
|
||||
/**
|
||||
* @brief Configures the shader units to use the specified shader program.
|
||||
* @param sp Shader program to use.
|
||||
* @param sendVshCode When true, the vertex shader's code and operand descriptors are uploaded.
|
||||
* @param sendGshCode When true, the geometry shader's code and operand descriptors are uploaded.
|
||||
*/
|
||||
Result shaderProgramConfigure(shaderProgram_s* sp, bool sendVshCode, bool sendGshCode);
|
||||
|
||||
/**
|
||||
* @brief Same as shaderProgramConfigure, but always loading code/operand descriptors and uploading DVLE constants afterwards.
|
||||
* @param sp Shader program to use.
|
||||
*/
|
||||
Result shaderProgramUse(shaderProgram_s* sp);
|
||||
|
@ -28,18 +28,9 @@ typedef enum{
|
||||
RESULT_TEXCOORD0W = 0x4, ///< Texture coordinate 0 W.
|
||||
RESULT_TEXCOORD1 = 0x5, ///< Texture coordinate 1.
|
||||
RESULT_TEXCOORD2 = 0x6, ///< Texture coordinate 2.
|
||||
RESULT_VIEW = 0x8, ///< View.
|
||||
RESULT_DUMMY = 0x9, ///< Dummy attribute (used as passthrough for geometry shader input).
|
||||
RESULT_VIEW = 0x8 ///< View.
|
||||
}DVLE_outputAttribute_t;
|
||||
|
||||
/// Geometry shader operation modes.
|
||||
typedef enum
|
||||
{
|
||||
GSH_POINT = 0, ///< Point processing mode.
|
||||
GSH_VARIABLE_PRIM = 1, ///< Variable-size primitive processing mode.
|
||||
GSH_FIXED_PRIM = 2, ///< Fixed-size primitive processing mode.
|
||||
} DVLE_geoShaderMode;
|
||||
|
||||
/// DVLP data.
|
||||
typedef struct{
|
||||
u32 codeSize; ///< Code size.
|
||||
@ -73,11 +64,6 @@ typedef struct{
|
||||
/// DVLE data.
|
||||
typedef struct{
|
||||
DVLE_type type; ///< DVLE type.
|
||||
bool mergeOutmaps; ///< true = merge vertex/geometry shader outmaps ('dummy' output attribute is present).
|
||||
DVLE_geoShaderMode gshMode; ///< Geometry shader operation mode.
|
||||
u8 gshFixedVtxStart; ///< Starting float uniform register number for storing the fixed-size primitive vertex array.
|
||||
u8 gshVariableVtxNum; ///< Number of fully-defined vertices in the variable-size primitive vertex array.
|
||||
u8 gshFixedVtxNum; ///< Number of vertices in the fixed-size primitive vertex array.
|
||||
DVLP_s* dvlp; ///< Contained DVLPs.
|
||||
u32 mainOffset; ///< Offset of the start of the main function.
|
||||
u32 endmainOffset; ///< Offset of the end of the main function.
|
||||
|
@ -60,21 +60,16 @@ static inline u32 IPC_Desc_MoveHandles(unsigned number)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the code to ask the kernel to fill the handle with the current process ID.
|
||||
* @return The code to request the current process ID.
|
||||
* @brief Returns the code to ask the kernel to fill the handle with the current process handle.
|
||||
* @return The code to request the current process handle.
|
||||
*
|
||||
* The next value is a placeholder that will be replaced by the current process ID by the kernel.
|
||||
* The next value is a placeholder that will be replaced by the current process handle by the kernel.
|
||||
*/
|
||||
static inline u32 IPC_Desc_CurProcessId(void)
|
||||
static inline u32 IPC_Desc_CurProcessHandle(void)
|
||||
{
|
||||
return 0x20;
|
||||
}
|
||||
|
||||
static inline CTR_DEPRECATED u32 IPC_Desc_CurProcessHandle(void)
|
||||
{
|
||||
return IPC_Desc_CurProcessId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a header describing a static buffer.
|
||||
* @param size Size of the buffer. Max ?0x03FFFF?.
|
||||
|
@ -1,159 +0,0 @@
|
||||
/**
|
||||
* @file mii.h
|
||||
* @brief Shared Mii struct.
|
||||
*
|
||||
* @see https://www.3dbrew.org/wiki/Mii#Mii_format
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Shared Mii struct
|
||||
typedef struct
|
||||
{
|
||||
u8 magic; ///< Always 3?
|
||||
|
||||
/// Mii options
|
||||
struct
|
||||
{
|
||||
bool allow_copying : 1; ///< True if copying is allowed
|
||||
bool is_private_name : 1; ///< Private name?
|
||||
u8 region_lock : 2; ///< Region lock (0=no lock, 1=JPN, 2=USA, 3=EUR)
|
||||
u8 char_set : 2; ///< Character set (0=JPN+USA+EUR, 1=CHN, 2=KOR, 3=TWN)
|
||||
} mii_options;
|
||||
|
||||
/// Mii position in Mii selector or Mii maker
|
||||
struct
|
||||
{
|
||||
u8 page_index : 4; ///< Page index of Mii
|
||||
u8 slot_index : 4; ///< Slot offset of Mii on its Page
|
||||
} mii_pos;
|
||||
|
||||
/// Console Identity
|
||||
struct
|
||||
{
|
||||
u8 unknown0 : 4; ///< Mabye padding (always seems to be 0)?
|
||||
u8 origin_console : 3; ///< Console that the Mii was created on (1=WII, 2=DSI, 3=3DS)
|
||||
} console_identity;
|
||||
|
||||
u64 system_id; ///< Identifies the system that the Mii was created on (Determines pants)
|
||||
u32 mii_id; ///< ID of Mii
|
||||
u8 mac[6]; ///< Creator's system's full MAC address
|
||||
u8 pad[2]; ///< Padding
|
||||
|
||||
/// Mii details
|
||||
struct {
|
||||
bool sex : 1; ///< Sex of Mii (False=Male, True=Female)
|
||||
u16 bday_month : 4; ///< Month of Mii's birthday
|
||||
u16 bday_day : 5; ///< Day of Mii's birthday
|
||||
u16 shirt_color : 4; ///< Color of Mii's shirt
|
||||
bool favorite : 1; ///< Whether the Mii is one of your 10 favorite Mii's
|
||||
} mii_details;
|
||||
|
||||
u16 mii_name[10]; ///< Name of Mii (Encoded using UTF16)
|
||||
u8 height; ///< How tall the Mii is
|
||||
u8 width; ///< How wide the Mii is
|
||||
|
||||
/// Face style
|
||||
struct
|
||||
{
|
||||
bool disable_sharing : 1; ///< Whether or not Sharing of the Mii is allowed
|
||||
u8 shape : 4; ///< Face shape
|
||||
u8 skinColor : 3; ///< Color of skin
|
||||
} face_style;
|
||||
|
||||
/// Face details
|
||||
struct
|
||||
{
|
||||
u8 wrinkles : 4;
|
||||
u8 makeup : 4;
|
||||
} face_details;
|
||||
|
||||
u8 hair_style;
|
||||
|
||||
/// Hair details
|
||||
struct
|
||||
{
|
||||
u8 color : 3;
|
||||
bool flip : 1;
|
||||
} hair_details;
|
||||
|
||||
/// Eye details
|
||||
struct
|
||||
{
|
||||
u32 style : 6;
|
||||
u32 color : 3;
|
||||
u32 scale : 4;
|
||||
u32 yscale : 3;
|
||||
u32 rotation : 5;
|
||||
u32 xspacing : 4;
|
||||
u32 yposition : 5;
|
||||
} eye_details;
|
||||
|
||||
/// Eyebrow details
|
||||
struct
|
||||
{
|
||||
u32 style : 5;
|
||||
u32 color : 3;
|
||||
u32 scale : 4;
|
||||
u32 yscale : 3;
|
||||
u32 pad : 1;
|
||||
u32 rotation : 5;
|
||||
u32 xspacing : 4;
|
||||
u32 yposition : 5;
|
||||
} eyebrow_details;
|
||||
|
||||
/// Nose details
|
||||
struct
|
||||
{
|
||||
u16 style : 5;
|
||||
u16 scale : 4;
|
||||
u16 yposition : 5;
|
||||
} nose_details;
|
||||
|
||||
/// Mouth details
|
||||
struct
|
||||
{
|
||||
u16 style : 6;
|
||||
u16 color : 3;
|
||||
u16 scale : 4;
|
||||
u16 yscale : 3;
|
||||
} mouth_details;
|
||||
|
||||
/// Mustache details
|
||||
struct
|
||||
{
|
||||
u16 mouth_yposition : 5;
|
||||
u16 mustach_style : 3;
|
||||
u16 pad : 2;
|
||||
} mustache_details;
|
||||
|
||||
/// Beard details
|
||||
struct
|
||||
{
|
||||
u16 style : 3;
|
||||
u16 color : 3;
|
||||
u16 scale : 4;
|
||||
u16 ypos : 5;
|
||||
} beard_details;
|
||||
|
||||
/// Glasses details
|
||||
struct
|
||||
{
|
||||
u16 style : 4;
|
||||
u16 color : 3;
|
||||
u16 scale : 4;
|
||||
u16 ypos : 5;
|
||||
} glasses_details;
|
||||
|
||||
/// Mole details
|
||||
struct
|
||||
{
|
||||
bool enable : 1;
|
||||
u16 scale : 5;
|
||||
u16 xpos : 5;
|
||||
u16 ypos : 5;
|
||||
} mole_details;
|
||||
|
||||
u16 author_name[10]; ///< Name of Mii's author (Encoded using UTF16)
|
||||
} CTR_PACKED MiiData;
|
@ -81,21 +81,6 @@ u32 ndspChnGetSamplePos(int id);
|
||||
* @return The sequence ID of the wave buffer.
|
||||
*/
|
||||
u16 ndspChnGetWaveBufSeq(int id);
|
||||
|
||||
/**
|
||||
* @brief Checks whether a channel is currently paused.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @return Whether the channel is currently paused.
|
||||
*/
|
||||
bool ndspChnIsPaused(int id);
|
||||
|
||||
/**
|
||||
* @brief Sets the pause status of a channel.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param paused Whether the channel is to be paused (true) or unpaused (false).
|
||||
*/
|
||||
void ndspChnSetPaused(int id, bool paused);
|
||||
|
||||
///@}
|
||||
|
||||
///@name Configuration
|
||||
@ -107,14 +92,6 @@ void ndspChnSetPaused(int id, bool paused);
|
||||
*/
|
||||
void ndspChnSetFormat(int id, u16 format);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Gets the format of a channel.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @return The format of the channel.
|
||||
*/
|
||||
u16 ndspChnGetFormat(int id);
|
||||
|
||||
/**
|
||||
* @brief Sets the interpolation type of a channel.
|
||||
* @param id ID of the channel (0..23).
|
||||
@ -122,13 +99,6 @@ u16 ndspChnGetFormat(int id);
|
||||
*/
|
||||
void ndspChnSetInterp(int id, ndspInterpType type);
|
||||
|
||||
/**
|
||||
* @brief Gets the interpolation type of a channel.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @return The interpolation type of the channel.
|
||||
*/
|
||||
ndspInterpType ndspChnGetInterp(int id);
|
||||
|
||||
/**
|
||||
* @brief Sets the sample rate of a channel.
|
||||
* @param id ID of the channel (0..23).
|
||||
@ -136,13 +106,6 @@ ndspInterpType ndspChnGetInterp(int id);
|
||||
*/
|
||||
void ndspChnSetRate(int id, float rate);
|
||||
|
||||
/**
|
||||
* @brief Gets the sample rate of a channel.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @return The sample rate of the channel.
|
||||
*/
|
||||
float ndspChnGetRate(int id);
|
||||
|
||||
/**
|
||||
* @brief Sets the mix parameters (volumes) of a channel.
|
||||
* @param id ID of the channel (0..23).
|
||||
@ -156,13 +119,6 @@ float ndspChnGetRate(int id);
|
||||
*/
|
||||
void ndspChnSetMix(int id, float mix[12]);
|
||||
|
||||
/**
|
||||
* @brief Gets the mix parameters (volumes) of a channel.
|
||||
* @param id ID of the channel (0..23)
|
||||
* @param mix Mix parameters to write out to. See \ref ndspChnSetMix.
|
||||
*/
|
||||
void ndspChnGetMix(int id, float mix[12]);
|
||||
|
||||
/**
|
||||
* @brief Sets the DSPADPCM coefficients of a channel.
|
||||
* @param id ID of the channel (0..23).
|
||||
@ -196,69 +152,12 @@ void ndspChnWaveBufAdd(int id, ndspWaveBuf* buf);
|
||||
* @param enable Whether to enable the IIR monopole filter.
|
||||
*/
|
||||
void ndspChnIirMonoSetEnable(int id, bool enable);
|
||||
/**
|
||||
* @brief Manually sets up the parameters on monopole filter
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param enable Whether to enable the IIR monopole filter.
|
||||
*/
|
||||
bool ndspChnIirMonoSetParamsCustomFilter(int id, float a0, float a1, float b0);
|
||||
/**
|
||||
* @brief Sets the monopole to be a low pass filter. (Note: This is a lower-quality filter than the biquad one.)
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param f0 Low pass cut-off frequency.
|
||||
*/
|
||||
bool ndspChnIirMonoSetParamsLowPassFilter(int id, float f0);
|
||||
/**
|
||||
* @brief Sets the monopole to be a high pass filter. (Note: This is a lower-quality filter than the biquad one.)
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param f0 High pass cut-off frequency.
|
||||
*/
|
||||
bool ndspChnIirMonoSetParamsHighPassFilter(int id, float f0);
|
||||
// ndspChnIirMonoSetParams
|
||||
/**
|
||||
* @brief Configures whether the IIR biquad filter of a channel is enabled.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param enable Whether to enable the IIR biquad filter.
|
||||
*/
|
||||
void ndspChnIirBiquadSetEnable(int id, bool enable);
|
||||
/**
|
||||
* @brief Manually sets up the parameters of the biquad filter
|
||||
* @param id ID of the channel (0..23).
|
||||
*/
|
||||
bool ndspChnIirBiquadSetParamsCustomFilter(int id, float a0, float a1, float a2, float b0, float b1, float b2);
|
||||
/**
|
||||
* @brief Sets the biquad to be a low pass filter.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param f0 Low pass cut-off frequency.
|
||||
* @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071).
|
||||
*/
|
||||
bool ndspChnIirBiquadSetParamsLowPassFilter(int id, float f0, float Q);
|
||||
/**
|
||||
* @brief Sets the biquad to be a high pass filter.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param f0 High pass cut-off frequency.
|
||||
* @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071).
|
||||
*/
|
||||
bool ndspChnIirBiquadSetParamsHighPassFilter(int id, float f0, float Q);
|
||||
/**
|
||||
* @brief Sets the biquad to be a band pass filter.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param f0 Mid-frequency.
|
||||
* @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071).
|
||||
*/
|
||||
bool ndspChnIirBiquadSetParamsBandPassFilter(int id, float f0, float Q);
|
||||
/**
|
||||
* @brief Sets the biquad to be a notch filter.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param f0 Notch frequency.
|
||||
* @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071).
|
||||
*/
|
||||
bool ndspChnIirBiquadSetParamsNotchFilter(int id, float f0, float Q);
|
||||
/**
|
||||
* @brief Sets the biquad to be a peaking equalizer.
|
||||
* @param id ID of the channel (0..23).
|
||||
* @param f0 Central frequency.
|
||||
* @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071).
|
||||
* @param gain Amount of gain (raw value = 10 ^ dB/40)
|
||||
*/
|
||||
bool ndspChnIirBiquadSetParamsPeakingEqualizer(int id, float f0, float Q, float gain);
|
||||
// ndspChnIirBiquadSetParams
|
||||
///@}
|
||||
|
@ -4,10 +4,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/os.h>
|
||||
|
||||
#define NDSP_SAMPLE_RATE (SYSCLOCK_SOC / 512.0)
|
||||
|
||||
///@name Data types
|
||||
///@{
|
||||
/// Sound output modes.
|
||||
@ -118,48 +114,24 @@ u32 ndspGetFrameCount(void);
|
||||
*/
|
||||
void ndspSetMasterVol(float volume);
|
||||
|
||||
/**
|
||||
* @brief Gets the master volume.
|
||||
* @return The master volume.
|
||||
*/
|
||||
float ndspGetMasterVol(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the output mode.
|
||||
* @param mode Output mode to set. Defaults to NDSP_OUTPUT_STEREO.
|
||||
*/
|
||||
void ndspSetOutputMode(ndspOutputMode mode);
|
||||
|
||||
/**
|
||||
* @brief Gets the output mode.
|
||||
* @return The output mode.
|
||||
*/
|
||||
ndspOutputMode ndspGetOutputMode(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the clipping mode.
|
||||
* @param mode Clipping mode to set. Defaults to NDSP_CLIP_SOFT.
|
||||
*/
|
||||
void ndspSetClippingMode(ndspClippingMode mode);
|
||||
|
||||
/**
|
||||
* @brief Gets the clipping mode.
|
||||
* @return The clipping mode.
|
||||
*/
|
||||
ndspClippingMode ndspGetClippingMode(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the output count.
|
||||
* @param count Output count to set. Defaults to 2.
|
||||
*/
|
||||
void ndspSetOutputCount(int count);
|
||||
|
||||
/**
|
||||
* @brief Gets the output count.
|
||||
* @return The output count.
|
||||
*/
|
||||
int ndspGetOutputCount(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the wave buffer to capture audio to.
|
||||
* @param capture Wave buffer to capture to.
|
||||
@ -182,35 +154,17 @@ void ndspSetCallback(ndspCallback callback, void* data);
|
||||
*/
|
||||
void ndspSurroundSetDepth(u16 depth);
|
||||
|
||||
/**
|
||||
* @brief Gets the surround sound depth.
|
||||
* @return The surround sound depth.
|
||||
*/
|
||||
u16 ndspSurroundGetDepth(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the surround sound position.
|
||||
* @param pos Position to set. Defaults to NDSP_SPKPOS_SQUARE.
|
||||
*/
|
||||
void ndspSurroundSetPos(ndspSpeakerPos pos);
|
||||
|
||||
/**
|
||||
* @brief Gets the surround sound position.
|
||||
* @return The surround sound speaker position.
|
||||
*/
|
||||
ndspSpeakerPos ndspSurroundGetPos(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the surround sound rear ratio.
|
||||
* @param ratio Rear ratio to set. Defaults to 0x8000.
|
||||
*/
|
||||
void ndspSurroundSetRearRatio(u16 ratio);
|
||||
|
||||
/**
|
||||
* @brief Gets the surround sound rear ratio.
|
||||
* @return The rear ratio.
|
||||
*/
|
||||
u16 ndspSurroundGetRearRatio(void);
|
||||
///@}
|
||||
|
||||
///@name Auxiliary output
|
||||
@ -222,13 +176,6 @@ u16 ndspSurroundGetRearRatio(void);
|
||||
*/
|
||||
void ndspAuxSetEnable(int id, bool enable);
|
||||
|
||||
/**
|
||||
* @brief Gets whether auxiliary output is enabled.
|
||||
* @param id ID of the auxiliary output.
|
||||
* @return Whether auxiliary output is enabled.
|
||||
*/
|
||||
bool ndspAuxIsEnabled(int id);
|
||||
|
||||
/**
|
||||
* @brief Configures whether an auxiliary output should use front bypass.
|
||||
* @param id ID of the auxiliary output.
|
||||
@ -236,13 +183,6 @@ bool ndspAuxIsEnabled(int id);
|
||||
*/
|
||||
void ndspAuxSetFrontBypass(int id, bool bypass);
|
||||
|
||||
/**
|
||||
* @brief Gets whether auxiliary output front bypass is enabled.
|
||||
* @param id ID of the auxiliary output.
|
||||
* @return Whether auxiliary output front bypass is enabled.
|
||||
*/
|
||||
bool ndspAuxGetFrontBypass(int id);
|
||||
|
||||
/**
|
||||
* @brief Sets the volume of an auxiliary output.
|
||||
* @param id ID of the auxiliary output.
|
||||
@ -250,13 +190,6 @@ bool ndspAuxGetFrontBypass(int id);
|
||||
*/
|
||||
void ndspAuxSetVolume(int id, float volume);
|
||||
|
||||
/**
|
||||
* @brief Gets the volume of an auxiliary output.
|
||||
* @param id ID of the auxiliary output.
|
||||
* @return Volume of the auxiliary output.
|
||||
*/
|
||||
float ndspAuxGetVolume(int id);
|
||||
|
||||
/**
|
||||
* @brief Sets the callback of an auxiliary output.
|
||||
* @param id ID of the auxiliary output.
|
||||
|
@ -3,27 +3,6 @@
|
||||
* @brief OS related stuff.
|
||||
*/
|
||||
#pragma once
|
||||
#include "svc.h"
|
||||
|
||||
///< The external clock rate for the SoC.
|
||||
#define SYSCLOCK_SOC (16756991u)
|
||||
///< The base system clock rate (for I2C, NDMA, etc.).
|
||||
#define SYSCLOCK_SYS (SYSCLOCK_SOC * 2)
|
||||
///< The base clock rate for the SDMMC controller (and some other peripherals).
|
||||
#define SYSCLOCK_SDMMC (SYSCLOCK_SYS * 2)
|
||||
///< The clock rate for the Arm9.
|
||||
#define SYSCLOCK_ARM9 (SYSCLOCK_SYS * 4)
|
||||
///< The clock rate for the Arm11 in CTR mode and in \ref svcGetSystemTick.
|
||||
#define SYSCLOCK_ARM11 (SYSCLOCK_ARM9 * 2)
|
||||
///< The clock rate for the Arm11 in LGR1 mode.
|
||||
#define SYSCLOCK_ARM11_LGR1 (SYSCLOCK_ARM11 * 2)
|
||||
///< The clock rate for the Arm11 in LGR2 mode.
|
||||
#define SYSCLOCK_ARM11_LGR2 (SYSCLOCK_ARM11 * 3)
|
||||
///< The highest possible clock rate for the Arm11 on known New 3DS units.
|
||||
#define SYSCLOCK_ARM11_NEW SYSCLOCK_ARM11_LGR2
|
||||
|
||||
#define CPU_TICKS_PER_MSEC (SYSCLOCK_ARM11 / 1000.0)
|
||||
#define CPU_TICKS_PER_USEC (SYSCLOCK_ARM11 / 1000000.0)
|
||||
|
||||
/// Packs a system version from its components.
|
||||
#define SYSTEM_VERSION(major, minor, revision) \
|
||||
@ -38,105 +17,14 @@
|
||||
/// Retrieves the revision version from a packed system version.
|
||||
#define GET_VERSION_REVISION(version) (((version)>> 8)&0xFF)
|
||||
|
||||
#define OS_HEAP_AREA_BEGIN 0x08000000 ///< Start of the heap area in the virtual address space
|
||||
#define OS_HEAP_AREA_END 0x0E000000 ///< End of the heap area in the virtual address space
|
||||
|
||||
#define OS_MAP_AREA_BEGIN 0x10000000 ///< Start of the mappable area in the virtual address space
|
||||
#define OS_MAP_AREA_END 0x14000000 ///< End of the mappable area in the virtual address space
|
||||
|
||||
#define OS_OLD_FCRAM_VADDR 0x14000000 ///< Old pre-8.x linear FCRAM mapping virtual address
|
||||
#define OS_OLD_FCRAM_PADDR 0x20000000 ///< Old pre-8.x linear FCRAM mapping physical address
|
||||
#define OS_OLD_FCRAM_SIZE 0x8000000 ///< Old pre-8.x linear FCRAM mapping size (128 MiB)
|
||||
|
||||
#define OS_QTMRAM_VADDR 0x1E800000 ///< New3DS QTM memory virtual address
|
||||
#define OS_QTMRAM_PADDR 0x1F000000 ///< New3DS QTM memory physical address
|
||||
#define OS_QTMRAM_SIZE 0x400000 ///< New3DS QTM memory size (4 MiB; last 128 KiB reserved by kernel)
|
||||
|
||||
#define OS_MMIO_VADDR 0x1EC00000 ///< Memory mapped IO range virtual address
|
||||
#define OS_MMIO_PADDR 0x10100000 ///< Memory mapped IO range physical address
|
||||
#define OS_MMIO_SIZE 0x400000 ///< Memory mapped IO range size (4 MiB)
|
||||
|
||||
#define OS_VRAM_VADDR 0x1F000000 ///< VRAM virtual address
|
||||
#define OS_VRAM_PADDR 0x18000000 ///< VRAM physical address
|
||||
#define OS_VRAM_SIZE 0x600000 ///< VRAM size (6 MiB)
|
||||
|
||||
#define OS_DSPRAM_VADDR 0x1FF00000 ///< DSP memory virtual address
|
||||
#define OS_DSPRAM_PADDR 0x1FF00000 ///< DSP memory physical address
|
||||
#define OS_DSPRAM_SIZE 0x80000 ///< DSP memory size (512 KiB)
|
||||
|
||||
#define OS_KERNELCFG_VADDR 0x1FF80000 ///< Kernel configuration page virtual address
|
||||
#define OS_SHAREDCFG_VADDR 0x1FF81000 ///< Shared system configuration page virtual address
|
||||
|
||||
#define OS_FCRAM_VADDR 0x30000000 ///< Linear FCRAM mapping virtual address
|
||||
#define OS_FCRAM_PADDR 0x20000000 ///< Linear FCRAM mapping physical address
|
||||
#define OS_FCRAM_SIZE 0x10000000 ///< Linear FCRAM mapping size (256 MiB)
|
||||
|
||||
#define OS_KernelConfig ((osKernelConfig_s const*)OS_KERNELCFG_VADDR) ///< Pointer to the kernel configuration page (see \ref osKernelConfig_s)
|
||||
#define OS_SharedConfig ((osSharedConfig_s*)OS_SHAREDCFG_VADDR) ///< Pointer to the shared system configuration page (see \ref osSharedConfig_s)
|
||||
|
||||
/// Kernel configuration page (read-only).
|
||||
typedef struct
|
||||
/// Memory regions.
|
||||
typedef enum
|
||||
{
|
||||
u32 kernel_ver;
|
||||
u32 update_flag;
|
||||
u64 ns_tid;
|
||||
u32 kernel_syscore_ver;
|
||||
u8 env_info;
|
||||
u8 unit_info;
|
||||
u8 boot_env;
|
||||
u8 unk_0x17;
|
||||
u32 kernel_ctrsdk_ver;
|
||||
u32 unk_0x1c;
|
||||
u32 firmlaunch_flags;
|
||||
u8 unk_0x24[0xc];
|
||||
u32 app_memtype;
|
||||
u8 unk_0x34[0xc];
|
||||
u32 memregion_sz[3];
|
||||
u8 unk_0x4c[0x14];
|
||||
u32 firm_ver;
|
||||
u32 firm_syscore_ver;
|
||||
u32 firm_ctrsdk_ver;
|
||||
} osKernelConfig_s;
|
||||
|
||||
/// Time reference information struct (filled in by PTM).
|
||||
typedef struct
|
||||
{
|
||||
u64 value_ms; ///< Milliseconds elapsed since January 1900 when this structure was last updated
|
||||
u64 value_tick; ///< System ticks elapsed since boot when this structure was last updated
|
||||
s64 sysclock_hz;///< System clock frequency in Hz adjusted using RTC measurements (usually around \ref SYSCLOCK_ARM11)
|
||||
s64 drift_ms; ///< Measured time drift of the system clock (according to the RTC) in milliseconds since the last update
|
||||
} osTimeRef_s;
|
||||
|
||||
/// Shared system configuration page structure (read-only or read-write depending on exheader).
|
||||
typedef struct
|
||||
{
|
||||
vu32 timeref_cnt;
|
||||
u8 running_hw;
|
||||
u8 mcu_hwinfo;
|
||||
u8 unk_0x06[0x1A];
|
||||
volatile osTimeRef_s timeref[2];
|
||||
u8 wifi_macaddr[6];
|
||||
vu8 wifi_strength;
|
||||
vu8 network_state;
|
||||
u8 unk_0x68[0x18];
|
||||
volatile float slider_3d;
|
||||
vu8 led_3d;
|
||||
vu8 led_battery;
|
||||
vu8 unk_flag;
|
||||
u8 unk_0x87;
|
||||
u8 unk_0x88[0x18];
|
||||
vu64 menu_tid;
|
||||
vu64 cur_menu_tid;
|
||||
u8 unk_0xB0[0x10];
|
||||
vu8 headset_connected;
|
||||
} osSharedConfig_s;
|
||||
|
||||
/// Tick counter.
|
||||
typedef struct
|
||||
{
|
||||
u64 elapsed; ///< Elapsed CPU ticks between measurements.
|
||||
u64 reference; ///< Point in time used as reference.
|
||||
} TickCounter;
|
||||
MEMREGION_ALL = 0, ///< All regions.
|
||||
MEMREGION_APPLICATION = 1, ///< APPLICATION memory.
|
||||
MEMREGION_SYSTEM = 2, ///< SYSTEM memory.
|
||||
MEMREGION_BASE = 3, ///< BASE memory.
|
||||
} MemRegion;
|
||||
|
||||
/// OS_VersionBin. Format of the system version: "<major>.<minor>.<build>-<nupver><region>"
|
||||
typedef struct
|
||||
@ -171,7 +59,7 @@ void* osConvertOldLINEARMemToNew(const void* vaddr);
|
||||
*
|
||||
* This can be used to get some details about an error returned by a service call.
|
||||
*/
|
||||
const char* osStrError(Result error);
|
||||
const char* osStrError(u32 error);
|
||||
|
||||
/**
|
||||
* @brief Gets the system's FIRM version.
|
||||
@ -181,7 +69,7 @@ const char* osStrError(Result error);
|
||||
*/
|
||||
static inline u32 osGetFirmVersion(void)
|
||||
{
|
||||
return OS_KernelConfig->firm_ver &~ 0xFF;
|
||||
return (*(vu32*)0x1FF80060) & ~0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,19 +84,7 @@ static inline u32 osGetFirmVersion(void)
|
||||
*/
|
||||
static inline u32 osGetKernelVersion(void)
|
||||
{
|
||||
return OS_KernelConfig->kernel_ver &~ 0xFF;
|
||||
}
|
||||
|
||||
/// Gets the system's "core version" (2 on NATIVE_FIRM, 3 on SAFE_FIRM, etc.)
|
||||
static inline u32 osGetSystemCoreVersion(void)
|
||||
{
|
||||
return OS_KernelConfig->kernel_syscore_ver;
|
||||
}
|
||||
|
||||
/// Gets the system's memory layout ID (0-5 on Old 3DS, 6-8 on New 3DS)
|
||||
static inline u32 osGetApplicationMemType(void)
|
||||
{
|
||||
return OS_KernelConfig->app_memtype;
|
||||
return (*(vu32*)0x1FF80000) & ~0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,7 +97,7 @@ static inline u32 osGetMemRegionSize(MemRegion region)
|
||||
if(region == MEMREGION_ALL) {
|
||||
return osGetMemRegionSize(MEMREGION_APPLICATION) + osGetMemRegionSize(MEMREGION_SYSTEM) + osGetMemRegionSize(MEMREGION_BASE);
|
||||
} else {
|
||||
return OS_KernelConfig->memregion_sz[region-1];
|
||||
return *(vu32*) (0x1FF80040 + (region - 1) * 0x4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,68 +106,30 @@ static inline u32 osGetMemRegionSize(MemRegion region)
|
||||
* @param region Memory region to check.
|
||||
* @return The number of used bytes of memory.
|
||||
*/
|
||||
static inline u32 osGetMemRegionUsed(MemRegion region)
|
||||
{
|
||||
s64 mem_used;
|
||||
svcGetSystemInfo(&mem_used, 0, region);
|
||||
return mem_used;
|
||||
}
|
||||
s64 osGetMemRegionUsed(MemRegion region);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of free bytes within the specified memory region.
|
||||
* @param region Memory region to check.
|
||||
* @return The number of free bytes of memory.
|
||||
*/
|
||||
static inline u32 osGetMemRegionFree(MemRegion region)
|
||||
static inline s64 osGetMemRegionFree(MemRegion region)
|
||||
{
|
||||
return osGetMemRegionSize(region) - osGetMemRegionUsed(region);
|
||||
return (s64) osGetMemRegionSize(region) - osGetMemRegionUsed(region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads the latest reference timepoint published by PTM.
|
||||
* @return Structure (see \ref osTimeRef_s).
|
||||
*/
|
||||
osTimeRef_s osGetTimeRef(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current time.
|
||||
* @return The number of milliseconds since 1st Jan 1900 00:00.
|
||||
*/
|
||||
u64 osGetTime(void);
|
||||
|
||||
/**
|
||||
* @brief Starts a tick counter.
|
||||
* @param cnt The tick counter.
|
||||
*/
|
||||
static inline void osTickCounterStart(TickCounter* cnt)
|
||||
{
|
||||
cnt->reference = svcGetSystemTick();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates the elapsed time in a tick counter.
|
||||
* @param cnt The tick counter.
|
||||
*/
|
||||
static inline void osTickCounterUpdate(TickCounter* cnt)
|
||||
{
|
||||
u64 now = svcGetSystemTick();
|
||||
cnt->elapsed = now - cnt->reference;
|
||||
cnt->reference = now;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads the elapsed time in a tick counter.
|
||||
* @param cnt The tick counter.
|
||||
* @return The number of milliseconds elapsed.
|
||||
*/
|
||||
double osTickCounterRead(const TickCounter* cnt);
|
||||
|
||||
/**
|
||||
* @brief Gets the current Wifi signal strength.
|
||||
* @return The current Wifi signal strength.
|
||||
*
|
||||
* Valid values are 0-3:
|
||||
* - 0 means the signal strength is terrible or the 3DS is disconnected from
|
||||
* - 0 means the singal strength is terrible or the 3DS is disconnected from
|
||||
* all networks.
|
||||
* - 1 means the signal strength is bad.
|
||||
* - 2 means the signal strength is decent.
|
||||
@ -303,7 +141,7 @@ double osTickCounterRead(const TickCounter* cnt);
|
||||
*/
|
||||
static inline u8 osGetWifiStrength(void)
|
||||
{
|
||||
return OS_SharedConfig->wifi_strength;
|
||||
return *(vu8*)0x1FF81066;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,16 +150,7 @@ static inline u8 osGetWifiStrength(void)
|
||||
*/
|
||||
static inline float osGet3DSliderState(void)
|
||||
{
|
||||
return OS_SharedConfig->slider_3d;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks whether a headset is connected.
|
||||
* @return true or false.
|
||||
*/
|
||||
static inline bool osIsHeadsetConnected(void)
|
||||
{
|
||||
return OS_SharedConfig->headset_connected != 0;
|
||||
return *(volatile float*)0x1FF81080;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -332,6 +161,7 @@ void osSetSpeedupEnable(bool enable);
|
||||
|
||||
/**
|
||||
* @brief Gets the NAND system-version stored in NVer/CVer.
|
||||
* The romfs device must not be already initialized(via romfsInit*()) at the time this function is called, since this code uses the romfs device.
|
||||
* @param nver_versionbin Output OS_VersionBin structure for the data read from NVer.
|
||||
* @param cver_versionbin Output OS_VersionBin structure for the data read from CVer.
|
||||
* @return The result-code. This value can be positive if opening "romfs:/version.bin" fails with stdio, since errno would be returned in that case. In some cases the error can be special negative values as well.
|
||||
|
@ -57,109 +57,6 @@ enum
|
||||
RS_INVALIDRESVAL = 63,
|
||||
};
|
||||
|
||||
/// Result code module values.
|
||||
enum
|
||||
{
|
||||
RM_COMMON = 0,
|
||||
RM_KERNEL = 1,
|
||||
RM_UTIL = 2,
|
||||
RM_FILE_SERVER = 3,
|
||||
RM_LOADER_SERVER = 4,
|
||||
RM_TCB = 5,
|
||||
RM_OS = 6,
|
||||
RM_DBG = 7,
|
||||
RM_DMNT = 8,
|
||||
RM_PDN = 9,
|
||||
RM_GSP = 10,
|
||||
RM_I2C = 11,
|
||||
RM_GPIO = 12,
|
||||
RM_DD = 13,
|
||||
RM_CODEC = 14,
|
||||
RM_SPI = 15,
|
||||
RM_PXI = 16,
|
||||
RM_FS = 17,
|
||||
RM_DI = 18,
|
||||
RM_HID = 19,
|
||||
RM_CAM = 20,
|
||||
RM_PI = 21,
|
||||
RM_PM = 22,
|
||||
RM_PM_LOW = 23,
|
||||
RM_FSI = 24,
|
||||
RM_SRV = 25,
|
||||
RM_NDM = 26,
|
||||
RM_NWM = 27,
|
||||
RM_SOC = 28,
|
||||
RM_LDR = 29,
|
||||
RM_ACC = 30,
|
||||
RM_ROMFS = 31,
|
||||
RM_AM = 32,
|
||||
RM_HIO = 33,
|
||||
RM_UPDATER = 34,
|
||||
RM_MIC = 35,
|
||||
RM_FND = 36,
|
||||
RM_MP = 37,
|
||||
RM_MPWL = 38,
|
||||
RM_AC = 39,
|
||||
RM_HTTP = 40,
|
||||
RM_DSP = 41,
|
||||
RM_SND = 42,
|
||||
RM_DLP = 43,
|
||||
RM_HIO_LOW = 44,
|
||||
RM_CSND = 45,
|
||||
RM_SSL = 46,
|
||||
RM_AM_LOW = 47,
|
||||
RM_NEX = 48,
|
||||
RM_FRIENDS = 49,
|
||||
RM_RDT = 50,
|
||||
RM_APPLET = 51,
|
||||
RM_NIM = 52,
|
||||
RM_PTM = 53,
|
||||
RM_MIDI = 54,
|
||||
RM_MC = 55,
|
||||
RM_SWC = 56,
|
||||
RM_FATFS = 57,
|
||||
RM_NGC = 58,
|
||||
RM_CARD = 59,
|
||||
RM_CARDNOR = 60,
|
||||
RM_SDMC = 61,
|
||||
RM_BOSS = 62,
|
||||
RM_DBM = 63,
|
||||
RM_CONFIG = 64,
|
||||
RM_PS = 65,
|
||||
RM_CEC = 66,
|
||||
RM_IR = 67,
|
||||
RM_UDS = 68,
|
||||
RM_PL = 69,
|
||||
RM_CUP = 70,
|
||||
RM_GYROSCOPE = 71,
|
||||
RM_MCU = 72,
|
||||
RM_NS = 73,
|
||||
RM_NEWS = 74,
|
||||
RM_RO = 75,
|
||||
RM_GD = 76,
|
||||
RM_CARD_SPI = 77,
|
||||
RM_EC = 78,
|
||||
RM_WEB_BROWSER = 79,
|
||||
RM_TEST = 80,
|
||||
RM_ENC = 81,
|
||||
RM_PIA = 82,
|
||||
RM_ACT = 83,
|
||||
RM_VCTL = 84,
|
||||
RM_OLV = 85,
|
||||
RM_NEIA = 86,
|
||||
RM_NPNS = 87,
|
||||
RM_AVD = 90,
|
||||
RM_L2B = 91,
|
||||
RM_MVD = 92,
|
||||
RM_NFC = 93,
|
||||
RM_UART = 94,
|
||||
RM_SPM = 95,
|
||||
RM_QTM = 96,
|
||||
RM_NFP = 97,
|
||||
RM_APPLICATION = 254,
|
||||
RM_INVALIDRESVAL = 255,
|
||||
};
|
||||
|
||||
/// Result code generic description values.
|
||||
enum
|
||||
{
|
||||
|
@ -5,7 +5,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/services/fs.h>
|
||||
|
||||
/// RomFS header.
|
||||
typedef struct
|
||||
@ -46,48 +45,15 @@ typedef struct
|
||||
u16 name[]; ///< Name. (UTF-16)
|
||||
} romfs_file;
|
||||
|
||||
/**
|
||||
* @brief Mounts the Application's RomFS.
|
||||
* @param name Device mount name.
|
||||
* @remark This function is intended to be used to access one's own RomFS.
|
||||
* If the application is running as 3DSX, it mounts the embedded RomFS section inside the 3DSX.
|
||||
* If on the other hand it's an NCCH, it behaves identically to \ref romfsMountFromCurrentProcess.
|
||||
*/
|
||||
Result romfsMountSelf(const char *name);
|
||||
/// Initializes the RomFS driver.
|
||||
Result romfsInit(void);
|
||||
|
||||
/**
|
||||
* @brief Mounts RomFS from an open file.
|
||||
* @param fd FSFILE handle of the RomFS image.
|
||||
* @brief Initializes the RomFS driver from a RomFS file.
|
||||
* @param file Handle of the RomFS file.
|
||||
* @param offset Offset of the RomFS within the file.
|
||||
* @param name Device mount name.
|
||||
*/
|
||||
Result romfsMountFromFile(Handle fd, u32 offset, const char *name);
|
||||
Result romfsInitFromFile(Handle file, u32 offset);
|
||||
|
||||
/**
|
||||
* @brief Mounts RomFS using the current process host program RomFS.
|
||||
* @param name Device mount name.
|
||||
*/
|
||||
Result romfsMountFromCurrentProcess(const char *name);
|
||||
|
||||
/**
|
||||
* @brief Mounts RomFS from the specified title.
|
||||
* @param tid Title ID
|
||||
* @param mediatype Mediatype
|
||||
* @param name Device mount name.
|
||||
*/
|
||||
Result romfsMountFromTitle(u64 tid, FS_MediaType mediatype, const char* name);
|
||||
|
||||
/// Unmounts the RomFS device.
|
||||
Result romfsUnmount(const char *name);
|
||||
|
||||
/// Wrapper for \ref romfsMountSelf with the default "romfs" device name.
|
||||
static inline Result romfsInit(void)
|
||||
{
|
||||
return romfsMountSelf("romfs");
|
||||
}
|
||||
|
||||
/// Wrapper for \ref romfsUnmount with the default "romfs" device name.
|
||||
static inline Result romfsExit(void)
|
||||
{
|
||||
return romfsUnmount("romfs");
|
||||
}
|
||||
/// Exits the RomFS driver.
|
||||
Result romfsExit(void);
|
||||
|
13
libctru/include/3ds/sdmc.h
Normal file
13
libctru/include/3ds/sdmc.h
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @file sdmc.h
|
||||
* @brief SDMC driver.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Initializes the SDMC driver.
|
||||
Result sdmcInit(void);
|
||||
|
||||
/// Exits the SDMC driver.
|
||||
Result sdmcExit(void);
|
@ -4,154 +4,17 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Wifi security modes.
|
||||
typedef enum {
|
||||
AC_OPEN = 0, ///< Open authentication.
|
||||
AC_WEP_40BIT = 1, ///< WEP 40-bit authentication.
|
||||
AC_WEP_104BIT = 2, ///< WEP 104-bit authentication.
|
||||
AC_WEP_128BIT = 3, ///< WEP 128-bit authentication.
|
||||
AC_WPA_TKIP = 4, ///< WPA TKIP authentication.
|
||||
AC_WPA2_TKIP = 5, ///< WPA2 TKIP authentication.
|
||||
AC_WPA_AES = 6, ///< WPA AES authentication.
|
||||
AC_WPA2_AES = 7, ///< WPA2 AES authentication.
|
||||
} acSecurityMode;
|
||||
|
||||
/// Wifi access point types (bitfield).
|
||||
enum {
|
||||
AC_AP_TYPE_NONE = 0, ///< No access point/none allowed.
|
||||
AC_AP_TYPE_SLOT1 = BIT(1), ///< Slot 1 in System Settings.
|
||||
AC_AP_TYPE_SLOT2 = BIT(2), ///< Slot 2 in System Settings.
|
||||
AC_AP_TYPE_SLOT3 = BIT(3), ///< Slot 3 in System Settings.
|
||||
|
||||
AC_AP_TYPE_ALL = 0x7FFFFFFF, ///< All access point types allowed.
|
||||
};
|
||||
|
||||
/// Struct to contain the data for connecting to a Wifi network from a stored slot.
|
||||
typedef struct {
|
||||
u8 reserved[0x200];
|
||||
} acuConfig;
|
||||
|
||||
/// Initializes AC.
|
||||
Result acInit(void);
|
||||
|
||||
/// Exits AC.
|
||||
void acExit(void);
|
||||
|
||||
/// Gets the current AC session handle.
|
||||
Handle *acGetSessionHandle(void);
|
||||
|
||||
/// Waits for the system to connect to the internet.
|
||||
Result acWaitInternetConnection(void);
|
||||
|
||||
/**
|
||||
* @brief Describes the access point the console is currently connected to with AC_AP_TYPE_* flags.
|
||||
* @param out Pointer to output the combination of AC_AP_TYPE_* flags describing the AP to.
|
||||
* @brief Gets the current Wifi status.
|
||||
* @param out Pointer to output the current Wifi status to. (0 = not connected, 1 = O3DS Internet, 2 = N3DS Internet)
|
||||
*/
|
||||
Result ACU_GetWifiStatus(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected Wifi status.
|
||||
* @param out Pointer to output the connected Wifi status to. (1 = not connected, 3 = connected)
|
||||
*/
|
||||
Result ACU_GetStatus(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected Wifi security mode.
|
||||
* @param mode Pointer to output the connected Wifi security mode to. (0 = Open Authentication, 1 = WEP 40-bit, 2 = WEP 104-bit, 3 = WEP 128-bit, 4 = WPA TKIP, 5 = WPA2 TKIP, 6 = WPA AES, 7 = WPA2 AES)
|
||||
*/
|
||||
Result ACU_GetSecurityMode(acSecurityMode *mode);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected Wifi SSID.
|
||||
* @param SSID Pointer to output the connected Wifi SSID to.
|
||||
*/
|
||||
Result ACU_GetSSID(char *SSID);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected Wifi SSID length.
|
||||
* @param out Pointer to output the connected Wifi SSID length to.
|
||||
*/
|
||||
Result ACU_GetSSIDLength(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Determines whether proxy is enabled for the connected network.
|
||||
* @param enable Pointer to output the proxy status to.
|
||||
*/
|
||||
Result ACU_GetProxyEnable(bool *enable);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected network's proxy port.
|
||||
* @param out Pointer to output the proxy port to.
|
||||
*/
|
||||
Result ACU_GetProxyPort(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected network's proxy username.
|
||||
* @param username Pointer to output the proxy username to. (The size must be at least 0x20-bytes)
|
||||
*/
|
||||
Result ACU_GetProxyUserName(char *username);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected network's proxy password.
|
||||
* @param password Pointer to output the proxy password to. (The size must be at least 0x20-bytes)
|
||||
*/
|
||||
Result ACU_GetProxyPassword(char *password);
|
||||
|
||||
/**
|
||||
* @brief Gets the last error to occur during a connection.
|
||||
* @param errorCode Pointer to output the error code to.
|
||||
*/
|
||||
Result ACU_GetLastErrorCode(u32* errorCode);
|
||||
|
||||
/**
|
||||
* @brief Gets the last detailed error to occur during a connection.
|
||||
* @param errorCode Pointer to output the error code to.
|
||||
*/
|
||||
Result ACU_GetLastDetailErrorCode(u32* errorCode);
|
||||
|
||||
/**
|
||||
* @brief Prepares a buffer to hold the configuration data to start a connection.
|
||||
* @param config Pointer to an acuConfig struct to contain the data.
|
||||
*/
|
||||
Result ACU_CreateDefaultConfig(acuConfig* config);
|
||||
|
||||
/**
|
||||
* @brief Sets something that makes the connection reliable.
|
||||
* @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
|
||||
* @param area Always 2 ?
|
||||
*/
|
||||
Result ACU_SetNetworkArea(acuConfig* config, u8 area);
|
||||
|
||||
/**
|
||||
* @brief Sets the slot to use when connecting.
|
||||
* @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
|
||||
* @param type Allowed AP types bitmask, a combination of AC_AP_TYPE_* flags.
|
||||
*/
|
||||
Result ACU_SetAllowApType(acuConfig* config, u8 type);
|
||||
|
||||
/**
|
||||
* @brief Sets something that makes the connection reliable.
|
||||
* @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
|
||||
*/
|
||||
Result ACU_SetRequestEulaVersion(acuConfig* config);
|
||||
|
||||
/**
|
||||
* @brief Starts the connection procedure.
|
||||
* @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
|
||||
* @param connectionHandle Handle created with svcCreateEvent to wait on until the connection succeeds or fails.
|
||||
*/
|
||||
Result ACU_ConnectAsync(const acuConfig* config, Handle connectionHandle);
|
||||
|
||||
/**
|
||||
* @brief Selects the WiFi configuration slot for further ac:i operations.
|
||||
* @param slot WiFi slot (0, 1 or 2).
|
||||
*/
|
||||
Result ACI_LoadNetworkSetting(u32 slot);
|
||||
|
||||
/**
|
||||
* @brief Fetches the SSID of the previously selected WiFi configuration slot.
|
||||
* @param[out] ssid Pointer to the output buffer of size 32B the SSID will be stored in.
|
||||
*/
|
||||
Result ACI_GetNetworkWirelessEssidSecuritySsid(void *ssid);
|
||||
|
@ -4,9 +4,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/services/fs.h>
|
||||
|
||||
/// Contains basic information about a title.
|
||||
/**
|
||||
* @brief Contains basic information about a title.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
u64 titleID; ///< The title's ID.
|
||||
@ -15,70 +15,9 @@ typedef struct
|
||||
u8 unk[6]; ///< Unknown title data.
|
||||
} AM_TitleEntry;
|
||||
|
||||
/// Pending title status mask values.
|
||||
enum
|
||||
{
|
||||
AM_STATUS_MASK_INSTALLING = BIT(0), ///< Titles currently installing.
|
||||
AM_STATUS_MASK_AWAITING_FINALIZATION = BIT(1) ///< Titles awaiting finalization.
|
||||
};
|
||||
|
||||
/// Pending title status values.
|
||||
typedef enum
|
||||
{
|
||||
AM_STATUS_ABORTED = 0x0002, ///< Install aborted.
|
||||
AM_STATUS_SAVED = 0x0003, ///< Title saved, but not installed.
|
||||
AM_STATUS_INSTALL_IN_PROGRESS = 0x0802, ///< Install in progress.
|
||||
AM_STATUS_AWAITING_FINALIZATION = 0x0803 ///< Awaiting finalization.
|
||||
} AM_InstallStatus;
|
||||
|
||||
// Contains basic information about a pending title.
|
||||
typedef struct
|
||||
{
|
||||
u64 titleId; ///< Title ID
|
||||
u16 version; ///< Version
|
||||
u16 status; ///< @ref AM_InstallStatus
|
||||
u32 titleType; ///< Title Type
|
||||
u8 unk[0x8]; ///< Unknown
|
||||
} AM_PendingTitleEntry;
|
||||
|
||||
/// Pending title deletion flags.
|
||||
enum
|
||||
{
|
||||
AM_DELETE_PENDING_NON_SYSTEM = BIT(0), ///< Non-system titles.
|
||||
AM_DELETE_PENDING_SYSTEM = BIT(1) ///< System titles.
|
||||
};
|
||||
|
||||
/// Information about the TWL NAND partition.
|
||||
typedef struct {
|
||||
u64 capacity; ///< Total capacity.
|
||||
u64 freeSpace; ///< Total free space.
|
||||
u64 titlesCapacity; ///< Capacity for titles.
|
||||
u64 titlesFreeSpace; ///< Free space for titles.
|
||||
} AM_TWLPartitionInfo;
|
||||
|
||||
/// Contains information about a title's content.
|
||||
typedef struct {
|
||||
u16 index; ///< Index of the content in the title.
|
||||
u16 type; ///< ?
|
||||
u32 contentId; ///< ID of the content in the title.
|
||||
u64 size; ///< Size of the content in the title.
|
||||
u8 flags; ///< @ref AM_ContentInfoFlags
|
||||
u8 padding[7]; ///< Padding
|
||||
} AM_ContentInfo;
|
||||
|
||||
/// Title ContentInfo flags.
|
||||
typedef enum
|
||||
{
|
||||
AM_CONTENT_DOWNLOADED = BIT(0), ///< ?
|
||||
AM_CONTENT_OWNED = BIT(1) ///< ?
|
||||
} AM_ContentInfoFlags;
|
||||
|
||||
/// Initializes AM. This doesn't initialize with "am:app", see amAppInit().
|
||||
/// Initializes AM.
|
||||
Result amInit(void);
|
||||
|
||||
/// Initializes AM with a service which has access to the amapp-commands. This should only be used when using the amapp commands, not non-amapp AM commands.
|
||||
Result amAppInit(void);
|
||||
|
||||
/// Exits AM.
|
||||
void amExit(void);
|
||||
|
||||
@ -86,71 +25,19 @@ void amExit(void);
|
||||
Handle *amGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of titles for a given media type.
|
||||
* @param mediatype Media type to get titles from.
|
||||
* @param[out] count Pointer to write the title count to.
|
||||
* @brief Gets the number of titles for a given mediatype.
|
||||
* @param mediatype Mediatype to get titles from.
|
||||
* @param count Pointer to write the title count to.
|
||||
*/
|
||||
Result AM_GetTitleCount(FS_MediaType mediatype, u32 *count);
|
||||
Result AM_GetTitleCount(u8 mediatype, u32 *count);
|
||||
|
||||
/**
|
||||
* @brief Gets a list of title IDs present in a mediatype.
|
||||
* @param[out] titlesRead Pointer to output the number of read titles to.
|
||||
* @param mediatype Media type to get titles from.
|
||||
* @param titleCount Number of title IDs to get.
|
||||
* @param titleIds Buffer to output the retrieved title IDs to.
|
||||
* @param mediatype Mediatype to get titles from.
|
||||
* @param count Number of title IDs to get.
|
||||
* @param titleIDs Buffer to write retrieved title IDs to.
|
||||
*/
|
||||
Result AM_GetTitleList(u32* titlesRead, FS_MediaType mediatype, u32 titleCount, u64 *titleIds);
|
||||
|
||||
/**
|
||||
* @brief Gets a list of details about installed titles.
|
||||
* @param mediatype Media type to get titles from.
|
||||
* @param titleCount Number of titles to list.
|
||||
* @param titleIds List of title IDs to retrieve details for.
|
||||
* @param titleInfo Buffer to write AM_TitleEntry's to.
|
||||
*/
|
||||
Result AM_GetTitleInfo(FS_MediaType mediatype, u32 titleCount, u64 *titleIds, AM_TitleEntry *titleInfo);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of tickets installed on the system.
|
||||
* @param[out] count Pointer to output the ticket count to.
|
||||
*/
|
||||
Result AM_GetTicketCount(u32 *count);
|
||||
|
||||
/**
|
||||
* @brief Gets a list of tickets installed on the system.
|
||||
* @param[out] ticketsRead Pointer to output the number of read tickets to.
|
||||
* @param ticketCount Number of tickets to read.
|
||||
* @param skip Number of tickets to skip.
|
||||
* @param ticketIds Buffer to output the retrieved ticket IDs to.
|
||||
*/
|
||||
Result AM_GetTicketList(u32 *ticketsRead, u32 ticketCount, u32 skip, u64 *ticketIds);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of pending titles on this system.
|
||||
* @param[out] count Pointer to output the pending title count to.
|
||||
* @param mediatype Media type of pending titles to count.
|
||||
* @param statusMask Bit mask of status values to include.
|
||||
*/
|
||||
Result AM_GetPendingTitleCount(u32 *count, FS_MediaType mediatype, u32 statusMask);
|
||||
|
||||
/**
|
||||
* @brief Gets a list of pending titles on this system.
|
||||
* @param[out] titlesRead Pointer to output the number of read pending titles to.
|
||||
* @param titleCount Number of pending titles to read.
|
||||
* @param mediatype Media type of pending titles to list.
|
||||
* @param statusMask Bit mask of status values to include.
|
||||
* @param titleIds Buffer to output the retrieved pending title IDs to.
|
||||
*/
|
||||
Result AM_GetPendingTitleList(u32 *titlesRead, u32 titleCount, FS_MediaType mediatype, u32 statusMask, u64 *titleIds);
|
||||
|
||||
/**
|
||||
* @brief Gets information about pending titles on this system.
|
||||
* @param titleCount Number of pending titles to read.
|
||||
* @param mediatype Media type of pending titles to get information on.
|
||||
* @param titleIds IDs of the titles to get information about.
|
||||
* @param titleInfo Buffer to output the retrieved pending title info to.
|
||||
*/
|
||||
Result AM_GetPendingTitleInfo(u32 titleCount, FS_MediaType mediatype, u64 *titleIds, AM_PendingTitleEntry *titleInfo);
|
||||
Result AM_GetTitleIdList(u8 mediatype, u32 count, u64 *titleIDs);
|
||||
|
||||
/**
|
||||
* @brief Gets a 32-bit device-specific ID.
|
||||
@ -159,198 +46,75 @@ Result AM_GetPendingTitleInfo(u32 titleCount, FS_MediaType mediatype, u64 *title
|
||||
Result AM_GetDeviceId(u32 *deviceID);
|
||||
|
||||
/**
|
||||
* @brief Exports DSiWare to the specified filepath.
|
||||
* @param titleID TWL titleID.
|
||||
* @param operation DSiWare operation type.
|
||||
* @param workbuf Work buffer.
|
||||
* @param workbuf_size Work buffer size, must be >=0x20000.
|
||||
* @param filepath UTF-8 filepath(converted to UTF-16 internally).
|
||||
* @brief Gets a list of details about installed titles.
|
||||
* @param mediatype Mediatype to get titles from.
|
||||
* @param titleCount Number of titles to list.
|
||||
* @param titleIdList List of title IDs to retrieve details for.
|
||||
* @param titleList Buffer to write AM_TitleEntry's to.
|
||||
*/
|
||||
Result AM_ExportTwlBackup(u64 titleID, u8 operation, void* workbuf, u32 workbuf_size, const char *filepath);
|
||||
|
||||
/**
|
||||
* @brief Imports DSiWare from the specified file.
|
||||
* @param filehandle FSUSER file handle.
|
||||
* @param operation DSiWare operation type.
|
||||
* @param buffer Work buffer.
|
||||
* @param size Buffer size, must be >=0x20000.
|
||||
*/
|
||||
Result AM_ImportTwlBackup(Handle filehandle, u8 operation, void* buffer, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Reads info from the specified DSiWare export file. This can only be used with DSiWare exported with certain operation value(s).
|
||||
* @param filehandle FSUSER file handle.
|
||||
* @param outinfo Output info buffer.
|
||||
* @param outinfo_size Output info buffer size.
|
||||
* @param workbuf Work buffer.
|
||||
* @param workbuf_size Work buffer size.
|
||||
* @param banner Output banner buffer.
|
||||
* @param banner_size Output banner buffer size.
|
||||
*/
|
||||
Result AM_ReadTwlBackupInfo(Handle filehandle, void* outinfo, u32 outinfo_size, void* workbuf, u32 workbuf_size, void* banner, u32 banner_size);
|
||||
|
||||
/**
|
||||
* @brief Retrieves information about the NAND TWL partition.
|
||||
* @param[out] info Pointer to output the TWL partition info to.
|
||||
*/
|
||||
Result AM_GetTWLPartitionInfo(AM_TWLPartitionInfo *info);
|
||||
Result AM_ListTitles(u8 mediatype, u32 titleCount, u64 *titleIdList, AM_TitleEntry *titleList);
|
||||
|
||||
/**
|
||||
* @brief Initializes the CIA install process, returning a handle to write CIA data to.
|
||||
* @param mediatype Media type to install the CIA to.
|
||||
* @param[out] ciaHandle Pointer to write the CIA handle to.
|
||||
* @param mediatype Mediatype to install the CIA to.
|
||||
* @param ciaHandle Pointer to write the CIA handle to.
|
||||
*/
|
||||
Result AM_StartCiaInstall(FS_MediaType mediatype, Handle *ciaHandle);
|
||||
Result AM_StartCiaInstall(u8 mediatype, Handle *ciaHandle);
|
||||
|
||||
/**
|
||||
* @brief Initializes the CIA install process for Download Play CIAs, returning a handle to write CIA data to.
|
||||
* @param[out] ciaHandle Pointer to write the CIA handle to.
|
||||
* @param ciaHandle Pointer to write the CIA handle to.
|
||||
*/
|
||||
Result AM_StartDlpChildCiaInstall(Handle *ciaHandle);
|
||||
|
||||
/**
|
||||
* @brief Aborts the CIA install process.
|
||||
* @param ciaHandle CIA handle to cancel.
|
||||
* @param ciaHandle Pointer to the CIA handle to cancel.
|
||||
*/
|
||||
Result AM_CancelCIAInstall(Handle ciaHandle);
|
||||
Result AM_CancelCIAInstall(Handle *ciaHandle);
|
||||
|
||||
/**
|
||||
* @brief Finalizes the CIA install process.
|
||||
* @param ciaHandle CIA handle to finalize.
|
||||
* @param mediatype Mediatype to install the CIA to.
|
||||
* @param ciaHandle Pointer to the CIA handle to finalize.
|
||||
*/
|
||||
Result AM_FinishCiaInstall(Handle ciaHandle);
|
||||
|
||||
/**
|
||||
* @brief Finalizes the CIA install process without committing the title to title.db or tmp*.db.
|
||||
* @param ciaHandle CIA handle to finalize.
|
||||
*/
|
||||
Result AM_FinishCiaInstallWithoutCommit(Handle ciaHandle);
|
||||
|
||||
/**
|
||||
* @brief Commits installed CIAs.
|
||||
* @param mediaType Location of the titles to finalize.
|
||||
* @param titleCount Number of titles to finalize.
|
||||
* @param temp Whether the titles being finalized are in the temporary database.
|
||||
* @param titleIds Title IDs to finalize.
|
||||
*/
|
||||
Result AM_CommitImportPrograms(FS_MediaType mediaType, u32 titleCount, bool temp, const u64* titleIds);
|
||||
Result AM_FinishCiaInstall(u8 mediatype, Handle *ciaHandle);
|
||||
|
||||
/**
|
||||
* @brief Deletes a title.
|
||||
* @param mediatype Media type to delete from.
|
||||
* @param mediatype Mediatype to delete from.
|
||||
* @param titleID ID of the title to delete.
|
||||
*/
|
||||
Result AM_DeleteTitle(FS_MediaType mediatype, u64 titleID);
|
||||
Result AM_DeleteTitle(u8 mediatype, u64 titleID);
|
||||
|
||||
/**
|
||||
* @brief Deletes a title, provided that it is not a system title.
|
||||
* @param mediatype Media type to delete from.
|
||||
* @param mediatype Mediatype to delete from.
|
||||
* @param titleID ID of the title to delete.
|
||||
*/
|
||||
Result AM_DeleteAppTitle(FS_MediaType mediatype, u64 titleID);
|
||||
|
||||
/**
|
||||
* @brief Deletes a ticket.
|
||||
* @param titleID ID of the ticket to delete.
|
||||
*/
|
||||
Result AM_DeleteTicket(u64 ticketId);
|
||||
|
||||
/**
|
||||
* @brief Deletes a pending title.
|
||||
* @param mediatype Media type to delete from.
|
||||
* @param titleId ID of the pending title to delete.
|
||||
*/
|
||||
Result AM_DeletePendingTitle(FS_MediaType mediatype, u64 titleId);
|
||||
|
||||
/**
|
||||
* @brief Deletes pending titles.
|
||||
* @param mediatype Media type to delete from.
|
||||
* @param flags Flags used to select pending titles.
|
||||
*/
|
||||
Result AM_DeletePendingTitles(FS_MediaType mediatype, u32 flags);
|
||||
|
||||
/**
|
||||
* @brief Deletes all pending titles.
|
||||
* @param mediatype Media type to delete from.
|
||||
*/
|
||||
Result AM_DeleteAllPendingTitles(FS_MediaType mediatype);
|
||||
Result AM_DeleteAppTitle(u8 mediatype, u64 titleID);
|
||||
|
||||
/// Installs the current NATIVE_FIRM title to NAND (firm0:/ & firm1:/)
|
||||
Result AM_InstallNativeFirm(void);
|
||||
|
||||
/**
|
||||
* @brief Installs a NATIVE_FIRM title to NAND. Accepts 0004013800000002 or 0004013820000002 (N3DS).
|
||||
* @param titleID Title ID of the NATIVE_FIRM to install.
|
||||
*/
|
||||
/// Similar to InstallNativeFirm, but doesn't use AMPXI_GetTitleList (NATIVE_FIRM: 0004013800000002 or 0004013820000002 (N3DS))
|
||||
Result AM_InstallFirm(u64 titleID);
|
||||
|
||||
/**
|
||||
* @brief Gets the product code of a title.
|
||||
* @param mediatype Media type of the title.
|
||||
* @param mediatype Mediatype of the title.
|
||||
* @param titleID ID of the title.
|
||||
* @param[out] productCode Pointer to output the product code to. (length = 16)
|
||||
* @param productCode Buffer to output the product code to. (length = 16)
|
||||
*/
|
||||
Result AM_GetTitleProductCode(FS_MediaType mediatype, u64 titleId, char *productCode);
|
||||
|
||||
/**
|
||||
* @brief Gets the ext data ID of a title.
|
||||
* @param[out] extDataId Pointer to output the ext data ID to.
|
||||
* @param mediatype Media type of the title.
|
||||
* @param titleID ID of the title.
|
||||
*/
|
||||
Result AM_GetTitleExtDataId(u64 *extDataId, FS_MediaType mediatype, u64 titleId);
|
||||
Result AM_GetTitleProductCode(u8 mediatype, u64 titleID, char* productCode);
|
||||
|
||||
/**
|
||||
* @brief Gets an AM_TitleEntry instance for a CIA file.
|
||||
* @param mediatype Media type that this CIA would be installed to.
|
||||
* @param[out] titleEntry Pointer to write the AM_TitleEntry instance to.
|
||||
* @param fileHandle Handle of the CIA file.
|
||||
* @param mediatype Mediatype that this CIA would be installed to.
|
||||
* @param titleEntry Pointer to write the AM_TitleEntry instance to.
|
||||
* @param fileHandle Handle of the CIA file to read.
|
||||
*/
|
||||
Result AM_GetCiaFileInfo(FS_MediaType mediatype, AM_TitleEntry *titleEntry, Handle fileHandle);
|
||||
|
||||
/**
|
||||
* @brief Gets the SMDH icon data of a CIA file.
|
||||
* @param icon Buffer to store the icon data in. Must be of size 0x36C0 bytes.
|
||||
* @param fileHandle Handle of the CIA file.
|
||||
*/
|
||||
Result AM_GetCiaIcon(void *icon, Handle fileHandle);
|
||||
|
||||
/**
|
||||
* @brief Gets the title ID dependency list of a CIA file.
|
||||
* @param dependencies Buffer to store dependency title IDs in. Must be of size 0x300 bytes.
|
||||
* @param fileHandle Handle of the CIA file.
|
||||
*/
|
||||
Result AM_GetCiaDependencies(u64 *dependencies, Handle fileHandle);
|
||||
|
||||
/**
|
||||
* @brief Gets the meta section offset of a CIA file.
|
||||
* @param[out] metaOffset Pointer to output the meta section offset to.
|
||||
* @param fileHandle Handle of the CIA file.
|
||||
*/
|
||||
Result AM_GetCiaMetaOffset(u64 *metaOffset, Handle fileHandle);
|
||||
|
||||
/**
|
||||
* @brief Gets the core version of a CIA file.
|
||||
* @param[out] coreVersion Pointer to output the core version to.
|
||||
* @param fileHandle Handle of the CIA file.
|
||||
*/
|
||||
Result AM_GetCiaCoreVersion(u32 *coreVersion, Handle fileHandle);
|
||||
|
||||
/**
|
||||
* @brief Gets the free space, in bytes, required to install a CIA file.
|
||||
* @param[out] requiredSpace Pointer to output the required free space to.
|
||||
* @param mediaType Media type to check free space needed to install to.
|
||||
* @param fileHandle Handle of the CIA file.
|
||||
*/
|
||||
Result AM_GetCiaRequiredSpace(u64 *requiredSpace, FS_MediaType mediaType, Handle fileHandle);
|
||||
|
||||
/**
|
||||
* @brief Gets the full meta section of a CIA file.
|
||||
* @param meta Buffer to store the meta section in.
|
||||
* @param size Size of the buffer. Must be greater than or equal to the actual section data's size.
|
||||
* @param fileHandle Handle of the CIA file.
|
||||
*/
|
||||
Result AM_GetCiaMetaSection(void *meta, u32 size, Handle fileHandle);
|
||||
Result AM_GetCiaFileInfo(u8 mediatype, AM_TitleEntry *titleEntry, Handle fileHandle);
|
||||
|
||||
/**
|
||||
* @brief Initializes the external (SD) title database.
|
||||
@ -363,176 +127,3 @@ Result AM_InitializeExternalTitleDatabase(bool overwrite);
|
||||
* @param[out] available Pointer to output the availability status to.
|
||||
*/
|
||||
Result AM_QueryAvailableExternalTitleDatabase(bool* available);
|
||||
|
||||
/**
|
||||
* @brief Begins installing a ticket.
|
||||
* @param[out] ticketHandle Pointer to output a handle to write ticket data to.
|
||||
*/
|
||||
Result AM_InstallTicketBegin(Handle *ticketHandle);
|
||||
|
||||
/**
|
||||
* @brief Aborts installing a ticket.
|
||||
* @param ticketHandle Handle of the installation to abort.
|
||||
*/
|
||||
Result AM_InstallTicketAbort(Handle ticketHandle);
|
||||
|
||||
/**
|
||||
* @brief Finishes installing a ticket.
|
||||
* @param ticketHandle Handle of the installation to finalize.
|
||||
*/
|
||||
Result AM_InstallTicketFinish(Handle ticketHandle);
|
||||
|
||||
/**
|
||||
* @brief Begins installing a title.
|
||||
* @param mediaType Destination to install to.
|
||||
* @param titleId ID of the title to install.
|
||||
* @param unk Unknown. (usually false)
|
||||
*/
|
||||
Result AM_InstallTitleBegin(FS_MediaType mediaType, u64 titleId, bool unk);
|
||||
|
||||
/// Stops installing a title, generally to be resumed later.
|
||||
Result AM_InstallTitleStop(void);
|
||||
|
||||
/**
|
||||
* @brief Resumes installing a title.
|
||||
* @param mediaType Destination to install to.
|
||||
* @param titleId ID of the title to install.
|
||||
*/
|
||||
Result AM_InstallTitleResume(FS_MediaType mediaType, u64 titleId);
|
||||
|
||||
/// Aborts installing a title.
|
||||
Result AM_InstallTitleAbort(void);
|
||||
|
||||
/// Finishes installing a title.
|
||||
Result AM_InstallTitleFinish(void);
|
||||
|
||||
/**
|
||||
* @brief Commits installed titles.
|
||||
* @param mediaType Location of the titles to finalize.
|
||||
* @param titleCount Number of titles to finalize.
|
||||
* @param temp Whether the titles being finalized are in the temporary database.
|
||||
* @param titleIds Title IDs to finalize.
|
||||
*/
|
||||
Result AM_CommitImportTitles(FS_MediaType mediaType, u32 titleCount, bool temp, const u64* titleIds);
|
||||
|
||||
/**
|
||||
* @brief Begins installing a TMD.
|
||||
* @param[out] tmdHandle Pointer to output a handle to write TMD data to.
|
||||
*/
|
||||
Result AM_InstallTmdBegin(Handle *tmdHandle);
|
||||
|
||||
/**
|
||||
* @brief Aborts installing a TMD.
|
||||
* @param tmdHandle Handle of the installation to abort.
|
||||
*/
|
||||
Result AM_InstallTmdAbort(Handle tmdHandle);
|
||||
|
||||
/**
|
||||
* @brief Finishes installing a TMD.
|
||||
* @param tmdHandle Handle of the installation to finalize.
|
||||
* @param unk Unknown. (usually true)
|
||||
*/
|
||||
Result AM_InstallTmdFinish(Handle tmdHandle, bool unk);
|
||||
|
||||
/**
|
||||
* @brief Prepares to import title contents.
|
||||
* @param contentCount Number of contents to be imported.
|
||||
* @param contentIndices Indices of the contents to be imported.
|
||||
*/
|
||||
Result AM_CreateImportContentContexts(u32 contentCount, u16* contentIndices);
|
||||
|
||||
/**
|
||||
* @brief Begins installing title content.
|
||||
* @param[out] contentHandle Pointer to output a handle to write content data to.
|
||||
* @param index Index of the content to install.
|
||||
*/
|
||||
Result AM_InstallContentBegin(Handle *contentHandle, u16 index);
|
||||
|
||||
/**
|
||||
* @brief Stops installing title content, generally to be resumed later.
|
||||
* @param contentHandle Handle of the installation to abort.
|
||||
*/
|
||||
Result AM_InstallContentStop(Handle contentHandle);
|
||||
|
||||
/**
|
||||
* @brief Resumes installing title content.
|
||||
* @param[out] contentHandle Pointer to output a handle to write content data to.
|
||||
* @param[out] resumeOffset Pointer to write the offset to resume content installation at to.
|
||||
* @param index Index of the content to install.
|
||||
*/
|
||||
Result AM_InstallContentResume(Handle *contentHandle, u64* resumeOffset, u16 index);
|
||||
|
||||
/**
|
||||
* @brief Cancels installing title content.
|
||||
* @param contentHandle Handle of the installation to finalize.
|
||||
*/
|
||||
Result AM_InstallContentCancel(Handle contentHandle);
|
||||
|
||||
/**
|
||||
* @brief Finishes installing title content.
|
||||
* @param contentHandle Handle of the installation to finalize.
|
||||
*/
|
||||
Result AM_InstallContentFinish(Handle contentHandle);
|
||||
|
||||
/**
|
||||
* @brief Imports up to four certificates into the ticket certificate chain.
|
||||
* @param cert1Size Size of the first certificate.
|
||||
* @param cert1 Data of the first certificate.
|
||||
* @param cert2Size Size of the second certificate.
|
||||
* @param cert2 Data of the second certificate.
|
||||
* @param cert3Size Size of the third certificate.
|
||||
* @param cert3 Data of the third certificate.
|
||||
* @param cert4Size Size of the fourth certificate.
|
||||
* @param cert4 Data of the fourth certificate.
|
||||
*/
|
||||
Result AM_ImportCertificates(u32 cert1Size, void* cert1, u32 cert2Size, void* cert2, u32 cert3Size, void* cert3, u32 cert4Size, void* cert4);
|
||||
|
||||
/**
|
||||
* @brief Imports a certificate into the ticket certificate chain.
|
||||
* @param certSize Size of the certificate.
|
||||
* @param cert Data of the certificate.
|
||||
*/
|
||||
Result AM_ImportCertificate(u32 certSize, void* cert);
|
||||
|
||||
/**
|
||||
* @brief Commits installed titles, and updates FIRM if necessary.
|
||||
* @param mediaType Location of the titles to finalize.
|
||||
* @param titleCount Number of titles to finalize.
|
||||
* @param temp Whether the titles being finalized are in the temporary database.
|
||||
* @param titleIds Title IDs to finalize.
|
||||
*/
|
||||
Result AM_CommitImportTitlesAndUpdateFirmwareAuto(FS_MediaType mediaType, u32 titleCount, bool temp, u64* titleIds);
|
||||
|
||||
/// Resets play count of all installed demos by deleting their launch info.
|
||||
Result AM_DeleteAllDemoLaunchInfos(void);
|
||||
|
||||
/// Deletes temporary titles.
|
||||
Result AM_DeleteAllTemporaryTitles(void);
|
||||
|
||||
/**
|
||||
* @brief Deletes all expired titles.
|
||||
* @param mediatype Media type to delete from.
|
||||
*/
|
||||
Result AM_DeleteAllExpiredTitles(FS_MediaType mediatype);
|
||||
|
||||
/// Deletes all TWL titles.
|
||||
Result AM_DeleteAllTwlTitles(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of content index installed under the specified DLC title.
|
||||
* @param[out] count Pointer to output the number of content indices to.
|
||||
* @param mediatype Media type of the title.
|
||||
* @param titleID Title ID to retrieve the count for (high-id is 0x0004008C).
|
||||
*/
|
||||
Result AMAPP_GetDLCContentInfoCount(u32* count, FS_MediaType mediatype, u64 titleID);
|
||||
|
||||
/**
|
||||
* @brief Gets content infos installed under the specified DLC title.
|
||||
* @param[out] contentInfoRead Pointer to output the number of content infos read to.
|
||||
* @param mediatype Media type of the title.
|
||||
* @param titleID Title ID to retrieve the content infos for (high-id is 0x0004008C).
|
||||
* @param contentInfoCount Number of content infos to retrieve.
|
||||
* @param offset Offset from the first content index the count starts at.
|
||||
* @param[out] contentInfos Pointer to output the content infos read to.
|
||||
*/
|
||||
Result AMAPP_ListDLCContentInfos(u32* contentInfoRead, FS_MediaType mediatype, u64 titleID, u32 contentInfoCount, u32 offset, AM_ContentInfo* contentInfos);
|
||||
|
@ -1,35 +0,0 @@
|
||||
/**
|
||||
* @file ampxi.h
|
||||
* @brief AMPXI service. This is normally not accessible to userland apps. https://3dbrew.org/wiki/Application_Manager_Services_PXI
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @brief Initializes AMPXI.
|
||||
* @param servhandle Optional service session handle to use for AMPXI, if zero srvGetServiceHandle() will be used.
|
||||
*/
|
||||
Result ampxiInit(Handle servhandle);
|
||||
|
||||
/// Exits AMPXI.
|
||||
void ampxiExit(void);
|
||||
|
||||
/**
|
||||
* @brief Writes a TWL save-file to NAND. https://www.3dbrew.org/wiki/AMPXI:WriteTWLSavedata
|
||||
* @param titleid ID of the TWL title.
|
||||
* @param buffer Savedata buffer ptr.
|
||||
* @param size Size of the savedata buffer.
|
||||
* @param image_filepos Filepos to use for writing the data to the NAND savedata file.
|
||||
* @param section_type https://www.3dbrew.org/wiki/AMPXI:WriteTWLSavedata
|
||||
* @param operation https://3dbrew.org/wiki/AM:ImportDSiWare
|
||||
*/
|
||||
Result AMPXI_WriteTWLSavedata(u64 titleid, u8 *buffer, u32 size, u32 image_filepos, u8 section_type, u8 operation);
|
||||
|
||||
/**
|
||||
* @brief Finalizes title installation. https://3dbrew.org/wiki/AMPXI:InstallTitlesFinish
|
||||
* @param mediaType Mediatype of the titles to finalize.
|
||||
* @param db Which title database to use.
|
||||
* @param size Size of the savedata buffer.
|
||||
* @param titlecount Total titles.
|
||||
* @param tidlist List of titleIDs.
|
||||
*/
|
||||
Result AMPXI_InstallTitlesFinish(FS_MediaType mediaType, u8 db, u32 titlecount, u64 *tidlist);
|
@ -10,7 +10,6 @@
|
||||
* Retrieved from http://3dbrew.org/wiki/NS_and_APT_Services#AppIDs
|
||||
*/
|
||||
typedef enum {
|
||||
APPID_NONE = 0,
|
||||
APPID_HOMEMENU = 0x101, ///< Home Menu
|
||||
APPID_CAMERA = 0x110, ///< Camera applet
|
||||
APPID_FRIENDS_LIST = 0x112, ///< Friends List applet
|
||||
@ -33,84 +32,34 @@ typedef enum {
|
||||
APPID_MEMOLIB = 0x409, ///< memolib
|
||||
} NS_APPID;
|
||||
|
||||
/// APT applet position.
|
||||
/// App status values.
|
||||
typedef enum {
|
||||
APTPOS_NONE = -1, ///< No position specified.
|
||||
APTPOS_APP = 0, ///< Application.
|
||||
APTPOS_APPLIB = 1, ///< Application library (?).
|
||||
APTPOS_SYS = 2, ///< System applet.
|
||||
APTPOS_SYSLIB = 3, ///< System library (?).
|
||||
APTPOS_RESIDENT = 4, ///< Resident applet.
|
||||
} APT_AppletPos;
|
||||
|
||||
typedef u8 APT_AppletAttr;
|
||||
|
||||
struct PtmWakeEvents;
|
||||
|
||||
/// Create an APT_AppletAttr bitfield from its components.
|
||||
static inline APT_AppletAttr aptMakeAppletAttr(APT_AppletPos pos, bool manualGpuRights, bool manualDspRights)
|
||||
{
|
||||
return (pos&7) | (manualGpuRights ? BIT(3) : 0) | (manualDspRights ? BIT(4) : 0);
|
||||
}
|
||||
|
||||
/// APT query reply.
|
||||
typedef enum {
|
||||
APTREPLY_REJECT = 0,
|
||||
APTREPLY_ACCEPT = 1,
|
||||
APTREPLY_LATER = 2,
|
||||
} APT_QueryReply;
|
||||
APP_NOTINITIALIZED, ///< App not initialized.
|
||||
APP_RUNNING, ///< App running.
|
||||
APP_SUSPENDED, ///< App suspended.
|
||||
APP_EXITING, ///< App exiting.
|
||||
APP_SUSPENDING, ///< App suspending.
|
||||
APP_SLEEPMODE, ///< App in sleep mode.
|
||||
APP_PREPARE_SLEEPMODE, ///< App preparing to enter sleep mode.
|
||||
APP_APPLETSTARTED, ///< Applet started.
|
||||
APP_APPLETCLOSED ///< Applet closed.
|
||||
} APT_AppStatus;
|
||||
|
||||
/// APT signals.
|
||||
typedef enum {
|
||||
APTSIGNAL_NONE = 0, ///< No signal received.
|
||||
APTSIGNAL_HOMEBUTTON = 1, ///< HOME button pressed.
|
||||
APTSIGNAL_HOMEBUTTON2 = 2, ///< HOME button pressed (again?).
|
||||
APTSIGNAL_SLEEP_QUERY = 3, ///< Prepare to enter sleep mode.
|
||||
APTSIGNAL_SLEEP_CANCEL = 4, ///< Triggered when ptm:s GetShellStatus() returns 5.
|
||||
APTSIGNAL_SLEEP_ENTER = 5, ///< Enter sleep mode.
|
||||
APTSIGNAL_SLEEP_WAKEUP = 6, ///< Wake from sleep mode.
|
||||
APTSIGNAL_SHUTDOWN = 7, ///< Shutdown.
|
||||
APTSIGNAL_POWERBUTTON = 8, ///< POWER button pressed.
|
||||
APTSIGNAL_POWERBUTTON2 = 9, ///< POWER button cleared (?).
|
||||
APTSIGNAL_TRY_SLEEP = 10, ///< System sleeping (?).
|
||||
APTSIGNAL_ORDERTOCLOSE = 11, ///< Order to close (such as when an error happens?).
|
||||
APTSIGNAL_HOMEBUTTON = 1, ///< Home button pressed.
|
||||
// 2: sleep-mode related?
|
||||
APTSIGNAL_PREPARESLEEP = 3, ///< Prepare to enter sleep mode.
|
||||
// 4: triggered when ptm:s GetShellStatus() returns 5.
|
||||
APTSIGNAL_ENTERSLEEP = 5, ///< Enter sleep mode.
|
||||
APTSIGNAL_WAKEUP = 6, ///< Wake from sleep mode.
|
||||
APTSIGNAL_ENABLE = 7, ///< Enable.
|
||||
APTSIGNAL_POWERBUTTON = 8, ///< Power button pressed.
|
||||
APTSIGNAL_UTILITY = 9, ///< Utility called.
|
||||
APTSIGNAL_SLEEPSYSTEM = 10, ///< System sleeping.
|
||||
APTSIGNAL_ERROR = 11 ///< Error occurred.
|
||||
} APT_Signal;
|
||||
|
||||
/// APT commands.
|
||||
typedef enum {
|
||||
APTCMD_NONE = 0, ///< No command received.
|
||||
APTCMD_WAKEUP = 1, ///< Applet should wake up.
|
||||
APTCMD_REQUEST = 2, ///< Source applet sent us a parameter.
|
||||
APTCMD_RESPONSE = 3, ///< Target applet replied to our parameter.
|
||||
APTCMD_EXIT = 4, ///< Exit (??)
|
||||
APTCMD_MESSAGE = 5, ///< Message (??)
|
||||
APTCMD_HOMEBUTTON_ONCE = 6, ///< HOME button pressed once.
|
||||
APTCMD_HOMEBUTTON_TWICE = 7, ///< HOME button pressed twice (double-pressed).
|
||||
APTCMD_DSP_SLEEP = 8, ///< DSP should sleep (manual DSP rights related?).
|
||||
APTCMD_DSP_WAKEUP = 9, ///< DSP should wake up (manual DSP rights related?).
|
||||
APTCMD_WAKEUP_EXIT = 10, ///< Applet wakes up due to a different applet exiting.
|
||||
APTCMD_WAKEUP_PAUSE = 11, ///< Applet wakes up after being paused through HOME menu.
|
||||
APTCMD_WAKEUP_CANCEL = 12, ///< Applet wakes up due to being cancelled.
|
||||
APTCMD_WAKEUP_CANCELALL = 13, ///< Applet wakes up due to all applets being cancelled.
|
||||
APTCMD_WAKEUP_POWERBUTTON = 14, ///< Applet wakes up due to POWER button being pressed (?).
|
||||
APTCMD_WAKEUP_JUMPTOHOME = 15, ///< Applet wakes up and is instructed to jump to HOME menu (?).
|
||||
APTCMD_SYSAPPLET_REQUEST = 16, ///< Request for sysapplet (?).
|
||||
APTCMD_WAKEUP_LAUNCHAPP = 17, ///< Applet wakes up and is instructed to launch another applet (?).
|
||||
} APT_Command;
|
||||
|
||||
/// APT capture buffer information.
|
||||
typedef struct
|
||||
{
|
||||
u32 size;
|
||||
u32 is3D;
|
||||
struct
|
||||
{
|
||||
u32 leftOffset;
|
||||
u32 rightOffset;
|
||||
u32 format;
|
||||
} top, bottom;
|
||||
} aptCaptureBufInfo;
|
||||
|
||||
/// APT hook types.
|
||||
typedef enum {
|
||||
APTHOOK_ONSUSPEND = 0, ///< App suspended.
|
||||
@ -133,8 +82,8 @@ typedef struct tag_aptHookCookie
|
||||
void* param; ///< Callback parameter.
|
||||
} aptHookCookie;
|
||||
|
||||
/// APT message callback.
|
||||
typedef void (*aptMessageCb)(void* user, NS_APPID sender, void* msg, size_t msgsize);
|
||||
/// APT events.
|
||||
extern Handle aptEvents[3];
|
||||
|
||||
/// Initializes APT.
|
||||
Result aptInit(void);
|
||||
@ -142,58 +91,59 @@ Result aptInit(void);
|
||||
/// Exits APT.
|
||||
void aptExit(void);
|
||||
|
||||
/// Opens an APT session.
|
||||
void aptOpenSession(void);
|
||||
|
||||
/// Closes an APT session.
|
||||
void aptCloseSession(void);
|
||||
|
||||
/**
|
||||
* @brief Sends an APT command through IPC, taking care of locking, opening and closing an APT session.
|
||||
* @param aptcmdbuf Pointer to command buffer (should have capacity for at least 16 words).
|
||||
* @brief Sets the app's status.
|
||||
* @param status Status to set.
|
||||
*/
|
||||
Result aptSendCommand(u32* aptcmdbuf);
|
||||
|
||||
/// Returns true if the application is currently in the foreground.
|
||||
bool aptIsActive(void);
|
||||
|
||||
/// Returns true if the system has told the application to close.
|
||||
bool aptShouldClose(void);
|
||||
|
||||
/// Returns true if the system can enter sleep mode while the application is active.
|
||||
bool aptIsSleepAllowed(void);
|
||||
|
||||
/// Configures whether the system can enter sleep mode while the application is active.
|
||||
void aptSetSleepAllowed(bool allowed);
|
||||
|
||||
/// Handles incoming sleep mode requests.
|
||||
void aptHandleSleep(void);
|
||||
|
||||
/// Returns true if the user can press the HOME button to jump back to the HOME menu while the application is active.
|
||||
bool aptIsHomeAllowed(void);
|
||||
|
||||
/// Configures whether the user can press the HOME button to jump back to the HOME menu while the application is active.
|
||||
void aptSetHomeAllowed(bool allowed);
|
||||
|
||||
/// Returns true if the system requires the application to jump back to the HOME menu.
|
||||
bool aptShouldJumpToHome(void);
|
||||
|
||||
/// Returns true if there is an incoming HOME button press rejected by the policy set by \ref aptSetHomeAllowed (use this to show a "no HOME allowed" icon).
|
||||
bool aptCheckHomePressRejected(void);
|
||||
|
||||
/// \deprecated Alias for \ref aptCheckHomePressRejected.
|
||||
static inline CTR_DEPRECATED bool aptIsHomePressed(void)
|
||||
{
|
||||
return aptCheckHomePressRejected();
|
||||
}
|
||||
|
||||
/// Jumps back to the HOME menu.
|
||||
void aptJumpToHomeMenu(void);
|
||||
|
||||
/// Handles incoming jump-to-HOME requests.
|
||||
static inline void aptHandleJumpToHome(void)
|
||||
{
|
||||
if (aptShouldJumpToHome())
|
||||
aptJumpToHomeMenu();
|
||||
}
|
||||
void aptSetStatus(APT_AppStatus status);
|
||||
|
||||
/**
|
||||
* @brief Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every frame.
|
||||
* @return true if the application should keep running, false otherwise (see \ref aptShouldClose).
|
||||
* @brief Gets the app's status.
|
||||
* @return The app's status.
|
||||
*/
|
||||
APT_AppStatus aptGetStatus(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the app's power status.
|
||||
* When the status is APT_SUSPEND, this can be used to check what triggered a return-to-menu.
|
||||
* @return The app's power status. (0 = normal, 1 = power button pressed)
|
||||
*/
|
||||
u32 aptGetStatusPower(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the app's power status.
|
||||
* @param status Power status to set.
|
||||
*/
|
||||
void aptSetStatusPower(u32 status);
|
||||
|
||||
/**
|
||||
* @brief Triggers a return to the home menu.
|
||||
*
|
||||
* This should be called by the user application when aptGetStatus() returns APP_SUSPENDING, not calling this will result in return-to-menu being disabled with the status left at APP_SUSPENDING. This function will not return until the system returns to the application, or when the status was changed to APP_EXITING.
|
||||
*/
|
||||
void aptReturnToMenu(void);
|
||||
|
||||
/// Waits for an APT status event.
|
||||
void aptWaitStatusEvent(void);
|
||||
|
||||
/// Signals that the app is ready to sleep.
|
||||
void aptSignalReadyForSleep(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the menu's app ID.
|
||||
* @return The menu's app ID.
|
||||
*/
|
||||
NS_APPID aptGetMenuAppID(void);
|
||||
|
||||
/**
|
||||
* @brief Processes the current APT status. Generally used within a main loop.
|
||||
* @return Whether the application is closing.
|
||||
*/
|
||||
bool aptMainLoop(void);
|
||||
|
||||
@ -211,48 +161,6 @@ void aptHook(aptHookCookie* cookie, aptHookFn callback, void* param);
|
||||
*/
|
||||
void aptUnhook(aptHookCookie* cookie);
|
||||
|
||||
/**
|
||||
* @brief Sets the function to be called when an APT message from another applet is received.
|
||||
* @param callback Callback function.
|
||||
* @param user User-defined data to be passed to the callback.
|
||||
*/
|
||||
void aptSetMessageCallback(aptMessageCb callback, void* user);
|
||||
|
||||
/**
|
||||
* @brief Launches a library applet.
|
||||
* @param appId ID of the applet to launch.
|
||||
* @param buf Input/output buffer that contains launch parameters on entry and result data on exit.
|
||||
* @param bufsize Size of the buffer.
|
||||
* @param handle Handle to pass to the library applet.
|
||||
*/
|
||||
void aptLaunchLibraryApplet(NS_APPID appId, void* buf, size_t bufsize, Handle handle);
|
||||
|
||||
/// Clears the chainloader state.
|
||||
void aptClearChainloader(void);
|
||||
|
||||
/**
|
||||
* @brief Configures the chainloader to launch a specific application.
|
||||
* @param programID ID of the program to chainload to.
|
||||
* @param mediatype Media type of the program to chainload to.
|
||||
*/
|
||||
void aptSetChainloader(u64 programID, u8 mediatype);
|
||||
|
||||
/// Configures the chainloader to launch the previous application.
|
||||
void aptSetChainloaderToCaller(void);
|
||||
|
||||
/// Configures the chainloader to relaunch the current application (i.e. soft-reset)
|
||||
void aptSetChainloaderToSelf(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the "deliver arg" and HMAC for the chainloader, which will
|
||||
* be passed to the target 3DS/DS(i) application. The meaning of each
|
||||
* parameter varies on a per-application basis.
|
||||
* @param deliverArg Deliver arg to pass to the target application.
|
||||
* @param deliverArgSize Size of the deliver arg, maximum 0x300 bytes.
|
||||
* @param hmac HMAC buffer, 32 bytes. Use NULL to pass an all-zero dummy HMAC.
|
||||
*/
|
||||
void aptSetChainloaderArgs(const void *deliverArg, size_t deliverArgSize, const void *hmac);
|
||||
|
||||
/**
|
||||
* @brief Gets an APT lock handle.
|
||||
* @param flags Flags to use.
|
||||
@ -263,11 +171,10 @@ Result APT_GetLockHandle(u16 flags, Handle* lockHandle);
|
||||
/**
|
||||
* @brief Initializes an application's registration with APT.
|
||||
* @param appId ID of the application.
|
||||
* @param attr Attributes of the application.
|
||||
* @param signalEvent Pointer to output the signal event handle to.
|
||||
* @param resumeEvent Pointer to output the resume event handle to.
|
||||
* @param eventHandle1 Pointer to output the signal event handle to.
|
||||
* @param eventHandle2 Pointer to output the launch and exit event handle to.
|
||||
*/
|
||||
Result APT_Initialize(NS_APPID appId, APT_AppletAttr attr, Handle* signalEvent, Handle* resumeEvent);
|
||||
Result APT_Initialize(NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2);
|
||||
|
||||
/**
|
||||
* @brief Terminates an application's registration with APT.
|
||||
@ -280,41 +187,31 @@ Result APT_HardwareResetAsync(void);
|
||||
|
||||
/**
|
||||
* @brief Enables APT.
|
||||
* @param attr Attributes of the application.
|
||||
* @param a Parameter to enable with.
|
||||
*/
|
||||
Result APT_Enable(APT_AppletAttr attr);
|
||||
Result APT_Enable(u32 a);
|
||||
|
||||
/**
|
||||
* @brief Gets applet management info.
|
||||
* @param inpos Requested applet position.
|
||||
* @param outpos Pointer to output the position of the current applet to.
|
||||
* @param req_appid Pointer to output the AppID of the applet at the requested position to.
|
||||
* @param menu_appid Pointer to output the HOME menu AppID to.
|
||||
* @param active_appid Pointer to output the AppID of the currently active applet to.
|
||||
* @param inval Requested applet type.
|
||||
* @param outval8 Pointer to output the current applet type to.
|
||||
* @param outval32 Pointer to output the requested app ID to.
|
||||
* @param menu_appid Pointer to output the home menu app ID to.
|
||||
* @param active_appid Pointer to output the currently active app ID to.
|
||||
* @param pAttributes Pointer to output the atrributes to.
|
||||
*/
|
||||
Result APT_GetAppletManInfo(APT_AppletPos inpos, APT_AppletPos* outpos, NS_APPID* req_appid, NS_APPID* menu_appid, NS_APPID* active_appid);
|
||||
|
||||
/**
|
||||
* @brief Gets the menu's app ID.
|
||||
* @return The menu's app ID.
|
||||
*/
|
||||
static inline NS_APPID aptGetMenuAppID(void)
|
||||
{
|
||||
NS_APPID menu_appid = APPID_NONE;
|
||||
APT_GetAppletManInfo(APTPOS_NONE, NULL, NULL, &menu_appid, NULL);
|
||||
return menu_appid;
|
||||
}
|
||||
Result APT_GetAppletManInfo(u8 inval, u8 *outval8, u32 *outval32, NS_APPID *menu_appid, NS_APPID *active_appid);
|
||||
|
||||
/**
|
||||
* @brief Gets an applet's information.
|
||||
* @param appID AppID of the applet.
|
||||
* @param appID ID of the applet.
|
||||
* @param pProgramID Pointer to output the program ID to.
|
||||
* @param pMediaType Pointer to output the media type to.
|
||||
* @param pRegistered Pointer to output the registration status to.
|
||||
* @param pLoadState Pointer to output the load state to.
|
||||
* @param pAttributes Pointer to output the applet atrributes to.
|
||||
* @param pAttributes Pointer to output the atrributes to.
|
||||
*/
|
||||
Result APT_GetAppletInfo(NS_APPID appID, u64* pProgramID, u8* pMediaType, bool* pRegistered, bool* pLoadState, APT_AppletAttr* pAttributes);
|
||||
Result APT_GetAppletInfo(NS_APPID appID, u64* pProgramID, u8* pMediaType, u8* pRegistered, u8* pLoadState, u32* pAttributes);
|
||||
|
||||
/**
|
||||
* @brief Gets an applet's program information.
|
||||
@ -347,13 +244,13 @@ Result APT_PrepareToJumpToHomeMenu(void);
|
||||
* @param Size of the parameter buffer.
|
||||
* @param handle Handle to pass.
|
||||
*/
|
||||
Result APT_JumpToHomeMenu(const void* param, size_t paramSize, Handle handle);
|
||||
Result APT_JumpToHomeMenu(const u8 *param, size_t paramSize, Handle handle);
|
||||
|
||||
/**
|
||||
* @brief Prepares to jump to an application.
|
||||
* @param exiting Specifies whether the applet is exiting.
|
||||
* @param a Application to jump to.
|
||||
*/
|
||||
Result APT_PrepareToJumpToApplication(bool exiting);
|
||||
Result APT_PrepareToJumpToApplication(u32 a);
|
||||
|
||||
/**
|
||||
* @brief Jumps to an application.
|
||||
@ -361,14 +258,14 @@ Result APT_PrepareToJumpToApplication(bool exiting);
|
||||
* @param Size of the parameter buffer.
|
||||
* @param handle Handle to pass.
|
||||
*/
|
||||
Result APT_JumpToApplication(const void* param, size_t paramSize, Handle handle);
|
||||
Result APT_JumpToApplication(const u8 *param, size_t paramSize, Handle handle);
|
||||
|
||||
/**
|
||||
* @brief Gets whether an application is registered.
|
||||
* @param appID ID of the application.
|
||||
* @param out Pointer to output the registration state to.
|
||||
*/
|
||||
Result APT_IsRegistered(NS_APPID appID, bool* out);
|
||||
Result APT_IsRegistered(NS_APPID appID, u8* out);
|
||||
|
||||
/**
|
||||
* @brief Inquires as to whether a signal has been received.
|
||||
@ -377,13 +274,6 @@ Result APT_IsRegistered(NS_APPID appID, bool* out);
|
||||
*/
|
||||
Result APT_InquireNotification(u32 appID, APT_Signal* signalType);
|
||||
|
||||
/**
|
||||
* @brief Requests to enter sleep mode, and later sets wake events if allowed to.
|
||||
* @param wakeEvents The wake events. Limited to "shell" (bit 1) for the PDN wake events part
|
||||
* and "shell opened", "shell closed" and "HOME button pressed" for the MCU interrupts part.
|
||||
*/
|
||||
Result APT_SleepSystem(const struct PtmWakeEvents *wakeEvents);
|
||||
|
||||
/**
|
||||
* @brief Notifies an application to wait.
|
||||
* @param appID ID of the application.
|
||||
@ -392,92 +282,59 @@ Result APT_NotifyToWait(NS_APPID appID);
|
||||
|
||||
/**
|
||||
* @brief Calls an applet utility function.
|
||||
* @param id Utility function to call.
|
||||
* @param out Pointer to write output data to.
|
||||
* @param outSize Size of the output buffer.
|
||||
* @param in Pointer to the input data.
|
||||
* @param inSize Size of the input buffer.
|
||||
* @param a Utility function to call.
|
||||
* @param size1 Size of the first buffer.
|
||||
* @param buf1 First buffer.
|
||||
* @param size2 Size of the second buffer.
|
||||
* @param buf2 Second buffer.
|
||||
*/
|
||||
Result APT_AppletUtility(int id, void* out, size_t outSize, const void* in, size_t inSize);
|
||||
|
||||
/// Sleeps if shell is closed (?).
|
||||
Result APT_SleepIfShellClosed(void);
|
||||
|
||||
/**
|
||||
* @brief Locks a transition (?).
|
||||
* @param transition Transition ID.
|
||||
* @param flag Flag (?)
|
||||
*/
|
||||
Result APT_LockTransition(u32 transition, bool flag);
|
||||
|
||||
/**
|
||||
* @brief Tries to lock a transition (?).
|
||||
* @param transition Transition ID.
|
||||
* @param succeeded Pointer to output whether the lock was successfully applied.
|
||||
*/
|
||||
Result APT_TryLockTransition(u32 transition, bool* succeeded);
|
||||
|
||||
/**
|
||||
* @brief Unlocks a transition (?).
|
||||
* @param transition Transition ID.
|
||||
*/
|
||||
Result APT_UnlockTransition(u32 transition);
|
||||
Result APT_AppletUtility(u32* out, u32 a, u32 size1, u8* buf1, u32 size2, u8* buf2);
|
||||
|
||||
/**
|
||||
* @brief Glances at a receieved parameter without removing it from the queue.
|
||||
* @param appID AppID of the application.
|
||||
* @param buffer Buffer to receive to.
|
||||
* @param appID ID of the application.
|
||||
* @param bufferSize Size of the buffer.
|
||||
* @param sender Pointer to output the sender's AppID to.
|
||||
* @param command Pointer to output the command ID to.
|
||||
* @param buffer Buffer to receive to.
|
||||
* @param actualSize Pointer to output the actual received data size to.
|
||||
* @param parameter Pointer to output the parameter handle to.
|
||||
* @param signalType Pointer to output the signal type to.
|
||||
*/
|
||||
Result APT_GlanceParameter(NS_APPID appID, void* buffer, size_t bufferSize, NS_APPID* sender, APT_Command* command, size_t* actualSize, Handle* parameter);
|
||||
Result APT_GlanceParameter(NS_APPID appID, u32 bufferSize, u32* buffer, u32* actualSize, u8* signalType);
|
||||
|
||||
/**
|
||||
* @brief Receives a parameter.
|
||||
* @param appID AppID of the application.
|
||||
* @param buffer Buffer to receive to.
|
||||
* @param appID ID of the application.
|
||||
* @param bufferSize Size of the buffer.
|
||||
* @param sender Pointer to output the sender's AppID to.
|
||||
* @param command Pointer to output the command ID to.
|
||||
* @param buffer Buffer to receive to.
|
||||
* @param actualSize Pointer to output the actual received data size to.
|
||||
* @param parameter Pointer to output the parameter handle to.
|
||||
* @param signalType Pointer to output the signal type to.
|
||||
*/
|
||||
Result APT_ReceiveParameter(NS_APPID appID, void* buffer, size_t bufferSize, NS_APPID* sender, APT_Command* command, size_t* actualSize, Handle* parameter);
|
||||
Result APT_ReceiveParameter(NS_APPID appID, u32 bufferSize, u32* buffer, u32* actualSize, u8* signalType);
|
||||
|
||||
/**
|
||||
* @brief Sends a parameter.
|
||||
* @param source AppID of the source application.
|
||||
* @param dest AppID of the destination application.
|
||||
* @param command Command to send.
|
||||
* @param buffer Buffer to send.
|
||||
* @param src_appID ID of the source application.
|
||||
* @param dst_appID ID of the destination application.
|
||||
* @param bufferSize Size of the buffer.
|
||||
* @param parameter Parameter handle to pass.
|
||||
* @param buffer Buffer to send.
|
||||
* @param paramhandle Handle to pass.
|
||||
* @param signalType Signal type to send.
|
||||
*/
|
||||
Result APT_SendParameter(NS_APPID source, NS_APPID dest, APT_Command command, const void* buffer, u32 bufferSize, Handle parameter);
|
||||
|
||||
/**
|
||||
* @brief Cancels a parameter which matches the specified source and dest AppIDs.
|
||||
* @param source AppID of the source application (use APPID_NONE to disable the check).
|
||||
* @param dest AppID of the destination application (use APPID_NONE to disable the check).
|
||||
* @param success Pointer to output true if a parameter was cancelled, or false otherwise.
|
||||
*/
|
||||
Result APT_CancelParameter(NS_APPID source, NS_APPID dest, bool* success);
|
||||
Result APT_SendParameter(NS_APPID src_appID, NS_APPID dst_appID, u32 bufferSize, u32* buffer, Handle paramhandle, u8 signalType);
|
||||
|
||||
/**
|
||||
* @brief Sends capture buffer information.
|
||||
* @param captureBuf Capture buffer information to send.
|
||||
* @param bufferSize Size of the buffer to send.
|
||||
* @param buffer Buffer to send.
|
||||
*/
|
||||
Result APT_SendCaptureBufferInfo(const aptCaptureBufInfo* captureBuf);
|
||||
Result APT_SendCaptureBufferInfo(u32 bufferSize, u32* buffer);
|
||||
|
||||
/**
|
||||
* @brief Replies to a sleep query.
|
||||
* @param appID ID of the application.
|
||||
* @param reply Query reply value.
|
||||
* @param a Parameter to reply with.
|
||||
*/
|
||||
Result APT_ReplySleepQuery(NS_APPID appID, APT_QueryReply reply);
|
||||
Result APT_ReplySleepQuery(NS_APPID appID, u32 a);
|
||||
|
||||
/**
|
||||
* @brief Replies that a sleep notification has been completed.
|
||||
@ -487,9 +344,9 @@ Result APT_ReplySleepNotificationComplete(NS_APPID appID);
|
||||
|
||||
/**
|
||||
* @brief Prepares to close the application.
|
||||
* @param cancelPreload Whether applet preloads should be cancelled.
|
||||
* @param a Whether the jump is to the home menu.
|
||||
*/
|
||||
Result APT_PrepareToCloseApplication(bool cancelPreload);
|
||||
Result APT_PrepareToCloseApplication(u8 a);
|
||||
|
||||
/**
|
||||
* @brief Closes the application.
|
||||
@ -497,7 +354,7 @@ Result APT_PrepareToCloseApplication(bool cancelPreload);
|
||||
* @param paramSize Size of param.
|
||||
* @param handle Handle to pass.
|
||||
*/
|
||||
Result APT_CloseApplication(const void* param, size_t paramSize, Handle handle);
|
||||
Result APT_CloseApplication(const u8 *param, size_t paramSize, Handle handle);
|
||||
|
||||
/**
|
||||
* @brief Sets the application's CPU time limit.
|
||||
@ -513,9 +370,22 @@ Result APT_GetAppCpuTimeLimit(u32 *percent);
|
||||
|
||||
/**
|
||||
* @brief Checks whether the system is a New 3DS.
|
||||
* Note: this function is unreliable, see: http://3dbrew.org/wiki/APT:PrepareToStartApplication
|
||||
* @param out Pointer to write the New 3DS flag to.
|
||||
*/
|
||||
Result APT_CheckNew3DS(bool* out);
|
||||
Result APT_CheckNew3DS_Application(u8 *out);
|
||||
|
||||
/**
|
||||
* @brief Checks whether the system is a New 3DS.
|
||||
* @param out Pointer to write the New 3DS flag to.
|
||||
*/
|
||||
Result APT_CheckNew3DS_System(u8 *out);
|
||||
|
||||
/**
|
||||
* @brief Checks whether the system is a New 3DS.
|
||||
* @param out Pointer to write the New 3DS flag to.
|
||||
*/
|
||||
Result APT_CheckNew3DS(u8 *out);
|
||||
|
||||
/**
|
||||
* @brief Prepares for an applicaton jump.
|
||||
@ -523,59 +393,54 @@ Result APT_CheckNew3DS(bool* out);
|
||||
* @param programID ID of the program to jump to.
|
||||
* @param mediatype Media type of the program to jump to.
|
||||
*/
|
||||
Result APT_PrepareToDoApplicationJump(u8 flags, u64 programID, u8 mediatype);
|
||||
Result APT_PrepareToDoAppJump(u8 flags, u64 programID, u8 mediatype);
|
||||
|
||||
/**
|
||||
* @brief Performs an application jump.
|
||||
* @param param Parameter buffer.
|
||||
* @param paramSize Size of parameter buffer.
|
||||
* @param hmac HMAC buffer (should be 0x20 bytes long).
|
||||
* @param NSbuf0Size Size of NSbuf0Ptr.
|
||||
* @param NSbuf1Size Size of NSbuf1Ptr.
|
||||
* @param NSbuf0Ptr Launch buffer 0.
|
||||
* @param NSbuf1Ptr Launch buffer 1.
|
||||
*/
|
||||
Result APT_DoApplicationJump(const void* param, size_t paramSize, const void* hmac);
|
||||
Result APT_DoAppJump(u32 NSbuf0Size, u32 NSbuf1Size, u8 *NSbuf0Ptr, u8 *NSbuf1Ptr);
|
||||
|
||||
/**
|
||||
* @brief Prepares to start a library applet.
|
||||
* @param appID AppID of the applet to start.
|
||||
* @param appID ID of the applet to start.
|
||||
*/
|
||||
Result APT_PrepareToStartLibraryApplet(NS_APPID appID);
|
||||
|
||||
/**
|
||||
* @brief Starts a library applet.
|
||||
* @param appID AppID of the applet to launch.
|
||||
* @param param Buffer containing applet parameters.
|
||||
* @param paramsize Size of the buffer.
|
||||
* @param handle Handle to pass to the applet.
|
||||
* @param appID ID of the applet to launch.
|
||||
* @param inhandle Handle to pass to the applet.
|
||||
* @param parambuf Buffer containing applet parameters.
|
||||
* @param parambufsize Size of parambuf.
|
||||
*/
|
||||
Result APT_StartLibraryApplet(NS_APPID appID, const void* param, size_t paramSize, Handle handle);
|
||||
Result APT_StartLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize);
|
||||
|
||||
/**
|
||||
* @brief Launches a library applet.
|
||||
* Note: This is not usable from the homebrew launcher. This is broken: when the applet does get launched at all, the applet process doesn't actually get terminated when the applet gets closed.
|
||||
* @param appID ID of the applet to launch.
|
||||
* @param inhandle Handle to pass to the applet.
|
||||
* @param parambuf Buffer containing applet parameters.
|
||||
* @param parambufsize Size of parambuf.
|
||||
*/
|
||||
Result APT_LaunchLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize);
|
||||
|
||||
/**
|
||||
* @brief Prepares to start a system applet.
|
||||
* @param appID AppID of the applet to start.
|
||||
* @param appID ID of the applet to start.
|
||||
*/
|
||||
Result APT_PrepareToStartSystemApplet(NS_APPID appID);
|
||||
|
||||
/**
|
||||
* @brief Starts a system applet.
|
||||
* @param appID AppID of the applet to launch.
|
||||
* @param param Buffer containing applet parameters.
|
||||
* @param paramSize Size of the parameter buffer.
|
||||
* @param handle Handle to pass to the applet.
|
||||
* @param appID ID of the applet to launch.
|
||||
* @param bufSize Size of the parameter buffer.
|
||||
* @param applHandle Handle to pass to the applet.
|
||||
* @param buf Buffer containing applet parameters.
|
||||
*/
|
||||
Result APT_StartSystemApplet(NS_APPID appID, const void* param, size_t paramSize, Handle handle);
|
||||
Result APT_StartSystemApplet(NS_APPID appID, u32 bufSize, Handle applHandle, u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the shared system font.
|
||||
* @brief fontHandle Pointer to write the handle of the system font memory block to.
|
||||
* @brief mapAddr Pointer to write the mapping address of the system font memory block to.
|
||||
*/
|
||||
Result APT_GetSharedFont(Handle* fontHandle, u32* mapAddr);
|
||||
|
||||
/**
|
||||
* @brief Receives the deliver (launch) argument
|
||||
* @param param Parameter buffer.
|
||||
* @param paramSize Size of parameter buffer.
|
||||
* @param hmac HMAC buffer (should be 0x20 bytes long).
|
||||
* @param sender Pointer to output the sender's AppID to.
|
||||
* @param received Pointer to output whether an argument was received to.
|
||||
*/
|
||||
Result APT_ReceiveDeliverArg(void* param, size_t paramSize, void* hmac, u64* sender, bool* received);
|
||||
|
@ -1,180 +0,0 @@
|
||||
/**
|
||||
* @file boss.h
|
||||
* @brief BOSS service, see also: https://www.3dbrew.org/wiki/BOSS_Services
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// BOSS context.
|
||||
typedef struct
|
||||
{
|
||||
u32 property[0x7];
|
||||
|
||||
char url[0x200];
|
||||
|
||||
u32 property_x8;
|
||||
u8 property_x9;
|
||||
|
||||
u8 property_xa[0x100];
|
||||
|
||||
u8 property_xb[0x200];
|
||||
|
||||
char property_xd[0x360];//Additonal optional HTTP request headers.
|
||||
|
||||
u32 property_xe;
|
||||
|
||||
u32 property_xf[0xc>>2];
|
||||
|
||||
u8 property_x10;
|
||||
u8 property_x11;
|
||||
u8 property_x12;
|
||||
u32 property_x13;
|
||||
u32 property_x14;
|
||||
|
||||
u8 property_x15[0x40];
|
||||
|
||||
u32 property_x16;
|
||||
|
||||
u32 property_x3b;
|
||||
|
||||
u8 property_x3e[0x200];
|
||||
} bossContext;
|
||||
|
||||
/// BOSS task status.
|
||||
typedef enum {
|
||||
BOSSTASKSTATUS_STARTED = 0x2,
|
||||
BOSSTASKSTATUS_ERROR = 0x7,
|
||||
} bossTaskStatus;
|
||||
|
||||
/// Type values for bossGetNsDataHeaderInfo().
|
||||
typedef enum {
|
||||
bossNsDataHeaderInfoType_ContentSize = 0x3 /// Size of the content.
|
||||
} bossNsDataHeaderInfoTypes;
|
||||
|
||||
/// Size of the output data for bossGetNsDataHeaderInfo().
|
||||
typedef enum {
|
||||
bossNsDataHeaderInfoTypeSize_ContentSize = 0x4 ///Type2
|
||||
} bossNsDataHeaderInfoTypeSizes;
|
||||
|
||||
/**
|
||||
* @brief Initializes BOSS.
|
||||
* @param programID programID to use, 0 for the current process. Only used when BOSSP is available without *hax payload.
|
||||
* @param force_user When true, just use bossU instead of trying to initialize with bossP first.
|
||||
*/
|
||||
Result bossInit(u64 programID, bool force_user);
|
||||
|
||||
/**
|
||||
* @brief Run the InitializeSession service cmd. This is mainly for changing the programID associated with the current BOSS session.
|
||||
* @param programID programID to use, 0 for the current process.
|
||||
*/
|
||||
Result bossReinit(u64 programID);
|
||||
|
||||
/// Exits BOSS.
|
||||
void bossExit(void);
|
||||
|
||||
/// Returns the BOSS session handle.
|
||||
Handle bossGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Set the content data storage location.
|
||||
* @param extdataID u64 extdataID, must have the high word set to the shared-extdata value when it's for NAND.
|
||||
* @param boss_size Probably the max size in the extdata which BOSS can use.
|
||||
* @param mediaType Roughly the same as FS mediatype.
|
||||
*/
|
||||
Result bossSetStorageInfo(u64 extdataID, u32 boss_size, u8 mediaType);
|
||||
|
||||
/**
|
||||
* @brief Unregister the content data storage location, which includes unregistering the BOSS-session programID with BOSS.
|
||||
*/
|
||||
Result bossUnregisterStorage(void);
|
||||
|
||||
/**
|
||||
* @brief Register a task.
|
||||
* @param taskID BOSS taskID.
|
||||
* @param unk0 Unknown, usually zero.
|
||||
* @param unk1 Unknown, usually zero.
|
||||
*/
|
||||
Result bossRegisterTask(const char *taskID, u8 unk0, u8 unk1);
|
||||
|
||||
/**
|
||||
* @brief Send a property.
|
||||
* @param PropertyID PropertyID
|
||||
* @param buf Input buffer data.
|
||||
* @param size Buffer size.
|
||||
*/
|
||||
Result bossSendProperty(u16 PropertyID, const void* buf, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Deletes the content file for the specified NsDataId.
|
||||
* @param NsDataId NsDataId
|
||||
*/
|
||||
Result bossDeleteNsData(u32 NsDataId);
|
||||
|
||||
/**
|
||||
* @brief Gets header info for the specified NsDataId.
|
||||
* @param NsDataId NsDataId
|
||||
* @param type Type of data to load.
|
||||
* @param buffer Output buffer.
|
||||
* @param size Output buffer size.
|
||||
*/
|
||||
Result bossGetNsDataHeaderInfo(u32 NsDataId, u8 type, void* buffer, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Reads data from the content for the specified NsDataId.
|
||||
* @param NsDataId NsDataId
|
||||
* @param offset Offset in the content.
|
||||
* @param buffer Output buffer.
|
||||
* @param size Output buffer size.
|
||||
* @param transfer_total Optional output actual read size, can be NULL.
|
||||
* @param unk_out Optional unknown output, can be NULL.
|
||||
*/
|
||||
Result bossReadNsData(u32 NsDataId, u64 offset, void* buffer, u32 size, u32 *transfer_total, u32 *unk_out);
|
||||
|
||||
/**
|
||||
* @brief Starts a task soon after running this command.
|
||||
* @param taskID BOSS taskID.
|
||||
*/
|
||||
Result bossStartTaskImmediate(const char *taskID);
|
||||
|
||||
/**
|
||||
* @brief Similar to bossStartTaskImmediate?
|
||||
* @param taskID BOSS taskID.
|
||||
*/
|
||||
Result bossStartBgImmediate(const char *taskID);
|
||||
|
||||
/**
|
||||
* @brief Deletes a task by using CancelTask and UnregisterTask internally.
|
||||
* @param taskID BOSS taskID.
|
||||
* @param unk Unknown, usually zero?
|
||||
*/
|
||||
Result bossDeleteTask(const char *taskID, u32 unk);
|
||||
|
||||
/**
|
||||
* @brief Returns task state.
|
||||
* @param taskID BOSS taskID.
|
||||
* @param inval Unknown, normally 0?
|
||||
* @param status Output status, see bossTaskStatus.
|
||||
* @param out1 Output field.
|
||||
* @param out2 Output field.
|
||||
*/
|
||||
Result bossGetTaskState(const char *taskID, s8 inval, u8 *status, u32 *out1, u8 *out2);
|
||||
|
||||
/**
|
||||
* @brief This loads the current state of PropertyID 0x0 for the specified task.
|
||||
* @param taskID BOSS taskID.
|
||||
*/
|
||||
Result bossGetTaskProperty0(const char *taskID, u8 *out);
|
||||
|
||||
/**
|
||||
* @brief Setup a BOSS context with the default config.
|
||||
* @param bossContext BOSS context.
|
||||
* @param seconds_interval Interval in seconds for running the task automatically.
|
||||
* @param url Task URL.
|
||||
*/
|
||||
void bossSetupContextDefault(bossContext *ctx, u32 seconds_interval, const char *url);
|
||||
|
||||
/**
|
||||
* @brief Sends the config stored in the context. Used before registering a task.
|
||||
* @param bossContext BOSS context.
|
||||
*/
|
||||
Result bossSendContextConfig(bossContext *ctx);
|
||||
|
@ -1,90 +0,0 @@
|
||||
/**
|
||||
* @file cdcchk.h
|
||||
* @brief CODEC Hardware Check service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// I2S line enumeration
|
||||
typedef enum {
|
||||
CODEC_I2S_LINE_1, ///< Primary I2S line, used by DSP/Mic (configurable)/GBA sound controller.
|
||||
CODEC_I2S_LINE_2, ///< Secondary I2S line, used by CSND hardware.
|
||||
} CodecI2sLine;
|
||||
|
||||
/// Initializes CDCCHK.
|
||||
Result cdcChkInit(void);
|
||||
|
||||
/// Exits CDCCHK.
|
||||
void cdcChkExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the current cdc:CHK session handle.
|
||||
* @return A pointer to the current cdc:CHK session handle.
|
||||
*/
|
||||
Handle *cdcChkGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Reads multiple registers from the CODEC, using the old
|
||||
* SPI hardware interface and a 4MHz baudrate.
|
||||
* @param pageId CODEC Page ID.
|
||||
* @param initialRegAddr Address of the CODEC register to start with.
|
||||
* @param[out] outData Where to write the read data to.
|
||||
* @param size Number of registers to read (bytes to read, max. 64).
|
||||
*/
|
||||
Result CDCCHK_ReadRegisters1(u8 pageId, u8 initialRegAddr, void *outData, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Reads multiple registers from the CODEC, using the new
|
||||
* SPI hardware interface and a 16MHz baudrate.
|
||||
* @param pageId CODEC Page ID.
|
||||
* @param initialRegAddr Address of the CODEC register to start with.
|
||||
* @param[out] outData Where to read the data to.
|
||||
* @param size Number of registers to read (bytes to read, max. 64).
|
||||
*/
|
||||
Result CDCCHK_ReadRegisters2(u8 pageId, u8 initialRegAddr, void *outData, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Writes multiple registers to the CODEC, using the old
|
||||
* SPI hardware interface and a 4MHz baudrate.
|
||||
* @param pageId CODEC Page ID.
|
||||
* @param initialRegAddr Address of the CODEC register to start with.
|
||||
* @param data Where to read the data to write from.
|
||||
* @param size Number of registers to write (bytes to read, max. 64).
|
||||
*/
|
||||
Result CDCCHK_WriteRegisters1(u8 pageId, u8 initialRegAddr, const void *data, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Writes multiple registers to the CODEC, using the new
|
||||
* SPI hardware interface and a 16MHz baudrate.
|
||||
* @param pageId CODEC Page ID.
|
||||
* @param initialRegAddr Address of the CODEC register to start with.
|
||||
* @param data Where to read the data to write from.
|
||||
* @param size Number of registers to write (bytes to read, max. 64).
|
||||
*/
|
||||
Result CDCCHK_WriteRegisters2(u8 pageId, u8 initialRegAddr, const void *data, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Reads a single register from the NTR PMIC.
|
||||
* @param[out] outData Where to read the data to (1 byte).
|
||||
* @param regAddr Register address.
|
||||
* @note The NTR PMIC is emulated by the CODEC hardware and sends
|
||||
* IRQs to the MCU when relevant.
|
||||
*/
|
||||
Result CDCCHK_ReadNtrPmicRegister(u8 *outData, u8 regAddr);
|
||||
|
||||
/**
|
||||
* @brief Writes a single register from the NTR PMIC.
|
||||
* @param regAddr Register address.
|
||||
* @param data Data to write (1 byte).
|
||||
* @note The NTR PMIC is emulated by the CODEC hardware and sends
|
||||
* IRQs to the MCU when relevant.
|
||||
*/
|
||||
Result CDCCHK_WriteNtrPmicRegister(u8 regAddr, u8 data);
|
||||
|
||||
/**
|
||||
* @brief Sets the DAC volume level for the specified I2S line.
|
||||
* @param i2sLine I2S line to set the volume for.
|
||||
* @param volume Volume level (-128 to 0).
|
||||
*/
|
||||
Result CDCCHK_SetI2sVolume(CodecI2sLine i2sLine, s8 volume);
|
@ -3,7 +3,6 @@
|
||||
* @brief CFGU (Configuration) Service
|
||||
*/
|
||||
#pragma once
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Configuration region values.
|
||||
typedef enum
|
||||
@ -20,32 +19,20 @@ typedef enum
|
||||
/// Configuration language values.
|
||||
typedef enum
|
||||
{
|
||||
CFG_LANGUAGE_DEFAULT = -1, ///< Use system language in errorInit
|
||||
CFG_LANGUAGE_JP, ///< Japanese
|
||||
CFG_LANGUAGE_EN, ///< English
|
||||
CFG_LANGUAGE_FR, ///< French
|
||||
CFG_LANGUAGE_DE, ///< German
|
||||
CFG_LANGUAGE_IT, ///< Italian
|
||||
CFG_LANGUAGE_ES, ///< Spanish
|
||||
CFG_LANGUAGE_ZH, ///< Simplified Chinese
|
||||
CFG_LANGUAGE_KO, ///< Korean
|
||||
CFG_LANGUAGE_NL, ///< Dutch
|
||||
CFG_LANGUAGE_PT, ///< Portugese
|
||||
CFG_LANGUAGE_RU, ///< Russian
|
||||
CFG_LANGUAGE_TW, ///< Traditional Chinese
|
||||
CFG_LANGUAGE_JP = 0, ///< Japanese
|
||||
CFG_LANGUAGE_EN = 1, ///< English
|
||||
CFG_LANGUAGE_FR = 2, ///< French
|
||||
CFG_LANGUAGE_DE = 3, ///< German
|
||||
CFG_LANGUAGE_IT = 4, ///< Italian
|
||||
CFG_LANGUAGE_ES = 5, ///< Spanish
|
||||
CFG_LANGUAGE_ZH = 6, ///< Simplified Chinese
|
||||
CFG_LANGUAGE_KO = 7, ///< Korean
|
||||
CFG_LANGUAGE_NL = 8, ///< Dutch
|
||||
CFG_LANGUAGE_PT = 9, ///< Portugese
|
||||
CFG_LANGUAGE_RU = 10, ///< Russian
|
||||
CFG_LANGUAGE_TW = 11, ///< Traditional Chinese
|
||||
} CFG_Language;
|
||||
|
||||
// Configuration system model values.
|
||||
typedef enum
|
||||
{
|
||||
CFG_MODEL_3DS = 0, ///< Old 3DS (CTR)
|
||||
CFG_MODEL_3DSXL = 1, ///< Old 3DS XL (SPR)
|
||||
CFG_MODEL_N3DS = 2, ///< New 3DS (KTR)
|
||||
CFG_MODEL_2DS = 3, ///< Old 2DS (FTR)
|
||||
CFG_MODEL_N3DSXL = 4, ///< New 3DS XL (RED)
|
||||
CFG_MODEL_N2DSXL = 5, ///< New 2DS XL (JAN)
|
||||
} CFG_SystemModel;
|
||||
|
||||
/// Initializes CFGU.
|
||||
Result cfguInit(void);
|
||||
|
||||
@ -73,7 +60,7 @@ Result CFGU_GetRegionCanadaUSA(u8* value);
|
||||
|
||||
/**
|
||||
* @brief Gets the system's model.
|
||||
* @param model Pointer to output the model to. (see @ref CFG_SystemModel)
|
||||
* @param model Pointer to output the model to. (0 = O3DS, 1 = O3DSXL, 2 = N3DS, 3 = 2DS, 4 = N3DSXL)
|
||||
*/
|
||||
Result CFGU_GetSystemModel(u8* model);
|
||||
|
||||
@ -98,124 +85,15 @@ Result CFGU_GetCountryCodeString(u16 code, u16* string);
|
||||
Result CFGU_GetCountryCodeID(u16 string, u16* code);
|
||||
|
||||
/**
|
||||
* @brief Checks if NFC (code name: fangate) is supported.
|
||||
* @param isSupported pointer to the output the result to.
|
||||
*/
|
||||
Result CFGU_IsNFCSupported(bool* isSupported);
|
||||
|
||||
/**
|
||||
* @brief Gets a config info block with flags = 2.
|
||||
* @brief Gets a config info block.
|
||||
* @param size Size of the data to retrieve.
|
||||
* @param blkID ID of the block to retrieve.
|
||||
* @param outData Pointer to write the block data to.
|
||||
*/
|
||||
Result CFGU_GetConfigInfoBlk2(u32 size, u32 blkID, void* outData);
|
||||
|
||||
/**
|
||||
* @brief Gets a config info block with flags = 4.
|
||||
* @param size Size of the data to retrieve.
|
||||
* @param blkID ID of the block to retrieve.
|
||||
* @param outData Pointer to write the block data to.
|
||||
*/
|
||||
Result CFG_GetConfigInfoBlk4(u32 size, u32 blkID, void* outData);
|
||||
|
||||
/**
|
||||
* @brief Gets a config info block with flags = 8.
|
||||
* @param size Size of the data to retrieve.
|
||||
* @param blkID ID of the block to retrieve.
|
||||
* @param outData Pointer to write the block data to.
|
||||
*/
|
||||
Result CFG_GetConfigInfoBlk8(u32 size, u32 blkID, void* outData);
|
||||
|
||||
/**
|
||||
* @brief Sets a config info block with flags = 4.
|
||||
* @param size Size of the data to retrieve.
|
||||
* @param blkID ID of the block to retrieve.
|
||||
* @param inData Pointer to block data to write.
|
||||
*/
|
||||
Result CFG_SetConfigInfoBlk4(u32 size, u32 blkID, const void* inData);
|
||||
|
||||
/**
|
||||
* @brief Sets a config info block with flags = 8.
|
||||
* @param size Size of the data to retrieve.
|
||||
* @param blkID ID of the block to retrieve.
|
||||
* @param inData Pointer to block data to write.
|
||||
*/
|
||||
Result CFG_SetConfigInfoBlk8(u32 size, u32 blkID, const void* inData);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Writes the CFG buffer in memory to the savegame in NAND.
|
||||
*/
|
||||
Result CFG_UpdateConfigSavegame(void);
|
||||
Result CFGU_GetConfigInfoBlk2(u32 size, u32 blkID, u8* outData);
|
||||
|
||||
/**
|
||||
* @brief Gets the system's language.
|
||||
* @param language Pointer to write the language to. (see @ref CFG_Language)
|
||||
*/
|
||||
Result CFGU_GetSystemLanguage(u8* language);
|
||||
|
||||
/**
|
||||
* @brief Deletes the NAND LocalFriendCodeSeed file, then recreates it using the LocalFriendCodeSeed data stored in memory.
|
||||
*/
|
||||
Result CFGI_RestoreLocalFriendCodeSeed(void);
|
||||
|
||||
/**
|
||||
* @brief Deletes the NAND SecureInfo file, then recreates it using the SecureInfo data stored in memory.
|
||||
*/
|
||||
Result CFGI_RestoreSecureInfo(void);
|
||||
|
||||
/**
|
||||
* @brief Deletes the "config" file stored in the NAND Config_Savegame.
|
||||
*/
|
||||
Result CFGI_DeleteConfigSavefile(void);
|
||||
|
||||
/**
|
||||
* @brief Formats Config_Savegame.
|
||||
*/
|
||||
Result CFGI_FormatConfig(void);
|
||||
|
||||
/**
|
||||
* @brief Clears parental controls
|
||||
*/
|
||||
Result CFGI_ClearParentalControls(void);
|
||||
|
||||
/**
|
||||
* @brief Verifies the RSA signature for the LocalFriendCodeSeed data already stored in memory.
|
||||
*/
|
||||
Result CFGI_VerifySigLocalFriendCodeSeed(void);
|
||||
|
||||
/**
|
||||
* @brief Verifies the RSA signature for the SecureInfo data already stored in memory.
|
||||
*/
|
||||
Result CFGI_VerifySigSecureInfo(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the system's serial number.
|
||||
* @param serial Pointer to output the serial to. (This is normally 0xF)
|
||||
*/
|
||||
Result CFGI_SecureInfoGetSerialNumber(u8 *serial);
|
||||
|
||||
/**
|
||||
* @brief Gets the 0x110-byte buffer containing the data for the LocalFriendCodeSeed.
|
||||
* @param data Pointer to output the buffer. (The size must be at least 0x110-bytes)
|
||||
*/
|
||||
Result CFGI_GetLocalFriendCodeSeedData(u8 *data);
|
||||
|
||||
/**
|
||||
* @brief Gets the 64-bit local friend code seed.
|
||||
* @param seed Pointer to write the friend code seed to.
|
||||
*/
|
||||
Result CFGI_GetLocalFriendCodeSeed(u64* seed);
|
||||
|
||||
/**
|
||||
* @brief Gets the 0x11-byte data following the SecureInfo signature.
|
||||
* @param data Pointer to output the buffer. (The size must be at least 0x11-bytes)
|
||||
*/
|
||||
Result CFGI_GetSecureInfoData(u8 *data);
|
||||
|
||||
/**
|
||||
* @brief Gets the 0x100-byte RSA-2048 SecureInfo signature.
|
||||
* @param data Pointer to output the buffer. (The size must be at least 0x100-bytes)
|
||||
*/
|
||||
Result CFGI_GetSecureInfoSignature(u8 *data);
|
||||
|
@ -20,18 +20,15 @@
|
||||
*/
|
||||
static inline u32 CSND_VOL(float vol, float pan)
|
||||
{
|
||||
float rpan;
|
||||
u32 lvol, rvol;
|
||||
if (vol < 0.0) vol = 0.0;
|
||||
else if (vol > 1.0) vol = 1.0;
|
||||
|
||||
if (vol < 0.0f) vol = 0.0f;
|
||||
else if (vol > 1.0f) vol = 1.0f;
|
||||
float rpan = (pan+1) / 2;
|
||||
if (rpan < 0.0) rpan = 0.0;
|
||||
else if (rpan > 1.0) rpan = 1.0;
|
||||
|
||||
rpan = (pan+1) / 2;
|
||||
if (rpan < 0.0f) rpan = 0.0f;
|
||||
else if (rpan > 1.0f) rpan = 1.0f;
|
||||
|
||||
lvol = vol*(1-rpan) * 0x8000;
|
||||
rvol = vol*rpan * 0x8000;
|
||||
u32 lvol = vol*(1-rpan) * 0x8000;
|
||||
u32 rvol = vol*rpan * 0x8000;
|
||||
return lvol | (rvol << 16);
|
||||
}
|
||||
|
||||
|
@ -13,23 +13,12 @@ typedef enum
|
||||
DSP_INTERRUPT_PIPE = 2 ///< Pipe interrupt.
|
||||
} DSP_InterruptType;
|
||||
|
||||
/// DSP hook types.
|
||||
/// DSP pipe directions.
|
||||
typedef enum
|
||||
{
|
||||
DSPHOOK_ONSLEEP = 0, ///< DSP is going to sleep.
|
||||
DSPHOOK_ONWAKEUP = 1, ///< DSP is waking up.
|
||||
DSPHOOK_ONCANCEL = 2, ///< DSP was sleeping and the app was cancelled.
|
||||
} DSP_HookType;
|
||||
|
||||
/// DSP hook function.
|
||||
typedef void (* dspHookFn)(DSP_HookType hook);
|
||||
|
||||
/// DSP hook cookie.
|
||||
typedef struct tag_dspHookCookie
|
||||
{
|
||||
struct tag_dspHookCookie* next; ///< Next cookie.
|
||||
dspHookFn callback; ///< Hook callback.
|
||||
} dspHookCookie;
|
||||
DSP_PIPE_INPUT = 0, ///< DSP to ARM
|
||||
DSP_PIPE_OUTPUT = 1 ///< ARM to DSP
|
||||
} DSP_PipeDirection;
|
||||
|
||||
/**
|
||||
* @brief Initializes the dsp service.
|
||||
@ -46,22 +35,6 @@ Result dspInit(void);
|
||||
*/
|
||||
void dspExit(void);
|
||||
|
||||
/// Returns true if a component is loaded, false otherwise.
|
||||
bool dspIsComponentLoaded(void);
|
||||
|
||||
/**
|
||||
* @brief Sets up a DSP status hook.
|
||||
* @param cookie Hook cookie to use.
|
||||
* @param callback Function to call when DSP's status changes.
|
||||
*/
|
||||
void dspHook(dspHookCookie* cookie, dspHookFn callback);
|
||||
|
||||
/**
|
||||
* @brief Removes a DSP status hook.
|
||||
* @param cookie Hook cookie to remove.
|
||||
*/
|
||||
void dspUnhook(dspHookCookie* cookie);
|
||||
|
||||
/**
|
||||
* @brief Checks if a headphone is inserted.
|
||||
* @param is_inserted Pointer to output the insertion status to.
|
||||
@ -141,7 +114,7 @@ Result DSP_RegisterInterruptEvents(Handle handle, u32 interrupt, u32 channel);
|
||||
Result DSP_ReadPipeIfPossible(u32 channel, u32 peer, void* buffer, u16 length, u16* length_read);
|
||||
|
||||
/**
|
||||
* @brief Writes to a pipe.
|
||||
* @param Writes to a pipe.
|
||||
* @param channel unknown. Usually 2
|
||||
* @param buffer The message to send to the DSP process
|
||||
* @param length Length of the message
|
||||
|
@ -1,261 +0,0 @@
|
||||
/**
|
||||
* @file frd.h
|
||||
* @brief Friend Services
|
||||
*/
|
||||
#pragma once
|
||||
#include <3ds/mii.h>
|
||||
|
||||
#define FRIEND_SCREEN_NAME_SIZE 0xB ///< 11-byte UTF-16 screen name
|
||||
#define FRIEND_COMMENT_SIZE 0x21 ///< 33-byte UTF-16 comment
|
||||
#define FRIEND_LIST_SIZE 0x64 ///< 100 (Max number of friends)
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
/// Friend key data
|
||||
typedef struct
|
||||
{
|
||||
u32 principalId;
|
||||
u32 padding;
|
||||
u64 localFriendCode;
|
||||
} FriendKey;
|
||||
|
||||
/// Friend Title data
|
||||
typedef struct
|
||||
{
|
||||
u64 tid;
|
||||
u32 version;
|
||||
u32 unk;
|
||||
} TitleData;
|
||||
|
||||
/// Friend profile data
|
||||
typedef struct
|
||||
{
|
||||
u8 region; ///< The region code for the hardware.
|
||||
u8 country; ///< Country code.
|
||||
u8 area; ///< Area code.
|
||||
u8 language; ///< Language code.
|
||||
u8 platform; ///< Platform code.
|
||||
u32 padding;
|
||||
} FriendProfile;
|
||||
|
||||
/// Game Description structure
|
||||
typedef struct
|
||||
{
|
||||
TitleData data;
|
||||
u16 desc[128];
|
||||
} GameDescription;
|
||||
|
||||
/// Friend Notification Event structure
|
||||
typedef struct
|
||||
{
|
||||
u8 type;
|
||||
u8 padding3[3];
|
||||
u32 padding;
|
||||
FriendKey key;
|
||||
} NotificationEvent;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/// Enum to use with FRD_GetNotificationEvent
|
||||
typedef enum
|
||||
{
|
||||
USER_WENT_ONLINE = 1, ///< Self went online
|
||||
USER_WENT_OFFLINE, ///< Self went offline
|
||||
FRIEND_WENT_ONLINE, ///< Friend Went Online
|
||||
FRIEND_UPDATED_PRESENCE, ///< Friend Presence changed
|
||||
FRIEND_UPDATED_MII, ///< Friend Mii changed
|
||||
FRIEND_UPDATED_PROFILE, ///< Friend Profile changed
|
||||
FRIEND_WENT_OFFLINE, ///< Friend went offline
|
||||
FRIEND_REGISTERED_USER, ///< Friend registered self as friend
|
||||
FRIEND_SENT_INVITATION ///< Friend Sent invitation
|
||||
} NotificationTypes;
|
||||
|
||||
/// Initializes FRD service.
|
||||
Result frdInit(void);
|
||||
|
||||
/// Exists FRD.
|
||||
void frdExit(void);
|
||||
|
||||
/// Get FRD handle.
|
||||
Handle *frdGetSessionHandle(void);
|
||||
/**
|
||||
* @brief Gets the login status of the current user.
|
||||
* @param state Pointer to write the current user's login status to.
|
||||
*/
|
||||
Result FRDU_HasLoggedIn(bool *state);
|
||||
|
||||
/**
|
||||
* @brief Gets the online status of the current user.
|
||||
* @param state Pointer to write the current user's online status to.
|
||||
*/
|
||||
Result FRDU_IsOnline(bool *state);
|
||||
|
||||
/// Logs out of Nintendo's friend server.
|
||||
Result FRD_Logout(void);
|
||||
|
||||
/**
|
||||
* @brief Log in to Nintendo's friend server.
|
||||
* @param event Event to signal when Login is done.
|
||||
*/
|
||||
Result FRD_Login(Handle event);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's friend key.
|
||||
* @param key Pointer to write the current user's friend key to.
|
||||
*/
|
||||
Result FRD_GetMyFriendKey(FriendKey *key);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's privacy information.
|
||||
* @param isPublicMode Determines whether friends are notified of the current user's online status.
|
||||
* @param isShowGameName Determines whether friends are notified of the application that the current user is running.
|
||||
* @param isShowPlayedGame Determiens whether to display the current user's game history.
|
||||
*/
|
||||
Result FRD_GetMyPreference(bool *isPublicMode, bool *isShowGameName, bool *isShowPlayedGame);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's profile information.
|
||||
* @param profile Pointer to write the current user's profile information to.
|
||||
*/
|
||||
Result FRD_GetMyProfile(FriendProfile *profile);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's screen name.
|
||||
* @param name Pointer to write the current user's screen name to.
|
||||
* @param max_size Max size of the screen name.
|
||||
*/
|
||||
Result FRD_GetMyScreenName(char *name, size_t max_size);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's Mii data.
|
||||
* @param mii Pointer to write the current user's mii data to.
|
||||
*/
|
||||
Result FRD_GetMyMii(MiiData *mii);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's playing game.
|
||||
* @param titleId Pointer to write the current user's playing game to.
|
||||
*/
|
||||
Result FRD_GetMyPlayingGame(u64 *titleId);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's favourite game.
|
||||
* @param titleId Pointer to write the title ID of current user's favourite game to.
|
||||
*/
|
||||
Result FRD_GetMyFavoriteGame(u64 *titleId);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's comment on their friend profile.
|
||||
* @param comment Pointer to write the current user's comment to.
|
||||
* @param max_size Max size of the comment.
|
||||
*/
|
||||
Result FRD_GetMyComment(char *comment, size_t max_size);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's friend key list.
|
||||
* @param friendKeyList Pointer to write the friend key list to.
|
||||
* @param num Stores the number of friend keys obtained.
|
||||
* @param offset The index of the friend key to start with.
|
||||
* @param size Size of the friend key list. (FRIEND_LIST_SIZE)
|
||||
*/
|
||||
Result FRD_GetFriendKeyList(FriendKey *friendKeyList, u32 *num, u32 offset, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the current user's friends' Mii data.
|
||||
* @param miiDataList Pointer to write Mii data to.
|
||||
* @param friendKeyList Pointer to FriendKeys.
|
||||
* @param size Number of Friendkeys.
|
||||
*/
|
||||
Result FRD_GetFriendMii(MiiData *miiDataList, const FriendKey *friendKeyList, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Get the current user's friends' profile data.
|
||||
* @param profile Pointer to write profile data to.
|
||||
* @param friendKeyList Pointer to FriendKeys.
|
||||
* @param size Number of FriendKeys.
|
||||
*/
|
||||
Result FRD_GetFriendProfile(FriendProfile *profile, const FriendKey *friendKeyList, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Get the current user's friends' playing game.
|
||||
* @param desc Pointer to write Game Description data to.
|
||||
* @param friendKeyList Pointer to FriendKeys,
|
||||
* @param size Number Of FriendKeys.
|
||||
*/
|
||||
Result FRD_GetFriendPlayingGame(GameDescription *desc, const FriendKey *friendKeyList, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Get the current user's friends' favourite game.
|
||||
* @param desc Pointer to write Game Description data to.
|
||||
* @param friendKeyList Pointer to FriendKeys,
|
||||
* @param count Number Of FriendKeys.
|
||||
*/
|
||||
Result FRD_GetFriendFavouriteGame(GameDescription *desc, const FriendKey *friendKeyList, u32 count);
|
||||
|
||||
/**
|
||||
* @brief Gets whether a friend key is included in the current user's friend list.
|
||||
* @param friendKeyList Pointer to a list of friend keys.
|
||||
* @param isFromList Pointer to a write the friendship status to.
|
||||
*/
|
||||
Result FRD_IsInFriendList(FriendKey *friendKeyList, bool *isFromList);
|
||||
|
||||
/**
|
||||
* @brief Updates the game mode description string.
|
||||
* @param desc Pointer to write the game mode description to.
|
||||
*/
|
||||
Result FRD_UpdateGameModeDescription(const char *desc);
|
||||
|
||||
/**
|
||||
* @brief Event which is signaled when friend login states change.
|
||||
* @param event event which will be signaled.
|
||||
*/
|
||||
Result FRD_AttachToEventNotification(Handle event);
|
||||
|
||||
/**
|
||||
* @brief Get Latest Event Notification
|
||||
* @param event Pointer to write recieved notification event struct to.
|
||||
* @param count Number of events
|
||||
* @param recievedNotifCount Number of notification reccieved.
|
||||
*/
|
||||
Result FRD_GetEventNotification(NotificationEvent *event, u32 count, u32 *recievedNotifCount);
|
||||
|
||||
/**
|
||||
* @brief Returns the friend code using the given principal ID.
|
||||
* @param principalId The principal ID being used.
|
||||
* @param friendCode Pointer to write the friend code to.
|
||||
*/
|
||||
Result FRD_PrincipalIdToFriendCode(u32 principalId, u64 *friendCode);
|
||||
|
||||
/**
|
||||
* @brief Returns the principal ID using the given friend code.
|
||||
* @param friendCode The friend code being used.
|
||||
* @param principalId Pointer to write the principal ID to.
|
||||
*/
|
||||
Result FRD_FriendCodeToPrincipalId(u64 friendCode, u32 *principalId);
|
||||
|
||||
/**
|
||||
* @brief Checks if the friend code is valid.
|
||||
* @param friendCode The friend code being used.
|
||||
* @param isValid Pointer to write the validity of the friend code to.
|
||||
*/
|
||||
Result FRD_IsValidFriendCode(u64 friendCode, bool *isValid);
|
||||
|
||||
/**
|
||||
* @brief Sets the Friend API to use a specific SDK version.
|
||||
* @param sdkVer The SDK version needed to be used.
|
||||
*/
|
||||
Result FRD_SetClientSdkVersion(u32 sdkVer);
|
||||
|
||||
/**
|
||||
* @brief Add a Friend online.
|
||||
* @param event Event signaled when friend is registered.
|
||||
* @param principalId PrincipalId of the friend to add.
|
||||
*/
|
||||
Result FRD_AddFriendOnline(Handle event, u32 principalId);
|
||||
|
||||
/**
|
||||
* @brief Remove a Friend.
|
||||
* @param principalId PrinipalId of the friend code to remove.
|
||||
* @param localFriendCode LocalFriendCode of the friend code to remove.
|
||||
*/
|
||||
Result FRD_RemoveFriend(u32 principalId, u64 localFriendCode);
|
@ -38,15 +38,6 @@ typedef enum
|
||||
MEDIATYPE_GAME_CARD = 2, ///< Game card.
|
||||
} FS_MediaType;
|
||||
|
||||
/// System media types.
|
||||
typedef enum
|
||||
{
|
||||
SYSTEM_MEDIATYPE_CTR_NAND = 0, ///< CTR NAND.
|
||||
SYSTEM_MEDIATYPE_TWL_NAND = 1, ///< TWL NAND.
|
||||
SYSTEM_MEDIATYPE_SD = 2, ///< SD card.
|
||||
SYSTEM_MEDIATYPE_TWL_PHOTO = 3, ///< TWL Photo.
|
||||
} FS_SystemMediaType;
|
||||
|
||||
/// Archive IDs.
|
||||
typedef enum
|
||||
{
|
||||
@ -68,7 +59,6 @@ typedef enum
|
||||
ARCHIVE_SAVEDATA_AND_CONTENT2 = 0x2345678E, ///< User save data and ExeFS/RomFS archive (only ExeFS for fs:LDR).
|
||||
ARCHIVE_NAND_CTR_FS = 0x567890AB, ///< NAND CTR FS archive.
|
||||
ARCHIVE_TWL_PHOTO = 0x567890AC, ///< TWL PHOTO archive.
|
||||
ARCHIVE_TWL_SOUND = 0x567890AD, ///< TWL SOUND archive.
|
||||
ARCHIVE_NAND_TWL_FS = 0x567890AE, ///< NAND TWL FS archive.
|
||||
ARCHIVE_NAND_W_FS = 0x567890AF, ///< NAND W FS archive.
|
||||
ARCHIVE_GAMECARD_SAVEDATA = 0x567890B1, ///< Game card save data archive.
|
||||
@ -135,7 +125,6 @@ typedef enum
|
||||
{
|
||||
ARCHIVE_ACTION_COMMIT_SAVE_DATA = 0, ///< Commits save data changes. No inputs/outputs.
|
||||
ARCHIVE_ACTION_GET_TIMESTAMP = 1, ///< Retrieves a file's last-modified timestamp. In: "u16*, UTF-16 Path", Out: "u64, Time Stamp".
|
||||
ARCHIVE_ACTION_UNKNOWN = 0x789D, //< Unknown action; calls FSPXI command 0x56. In: "FS_Path instance", Out: "u32[4], Unknown"
|
||||
} FS_ArchiveAction;
|
||||
|
||||
/// Secure save control actions.
|
||||
@ -202,7 +191,7 @@ typedef struct
|
||||
} FS_IntegrityVerificationSeed;
|
||||
|
||||
/// Ext save data information.
|
||||
typedef struct CTR_PACKED
|
||||
typedef struct PACKED
|
||||
{
|
||||
FS_MediaType mediaType : 8; ///< Media type.
|
||||
u8 unknown; ///< Unknown.
|
||||
@ -227,7 +216,7 @@ typedef struct
|
||||
u8 encryptParameter[0x10]; ///< Encrypt parameter.
|
||||
} FS_DeviceMoveContext;
|
||||
|
||||
/// Filesystem path data, detailing the specific target of an operation.
|
||||
/// FS path.
|
||||
typedef struct
|
||||
{
|
||||
FS_PathType type; ///< FS path type.
|
||||
@ -235,16 +224,13 @@ typedef struct
|
||||
const void* data; ///< Pointer to FS path data.
|
||||
} FS_Path;
|
||||
|
||||
/// SDMC/NAND speed information
|
||||
/// FS archive.
|
||||
typedef struct
|
||||
{
|
||||
bool highSpeedModeEnabled; ///< Whether or not High Speed Mode is enabled.
|
||||
bool usesHighestClockRate; ///< Whether or not a clock divider of 2 is being used.
|
||||
u16 sdClkCtrl; ///< The value of the SD_CLK_CTRL register.
|
||||
} FS_SdMmcSpeedInfo;
|
||||
|
||||
/// Filesystem archive handle, providing access to a filesystem's contents.
|
||||
typedef u64 FS_Archive;
|
||||
u32 id; ///< Archive ID.
|
||||
FS_Path lowPath; ///< FS path.
|
||||
u64 handle; ///< Handle.
|
||||
} FS_Archive;
|
||||
|
||||
/// Initializes FS.
|
||||
Result fsInit(void);
|
||||
@ -255,25 +241,13 @@ void fsExit(void);
|
||||
/**
|
||||
* @brief Sets the FSUSER session to use in the current thread.
|
||||
* @param session The handle of the FSUSER session to use.
|
||||
* @param sdmc When true, SDMC archive commands are redirected to this session too. Otherwise the default session is used.
|
||||
*/
|
||||
void fsUseSession(Handle session);
|
||||
void fsUseSession(Handle session, bool sdmc);
|
||||
|
||||
/// Disables the FSUSER session override in the current thread.
|
||||
void fsEndUseSession(void);
|
||||
|
||||
/**
|
||||
* @brief Exempts an archive from using alternate FS session handles provided with @ref fsUseSession
|
||||
* Instead, the archive will use the default FS session handle, opened with @ref srvGetSessionHandle
|
||||
* @param archive Archive to exempt.
|
||||
*/
|
||||
void fsExemptFromSession(FS_Archive archive);
|
||||
|
||||
/**
|
||||
* @brief Unexempts an archive from using alternate FS session handles provided with @ref fsUseSession
|
||||
* @param archive Archive to remove from the exemption list.
|
||||
*/
|
||||
void fsUnexemptFromSession(FS_Archive archive);
|
||||
|
||||
/**
|
||||
* @brief Creates an FS_Path instance.
|
||||
* @param type Type of path.
|
||||
@ -315,15 +289,14 @@ Result FSUSER_Initialize(Handle session);
|
||||
Result FSUSER_OpenFile(Handle* out, FS_Archive archive, FS_Path path, u32 openFlags, u32 attributes);
|
||||
|
||||
/**
|
||||
* @brief Opens a file directly, bypassing the requirement of an opened archive handle.
|
||||
* @brief Opens a file directly.
|
||||
* @param out Pointer to output the file handle to.
|
||||
* @param archiveId ID of the archive containing the file.
|
||||
* @param archivePath Path of the archive containing the file.
|
||||
* @param filePath Path of the file.
|
||||
* @param archive Archive containing the file.
|
||||
* @param path Path of the file.
|
||||
* @param openFlags Flags to open the file with.
|
||||
* @param attributes Attributes of the file.
|
||||
*/
|
||||
Result FSUSER_OpenFileDirectly(Handle* out, FS_ArchiveID archiveId, FS_Path archivePath, FS_Path filePath, u32 openFlags, u32 attributes);
|
||||
Result FSUSER_OpenFileDirectly(Handle* out, FS_Archive archive, FS_Path path, u32 openFlags, u32 attributes);
|
||||
|
||||
/**
|
||||
* @brief Deletes a file.
|
||||
@ -357,7 +330,7 @@ Result FSUSER_DeleteDirectoryRecursively(FS_Archive archive, FS_Path path);
|
||||
|
||||
/**
|
||||
* @brief Creates a file.
|
||||
* @param archive Archive to create the file in.
|
||||
* @param archive Archive containing the file.
|
||||
* @param path Path of the file.
|
||||
* @param attributes Attributes of the file.
|
||||
* @param fileSize Size of the file.
|
||||
@ -366,7 +339,7 @@ Result FSUSER_CreateFile(FS_Archive archive, FS_Path path, u32 attributes, u64 f
|
||||
|
||||
/**
|
||||
* @brief Creates a directory
|
||||
* @param archive Archive to create the directory in.
|
||||
* @param archive Archive containing the directory.
|
||||
* @param path Path of the directory.
|
||||
* @param attributes Attributes of the directory.
|
||||
*/
|
||||
@ -391,11 +364,9 @@ Result FSUSER_OpenDirectory(Handle *out, FS_Archive archive, FS_Path path);
|
||||
|
||||
/**
|
||||
* @brief Opens an archive.
|
||||
* @param archive Pointer to output the opened archive to.
|
||||
* @param id ID of the archive.
|
||||
* @param path Path of the archive.
|
||||
* @param archive Archive to open.
|
||||
*/
|
||||
Result FSUSER_OpenArchive(FS_Archive* archive, FS_ArchiveID id, FS_Path path);
|
||||
Result FSUSER_OpenArchive(FS_Archive* archive);
|
||||
|
||||
/**
|
||||
* @brief Performs a control operation on an archive.
|
||||
@ -412,7 +383,7 @@ Result FSUSER_ControlArchive(FS_Archive archive, FS_ArchiveAction action, void*
|
||||
* @brief Closes an archive.
|
||||
* @param archive Archive to close.
|
||||
*/
|
||||
Result FSUSER_CloseArchive(FS_Archive archive);
|
||||
Result FSUSER_CloseArchive(FS_Archive* archive);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of free bytes within an archive.
|
||||
@ -453,7 +424,7 @@ Result FSUSER_IsSdmcDetected(bool *detected);
|
||||
|
||||
/**
|
||||
* @brief Gets whether the SD card is writable.
|
||||
* @param writable Pointer to output the writable status to.
|
||||
* @param detected Pointer to output the writable status to.
|
||||
*/
|
||||
Result FSUSER_IsSdmcWritable(bool *writable);
|
||||
|
||||
@ -475,13 +446,13 @@ Result FSUSER_GetNandCid(u8* out, u32 length);
|
||||
* @brief Gets the SDMC speed info.
|
||||
* @param speedInfo Pointer to output the speed info to.
|
||||
*/
|
||||
Result FSUSER_GetSdmcSpeedInfo(FS_SdMmcSpeedInfo *speedInfo);
|
||||
Result FSUSER_GetSdmcSpeedInfo(u32 *speedInfo);
|
||||
|
||||
/**
|
||||
* @brief Gets the NAND speed info.
|
||||
* @param speedInfo Pointer to output the speed info to.
|
||||
*/
|
||||
Result FSUSER_GetNandSpeedInfo(FS_SdMmcSpeedInfo *speedInfo);
|
||||
Result FSUSER_GetNandSpeedInfo(u32 *speedInfo);
|
||||
|
||||
/**
|
||||
* @brief Gets the SDMC log.
|
||||
@ -546,7 +517,7 @@ Result FSUSER_CardNorDirectCommandWithAddress(u8 commandId, u32 address);
|
||||
* @param size Size of the output buffer.
|
||||
* @param output Output buffer.
|
||||
*/
|
||||
Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, void* output);
|
||||
Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, u8* output);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct read with an address.
|
||||
@ -555,7 +526,7 @@ Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, void* output);
|
||||
* @param size Size of the output buffer.
|
||||
* @param output Output buffer.
|
||||
*/
|
||||
Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size, void* output);
|
||||
Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size, u8* output);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct write.
|
||||
@ -563,7 +534,7 @@ Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size,
|
||||
* @param size Size of the input buffer.
|
||||
* @param output Input buffer.
|
||||
*/
|
||||
Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, const void* input);
|
||||
Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, u8* input);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct write with an address.
|
||||
@ -572,7 +543,7 @@ Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, const void* input);
|
||||
* @param size Size of the input buffer.
|
||||
* @param input Input buffer.
|
||||
*/
|
||||
Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size, const void* input);
|
||||
Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size, u8* input);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR 4xIO direct read.
|
||||
@ -581,7 +552,7 @@ Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size,
|
||||
* @param size Size of the output buffer.
|
||||
* @param output Output buffer.
|
||||
*/
|
||||
Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, void* output);
|
||||
Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, u8* output);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct CPU write without verify.
|
||||
@ -589,7 +560,7 @@ Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, void*
|
||||
* @param size Size of the input buffer.
|
||||
* @param output Input buffer.
|
||||
*/
|
||||
Result FSUSER_CardNorDirectCpuWriteWithoutVerify(u32 address, u32 size, const void* input);
|
||||
Result FSUSER_CardNorDirectCpuWriteWithoutVerify(u32 address, u32 size, u8* input);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct sector erase without verify.
|
||||
@ -619,7 +590,7 @@ Result FSUSER_SetCardSpiBaudRate(FS_CardSpiBaudRate baudRate);
|
||||
|
||||
/**
|
||||
* @brief Sets the CARDSPI bus mode.
|
||||
* @param busMode Bus mode to set.
|
||||
* @param baudRate Bus mode to set.
|
||||
*/
|
||||
Result FSUSER_SetCardSpiBusMode(FS_CardSpiBusMode busMode);
|
||||
|
||||
@ -641,15 +612,15 @@ Result FSUSER_GetSpecialContentIndex(u16* index, FS_MediaType mediaType, u64 pro
|
||||
* @param programId ID of the program.
|
||||
* @param header Pointer to output the legacy ROM header to. (size = 0x3B4)
|
||||
*/
|
||||
Result FSUSER_GetLegacyRomHeader(FS_MediaType mediaType, u64 programId, void* header);
|
||||
Result FSUSER_GetLegacyRomHeader(FS_MediaType mediaType, u64 programId, u8* header);
|
||||
|
||||
/**
|
||||
* @brief Gets the legacy banner data of a program.
|
||||
* @param mediaType Media type of the program.
|
||||
* @param programId ID of the program.
|
||||
* @param banner Pointer to output the legacy banner data to. (size = 0x23C0)
|
||||
* @param header Pointer to output the legacy banner data to. (size = 0x23C0)
|
||||
*/
|
||||
Result FSUSER_GetLegacyBannerData(FS_MediaType mediaType, u64 programId, void* banner);
|
||||
Result FSUSER_GetLegacyBannerData(FS_MediaType mediaType, u64 programId, u8* banner);
|
||||
|
||||
/**
|
||||
* @brief Checks a process's authority to access a save data archive.
|
||||
@ -706,7 +677,7 @@ Result FSUSER_GetFormatInfo(u32* totalSize, u32* directories, u32* files, bool*
|
||||
* @param programId ID of the program.
|
||||
* @param header Pointer to output the legacy ROM header to.
|
||||
*/
|
||||
Result FSUSER_GetLegacyRomHeader2(u32 headerSize, FS_MediaType mediaType, u64 programId, void* header);
|
||||
Result FSUSER_GetLegacyRomHeader2(u32 headerSize, FS_MediaType mediaType, u64 programId, u8* header);
|
||||
|
||||
/**
|
||||
* @brief Gets the CTR SDMC root path.
|
||||
@ -718,9 +689,9 @@ Result FSUSER_GetSdmcCtrRootPath(u8* out, u32 length);
|
||||
/**
|
||||
* @brief Gets an archive's resource information.
|
||||
* @param archiveResource Pointer to output the archive resource information to.
|
||||
* @param mediaType System media type to check.
|
||||
* @param mediaType Media type to check.
|
||||
*/
|
||||
Result FSUSER_GetArchiveResource(FS_ArchiveResource* archiveResource, FS_SystemMediaType mediaType);
|
||||
Result FSUSER_GetArchiveResource(FS_ArchiveResource* archiveResource, FS_MediaType mediaType);
|
||||
|
||||
/**
|
||||
* @brief Exports the integrity verification seed.
|
||||
@ -754,15 +725,7 @@ Result FSUSER_FormatSaveData(FS_ArchiveID archiveId, FS_Path path, u32 blocks, u
|
||||
* @param programId ID of the program.
|
||||
* @param header Pointer to output the legacy sub banner data to.
|
||||
*/
|
||||
Result FSUSER_GetLegacySubBannerData(u32 bannerSize, FS_MediaType mediaType, u64 programId, void* banner);
|
||||
|
||||
/**
|
||||
* @brief Hashes the given data and outputs a SHA256 hash.
|
||||
* @param data Pointer to the data to be hashed.
|
||||
* @param inputSize The size of the data.
|
||||
* @param hash Hash output pointer.
|
||||
*/
|
||||
Result FSUSER_UpdateSha256Context(const void* data, u32 inputSize, u8* hash);
|
||||
Result FSUSER_GetLegacySubBannerData(u32 bannerSize, FS_MediaType mediaType, u64 programId, u8* banner);
|
||||
|
||||
/**
|
||||
* @brief Reads from a special file.
|
||||
@ -771,7 +734,7 @@ Result FSUSER_UpdateSha256Context(const void* data, u32 inputSize, u8* hash);
|
||||
* @param size Size of the buffer.
|
||||
* @param data Buffer to read to.
|
||||
*/
|
||||
Result FSUSER_ReadSpecialFile(u32* bytesRead, u64 fileOffset, u32 size, void* data);
|
||||
Result FSUSER_ReadSpecialFile(u32* bytesRead, u64 fileOffset, u32 size, u8* data);
|
||||
|
||||
/**
|
||||
* @brief Gets the size of a special file.
|
||||
@ -880,7 +843,7 @@ Result FSUSER_SetCtrCardLatencyParameter(u64 latency, bool emulateEndurance);
|
||||
|
||||
/**
|
||||
* @brief Toggles cleaning up invalid save data.
|
||||
* @param enable Whether to enable cleaning up invalid save data.
|
||||
* @param Whether to enable cleaning up invalid save data.
|
||||
*/
|
||||
Result FSUSER_SwitchCleanupInvalidSaveData(bool enable);
|
||||
|
||||
@ -890,7 +853,7 @@ Result FSUSER_SwitchCleanupInvalidSaveData(bool enable);
|
||||
* @param idsSize Size of the IDs buffer.
|
||||
* @param ids Pointer to output IDs to.
|
||||
*/
|
||||
Result FSUSER_EnumerateSystemSaveData(u32* idsWritten, u32 idsSize, u32* ids);
|
||||
Result FSUSER_EnumerateSystemSaveData(u32* idsWritten, u32 idsSize, u64* ids);
|
||||
|
||||
/**
|
||||
* @brief Initializes a FSUSER session with an SDK version.
|
||||
|
@ -1,613 +0,0 @@
|
||||
/**
|
||||
* @file fspxi.h
|
||||
* @brief Service interface for PxiFS services. This is normally not accessible to userland apps. https://3dbrew.org/wiki/Filesystem_services_PXI
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/services/fs.h>
|
||||
#include <3ds/types.h>
|
||||
|
||||
typedef u64 FSPXI_Archive;
|
||||
typedef u64 FSPXI_File;
|
||||
typedef u64 FSPXI_Directory;
|
||||
|
||||
/**
|
||||
* @brief Opens a file.
|
||||
* @param out Pointer to output the file handle to.
|
||||
* @param archive Archive containing the file.
|
||||
* @param path Path of the file.
|
||||
* @param flags Flags to open the file with.
|
||||
* @param attributes Attributes of the file.
|
||||
*/
|
||||
Result FSPXI_OpenFile(Handle serviceHandle, FSPXI_File* out, FSPXI_Archive archive, FS_Path path, u32 flags, u32 attributes);
|
||||
|
||||
/**
|
||||
* @brief Deletes a file.
|
||||
* @param archive Archive containing the file.
|
||||
* @param path Path of the file.
|
||||
*/
|
||||
Result FSPXI_DeleteFile(Handle serviceHandle, FSPXI_Archive archive, FS_Path path);
|
||||
|
||||
/**
|
||||
* @brief Renames a file.
|
||||
* @param srcArchive Archive containing the source file.
|
||||
* @param srcPath Path of the source file.
|
||||
* @param dstArchive Archive containing the destination file.
|
||||
* @param dstPath Path of the destination file.
|
||||
*/
|
||||
Result FSPXI_RenameFile(Handle serviceHandle, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath);
|
||||
|
||||
/**
|
||||
* @brief Deletes a directory.
|
||||
* @param archive Archive containing the directory.
|
||||
* @param path Path of the directory.
|
||||
*/
|
||||
Result FSPXI_DeleteDirectory(Handle serviceHandle, FSPXI_Archive archive, FS_Path path);
|
||||
|
||||
/**
|
||||
* @brief Creates a file.
|
||||
* @param archive Archive to create the file in.
|
||||
* @param path Path of the file.
|
||||
* @param attributes Attributes of the file.
|
||||
* @param size Size of the file.
|
||||
*/
|
||||
Result FSPXI_CreateFile(Handle serviceHandle, FSPXI_Archive archive, FS_Path path, u32 attributes, u64 fileSize);
|
||||
|
||||
/**
|
||||
* @brief Creates a directory.
|
||||
* @param archive Archive to create the directory in.
|
||||
* @param path Path of the directory.
|
||||
* @param attributes Attributes of the directory.
|
||||
*/
|
||||
Result FSPXI_CreateDirectory(Handle serviceHandle, FSPXI_Archive archive, FS_Path path, u32 attributes);
|
||||
|
||||
/**
|
||||
* @brief Renames a directory.
|
||||
* @param srcArchive Archive containing the source directory.
|
||||
* @param srcPath Path of the source directory.
|
||||
* @param dstArchive Archive containing the destination directory.
|
||||
* @param dstPath Path of the destination directory.
|
||||
*/
|
||||
Result FSPXI_RenameDirectory(Handle serviceHandle, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath);
|
||||
|
||||
/**
|
||||
* @brief Opens a directory.
|
||||
* @param out Pointer to output the directory handle to.
|
||||
* @param archive Archive containing the directory.
|
||||
* @param path Path of the directory.
|
||||
*/
|
||||
Result FSPXI_OpenDirectory(Handle serviceHandle, FSPXI_Directory* out, FSPXI_Archive archive, FS_Path path);
|
||||
|
||||
/**
|
||||
* @brief Reads from a file.
|
||||
* @param file File to read from.
|
||||
* @param bytesRead Pointer to output the number of read bytes to.
|
||||
* @param offset Offset to read from.
|
||||
* @param buffer Buffer to read to.
|
||||
* @param size Size of the buffer.
|
||||
*/
|
||||
Result FSPXI_ReadFile(Handle serviceHandle, FSPXI_File file, u32* bytesRead, u64 offset, void* buffer, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Calculate SHA256 of a file.
|
||||
* @param file File to calculate the hash of.
|
||||
* @param buffer Buffer to output the hash to.
|
||||
* @param size Size of the buffer.
|
||||
*/
|
||||
Result FSPXI_CalculateFileHashSHA256(Handle serviceHandle, FSPXI_File file, void* buffer, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Writes to a file.
|
||||
* @param file File to write to.
|
||||
* @param bytesWritten Pointer to output the number of bytes written to.
|
||||
* @param offset Offset to write to.
|
||||
* @param buffer Buffer to write from.
|
||||
* @param size Size of the buffer.
|
||||
* @param flags Flags to use when writing.
|
||||
*/
|
||||
Result FSPXI_WriteFile(Handle serviceHandle, FSPXI_File file, u32* bytesWritten, u64 offset, const void* buffer, u32 size, u32 flags);
|
||||
|
||||
/**
|
||||
* @brief Calculates the MAC used in a DISA/DIFF header?
|
||||
* @param file Unsure
|
||||
* @param inBuffer 0x100-byte DISA/DIFF input buffer.
|
||||
* @param inSize Size of inBuffer.
|
||||
* @param outBuffer Buffer to write MAC to.
|
||||
* @param outSize Size of outBuffer.
|
||||
*/
|
||||
Result FSPXI_CalcSavegameMAC(Handle serviceHandle, FSPXI_File file, const void* inBuffer, u32 inSize, void* outBuffer, u32 outSize);
|
||||
|
||||
/**
|
||||
* @brief Get size of a file
|
||||
* @param file File to get the size of.
|
||||
* @param size Pointer to output size to.
|
||||
*/
|
||||
Result FSPXI_GetFileSize(Handle serviceHandle, FSPXI_File file, u64* size);
|
||||
|
||||
/**
|
||||
* @brief Set size of a file
|
||||
* @param file File to set the size of
|
||||
* @param size Size to set the file to
|
||||
*/
|
||||
Result FSPXI_SetFileSize(Handle serviceHandle, FSPXI_File file, u64 size);
|
||||
|
||||
/**
|
||||
* @brief Close a file
|
||||
* @param file File to close
|
||||
*/
|
||||
Result FSPXI_CloseFile(Handle serviceHandle, FSPXI_File file);
|
||||
|
||||
/**
|
||||
* @brief Reads one or more directory entries.
|
||||
* @param directory Directory to read from.
|
||||
* @param entriesRead Pointer to output the number of entries read to.
|
||||
* @param entryCount Number of entries to read.
|
||||
* @param entryOut Pointer to output directory entries to.
|
||||
*/
|
||||
Result FSPXI_ReadDirectory(Handle serviceHandle, FSPXI_Directory directory, u32* entriesRead, u32 entryCount, FS_DirectoryEntry* entries);
|
||||
|
||||
/**
|
||||
* @brief Close a directory
|
||||
* @param directory Directory to close.
|
||||
*/
|
||||
Result FSPXI_CloseDirectory(Handle serviceHandle, FSPXI_Directory directory);
|
||||
|
||||
/**
|
||||
* @brief Opens an archive.
|
||||
* @param archive Pointer to output the opened archive to.
|
||||
* @param id ID of the archive.
|
||||
* @param path Path of the archive.
|
||||
*/
|
||||
Result FSPXI_OpenArchive(Handle serviceHandle, FSPXI_Archive* archive, FS_ArchiveID archiveID, FS_Path path);
|
||||
|
||||
/**
|
||||
* @brief Checks if the archive contains a file at path.
|
||||
* @param archive Archive to check.
|
||||
* @param out Pointer to output existence to.
|
||||
* @param path Path to check for file
|
||||
*/
|
||||
Result FSPXI_HasFile(Handle serviceHandle, FSPXI_Archive archive, bool* out, FS_Path path);
|
||||
|
||||
/**
|
||||
* @brief Checks if the archive contains a directory at path.
|
||||
* @param archive Archive to check.
|
||||
* @param out Pointer to output existence to.
|
||||
* @param path Path to check for directory
|
||||
*/
|
||||
Result FSPXI_HasDirectory(Handle serviceHandle, FSPXI_Archive archive, bool* out, FS_Path path);
|
||||
|
||||
/**
|
||||
* @brief Commits an archive's save data.
|
||||
* @param archive Archive to commit.
|
||||
* @param id Archive action sent by FSUSER_ControlArchive. Must not be 0 or 0x789D
|
||||
* @remark Unsure why id is sent. This appears to be the default action for FSUSER_ControlArchive, with every action other than 0 and 0x789D being sent to this command.
|
||||
*/
|
||||
Result FSPXI_CommitSaveData(Handle serviceHandle, FSPXI_Archive archive, u32 id);
|
||||
|
||||
/**
|
||||
* @brief Close an archive
|
||||
* @param archive Archive to close.
|
||||
*/
|
||||
Result FSPXI_CloseArchive(Handle serviceHandle, FSPXI_Archive archive);
|
||||
|
||||
/**
|
||||
* @brief Unknown 0x17. Appears to be an "is archive handle valid" command?
|
||||
* @param archive Archive handle to check validity of.
|
||||
* @param out Pointer to output validity to.
|
||||
*/
|
||||
Result FSPXI_Unknown0x17(Handle serviceHandle, FSPXI_Archive archive, bool* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the inserted card type.
|
||||
* @param out Pointer to output the card type to.
|
||||
*/
|
||||
Result FSPXI_GetCardType(Handle serviceHandle, FS_CardType* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the SDMC archive resource information.
|
||||
* @param out Pointer to output the archive resource information to.
|
||||
*/
|
||||
Result FSPXI_GetSdmcArchiveResource(Handle serviceHandle, FS_ArchiveResource* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the NAND archive resource information.
|
||||
* @param out Pointer to output the archive resource information to.
|
||||
*/
|
||||
Result FSPXI_GetNandArchiveResource(Handle serviceHandle, FS_ArchiveResource* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the error code from the SDMC FatFS driver
|
||||
* @param out Pointer to output the error code to
|
||||
*/
|
||||
Result FSPXI_GetSdmcFatFsError(Handle serviceHandle, u32* out);
|
||||
|
||||
/**
|
||||
* @brief Gets whether PXIFS0 detects the SD
|
||||
* @param out Pointer to output the detection status to
|
||||
*/
|
||||
Result FSPXI_IsSdmcDetected(Handle serviceHandle, bool* out);
|
||||
|
||||
/**
|
||||
* @brief Gets whether PXIFS0 can write to the SD
|
||||
* @param out Pointer to output the writable status to
|
||||
*/
|
||||
Result FSPXI_IsSdmcWritable(Handle serviceHandle, bool* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the SDMC CID
|
||||
* @param out Buffer to output the CID to.
|
||||
* @param size Size of buffer.
|
||||
*/
|
||||
Result FSPXI_GetSdmcCid(Handle serviceHandle, void* out, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the NAND CID
|
||||
* @param out Buffer to output the CID to.
|
||||
* @param size Size of buffer.
|
||||
*/
|
||||
Result FSPXI_GetNandCid(Handle serviceHandle, void* out, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the SDMC speed info
|
||||
* @param out Buffer to output the speed info to.
|
||||
*/
|
||||
Result FSPXI_GetSdmcSpeedInfo(Handle serviceHandle, FS_SdMmcSpeedInfo* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the NAND speed info
|
||||
* @param out Buffer to output the speed info to.
|
||||
*/
|
||||
Result FSPXI_GetNandSpeedInfo(Handle serviceHandle, FS_SdMmcSpeedInfo* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the SDMC log
|
||||
* @param out Buffer to output the log to.
|
||||
* @param size Size of buffer.
|
||||
*/
|
||||
Result FSPXI_GetSdmcLog(Handle serviceHandle, void* out, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the NAND log
|
||||
* @param out Buffer to output the log to.
|
||||
* @param size Size of buffer.
|
||||
*/
|
||||
Result FSPXI_GetNandLog(Handle serviceHandle, void* out, u32 size);
|
||||
|
||||
/// Clears the SDMC log
|
||||
Result FSPXI_ClearSdmcLog(Handle serviceHandle);
|
||||
|
||||
/// Clears the NAND log
|
||||
Result FSPXI_ClearNandLog(Handle serviceHandle);
|
||||
|
||||
/**
|
||||
* @brief Gets whether a card is inserted.
|
||||
* @param inserted Pointer to output the insertion status to.
|
||||
*/
|
||||
Result FSPXI_CardSlotIsInserted(Handle serviceHandle, bool* inserted);
|
||||
|
||||
/**
|
||||
* @brief Powers on the card slot.
|
||||
* @param status Pointer to output the power status to.
|
||||
*/
|
||||
Result FSPXI_CardSlotPowerOn(Handle serviceHandle, bool* status);
|
||||
|
||||
/**
|
||||
* @brief Powers off the card slot.
|
||||
* @param status Pointer to output the power status to.
|
||||
*/
|
||||
Result FSPXI_CardSlotPowerOff(Handle serviceHandle, bool* status);
|
||||
|
||||
/**
|
||||
* @brief Gets the card's power status.
|
||||
* @param status Pointer to output the power status to.
|
||||
*/
|
||||
Result FSPXI_CardSlotGetCardIFPowerStatus(Handle serviceHandle, bool* status);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct command.
|
||||
* @param commandId ID of the command.
|
||||
*/
|
||||
Result FSPXI_CardNorDirectCommand(Handle serviceHandle, u8 commandId);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct command with an address.
|
||||
* @param commandId ID of the command.
|
||||
* @param address Address to provide.
|
||||
*/
|
||||
Result FSPXI_CardNorDirectCommandWithAddress(Handle serviceHandle, u8 commandId, u32 address);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct read.
|
||||
* @param commandId ID of the command.
|
||||
* @param size Size of the output buffer.
|
||||
* @param output Output buffer.
|
||||
*/
|
||||
Result FSPXI_CardNorDirectRead(Handle serviceHandle, u8 commandId, u32 size, void* output);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct read with an address.
|
||||
* @param commandId ID of the command.
|
||||
* @param address Address to provide.
|
||||
* @param size Size of the output buffer.
|
||||
* @param output Output buffer.
|
||||
*/
|
||||
Result FSPXI_CardNorDirectReadWithAddress(Handle serviceHandle, u8 commandId, u32 address, u32 size, void* output);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct write.
|
||||
* @param commandId ID of the command.
|
||||
* @param size Size of the input buffer.
|
||||
* @param output Input buffer.
|
||||
* @remark Stubbed in latest firmware, since ?.?.?
|
||||
*/
|
||||
Result FSPXI_CardNorDirectWrite(Handle serviceHandle, u8 commandId, u32 size, const void* input);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct write with an address.
|
||||
* @param commandId ID of the command.
|
||||
* @param address Address to provide.
|
||||
* @param size Size of the input buffer.
|
||||
* @param input Input buffer.
|
||||
*/
|
||||
Result FSPXI_CardNorDirectWriteWithAddress(Handle serviceHandle, u8 commandId, u32 address, u32 size, const void* input);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR 4xIO direct read.
|
||||
* @param commandId ID of the command.
|
||||
* @param address Address to provide.
|
||||
* @param size Size of the output buffer.
|
||||
* @param output Output buffer.
|
||||
*/
|
||||
Result FSPXI_CardNorDirectRead_4xIO(Handle serviceHandle, u8 commandId, u32 address, u32 size, void* output);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct CPU write without verify.
|
||||
* @param address Address to provide.
|
||||
* @param size Size of the input buffer.
|
||||
* @param output Input buffer.
|
||||
*/
|
||||
Result FSPXI_CardNorDirectCpuWriteWithoutVerify(Handle serviceHandle, u32 address, u32 size, const void* input);
|
||||
|
||||
/**
|
||||
* @brief Executes a CARDNOR direct sector erase without verify.
|
||||
* @param address Address to provide.
|
||||
*/
|
||||
Result FSPXI_CardNorDirectSectorEraseWithoutVerify(Handle serviceHandle, u32 address);
|
||||
|
||||
/**
|
||||
* @brief Gets an NCCH's product info
|
||||
* @param info Pointer to output the product info to.
|
||||
* @param archive Open NCCH content archive
|
||||
*/
|
||||
Result FSPXI_GetProductInfo(Handle serviceHandle, FS_ProductInfo* info, FSPXI_Archive archive);
|
||||
|
||||
/**
|
||||
* @brief Sets the CARDSPI baud rate.
|
||||
* @param baudRate Baud rate to set.
|
||||
*/
|
||||
Result FSPXI_SetCardSpiBaudrate(Handle serviceHandle, FS_CardSpiBaudRate baudRate);
|
||||
|
||||
/**
|
||||
* @brief Sets the CARDSPI bus mode.
|
||||
* @param busMode Bus mode to set.
|
||||
*/
|
||||
Result FSPXI_SetCardSpiBusMode(Handle serviceHandle, FS_CardSpiBusMode busMode);
|
||||
|
||||
/**
|
||||
* @brief Sends initialization info to ARM9
|
||||
* @param unk FS sends *(0x1FF81086)
|
||||
*/
|
||||
Result FSPXI_SendInitializeInfoTo9(Handle serviceHandle, u8 unk);
|
||||
|
||||
/**
|
||||
* @brief Creates ext save data.
|
||||
* @param info Info of the save data.
|
||||
*/
|
||||
Result FSPXI_CreateExtSaveData(Handle serviceHandle, FS_ExtSaveDataInfo info);
|
||||
|
||||
/**
|
||||
* @brief Deletes ext save data.
|
||||
* @param info Info of the save data.
|
||||
*/
|
||||
Result FSPXI_DeleteExtSaveData(Handle serviceHandle, FS_ExtSaveDataInfo info);
|
||||
|
||||
/**
|
||||
* @brief Enumerates ext save data.
|
||||
* @param idsWritten Pointer to output the number of IDs written to.
|
||||
* @param idsSize Size of the IDs buffer.
|
||||
* @param mediaType Media type to enumerate over.
|
||||
* @param idSize Size of each ID element.
|
||||
* @param shared Whether to enumerate shared ext save data.
|
||||
* @param ids Pointer to output IDs to.
|
||||
*/
|
||||
Result FSPXI_EnumerateExtSaveData(Handle serviceHandle, u32* idsWritten, u32 idsSize, FS_MediaType mediaType, u32 idSize, bool shared, u8* ids);
|
||||
|
||||
/**
|
||||
* @brief Gets a special content's index.
|
||||
* @param index Pointer to output the index to.
|
||||
* @param mediaType Media type of the special content.
|
||||
* @param programId Program ID owning the special content.
|
||||
* @param type Type of special content.
|
||||
*/
|
||||
Result FSPXI_GetSpecialContentIndex(Handle serviceHandle, u16* index, FS_MediaType mediaType, u64 programId, FS_SpecialContentType type);
|
||||
|
||||
/**
|
||||
* @brief Gets the legacy ROM header of a program.
|
||||
* @param mediaType Media type of the program.
|
||||
* @param programId ID of the program.
|
||||
* @param header Pointer to output the legacy ROM header to. (size = 0x3B4)
|
||||
*/
|
||||
Result FSPXI_GetLegacyRomHeader(Handle serviceHandle, FS_MediaType mediaType, u64 programId, void* header);
|
||||
|
||||
/**
|
||||
* @brief Gets the legacy banner data of a program.
|
||||
* @param mediaType Media type of the program.
|
||||
* @param programId ID of the program.
|
||||
* @param banner Pointer to output the legacy banner data to. (size = 0x23C0)
|
||||
* @param unk Unknown. Always 1?
|
||||
*/
|
||||
Result FSPXI_GetLegacyBannerData(Handle serviceHandle, FS_MediaType mediaType, u64 programId, void* banner, u8 unk);
|
||||
|
||||
/**
|
||||
* @brief Formats the CARDNOR device.
|
||||
* @param unk Unknown. Transaction?
|
||||
*/
|
||||
Result FSPXI_FormatCardNorDevice(Handle serviceHandle, u32 unk);
|
||||
|
||||
/// Deletes the 3DS SDMC root.
|
||||
Result FSPXI_DeleteSdmcRoot(Handle serviceHandle);
|
||||
|
||||
/// Deletes all ext save data on the NAND.
|
||||
Result FSPXI_DeleteAllExtSaveDataOnNand(Handle serviceHandle);
|
||||
|
||||
/// Initializes the CTR file system.
|
||||
Result FSPXI_InitializeCtrFilesystem(Handle serviceHandle);
|
||||
|
||||
/// Creates the FS seed.
|
||||
Result FSPXI_CreateSeed(Handle serviceHandle);
|
||||
|
||||
/**
|
||||
* @brief Gets the CTR SDMC root path.
|
||||
* @param out Pointer to output the root path to.
|
||||
* @param length Length of the output buffer in bytes.
|
||||
*/
|
||||
Result FSPXI_GetSdmcCtrRootPath(Handle serviceHandle, u16* out, u32 length);
|
||||
|
||||
/**
|
||||
* @brief Gets an archive's resource information.
|
||||
* @param archiveResource Pointer to output the archive resource information to.
|
||||
* @param mediaType System media type to check.
|
||||
*/
|
||||
Result FSPXI_GetArchiveResource(Handle serviceHandle, FS_ArchiveResource* archiveResource, FS_SystemMediaType mediaType);
|
||||
|
||||
/**
|
||||
* @brief Exports the integrity verification seed.
|
||||
* @param seed Pointer to output the seed to.
|
||||
*/
|
||||
Result FSPXI_ExportIntegrityVerificationSeed(Handle serviceHandle, FS_IntegrityVerificationSeed* seed);
|
||||
|
||||
/**
|
||||
* @brief Imports an integrity verification seed.
|
||||
* @param seed Seed to import.
|
||||
*/
|
||||
Result FSPXI_ImportIntegrityVerificationSeed(Handle serviceHandle, const FS_IntegrityVerificationSeed* seed);
|
||||
|
||||
/**
|
||||
* @brief Gets the legacy sub banner data of a program.
|
||||
* @param bannerSize Size of the banner.
|
||||
* @param mediaType Media type of the program.
|
||||
* @param programId ID of the program.
|
||||
* @param header Pointer to output the legacy sub banner data to.
|
||||
*/
|
||||
Result FSPXI_GetLegacySubBannerData(Handle serviceHandle, u32 bannerSize, FS_MediaType mediaType, u64 programId, void* banner);
|
||||
|
||||
/**
|
||||
* @brief Generates random bytes. Uses same code as PSPXI_GenerateRandomBytes
|
||||
* @param buf Buffer to output random bytes to.
|
||||
* @param size Size of buffer.
|
||||
*/
|
||||
Result FSPXI_GenerateRandomBytes(Handle serviceHandle, void* buffer, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the last modified time of a file in an archive.
|
||||
* @param archive The archive that contains the file.
|
||||
* @param out The pointer to write the timestamp to.
|
||||
* @param path The UTF-16 path of the file.
|
||||
* @param size The size of the path.
|
||||
*/
|
||||
Result FSPXI_GetFileLastModified(Handle serviceHandle, FSPXI_Archive archive, u64* out, const u16* path, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Reads from a special file.
|
||||
* @param bytesRead Pointer to output the number of bytes read to.
|
||||
* @param fileOffset Offset of the file.
|
||||
* @param size Size of the buffer.
|
||||
* @param data Buffer to read to.
|
||||
*/
|
||||
Result FSPXI_ReadSpecialFile(Handle serviceHandle, u32* bytesRead, u64 fileOffset, u32 size, void* data);
|
||||
|
||||
/**
|
||||
* @brief Gets the size of a special file.
|
||||
* @param fileSize Pointer to output the size to.
|
||||
*/
|
||||
Result FSPXI_GetSpecialFileSize(Handle serviceHandle, u64* fileSize);
|
||||
|
||||
/**
|
||||
* @brief Initiates a device move as the source device.
|
||||
* @param context Pointer to output the context to.
|
||||
*/
|
||||
Result FSPXI_StartDeviceMoveAsSource(Handle serviceHandle, FS_DeviceMoveContext* context);
|
||||
|
||||
/**
|
||||
* @brief Initiates a device move as the destination device.
|
||||
* @param context Context to use.
|
||||
* @param clear Whether to clear the device's data first.
|
||||
*/
|
||||
Result FSPXI_StartDeviceMoveAsDestination(Handle serviceHandle, FS_DeviceMoveContext context, bool clear);
|
||||
|
||||
/**
|
||||
* @brief Reads data and stores SHA256 hashes of blocks
|
||||
* @param file File to read from.
|
||||
* @param bytesRead Pointer to output the number of read bytes to.
|
||||
* @param offset Offset to read from.
|
||||
* @param readBuffer Pointer to store read data in.
|
||||
* @param readBufferSize Size of readBuffer.
|
||||
* @param hashtable Pointer to store SHA256 hashes in.
|
||||
* @param hashtableSize Size of hashtable.
|
||||
* @param unk Unknown. Always 0x00001000? Possibly block size?
|
||||
*/
|
||||
Result FSPXI_ReadFileSHA256(Handle serviceHandle, FSPXI_File file, u32* bytesRead, u64 offset, void* readBuffer, u32 readBufferSize, void* hashtable, u32 hashtableSize, u32 unk);
|
||||
|
||||
/**
|
||||
* @brief Assumedly writes data and stores SHA256 hashes of blocks
|
||||
* @param file File to write to.
|
||||
* @param bytesWritten Pointer to output the number of written bytes to.
|
||||
* @param offset Offset to write to.
|
||||
* @param writeBuffer Buffer to write from.
|
||||
* @param writeBufferSize Size of writeBuffer.
|
||||
* @param hashtable Pointer to store SHA256 hashes in.
|
||||
* @param hashtableSize Size of hashtable
|
||||
* @param unk1 Unknown. Might match with ReadFileSHA256's unknown?
|
||||
* @param unk2 Unknown. Might match with ReadFileSHA256's unknown?
|
||||
*/
|
||||
Result FSPXI_WriteFileSHA256(Handle serviceHandle, FSPXI_File file, u32* bytesWritten, u64 offset, const void* writeBuffer, u32 writeBufferSize, void* hashtable, u32 hashtableSize, u32 unk1, u32 unk2);
|
||||
|
||||
/**
|
||||
* @brief Configures CTRCARD latency emulation.
|
||||
* @param latency Latency to apply.
|
||||
*/
|
||||
Result FSPXI_SetCtrCardLatencyParameter(Handle serviceHandle, u64 latency);
|
||||
|
||||
/**
|
||||
* @brief Sets the file system priority.
|
||||
* @param priority Priority to set.
|
||||
*/
|
||||
Result FSPXI_SetPriority(Handle serviceHandle, u32 priority);
|
||||
|
||||
/**
|
||||
* @brief Toggles cleaning up invalid save data.
|
||||
* @param enable Whether to enable cleaning up invalid save data.
|
||||
*/
|
||||
Result FSPXI_SwitchCleanupInvalidSaveData(Handle serviceHandle, bool enable);
|
||||
|
||||
/**
|
||||
* @brief Enumerates system save data.
|
||||
* @param idsWritten Pointer to output the number of IDs written to.
|
||||
* @param idsSize Size of the IDs buffer.
|
||||
* @param ids Pointer to output IDs to.
|
||||
*/
|
||||
Result FSPXI_EnumerateSystemSaveData(Handle serviceHandle, u32* idsWritten, u32 idsSize, u32* ids);
|
||||
|
||||
/**
|
||||
* @brief Reads the NAND report.
|
||||
* @param unk Unknown
|
||||
* @param buffer Buffer to write the report to.
|
||||
* @param size Size of buffer
|
||||
*/
|
||||
Result FSPXI_ReadNandReport(Handle serviceHandle, void* buffer, u32 size, u32 unk);
|
||||
|
||||
/**
|
||||
* @brief Unknown command 0x56
|
||||
* @remark Called by FSUSER_ControlArchive with ArchiveAction 0x789D
|
||||
*/
|
||||
Result FSPXI_Unknown0x56(Handle serviceHandle, u32 out[4], FS_Archive archive, FS_Path path);
|
@ -1,63 +0,0 @@
|
||||
/**
|
||||
* @file fsReg.h
|
||||
* @brief Filesystem registry service
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <3ds/exheader.h>
|
||||
#include <3ds/services/fs.h>
|
||||
|
||||
/// Initializes fs:REG.
|
||||
Result fsRegInit(void);
|
||||
|
||||
/// Exits fs:REG.
|
||||
void fsRegExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current fs:REG session handle.
|
||||
* @return The current fs:REG session handle.
|
||||
*/
|
||||
Handle *fsRegGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Registers a program's storage information.
|
||||
* @param pid The Process ID of the program.
|
||||
* @param programHandle The program handle.
|
||||
* @param programInfo Information about the program.
|
||||
* @param storageInfo Storage information to register.
|
||||
*/
|
||||
Result FSREG_Register(u32 pid, u64 programHandle, const FS_ProgramInfo *programInfo, const ExHeader_Arm11StorageInfo *storageInfo);
|
||||
|
||||
/**
|
||||
* @brief Unregisters a program's storage information.
|
||||
* @param pid The Process ID of the program.
|
||||
*/
|
||||
Result FSREG_Unregister(u32 pid);
|
||||
|
||||
/**
|
||||
* @brief Retrives the exheader information set(s) (SCI+ACI) about a program.
|
||||
* @param exheaderInfos[out] Pointer to the output exheader information set(s).
|
||||
* @param maxNumEntries The maximum number of entries.
|
||||
* @param programHandle The program handle.
|
||||
*/
|
||||
Result FSREG_GetProgramInfo(ExHeader_Info *exheaderInfos, u32 maxNumEntries, u64 programHandle);
|
||||
|
||||
/**
|
||||
* @brief Loads a program.
|
||||
* @param programHandle[out] Pointer to the output the program handle to.
|
||||
* @param programInfo Information about the program to load.
|
||||
*/
|
||||
Result FSREG_LoadProgram(u64 *programHandle, const FS_ProgramInfo *programInfo);
|
||||
|
||||
/**
|
||||
* @brief Unloads a program.
|
||||
* @param programHandle The program handle.
|
||||
*/
|
||||
Result FSREG_UnloadProgram(u64 programHandle);
|
||||
|
||||
/**
|
||||
* @brief Checks if a program has been loaded by fs:REG.
|
||||
* @param programHandle The program handle.
|
||||
*/
|
||||
Result FSREG_CheckHostLoadId(u64 programHandle);
|
@ -4,12 +4,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define GSP_SCREEN_TOP 0 ///< ID of the top screen.
|
||||
#define GSP_SCREEN_BOTTOM 1 ///< ID of the bottom screen.
|
||||
#define GSP_SCREEN_WIDTH 240 ///< Width of the top/bottom screens.
|
||||
#define GSP_SCREEN_HEIGHT_TOP 400 ///< Height of the top screen.
|
||||
#define GSP_SCREEN_HEIGHT_TOP_2X 800 ///< Height of the top screen (2x).
|
||||
#define GSP_SCREEN_HEIGHT_BOTTOM 320 ///< Height of the bottom screen.
|
||||
#define GSPGPU_REBASE_REG(r) ((r)-0x1EB00000)
|
||||
|
||||
/// Framebuffer information.
|
||||
typedef struct
|
||||
@ -31,7 +26,7 @@ typedef enum
|
||||
GSP_RGB565_OES=2, ///< RGB565. (2 bytes)
|
||||
GSP_RGB5_A1_OES=3, ///< RGB5A1. (2 bytes)
|
||||
GSP_RGBA4_OES=4 ///< RGBA4. (2 bytes)
|
||||
} GSPGPU_FramebufferFormat;
|
||||
} GSPGPU_FramebufferFormats;
|
||||
|
||||
/// Capture info entry.
|
||||
typedef struct
|
||||
@ -62,61 +57,12 @@ typedef enum
|
||||
GSPGPU_EVENT_MAX, ///< Used to know how many events there are.
|
||||
} GSPGPU_Event;
|
||||
|
||||
/**
|
||||
* @brief Gets the number of bytes per pixel for the specified format.
|
||||
* @param format See \ref GSPGPU_FramebufferFormat.
|
||||
* @return Bytes per pixel.
|
||||
*/
|
||||
static inline unsigned gspGetBytesPerPixel(GSPGPU_FramebufferFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case GSP_RGBA8_OES:
|
||||
return 4;
|
||||
default:
|
||||
case GSP_BGR8_OES:
|
||||
return 3;
|
||||
case GSP_RGB565_OES:
|
||||
case GSP_RGB5_A1_OES:
|
||||
case GSP_RGBA4_OES:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes GSPGPU.
|
||||
Result gspInit(void);
|
||||
|
||||
/// Exits GSPGPU.
|
||||
void gspExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the current gsp::Gpu session handle.
|
||||
* @return A pointer to the current gsp::Gpu session handle.
|
||||
*/
|
||||
Handle *gspGetSessionHandle(void);
|
||||
|
||||
/// Returns true if the application currently has GPU rights.
|
||||
bool gspHasGpuRight(void);
|
||||
|
||||
/**
|
||||
* @brief Presents a buffer to the specified screen.
|
||||
* @param screen Screen ID (see \ref GSP_SCREEN_TOP and \ref GSP_SCREEN_BOTTOM)
|
||||
* @param swap Specifies which set of framebuffer registers to configure and activate (0 or 1)
|
||||
* @param fb_a Pointer to the framebuffer (in stereo mode: left eye)
|
||||
* @param fb_b Pointer to the secondary framebuffer (only used in stereo mode for the right eye, otherwise pass the same as fb_a)
|
||||
* @param stride Stride in bytes between scanlines
|
||||
* @param mode Mode configuration to be written to LCD register
|
||||
* @return true if a buffer had already been presented to the screen but not processed yet by GSP, false otherwise.
|
||||
* @note The most recently presented buffer is processed and configured during the specified screen's next VBlank event.
|
||||
*/
|
||||
bool gspPresentBuffer(unsigned screen, unsigned swap, const void* fb_a, const void* fb_b, u32 stride, u32 mode);
|
||||
|
||||
/**
|
||||
* @brief Returns true if a prior \ref gspPresentBuffer command is still pending to be processed by GSP.
|
||||
* @param screen Screen ID (see \ref GSP_SCREEN_TOP and \ref GSP_SCREEN_BOTTOM)
|
||||
*/
|
||||
bool gspIsPresentPending(unsigned screen);
|
||||
|
||||
/**
|
||||
* @brief Configures a callback to run when a GSPGPU event occurs.
|
||||
* @param id ID of the event.
|
||||
@ -126,6 +72,17 @@ bool gspIsPresentPending(unsigned screen);
|
||||
*/
|
||||
void gspSetEventCallback(GSPGPU_Event id, ThreadFunc cb, void* data, bool oneShot);
|
||||
|
||||
/**
|
||||
* @brief Initializes the GSPGPU event handler.
|
||||
* @param gspEvent Event handle to use.
|
||||
* @param gspSharedMem GSP shared memory.
|
||||
* @param gspThreadId ID of the GSP thread.
|
||||
*/
|
||||
Result gspInitEventHandler(Handle gspEvent, vu8* gspSharedMem, u8 gspThreadId);
|
||||
|
||||
/// Exits the GSPGPU event handler.
|
||||
void gspExitEventHandler(void);
|
||||
|
||||
/**
|
||||
* @brief Waits for a GSPGPU event to occur.
|
||||
* @param id ID of the event.
|
||||
@ -167,9 +124,10 @@ GSPGPU_Event gspWaitForAnyEvent(void);
|
||||
|
||||
/**
|
||||
* @brief Submits a GX command.
|
||||
* @param sharedGspCmdBuf Command buffer to use.
|
||||
* @param gxCommand GX command to execute.
|
||||
*/
|
||||
Result gspSubmitGxCommand(const u32 gxCommand[0x8]);
|
||||
Result gspSubmitGxCommand(u32* sharedGspCmdBuf, u32 gxCommand[0x8]);
|
||||
|
||||
/**
|
||||
* @brief Acquires GPU rights.
|
||||
@ -184,14 +142,11 @@ Result GSPGPU_ReleaseRight(void);
|
||||
* @brief Retrieves display capture info.
|
||||
* @param captureinfo Pointer to output capture info to.
|
||||
*/
|
||||
Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo* captureinfo);
|
||||
Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo*captureinfo);
|
||||
|
||||
/// Saves the VRAM sys area.
|
||||
/// Sames the VRAM sys area.
|
||||
Result GSPGPU_SaveVramSysArea(void);
|
||||
|
||||
/// Resets the GPU
|
||||
Result GSPGPU_ResetGpuCore(void);
|
||||
|
||||
/// Restores the VRAM sys area.
|
||||
Result GSPGPU_RestoreVramSysArea(void);
|
||||
|
||||
@ -206,7 +161,7 @@ Result GSPGPU_SetLcdForceBlack(u8 flags);
|
||||
* @param screenid ID of the screen to update.
|
||||
* @param framebufinfo Framebuffer information to update with.
|
||||
*/
|
||||
Result GSPGPU_SetBufferSwap(u32 screenid, const GSPGPU_FramebufferInfo* framebufinfo);
|
||||
Result GSPGPU_SetBufferSwap(u32 screenid, GSPGPU_FramebufferInfo*framebufinfo);
|
||||
|
||||
/**
|
||||
* @brief Flushes memory from the data cache.
|
||||
@ -228,7 +183,7 @@ Result GSPGPU_InvalidateDataCache(const void* adr, u32 size);
|
||||
* @param data Data to write.
|
||||
* @param size Size of the data to write.
|
||||
*/
|
||||
Result GSPGPU_WriteHWRegs(u32 regAddr, const u32* data, u8 size);
|
||||
Result GSPGPU_WriteHWRegs(u32 regAddr, u32* data, u8 size);
|
||||
|
||||
/**
|
||||
* @brief Writes to GPU hardware registers with a mask.
|
||||
@ -238,7 +193,7 @@ Result GSPGPU_WriteHWRegs(u32 regAddr, const u32* data, u8 size);
|
||||
* @param maskdata Data of the mask.
|
||||
* @param masksize Size of the mask.
|
||||
*/
|
||||
Result GSPGPU_WriteHWRegsWithMask(u32 regAddr, const u32* data, u8 datasize, const u32* maskdata, u8 masksize);
|
||||
Result GSPGPU_WriteHWRegsWithMask(u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize);
|
||||
|
||||
/**
|
||||
* @brief Reads from GPU hardware registers.
|
||||
@ -263,8 +218,3 @@ Result GSPGPU_UnregisterInterruptRelayQueue(void);
|
||||
/// Triggers a handling of commands written to shared memory.
|
||||
Result GSPGPU_TriggerCmdReqQueue(void);
|
||||
|
||||
/**
|
||||
* @brief Sets 3D_LEDSTATE to the input state value.
|
||||
* @param disable False = 3D LED enable, true = 3D LED disable.
|
||||
*/
|
||||
Result GSPGPU_SetLedForceOff(bool disable);
|
||||
|
@ -3,14 +3,13 @@
|
||||
* @brief GSPLCD service.
|
||||
*/
|
||||
#pragma once
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/services/gspgpu.h>
|
||||
#include <3ds/gfx.h> // For gfxScreen_t
|
||||
|
||||
/// LCD screens.
|
||||
enum
|
||||
{
|
||||
GSPLCD_SCREEN_TOP = BIT(GSP_SCREEN_TOP), ///< Top screen.
|
||||
GSPLCD_SCREEN_BOTTOM = BIT(GSP_SCREEN_BOTTOM), ///< Bottom screen.
|
||||
GSPLCD_SCREEN_TOP = BIT(GFX_TOP), ///< Top screen.
|
||||
GSPLCD_SCREEN_BOTTOM = BIT(GFX_BOTTOM), ///< Bottom screen.
|
||||
GSPLCD_SCREEN_BOTH = GSPLCD_SCREEN_TOP | GSPLCD_SCREEN_BOTTOM, ///< Both screens.
|
||||
};
|
||||
|
||||
@ -20,18 +19,6 @@ Result gspLcdInit(void);
|
||||
/// Exits GSPLCD.
|
||||
void gspLcdExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the current gsp::Lcd session handle.
|
||||
* @return A pointer to the current gsp::Lcd session handle.
|
||||
*/
|
||||
Handle *gspLcdGetSessionHandle(void);
|
||||
|
||||
/// Powers on both backlights.
|
||||
Result GSPLCD_PowerOnAllBacklights(void);
|
||||
|
||||
/// Powers off both backlights.
|
||||
Result GSPLCD_PowerOffAllBacklights(void);
|
||||
|
||||
/**
|
||||
* @brief Powers on the backlight.
|
||||
* @param screen Screen to power on.
|
||||
@ -44,35 +31,3 @@ Result GSPLCD_PowerOnBacklight(u32 screen);
|
||||
*/
|
||||
Result GSPLCD_PowerOffBacklight(u32 screen);
|
||||
|
||||
/**
|
||||
* @brief Sets 3D_LEDSTATE to the input state value.
|
||||
* @param disable False = 3D LED enable, true = 3D LED disable.
|
||||
*/
|
||||
Result GSPLCD_SetLedForceOff(bool disable);
|
||||
|
||||
/**
|
||||
* @brief Gets the LCD screens' vendors. Stubbed on old 3ds.
|
||||
* @param vendor Pointer to output the screen vendors to.
|
||||
*/
|
||||
Result GSPLCD_GetVendors(u8 *vendors);
|
||||
|
||||
/**
|
||||
* @brief Gets the LCD screens' brightness. Stubbed on old 3ds.
|
||||
* @param screen Screen to get the brightness value of.
|
||||
* @param brightness Brightness value returned.
|
||||
*/
|
||||
Result GSPLCD_GetBrightness(u32 screen, u32 *brightness);
|
||||
|
||||
/**
|
||||
* @brief Sets the LCD screens' brightness.
|
||||
* @param screen Screen to set the brightness value of.
|
||||
* @param brightness Brightness value set.
|
||||
*/
|
||||
Result GSPLCD_SetBrightness(u32 screen, u32 brightness);
|
||||
|
||||
/**
|
||||
* @brief Sets the LCD screens' raw brightness.
|
||||
* @param screen Screen to set the brightness value of.
|
||||
* @param brightness Brightness value set.
|
||||
*/
|
||||
Result GSPLCD_SetBrightnessRaw(u32 screen, u32 brightness);
|
||||
|
38
libctru/include/3ds/services/hb.h
Normal file
38
libctru/include/3ds/services/hb.h
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file hb.h
|
||||
* @brief HB (Homebrew) service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// WARNING ! THIS FILE PROVIDES AN INTERFACE TO A NON-OFFICIAL SERVICE PROVIDED BY NINJHAX
|
||||
// BY USING COMMANDS FROM THIS SERVICE YOU WILL LIKELY MAKE YOUR APPLICATION INCOMPATIBLE WITH OTHER HOMEBREW LAUNCHING METHODS
|
||||
// A GOOD WAY TO COPE WITH THIS IS TO CHECK THE OUTPUT OF hbInit FOR ERRORS
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Initializes HB.
|
||||
Result hbInit(void);
|
||||
|
||||
/// Exits HB.
|
||||
void hbExit(void);
|
||||
|
||||
/// Flushes/invalidates the entire data/instruction cache.
|
||||
Result HB_FlushInvalidateCache(void);
|
||||
|
||||
/**
|
||||
* @brief Fetches the address for Ninjhax 1.x bootloader addresses.
|
||||
* @param load3dsx void (*callBootloader)(Handle hb, Handle file);
|
||||
* @param setArgv void (*setArgs)(u32* src, u32 length);
|
||||
*/
|
||||
Result HB_GetBootloaderAddresses(void** load3dsx, void** setArgv);
|
||||
|
||||
/**
|
||||
* @brief Changes the permissions of a given number of pages at address addr to mode.
|
||||
* Should it fail, the appropriate kernel error code will be returned and *reprotectedPages (if not NULL)
|
||||
* will be set to the number of sequential pages which were successfully reprotected + 1
|
||||
* @param addr Address to reprotect.
|
||||
* @param pages Number of pages to reprotect.
|
||||
* @param mode Mode to reprotect to.
|
||||
* @param reprotectedPages Number of successfully reprotected pages, on failure.
|
||||
*/
|
||||
Result HB_ReprotectMemory(u32* addr, u32 pages, u32 mode, u32* reprotectedPages);
|
@ -91,41 +91,27 @@ Result hidInit(void);
|
||||
/// Exits HID.
|
||||
void hidExit(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the key repeat parameters for @ref hidKeysRepeat.
|
||||
* @param delay Initial delay.
|
||||
* @param interval Repeat interval.
|
||||
*/
|
||||
void hidSetRepeatParameters(u32 delay, u32 interval);
|
||||
|
||||
/// Scans HID for input data.
|
||||
void hidScanInput(void);
|
||||
|
||||
/**
|
||||
* @brief Returns a bitmask of held buttons.
|
||||
* Individual buttons can be extracted using binary AND.
|
||||
* @return 32-bit bitmask of held buttons (1+ frames).
|
||||
* @brief Gets the currently held keys.
|
||||
* Individual keys can be checked by ORing them with this value.
|
||||
* @return Keys held.
|
||||
*/
|
||||
u32 hidKeysHeld(void);
|
||||
|
||||
/**
|
||||
* @brief Returns a bitmask of newly pressed buttons, this frame.
|
||||
* Individual buttons can be extracted using binary AND.
|
||||
* @return 32-bit bitmask of newly pressed buttons.
|
||||
* @brief Gets keys that were just pressed.
|
||||
* Individual keys can be checked by ORing them with this value.
|
||||
* @return Keys down.
|
||||
*/
|
||||
u32 hidKeysDown(void);
|
||||
|
||||
/**
|
||||
* @brief Returns a bitmask of newly pressed or repeated buttons, this frame.
|
||||
* Individual buttons can be extracted using binary AND.
|
||||
* @return 32-bit bitmask of newly pressed or repeated buttons.
|
||||
*/
|
||||
u32 hidKeysDownRepeat(void);
|
||||
|
||||
/**
|
||||
* @brief Returns a bitmask of newly released buttons, this frame.
|
||||
* Individual buttons can be extracted using binary AND.
|
||||
* @return 32-bit bitmask of newly released buttons.
|
||||
* @brief Gets keys that were just released.
|
||||
* Individual keys can be checked by ORing them with this value.
|
||||
* @return Keys up.
|
||||
*/
|
||||
u32 hidKeysUp(void);
|
||||
|
||||
@ -160,14 +146,6 @@ void hidGyroRead(angularRate* rate);
|
||||
*/
|
||||
void hidWaitForEvent(HID_Event id, bool nextEvent);
|
||||
|
||||
/**
|
||||
* @brief Waits for any HID or IRRST event.
|
||||
* @param nextEvents Whether to discard the current events and wait for the next events.
|
||||
* @param cancelEvent Optional additional handle to wait on, otherwise 0.
|
||||
* @param timeout Timeout.
|
||||
*/
|
||||
Result hidWaitForAnyEvent(bool nextEvents, Handle cancelEvent, s64 timeout);
|
||||
|
||||
/// Compatibility macro for hidScanInput.
|
||||
#define scanKeys hidScanInput
|
||||
/// Compatibility macro for hidKeysHeld.
|
||||
|
@ -10,38 +10,17 @@ typedef struct {
|
||||
u32 httphandle; ///< HTTP handle.
|
||||
} httpcContext;
|
||||
|
||||
/// HTTP request method.
|
||||
typedef enum {
|
||||
HTTPC_METHOD_GET = 0x1,
|
||||
HTTPC_METHOD_POST = 0x2,
|
||||
HTTPC_METHOD_HEAD = 0x3,
|
||||
HTTPC_METHOD_PUT = 0x4,
|
||||
HTTPC_METHOD_DELETE = 0x5
|
||||
} HTTPC_RequestMethod;
|
||||
|
||||
/// HTTP request status.
|
||||
typedef enum {
|
||||
HTTPC_STATUS_REQUEST_IN_PROGRESS = 0x5, ///< Request in progress.
|
||||
HTTPC_STATUS_DOWNLOAD_READY = 0x7 ///< Download ready.
|
||||
} HTTPC_RequestStatus;
|
||||
|
||||
/// HTTP KeepAlive option.
|
||||
typedef enum {
|
||||
HTTPC_KEEPALIVE_DISABLED = 0x0,
|
||||
HTTPC_KEEPALIVE_ENABLED = 0x1
|
||||
} HTTPC_KeepAlive;
|
||||
|
||||
/// Result code returned when a download is pending.
|
||||
#define HTTPC_RESULTCODE_DOWNLOADPENDING 0xd840a02b
|
||||
|
||||
// Result code returned when asked about a non-existing header.
|
||||
#define HTTPC_RESULTCODE_NOTFOUND 0xd840a028
|
||||
|
||||
// Result code returned when any timeout function times out.
|
||||
#define HTTPC_RESULTCODE_TIMEDOUT 0xd820a069
|
||||
|
||||
/// Initializes HTTPC. For HTTP GET the sharedmem_size can be zero. The sharedmem contains data which will be later uploaded for HTTP POST. sharedmem_size should be aligned to 0x1000-bytes.
|
||||
Result httpcInit(u32 sharedmem_size);
|
||||
/// Initializes HTTPC.
|
||||
Result httpcInit(void);
|
||||
|
||||
/// Exits HTTPC.
|
||||
void httpcExit(void);
|
||||
@ -52,7 +31,7 @@ void httpcExit(void);
|
||||
* @param url URL to connect to.
|
||||
* @param use_defaultproxy Whether the default proxy should be used (0 for default)
|
||||
*/
|
||||
Result httpcOpenContext(httpcContext *context, HTTPC_RequestMethod method, const char* url, u32 use_defaultproxy);
|
||||
Result httpcOpenContext(httpcContext *context, char* url, u32 use_defaultproxy);
|
||||
|
||||
/**
|
||||
* @brief Closes a HTTP context.
|
||||
@ -60,44 +39,13 @@ Result httpcOpenContext(httpcContext *context, HTTPC_RequestMethod method, const
|
||||
*/
|
||||
Result httpcCloseContext(httpcContext *context);
|
||||
|
||||
/**
|
||||
* @brief Cancels a HTTP connection.
|
||||
* @param context Context to close.
|
||||
*/
|
||||
Result httpcCancelConnection(httpcContext *context);
|
||||
|
||||
/**
|
||||
* @brief Adds a request header field to a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param name Name of the field.
|
||||
* @param value Value of the field.
|
||||
*/
|
||||
Result httpcAddRequestHeaderField(httpcContext *context, const char* name, const char* value);
|
||||
|
||||
/**
|
||||
* @brief Adds a POST form field to a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param name Name of the field.
|
||||
* @param value Value of the field.
|
||||
*/
|
||||
Result httpcAddPostDataAscii(httpcContext *context, const char* name, const char* value);
|
||||
|
||||
/**
|
||||
* @brief Adds a POST form field with binary data to a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param name Name of the field.
|
||||
* @param value The binary data to pass as a value.
|
||||
* @param len Length of the binary data which has been passed.
|
||||
*/
|
||||
Result httpcAddPostDataBinary(httpcContext *context, const char* name, const u8* value, u32 len);
|
||||
|
||||
/**
|
||||
* @brief Adds a POST body to a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param data The data to be passed as raw into the body of the post request.
|
||||
* @param len Length of data passed by data param.
|
||||
*/
|
||||
Result httpcAddPostDataRaw(httpcContext *context, const u32* data, u32 len);
|
||||
Result httpcAddRequestHeaderField(httpcContext *context, char* name, char* value);
|
||||
|
||||
/**
|
||||
* @brief Begins a HTTP request.
|
||||
@ -113,15 +61,6 @@ Result httpcBeginRequest(httpcContext *context);
|
||||
*/
|
||||
Result httpcReceiveData(httpcContext *context, u8* buffer, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Receives data from a HTTP context with a timeout value.
|
||||
* @param context Context to use.
|
||||
* @param buffer Buffer to receive data to.
|
||||
* @param size Size of the buffer.
|
||||
* @param timeout Maximum time in nanoseconds to wait for a reply.
|
||||
*/
|
||||
Result httpcReceiveDataTimeout(httpcContext *context, u8* buffer, u32 size, u64 timeout);
|
||||
|
||||
/**
|
||||
* @brief Gets the request state of a HTTP context.
|
||||
* @param context Context to use.
|
||||
@ -141,16 +80,9 @@ Result httpcGetDownloadSizeState(httpcContext *context, u32* downloadedsize, u32
|
||||
* @brief Gets the response code of the HTTP context.
|
||||
* @param context Context to get the response code of.
|
||||
* @param out Pointer to write the response code to.
|
||||
* @param delay Delay to wait for the status code. Not used yet.
|
||||
*/
|
||||
Result httpcGetResponseStatusCode(httpcContext *context, u32* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the response code of the HTTP context with a timeout value.
|
||||
* @param context Context to get the response code of.
|
||||
* @param out Pointer to write the response code to.
|
||||
* @param timeout Maximum time in nanoseconds to wait for a reply.
|
||||
*/
|
||||
Result httpcGetResponseStatusCodeTimeout(httpcContext *context, u32* out, u64 timeout);
|
||||
Result httpcGetResponseStatusCode(httpcContext *context, u32* out, u64 delay);
|
||||
|
||||
/**
|
||||
* @brief Gets a response header field from a HTTP context.
|
||||
@ -159,128 +91,7 @@ Result httpcGetResponseStatusCodeTimeout(httpcContext *context, u32* out, u64 ti
|
||||
* @param value Pointer to output the value of the field to.
|
||||
* @param valuebuf_maxsize Maximum size of the value buffer.
|
||||
*/
|
||||
Result httpcGetResponseHeader(httpcContext *context, const char* name, char* value, u32 valuebuf_maxsize);
|
||||
|
||||
/**
|
||||
* @brief Adds a trusted RootCA cert to a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param cert Pointer to DER cert.
|
||||
* @param certsize Size of the DER cert.
|
||||
*/
|
||||
Result httpcAddTrustedRootCA(httpcContext *context, const u8 *cert, u32 certsize);
|
||||
|
||||
/**
|
||||
* @brief Adds a default RootCA cert to a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param certID ID of the cert to add, see sslc.h.
|
||||
*/
|
||||
Result httpcAddDefaultCert(httpcContext *context, SSLC_DefaultRootCert certID);
|
||||
|
||||
/**
|
||||
* @brief Sets the RootCertChain for a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param RootCertChain_contexthandle Contexthandle for the RootCertChain.
|
||||
*/
|
||||
Result httpcSelectRootCertChain(httpcContext *context, u32 RootCertChain_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Sets the ClientCert for a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param cert Pointer to DER cert.
|
||||
* @param certsize Size of the DER cert.
|
||||
* @param privk Pointer to the DER private key.
|
||||
* @param privk_size Size of the privk.
|
||||
*/
|
||||
Result httpcSetClientCert(httpcContext *context, const u8 *cert, u32 certsize, const u8 *privk, u32 privk_size);
|
||||
|
||||
/**
|
||||
* @brief Sets the default clientcert for a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param certID ID of the cert to add, see sslc.h.
|
||||
*/
|
||||
Result httpcSetClientCertDefault(httpcContext *context, SSLC_DefaultClientCert certID);
|
||||
|
||||
/**
|
||||
* @brief Sets the ClientCert contexthandle for a HTTP context.
|
||||
* @param context Context to use.
|
||||
* @param ClientCert_contexthandle Contexthandle for the ClientCert.
|
||||
*/
|
||||
Result httpcSetClientCertContext(httpcContext *context, u32 ClientCert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Sets SSL options for the context.
|
||||
* The HTTPC SSL option bits are the same as those defined in sslc.h
|
||||
* @param context Context to set flags on.
|
||||
* @param options SSL option flags.
|
||||
*/
|
||||
Result httpcSetSSLOpt(httpcContext *context, u32 options);
|
||||
|
||||
/**
|
||||
* @brief Sets the SSL options which will be cleared for the context.
|
||||
* The HTTPC SSL option bits are the same as those defined in sslc.h
|
||||
* @param context Context to clear flags on.
|
||||
* @param options SSL option flags.
|
||||
*/
|
||||
Result httpcSetSSLClearOpt(httpcContext *context, u32 options);
|
||||
|
||||
/**
|
||||
* @brief Creates a RootCertChain. Up to 2 RootCertChains can be created under this user-process.
|
||||
* @param RootCertChain_contexthandle Output RootCertChain contexthandle.
|
||||
*/
|
||||
Result httpcCreateRootCertChain(u32 *RootCertChain_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Destroy a RootCertChain.
|
||||
* @param RootCertChain_contexthandle RootCertChain to use.
|
||||
*/
|
||||
Result httpcDestroyRootCertChain(u32 RootCertChain_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Adds a RootCA cert to a RootCertChain.
|
||||
* @param RootCertChain_contexthandle RootCertChain to use.
|
||||
* @param cert Pointer to DER cert.
|
||||
* @param certsize Size of the DER cert.
|
||||
* @param cert_contexthandle Optional output ptr for the cert contexthandle(this can be NULL).
|
||||
*/
|
||||
Result httpcRootCertChainAddCert(u32 RootCertChain_contexthandle, const u8 *cert, u32 certsize, u32 *cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Adds a default RootCA cert to a RootCertChain.
|
||||
* @param RootCertChain_contexthandle RootCertChain to use.
|
||||
* @param certID ID of the cert to add, see sslc.h.
|
||||
* @param cert_contexthandle Optional output ptr for the cert contexthandle(this can be NULL).
|
||||
*/
|
||||
Result httpcRootCertChainAddDefaultCert(u32 RootCertChain_contexthandle, SSLC_DefaultRootCert certID, u32 *cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Removes a cert from a RootCertChain.
|
||||
* @param RootCertChain_contexthandle RootCertChain to use.
|
||||
* @param cert_contexthandle Contexthandle of the cert to remove.
|
||||
*/
|
||||
Result httpcRootCertChainRemoveCert(u32 RootCertChain_contexthandle, u32 cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Opens a ClientCert-context. Up to 2 ClientCert-contexts can be open under this user-process.
|
||||
* @param cert Pointer to DER cert.
|
||||
* @param certsize Size of the DER cert.
|
||||
* @param privk Pointer to the DER private key.
|
||||
* @param privk_size Size of the privk.
|
||||
* @param ClientCert_contexthandle Output ClientCert context handle.
|
||||
*/
|
||||
Result httpcOpenClientCertContext(const u8 *cert, u32 certsize, const u8 *privk, u32 privk_size, u32 *ClientCert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Opens a ClientCert-context with a default clientclient. Up to 2 ClientCert-contexts can be open under this user-process.
|
||||
* @param certID ID of the cert to add, see sslc.h.
|
||||
* @param ClientCert_contexthandle Output ClientCert context handle.
|
||||
*/
|
||||
Result httpcOpenDefaultClientCertContext(SSLC_DefaultClientCert certID, u32 *ClientCert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Closes a ClientCert context.
|
||||
* @param ClientCert_contexthandle ClientCert context to use.
|
||||
*/
|
||||
Result httpcCloseClientCertContext(u32 ClientCert_contexthandle);
|
||||
Result httpcGetResponseHeader(httpcContext *context, char* name, char* value, u32 valuebuf_maxsize);
|
||||
|
||||
/**
|
||||
* @brief Downloads data from the HTTP context into a buffer.
|
||||
@ -292,10 +103,100 @@ Result httpcCloseClientCertContext(u32 ClientCert_contexthandle);
|
||||
*/
|
||||
Result httpcDownloadData(httpcContext *context, u8* buffer, u32 size, u32 *downloadedsize);
|
||||
|
||||
/**
|
||||
* @brief Sets Keep-Alive for the context.
|
||||
* @param context Context to set the KeepAlive flag on.
|
||||
* @param option HTTPC_KeepAlive option.
|
||||
*/
|
||||
Result httpcSetKeepAlive(httpcContext *context, HTTPC_KeepAlive option);
|
||||
//Using the below functions directly is not recommended, use the above functions. See also the http example.
|
||||
|
||||
/**
|
||||
* @brief Initializes HTTPC.
|
||||
* @param handle HTTPC service handle to use.
|
||||
*/
|
||||
Result HTTPC_Initialize(Handle handle);
|
||||
|
||||
/**
|
||||
* @brief Initializes a HTTP connection session.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
*/
|
||||
Result HTTPC_InitializeConnectionSession(Handle handle, Handle contextHandle);
|
||||
|
||||
/**
|
||||
* @brief Creates a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param url URL to connect to.
|
||||
* @param contextHandle Pointer to output the created HTTP context handle to.
|
||||
*/
|
||||
Result HTTPC_CreateContext(Handle handle, char* url, Handle* contextHandle);
|
||||
|
||||
/**
|
||||
* @brief Closes a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
*/
|
||||
Result HTTPC_CloseContext(Handle handle, Handle contextHandle);
|
||||
|
||||
/**
|
||||
* @brief Applies the default proxy to a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
*/
|
||||
Result HTTPC_SetProxyDefault(Handle handle, Handle contextHandle);
|
||||
|
||||
/**
|
||||
* @brief Adds a request header field to a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
* @param name Name of the field.
|
||||
* @param value of the field.
|
||||
*/
|
||||
Result HTTPC_AddRequestHeaderField(Handle handle, Handle contextHandle, char* name, char* value);
|
||||
|
||||
/**
|
||||
* @brief Begins a HTTP request.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
*/
|
||||
Result HTTPC_BeginRequest(Handle handle, Handle contextHandle);
|
||||
|
||||
/**
|
||||
* @brief Receives data from a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
* @param buffer Buffer to receive data to.
|
||||
* @param size Size of the buffer.
|
||||
*/
|
||||
Result HTTPC_ReceiveData(Handle handle, Handle contextHandle, u8* buffer, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the request state of a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
* @param out Pointer to output the request state to.
|
||||
*/
|
||||
Result HTTPC_GetRequestState(Handle handle, Handle contextHandle, HTTPC_RequestStatus* out);
|
||||
|
||||
/**
|
||||
* @brief Gets the download size state of a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
* @param downloadedsize Pointer to output the downloaded size to.
|
||||
* @param contentsize Pointer to output the total content size to.
|
||||
*/
|
||||
Result HTTPC_GetDownloadSizeState(Handle handle, Handle contextHandle, u32* downloadedsize, u32* contentsize);
|
||||
|
||||
/**
|
||||
* @brief Gets a response header field from a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
* @param name Name of the field.
|
||||
* @param value Pointer to output the value of the field to.
|
||||
* @param valuebuf_maxsize Maximum size of the value buffer.
|
||||
*/
|
||||
Result HTTPC_GetResponseHeader(Handle handle, Handle contextHandle, char* name, char* value, u32 valuebuf_maxsize);
|
||||
|
||||
/**
|
||||
* @brief Gets the status code of a HTTP context.
|
||||
* @param handle HTTPC service handle to use.
|
||||
* @param contextHandle HTTP context handle to use.
|
||||
* @param out Pointer to output the status code to.
|
||||
*/
|
||||
Result HTTPC_GetResponseStatusCode(Handle handle, Handle contextHandle, u32* out);
|
||||
|
||||
|
@ -87,19 +87,7 @@ Result IRU_GetBitRate(u8 *out);
|
||||
Result IRU_SetIRLEDState(u32 value);
|
||||
|
||||
/**
|
||||
* @brief Gets the IR LED state.
|
||||
* @brief Gets the IR KED state.
|
||||
* @param out Pointer to write the IR LED state to.
|
||||
*/
|
||||
Result IRU_GetIRLEDRecvState(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets an event which is signaled once a send finishes.
|
||||
* @param out Pointer to write the event handle to.
|
||||
*/
|
||||
Result IRU_GetSendFinishedEvent(Handle *out);
|
||||
|
||||
/**
|
||||
* @brief Gets an event which is signaled once a receive finishes.
|
||||
* @param out Pointer to write the event handle to.
|
||||
*/
|
||||
Result IRU_GetRecvFinishedEvent(Handle *out);
|
||||
|
@ -14,9 +14,6 @@ extern Handle irrstMemHandle;
|
||||
/// IRRST's shared memory.
|
||||
extern vu32* irrstSharedMem;
|
||||
|
||||
/// IRRST's state update event
|
||||
extern Handle irrstEvent;
|
||||
|
||||
/// Initializes IRRST.
|
||||
Result irrstInit(void);
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
/**
|
||||
* @file loader.h
|
||||
* @brief LOADER Service
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <3ds/exheader.h>
|
||||
#include <3ds/services/fs.h>
|
||||
|
||||
/// Initializes LOADER.
|
||||
Result loaderInit(void);
|
||||
|
||||
/// Exits LOADER.
|
||||
void loaderExit(void);
|
||||
|
||||
/**
|
||||
* @brief Loads a program and returns a process handle to the newly created process.
|
||||
* @param[out] process Pointer to output the process handle to.
|
||||
* @param programHandle The handle of the program to load.
|
||||
*/
|
||||
Result LOADER_LoadProcess(Handle* process, u64 programHandle);
|
||||
|
||||
/**
|
||||
* @brief Registers a program (along with its update).
|
||||
* @param[out] programHandle Pointer to output the program handle to.
|
||||
* @param programInfo The program info.
|
||||
* @param programInfo The program update info.
|
||||
*/
|
||||
Result LOADER_RegisterProgram(u64* programHandle, const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate);
|
||||
|
||||
/**
|
||||
* @brief Unregisters a program (along with its update).
|
||||
* @param programHandle The handle of the program to unregister.
|
||||
*/
|
||||
Result LOADER_UnregisterProgram(u64 programHandle);
|
||||
|
||||
/**
|
||||
* @brief Retrives a program's main NCCH extended header info (SCI + ACI, see @ref ExHeader_Info).
|
||||
* @param[out] exheaderInfo Pointer to output the main NCCH extended header info.
|
||||
* @param programHandle The handle of the program to unregister
|
||||
*/
|
||||
Result LOADER_GetProgramInfo(ExHeader_Info* exheaderInfo, u64 programHandle);
|
@ -1,107 +0,0 @@
|
||||
/**
|
||||
* @file mcuhwc.h
|
||||
* @brief mcuHwc service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
LED_NORMAL = 1, ///< The normal mode of the led
|
||||
LED_SLEEP_MODE, ///< The led pulses slowly as it does in the sleep mode
|
||||
LED_OFF, ///< Switch off power led
|
||||
LED_RED, ///< Red state of the led
|
||||
LED_BLUE, ///< Blue state of the led
|
||||
LED_BLINK_RED, ///< Blinking red state of power led and notification led
|
||||
} powerLedState;
|
||||
|
||||
typedef struct InfoLedPattern
|
||||
{
|
||||
u8 delay; ///< Delay between pattern values, 1/16th of a second (1 second = 0x10)
|
||||
u8 smoothing; ///< Smoothing between pattern values (higher = smoother)
|
||||
u8 loopDelay; ///< Delay between pattern loops, 1/16th of a second (1 second = 0x10, 0xFF = pattern is played only once)
|
||||
u8 blinkSpeed; ///< Blink speed, when smoothing == 0x00
|
||||
u8 redPattern[32]; ///< Pattern for red component
|
||||
u8 greenPattern[32]; ///< Pattern for green component
|
||||
u8 bluePattern[32]; ///< Pattern for blue component
|
||||
} InfoLedPattern;
|
||||
|
||||
/// Initializes mcuHwc.
|
||||
Result mcuHwcInit(void);
|
||||
|
||||
/// Exits mcuHwc.
|
||||
void mcuHwcExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current mcuHwc session handle.
|
||||
* @return A pointer to the current mcuHwc session handle.
|
||||
*/
|
||||
Handle* mcuHwcGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Reads data from an i2c device3 register
|
||||
* @param reg Register number. See https://www.3dbrew.org/wiki/I2C_Registers#Device_3 for more info
|
||||
* @param data Pointer to write the data to.
|
||||
* @param size Size of data to be read
|
||||
*/
|
||||
Result MCUHWC_ReadRegister(u8 reg, void *data, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Writes data to a i2c device3 register
|
||||
* @param reg Register number. See https://www.3dbrew.org/wiki/I2C_Registers#Device_3 for more info
|
||||
* @param data Pointer to write the data to.
|
||||
* @param size Size of data to be written
|
||||
*/
|
||||
Result MCUHWC_WriteRegister(u8 reg, const void *data, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the battery voltage
|
||||
* @param voltage Pointer to write the battery voltage to.
|
||||
*/
|
||||
Result MCUHWC_GetBatteryVoltage(u8 *voltage);
|
||||
|
||||
/**
|
||||
* @brief Gets the battery level
|
||||
* @param level Pointer to write the current battery level to.
|
||||
*/
|
||||
Result MCUHWC_GetBatteryLevel(u8 *level);
|
||||
|
||||
/**
|
||||
* @brief Gets the sound slider level
|
||||
* @param level Pointer to write the slider level to.
|
||||
*/
|
||||
Result MCUHWC_GetSoundSliderLevel(u8 *level);
|
||||
|
||||
/**
|
||||
* @brief Sets Wifi LED state
|
||||
* @param state State of Wifi LED. (True/False)
|
||||
*/
|
||||
Result MCUHWC_SetWifiLedState(bool state);
|
||||
|
||||
/**
|
||||
* @brief Sets the notification LED pattern
|
||||
* @param pattern Pattern for the notification LED.
|
||||
*/
|
||||
Result MCUHWC_SetInfoLedPattern(const InfoLedPattern* pattern);
|
||||
|
||||
/**
|
||||
* @brief Sets Power LED state
|
||||
* @param state powerLedState State of power LED.
|
||||
*/
|
||||
Result MCUHWC_SetPowerLedState(powerLedState state);
|
||||
|
||||
/**
|
||||
* @brief Gets 3d slider level
|
||||
* @param level Pointer to write 3D slider level to.
|
||||
*/
|
||||
Result MCUHWC_Get3dSliderLevel(u8 *level);
|
||||
|
||||
/**
|
||||
* @brief Gets the major MCU firmware version
|
||||
* @param out Pointer to write the major firmware version to.
|
||||
*/
|
||||
Result MCUHWC_GetFwVerHigh(u8 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets the minor MCU firmware version
|
||||
* @param out Pointer to write the minor firmware version to.
|
||||
*/
|
||||
Result MCUHWC_GetFwVerLow(u8 *out);
|
@ -16,10 +16,10 @@ typedef enum
|
||||
/// Microphone audio sampling rates.
|
||||
typedef enum
|
||||
{
|
||||
MICU_SAMPLE_RATE_32730 = 0, ///< 32728.498 Hz
|
||||
MICU_SAMPLE_RATE_16360 = 1, ///< 16364.479 Hz
|
||||
MICU_SAMPLE_RATE_10910 = 2, ///< 10909.499 Hz
|
||||
MICU_SAMPLE_RATE_8180 = 3, ///< 8182.1245 Hz
|
||||
MICU_SAMPLE_RATE_32730 = 0, ///< 32730 Hz
|
||||
MICU_SAMPLE_RATE_16360 = 1, ///< 16360 Hz
|
||||
MICU_SAMPLE_RATE_10910 = 2, ///< 10910 Hz
|
||||
MICU_SAMPLE_RATE_8180 = 3, ///< 8180 Hz
|
||||
} MICU_SampleRate;
|
||||
|
||||
/**
|
||||
|
@ -6,20 +6,6 @@
|
||||
|
||||
//New3DS-only, see also: http://3dbrew.org/wiki/MVD_Services
|
||||
|
||||
///These values are the data returned as "result-codes" by MVDSTD.
|
||||
#define MVD_STATUS_OK 0x17000
|
||||
#define MVD_STATUS_PARAMSET 0x17001 ///"Returned after processing NAL-unit parameter-sets."
|
||||
#define MVD_STATUS_BUSY 0x17002
|
||||
#define MVD_STATUS_FRAMEREADY 0x17003
|
||||
#define MVD_STATUS_INCOMPLETEPROCESSING 0x17004 ///"Returned when not all of the input NAL-unit buffer was processed."
|
||||
#define MVD_STATUS_NALUPROCFLAG 0x17007 ///See here: https://www.3dbrew.org/wiki/MVDSTD:ProcessNALUnit
|
||||
|
||||
///This can be used to check whether mvdstdProcessVideoFrame() was successful.
|
||||
#define MVD_CHECKNALUPROC_SUCCESS(x) (x==MVD_STATUS_OK || x==MVD_STATUS_PARAMSET || x==MVD_STATUS_FRAMEREADY || x==MVD_STATUS_INCOMPLETEPROCESSING || x==MVD_STATUS_NALUPROCFLAG)
|
||||
|
||||
/// Default input size for mvdstdInit(). This is what the New3DS Internet Browser uses, from the MVDSTD:CalculateWorkBufSize output.
|
||||
#define MVD_DEFAULT_WORKBUF_SIZE 0x9006C8
|
||||
|
||||
/// Processing mode.
|
||||
typedef enum {
|
||||
MVDMODE_COLORFORMATCONV, ///< Converting color formats.
|
||||
@ -34,77 +20,40 @@ typedef enum {
|
||||
|
||||
/// Output format.
|
||||
typedef enum {
|
||||
MVD_OUTPUT_YUYV422 = 0x00010001, ///< YUYV422
|
||||
MVD_OUTPUT_BGR565 = 0x00040002, ///< BGR565
|
||||
MVD_OUTPUT_RGB565 = 0x00040004 ///< RGB565
|
||||
MVD_OUTPUT_RGB565 = 0x00040002 ///< RGB565
|
||||
} MVDSTD_OutputFormat;
|
||||
|
||||
/// Processing configuration.
|
||||
typedef struct {
|
||||
MVDSTD_InputFormat input_type; ///< Input type.
|
||||
MVDSTD_InputFormat input_type; ///< Input type.
|
||||
u32 unk_x04; ///< Unknown.
|
||||
u32 unk_x08; ///< Unknown. Referred to as "H264 range" in SKATER.
|
||||
u32 unk_x08; ///< Unknown.
|
||||
u32 inwidth; ///< Input width.
|
||||
u32 inheight; ///< Input height.
|
||||
u32 physaddr_colorconv_indata; ///< Physical address of color conversion input data.
|
||||
u32 physaddr_colorconv_unk0; ///< Physical address used with color conversion.
|
||||
u32 physaddr_colorconv_unk1; ///< Physical address used with color conversion.
|
||||
u32 physaddr_colorconv_unk2; ///< Physical address used with color conversion.
|
||||
u32 physaddr_colorconv_unk3; ///< Physical address used with color conversion.
|
||||
u32 unk_x28[0x18>>2]; ///< Unknown.
|
||||
u32 enable_cropping; ///< Enables cropping with the input image when non-zero via the following 4 words.
|
||||
u32 input_crop_x_pos;
|
||||
u32 input_crop_y_pos;
|
||||
u32 input_crop_height;
|
||||
u32 input_crop_width;
|
||||
u32 unk_x18[0x28>>2]; ///< Unknown.
|
||||
u32 flag_x40; ///< Unknown. 0x0 for colorconv, 0x1 for H.264
|
||||
u32 unk_x44; ///< Unknown.
|
||||
u32 unk_x48; ///< Unknown.
|
||||
u32 outheight0; ///< First output width. Only set for H.264.
|
||||
u32 outwidth0; ///< First output height. Only set for H.264.
|
||||
u32 unk_x54; ///< Unknown.
|
||||
MVDSTD_OutputFormat output_type; ///< Output type.
|
||||
u32 outwidth; ///< Output width.
|
||||
u32 outheight; ///< Output height.
|
||||
MVDSTD_OutputFormat output_type; ///< Output type.
|
||||
u32 outwidth1; ///< Second output width.
|
||||
u32 outheight1; ///< Second output height.
|
||||
u32 physaddr_outdata0; ///< Physical address of output data.
|
||||
u32 physaddr_outdata1; ///< Additional physical address for output data, only used when the output format type is value 0x00020001.
|
||||
u32 unk_x6c[0x98>>2]; ///< Unknown.
|
||||
u32 flag_x104; ///< This enables using the following 4 words when non-zero.
|
||||
u32 output_x_pos; ///< Output X position in the output buffer.
|
||||
u32 output_y_pos; ///< Same as above except for the Y pos.
|
||||
u32 output_width_override; ///< Used for aligning the output width when larger than the output width. Overrides the output width when smaller than the output width.
|
||||
u32 output_height_override; ///< Same as output_width_override except for the output height.
|
||||
u32 unk_x118;
|
||||
u32 physaddr_outdata1_colorconv; ///< Physical address of color conversion output data.
|
||||
u32 unk_x6c[0xb0>>2]; ///< Unknown.
|
||||
} MVDSTD_Config;
|
||||
|
||||
typedef struct {
|
||||
u32 end_vaddr;//"End-address of the processed NAL-unit(internal MVD heap vaddr)."
|
||||
u32 end_physaddr;//"End-address of the processed NAL-unit(physaddr following the input physaddr)."
|
||||
u32 remaining_size;//"Total remaining unprocessed input data. Buffer_end_pos=bufsize-<this value>."
|
||||
} MVDSTD_ProcessNALUnitOut;
|
||||
|
||||
typedef struct {
|
||||
void* outdata0;//Linearmem vaddr equivalent to config *_outdata0.
|
||||
void* outdata1;//Linearmem vaddr equivalent to config *_outdata1.
|
||||
} MVDSTD_OutputBuffersEntry;
|
||||
|
||||
typedef struct {
|
||||
u32 total_entries;//Total actual used entries below.
|
||||
MVDSTD_OutputBuffersEntry entries[17];
|
||||
} MVDSTD_OutputBuffersEntryList;
|
||||
|
||||
/// This can be used to override the default input values for MVDSTD commands during initialization with video-processing. The default for these fields are all-zero, except for cmd1b_inval which is 1. See also here: https://www.3dbrew.org/wiki/MVD_Services
|
||||
typedef struct {
|
||||
s8 cmd5_inval0, cmd5_inval1, cmd5_inval2;
|
||||
u32 cmd5_inval3;
|
||||
|
||||
u8 cmd1b_inval;
|
||||
} MVDSTD_InitStruct;
|
||||
|
||||
/**
|
||||
* @brief Initializes MVDSTD.
|
||||
* @brief Initializes MVDSTD. Video processing / H.264 currently isn't supported.
|
||||
* @param mode Mode to initialize MVDSTD to.
|
||||
* @param input_type Type of input to process.
|
||||
* @param output_type Type of output to produce.
|
||||
* @param size Size of the work buffer, MVD_DEFAULT_WORKBUF_SIZE can be used for this. Only used when type == MVDMODE_VIDEOPROCESSING.
|
||||
* @param initstruct Optional MVDSTD_InitStruct, this should be NULL normally.
|
||||
* @param size Size of data to process. Not used when type == MVDTYPE_COLORFORMATCONV.
|
||||
*/
|
||||
Result mvdstdInit(MVDSTD_Mode mode, MVDSTD_InputFormat input_type, MVDSTD_OutputFormat output_type, u32 size, MVDSTD_InitStruct *initstruct);
|
||||
Result mvdstdInit(MVDSTD_Mode mode, MVDSTD_InputFormat input_type, MVDSTD_OutputFormat output_type, u32 size);
|
||||
|
||||
/// Shuts down MVDSTD.
|
||||
void mvdstdExit(void);
|
||||
@ -118,31 +67,18 @@ void mvdstdExit(void);
|
||||
* @param output_height Output height.
|
||||
* @param vaddr_colorconv_indata Virtual address of the color conversion input data.
|
||||
* @param vaddr_outdata0 Virtual address of the output data.
|
||||
* @param vaddr_outdata1 Additional virtual address for output data, only used when the output format type is value 0x00020001.
|
||||
* @param vaddr_outdata1_colorconv Virtual address of the color conversion output data.
|
||||
*/
|
||||
void mvdstdGenerateDefaultConfig(MVDSTD_Config*config, u32 input_width, u32 input_height, u32 output_width, u32 output_height, u32 *vaddr_colorconv_indata, u32 *vaddr_outdata0, u32 *vaddr_outdata1);
|
||||
void mvdstdGenerateDefaultConfig(MVDSTD_Config*config, u32 input_width, u32 input_height, u32 output_width, u32 output_height, u32 *vaddr_colorconv_indata, u32 *vaddr_outdata0, u32 *vaddr_outdata1_colorconv);
|
||||
|
||||
/**
|
||||
* @brief Run color-format-conversion.
|
||||
* @brief Processes a frame.
|
||||
* @param config Pointer to the configuration to use.
|
||||
* @param h264_vaddr_inframe Input H264 frame.
|
||||
* @param h264_inframesize Size of the input frame.
|
||||
* @param h264_frameid ID of the input frame.
|
||||
*/
|
||||
Result mvdstdConvertImage(MVDSTD_Config* config);
|
||||
|
||||
/**
|
||||
* @brief Processes a video frame(specifically a NAL-unit).
|
||||
* @param inbuf_vaddr Input NAL-unit starting with the 3-byte "00 00 01" prefix. Must be located in linearmem.
|
||||
* @param size Size of the input buffer.
|
||||
* @param flag See here regarding this input flag: https://www.3dbrew.org/wiki/MVDSTD:ProcessNALUnit
|
||||
* @param out Optional output MVDSTD_ProcessNALUnitOut structure.
|
||||
*/
|
||||
Result mvdstdProcessVideoFrame(void* inbuf_vaddr, size_t size, u32 flag, MVDSTD_ProcessNALUnitOut *out);
|
||||
|
||||
/**
|
||||
* @brief Renders the video frame.
|
||||
* @param config Optional pointer to the configuration to use. When NULL, MVDSTD_SetConfig() should have been used previously for this video.
|
||||
* @param wait When true, wait for rendering to finish. When false, you can manually call this function repeatedly until it stops returning MVD_STATUS_BUSY.
|
||||
*/
|
||||
Result mvdstdRenderVideoFrame(MVDSTD_Config* config, bool wait);
|
||||
Result mvdstdProcessFrame(MVDSTD_Config*config, u32 *h264_vaddr_inframe, u32 h264_inframesize, u32 h264_frameid);
|
||||
|
||||
/**
|
||||
* @brief Sets the current configuration of MVDSTD.
|
||||
@ -150,19 +86,3 @@ Result mvdstdRenderVideoFrame(MVDSTD_Config* config, bool wait);
|
||||
*/
|
||||
Result MVDSTD_SetConfig(MVDSTD_Config* config);
|
||||
|
||||
/**
|
||||
* @brief New3DS Internet Browser doesn't use this. Once done, rendered frames will be written to the output buffers specified by the entrylist instead of the output specified by configuration. See here: https://www.3dbrew.org/wiki/MVDSTD:SetupOutputBuffers
|
||||
* @param entrylist Input entrylist.
|
||||
* @param bufsize Size of each buffer from the entrylist.
|
||||
*/
|
||||
Result mvdstdSetupOutputBuffers(MVDSTD_OutputBuffersEntryList *entrylist, u32 bufsize);
|
||||
|
||||
/**
|
||||
* @brief New3DS Internet Browser doesn't use this. This overrides the entry0 output buffers originally setup by mvdstdSetupOutputBuffers(). See also here: https://www.3dbrew.org/wiki/MVDSTD:OverrideOutputBuffers
|
||||
* @param cur_outdata0 Linearmem vaddr. The current outdata0 for this entry must match this value.
|
||||
* @param cur_outdata1 Linearmem vaddr. The current outdata1 for this entry must match this value.
|
||||
* @param new_outdata0 Linearmem vaddr. This is the new address to use for outaddr0.
|
||||
* @param new_outdata1 Linearmem vaddr. This is the new address to use for outaddr1.
|
||||
*/
|
||||
Result mvdstdOverrideOutputBuffers(void* cur_outdata0, void* cur_outdata1, void* new_outdata0, void* new_outdata1);
|
||||
|
||||
|
@ -1,149 +0,0 @@
|
||||
/**
|
||||
* @file ndm.h
|
||||
* @brief NDMU service. https://3dbrew.org/wiki/NDM_Services
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// Exclusive states.
|
||||
typedef enum {
|
||||
NDM_EXCLUSIVE_STATE_NONE = 0,
|
||||
NDM_EXCLUSIVE_STATE_INFRASTRUCTURE = 1,
|
||||
NDM_EXCLUSIVE_STATE_LOCAL_COMMUNICATIONS = 2,
|
||||
NDM_EXCLUSIVE_STATE_STREETPASS = 3,
|
||||
NDM_EXCLUSIVE_STATE_STREETPASS_DATA = 4,
|
||||
} ndmExclusiveState;
|
||||
|
||||
/// Current states.
|
||||
typedef enum {
|
||||
NDM_STATE_INITIAL = 0,
|
||||
NDM_STATE_SUSPENDED = 1,
|
||||
NDM_STATE_INFRASTRUCTURE_CONNECTING = 2,
|
||||
NDM_STATE_INFRASTRUCTURE_CONNECTED = 3,
|
||||
NDM_STATE_INFRASTRUCTURE_WORKING = 4,
|
||||
NDM_STATE_INFRASTRUCTURE_SUSPENDING = 5,
|
||||
NDM_STATE_INFRASTRUCTURE_FORCE_SUSPENDING = 6,
|
||||
NDM_STATE_INFRASTRUCTURE_DISCONNECTING = 7,
|
||||
NDM_STATE_INFRASTRUCTURE_FORCE_DISCONNECTING = 8,
|
||||
NDM_STATE_CEC_WORKING = 9,
|
||||
NDM_STATE_CEC_FORCE_SUSPENDING = 10,
|
||||
NDM_STATE_CEC_SUSPENDING = 11,
|
||||
} ndmState;
|
||||
|
||||
// Daemons.
|
||||
typedef enum {
|
||||
NDM_DAEMON_CEC = 0,
|
||||
NDM_DAEMON_BOSS = 1,
|
||||
NDM_DAEMON_NIM = 2,
|
||||
NDM_DAEMON_FRIENDS = 3,
|
||||
} ndmDaemon;
|
||||
|
||||
/// Used to specify multiple daemons.
|
||||
typedef enum {
|
||||
NDM_DAEMON_MASK_CEC = BIT(NDM_DAEMON_CEC),
|
||||
NDM_DAEMON_MASK_BOSS = BIT(NDM_DAEMON_BOSS),
|
||||
NDM_DAEMON_MASK_NIM = BIT(NDM_DAEMON_NIM),
|
||||
NDM_DAEMON_MASK_FRIENDS = BIT(NDM_DAEMON_FRIENDS),
|
||||
NDM_DAEMON_MASK_BACKGROUOND = NDM_DAEMON_MASK_CEC | NDM_DAEMON_MASK_BOSS | NDM_DAEMON_MASK_NIM,
|
||||
NDM_DAEMON_MASK_ALL = NDM_DAEMON_MASK_CEC | NDM_DAEMON_MASK_BOSS | NDM_DAEMON_MASK_NIM | NDM_DAEMON_MASK_FRIENDS,
|
||||
NDM_DAEMON_MASK_DEFAULT = NDM_DAEMON_MASK_CEC | NDM_DAEMON_MASK_FRIENDS,
|
||||
} ndmDaemonMask;
|
||||
|
||||
// Daemon status.
|
||||
typedef enum {
|
||||
NDM_DAEMON_STATUS_BUSY = 0,
|
||||
NDM_DAEMON_STATUS_IDLE = 1,
|
||||
NDM_DAEMON_STATUS_SUSPENDING = 2,
|
||||
NDM_DAEMON_STATUS_SUSPENDED = 3,
|
||||
} ndmDaemonStatus;
|
||||
|
||||
/// Initializes ndmu.
|
||||
Result ndmuInit(void);
|
||||
|
||||
/// Exits ndmu.
|
||||
void ndmuExit(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the network daemon to an exclusive state.
|
||||
* @param state State specified in the ndmExclusiveState enumerator.
|
||||
*/
|
||||
Result NDMU_EnterExclusiveState(ndmExclusiveState state);
|
||||
|
||||
/// Cancels an exclusive state for the network daemon.
|
||||
Result NDMU_LeaveExclusiveState(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the exclusive state for the network daemon.
|
||||
* @param state Pointer to write the exclsuive state to.
|
||||
*/
|
||||
Result NDMU_GetExclusiveState(ndmExclusiveState *state);
|
||||
|
||||
/// Locks the exclusive state.
|
||||
Result NDMU_LockState(void);
|
||||
|
||||
/// Unlocks the exclusive state.
|
||||
Result NDMU_UnlockState(void);
|
||||
|
||||
/**
|
||||
* @brief Suspends network daemon.
|
||||
* @param mask The specified daemon.
|
||||
*/
|
||||
Result NDMU_SuspendDaemons(ndmDaemonMask mask);
|
||||
|
||||
/**
|
||||
* @brief Resumes network daemon.
|
||||
* @param mask The specified daemon.
|
||||
*/
|
||||
Result NDMU_ResumeDaemons(ndmDaemonMask mask);
|
||||
|
||||
/**
|
||||
* @brief Suspends scheduling for all network daemons.
|
||||
* @param flag 0 = Wait for completion, 1 = Perform in background.
|
||||
*/
|
||||
Result NDMU_SuspendScheduler(u32 flag);
|
||||
|
||||
/// Resumes daemon scheduling.
|
||||
Result NDMU_ResumeScheduler(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the current state for the network daemon.
|
||||
* @param state Pointer to write the current state to.
|
||||
*/
|
||||
Result NDMU_GetCurrentState(ndmState *state);
|
||||
|
||||
/**
|
||||
* @brief Returns a daemon state.
|
||||
* @param daemon The specified daemon.
|
||||
* @param state Pointer to write the daemon state to.
|
||||
*/
|
||||
Result NDMU_QueryStatus(ndmDaemon daemon, ndmDaemonStatus *status);
|
||||
|
||||
/**
|
||||
* @brief Sets the scan interval.
|
||||
* @param interval Value to set the scan interval to.
|
||||
*/
|
||||
Result NDMU_SetScanInterval(u32 interval);
|
||||
|
||||
/**
|
||||
* @brief Returns the scan interval.
|
||||
* @param interval Pointer to write the interval value to.
|
||||
*/
|
||||
Result NDMU_GetScanInterval(u32 *interval);
|
||||
|
||||
/**
|
||||
* @brief Returns the retry interval.
|
||||
* @param interval Pointer to write the interval value to.
|
||||
*/
|
||||
Result NDMU_GetRetryInterval(u32 *interval);
|
||||
|
||||
/// Reverts network daemon to defaults.
|
||||
Result NDMU_ResetDaemons(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current default daemon bit mask.
|
||||
* @param interval Pointer to write the default daemon mask value to. The default value is (DAEMONMASK_CEC | DAEMONMASK_FRIENDS)
|
||||
*/
|
||||
Result NDMU_GetDefaultDaemons(ndmDaemonMask *mask);
|
||||
|
||||
/// Clears half awake mac filter.
|
||||
Result NDMU_ClearMacFilter(void);
|
||||
|
@ -4,22 +4,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// Notification header data.
|
||||
typedef struct {
|
||||
bool dataSet;
|
||||
bool unread;
|
||||
bool enableJPEG;
|
||||
bool isSpotPass;
|
||||
bool isOptedOut;
|
||||
u8 unkData[3];
|
||||
u64 processID;
|
||||
u8 unkData2[8];
|
||||
u64 jumpParam;
|
||||
u8 unkData3[8];
|
||||
u64 time;
|
||||
u16 title[32];
|
||||
} NotificationHeader;
|
||||
|
||||
/// Initializes NEWS.
|
||||
Result newsInit(void);
|
||||
|
||||
@ -37,55 +21,3 @@ void newsExit(void);
|
||||
* @param jpeg Whether the image is a JPEG or not.
|
||||
*/
|
||||
Result NEWS_AddNotification(const u16* title, u32 titleLength, const u16* message, u32 messageLength, const void* imageData, u32 imageSize, bool jpeg);
|
||||
|
||||
/**
|
||||
* @brief Gets current total notifications number.
|
||||
* @param num Pointer where total number will be saved.
|
||||
*/
|
||||
Result NEWS_GetTotalNotifications(u32* num);
|
||||
|
||||
/**
|
||||
* @brief Sets a custom header for a specific notification.
|
||||
* @param news_id Identification number of the notification.
|
||||
* @param header Pointer to notification header to set.
|
||||
*/
|
||||
Result NEWS_SetNotificationHeader(u32 news_id, const NotificationHeader* header);
|
||||
|
||||
/**
|
||||
* @brief Gets the header of a specific notification.
|
||||
* @param news_id Identification number of the notification.
|
||||
* @param header Pointer where header of the notification will be saved.
|
||||
*/
|
||||
Result NEWS_GetNotificationHeader(u32 news_id, NotificationHeader* header);
|
||||
|
||||
/**
|
||||
* @brief Sets a custom message for a specific notification.
|
||||
* @param news_id Identification number of the notification.
|
||||
* @param message Pointer to UTF-16 message to set.
|
||||
* @param size Size of message to set.
|
||||
*/
|
||||
Result NEWS_SetNotificationMessage(u32 news_id, const u16* message, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the message of a specific notification.
|
||||
* @param news_id Identification number of the notification.
|
||||
* @param message Pointer where UTF-16 message of the notification will be saved.
|
||||
* @param size Pointer where size of the message data will be saved in bytes.
|
||||
*/
|
||||
Result NEWS_GetNotificationMessage(u32 news_id, u16* message, u32* size);
|
||||
|
||||
/**
|
||||
* @brief Sets a custom image for a specific notification.
|
||||
* @param news_id Identification number of the notification.
|
||||
* @param buffer Pointer to MPO image to set.
|
||||
* @param size Size of the MPO image to set.
|
||||
*/
|
||||
Result NEWS_SetNotificationImage(u32 news_id, const void* buffer, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Gets the image of a specific notification.
|
||||
* @param news_id Identification number of the notification.
|
||||
* @param buffer Pointer where MPO image of the notification will be saved.
|
||||
* @param size Pointer where size of the image data will be saved in bytes.
|
||||
*/
|
||||
Result NEWS_GetNotificationImage(u32 news_id, void* buffer, u32* size);
|
@ -1,220 +0,0 @@
|
||||
/**
|
||||
* @file nfc.h
|
||||
* @brief NFC service. This can only be used with system-version >=9.3.0-X.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// This is returned when the current state is invalid for this command.
|
||||
#define NFC_ERR_INVALID_STATE 0xC8A17600
|
||||
|
||||
/// This is returned by nfcOpenAppData() when the appdata is uninitialized since nfcInitializeWriteAppData() wasn't used previously.
|
||||
#define NFC_ERR_APPDATA_UNINITIALIZED 0xC8A17620
|
||||
|
||||
/// This is returned by nfcGetAmiiboSettings() when the amiibo wasn't setup by the amiibo Settings applet.
|
||||
#define NFC_ERR_AMIIBO_NOTSETUP 0xC8A17628
|
||||
|
||||
/// This is returned by nfcOpenAppData() when the input AppID doesn't match the actual amiibo AppID.
|
||||
#define NFC_ERR_APPID_MISMATCH 0xC8A17638
|
||||
|
||||
/// "Returned for HMAC-hash mismatch(data corruption), with HMAC-calculation input_buffer_size=0x34."
|
||||
#define NFC_ERR_DATACORRUPTION0 0xC8C1760C
|
||||
|
||||
/// HMAC-hash mismatch with input_buffer_size=0x1DF, see here: https://www.3dbrew.org/wiki/Amiibo
|
||||
#define NFC_ERR_DATACORRUPTION1 0xC8A17618
|
||||
|
||||
/// This can be used for nfcStartScanning().
|
||||
#define NFC_STARTSCAN_DEFAULTINPUT 0
|
||||
|
||||
/// NFC operation type.
|
||||
typedef enum {
|
||||
NFC_OpType_1 = 1, /// Unknown.
|
||||
NFC_OpType_NFCTag = 2, /// This is the default.
|
||||
NFC_OpType_RawNFC = 3 /// Use Raw NFC tag commands. Only available with >=10.0.0-X.
|
||||
} NFC_OpType;
|
||||
|
||||
typedef enum {
|
||||
NFC_TagState_Uninitialized = 0, /// nfcInit() was not used yet.
|
||||
NFC_TagState_ScanningStopped = 1, /// Not currently scanning for NFC tags. Set by nfcStopScanning() and nfcInit(), when successful.
|
||||
NFC_TagState_Scanning = 2, /// Currently scanning for NFC tags. Set by nfcStartScanning() when successful.
|
||||
NFC_TagState_InRange = 3, /// NFC tag is in range. The state automatically changes to this when the state was previously value 2, without using any NFC service commands.
|
||||
NFC_TagState_OutOfRange = 4, /// NFC tag is now out of range, where the NFC tag was previously in range. This occurs automatically without using any NFC service commands. Once this state is entered, it won't automatically change to anything else when the tag is moved in range again. Hence, if you want to keep doing tag scanning after this, you must stop+start scanning.
|
||||
NFC_TagState_DataReady = 5 /// NFC tag data was successfully loaded. This is set by nfcLoadAmiiboData() when successful.
|
||||
} NFC_TagState;
|
||||
|
||||
/// Bit4-7 are always clear with nfcGetAmiiboSettings() due to "& 0xF".
|
||||
enum {
|
||||
NFC_amiiboFlag_Setup = BIT(4), /// This indicates that the amiibo was setup with amiibo Settings. nfcGetAmiiboSettings() will return an all-zero struct when this is not set.
|
||||
NFC_amiiboFlag_AppDataSetup = BIT(5) /// This indicates that the AppData was previously initialized via nfcInitializeWriteAppData(), that function can't be used again with this flag already set.
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
u16 id_offset_size;/// "u16 size/offset of the below ID data. Normally this is 0x7. When this is <=10, this field is the size of the below ID data. When this is >10, this is the offset of the 10-byte ID data, relative to structstart+4+<offsetfield-10>. It's unknown in what cases this 10-byte ID data is used."
|
||||
u8 unk_x2;//"Unknown u8, normally 0x0."
|
||||
u8 unk_x3;//"Unknown u8, normally 0x2."
|
||||
u8 id[0x28];//"ID data. When the above size field is 0x7, this is the 7-byte NFC tag UID, followed by all-zeros."
|
||||
} NFC_TagInfo;
|
||||
|
||||
/// AmiiboSettings structure, see also here: https://3dbrew.org/wiki/NFC:GetAmiiboSettings
|
||||
typedef struct {
|
||||
u8 mii[0x60];/// "Owner Mii."
|
||||
u16 nickname[11];/// "UTF-16BE Amiibo nickname."
|
||||
u8 flags;/// "This is plaintext_amiibosettingsdata[0] & 0xF." See also the NFC_amiiboFlag enums.
|
||||
u8 countrycodeid;/// "This is plaintext_amiibosettingsdata[1]." "Country Code ID, from the system which setup this amiibo."
|
||||
u16 setupdate_year;
|
||||
u8 setupdate_month;
|
||||
u8 setupdate_day;
|
||||
u8 unk_x7c[0x2c];//Normally all-zero?
|
||||
} NFC_AmiiboSettings;
|
||||
|
||||
/// AmiiboConfig structure, see also here: https://3dbrew.org/wiki/NFC:GetAmiiboConfig
|
||||
typedef struct {
|
||||
u16 lastwritedate_year;
|
||||
u8 lastwritedate_month;
|
||||
u8 lastwritedate_day;
|
||||
u16 write_counter;
|
||||
u8 characterID[3];/// the first element is the collection ID, the second the character in this collection, the third the variant
|
||||
u8 series;/// ID of the series
|
||||
u16 amiiboID;/// ID shared by all exact same amiibo. Some amiibo are only distinguished by this one like regular SMB Series Mario and the gold one
|
||||
u8 type;/// Type of amiibo 0 = figure, 1 = card, 2 = plush
|
||||
u8 pagex4_byte3;
|
||||
u16 appdata_size;/// "NFC module writes hard-coded u8 value 0xD8 here. This is the size of the Amiibo AppData, apps can use this with the AppData R/W commands. ..."
|
||||
u8 zeros[0x30];/// "Unused / reserved: this is cleared by NFC module but never written after that."
|
||||
} NFC_AmiiboConfig;
|
||||
|
||||
/// Used by nfcInitializeWriteAppData() internally, see also here: https://3dbrew.org/wiki/NFC:GetAppDataInitStruct
|
||||
typedef struct {
|
||||
u8 data_x0[0xC];
|
||||
u8 data_xc[0x30];/// "The data starting at struct offset 0xC is the 0x30-byte struct used by NFC:InitializeWriteAppData, sent by the user-process."
|
||||
} NFC_AppDataInitStruct;
|
||||
|
||||
/// Used by nfcWriteAppData() internally, see also: https://3dbrew.org/wiki/NFC:WriteAppData
|
||||
typedef struct {
|
||||
u8 id[10];//7-byte UID normally.
|
||||
u8 id_size;
|
||||
u8 unused_xb[0x15];
|
||||
} NFC_AppDataWriteStruct;
|
||||
|
||||
/**
|
||||
* @brief Initializes NFC.
|
||||
* @param type See the NFC_OpType enum.
|
||||
*/
|
||||
Result nfcInit(NFC_OpType type);
|
||||
|
||||
/**
|
||||
* @brief Shuts down NFC.
|
||||
*/
|
||||
void nfcExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the NFC service handle.
|
||||
* @return The NFC service handle.
|
||||
*/
|
||||
Handle nfcGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Starts scanning for NFC tags.
|
||||
* @param inval Unknown. See NFC_STARTSCAN_DEFAULTINPUT.
|
||||
*/
|
||||
Result nfcStartScanning(u16 inval);
|
||||
|
||||
/**
|
||||
* @brief Stops scanning for NFC tags.
|
||||
*/
|
||||
void nfcStopScanning(void);
|
||||
|
||||
/**
|
||||
* @brief Read amiibo NFC data and load in memory.
|
||||
*/
|
||||
Result nfcLoadAmiiboData(void);
|
||||
|
||||
/**
|
||||
* @brief If the tagstate is valid(NFC_TagState_DataReady or 6), it then sets the current tagstate to NFC_TagState_InRange.
|
||||
*/
|
||||
Result nfcResetTagScanState(void);
|
||||
|
||||
/**
|
||||
* @brief This writes the amiibo data stored in memory to the actual amiibo data storage(which is normally the NFC data pages). This can only be used if NFC_LoadAmiiboData() was used previously.
|
||||
*/
|
||||
Result nfcUpdateStoredAmiiboData(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the current NFC tag state.
|
||||
* @param state Pointer to write NFC tag state.
|
||||
*/
|
||||
Result nfcGetTagState(NFC_TagState *state);
|
||||
|
||||
/**
|
||||
* @brief Returns the current TagInfo.
|
||||
* @param out Pointer to write the output TagInfo.
|
||||
*/
|
||||
Result nfcGetTagInfo(NFC_TagInfo *out);
|
||||
|
||||
/**
|
||||
* @brief Opens the appdata, when the amiibo appdata was previously initialized. This must be used before reading/writing the appdata. See also: https://3dbrew.org/wiki/NFC:OpenAppData
|
||||
* @param amiibo_appid Amiibo AppID. See here: https://www.3dbrew.org/wiki/Amiibo
|
||||
*/
|
||||
Result nfcOpenAppData(u32 amiibo_appid);
|
||||
|
||||
/**
|
||||
* @brief This initializes the appdata using the specified input, when the appdata previously wasn't initialized. If the appdata is already initialized, you must first use the amiibo Settings applet menu option labeled "Delete amiibo Game Data". This automatically writes the amiibo data into the actual data storage(normally NFC data pages). See also nfcWriteAppData().
|
||||
* @param amiibo_appid amiibo AppID. See also nfcOpenAppData().
|
||||
* @param buf Input buffer.
|
||||
* @param size Buffer size.
|
||||
*/
|
||||
Result nfcInitializeWriteAppData(u32 amiibo_appid, const void *buf, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Reads the appdata. The size must be >=0xD8-bytes, but the actual used size is hard-coded to 0xD8. Note that areas of appdata which were never written to by applications are uninitialized in this output buffer.
|
||||
* @param buf Output buffer.
|
||||
* @param size Buffer size.
|
||||
*/
|
||||
Result nfcReadAppData(void *buf, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Writes the appdata, after nfcOpenAppData() was used successfully. The size should be <=0xD8-bytes. See also: https://3dbrew.org/wiki/NFC:WriteAppData
|
||||
* @param buf Input buffer.
|
||||
* @param size Buffer size.
|
||||
* @param taginfo TagInfo from nfcGetTagInfo().
|
||||
*/
|
||||
Result nfcWriteAppData(const void *buf, size_t size, NFC_TagInfo *taginfo);
|
||||
|
||||
/**
|
||||
* @brief Returns the current AmiiboSettings.
|
||||
* @param out Pointer to write the output AmiiboSettings.
|
||||
*/
|
||||
Result nfcGetAmiiboSettings(NFC_AmiiboSettings *out);
|
||||
|
||||
/**
|
||||
* @brief Returns the current AmiiboConfig.
|
||||
* @param out Pointer to write the output AmiiboConfig.
|
||||
*/
|
||||
Result nfcGetAmiiboConfig(NFC_AmiiboConfig *out);
|
||||
|
||||
/**
|
||||
* @brief Starts scanning for NFC tags when initialized with NFC_OpType_RawNFC. See also: https://www.3dbrew.org/wiki/NFC:StartOtherTagScanning
|
||||
* @param unk0 Same as nfcStartScanning() input.
|
||||
* @param unk1 Unknown.
|
||||
*/
|
||||
Result nfcStartOtherTagScanning(u16 unk0, u32 unk1);
|
||||
|
||||
/**
|
||||
* @brief This sends a raw NFC command to the tag. This can only be used when initialized with NFC_OpType_RawNFC, and when the TagState is NFC_TagState_InRange. See also: https://www.3dbrew.org/wiki/NFC:SendTagCommand
|
||||
* @param inbuf Input buffer.
|
||||
* @param insize Size of the input buffer.
|
||||
* @param outbuf Output buffer.
|
||||
* @param outsize Size of the output buffer.
|
||||
* @param actual_transfer_size Optional output ptr to write the actual output-size to, can be NULL.
|
||||
* @param microseconds Timing-related field in microseconds.
|
||||
*/
|
||||
Result nfcSendTagCommand(const void *inbuf, size_t insize, void *outbuf, size_t outsize, size_t *actual_transfer_size, u64 microseconds);
|
||||
|
||||
/**
|
||||
* @brief Unknown. This can only be used when initialized with NFC_OpType_RawNFC, and when the TagState is NFC_TagState_InRange.
|
||||
*/
|
||||
Result nfcCmd21(void);
|
||||
|
||||
/**
|
||||
* @brief Unknown. This can only be used when initialized with NFC_OpType_RawNFC, and when the TagState is NFC_TagState_InRange.
|
||||
*/
|
||||
Result nfcCmd22(void);
|
||||
|
@ -1,151 +0,0 @@
|
||||
/**
|
||||
* @file nim.h
|
||||
* @brief NIM (network installation management) service.
|
||||
*
|
||||
* This service is used to download and install titles from Nintendo's CDN.
|
||||
*
|
||||
* We differentiate between two different kinds of downloads:
|
||||
*
|
||||
* - "active" downloads, which are downloads started with @ref NIMS_StartDownload or @ref NIMS_StartDownloadSimple. The process must keep polling the current status using @ref NIMS_GetProgress.
|
||||
* - "tasks", which are downloads started with @ref NIMS_RegisterTask. These are only processed in sleep mode.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// FS_MediaType
|
||||
#include <3ds/services/fs.h>
|
||||
|
||||
/// Mode that NIM downloads/installs a title with.
|
||||
typedef enum
|
||||
{
|
||||
IM_DEFAULT = 0, ///< Initial installation
|
||||
IM_UNKNOWN1, ///< Unknown
|
||||
IM_UNKNOWN2, ///< Unknown
|
||||
IM_REINSTALL, ///< Reinstall currently installed title; use this if the title is already installed (including updates)
|
||||
} NIM_InstallationMode;
|
||||
|
||||
/// Current state of a NIM download/installation.
|
||||
typedef enum
|
||||
{
|
||||
DS_NOT_INITIALIZED = 0, ///< Download not yet initialized
|
||||
DS_INITIALIZED, ///< Download initialized
|
||||
DS_DOWNLOAD_TMD, ///< Downloading and installing TMD
|
||||
DS_PREPARE_SAVE_DATA, ///< Initializing save data
|
||||
DS_DOWNLOAD_CONTENTS, ///< Downloading and installing contents
|
||||
DS_WAIT_COMMIT, ///< Waiting before calling AM_CommitImportTitles
|
||||
DS_COMMITTING, ///< Running AM_CommitImportTitles
|
||||
DS_FINISHED, ///< Title installation finished
|
||||
DS_VERSION_ERROR, ///< (unknown error regarding title version)
|
||||
DS_CREATE_CONTEXT, ///< Creating the .ctx file?
|
||||
DS_CANNOT_RECOVER, ///< Irrecoverable error encountered (e.g. out of space)
|
||||
DS_INVALID, ///< Invalid state
|
||||
} NIM_DownloadState;
|
||||
|
||||
/// Input configuration for NIM download/installation tasks.
|
||||
typedef struct
|
||||
{
|
||||
u64 titleId; ///< Title ID
|
||||
u32 version; ///< Title version
|
||||
u32 unknown_0; ///< Always 0
|
||||
u8 ratingAge; ///< Age for the HOME Menu parental controls
|
||||
u8 mediaType; ///< Media type, see @ref FS_MediaType enum
|
||||
u8 padding[2]; ///< Padding
|
||||
u32 unknown_1; ///< Unknown input, seems to be always 0
|
||||
} NIM_TitleConfig;
|
||||
|
||||
/// Output struct for NIM downloads/installations in progress.
|
||||
typedef struct
|
||||
{
|
||||
u32 state; ///< State, see NIM_DownloadState enum
|
||||
Result lastResult; ///< Last result code in NIM
|
||||
u64 downloadedSize; ///< Amount of bytes that have been downloaded
|
||||
u64 totalSize; ///< Amount of bytes that need to be downloaded in total
|
||||
} NIM_TitleProgress;
|
||||
|
||||
/**
|
||||
* @brief Initializes nim:s. This uses networking and is blocking.
|
||||
* @param buffer A buffer for internal use. It must be at least 0x20000 bytes long.
|
||||
* @param buffer_len Length of the passed buffer.
|
||||
*/
|
||||
Result nimsInit(void *buffer, size_t buffer_len);
|
||||
|
||||
/**
|
||||
* @brief Initializes nim:s with the given TIN. This uses networking and is blocking.
|
||||
* @param buffer A buffer for internal use. It must be at least 0x20000 bytes long.
|
||||
* @param buffer_len Length of the passed buffer.
|
||||
* @param TIN The TIN to initialize nim:s with. If you do not know what a TIN is or why you would want to change it, use @ref nimsInit instead.
|
||||
*/
|
||||
Result nimsInitWithTIN(void *buffer, size_t buffer_len, const char *TIN);
|
||||
|
||||
/// Exits nim:s.
|
||||
void nimsExit(void);
|
||||
|
||||
/// Gets the current nim:s session handle.
|
||||
Handle *nimsGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Sets an attribute.
|
||||
* @param attr Name of the attribute.
|
||||
* @param val Value of the attribute.
|
||||
*/
|
||||
Result NIMS_SetAttribute(const char *attr, const char *val);
|
||||
|
||||
/**
|
||||
* @brief Checks if nim wants a system update.
|
||||
* @param want_update Set to true if a system update is required. Can be NULL.
|
||||
*/
|
||||
Result NIMS_WantUpdate(bool *want_update);
|
||||
|
||||
/**
|
||||
* @brief Makes a TitleConfig struct for use with @ref NIMS_RegisterTask, @ref NIMS_StartDownload or @ref NIMS_StartDownloadSimple.
|
||||
* @param cfg Struct to initialize.
|
||||
* @param titleId Title ID to download and install.
|
||||
* @param version Version of the title to download and install.
|
||||
* @param ratingAge Age for which the title is aged; used by parental controls in HOME Menu.
|
||||
* @param mediaType Media type of the title to download and install.
|
||||
*/
|
||||
void NIMS_MakeTitleConfig(NIM_TitleConfig *cfg, u64 titleId, u32 version, u8 ratingAge, FS_MediaType mediaType);
|
||||
|
||||
/**
|
||||
* @brief Registers a background download task with NIM. These are processed in sleep mode only.
|
||||
* @param cfg Title config to use. See @ref NIMS_MakeTitleConfig.
|
||||
* @param name Name of the title in UTF-8. Will be displayed on the HOME Menu. Maximum 73 characters.
|
||||
* @param maker Name of the maker/publisher in UTF-8. Will be displayed on the HOME Menu. Maximum 37 characters.
|
||||
*/
|
||||
Result NIMS_RegisterTask(const NIM_TitleConfig *cfg, const char *name, const char *maker);
|
||||
|
||||
/**
|
||||
* @brief Checks whether a background download task for the given title is registered with NIM.
|
||||
* @param titleId Title ID to check for.
|
||||
* @param registered Whether there is a background download task registered.
|
||||
*/
|
||||
Result NIMS_IsTaskRegistered(u64 titleId, bool *registered);
|
||||
|
||||
/**
|
||||
* @brief Unregisters a background download task.
|
||||
* @param titleId Title ID whose background download task to cancel.
|
||||
*/
|
||||
Result NIMS_UnregisterTask(u64 titleId);
|
||||
|
||||
/**
|
||||
* @brief Starts an active download with NIM. Progress can be checked with @ref NIMS_GetProcess. Do not exit the process while a download is in progress without calling @ref NIMS_CancelDownload.
|
||||
* @param cfg Title config to use. See @ref NIMS_MakeTitleConfig.
|
||||
* @param mode The installation mode to use. See @ref NIM_InstallationMode.
|
||||
*/
|
||||
Result NIMS_StartDownload(const NIM_TitleConfig *cfg, NIM_InstallationMode mode);
|
||||
|
||||
/**
|
||||
* @brief Starts an active download with NIM with default installation mode; cannot reinstall titles. Progress can be checked with @ref NIMS_GetProcess. Do not exit the process while a download is in progress without calling @ref NIMS_CancelDownload.
|
||||
* @param cfg Title config to use. See @ref NIMS_MakeTitleConfig.
|
||||
*/
|
||||
Result NIMS_StartDownloadSimple(const NIM_TitleConfig *cfg);
|
||||
|
||||
/**
|
||||
* @brief Checks the status of the current active download.
|
||||
* @param tp Title progress struct to write to. See @ref NIM_TitleProgress.
|
||||
*/
|
||||
Result NIMS_GetProgress(NIM_TitleProgress *tp);
|
||||
|
||||
/**
|
||||
* @brief Cancels the current active download with NIM.
|
||||
*/
|
||||
Result NIMS_CancelDownload(void);
|
@ -10,12 +10,6 @@ Result nsInit(void);
|
||||
/// Exits NS.
|
||||
void nsExit(void);
|
||||
|
||||
/**
|
||||
* @brief Launches a title and the required firmware (only if necessary).
|
||||
* @param titleid ID of the title to launch, 0 for gamecard, JPN System Settings' titleID for System Settings.
|
||||
*/
|
||||
Result NS_LaunchFIRM(u64 titleid);
|
||||
|
||||
/**
|
||||
* @brief Launches a title.
|
||||
* @param titleid ID of the title to launch, or 0 for gamecard.
|
||||
@ -24,28 +18,9 @@ Result NS_LaunchFIRM(u64 titleid);
|
||||
*/
|
||||
Result NS_LaunchTitle(u64 titleid, u32 launch_flags, u32 *procid);
|
||||
|
||||
/// Terminates the application from which this function is called
|
||||
Result NS_TerminateTitle(void);
|
||||
/**
|
||||
* @brief Launches a title and the required firmware.
|
||||
* @param titleid ID of the title to launch, 0 for gamecard.
|
||||
* @param flags Flags for firm-launch. bit0: require an application title-info structure in FIRM paramters to be specified via FIRM parameters. bit1: if clear, NS will check certain Configuration Memory fields.
|
||||
*/
|
||||
Result NS_LaunchApplicationFIRM(u64 titleid, u32 flags);
|
||||
|
||||
/**
|
||||
* @brief Reboots to a title.
|
||||
* @param mediatype Mediatype of the title.
|
||||
* @param titleid ID of the title to launch.
|
||||
*/
|
||||
Result NS_RebootToTitle(u8 mediatype, u64 titleid);
|
||||
|
||||
/**
|
||||
* @brief Terminates the process with the specified titleid.
|
||||
* @param titleid ID of the title to terminate.
|
||||
* @param timeout Timeout in nanoseconds. Pass 0 if not required.
|
||||
*/
|
||||
Result NS_TerminateProcessTID(u64 titleid, u64 timeout);
|
||||
|
||||
/// Reboots the system
|
||||
Result NS_RebootSystem(void);
|
@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Initializes NWMEXT.
|
||||
Result nwmExtInit(void);
|
||||
|
||||
// Exits NWMEXT.
|
||||
void nwmExtExit(void);
|
||||
|
||||
/**
|
||||
* @brief Turns wireless on or off.
|
||||
* @param enableWifi True enables it, false disables it.
|
||||
*/
|
||||
Result NWMEXT_ControlWirelessEnabled(bool enableWifi);
|
49
libctru/include/3ds/services/pm.h
Normal file
49
libctru/include/3ds/services/pm.h
Normal file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @file pm.h
|
||||
* @brief PM (Process Manager) service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// Initializes PM.
|
||||
Result pmInit(void);
|
||||
|
||||
/// Exits PM.
|
||||
void pmExit(void);
|
||||
|
||||
/**
|
||||
* @brief Launches a title.
|
||||
* @param mediatype Mediatype of the title.
|
||||
* @param titleid ID of the title.
|
||||
* @param launch_flags Flags to launch the title with.
|
||||
*/
|
||||
Result PM_LaunchTitle(u8 mediatype, u64 titleid, u32 launch_flags);
|
||||
|
||||
/**
|
||||
* @brief Gets launch flags from a title's exheader.
|
||||
* @param mediatype Mediatype of the title.
|
||||
* @param titleid ID of the title.
|
||||
* @param out Pointer to write the launch flags to.
|
||||
*/
|
||||
Result PM_GetTitleExheaderFlags(u8 mediatype, u64 titleid, u8* out);
|
||||
|
||||
/**
|
||||
* @brief Sets the current FIRM launch parameters.
|
||||
* @param size Size of the FIRM launch parameter buffer.
|
||||
* @param in Buffer to retrieve the launch parameters from.
|
||||
*/
|
||||
Result PM_SetFIRMLaunchParams(u32 size, u8* in);
|
||||
|
||||
/**
|
||||
* @brief Gets the current FIRM launch parameters.
|
||||
* @param size Size of the FIRM launch parameter buffer.
|
||||
* @param out Buffer to write the launch parameters to.
|
||||
*/
|
||||
Result PM_GetFIRMLaunchParams(u32 size, u8* out);
|
||||
|
||||
/**
|
||||
* @brief Sets the current FIRM launch parameters.
|
||||
* @param firm_titleid_low Low Title ID of the FIRM title to launch.
|
||||
* @param size Size of the FIRM launch parameter buffer.
|
||||
* @param in Buffer to retrieve the launch parameters from.
|
||||
*/
|
||||
Result PM_LaunchFIRMSetParams(u32 firm_titleid_low, u32 size, u8* in);
|
@ -1,123 +0,0 @@
|
||||
/**
|
||||
* @file pmapp.h
|
||||
* @brief PM (Process Manager) application service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/services/fs.h>
|
||||
#include <3ds/exheader.h>
|
||||
|
||||
/// Launch flags for PM launch commands.
|
||||
enum {
|
||||
PMLAUNCHFLAG_NORMAL_APPLICATION = BIT(0),
|
||||
PMLAUNCHFLAG_LOAD_DEPENDENCIES = BIT(1),
|
||||
PMLAUNCHFLAG_NOTIFY_TERMINATION = BIT(2),
|
||||
PMLAUNCHFLAG_QUEUE_DEBUG_APPLICATION = BIT(3),
|
||||
PMLAUNCHFLAG_TERMINATION_NOTIFICATION_MASK = 0xF0,
|
||||
PMLAUNCHFLAG_FORCE_USE_O3DS_APP_MEM = BIT(8), ///< Forces the usage of the O3DS system mode app memory setting even if N3DS system mode is not "Legacy". Dev4 and Dev5 not supported. N3DS only.
|
||||
PMLAUNCHFLAG_FORCE_USE_O3DS_MAX_APP_MEM = BIT(9), ///< In conjunction with the above, forces the 96MB app memory setting. N3DS only.
|
||||
PMLAUNCHFLAG_USE_UPDATE_TITLE = BIT(16),
|
||||
};
|
||||
|
||||
/// Initializes pm:app.
|
||||
Result pmAppInit(void);
|
||||
|
||||
/// Exits pm:app.
|
||||
void pmAppExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current pm:app session handle.
|
||||
* @return The current pm:app session handle.
|
||||
*/
|
||||
Handle *pmAppGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Launches a title.
|
||||
* @param programInfo Program information of the title.
|
||||
* @param launchFlags Flags to launch the title with.
|
||||
*/
|
||||
Result PMAPP_LaunchTitle(const FS_ProgramInfo *programInfo, u32 launchFlags);
|
||||
|
||||
/**
|
||||
* @brief Launches a title, applying patches.
|
||||
* @param programInfo Program information of the title.
|
||||
* @param programInfoUpdate Program information of the update title.
|
||||
* @param launchFlags Flags to launch the title with.
|
||||
*/
|
||||
Result PMAPP_LaunchTitleUpdate(const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate, u32 launchFlags);
|
||||
|
||||
/**
|
||||
* @brief Gets a title's ExHeader Arm11CoreInfo and SystemInfo flags.
|
||||
* @param[out] outCoreInfo Pointer to write the ExHeader Arm11CoreInfo to.
|
||||
* @param[out] outSiFlags Pointer to write the ExHeader SystemInfo flags to.
|
||||
* @param programInfo Program information of the title.
|
||||
*/
|
||||
Result PMAPP_GetTitleExheaderFlags(ExHeader_Arm11CoreInfo* outCoreInfo, ExHeader_SystemInfoFlags* outSiFlags, const FS_ProgramInfo *programInfo);
|
||||
|
||||
/**
|
||||
* @brief Sets the current FIRM launch parameters.
|
||||
* @param size Size of the FIRM launch parameter buffer.
|
||||
* @param in Buffer to retrieve the launch parameters from.
|
||||
*/
|
||||
Result PMAPP_SetFIRMLaunchParams(u32 size, const void* in);
|
||||
|
||||
/**
|
||||
* @brief Gets the current FIRM launch parameters.
|
||||
* @param size Size of the FIRM launch parameter buffer.
|
||||
* @param[out] out Buffer to write the launch parameters to.
|
||||
*/
|
||||
Result PMAPP_GetFIRMLaunchParams(void *out, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Sets the current FIRM launch parameters.
|
||||
* @param firmTidLow Low Title ID of the FIRM title to launch.
|
||||
* @param size Size of the FIRM launch parameter buffer.
|
||||
* @param in Buffer to retrieve the launch parameters from.
|
||||
*/
|
||||
Result PMAPP_LaunchFIRMSetParams(u32 firmTidLow, u32 size, const void* in);
|
||||
|
||||
/**
|
||||
* @brief Terminate most processes, to prepare for a reboot or a shutdown.
|
||||
* @param timeout Time limit in ns for process termination, after which the remaining processes are killed.
|
||||
*/
|
||||
Result PMAPP_PrepareForReboot(s64 timeout);
|
||||
|
||||
/**
|
||||
* @brief Terminates the current Application
|
||||
* @param timeout Timeout in nanoseconds
|
||||
*/
|
||||
Result PMAPP_TerminateCurrentApplication(s64 timeout);
|
||||
|
||||
/**
|
||||
* @brief Terminates the processes having the specified titleId.
|
||||
* @param titleId Title ID of the processes to terminate
|
||||
* @param timeout Timeout in nanoseconds
|
||||
*/
|
||||
Result PMAPP_TerminateTitle(u64 titleId, s64 timeout);
|
||||
|
||||
/**
|
||||
* @brief Terminates the specified process
|
||||
* @param pid Process-ID of the process to terminate
|
||||
* @param timeout Timeout in nanoseconds
|
||||
*/
|
||||
Result PMAPP_TerminateProcess(u32 pid, s64 timeout);
|
||||
|
||||
/**
|
||||
* @brief Unregisters a process
|
||||
* @param tid TitleID of the process to unregister
|
||||
*/
|
||||
Result PMAPP_UnregisterProcess(u64 tid);
|
||||
|
||||
/**
|
||||
* @brief Sets the APPLICATION cputime reslimit.
|
||||
* @param cpuTime Reslimit value.
|
||||
* @note cpuTime can be no higher than reslimitdesc[0] & 0x7F in exheader (or 80 if the latter is 0).
|
||||
*/
|
||||
Result PMAPP_SetAppResourceLimit(s64 cpuTime);
|
||||
|
||||
/**
|
||||
* @brief Gets the APPLICATION cputime reslimit.
|
||||
* @param[out] cpuTime Pointer to write the reslimit value to.
|
||||
*/
|
||||
Result PMAPP_GetAppResourceLimit(s64 *outCpuTime);
|
||||
|
@ -1,41 +0,0 @@
|
||||
/**
|
||||
* @file pmdbg.h
|
||||
* @brief PM (Process Manager) debug service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/services/pmapp.h>
|
||||
|
||||
/// Initializes pm:dbg.
|
||||
Result pmDbgInit(void);
|
||||
|
||||
/// Exits pm:dbg.
|
||||
void pmDbgExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current pm:dbg session handle.
|
||||
* @return The current pm:dbg session handle.
|
||||
*/
|
||||
Handle *pmDbgGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Enqueues an application for debug after setting cpuTime to 0, and returns a debug handle to it.
|
||||
* If another process was enqueued, this just calls @ref RunQueuedProcess instead.
|
||||
* @param[out] Pointer to output the debug handle to.
|
||||
* @param programInfo Program information of the title.
|
||||
* @param launchFlags Flags to launch the title with.
|
||||
*/
|
||||
Result PMDBG_LaunchAppDebug(Handle *outDebug, const FS_ProgramInfo *programInfo, u32 launchFlags);
|
||||
|
||||
/**
|
||||
* @brief Launches an application for debug after setting cpuTime to 0.
|
||||
* @param programInfo Program information of the title.
|
||||
* @param launchFlags Flags to launch the title with.
|
||||
*/
|
||||
Result PMDBG_LaunchApp(const FS_ProgramInfo *programInfo, u32 launchFlags);
|
||||
|
||||
/**
|
||||
* @brief Runs the queued process and returns a debug handle to it.
|
||||
* @param[out] Pointer to output the debug handle to.
|
||||
*/
|
||||
Result PMDBG_RunQueuedProcess(Handle *outDebug);
|
@ -7,12 +7,12 @@
|
||||
/// PS AES algorithms.
|
||||
typedef enum
|
||||
{
|
||||
PS_ALGORITHM_CBC_ENC, ///< CBC encryption.
|
||||
PS_ALGORITHM_CBC_DEC, ///< CBC decryption.
|
||||
PS_ALGORITHM_CTR_ENC, ///< CTR encryption.
|
||||
PS_ALGORITHM_CTR_DEC, ///< CTR decryption(same as PS_ALGORITHM_CTR_ENC).
|
||||
PS_ALGORITHM_CCM_ENC, ///< CCM encryption.
|
||||
PS_ALGORITHM_CCM_DEC, ///< CCM decryption.
|
||||
PS_ALGORITHM_CBC_ENC, ///< CBC encoding.
|
||||
PS_ALGORITHM_CBC_DEC, ///< CBC decoding.
|
||||
PS_ALGORITHM_CTR_ENC, ///< CTR encoding.
|
||||
PS_ALGORITHM_CTR_DEC, ///< CTR decoding.
|
||||
PS_ALGORITHM_CCM_ENC, ///< CCM encoding.
|
||||
PS_ALGORITHM_CCM_DEC, ///< CCM decoding.
|
||||
} PS_AESAlgorithm;
|
||||
|
||||
/// PS key slots.
|
||||
@ -30,45 +30,12 @@ typedef enum
|
||||
PS_KEYSLOT_39_NFC ///< Key slot 0x39. (NFC)
|
||||
} PS_AESKeyType;
|
||||
|
||||
/// RSA context.
|
||||
typedef struct {
|
||||
u8 modulo[0x100];
|
||||
u8 exponent[0x100];
|
||||
u32 rsa_bitsize;//The signature byte size is rsa_bitsize>>3.
|
||||
u32 unk;//Normally zero?
|
||||
} psRSAContext;
|
||||
|
||||
/// Initializes PS.
|
||||
Result psInit(void);
|
||||
|
||||
/**
|
||||
* @brief Initializes PS with the specified session handle.
|
||||
* @param handle Session handle.
|
||||
*/
|
||||
Result psInitHandle(Handle handle);
|
||||
|
||||
/// Exits PS.
|
||||
void psExit(void);
|
||||
|
||||
/// Returns the PS session handle.
|
||||
Handle psGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Signs a RSA signature.
|
||||
* @param hash SHA256 hash to sign.
|
||||
* @param ctx RSA context.
|
||||
* @param signature RSA signature.
|
||||
*/
|
||||
Result PS_SignRsaSha256(u8 *hash, psRSAContext *ctx, u8 *signature);
|
||||
|
||||
/**
|
||||
* @brief Verifies a RSA signature.
|
||||
* @param hash SHA256 hash to compare with.
|
||||
* @param ctx RSA context.
|
||||
* @param signature RSA signature.
|
||||
*/
|
||||
Result PS_VerifyRsaSha256(u8 *hash, psRSAContext *ctx, u8 *signature);
|
||||
|
||||
/**
|
||||
* @brief Encrypts/Decrypts AES data. Does not support AES CCM.
|
||||
* @param size Size of the data.
|
||||
@ -76,7 +43,7 @@ Result PS_VerifyRsaSha256(u8 *hash, psRSAContext *ctx, u8 *signature);
|
||||
* @param out Output buffer.
|
||||
* @param aes_algo AES algorithm to use.
|
||||
* @param key_type Key type to use.
|
||||
* @param iv Pointer to the CTR/IV. The output CTR/IV is also written here.
|
||||
* @param iv Pointer to the CTR/IV.
|
||||
*/
|
||||
Result PS_EncryptDecryptAes(u32 size, u8* in, u8* out, PS_AESAlgorithm aes_algo, PS_AESKeyType key_type, u8* iv);
|
||||
|
||||
@ -107,10 +74,3 @@ Result PS_GetLocalFriendCodeSeed(u64* seed);
|
||||
* @param device_id Pointer to write the device ID to.
|
||||
*/
|
||||
Result PS_GetDeviceId(u32* device_id);
|
||||
|
||||
/**
|
||||
* @brief Generates cryptographically secure random bytes.
|
||||
* @param out Pointer to the buffer to write the bytes to.
|
||||
* @param len Number of bytes to write.
|
||||
*/
|
||||
Result PS_GenerateRandomBytes(void* out, size_t len);
|
||||
|
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* @file ptmgets.h
|
||||
* @brief PTMGETS service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Initializes PTMGETS.
|
||||
Result ptmGetsInit(void);
|
||||
|
||||
/// Exits PTMGETS.
|
||||
void ptmGetsExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the current ptm:gets session handle.
|
||||
* @return A pointer to the current ptm:gets session handle.
|
||||
*/
|
||||
Handle *ptmGetsGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the system time.
|
||||
* @param[out] outMsY2k The pointer to write the number of milliseconds since 01/01/2000 to.
|
||||
*/
|
||||
Result PTMGETS_GetSystemTime(s64 *outMsY2k);
|
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* @file ptmsets.h
|
||||
* @brief PTMSETS service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// Initializes PTMSETS.
|
||||
Result ptmSetsInit(void);
|
||||
|
||||
/// Exits PTMSETS.
|
||||
void ptmSetsExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the current ptm:sets session handle.
|
||||
* @return A pointer to the current ptm:sets session handle.
|
||||
*/
|
||||
Handle *ptmSetsGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the system time.
|
||||
* @param msY2k The number of milliseconds since 01/01/2000.
|
||||
*/
|
||||
Result PTMSETS_SetSystemTime(s64 msY2k);
|
@ -4,130 +4,15 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/// PDN wake events and MCU interrupts to select, combined with those of other processes
|
||||
typedef struct PtmWakeEvents {
|
||||
u32 pdn_wake_events; ///< Written to PDN_WAKE_EVENTS. Don't select bit26 (MCU), PTM will do it automatically.
|
||||
u32 mcu_interupt_mask; ///< MCU interrupts to check when a MCU wake event happens.
|
||||
} PtmWakeEvents;
|
||||
|
||||
typedef struct {
|
||||
PtmWakeEvents exit_sleep_events; ///< Wake events for which the system should fully wake up.
|
||||
PtmWakeEvents continue_sleep_events; ///< Wake events for which the system should return to sleep.
|
||||
} PtmSleepConfig;
|
||||
|
||||
enum {
|
||||
// Sleep FSM notification IDs
|
||||
PTMNOTIFID_SLEEP_REQUESTED = 0x101, ///< @ref PTMSYSM_RequestSleep has been called (ack = 3)
|
||||
PTMNOTIFID_SLEEP_DENIED = 0x102, ///< The sleep request has been denied by @ref PTMSYSM_ReplyToSleepQuery(true) (no ack required).
|
||||
PTMNOTIFID_SLEEP_ALLOWED = 0x103, ///< The sleep request has been allowed by @ref PTMSYSM_ReplyToSleepQuery(false) (ack = 1).
|
||||
PTMNOTIFID_GOING_TO_SLEEP = 0x104, ///< All processes not having "RunnableOnSleep" have been paused & the system is about to go to sleep (ack = 0).
|
||||
PTMNOTIFID_FULLY_WAKING_UP = 0x105, ///< The system has been woken up, and the paused processes are about to be unpaused (ack = 1).
|
||||
PTMNOTIFID_FULLY_AWAKE = 0x106, ///< The system is fully awake (no ack required).
|
||||
PTMNOTIFID_HALF_AWAKE = 0x107, ///< The system has been woken up but is about to go to sleep again (ack = 2).
|
||||
|
||||
PTMNOTIFID_SHUTDOWN = 0x108, ///< The system is about to power off or reboot.
|
||||
|
||||
PTMNOTIFID_BATTERY_VERY_LOW = 0x211, ///< The battery level has reached 5% or below.
|
||||
PTMNOTIFID_BATTERY_LOW = 0x212, ///< The battery level has reached 10% or below.
|
||||
};
|
||||
|
||||
/// See @ref PTMSYSM_NotifySleepPreparationComplete. Corresponds to the number of potentially remaning notifs. until sleep/wakeup.
|
||||
static inline s32 ptmSysmGetNotificationAckValue(u32 id)
|
||||
{
|
||||
static const s32 values[] = { 3, -1, 1, 0, 0, -1, 2 };
|
||||
if (id < PTMNOTIFID_SLEEP_REQUESTED || id > PTMNOTIFID_HALF_AWAKE)
|
||||
return -1;
|
||||
return values[id - PTMNOTIFID_SLEEP_REQUESTED];
|
||||
}
|
||||
|
||||
/// Initializes ptm:sysm.
|
||||
Result ptmSysmInit(void);
|
||||
|
||||
/// Exits ptm:sysm.
|
||||
void ptmSysmExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the current ptm:sysm session handle.
|
||||
* @return A pointer to the current ptm:sysm session handle.
|
||||
*/
|
||||
Handle *ptmSysmGetSessionHandle(void);
|
||||
|
||||
/// Requests to enter sleep mode.
|
||||
Result PTMSYSM_RequestSleep(void);
|
||||
|
||||
/**
|
||||
* @brief Accepts or denies the incoming sleep mode request.
|
||||
* @param deny Whether or not to deny the sleep request.
|
||||
* @note If deny = false, this is equivalent to calling @ref PTMSYSM_NotifySleepPreparationComplete(3)
|
||||
*/
|
||||
Result PTMSYSM_ReplyToSleepQuery(bool deny);
|
||||
|
||||
/**
|
||||
* @brief Acknowledges the current sleep notification and advance the internal sleep mode FSM. All subscribers must reply.
|
||||
* @param ackValue Use @ref ptmSysmGetNotificationAckValue
|
||||
* @note @ref PTMNOTIFID_SLEEP_DENIED and @ref PTMNOTIFID_FULLY_AWAKE don't require this.
|
||||
*/
|
||||
Result PTMSYSM_NotifySleepPreparationComplete(s32 ackValue);
|
||||
|
||||
/**
|
||||
* @brief Sets the wake events (two sets: when to fully wake up and when to return to sleep).
|
||||
* @param sleepConfig Pointer to the two sets of wake events.
|
||||
* @note Can only be called just before acknowledging @ref PTMNOTIFID_GOING_TO_SLEEP or @ref PTMNOTIFID_HALF_AWAKE.
|
||||
*/
|
||||
Result PTMSYSM_SetWakeEvents(const PtmSleepConfig *sleepConfig);
|
||||
|
||||
/**
|
||||
* @brief Gets the wake reason (only the first applicable wake event is taken into account).
|
||||
* @param sleepConfig Pointer to the two sets of wake events. Only the relevant set will be filled.
|
||||
*/
|
||||
Result PTMSYSM_GetWakeReason(PtmSleepConfig *outSleepConfig);
|
||||
|
||||
/// Cancels the "half-awake" state and fully wakes up the 3DS after some delay.
|
||||
Result PTMSYSM_Awaken(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the user time by updating the user time offset.
|
||||
* @param msY2k The number of milliseconds since 01/01/2000.
|
||||
*/
|
||||
Result PTMSYSM_SetUserTime(s64 msY2k);
|
||||
|
||||
/// Invalidates the "system time" (cfg block 0x30002)
|
||||
Result PTMSYSM_InvalidateSystemTime(void);
|
||||
|
||||
/**
|
||||
* @brief Reads the time and date coming from the RTC and converts the result.
|
||||
* @param[out] outMsY2k The pointer to write the number of milliseconds since 01/01/2000 to.
|
||||
*/
|
||||
Result PTMSYSM_GetRtcTime(s64 *outMsY2k);
|
||||
|
||||
/**
|
||||
* @brief Writes the time and date coming to the RTC, after conversion.
|
||||
* @param msY2k The number of milliseconds since 01/01/2000.
|
||||
*/
|
||||
Result PTMSYSM_SetRtcTime(s64 msY2k);
|
||||
|
||||
/**
|
||||
* @brief Checks whether the system is a New 3DS.
|
||||
* @param[out] out Pointer to write the New 3DS flag to.
|
||||
*/
|
||||
Result PTMSYSM_CheckNew3DS(bool *out);
|
||||
|
||||
/**
|
||||
* @brief Configures the New 3DS' CPU clock speed and L2 cache.
|
||||
* @param value Bit0: enable higher clock, Bit1: enable L2 cache.
|
||||
*/
|
||||
Result PTMSYSM_ConfigureNew3DSCPU(u8 value);
|
||||
|
||||
/**
|
||||
* @brief Trigger a hardware system shutdown via the MCU.
|
||||
* @param timeout: timeout passed to PMApp:ShutdownAsync (PrepareForReboot).
|
||||
*/
|
||||
Result PTMSYSM_ShutdownAsync(u64 timeout);
|
||||
|
||||
/**
|
||||
* @brief Trigger a hardware system reboot via the MCU.
|
||||
* @param timeout: timeout passed to PMApp:ShutdownAsync (PrepareForReboot).
|
||||
*/
|
||||
Result PTMSYSM_RebootAsync(u64 timeout);
|
||||
|
@ -10,12 +10,6 @@ Result ptmuInit(void);
|
||||
/// Exits PTMU.
|
||||
void ptmuExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets a pointer to the current ptm:u session handle.
|
||||
* @return A pointer to the current ptm:u session handle.
|
||||
*/
|
||||
Handle *ptmuGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the system's current shell state.
|
||||
* @param out Pointer to write the current shell state to. (0 = closed, 1 = open)
|
||||
@ -46,8 +40,3 @@ Result PTMU_GetPedometerState(u8 *out);
|
||||
*/
|
||||
Result PTMU_GetTotalStepCount(u32 *steps);
|
||||
|
||||
/**
|
||||
* @brief Gets whether the adapter is plugged in or not
|
||||
* @param out Pointer to write the adapter state to.
|
||||
*/
|
||||
Result PTMU_GetAdapterState(bool *out);
|
||||
|
@ -1,79 +0,0 @@
|
||||
/**
|
||||
* @file pxidev.h
|
||||
* @brief Gamecard PXI service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/services/fs.h>
|
||||
|
||||
/// Card SPI wait operation type.
|
||||
typedef enum {
|
||||
WAIT_NONE = 0, ///< Do not wait.
|
||||
WAIT_SLEEP = 1, ///< Sleep for the specified number of nanoseconds.
|
||||
WAIT_IREQ_RETURN = 2, ///< Wait for IREQ, return if timeout.
|
||||
WAIT_IREQ_CONTINUE = 3 ///< Wait for IREQ, continue if timeout.
|
||||
} PXIDEV_WaitType;
|
||||
|
||||
/// Card SPI register deassertion type.
|
||||
typedef enum {
|
||||
DEASSERT_NONE = 0, ///< Do not deassert.
|
||||
DEASSERT_BEFORE_WAIT = 1, ///< Deassert before waiting.
|
||||
DEASSERT_AFTER_WAIT = 2 ///< Deassert after waiting.
|
||||
} PXIDEV_DeassertType;
|
||||
|
||||
/// Card SPI transfer buffer.
|
||||
typedef struct {
|
||||
void* ptr; ///< Data pointer.
|
||||
u32 size; ///< Data size.
|
||||
u8 transferOption; ///< Transfer options. See @ref pxiDevMakeTransferOption
|
||||
u64 waitOperation; ///< Wait operation. See @ref pxiDevMakeWaitOperation
|
||||
} PXIDEV_SPIBuffer;
|
||||
|
||||
/// Initializes pxi:dev.
|
||||
Result pxiDevInit(void);
|
||||
|
||||
/// Shuts down pxi:dev.
|
||||
void pxiDevExit(void);
|
||||
|
||||
/**
|
||||
* @brief Creates a packed card SPI transfer option value.
|
||||
* @param baudRate Baud rate to use when transferring.
|
||||
* @param busMode Bus mode to use when transferring.
|
||||
* @return A packed card SPI transfer option value.
|
||||
*/
|
||||
static inline u8 pxiDevMakeTransferOption(FS_CardSpiBaudRate baudRate, FS_CardSpiBusMode busMode)
|
||||
{
|
||||
return (baudRate & 0x3F) | ((busMode & 0x3) << 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a packed card SPI wait operation value.
|
||||
* @param waitType Type of wait to perform.
|
||||
* @param deassertType Type of register deassertion to perform.
|
||||
* @param timeout Timeout, in nanoseconds, to wait, if applicable.
|
||||
* @return A packed card SPI wait operation value.
|
||||
*/
|
||||
static inline u64 pxiDevMakeWaitOperation(PXIDEV_WaitType waitType, PXIDEV_DeassertType deassertType, u64 timeout)
|
||||
{
|
||||
return (waitType & 0xF) | ((deassertType & 0xF) << 4) | ((timeout & 0xFFFFFFFFFFFFFF) << 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs multiple card SPI writes and reads.
|
||||
* @param header Header to lead the transfers with. Must be, at most, 8 bytes in size.
|
||||
* @param writeBuffer1 Buffer to make first transfer from.
|
||||
* @param readBuffer1 Buffer to receive first response to.
|
||||
* @param writeBuffer2 Buffer to make second transfer from.
|
||||
* @param readBuffer2 Buffer to receive second response to.
|
||||
* @param footer Footer to follow the transfers with. Must be, at most, 8 bytes in size. Wait operation is unused.
|
||||
*/
|
||||
Result PXIDEV_SPIMultiWriteRead(PXIDEV_SPIBuffer* header, PXIDEV_SPIBuffer* writeBuffer1, PXIDEV_SPIBuffer* readBuffer1, PXIDEV_SPIBuffer* writeBuffer2, PXIDEV_SPIBuffer* readBuffer2, PXIDEV_SPIBuffer* footer);
|
||||
|
||||
/**
|
||||
* @brief Performs a single card SPI write and read.
|
||||
* @param bytesRead Pointer to output the number of bytes received to.
|
||||
* @param initialWaitOperation Wait operation to perform before transferring data.
|
||||
* @param writeBuffer Buffer to transfer data from.
|
||||
* @param readBuffer Buffer to receive data to.
|
||||
*/
|
||||
Result PXIDEV_SPIWriteRead(u32* bytesRead, u64 initialWaitOperation, PXIDEV_SPIBuffer* writeBuffer, PXIDEV_SPIBuffer* readBuffer);
|
@ -1,42 +0,0 @@
|
||||
/**
|
||||
* @file pxipm.h
|
||||
* @brief Process Manager PXI service
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <3ds/exheader.h>
|
||||
#include <3ds/services/fs.h>
|
||||
|
||||
/// Initializes PxiPM.
|
||||
Result pxiPmInit(void);
|
||||
|
||||
/// Exits PxiPM.
|
||||
void pxiPmExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current PxiPM session handle.
|
||||
* @return The current PxiPM session handle.
|
||||
*/
|
||||
Handle *pxiPmGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Retrives the exheader information set(s) (SCI+ACI) about a program.
|
||||
* @param exheaderInfos[out] Pointer to the output exheader information set.
|
||||
* @param programHandle The program handle.
|
||||
*/
|
||||
Result PXIPM_GetProgramInfo(ExHeader_Info *exheaderInfo, u64 programHandle);
|
||||
|
||||
/**
|
||||
* @brief Loads a program and registers it to Process9.
|
||||
* @param programHandle[out] Pointer to the output the program handle to.
|
||||
* @param programInfo Information about the program to load.
|
||||
* @param updateInfo Information about the program update to load.
|
||||
*/
|
||||
Result PXIPM_RegisterProgram(u64 *programHandle, const FS_ProgramInfo *programInfo, const FS_ProgramInfo *updateInfo);
|
||||
|
||||
/**
|
||||
* @brief Unloads a program and unregisters it from Process9.
|
||||
* @param programHandle The program handle.
|
||||
*/
|
||||
Result PXIPM_UnregisterProgram(u64 programHandle);
|
@ -1,559 +1,57 @@
|
||||
/**
|
||||
* @file qtm.h
|
||||
* @brief QTM services.
|
||||
*
|
||||
* QTM is responsible for the following:
|
||||
* - tracking and predicting the position of the user's eyes. This is done by using the inner
|
||||
* camera sampling at 320x240px at 30 FPS, and by using the gyroscope to predict the position
|
||||
* of the eyes between two camera samples (effectively doubling the tracking rate).
|
||||
* The API reporting eye tracking data is actually *console-agnostic*. This concept is most
|
||||
* likely covered by patent US9098112B2
|
||||
* - automatically managing the IR LED emitter used for eye tracking in low-light conditions
|
||||
* - managing the state of the parallax barrier by controlling the positions of the barrier's
|
||||
* mask (opaque/transparent state by repeating pattern of 12 units, plus polarity). This is
|
||||
* done via a TI TCA6416A I2C->Parallel expander (highlighted in yellow in this teardown photo:
|
||||
* https://guide-images.cdn.ifixit.com/igi/IKlW6WTZKKmapYkt.full, with the expected 12 traces
|
||||
* being clearly visible near the ribbon cable slot)
|
||||
* - updating the barrier position according to eye tracking data relative to an optimal setting
|
||||
* stored in calibration data: this is what Nintendo calls "Super Stable 3D" (SS3D); not done
|
||||
* when in 2D mode
|
||||
*
|
||||
* Head-tracking can be used even if SS3D is disabled.
|
||||
*
|
||||
* SS3D works as follows:
|
||||
* - compute the raw X and Y pixel coordinates for the eye midpoint:
|
||||
* `rawX = (leftEyeRawPxCoords.x + rightEyeRawPxCoords.x) / 2`
|
||||
* `rawY = (leftEyeRawPxCoords.y + rightEyeRawPxCoords.y) / 2`
|
||||
* - rotate the value around the optical Z-axis using the optimal eye-to-camera angle from
|
||||
* calibration data, with a rotation matrix
|
||||
* - normalize the X value:
|
||||
* `xC = (rawX / 320) - 0.5`
|
||||
* - transform into world space coordinate, using fovX from calibration (convert to radians first).
|
||||
* Note that this fovX doesn't take lens distortion into account and is slightly different from
|
||||
* the hardcoded angle used in \ref QTMU_GetTrackingData
|
||||
* `x = xC * tan(fovX/2)`
|
||||
* - multiply by length of adjacent side (eye-to-camera distance) to get the length of the opposite
|
||||
* side. This is the eye horizontal deviation to camera lens in mm, which is then converted to
|
||||
* number of iod/12 units:
|
||||
* `delta = x * optimalDistance / (iod/12)`
|
||||
* - we then obtain the new target position of the parallax barrier (expressed in iod/12 units,
|
||||
* mod iod/12):
|
||||
* `pos = centerPos + delta`
|
||||
* - the value is then rounded to nearest integer. To avoid artifacts, if the rounded value is
|
||||
* going to increase, then 0.01 is subtracted, and if it is going to decrease, then 0.01 is added.
|
||||
* The value is rounded again to compute the final discrete value written to the expander (barrier
|
||||
* position).
|
||||
* - note: all calculation in QTM and otherwise assume interocular distance to be 62mm (the average).
|
||||
* Assumedly, if the user's IOD is different, then "optimal distance to screen" effectively changes
|
||||
* for that user.
|
||||
*
|
||||
* QTM services are not present on O3DS, thus caller must call \ref qtmCheckServicesRegistered to check
|
||||
* if the services are registered. Moreover, since QTM functionality might not always be available (due
|
||||
* to blacklist or console being N2DSXL), `qtm:u` users should check Result return values, and `qtm:s`
|
||||
* users can call \ref QTMS_SetQtmStatus to check the actual availability status.
|
||||
*
|
||||
* Considering that the eye tracking data reporting API is hardware-agnostic, it is advisable to
|
||||
* hardcode neither camera aspect ratio (even if it is 4/3 on real hardware) and resolution nor
|
||||
* field-of-view angle.
|
||||
*
|
||||
* There is a separate QTM service, `qtm:c` ("hardware check"), that lets you manipulate parallax barrier
|
||||
* pattern directly. It is covered in \ref qtmc.h instead.
|
||||
* @brief QTM service.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
//See also: http://3dbrew.org/wiki/QTM_Services
|
||||
|
||||
/// ID of QTM status data (fully enabled/SS3D disabled) in `cfg`
|
||||
#define QTM_STATUS_CFG_BLK_ID 0x180000u
|
||||
/// Head tracking coordinate pair.
|
||||
typedef struct {
|
||||
float x; ///< X coordinate.
|
||||
float y; ///< Y coordinate.
|
||||
} QTM_HeadTrackingInfoCoord;
|
||||
|
||||
/// ID of QTM calibration data in `cfg`
|
||||
#define QTM_CAL_CFG_BLK_ID 0x180001u
|
||||
/// Head tracking info.
|
||||
typedef struct {
|
||||
u8 flags[5]; ///< Flags.
|
||||
u8 padding[3]; ///< Padding.
|
||||
float floatdata_x08; ///< Unknown. Not used by System_Settings.
|
||||
QTM_HeadTrackingInfoCoord coords0[4]; ///< Head coordinates.
|
||||
u32 unk_x2c[5]; ///< Unknown. Not used by System_Settings.
|
||||
} QTM_HeadTrackingInfo;
|
||||
|
||||
/**
|
||||
* @brief QTM enablement status (when cameras not in use by user), set by `qtm:s`.
|
||||
* @note Manual IR LED control, camera lux, and `qtm:c` commands remain available
|
||||
* for use on N3DS and N3DSXL regardless.
|
||||
*/
|
||||
typedef enum QtmStatus {
|
||||
QTM_STATUS_ENABLED = 0, ///< QTM is fully enabled.
|
||||
QTM_STATUS_SS3D_DISABLED = 1, ///< QTM "super stable 3D" feature is disabled. Parallax barrier hardware state is configured to match O3DS.
|
||||
|
||||
/**
|
||||
* @brief QTM is unavailable: either "blacklisted" (usually by NS) for the current title, **or console is a N2DSXL**.
|
||||
*
|
||||
* In this state, all QTM functionality is disabled. This includes "super-stable 3D"
|
||||
* (ie. auto barrier adjustment) including `qtm:s` manual barrier position setting functions,
|
||||
* head tracking, IR LED control and camera luminance reporting (400.0 is returned instead).
|
||||
*
|
||||
* @note `qtm:c` barrier hardware state setting function (\ref blah) bypasses this state.
|
||||
* @note Due to an oversight, \ref QTMS_SetQtmStatus allows changing QTM state on N2DSXL. This is not intended
|
||||
* to be done, and is in fact never done by official software.
|
||||
*/
|
||||
QTM_STATUS_UNAVAILABLE = 2,
|
||||
} QtmStatus;
|
||||
|
||||
/// QTM status data (fully enabled/SS3D disabled) in `cfg`. Usually all-zero on N2DSXL.
|
||||
typedef struct QtmStatusCfgData {
|
||||
QtmStatus defaultStats; ///< QTM status at boot (fully enabled or SS3D disabled).
|
||||
/**
|
||||
* @brief "Global variable" (.data) section load mode? Unused.
|
||||
* From CTRAging:
|
||||
* - 0: "normal"
|
||||
* - 1: "single reacq"
|
||||
* - 2: "double reacq"
|
||||
- 3/4/5: "w2w copy 1/10/100"
|
||||
*/
|
||||
u8 gvLoadMode;
|
||||
u8 _padding[2]; ///< Padding.
|
||||
} QtmStatusCfgData;
|
||||
|
||||
/// QTM calibration data (fully enabled/SS3D disabled) in `cfg`. Usually all-zero on N2DSXL.
|
||||
typedef struct QtmCalibrationData {
|
||||
/**
|
||||
* @brief Neutral (center) barrier position/offset (with slit width of 6 units), when the user is
|
||||
* facing directly facing the camera, that is to say, their eye midpoint normalized X coord
|
||||
* in the camera's plane is 0, assuming the user's head is located at the expected viewing distance
|
||||
* and at the expected eye-to-camera angle (as per the rest of this structure).
|
||||
* This is expressed in terms of iod/12 units modulo iod/12 (thus, range is 0 to 11 included),
|
||||
* with IOD (interocular distance) assumed to be 62mm.
|
||||
* @note This field is floating-point for QTM auto-adjustment purposes, however the actual barrier
|
||||
* position in hardware is an integer.
|
||||
* @note This is the field that System Settings lets you add -1.0 to +1.0 to.
|
||||
* @note Moreover, this field can be directly changed through \ref QTMS_SetCenterBarrierPosition.
|
||||
*/
|
||||
float centerBarrierPosition;
|
||||
|
||||
float translationX; ///< Lens X coord in inner camera space? Very low value and seems to be unused.
|
||||
float translationY; ///< Lens Y coord in inner camera space? Very low value and seems to be unused.
|
||||
float rotationZ; ///< Optimal eye-to-camera angle, in radians, without accounting for lens distortion.
|
||||
float fovX; ///< Camera's horizontal FoV in degrees, without accounting for lens distortion.
|
||||
float viewingDistance; ///< Optimal viewing distance between user and top screen, assuming iod to be 62mm.
|
||||
} QtmCalibrationData;
|
||||
|
||||
/// Left eye or right eye, for \ref QtmTrackingData and \ref QtmRawTrackingData
|
||||
typedef enum QtmEyeSide {
|
||||
QTM_EYE_LEFT = 0, ///< Left eye.
|
||||
QTM_EYE_RIGHT = 1, ///< Right eye.
|
||||
|
||||
QTM_EYE_NUM, ///< Number of eyes.
|
||||
} QtmEyeSide;
|
||||
|
||||
/// QTM raw eye tracking data
|
||||
typedef struct QtmRawTrackingData {
|
||||
/**
|
||||
* @brief Eye position detected or predicted, equals (confidenceLevel > 0).
|
||||
* If false, QTM will attempt to make a guess based on gyro data.
|
||||
* If the console isn't moving either, then QTM will assume the user's eyes are progressively
|
||||
* moving back to face the screen.
|
||||
*/
|
||||
bool eyesTracked; ///< Eye position detected or predicted, equals (confidenceLevel > 0).
|
||||
u8 _padding[3]; ///< Padding.
|
||||
u32 singletonQtmPtr; ///< Pointer to eye-tracking singleton pointer, in QTM's .bss, located in N3DS extra memory.
|
||||
float confidenceLevel; ///< Eye tracking confidence level (0 to 1).
|
||||
|
||||
/**
|
||||
* @brief Raw predicted or detected eye coordinates. Each eye is represented as one point.
|
||||
* Fractional part is *not* necessarily zero.
|
||||
* @note X coord is within 0 to 320.
|
||||
* @note Y coord is within 0 to 240.
|
||||
*/
|
||||
float rawEyeCameraCoordinates[QTM_EYE_NUM][2];
|
||||
|
||||
float dPitch; ///< Difference in gyro pitch from position at console boot.
|
||||
float dYaw; ///< Difference in gyro yaw from position at console boot.
|
||||
float dRoll; ///< Difference in gyro roll from position at console boot.
|
||||
|
||||
s64 samplingTick; ///< Time point the current measurements were made.
|
||||
} QtmRawTrackingData;
|
||||
|
||||
/// QTM processed eye tracking data, suitable for 3D programming
|
||||
typedef struct QtmTrackingData {
|
||||
bool eyesTracked; ///< Eye position detected or tracked with some confidence, equals (confidenceLevel > 0). Even if false, QTM may make a guess
|
||||
bool faceDetected; ///< Whether or not the entirety of the user's face has been detected with good confidence.
|
||||
bool eyesDetected; ///< Whether or not the user's eyes have actually been detected with full confidence.
|
||||
u8 _unused; ///< Unused.
|
||||
bool clamped; ///< Whether or not the normalized eye coordinates have been clamped after accounting for lens distortion.
|
||||
u8 _padding[3]; ///< Padding.
|
||||
|
||||
float confidenceLevel; ///< Eye tracking confidence level (0 to 1).
|
||||
|
||||
/**
|
||||
* @brief Normalized eye coordinates, for each eye, after accounting for lens distortion, centered around camera.
|
||||
* X coord is in the -1 to 1 range, and Y coord range depends on inverse aspect ratio (-0.75 to 0.75 on real hardware).
|
||||
* @note On real hardware, X coord equals `((rawX / 160.0) - 1.00) * 1.0639` before clamping.
|
||||
* @note On real hardware, Y coord equals `((rawY / 160.0) - 0.75) * 1.0637` before clamping.
|
||||
*/
|
||||
float eyeCameraCoordinates[QTM_EYE_NUM][2];
|
||||
|
||||
/**
|
||||
* @brief Normalized eye coordinates, for each eye, in world space.
|
||||
* Corresponds to \ref eyeCameraCoordinates multiplied by tangent of field of view.
|
||||
* @note On real hardware, X coord equals `eyeCameraCoordinates.x * tan(64.9 deg / 2)`.
|
||||
* @note On real hardware, Y coord equals `eyeCameraCoordinates.x * tan(51.0 deg / 2)`.
|
||||
*/
|
||||
float eyeWorldCoordinates[QTM_EYE_NUM][2];
|
||||
|
||||
float dPitch; ///< Difference in gyro pitch from position at console boot.
|
||||
float dYaw; ///< Difference in gyro yaw from position at console boot.
|
||||
float dRoll; ///< Difference in gyro roll from position at console boot.
|
||||
|
||||
|
||||
s64 samplingTick; ///< Time point the current measurements were made.
|
||||
} QtmTrackingData;
|
||||
|
||||
/// QTM service name enum, excluding `qtm:c`
|
||||
typedef enum QtmServiceName {
|
||||
/**
|
||||
* @brief `qtm:u`: has eye-tracking commands and IR LED control commands, but for some
|
||||
* reason cannot fetch ambiant lux data from the camera's luminosity sensor.
|
||||
*/
|
||||
QTM_SERVICE_USER = 0,
|
||||
|
||||
/**
|
||||
* @brief `qtm:s`: has access to all `qtm:u` commands, plus luminosity sensor, plus
|
||||
* manual barrier position setting and calibration adjustment commands.
|
||||
* Automatic barrier control is reenabled on session exit.
|
||||
*/
|
||||
QTM_SERVICE_SYSTEM = 1,
|
||||
|
||||
/**
|
||||
* @brief `qtm:sp`: has access to all `qtm:s` (and `qtm:u`) commands, and merely has a
|
||||
* few more commands that GSP uses to notify QTM of 2D<>3D mode switches and
|
||||
* power events. Automatic barrier control is reenabled on session exit.
|
||||
* GSP always keeps a `qtm:sp` sessions open (at least on latest system version),
|
||||
* whereas NS opens then immediately closes a `qtm:sp` sessions only when dealing
|
||||
* with a "blacklisted" application (that is, almost never).
|
||||
*/
|
||||
QTM_SERVICE_SYSTEM_PROCESS = 2,
|
||||
} QtmServiceName;
|
||||
|
||||
/**
|
||||
* @brief Check whether or not QTM services are registered.
|
||||
* @return True on O3DS systems, false on N3DS systems.
|
||||
*/
|
||||
bool qtmCheckServicesRegistered(void);
|
||||
|
||||
/**
|
||||
* @brief Initializes QTM (except `qtm:c`).
|
||||
* Excluding `qtm:c`, QTM has three main services.
|
||||
* Only 3 sessions (2 until 9.3.0 sysupdate) for ALL services COMBINED, including `qtm:c`,
|
||||
* can be open at a time.
|
||||
* Refer to \ref QtmServiceName enum value descriptions to see which service to choose.
|
||||
*
|
||||
* @param serviceName QTM service name enum value (corresponding to `qtm:u`, `qtm:s` and `qtm:sp`
|
||||
* respectively).
|
||||
* @note Result of \ref qtmCheckServicesRegistered should be checked before calling this function.
|
||||
*/
|
||||
Result qtmInit(QtmServiceName serviceName);
|
||||
/// Initializes QTM.
|
||||
Result qtmInit(void);
|
||||
|
||||
/// Exits QTM.
|
||||
void qtmExit(void);
|
||||
|
||||
/// Checks whether or not a `qtm:u`, `qtm:s` or `qtm:sp` session is active.
|
||||
bool qtmIsInitialized(void);
|
||||
|
||||
/// Returns a pointer to the current `qtm:u` / `qtm:s` / `qtm:sp` session handle.
|
||||
Handle *qtmGetSessionHandle(void);
|
||||
/**
|
||||
* @brief Checks whether QTM is initialized.
|
||||
* @return Whether QTM is initialized.
|
||||
*/
|
||||
bool qtmCheckInitialized(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current raw eye tracking data, with an optional prediction made for predictionTimePointOrZero = t+dt,
|
||||
* or for the current time point (QTM makes predictions based on gyro data since inner camera runs at 30 FPS).
|
||||
*
|
||||
* @param[out] outData Where to write the raw tracking data to. Cleared to all-zero on failure (instead of being left uninitialized).
|
||||
* @param predictionTimePointOrZero Either zero, or the time point (in system ticks) for which to make a prediction for.
|
||||
* Maximum 1 frame (at 30 FPS) in the past, and up to 5 frames in the future.
|
||||
* @return `0xC8A18008` if camera is in use by user, or `0xC8A183EF` if QTM is unavailable (in particular, QTM is always
|
||||
* unavailable on N2DSXL), Otherwise, 0 (success). Return value should be checked by caller.
|
||||
* @note Consider using \ref QTMU_GetTrackingDataEx instead.
|
||||
* @brief Checks whether a head is fully detected.
|
||||
* @param info Tracking info to check.
|
||||
*/
|
||||
Result QTMU_GetRawTrackingDataEx(QtmRawTrackingData *outData, s64 predictionTimePointOrZero);
|
||||
bool qtmCheckHeadFullyDetected(QTM_HeadTrackingInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Gets the current raw eye tracking data.
|
||||
*
|
||||
* @param[out] outData Where to write the raw tracking data to. Cleared to all-zero on failure (instead of being left uninitialized).
|
||||
* @return `0xC8A18008` if camera is in use by user, or `0xC8A183EF` if QTM is unavailable (in particular, QTM is always
|
||||
* unavailable on N2DSXL), Otherwise, 0 (success). Return value should be checked by caller.
|
||||
* @note Consider using \ref QTMU_GetTrackingData instead.
|
||||
* @brief Converts QTM coordinates to screen coordinates.
|
||||
* @param coord Coordinates to convert.
|
||||
* @param screen_width Width of the screen. Can be NULL to use the default value for the top screen.
|
||||
* @param screen_height Height of the screen. Can be NULL to use the default value for the top screen.
|
||||
* @param x Pointer to output the screen X coordinate to.
|
||||
* @param y Pointer to output the screen Y coordinate to.
|
||||
*/
|
||||
static inline Result QTMU_GetRawTrackingData(QtmRawTrackingData *outData)
|
||||
{
|
||||
return QTMU_GetRawTrackingDataEx(outData, 0LL);
|
||||
}
|
||||
Result qtmConvertCoordToScreen(QTM_HeadTrackingInfoCoord *coord, float *screen_width, float *screen_height, u32 *x, u32 *y);
|
||||
|
||||
/**
|
||||
* @brief Gets the current normalized eye tracking data, made suitable for 3D programming with an optional prediction made
|
||||
* for predictionTimePointOrZero = t+dt, or for the current time point (QTM makes predictions based on gyro data since
|
||||
* inner camera runs at 30 FPS).
|
||||
*
|
||||
* @param[out] outData Where to write the raw tracking data to. Cleared to all-zero on failure (instead of being left uninitialized).
|
||||
* @param predictionTimePointOrZero Either zero, or the time point (in system ticks) for which to make a prediction for.
|
||||
* Maximum 1 frame (at 30 FPS) in the past, and up to 5 frames in the future.
|
||||
* @return `0xC8A18008` if camera is in use by user, or `0xC8A183EF` if QTM is unavailable (in particular, QTM is always
|
||||
* unavailable on N2DSXL). Otherwise, 0 (success). Return value should be checked by caller.
|
||||
* @note This can, for example, be used in games to allow the user to control the scene's camera with their own face.
|
||||
* @brief Gets the current head tracking info.
|
||||
* @param val Normally 0.
|
||||
* @param out Pointer to write head tracking info to.
|
||||
*/
|
||||
Result QTMU_GetTrackingDataEx(QtmTrackingData *outData, s64 predictionTimePointOrZero);
|
||||
|
||||
/**
|
||||
* @brief Gets the current normalized eye tracking data, made suitable for 3D programming.
|
||||
*
|
||||
* @param[out] outData Where to write the raw tracking data to. Cleared to all-zero on failure (instead of being left uninitialized).
|
||||
* @return `0xC8A18008` if camera is in use by user, or `0xC8A183EF` if QTM is unavailable (in particular, QTM is always
|
||||
* unavailable on N2DSXL). Otherwise, 0 (success). Return value should be checked by caller.
|
||||
* @note This can, for example, be used in games to allow the user to control the scene's camera with their own face.
|
||||
*/
|
||||
static inline Result QTMU_GetTrackingData(QtmTrackingData *outData)
|
||||
{
|
||||
return QTMU_GetTrackingDataEx(outData, 0LL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Computes an approximation of the horizontal angular field of view of the camera based on eye tracking data.
|
||||
*
|
||||
* @param data Eye tracking data, obtained from \ref QTMU_GetTrackingData or \ref QTMU_GetTrackingDataEx.
|
||||
* @return Horizontal angular field of view in radians. Corresponds to 64.9 degrees on real hardware.
|
||||
*/
|
||||
float qtmComputeFovX(const QtmTrackingData *data);
|
||||
|
||||
/**
|
||||
* @brief Computes an approximation of the vertical angular field of view of the camera based on eye tracking data.
|
||||
*
|
||||
* @param data Eye tracking data, obtained from \ref QTMU_GetTrackingData or \ref QTMU_GetTrackingDataEx.
|
||||
* @return Vertical angular field of view in radians. Corresponds to 51.0 degrees on real hardware.
|
||||
*/
|
||||
float qtmComputeFovY(const QtmTrackingData *data);
|
||||
|
||||
/**
|
||||
* @brief Computes a rough approximation of the inverse of the aspect ration of the camera based on eye tracking data.
|
||||
*
|
||||
* @param data Eye tracking data, obtained from \ref QTMU_GetTrackingData or \ref QTMU_GetTrackingDataEx.
|
||||
* @return Rough approximation of the inverse of the aspect ratio of the camera. Aspect ratio is exactly 0.75 on real hardware.
|
||||
*/
|
||||
float qtmComputeInverseAspectRatio(const QtmTrackingData *data);
|
||||
|
||||
/**
|
||||
* @brief Computes the user's head tilt angle, that is, the angle between the line through both eyes and the camera's
|
||||
* horizontal axis in camera space.
|
||||
*
|
||||
* @param data Eye tracking data, obtained from \ref QTMU_GetTrackingData or \ref QTMU_GetTrackingDataEx.
|
||||
* @return Horizontal head angle relative to camera, in radians.
|
||||
*/
|
||||
float qtmComputeHeadTiltAngle(const QtmTrackingData *data);
|
||||
|
||||
/**
|
||||
* @brief Estimates the distance between the user's eyes and the camera, based on
|
||||
* eye tracking data. This may be a little bit inaccurate, as this assumes
|
||||
* interocular distance of 62mm (like all 3DS software does), and that both
|
||||
* eyes are at the same distance from the screen.
|
||||
*
|
||||
* @param data Eye tracking data, obtained from \ref QTMU_GetTrackingData or \ref QTMU_GetTrackingDataEx.
|
||||
* @return Eye-to-camera distance in millimeters.
|
||||
*/
|
||||
float qtmEstimateEyeToCameraDistance(const QtmTrackingData *data);
|
||||
|
||||
/**
|
||||
* @brief Temporarily enables manual control of the IR LED by user, disabling its automatic control.
|
||||
* If not already done, this also turns off the IR LED. This setting is cleared when user closes the console's shell.
|
||||
* @return Always 0 (success).
|
||||
*/
|
||||
Result QTMU_EnableManualIrLedControl(void);
|
||||
|
||||
/**
|
||||
* @brief Temporarily disables manual control of the IR LED by user, re-enabling its automatic control.
|
||||
* If not already done, this also turns off the IR LED.
|
||||
* @return Always 0 (success).
|
||||
*/
|
||||
Result QTMU_DisableManualIrLedControl(void);
|
||||
|
||||
/**
|
||||
* @brief Turns the IR LED on or off during manual control. \ref QTMU_EnableManualIrLedControl must have been called.
|
||||
*
|
||||
* @param on Whether to turn the IR LED on or off.
|
||||
* @return `0xC8A18005` if manual control was not enabled or if the operation failed, `0xC8A18008` if camera is in use
|
||||
* by user, or `0xC8A18009` if QTM is unavailable (in particular, QTM is always unavailable on N2DSXL).
|
||||
* Otherwise, 0 (success).
|
||||
*/
|
||||
Result QTMU_SetIrLedStatus(bool on);
|
||||
|
||||
/**
|
||||
* @brief Attempts to clear IR LED overrides from any of the relevant commands in `qtm:u`, `qtm:s` (and `qtm:c`) commands
|
||||
* by calling \ref QTMU_EnableManualIrLedControl followed by \ref QTMU_DisableManualIrLedControl, so that auto IR LED
|
||||
* management takes place again.
|
||||
* @return The value returned by \ref QTMU_DisableManualIrLedControl.
|
||||
*/
|
||||
Result qtmClearIrLedOverrides(void);
|
||||
|
||||
/**
|
||||
* @brief Checks whether or not QTM has been blacklisted, ie. that it has been made unavailable.
|
||||
* In detail, this means that the last call to \ref QTMS_SetQtmStatus was made with argument \ref QTM_STATUS_UNAVAILABLE,
|
||||
* usually by NS. This feature seems to only be used for some internal test titles.
|
||||
*
|
||||
* @param[out] outBlacklisted Whether or not QTM is unavailable. Always true on N2DSXL.
|
||||
* @return Always 0 (success).
|
||||
* @note On N2DSXL, even though status is always supposed to be \ref QTM_STATUS_UNAVAILABLE, this function often returns true
|
||||
* (because NS doesn't change QTM's status if title isn't blacklisted). Do not rely on this for N2DSXL detection.
|
||||
* @note Refer to https://www.3dbrew.org/wiki/NS_CFA for a list of title UIDs this is used for.
|
||||
*/
|
||||
Result QTMU_IsCurrentAppBlacklisted(bool *outBlacklisted);
|
||||
|
||||
/**
|
||||
* @brief Sets the neutral (center) barrier position/offset in calibration, _without_ saving it to `cfg`.
|
||||
* Takes effect immediately. SS3D works by calculating the position of the eye midpoint, rotated
|
||||
* by the ideal eye-to-camera angle, expressed in (iod/12 units, iod assumed to be 62mm).
|
||||
*
|
||||
* @param position Center barrier position, in terms of iod/12 units modulo iod/12.
|
||||
* @note This field is floating-point for QTM auto-adjustment purposes, however the actual barrier position
|
||||
* in hardware is an integer.
|
||||
* @note This is the field that System Settings lets you add -1.0 to +1.0 to.
|
||||
* @note There is no "get" counterpart for this.
|
||||
* @return `0xC8A18009` if QTM is unavailable (in particular, QTM is always unavailable on N2DSXL), otherwise
|
||||
0 (success).
|
||||
*/
|
||||
Result QTMS_SetCenterBarrierPosition(float position);
|
||||
|
||||
/**
|
||||
* @brief Gets the average ambient luminance as perceived by the inner camera (in lux).
|
||||
* If QTM is unavailable (in particular, QTM is always unavailable on N2DSXL), returns 400.0 instead
|
||||
* of the actual luminance.
|
||||
*
|
||||
* @param[out] outLuminanceLux Where to write the luminance to. Always 400.0 on N2DSXL.
|
||||
* @note Camera exposure, and in particular auto-exposure affects the returned luminance value. This must be
|
||||
* taken into consideration, because this value can thus surge when user covers the inner camera.
|
||||
* @return Always 0 (success).
|
||||
*/
|
||||
Result QTMS_GetCameraLuminance(float *outLuminanceLux);
|
||||
|
||||
/**
|
||||
* @brief Enables automatic barrier control when in 3D mode with "super stable 3D" enabled.
|
||||
*
|
||||
* @note This is automatically called upon `qtm:s` and `qtm:sp` session exit.
|
||||
* @return `0xC8A18009` if QTM is unavailable (in particular, QTM is always unavailable on N2DSXL), otherwise
|
||||
0 (success).
|
||||
* @note Due to an oversight, \ref QTMS_SetQtmStatus allows changing QTM state on N2DSXL. This is not intended
|
||||
* to be done, and is in fact never done by official software. If that is regardless the case,
|
||||
* this function here does nothing.
|
||||
*/
|
||||
Result QTMS_EnableAutoBarrierControl(void);
|
||||
|
||||
/**
|
||||
* @brief Temporarily disables automatic barrier control (when in 3D mode with "super stable 3D" enabled).
|
||||
*
|
||||
* @note This is automatically called upon `qtm:s` and `qtm:sp` session exit.
|
||||
* @return `0xC8A18009` if QTM is unavailable (in particular, QTM is always unavailable on N2DSXL), otherwise
|
||||
0 (success).
|
||||
* @note Due to an oversight, \ref QTMS_SetQtmStatus allows changing QTM state on N2DSXL. This is not intended
|
||||
* to be done, and is in fact never done by official software. If that is regardless the case,
|
||||
* this function here does nothing.
|
||||
*/
|
||||
Result QTMS_DisableAutoBarrierControl(void);
|
||||
|
||||
/**
|
||||
* @brief Temporarily sets the parallax barrier's position (offset in iod/12 units, assuming slit width of 6 units).
|
||||
* Does nothing in 2D mode and/or if "super stable 3D" is disabled.
|
||||
*
|
||||
* @param position Parallax barrier position (offset in units), must be between 0 and 11 (both included)
|
||||
* @return `0xC8A18009` if QTM is unavailable (in particular, QTM is always unavailable on N2DSXL), 0xE0E18002
|
||||
* if \p position is not in range, otherwise 0 (success).
|
||||
* @note Due to an oversight, \ref QTMS_SetQtmStatus allows changing QTM state on N2DSXL. This is not intended
|
||||
* to be done, and is in fact never done by official software. If that is regardless the case,
|
||||
* this function here does nothing.
|
||||
* @note No effect when the screen is in 2D mode.
|
||||
* @see QTMC_SetBarrierPattern
|
||||
*/
|
||||
Result QTMS_SetBarrierPosition(u8 position);
|
||||
|
||||
/**
|
||||
* @brief Gets the current position of the parallax barrier (offset in iod/12 units, slit width of 6 units).
|
||||
* When "super stable 3D" is disabled, returns 13 instead.
|
||||
*
|
||||
* @param[out] outPosition Where to write the barrier's position to.
|
||||
* @return `0xC8A18009` if QTM is unavailable (in particular, QTM is always unavailable on N2DSXL), otherwise
|
||||
0 (success).
|
||||
* @note When SS3D is disabled, this returns 13 to \p outPosition . When in 2D mode, the returned position is not
|
||||
updated.
|
||||
* @note Due to an oversight, \ref QTMS_SetQtmStatus allows changing QTM state on N2DSXL. This is not intended
|
||||
* to be done, and is in fact never done by official software. If that is regardless the case,
|
||||
* this function here returns 13 to \p outPosition .
|
||||
* @see QTMC_SetBarrierPattern
|
||||
*/
|
||||
Result QTMS_GetCurrentBarrierPosition(u8 *outPosition);
|
||||
|
||||
/**
|
||||
* @brief Temporarily overrides IR LED state. Requires "manual control" from `qtm:u` to be disabled, and has
|
||||
* lower priority than it.
|
||||
*
|
||||
* @param on Whether to turn the IR LED on or off.
|
||||
* @return `0xC8A18005` if manual control was enabled or if the operation failed, `0xC8A18008` if camera is in use
|
||||
* by user (unless "hardware check" API enabled), or `0xC8A18009` if QTM is unavailable (in particular,
|
||||
* QTM is always unavailable on N2DSXL). Otherwise, 0 (success).
|
||||
*/
|
||||
Result QTMS_SetIrLedStatusOverride(bool on);
|
||||
|
||||
/**
|
||||
* @brief Sets calibration data, taking effect immediately, and optionally saves it to `cfg`.
|
||||
*
|
||||
* @param cal Pointer to calibration data.
|
||||
* @param saveCalToCfg Whether or not to persist the calibration data in `cfg`.
|
||||
* @return `0xC8A18009` if QTM is unavailable (in particular, QTM is always unavailable on N2DSXL), otherwise
|
||||
whatever `cfg:s` commands return (if used), or 0 (success).
|
||||
* @note There is no "get" counterpart for this function, and there is no way to see the current calibration data
|
||||
in use unless it has been saved to `cfg`.
|
||||
* @note Due to an oversight, \ref QTMS_SetQtmStatus allows changing QTM state on N2DSXL. This is not intended
|
||||
* to be done, and is in fact never done by official software. If that is regardless the case,
|
||||
* this function here doesn't apply calibrations parameters (they may still be saved, however,
|
||||
* even though QTM calibration blocks are always normally 0 on N2DSXL).
|
||||
*/
|
||||
Result QTMS_SetCalibrationData(const QtmCalibrationData *cal, bool saveCalToCfg);
|
||||
|
||||
/**
|
||||
* @brief Gets the current QTM status (enabled/ss3d disabled/unavailable).
|
||||
*
|
||||
* @param[out] outQtmStatus Where to write the QTM status to.
|
||||
* @return Always 0.
|
||||
*/
|
||||
Result QTMS_GetQtmStatus(QtmStatus *outQtmStatus);
|
||||
|
||||
/**
|
||||
* @brief Gets the current QTM status (enabled/ss3d disabled/unavailable). Also sets or clear the
|
||||
* "blacklisted" flag returned by \ref QTMU_IsCurrentAppBlacklisted.
|
||||
*
|
||||
* @param qtmStatus QTM status to set. If equal to \ref QTM_STATUS_UNAVAILABLE, sets the "blacklisted" flag,
|
||||
* otherwise clears it.
|
||||
* @return `0xE0E18002` if enum value is invalid, otherwise 0 (success).
|
||||
* @note System settings uses this to disable super-stable 3D, and NS to "blacklist" (make QTM unavailable)
|
||||
* specific applications.
|
||||
*/
|
||||
Result QTMS_SetQtmStatus(QtmStatus qtmStatus);
|
||||
|
||||
/**
|
||||
* @brief Called by GSP's LCD driver to signal 2D<>3D mode change
|
||||
* @param newMode 0 for 2D, 1 for 800px 2D (unused for this function, same as 0), 2 for 3D
|
||||
* @return Always 0 (success).
|
||||
*/
|
||||
Result QTMSP_NotifyTopLcdModeChange(u8 newMode);
|
||||
|
||||
/**
|
||||
* @brief Called by GSP's LCD driver during top LCD power-on to signal to QTM that it may power on
|
||||
* and/or reconfigure then use the TI TCA6416A expander. In the process, QTM re-creates its
|
||||
* expander thread.
|
||||
* @return Always 0 (success).
|
||||
*/
|
||||
Result QTMSP_NotifyTopLcdPowerOn(void);
|
||||
|
||||
/**
|
||||
* @brief Called by GSP's LCD driver to know whether or not QTM's expander thread is using
|
||||
* the TI TCA6416A expander; it is waiting for this to become true/false during LCD
|
||||
* power on/power off to proceed. Always false on N2DSXL.
|
||||
* @param[out] outActive Where to write the "in use" status to.
|
||||
* @return Always 0 (success).
|
||||
*/
|
||||
Result QTMSP_IsExpanderInUse(bool *outActive);
|
||||
|
||||
/**
|
||||
* @brief Called by GSP's LCD driver during top LCD power-on to signal to QTM that it needs to
|
||||
* switch the parallax barrier state to a 2D state (all-transparent mask). Causes QTM's
|
||||
* expander thread to exit, relinquishing its `i2c::QTM` session with it.
|
||||
* @return Always 0 (success).
|
||||
*/
|
||||
Result QTMSP_NotifyTopLcdPowerOff(void);
|
||||
Result QTM_GetHeadTrackingInfo(u64 val, QTM_HeadTrackingInfo* out);
|
||||
|
@ -1,117 +0,0 @@
|
||||
/**
|
||||
* @file qtmc.h
|
||||
* @brief QTM Hardware Check service.
|
||||
*
|
||||
* Allows direct control over the parallax barrier's pattern and polarity phase through the
|
||||
* TI TCA6416A I2C->Parallel expander, as well as control over IR LED state even when camera
|
||||
* is used by user.
|
||||
*
|
||||
* TI TCA6416A I2C->Parallel expander is located on bus I2C1 (PA 0x10161000) device ID 0x40.
|
||||
*
|
||||
* The top screen parallax barrier was covered by patent US20030234980A1.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
/**
|
||||
* @brief Initializes `qtm:c`.
|
||||
* Only 3 sessions (2 until 9.3.0 sysupdate) for ALL services COMBINED, including the main
|
||||
* services, can be open at a time.
|
||||
*/
|
||||
Result qtmcInit(void);
|
||||
|
||||
/// Exits `qtm:c`.
|
||||
void qtmcExit(void);
|
||||
|
||||
/// Returns a pointer to the current `qtm:c` session handle.
|
||||
Handle *qtmcGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Starts the QTM Hardware Check API. This must be called before using any other `qtm:c` command,
|
||||
* and causes barrier pattern to be overriden by what was last set in \ref QTMC_SetBarrierPattern,
|
||||
* **even in 2D mode**. Also allows IR LED state to be overridden even if user uses the inner camera.
|
||||
* @return `0xD82183F9` if already started, otherwise 0 (success).
|
||||
*/
|
||||
Result QTMC_StartHardwareCheck(void);
|
||||
|
||||
/**
|
||||
* @brief Stops the QTM Hardware Check API. Restore normal barrier and IR LED management behavior.
|
||||
* @return `0xD82183F8` if API not started, otherwise 0 (success).
|
||||
*/
|
||||
Result QTMC_StopHardwareCheck(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the parallax barrier's mask pattern and polarity phase (12+1 bits).
|
||||
*
|
||||
* Bit11 to 0 correspond to a repeating barrier mask pattern, 0 meaning the corresponding mask unit is
|
||||
* transparent and 1 that it is opaque. The direction is: left->right corresponds to MSB->LSB.
|
||||
*
|
||||
* Bit12 is the polarity bit.
|
||||
*
|
||||
* QTM's expander management thread repeatedly writes (on every loop iteration) the current mask pattern
|
||||
* plus polarity bit, whether it is normally set or overridden by `qtm:c`, then on the following set,
|
||||
* negates both (it writes pattern ^ 0x1FFF). This is done at all times, even it 2D mode.
|
||||
*
|
||||
* The register being written to are regId 0x02 and 0x03 (output ports).
|
||||
* TI TCA6416A I2C->Parallel expander is located on bus I2C1 (PA 0x10161000) device ID 0x40.
|
||||
*
|
||||
* This function has no effect on N2DSXL.
|
||||
*
|
||||
* @param pattern Barrier mask pattern (bit12: polarity, bit11-0: 12-bit mask pattern)
|
||||
* @return `0xD82183F8` if API not started, otherwise 0 (success).
|
||||
* @see Patent US20030234980A1 for a description of parallax barriers.
|
||||
* @example The mask pattern used for super-stable 3D are as follows (position 0 to 11):
|
||||
*
|
||||
* 000011111100
|
||||
* 000001111110
|
||||
* 000000111111
|
||||
* 100000011111
|
||||
* 110000001111
|
||||
* 111000000111
|
||||
* 111100000011
|
||||
* 111110000001
|
||||
* 111111000000
|
||||
* 011111100000
|
||||
* 001111110000
|
||||
* 000111111000
|
||||
*
|
||||
* When SS3D is disabled (ie. it tries to match O3DS behavior), then pattern becomes:
|
||||
* 111100000111
|
||||
* Notice that the slit width is reduced from 6 to 5 units there.
|
||||
*
|
||||
* For 2D it is all-zero:
|
||||
* 000000000000
|
||||
*
|
||||
* 2D pattern is automatically set on QTM process init and exit.
|
||||
*/
|
||||
Result QTMC_SetBarrierPattern(u32 pattern);
|
||||
|
||||
/**
|
||||
* @brief Waits for the expander management thread to (re)initalize the TI TCA6416A I2C->Parallel expander,
|
||||
* then checks if that expander is behaving as expected (responds with the port direction config
|
||||
* it has been configured with): it checks whether all ports have been configured as outputs.
|
||||
*
|
||||
* On N2DSXL, this function waits forever and never returns.
|
||||
*
|
||||
* In detail, the hardware init procedure for the expander is as follows (as done by the expander mgmt. thread):
|
||||
* - configure enable expander pin on SoC: set GPIO3.bit11 to OUTPUT, then set to 1
|
||||
* - on the expander (I2C1 deviceId 0x40), set all ports to OUTPUT (regId 0x06, 0x07)
|
||||
* - on the expander, write 0 (all-transparent mask/2D) to the data registers (regId 0x02, 0x03)
|
||||
*
|
||||
* @param[out] outWorking Where to write the working status to. If true, expander is present working.
|
||||
* If false, the expander is present but is misbehaving. If the function does not
|
||||
* return, then expander is missing (e.g. on N2DSXL).
|
||||
* @return `0xD82183F8` if API not started, otherwise 0 (success).
|
||||
*/
|
||||
Result QTMC_WaitAndCheckExpanderWorking(bool *outWorking);
|
||||
|
||||
/**
|
||||
* @brief Temporarily overrides IR LED state. Requires "manual control" from `qtm:u` to be disabled, and has
|
||||
* lower priority than it. Same implementation as \ref QTMS_SetIrLedStatusOverride.
|
||||
*
|
||||
* @param on Whether to turn the IR LED on or off.
|
||||
* @return `0xD82183F8` if API not started, `0xC8A18005` if manual control was enabled or if the operation failed,
|
||||
* or `0xC8A18009` if QTM is unavailable (in particular, QTM is always unavailable on N2DSXL). Otherwise, 0 (success).
|
||||
*/
|
||||
Result QTMC_SetIrLedStatusOverride(bool on);
|
@ -5,96 +5,6 @@
|
||||
* After initializing this service you will be able to use system calls from netdb.h, sys/socket.h etc.
|
||||
*/
|
||||
#pragma once
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/// The config level to be used with @ref SOCU_GetNetworkOpt
|
||||
#define SOL_CONFIG 0xfffe
|
||||
|
||||
/// Options to be used with @ref SOCU_GetNetworkOpt
|
||||
typedef enum
|
||||
{
|
||||
NETOPT_MAC_ADDRESS = 0x1004, ///< The mac address of the interface (u32 mac[6])
|
||||
NETOPT_ARP_TABLE = 0x3002, ///< The ARP table @see SOCU_ARPTableEntry
|
||||
NETOPT_IP_INFO = 0x4003, ///< The current IP setup @see SOCU_IPInfo
|
||||
NETOPT_IP_MTU = 0x4004, ///< The value of the IP MTU (u32)
|
||||
NETOPT_ROUTING_TABLE = 0x4006, ///< The routing table @see SOCU_RoutingTableEntry
|
||||
NETOPT_UDP_NUMBER = 0x8002, ///< The number of sockets in the UDP table (u32)
|
||||
NETOPT_UDP_TABLE = 0x8003, ///< The table of opened UDP sockets @see SOCU_UDPTableEntry
|
||||
NETOPT_TCP_NUMBER = 0x9002, ///< The number of sockets in the TCP table (u32)
|
||||
NETOPT_TCP_TABLE = 0x9003, ///< The table of opened TCP sockets @see SOCU_TCPTableEntry
|
||||
NETOPT_DNS_TABLE = 0xB003, ///< The table of the DNS servers @see SOCU_DNSTableEntry -- Returns a buffer of size 336 but only 2 entries are set ?
|
||||
NETOPT_DHCP_LEASE_TIME = 0xC001, ///< The DHCP lease time remaining, in seconds
|
||||
} NetworkOpt;
|
||||
|
||||
/// One entry of the ARP table retrieved by using @ref SOCU_GetNetworkOpt and @ref NETOPT_ARP_TABLE
|
||||
typedef struct
|
||||
{
|
||||
u32 unk0; // often 2 ? state ?
|
||||
struct in_addr ip; ///< The IPv4 address associated to the entry
|
||||
u8 mac[6]; ///< The MAC address of associated to the entry
|
||||
u8 padding[2];
|
||||
} SOCU_ARPTableEntry;
|
||||
|
||||
/// Structure returned by @ref SOCU_GetNetworkOpt when using @ref NETOPT_IP_INFO
|
||||
typedef struct
|
||||
{
|
||||
struct in_addr ip; ///< Current IPv4 address
|
||||
struct in_addr netmask; ///< Current network mask
|
||||
struct in_addr broadcast; ///< Current network broadcast address
|
||||
} SOCU_IPInfo;
|
||||
|
||||
// Linux netstat flags
|
||||
// NOTE : there are probably other flags supported, if you can forge ICMP requests please check for D and M flags
|
||||
|
||||
/** The route uses a gateway */
|
||||
#define ROUTING_FLAG_G 0x01
|
||||
|
||||
/// One entry of the routing table retrieved by using @ref SOCU_GetNetworkOpt and @ref NETOPT_ROUTING_TABLE
|
||||
typedef struct
|
||||
{
|
||||
struct in_addr dest_ip; ///< Destination IP address of the route
|
||||
struct in_addr netmask; ///< Mask used for this route
|
||||
struct in_addr gateway; ///< Gateway address to reach the network
|
||||
u32 flags; ///< Linux netstat flags @see ROUTING_FLAG_G
|
||||
u64 time; ///< number of milliseconds since 1st Jan 1900 00:00.
|
||||
} SOCU_RoutingTableEntry;
|
||||
|
||||
/// One entry of the UDP sockets table retrieved by using @ref SOCU_GetNetworkOpt and @ref NETOPT_UDP_TABLE
|
||||
typedef struct
|
||||
{
|
||||
struct sockaddr_storage local; ///< Local address information
|
||||
struct sockaddr_storage remote; ///< Remote address information
|
||||
} SOCU_UDPTableEntry;
|
||||
|
||||
///@name TCP states
|
||||
///@{
|
||||
#define TCP_STATE_CLOSED 1
|
||||
#define TCP_STATE_LISTEN 2
|
||||
#define TCP_STATE_ESTABLISHED 5
|
||||
#define TCP_STATE_FINWAIT1 6
|
||||
#define TCP_STATE_FINWAIT2 7
|
||||
#define TCP_STATE_CLOSE_WAIT 8
|
||||
#define TCP_STATE_LAST_ACK 9
|
||||
#define TCP_STATE_TIME_WAIT 11
|
||||
///@}
|
||||
|
||||
/// One entry of the TCP sockets table retrieved by using @ref SOCU_GetNetworkOpt and @ref NETOPT_TCP_TABLE
|
||||
typedef struct
|
||||
{
|
||||
u32 state; ///< @see TCP states defines
|
||||
struct sockaddr_storage local; ///< Local address information
|
||||
struct sockaddr_storage remote; ///< Remote address information
|
||||
} SOCU_TCPTableEntry;
|
||||
|
||||
/// One entry of the DNS servers table retrieved by using @ref SOCU_GetNetworkOpt and @ref NETOPT_DNS_TABLE
|
||||
typedef struct
|
||||
{
|
||||
u32 family; /// Family of the address of the DNS server
|
||||
struct in_addr ip; /// IP of the DNS server
|
||||
u8 padding[12]; // matches the length required for IPv6 addresses
|
||||
} SOCU_DNSTableEntry;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initializes the SOC service.
|
||||
@ -110,39 +20,10 @@ Result socInit(u32 *context_addr, u32 context_size);
|
||||
*/
|
||||
Result socExit(void);
|
||||
|
||||
// this is supposed to be in unistd.h but newlib only puts it for cygwin, waiting for newlib patch from dkA
|
||||
// this is supposed to be in unistd.h but newlib only puts it for cygwin
|
||||
/**
|
||||
* @brief Gets the system's host ID.
|
||||
* @return The system's host ID.
|
||||
*/
|
||||
long gethostid(void);
|
||||
|
||||
// this is supposed to be in unistd.h but newlib only puts it for cygwin, waiting for newlib patch from dkA
|
||||
int gethostname(char *name, size_t namelen);
|
||||
|
||||
int SOCU_ShutdownSockets(void);
|
||||
|
||||
int SOCU_CloseSockets(void);
|
||||
|
||||
/**
|
||||
* @brief Retrieves information from the network configuration. Similar to getsockopt().
|
||||
* @param level Only value allowed seems to be @ref SOL_CONFIG
|
||||
* @param optname The option to be retrieved
|
||||
* @param optval Will contain the output of the command
|
||||
* @param optlen Size of the optval buffer, will be updated to hold the size of the output
|
||||
* @return 0 if successful. -1 if failed, and errno will be set accordingly. Can also return a system error code.
|
||||
*/
|
||||
int SOCU_GetNetworkOpt(int level, NetworkOpt optname, void * optval, socklen_t * optlen);
|
||||
|
||||
/**
|
||||
* @brief Gets the system's IP address, netmask, and subnet broadcast
|
||||
* @return error
|
||||
*/
|
||||
int SOCU_GetIPInfo(struct in_addr *ip, struct in_addr *netmask, struct in_addr *broadcast);
|
||||
|
||||
/**
|
||||
* @brief Adds a global socket.
|
||||
* @param sockfd The socket fd.
|
||||
* @return error
|
||||
*/
|
||||
int SOCU_AddGlobalSocket(int sockfd);
|
||||
|
@ -4,18 +4,12 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// Initializes srv:pm and the service API.
|
||||
/// Initializes srv:pm.
|
||||
Result srvPmInit(void);
|
||||
|
||||
/// Exits srv:pm and the service API.
|
||||
/// Exits srv:pm.
|
||||
void srvPmExit(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current srv:pm session handle.
|
||||
* @return The current srv:pm session handle.
|
||||
*/
|
||||
Handle *srvPmGetSessionHandle(void);
|
||||
|
||||
/**
|
||||
* @brief Publishes a notification to a process.
|
||||
* @param notificationId ID of the notification.
|
||||
@ -31,15 +25,15 @@ Result SRVPM_PublishToAll(u32 notificationId);
|
||||
|
||||
/**
|
||||
* @brief Registers a process with SRV.
|
||||
* @param pid ID of the process.
|
||||
* @param procid ID of the process.
|
||||
* @param count Number of services within the service access control data.
|
||||
* @param serviceAccessControlList Service Access Control list.
|
||||
* @param serviceaccesscontrol Service Access Control list.
|
||||
*/
|
||||
Result SRVPM_RegisterProcess(u32 pid, u32 count, const char (*serviceAccessControlList)[8]);
|
||||
Result SRVPM_RegisterProcess(u32 procid, u32 count, void* serviceaccesscontrol);
|
||||
|
||||
/**
|
||||
* @brief Unregisters a process with SRV.
|
||||
* @param pid ID of the process.
|
||||
* @param procid ID of the process.
|
||||
*/
|
||||
Result SRVPM_UnregisterProcess(u32 pid);
|
||||
Result SRVPM_UnregisterProcess(u32 procid);
|
||||
|
||||
|
@ -1,251 +0,0 @@
|
||||
/**
|
||||
* @file sslc.h
|
||||
* @brief SSLC(TLS) service. https://3dbrew.org/wiki/SSL_Services
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// sslc context.
|
||||
typedef struct {
|
||||
Handle servhandle; ///< Service handle.
|
||||
u32 sslchandle; ///< SSLC handle.
|
||||
Handle sharedmem_handle;
|
||||
} sslcContext;
|
||||
|
||||
typedef enum {
|
||||
SSLC_DefaultRootCert_Nintendo_CA = 0x1, //"Nintendo CA"
|
||||
SSLC_DefaultRootCert_Nintendo_CA_G2 = 0x2, //"Nintendo CA - G2"
|
||||
SSLC_DefaultRootCert_Nintendo_CA_G3 = 0x3, //"Nintendo CA - G3"
|
||||
SSLC_DefaultRootCert_Nintendo_Class2_CA = 0x4, //"Nintendo Class 2 CA"
|
||||
SSLC_DefaultRootCert_Nintendo_Class2_CA_G2 = 0x5, //"Nintendo Class 2 CA - G2"
|
||||
SSLC_DefaultRootCert_Nintendo_Class2_CA_G3 = 0x6, //"Nintendo Class 2 CA - G3"
|
||||
SSLC_DefaultRootCert_CyberTrust = 0x7, //"GTE CyberTrust Global Root"
|
||||
SSLC_DefaultRootCert_AddTrust_External_CA = 0x8, //"AddTrust External CA Root"
|
||||
SSLC_DefaultRootCert_COMODO = 0x9, //"COMODO RSA Certification Authority"
|
||||
SSLC_DefaultRootCert_USERTrust = 0xA, //"USERTrust RSA Certification Authority"
|
||||
SSLC_DefaultRootCert_DigiCert_EV = 0xB //"DigiCert High Assurance EV Root CA"
|
||||
} SSLC_DefaultRootCert;
|
||||
|
||||
typedef enum {
|
||||
SSLC_DefaultClientCert_ClCertA = 0x40
|
||||
} SSLC_DefaultClientCert;
|
||||
|
||||
/// sslc options. https://www.3dbrew.org/wiki/SSL_Services#SSLOpt
|
||||
enum {
|
||||
SSLCOPT_Default = 0,
|
||||
SSLCOPT_DisableVerify = BIT(9), // "Disables server cert verification when set."
|
||||
SSLCOPT_TLSv10 = BIT(11) // "Use TLSv1.0."
|
||||
};
|
||||
|
||||
/// Initializes SSLC. Normally session_handle should be 0. When non-zero this will use the specified handle for the main-service-session without using the Initialize command, instead of using srvGetServiceHandle.
|
||||
Result sslcInit(Handle session_handle);
|
||||
|
||||
/// Exits SSLC.
|
||||
void sslcExit(void);
|
||||
|
||||
/**
|
||||
* @brief Creates a RootCertChain.
|
||||
* @param RootCertChain_contexthandle Output contexthandle.
|
||||
*/
|
||||
Result sslcCreateRootCertChain(u32 *RootCertChain_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Destroys a RootCertChain.
|
||||
* @param RootCertChain_contexthandle RootCertChain contexthandle.
|
||||
*/
|
||||
Result sslcDestroyRootCertChain(u32 RootCertChain_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Adds a trusted RootCA cert to a RootCertChain.
|
||||
* @param RootCertChain_contexthandle RootCertChain to use.
|
||||
* @param cert Pointer to the DER cert.
|
||||
* @param certsize Size of the DER cert.
|
||||
*/
|
||||
Result sslcAddTrustedRootCA(u32 RootCertChain_contexthandle, const u8 *cert, u32 certsize, u32 *cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Adds a default RootCA cert to a RootCertChain.
|
||||
* @param RootCertChain_contexthandle RootCertChain to use.
|
||||
* @param certID ID of the cert to add.
|
||||
* @param cert_contexthandle Optional, the cert contexthandle can be written here.
|
||||
*/
|
||||
Result sslcRootCertChainAddDefaultCert(u32 RootCertChain_contexthandle, SSLC_DefaultRootCert certID, u32 *cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Removes the specified cert from the RootCertChain.
|
||||
* @param RootCertChain_contexthandle RootCertChain to use.
|
||||
* @param cert_contexthandle Cert contexthandle to remove from the RootCertChain.
|
||||
*/
|
||||
Result sslcRootCertChainRemoveCert(u32 RootCertChain_contexthandle, u32 cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Creates an unknown CertChain.
|
||||
* @param CertChain_contexthandle Output contexthandle.
|
||||
*/
|
||||
Result sslcCreate8CertChain(u32 *CertChain_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Destroys a CertChain from sslcCreate8CertChain().
|
||||
* @param CertChain_contexthandle CertChain contexthandle.
|
||||
*/
|
||||
Result sslcDestroy8CertChain(u32 CertChain_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Adds a cert to a CertChain from sslcCreate8CertChain().
|
||||
* @param CertChain_contexthandle CertChain to use.
|
||||
* @param cert Pointer to the cert.
|
||||
* @param certsize Size of the cert.
|
||||
*/
|
||||
Result sslc8CertChainAddCert(u32 CertChain_contexthandle, const u8 *cert, u32 certsize, u32 *cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Adds a default cert to a CertChain from sslcCreate8CertChain(). Not actually usable since no certIDs are implemented in SSL-module for this.
|
||||
* @param CertChain_contexthandle CertChain to use.
|
||||
* @param certID ID of the cert to add.
|
||||
* @param cert_contexthandle Optional, the cert contexthandle can be written here.
|
||||
*/
|
||||
Result sslc8CertChainAddDefaultCert(u32 CertChain_contexthandle, u8 certID, u32 *cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Removes the specified cert from the CertChain from sslcCreate8CertChain().
|
||||
* @param CertChain_contexthandle CertChain to use.
|
||||
* @param cert_contexthandle Cert contexthandle to remove from the CertChain.
|
||||
*/
|
||||
Result sslc8CertChainRemoveCert(u32 CertChain_contexthandle, u32 cert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Opens a new ClientCert-context.
|
||||
* @param cert Pointer to the DER cert.
|
||||
* @param certsize Size of the DER cert.
|
||||
* @param key Pointer to the DER key.
|
||||
* @param keysize Size of the DER key.
|
||||
* @param ClientCert_contexthandle Output contexthandle.
|
||||
*/
|
||||
Result sslcOpenClientCertContext(const u8 *cert, u32 certsize, const u8 *key, u32 keysize, u32 *ClientCert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Opens a ClientCert-context with a default certID.
|
||||
* @param certID ID of the ClientCert to use.
|
||||
* @param ClientCert_contexthandle Output contexthandle.
|
||||
*/
|
||||
Result sslcOpenDefaultClientCertContext(SSLC_DefaultClientCert certID, u32 *ClientCert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief Closes the specified ClientCert-context.
|
||||
* @param ClientCert_contexthandle ClientCert-context to use.
|
||||
*/
|
||||
Result sslcCloseClientCertContext(u32 ClientCert_contexthandle);
|
||||
|
||||
/**
|
||||
* @brief This uses ps:ps SeedRNG internally.
|
||||
*/
|
||||
Result sslcSeedRNG(void);
|
||||
|
||||
/**
|
||||
* @brief This uses ps:ps GenerateRandomData internally.
|
||||
* @param buf Output buffer.
|
||||
* @param size Output size.
|
||||
*/
|
||||
Result sslcGenerateRandomData(u8 *buf, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Creates a sslc context.
|
||||
* @param context sslc context.
|
||||
* @param sockfd Socket fd, this code automatically uses the required SOC command before using the actual sslc command.
|
||||
* @param input_opt Input sslc options bitmask.
|
||||
* @param hostname Server hostname.
|
||||
*/
|
||||
Result sslcCreateContext(sslcContext *context, int sockfd, u32 input_opt, const char *hostname);
|
||||
|
||||
/*
|
||||
* @brief Destroys a sslc context. The associated sockfd must be closed manually.
|
||||
* @param context sslc context.
|
||||
*/
|
||||
Result sslcDestroyContext(sslcContext *context);
|
||||
|
||||
/*
|
||||
* @brief Starts the TLS connection. If successful, this will not return until the connection is ready for data-transfer via sslcRead/sslcWrite.
|
||||
* @param context sslc context.
|
||||
* @param internal_retval Optional ptr where the internal_retval will be written. The value is only copied to here by this function when no error occurred.
|
||||
* @param out Optional ptr where an output u32 will be written. The value is only copied to here by this function when no error occurred.
|
||||
*/
|
||||
Result sslcStartConnection(sslcContext *context, int *internal_retval, u32 *out);
|
||||
|
||||
/*
|
||||
* @brief Receive data over the network connection.
|
||||
* @param context sslc context.
|
||||
* @param buf Output buffer.
|
||||
* @param len Size to receive.
|
||||
* @param peek When true, this is equivalent to setting the recv() MSG_PEEK flag.
|
||||
* @return When this isn't an error-code, this is the total transferred data size.
|
||||
*/
|
||||
Result sslcRead(sslcContext *context, void *buf, size_t len, bool peek);
|
||||
|
||||
/*
|
||||
* @brief Send data over the network connection.
|
||||
* @param context sslc context.
|
||||
* @param buf Input buffer.
|
||||
* @param len Size to send.
|
||||
* @return When this isn't an error-code, this is the total transferred data size.
|
||||
*/
|
||||
Result sslcWrite(sslcContext *context, const void *buf, size_t len);
|
||||
|
||||
/*
|
||||
* @brief Set the RootCertChain for the specified sslc context.
|
||||
* @param context sslc context.
|
||||
* @param handle RootCertChain contexthandle.
|
||||
*/
|
||||
Result sslcContextSetRootCertChain(sslcContext *context, u32 handle);
|
||||
|
||||
/*
|
||||
* @brief Set the ClientCert-context for the specified sslc context.
|
||||
* @param context sslc context.
|
||||
* @param handle ClientCert contexthandle.
|
||||
*/
|
||||
Result sslcContextSetClientCert(sslcContext *context, u32 handle);
|
||||
|
||||
/*
|
||||
* @brief Set the context for a CertChain from sslcCreate8CertChain(), for the specified sslc context. This needs updated once it's known what this context is for.
|
||||
* @param context sslc context.
|
||||
* @param handle contexthandle.
|
||||
*/
|
||||
Result sslcContextSetHandle8(sslcContext *context, u32 handle);
|
||||
|
||||
/*
|
||||
* @brief Clears the options field bits for the context using the specified bitmask.
|
||||
* @param context sslc context.
|
||||
* @param bitmask opt bitmask.
|
||||
*/
|
||||
Result sslcContextClearOpt(sslcContext *context, u32 bitmask);
|
||||
|
||||
/*
|
||||
* @brief This copies two strings from context state to the specified output buffers. Each string is only copied if it was successfully loaded. The maxsizes include the nul-terminator. This can only be used if sslcStartConnection() was already used successfully.
|
||||
* @param context sslc context.
|
||||
* @param outprotocols Output buffer for a string containing all protocol versions supported by SSL-module.
|
||||
* @param outprotocols_maxsize Max size of the above output buffer.
|
||||
* @param outcipher Output buffer for a string containing the cipher suite currently being used.
|
||||
* @param outcipher_maxsize Max size of the above output buffer.
|
||||
*/
|
||||
Result sslcContextGetProtocolCipher(sslcContext *context, char *outprotocols, u32 outprotocols_maxsize, char *outcipher, u32 outcipher_maxsize);
|
||||
|
||||
/*
|
||||
* @brief This loads an u32 from the specified context state. This needs updated once it's known what this field is for.
|
||||
* @param context sslc context.
|
||||
* @param out Output ptr to write the value to.
|
||||
*/
|
||||
Result sslcContextGetState(sslcContext *context, u32 *out);
|
||||
|
||||
/*
|
||||
* @brief This initializes sharedmem for the specified context.
|
||||
* @param context sslc context.
|
||||
* @param buf Sharedmem buffer with address aligned to 0x1000-bytes.
|
||||
* @param size Sharedmem size aligned to 0x1000-bytes.
|
||||
*/
|
||||
Result sslcContextInitSharedmem(sslcContext *context, u8 *buf, u32 size);
|
||||
|
||||
/*
|
||||
* @brief This loads the specified cert. This needs updated once it's known what the cert format is and what the cert is used for later.
|
||||
* @param buf Input cert.
|
||||
* @param size Cert size.
|
||||
*/
|
||||
Result sslcAddCert(sslcContext *context, const u8 *buf, u32 size);
|
||||
|
@ -1,368 +0,0 @@
|
||||
/**
|
||||
* @file uds.h
|
||||
* @brief UDS(NWMUDS) local-WLAN service. https://3dbrew.org/wiki/NWM_Services
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// Maximum number of nodes(devices) that can be connected to the network.
|
||||
#define UDS_MAXNODES 16
|
||||
|
||||
/// Broadcast value for NetworkNodeID / alias for all NetworkNodeIDs.
|
||||
#define UDS_BROADCAST_NETWORKNODEID 0xFFFF
|
||||
|
||||
/// NetworkNodeID for the host(the first node).
|
||||
#define UDS_HOST_NETWORKNODEID 0x1
|
||||
|
||||
/// Default recv_buffer_size that can be used for udsBind() input / code which uses udsBind() internally.
|
||||
#define UDS_DEFAULT_RECVBUFSIZE 0x2E30
|
||||
|
||||
/// Max size of user data-frames.
|
||||
#define UDS_DATAFRAME_MAXSIZE 0x5C6
|
||||
|
||||
/// Check whether a fatal udsSendTo error occured(some error(s) from udsSendTo() can be ignored, but the frame won't be sent when that happens).
|
||||
#define UDS_CHECK_SENDTO_FATALERROR(x) (R_FAILED(x) && x!=0xC86113F0)
|
||||
|
||||
/// Node info struct.
|
||||
typedef struct {
|
||||
u64 uds_friendcodeseed;//UDS version of the FriendCodeSeed.
|
||||
|
||||
union {
|
||||
u8 usercfg[0x18];//This is the first 0x18-bytes from this config block: https://www.3dbrew.org/wiki/Config_Savegame#0x000A0000_Block
|
||||
|
||||
struct {
|
||||
u16 username[10];
|
||||
|
||||
u16 unk_x1c;//Unknown, normally zero. Set to 0x0 with the output from udsScanBeacons().
|
||||
u8 flag;//"u8 flag, unknown. Originates from the u16 bitmask in the beacon node-list header. This flag is normally 0 since that bitmask is normally 0?"
|
||||
u8 pad_x1f;//Unknown, normally zero.
|
||||
};
|
||||
};
|
||||
|
||||
//The rest of this is initialized by NWM-module.
|
||||
u16 NetworkNodeID;
|
||||
u16 pad_x22;//Unknown, normally zero?
|
||||
u32 word_x24;//Normally zero?
|
||||
} udsNodeInfo;
|
||||
|
||||
/// Connection status struct.
|
||||
typedef struct {
|
||||
u32 status;
|
||||
u32 unk_x4;
|
||||
u16 cur_NetworkNodeID;//"u16 NetworkNodeID for this device."
|
||||
u16 unk_xa;
|
||||
u32 unk_xc[0x20>>2];
|
||||
|
||||
u8 total_nodes;
|
||||
u8 max_nodes;
|
||||
u16 node_bitmask;//"This is a bitmask of NetworkNodeIDs: bit0 for NetworkNodeID 0x1(host), bit1 for NetworkNodeID 0x2(first original client), and so on."
|
||||
} udsConnectionStatus;
|
||||
|
||||
/// Network struct stored as big-endian.
|
||||
typedef struct {
|
||||
u8 host_macaddress[6];
|
||||
u8 channel;//Wifi channel for this network. If you want to create a network on a specific channel instead of the system selecting it, you can set this to a non-zero channel value.
|
||||
u8 pad_x7;
|
||||
|
||||
u8 initialized_flag;//Must be non-zero otherwise NWM-module will use zeros internally instead of the actual field data, for most/all(?) of the fields in this struct.
|
||||
|
||||
u8 unk_x9[3];
|
||||
|
||||
u8 oui_value[3];//"This is the OUI value for use with the beacon tags. Normally this is 001F32."
|
||||
u8 oui_type;//"OUI type (21/0x15)"
|
||||
|
||||
u32 wlancommID;//Unique local-WLAN communications ID for each application.
|
||||
u8 id8;//Additional ID that can be used by the application for different types of networks.
|
||||
u8 unk_x15;
|
||||
|
||||
u16 attributes;//See the UDSNETATTR enum values below.
|
||||
|
||||
u32 networkID;
|
||||
|
||||
u8 total_nodes;
|
||||
u8 max_nodes;
|
||||
u8 unk_x1e;
|
||||
u8 unk_x1f;
|
||||
u8 unk_x20[0x1f];
|
||||
|
||||
u8 appdata_size;
|
||||
u8 appdata[0xc8];
|
||||
} udsNetworkStruct;
|
||||
|
||||
typedef struct {
|
||||
u32 BindNodeID;
|
||||
Handle event;
|
||||
bool spectator;
|
||||
} udsBindContext;
|
||||
|
||||
/// General NWM input structure used for AP scanning.
|
||||
typedef struct {
|
||||
u16 unk_x0;
|
||||
u16 unk_x2;
|
||||
u16 unk_x4;
|
||||
u16 unk_x6;
|
||||
|
||||
u8 mac_address[6];
|
||||
|
||||
u8 unk_xe[0x26];//Not initialized by dlp.
|
||||
} nwmScanInputStruct;
|
||||
|
||||
/// General NWM output structure from AP scanning.
|
||||
typedef struct {
|
||||
u32 maxsize;//"Max output size, from the command request."
|
||||
u32 size;//"Total amount of output data written relative to struct+0. 0xC when there's no entries."
|
||||
u32 total_entries;//"Total entries, 0 for none. "
|
||||
|
||||
//The entries start here.
|
||||
} nwmBeaconDataReplyHeader;
|
||||
|
||||
/// General NWM output structure from AP scanning, for each entry.
|
||||
typedef struct {
|
||||
u32 size;//"Size of this entire entry. The next entry starts at curentry_startoffset+curentry_size."
|
||||
u8 unk_x4;
|
||||
u8 channel;//Wifi channel for the AP.
|
||||
u8 unk_x6;
|
||||
u8 unk_x7;
|
||||
u8 mac_address[6];//"AP MAC address."
|
||||
u8 unk_xe[6];
|
||||
u32 unk_x14;
|
||||
u32 val_x1c;//"Value 0x1C(size of this header and/or offset to the actual beacon data)."
|
||||
|
||||
//The actual beacon data starts here.
|
||||
} nwmBeaconDataReplyEntry;
|
||||
|
||||
/// Output structure generated from host scanning output.
|
||||
typedef struct {
|
||||
nwmBeaconDataReplyEntry datareply_entry;
|
||||
udsNetworkStruct network;
|
||||
udsNodeInfo nodes[UDS_MAXNODES];
|
||||
} udsNetworkScanInfo;
|
||||
|
||||
enum {
|
||||
UDSNETATTR_DisableConnectSpectators = BIT(0), //When set new Spectators are not allowed to connect.
|
||||
UDSNETATTR_DisableConnectClients = BIT(1), //When set new Clients are not allowed to connect.
|
||||
UDSNETATTR_x4 = BIT(2), //Unknown what this bit is for.
|
||||
UDSNETATTR_Default = BIT(15), //Unknown what this bit is for.
|
||||
};
|
||||
|
||||
enum {
|
||||
UDS_SENDFLAG_Default = BIT(0), //Unknown what this bit is for.
|
||||
UDS_SENDFLAG_Broadcast = BIT(1) //When set, broadcast the data frame via the destination MAC address even when UDS_BROADCAST_NETWORKNODEID isn't used.
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
UDSCONTYPE_Client = 0x1,
|
||||
UDSCONTYPE_Spectator = 0x2
|
||||
} udsConnectionType;
|
||||
|
||||
/**
|
||||
* @brief Initializes UDS.
|
||||
* @param sharedmem_size This must be 0x1000-byte aligned.
|
||||
* @param username Optional custom UTF-8 username(converted to UTF-16 internally) that other nodes on the UDS network can use. If not set the username from system-config is used. Max len is 10 characters without NUL-terminator.
|
||||
*/
|
||||
Result udsInit(size_t sharedmem_size, const char *username);
|
||||
|
||||
/// Exits UDS.
|
||||
void udsExit(void);
|
||||
|
||||
/**
|
||||
* @brief Generates a NodeInfo struct with data loaded from system-config.
|
||||
* @param nodeinfo Output NodeInfo struct.
|
||||
* @param username If set, this is the UTF-8 string to convert for use in the struct. Max len is 10 characters without NUL-terminator.
|
||||
*/
|
||||
Result udsGenerateNodeInfo(udsNodeInfo *nodeinfo, const char *username);
|
||||
|
||||
/**
|
||||
* @brief Loads the UTF-16 username stored in the input NodeInfo struct, converted to UTF-8.
|
||||
* @param nodeinfo Input NodeInfo struct.
|
||||
* @param username This is the output UTF-8 string. Max len is 10 characters without NUL-terminator.
|
||||
*/
|
||||
Result udsGetNodeInfoUsername(const udsNodeInfo *nodeinfo, char *username);
|
||||
|
||||
/**
|
||||
* @brief Checks whether a NodeInfo struct was initialized by NWM-module(not any output from udsGenerateNodeInfo()).
|
||||
* @param nodeinfo Input NodeInfo struct.
|
||||
*/
|
||||
bool udsCheckNodeInfoInitialized(const udsNodeInfo *nodeinfo);
|
||||
|
||||
/**
|
||||
* @brief Generates a default NetworkStruct for creating networks.
|
||||
* @param network The output struct.
|
||||
* @param wlancommID Unique local-WLAN communications ID for each application.
|
||||
* @param id8 Additional ID that can be used by the application for different types of networks.
|
||||
* @param max_nodes Maximum number of nodes(devices) that can be connected to the network, including the host.
|
||||
*/
|
||||
void udsGenerateDefaultNetworkStruct(udsNetworkStruct *network, u32 wlancommID, u8 id8, u8 max_nodes);
|
||||
|
||||
/**
|
||||
* @brief Scans for networks via beacon-scanning.
|
||||
* @param outbuf Buffer which will be used by the beacon-scanning command and for the data parsing afterwards. Normally there's no need to use the contents of this buffer once this function returns.
|
||||
* @param maxsize Max size of the buffer.
|
||||
* @Param networks Ptr where the allocated udsNetworkScanInfo array buffer is written. The allocsize is sizeof(udsNetworkScanInfo)*total_networks.
|
||||
* @Param total_networks Total number of networks stored under the networks buffer.
|
||||
* @param wlancommID Unique local-WLAN communications ID for each application.
|
||||
* @param id8 Additional ID that can be used by the application for different types of networks.
|
||||
* @param host_macaddress When set, this code will only return network info from the specified host MAC address.
|
||||
* @connected When not connected to a network this *must* be false. When connected to a network this *must* be true.
|
||||
*/
|
||||
Result udsScanBeacons(void *outbuf, size_t maxsize, udsNetworkScanInfo **networks, size_t *total_networks, u32 wlancommID, u8 id8, const u8 *host_macaddress, bool connected);
|
||||
|
||||
/**
|
||||
* @brief This can be used by the host to set the appdata contained in the broadcasted beacons.
|
||||
* @param buf Appdata buffer.
|
||||
* @param size Size of the input appdata.
|
||||
*/
|
||||
Result udsSetApplicationData(const void *buf, size_t size);
|
||||
|
||||
/**
|
||||
* @brief This can be used while on a network(host/client) to get the appdata from the current beacon.
|
||||
* @param buf Appdata buffer.
|
||||
* @param size Max size of the output buffer.
|
||||
* @param actual_size If set, the actual size of the appdata written into the buffer is stored here.
|
||||
*/
|
||||
Result udsGetApplicationData(void *buf, size_t size, size_t *actual_size);
|
||||
|
||||
/**
|
||||
* @brief This can be used with a NetworkStruct, from udsScanBeacons() mainly, for getting the appdata.
|
||||
* @param buf Appdata buffer.
|
||||
* @param size Max size of the output buffer.
|
||||
* @param actual_size If set, the actual size of the appdata written into the buffer is stored here.
|
||||
*/
|
||||
Result udsGetNetworkStructApplicationData(const udsNetworkStruct *network, void *buf, size_t size, size_t *actual_size);
|
||||
|
||||
/**
|
||||
* @brief Create a bind.
|
||||
* @param bindcontext The output bind context.
|
||||
* @param NetworkNodeID This is the NetworkNodeID which this bind can receive data from.
|
||||
* @param spectator False for a regular bind, true for a spectator.
|
||||
* @param data_channel This is an arbitrary value to use for data-frame filtering. This bind will only receive data frames which contain a matching data_channel value, which was specified by udsSendTo(). The data_channel must be non-zero.
|
||||
* @param recv_buffer_size Size of the buffer under sharedmem used for temporarily storing received data-frames which are then loaded by udsPullPacket(). The system requires this to be >=0x5F4. UDS_DEFAULT_RECVBUFSIZE can be used for this.
|
||||
*/
|
||||
Result udsBind(udsBindContext *bindcontext, u16 NetworkNodeID, bool spectator, u8 data_channel, u32 recv_buffer_size);
|
||||
|
||||
/**
|
||||
* @brief Remove a bind.
|
||||
* @param bindcontext The bind context.
|
||||
*/
|
||||
Result udsUnbind(udsBindContext *bindcontext);
|
||||
|
||||
/**
|
||||
* @brief Waits for the bind event to occur, or checks if the event was signaled. This event is signaled every time new data is available via udsPullPacket().
|
||||
* @return Always true. However if wait=false, this will return false if the event wasn't signaled.
|
||||
* @param bindcontext The bind context.
|
||||
* @param nextEvent Whether to discard the current event and wait for the next event.
|
||||
* @param wait When true this will not return until the event is signaled. When false this checks if the event was signaled without waiting for it.
|
||||
*/
|
||||
bool udsWaitDataAvailable(const udsBindContext *bindcontext, bool nextEvent, bool wait);
|
||||
|
||||
/**
|
||||
* @brief Receives data over the network. This data is loaded from the recv_buffer setup by udsBind(). When a node disconnects, this will still return data from that node until there's no more frames from that node in the recv_buffer.
|
||||
* @param bindcontext Bind context.
|
||||
* @param buf Output receive buffer.
|
||||
* @param size Size of the buffer.
|
||||
* @param actual_size If set, the actual size written into the output buffer is stored here. This is zero when no data was received.
|
||||
* @param src_NetworkNodeID If set, the source NetworkNodeID is written here. This is zero when no data was received.
|
||||
*/
|
||||
Result udsPullPacket(const udsBindContext *bindcontext, void *buf, size_t size, size_t *actual_size, u16 *src_NetworkNodeID);
|
||||
|
||||
/**
|
||||
* @brief Sends data over the network.
|
||||
* @param dst_NetworkNodeID Destination NetworkNodeID.
|
||||
* @param data_channel See udsBind().
|
||||
* @param flags Send flags, see the UDS_SENDFLAG enum values.
|
||||
* @param buf Input send buffer.
|
||||
* @param size Size of the buffer.
|
||||
*/
|
||||
Result udsSendTo(u16 dst_NetworkNodeID, u8 data_channel, u8 flags, const void *buf, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Gets the wifi channel currently being used.
|
||||
* @param channel Output channel.
|
||||
*/
|
||||
Result udsGetChannel(u8 *channel);
|
||||
|
||||
/**
|
||||
* @brief Starts hosting a new network.
|
||||
* @param network The NetworkStruct, you can use udsGenerateDefaultNetworkStruct() for generating this.
|
||||
* @param passphrase Raw input passphrase buffer.
|
||||
* @param passphrase_size Size of the passphrase buffer.
|
||||
* @param context Optional output bind context which will be created for this host, with NetworkNodeID=UDS_BROADCAST_NETWORKNODEID.
|
||||
* @param data_channel This is the data_channel value which will be passed to udsBind() internally.
|
||||
* @param recv_buffer_size This is the recv_buffer_size value which will be passed to udsBind() internally.
|
||||
*/
|
||||
Result udsCreateNetwork(const udsNetworkStruct *network, const void *passphrase, size_t passphrase_size, udsBindContext *context, u8 data_channel, u32 recv_buffer_size);
|
||||
|
||||
/**
|
||||
* @brief Connect to a network.
|
||||
* @param network The NetworkStruct, you can use udsScanBeacons() for this.
|
||||
* @param passphrase Raw input passphrase buffer.
|
||||
* @param passphrase_size Size of the passphrase buffer.
|
||||
* @param context Optional output bind context which will be created for this host.
|
||||
* @param recv_NetworkNodeID This is the NetworkNodeID passed to udsBind() internally.
|
||||
* @param connection_type Type of connection, see the udsConnectionType enum values.
|
||||
* @param data_channel This is the data_channel value which will be passed to udsBind() internally.
|
||||
* @param recv_buffer_size This is the recv_buffer_size value which will be passed to udsBind() internally.
|
||||
*/
|
||||
Result udsConnectNetwork(const udsNetworkStruct *network, const void *passphrase, size_t passphrase_size, udsBindContext *context, u16 recv_NetworkNodeID, udsConnectionType connection_type, u8 data_channel, u32 recv_buffer_size);
|
||||
|
||||
/**
|
||||
* @brief Stop hosting the network.
|
||||
*/
|
||||
Result udsDestroyNetwork(void);
|
||||
|
||||
/**
|
||||
* @brief Disconnect this client device from the network.
|
||||
*/
|
||||
Result udsDisconnectNetwork(void);
|
||||
|
||||
/**
|
||||
* @brief This can be used by the host to force-disconnect client(s).
|
||||
* @param NetworkNodeID Target NetworkNodeID. UDS_BROADCAST_NETWORKNODEID can be used to disconnect all clients.
|
||||
*/
|
||||
Result udsEjectClient(u16 NetworkNodeID);
|
||||
|
||||
/**
|
||||
* @brief This can be used by the host to force-disconnect the spectators. Afterwards new spectators will not be allowed to connect until udsAllowSpectators() is used.
|
||||
*/
|
||||
Result udsEjectSpectator(void);
|
||||
|
||||
/**
|
||||
* @brief This can be used by the host to update the network attributes. If bitmask 0x4 is clear in the input bitmask, this clears that bit in the value before actually writing the value into state. Normally you should use the below wrapper functions.
|
||||
* @param bitmask Bitmask to clear/set in the attributes. See the UDSNETATTR enum values.
|
||||
* @param flag When false, bit-clear, otherwise bit-set.
|
||||
*/
|
||||
Result udsUpdateNetworkAttribute(u16 bitmask, bool flag);
|
||||
|
||||
/**
|
||||
* @brief This uses udsUpdateNetworkAttribute() for (un)blocking new connections to this host.
|
||||
* @param block When true, block the specified connection types(bitmask set). Otherwise allow them(bitmask clear).
|
||||
* @param clients When true, (un)block regular clients.
|
||||
* @param flag When true, update UDSNETATTR_x4. Normally this should be false.
|
||||
*/
|
||||
Result udsSetNewConnectionsBlocked(bool block, bool clients, bool flag);
|
||||
|
||||
/**
|
||||
* @brief This uses udsUpdateNetworkAttribute() for unblocking new spectator connections to this host. See udsEjectSpectator() for blocking new spectators.
|
||||
*/
|
||||
Result udsAllowSpectators(void);
|
||||
|
||||
/**
|
||||
* @brief This loads the current ConnectionStatus struct.
|
||||
* @param output Output ConnectionStatus struct.
|
||||
*/
|
||||
Result udsGetConnectionStatus(udsConnectionStatus *output);
|
||||
|
||||
/**
|
||||
* @brief Waits for the ConnectionStatus event to occur, or checks if the event was signaled. This event is signaled when the data from udsGetConnectionStatus() was updated internally.
|
||||
* @return Always true. However if wait=false, this will return false if the event wasn't signaled.
|
||||
* @param nextEvent Whether to discard the current event and wait for the next event.
|
||||
* @param wait When true this will not return until the event is signaled. When false this checks if the event was signaled without waiting for it.
|
||||
*/
|
||||
bool udsWaitConnectionStatusEvent(bool nextEvent, bool wait);
|
||||
|
||||
/**
|
||||
* @brief This loads a NodeInfo struct for the specified NetworkNodeID. The broadcast alias can't be used with this.
|
||||
* @param NetworkNodeID Target NetworkNodeID.
|
||||
* @param output Output NodeInfo struct.
|
||||
*/
|
||||
Result udsGetNodeInformation(u16 NetworkNodeID, udsNodeInfo *output);
|
||||
|
@ -29,7 +29,7 @@ typedef enum
|
||||
OUTPUT_RGB_32 = 0x0, ///< 32-bit RGBA8888. The alpha component is the 8-bit value set by @ref Y2RU_SetAlpha
|
||||
OUTPUT_RGB_24 = 0x1, ///< 24-bit RGB888.
|
||||
OUTPUT_RGB_16_555 = 0x2, ///< 16-bit RGBA5551. The alpha bit is the 7th bit of the alpha value set by @ref Y2RU_SetAlpha
|
||||
OUTPUT_RGB_16_565 = 0x3, ///< 16-bit RGB565.
|
||||
OUTPUT_RGB_16_565 = 0x3, ///< 16-bit RGB565.
|
||||
} Y2RU_OutputFormat;
|
||||
|
||||
/// Rotation to be applied to the output.
|
||||
|
@ -10,14 +10,6 @@ Result srvInit(void);
|
||||
/// Exits the service API.
|
||||
void srvExit(void);
|
||||
|
||||
/**
|
||||
* @brief Makes srvGetServiceHandle non-blocking for the current thread (or blocking, the default), in case of unavailable (full) requested services.
|
||||
* @param blocking Whether srvGetServiceHandle should be non-blocking.
|
||||
* srvGetServiceHandle will always block if the service hasn't been registered yet,
|
||||
* use srvIsServiceRegistered to check whether that is the case or not.
|
||||
*/
|
||||
void srvSetBlockingPolicy(bool nonBlocking);
|
||||
|
||||
/**
|
||||
* @brief Gets the current service API session handle.
|
||||
* @return The current service API session handle.
|
||||
@ -28,9 +20,6 @@ Handle *srvGetSessionHandle(void);
|
||||
* @brief Retrieves a service handle, retrieving from the environment handle list if possible.
|
||||
* @param out Pointer to write the handle to.
|
||||
* @param name Name of the service.
|
||||
* @return 0 if no error occured,
|
||||
* 0xD8E06406 if the caller has no right to access the service,
|
||||
* 0xD0401834 if the requested service port is full and srvGetServiceHandle is non-blocking (see @ref srvSetBlockingPolicy).
|
||||
*/
|
||||
Result srvGetServiceHandle(Handle* out, const char* name);
|
||||
|
||||
@ -61,9 +50,6 @@ Result srvUnregisterService(const char* name);
|
||||
* @brief Retrieves a service handle.
|
||||
* @param out Pointer to output the handle to.
|
||||
* @param name Name of the service.
|
||||
* * @return 0 if no error occured,
|
||||
* 0xD8E06406 if the caller has no right to access the service,
|
||||
* 0xD0401834 if the requested service port is full and srvGetServiceHandle is non-blocking (see @ref srvSetBlockingPolicy).
|
||||
*/
|
||||
Result srvGetServiceHandleDirect(Handle* out, const char* name);
|
||||
|
||||
@ -87,12 +73,6 @@ Result srvUnregisterPort(const char* name);
|
||||
*/
|
||||
Result srvGetPort(Handle* out, const char* name);
|
||||
|
||||
/**
|
||||
* @brief Waits for a port to be registered.
|
||||
* @param name Name of the port to wait for registration.
|
||||
*/
|
||||
Result srvWaitForPortRegistered(const char* name);
|
||||
|
||||
/**
|
||||
* @brief Subscribes to a notification.
|
||||
* @param notificationId ID of the notification.
|
||||
@ -114,7 +94,7 @@ Result srvReceiveNotification(u32* notificationIdOut);
|
||||
/**
|
||||
* @brief Publishes a notification to subscribers.
|
||||
* @param notificationId ID of the notification.
|
||||
* @param flags Flags to publish with. (bit 0 = only fire if not fired, bit 1 = do not report an error if there are more than 16 pending notifications)
|
||||
* @param flags Flags to publish with. (bit 0 = only fire if not fired, bit 1 = report errors)
|
||||
*/
|
||||
Result srvPublishToSubscriber(u32 notificationId, u32 flags);
|
||||
|
||||
@ -132,10 +112,3 @@ Result srvPublishAndGetSubscriber(u32* processIdCountOut, u32* processIdsOut, u3
|
||||
* @param name Name of the service to check.
|
||||
*/
|
||||
Result srvIsServiceRegistered(bool* registeredOut, const char* name);
|
||||
|
||||
/**
|
||||
* @brief Checks whether a port is registered.
|
||||
* @param registeredOut Pointer to output the registration status to.
|
||||
* @param name Name of the port to check.
|
||||
*/
|
||||
Result srvIsPortRegistered(bool* registeredOut, const char* name);
|
||||
|
File diff suppressed because it is too large
Load Diff
240
libctru/include/3ds/synchronization.h
Executable file → Normal file
240
libctru/include/3ds/synchronization.h
Executable file → Normal file
@ -4,7 +4,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
#include <sys/lock.h>
|
||||
#include <3ds/svc.h>
|
||||
|
||||
/// A light lock.
|
||||
typedef _LOCK_T LightLock;
|
||||
@ -12,42 +11,12 @@ typedef _LOCK_T LightLock;
|
||||
/// A recursive lock.
|
||||
typedef _LOCK_RECURSIVE_T RecursiveLock;
|
||||
|
||||
/// A condition variable.
|
||||
typedef s32 CondVar;
|
||||
|
||||
/// A light event.
|
||||
typedef struct
|
||||
{
|
||||
s32 state; ///< State of the event: -2=cleared sticky, -1=cleared oneshot, 0=signaled oneshot, 1=signaled sticky
|
||||
LightLock lock; ///< Lock used for sticky timer operation
|
||||
} LightEvent;
|
||||
|
||||
/// A light semaphore.
|
||||
typedef struct
|
||||
{
|
||||
s32 current_count; ///< The current release count of the semaphore
|
||||
s16 num_threads_acq; ///< Number of threads concurrently acquiring the semaphore
|
||||
s16 max_count; ///< The maximum release count of the semaphore
|
||||
} LightSemaphore;
|
||||
|
||||
/// Performs a Data Synchronization Barrier operation.
|
||||
static inline void __dsb(void)
|
||||
{
|
||||
__asm__ __volatile__("mcr p15, 0, %[val], c7, c10, 4" :: [val] "r" (0) : "memory");
|
||||
}
|
||||
|
||||
/// Performs a Data Memory Barrier operation.
|
||||
static inline void __dmb(void)
|
||||
{
|
||||
__asm__ __volatile__("mcr p15, 0, %[val], c7, c10, 5" :: [val] "r" (0) : "memory");
|
||||
}
|
||||
|
||||
/// Performs an Instruction Synchronization Barrier (officially "flush prefetch buffer") operation.
|
||||
static inline void __isb(void)
|
||||
{
|
||||
__asm__ __volatile__("mcr p15, 0, %[val], c7, c5, 4" :: [val] "r" (0) : "memory");
|
||||
}
|
||||
|
||||
/// Performs a clrex operation.
|
||||
static inline void __clrex(void)
|
||||
{
|
||||
@ -79,56 +48,6 @@ static inline bool __strex(s32* addr, s32 val)
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs a ldrexh operation.
|
||||
* @param addr Address to perform the operation on.
|
||||
* @return The resulting value.
|
||||
*/
|
||||
static inline u16 __ldrexh(u16* addr)
|
||||
{
|
||||
u16 val;
|
||||
__asm__ __volatile__("ldrexh %[val], %[addr]" : [val] "=r" (val) : [addr] "Q" (*addr));
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs a strexh operation.
|
||||
* @param addr Address to perform the operation on.
|
||||
* @param val Value to store.
|
||||
* @return Whether the operation was successful.
|
||||
*/
|
||||
static inline bool __strexh(u16* addr, u16 val)
|
||||
{
|
||||
bool res;
|
||||
__asm__ __volatile__("strexh %[res], %[val], %[addr]" : [res] "=&r" (res) : [val] "r" (val), [addr] "Q" (*addr));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs a ldrexb operation.
|
||||
* @param addr Address to perform the operation on.
|
||||
* @return The resulting value.
|
||||
*/
|
||||
static inline u8 __ldrexb(u8* addr)
|
||||
{
|
||||
u8 val;
|
||||
__asm__ __volatile__("ldrexb %[val], %[addr]" : [val] "=r" (val) : [addr] "Q" (*addr));
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs a strexb operation.
|
||||
* @param addr Address to perform the operation on.
|
||||
* @param val Value to store.
|
||||
* @return Whether the operation was successful.
|
||||
*/
|
||||
static inline bool __strexb(u8* addr, u8 val)
|
||||
{
|
||||
bool res;
|
||||
__asm__ __volatile__("strexb %[res], %[val], %[addr]" : [res] "=&r" (res) : [val] "r" (val), [addr] "Q" (*addr));
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Performs an atomic pre-increment operation.
|
||||
#define AtomicIncrement(ptr) __atomic_add_fetch((u32*)(ptr), 1, __ATOMIC_SEQ_CST)
|
||||
/// Performs an atomic pre-decrement operation.
|
||||
@ -141,40 +60,10 @@ static inline bool __strexb(u8* addr, u8 val)
|
||||
#define AtomicSwap(ptr, value) __atomic_exchange_n((u32*)(ptr), (value), __ATOMIC_SEQ_CST)
|
||||
|
||||
/**
|
||||
* @brief Function used to implement user-mode synchronization primitives.
|
||||
* @param addr Pointer to a signed 32-bit value whose address will be used to identify waiting threads.
|
||||
* @param type Type of action to be performed by the arbiter
|
||||
* @param value Number of threads to signal if using @ref ARBITRATION_SIGNAL, or the value used for comparison.
|
||||
*
|
||||
* This will perform an arbitration based on #type. The comparisons are done between #value and the value at the address #addr.
|
||||
*
|
||||
* @code
|
||||
* s32 val=0;
|
||||
* // Does *nothing* since val >= 0
|
||||
* syncArbitrateAddress(&val,ARBITRATION_WAIT_IF_LESS_THAN,0);
|
||||
* @endcode
|
||||
*
|
||||
* @note Usage of this function entails an implicit Data Memory Barrier (dmb).
|
||||
* @brief Retrieves the synchronization subsystem's address arbiter handle.
|
||||
* @return The synchronization subsystem's address arbiter handle.
|
||||
*/
|
||||
Result syncArbitrateAddress(s32* addr, ArbitrationType type, s32 value);
|
||||
|
||||
/**
|
||||
* @brief Function used to implement user-mode synchronization primitives (with timeout).
|
||||
* @param addr Pointer to a signed 32-bit value whose address will be used to identify waiting threads.
|
||||
* @param type Type of action to be performed by the arbiter (must use \ref ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT or \ref ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN_TIMEOUT)
|
||||
* @param value Number of threads to signal if using @ref ARBITRATION_SIGNAL, or the value used for comparison.
|
||||
*
|
||||
* This will perform an arbitration based on #type. The comparisons are done between #value and the value at the address #addr.
|
||||
*
|
||||
* @code
|
||||
* s32 val=0;
|
||||
* // Thread will wait for a signal or wake up after 10000000 nanoseconds because val < 1.
|
||||
* syncArbitrateAddressWithTimeout(&val,ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT,1,10000000LL);
|
||||
* @endcode
|
||||
*
|
||||
* @note Usage of this function entails an implicit Data Memory Barrier (dmb).
|
||||
*/
|
||||
Result syncArbitrateAddressWithTimeout(s32* addr, ArbitrationType type, s32 value, s64 timeout_ns);
|
||||
Handle __sync_get_arbiter(void);
|
||||
|
||||
/**
|
||||
* @brief Initializes a light lock.
|
||||
@ -225,126 +114,3 @@ int RecursiveLock_TryLock(RecursiveLock* lock);
|
||||
* @param lock Pointer to the lock.
|
||||
*/
|
||||
void RecursiveLock_Unlock(RecursiveLock* lock);
|
||||
|
||||
/**
|
||||
* @brief Initializes a condition variable.
|
||||
* @param cv Pointer to the condition variable.
|
||||
*/
|
||||
void CondVar_Init(CondVar* cv);
|
||||
|
||||
/**
|
||||
* @brief Waits on a condition variable.
|
||||
* @param cv Pointer to the condition variable.
|
||||
* @param lock Pointer to the lock to atomically unlock/relock during the wait.
|
||||
*/
|
||||
void CondVar_Wait(CondVar* cv, LightLock* lock);
|
||||
|
||||
/**
|
||||
* @brief Waits on a condition variable with a timeout.
|
||||
* @param cv Pointer to the condition variable.
|
||||
* @param lock Pointer to the lock to atomically unlock/relock during the wait.
|
||||
* @param timeout_ns Timeout in nanoseconds.
|
||||
* @return Zero on success, non-zero on failure.
|
||||
*/
|
||||
int CondVar_WaitTimeout(CondVar* cv, LightLock* lock, s64 timeout_ns);
|
||||
|
||||
/**
|
||||
* @brief Wakes up threads waiting on a condition variable.
|
||||
* @param cv Pointer to the condition variable.
|
||||
* @param num_threads Maximum number of threads to wake up (or \ref ARBITRATION_SIGNAL_ALL to wake them all).
|
||||
*/
|
||||
void CondVar_WakeUp(CondVar* cv, s32 num_threads);
|
||||
|
||||
/**
|
||||
* @brief Wakes up a single thread waiting on a condition variable.
|
||||
* @param cv Pointer to the condition variable.
|
||||
*/
|
||||
static inline void CondVar_Signal(CondVar* cv)
|
||||
{
|
||||
CondVar_WakeUp(cv, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wakes up all threads waiting on a condition variable.
|
||||
* @param cv Pointer to the condition variable.
|
||||
*/
|
||||
static inline void CondVar_Broadcast(CondVar* cv)
|
||||
{
|
||||
CondVar_WakeUp(cv, ARBITRATION_SIGNAL_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes a light event.
|
||||
* @param event Pointer to the event.
|
||||
* @param reset_type Type of reset the event uses (RESET_ONESHOT/RESET_STICKY).
|
||||
*/
|
||||
void LightEvent_Init(LightEvent* event, ResetType reset_type);
|
||||
|
||||
/**
|
||||
* @brief Clears a light event.
|
||||
* @param event Pointer to the event.
|
||||
*/
|
||||
void LightEvent_Clear(LightEvent* event);
|
||||
|
||||
/**
|
||||
* @brief Wakes up threads waiting on a sticky light event without signaling it. If the event had been signaled before, it is cleared instead.
|
||||
* @param event Pointer to the event.
|
||||
*/
|
||||
void LightEvent_Pulse(LightEvent* event);
|
||||
|
||||
/**
|
||||
* @brief Signals a light event, waking up threads waiting on it.
|
||||
* @param event Pointer to the event.
|
||||
*/
|
||||
void LightEvent_Signal(LightEvent* event);
|
||||
|
||||
/**
|
||||
* @brief Attempts to wait on a light event.
|
||||
* @param event Pointer to the event.
|
||||
* @return Non-zero if the event was signaled, zero otherwise.
|
||||
*/
|
||||
int LightEvent_TryWait(LightEvent* event);
|
||||
|
||||
/**
|
||||
* @brief Waits on a light event.
|
||||
* @param event Pointer to the event.
|
||||
*/
|
||||
void LightEvent_Wait(LightEvent* event);
|
||||
|
||||
/**
|
||||
* @brief Waits on a light event until either the event is signaled or the timeout is reached.
|
||||
* @param event Pointer to the event.
|
||||
* @param timeout_ns Timeout in nanoseconds.
|
||||
* @return Non-zero on timeout, zero otherwise.
|
||||
*/
|
||||
int LightEvent_WaitTimeout(LightEvent* event, s64 timeout_ns);
|
||||
|
||||
/**
|
||||
* @brief Initializes a light semaphore.
|
||||
* @param event Pointer to the semaphore.
|
||||
* @param max_count Initial count of the semaphore.
|
||||
* @param max_count Maximum count of the semaphore.
|
||||
*/
|
||||
void LightSemaphore_Init(LightSemaphore* semaphore, s16 initial_count, s16 max_count);
|
||||
|
||||
/**
|
||||
* @brief Acquires a light semaphore.
|
||||
* @param semaphore Pointer to the semaphore.
|
||||
* @param count Acquire count
|
||||
*/
|
||||
void LightSemaphore_Acquire(LightSemaphore* semaphore, s32 count);
|
||||
|
||||
/**
|
||||
* @brief Attempts to acquire a light semaphore.
|
||||
* @param semaphore Pointer to the semaphore.
|
||||
* @param count Acquire count
|
||||
* @return Zero on success, non-zero on failure
|
||||
*/
|
||||
int LightSemaphore_TryAcquire(LightSemaphore* semaphore, s32 count);
|
||||
|
||||
/**
|
||||
* @brief Releases a light semaphore.
|
||||
* @param semaphore Pointer to the semaphore.
|
||||
* @param count Release count
|
||||
*/
|
||||
void LightSemaphore_Release(LightSemaphore* semaphore, s32 count);
|
||||
|
@ -7,23 +7,10 @@
|
||||
#include <3ds/result.h>
|
||||
#include <3ds/synchronization.h>
|
||||
#include <3ds/svc.h>
|
||||
#include <3ds/errf.h>
|
||||
|
||||
/// Makes the exception handler reuse the stack of the faulting thread as-is
|
||||
#define RUN_HANDLER_ON_FAULTING_STACK ((void*)1)
|
||||
|
||||
/// Makes the exception handler push the exception data on its stack
|
||||
#define WRITE_DATA_TO_HANDLER_STACK NULL
|
||||
|
||||
/// Makes the exception handler push the exception data on the stack of the faulting thread
|
||||
#define WRITE_DATA_TO_FAULTING_STACK ((ERRF_ExceptionData*)1)
|
||||
|
||||
/// libctru thread handle type
|
||||
typedef struct Thread_tag* Thread;
|
||||
|
||||
/// Exception handler type, necessarily an ARM function that does not return.
|
||||
typedef void (*ExceptionHandler)(ERRF_ExceptionInfo* excep, CpuRegisters* regs);
|
||||
|
||||
/**
|
||||
* @brief Creates a new libctru thread.
|
||||
* @param entrypoint The function that will be called first upon thread creation
|
||||
@ -33,9 +20,9 @@ typedef void (*ExceptionHandler)(ERRF_ExceptionInfo* excep, CpuRegisters* regs);
|
||||
* For userland apps, this has to be within the range [0x18;0x3F].
|
||||
* The main thread usually has a priority of 0x30, but not always. Use svcGetThreadPriority() if you need
|
||||
* to create a thread with a priority that is explicitly greater or smaller than that of the main thread.
|
||||
* @param core_id The ID of the processor the thread should be ran on. Processor IDs are labeled starting from 0.
|
||||
* On Old3DS it must be <2, and on New3DS it must be <4.
|
||||
* Pass -1 to execute the thread on all CPUs and -2 to execute the thread on the default CPU (read from the Exheader).
|
||||
* @param affinity The ID of the processor the thread should be ran on. Processor IDs are labeled starting from 0.
|
||||
* On Old3DS it must be <2, and on New3DS it must be <4.
|
||||
* Pass -1 to execute the thread on all CPUs and -2 to execute the thread on the default CPU (read from the Exheader).
|
||||
* @param detached When set to true, the thread is automatically freed when it finishes.
|
||||
* @return The libctru thread handle on success, NULL on failure.
|
||||
*
|
||||
@ -44,11 +31,8 @@ typedef void (*ExceptionHandler)(ERRF_ExceptionInfo* excep, CpuRegisters* regs);
|
||||
* - Processor #2 is New3DS exclusive. Normal applications can create threads on this core if the exheader kernel flags bitmask has 0x2000 set.
|
||||
* - Processor #3 is New3DS exclusive. Normal applications cannot create threads on this core.
|
||||
* - Processes in the BASE memory region can always create threads on processors #2 and #3.
|
||||
*
|
||||
* @note Default exit code of a thread is 0.
|
||||
* @warning @ref svcExitThread should never be called from the thread, use @ref threadExit instead.
|
||||
*/
|
||||
Thread threadCreate(ThreadFunc entrypoint, void* arg, size_t stack_size, int prio, int core_id, bool detached);
|
||||
Thread threadCreate(ThreadFunc entrypoint, void* arg, size_t stack_size, int prio, int affinity, bool detached);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the OS thread handle of a libctru thread.
|
||||
@ -67,7 +51,6 @@ int threadGetExitCode(Thread thread);
|
||||
/**
|
||||
* @brief Frees a finished libctru thread.
|
||||
* @param thread libctru thread handle
|
||||
* @remarks This function should not be called if the thread is detached, as it is freed automatically when it finishes.
|
||||
*/
|
||||
void threadFree(Thread thread);
|
||||
|
||||
@ -78,12 +61,6 @@ void threadFree(Thread thread);
|
||||
*/
|
||||
Result threadJoin(Thread thread, u64 timeout_ns);
|
||||
|
||||
/**
|
||||
* @brief Changes a thread's status from attached to detached.
|
||||
* @param thread libctru thread handle
|
||||
*/
|
||||
void threadDetach(Thread thread);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the libctru thread handle of the current thread.
|
||||
* @return libctru thread handle of the current thread, or NULL for the main thread
|
||||
@ -95,29 +72,3 @@ Thread threadGetCurrent(void);
|
||||
* @param rc Exit code
|
||||
*/
|
||||
void threadExit(int rc) __attribute__((noreturn));
|
||||
|
||||
/**
|
||||
* @brief Sets the exception handler for the current thread. Called from the main thread, this sets the default handler.
|
||||
* @param handler The exception handler, necessarily an ARM function that does not return
|
||||
* @param stack_top A pointer to the top of the stack that will be used by the handler. See also @ref RUN_HANDLER_ON_FAULTING_STACK
|
||||
* @param exception_data A pointer to the buffer that will contain the exception data.
|
||||
See also @ref WRITE_DATA_TO_HANDLER_STACK and @ref WRITE_DATA_TO_FAULTING_STACK
|
||||
*
|
||||
* To have CPU exceptions reported through this mechanism, it is normally necessary that UNITINFO is set to a non-zero value when Kernel11 starts,
|
||||
* and this mechanism is also controlled by @ref svcKernelSetState type 6, see 3dbrew.
|
||||
*
|
||||
* VFP exceptions are always reported this way even if the process is being debugged using the debug SVCs.
|
||||
*
|
||||
* The current thread need not be a libctru thread.
|
||||
*/
|
||||
static inline void threadOnException(ExceptionHandler handler, void* stack_top, ERRF_ExceptionData* exception_data)
|
||||
{
|
||||
u8* tls = (u8*)getThreadLocalStorage();
|
||||
|
||||
*(u32*)(tls + 0x40) = (u32)handler;
|
||||
*(u32*)(tls + 0x44) = (u32)stack_top;
|
||||
*(u32*)(tls + 0x48) = (u32)exception_data;
|
||||
|
||||
__dsb();
|
||||
__isb();
|
||||
}
|
||||
|
@ -41,39 +41,19 @@ typedef volatile s64 vs64; ///< 64-bit volatile signed integer.
|
||||
typedef u32 Handle; ///< Resource handle.
|
||||
typedef s32 Result; ///< Function result.
|
||||
typedef void (*ThreadFunc)(void *); ///< Thread entrypoint function.
|
||||
typedef void (*voidfn)(void);
|
||||
|
||||
/// Creates a bitmask from a bit number.
|
||||
#define BIT(n) (1U<<(n))
|
||||
|
||||
/// Aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m.
|
||||
#define CTR_ALIGN(m) __attribute__((aligned(m)))
|
||||
#define ALIGN(m) __attribute__((aligned(m)))
|
||||
/// Packs a struct (and other types?) so it won't include padding bytes.
|
||||
#define CTR_PACKED __attribute__((packed))
|
||||
#define PACKED __attribute__((packed))
|
||||
|
||||
#ifndef CTR_NO_DEPRECATION
|
||||
#ifndef LIBCTRU_NO_DEPRECATION
|
||||
/// Flags a function as deprecated.
|
||||
#define CTR_DEPRECATED __attribute__ ((deprecated))
|
||||
#define DEPRECATED __attribute__ ((deprecated))
|
||||
#else
|
||||
/// Flags a function as deprecated.
|
||||
#define CTR_DEPRECATED
|
||||
#define DEPRECATED
|
||||
#endif
|
||||
|
||||
/// Structure representing CPU registers
|
||||
typedef struct {
|
||||
u32 r[13]; ///< r0-r12.
|
||||
u32 sp; ///< sp.
|
||||
u32 lr; ///< lr.
|
||||
u32 pc; ///< pc. May need to be adjusted.
|
||||
u32 cpsr; ///< cpsr.
|
||||
} CpuRegisters;
|
||||
|
||||
/// Structure representing FPU registers
|
||||
typedef struct {
|
||||
union {
|
||||
struct CTR_PACKED { double d[16]; }; ///< d0-d15.
|
||||
float s[32]; ///< s0-s31.
|
||||
};
|
||||
u32 fpscr; ///< fpscr.
|
||||
u32 fpexc; ///< fpexc.
|
||||
} FpuRegisters;
|
||||
|
@ -1,238 +0,0 @@
|
||||
/**
|
||||
* @file decompress.h
|
||||
* @brief Decompression functions.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/** @brief Compression types */
|
||||
typedef enum
|
||||
{
|
||||
DECOMPRESS_DUMMY = 0x00, ///< Dummy compression
|
||||
DECOMPRESS_LZSS = 0x10, ///< LZSS/LZ10 compression
|
||||
DECOMPRESS_LZ10 = 0x10, ///< LZSS/LZ10 compression
|
||||
DECOMPRESS_LZ11 = 0x11, ///< LZ11 compression
|
||||
DECOMPRESS_HUFF1 = 0x21, ///< Huffman compression with 1-bit data
|
||||
DECOMPRESS_HUFF2 = 0x22, ///< Huffman compression with 2-bit data
|
||||
DECOMPRESS_HUFF3 = 0x23, ///< Huffman compression with 3-bit data
|
||||
DECOMPRESS_HUFF4 = 0x24, ///< Huffman compression with 4-bit data
|
||||
DECOMPRESS_HUFF5 = 0x25, ///< Huffman compression with 5-bit data
|
||||
DECOMPRESS_HUFF6 = 0x26, ///< Huffman compression with 6-bit data
|
||||
DECOMPRESS_HUFF7 = 0x27, ///< Huffman compression with 7-bit data
|
||||
DECOMPRESS_HUFF8 = 0x28, ///< Huffman compression with 8-bit data
|
||||
DECOMPRESS_HUFF = 0x28, ///< Huffman compression with 8-bit data
|
||||
DECOMPRESS_RLE = 0x30, ///< Run-length encoding compression
|
||||
} decompressType;
|
||||
|
||||
/** @brief I/O vector */
|
||||
typedef struct
|
||||
{
|
||||
void *data; ///< I/O buffer
|
||||
size_t size; ///< Buffer size
|
||||
} decompressIOVec;
|
||||
|
||||
/** @brief Data callback */
|
||||
typedef ssize_t (*decompressCallback)(void *userdata, void *buffer,
|
||||
size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/** @brief Decompression callback for file descriptors
|
||||
* @param[in] userdata Address of file descriptor
|
||||
* @param[in] buffer Buffer to write into
|
||||
* @param[in] size Size to read from file descriptor
|
||||
* @returns Number of bytes read
|
||||
*/
|
||||
ssize_t decompressCallback_FD(void *userdata, void *buffer, size_t size);
|
||||
|
||||
/** @brief Decompression callback for stdio FILE*
|
||||
* @param[in] userdata FILE*
|
||||
* @param[in] buffer Buffer to write into
|
||||
* @param[in] size Size to read from file descriptor
|
||||
* @returns Number of bytes read
|
||||
*/
|
||||
ssize_t decompressCallback_Stdio(void *userdata, void *buffer, size_t size);
|
||||
|
||||
/** @brief Decode decompression header
|
||||
* @param[out] type Decompression type
|
||||
* @param[out] size Decompressed size
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Bytes consumed
|
||||
* @retval -1 error
|
||||
*/
|
||||
ssize_t decompressHeader(decompressType *type, size_t *size,
|
||||
decompressCallback callback, void *userdata,
|
||||
size_t insize);
|
||||
|
||||
/** @brief Decompress data
|
||||
* @param[in] iov Output vector
|
||||
* @param[in] iovcnt Number of buffers
|
||||
* @param[in] callback Data callback (see note)
|
||||
* @param[in] userdata User data passed to callback (see note)
|
||||
* @param[in] insize Size of userdata (see note)
|
||||
* @returns Whether succeeded
|
||||
*
|
||||
* @note If callback is null, userdata is a pointer to memory to read from,
|
||||
* and insize is the size of that data. If callback is not null,
|
||||
* userdata is passed to callback to fetch more data, and insize is
|
||||
* unused.
|
||||
*/
|
||||
bool decompressV(const decompressIOVec *iov, size_t iovcnt,
|
||||
decompressCallback callback, void *userdata, size_t insize);
|
||||
|
||||
/** @brief Decompress data
|
||||
* @param[in] output Output buffer
|
||||
* @param[in] size Output size limit
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
static inline bool
|
||||
decompress(void *output, size_t size, decompressCallback callback,
|
||||
void *userdata, size_t insize)
|
||||
{
|
||||
decompressIOVec iov;
|
||||
iov.data = output;
|
||||
iov.size = size;
|
||||
|
||||
return decompressV(&iov, 1, callback, userdata, insize);
|
||||
}
|
||||
|
||||
/** @brief Decompress LZSS/LZ10
|
||||
* @param[in] iov Output vector
|
||||
* @param[in] iovcnt Number of buffers
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
bool decompressV_LZSS(const decompressIOVec *iov, size_t iovcnt,
|
||||
decompressCallback callback, void *userdata,
|
||||
size_t insize);
|
||||
|
||||
/** @brief Decompress LZSS/LZ10
|
||||
* @param[in] output Output buffer
|
||||
* @param[in] size Output size limit
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
static inline bool
|
||||
decompress_LZSS(void *output, size_t size, decompressCallback callback,
|
||||
void *userdata, size_t insize)
|
||||
{
|
||||
decompressIOVec iov;
|
||||
iov.data = output;
|
||||
iov.size = size;
|
||||
|
||||
return decompressV_LZSS(&iov, 1, callback, userdata, insize);
|
||||
}
|
||||
|
||||
/** @brief Decompress LZ11
|
||||
* @param[in] iov Output vector
|
||||
* @param[in] iovcnt Number of buffers
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
bool decompressV_LZ11(const decompressIOVec *iov, size_t iovcnt,
|
||||
decompressCallback callback, void *userdata,
|
||||
size_t insize);
|
||||
|
||||
/** @brief Decompress LZ11
|
||||
* @param[in] output Output buffer
|
||||
* @param[in] size Output size limit
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
static inline bool
|
||||
decompress_LZ11(void *output, size_t size, decompressCallback callback,
|
||||
void *userdata, size_t insize)
|
||||
{
|
||||
decompressIOVec iov;
|
||||
iov.data = output;
|
||||
iov.size = size;
|
||||
|
||||
return decompressV_LZ11(&iov, 1, callback, userdata, insize);
|
||||
}
|
||||
|
||||
/** @brief Decompress Huffman
|
||||
* @param[in] bits Data size in bits (usually 4 or 8)
|
||||
* @param[in] iov Output vector
|
||||
* @param[in] iovcnt Number of buffers
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
bool decompressV_Huff(size_t bits, const decompressIOVec *iov, size_t iovcnt,
|
||||
decompressCallback callback, void *userdata,
|
||||
size_t insize);
|
||||
|
||||
/** @brief Decompress Huffman
|
||||
* @param[in] bits Data size in bits (usually 4 or 8)
|
||||
* @param[in] output Output buffer
|
||||
* @param[in] size Output size limit
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
static inline bool
|
||||
decompress_Huff(size_t bits, void *output, size_t size,
|
||||
decompressCallback callback, void *userdata, size_t insize)
|
||||
{
|
||||
decompressIOVec iov;
|
||||
iov.data = output;
|
||||
iov.size = size;
|
||||
|
||||
return decompressV_Huff(bits, &iov, 1, callback, userdata, insize);
|
||||
}
|
||||
|
||||
/** @brief Decompress run-length encoding
|
||||
* @param[in] iov Output vector
|
||||
* @param[in] iovcnt Number of buffers
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
bool decompressV_RLE(const decompressIOVec *iov, size_t iovcnt,
|
||||
decompressCallback callback, void *userdata,
|
||||
size_t insize);
|
||||
|
||||
/** @brief Decompress run-length encoding
|
||||
* @param[in] output Output buffer
|
||||
* @param[in] size Output size limit
|
||||
* @param[in] callback Data callback (see decompressV())
|
||||
* @param[in] userdata User data passed to callback (see decompressV())
|
||||
* @param[in] insize Size of userdata (see decompressV())
|
||||
* @returns Whether succeeded
|
||||
*/
|
||||
static inline bool
|
||||
decompress_RLE(void *output, size_t size, decompressCallback callback,
|
||||
void *userdata, size_t insize)
|
||||
{
|
||||
decompressIOVec iov;
|
||||
iov.data = output;
|
||||
iov.size = size;
|
||||
|
||||
return decompressV_RLE(&iov, 1, callback, userdata, insize);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -27,12 +27,9 @@ static inline uint16_t ntohs(uint16_t netshort)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
in_addr_t inet_addr(const char *cp);
|
||||
int inet_aton(const char *cp, struct in_addr *inp);
|
||||
char* inet_ntoa(struct in_addr in);
|
||||
|
||||
const char *inet_ntop(int af, const void * src, char * dst, socklen_t size);
|
||||
int inet_pton(int af, const char * src, void * dst);
|
||||
in_addr_t inet_addr(const char *cp);
|
||||
int inet_aton(const char *cp, struct in_addr *inp);
|
||||
char* inet_ntoa(struct in_addr in);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -9,46 +9,12 @@
|
||||
#define TRY_AGAIN 4
|
||||
|
||||
struct hostent {
|
||||
char *h_name; /* official name of host */
|
||||
char **h_aliases; /* alias list */
|
||||
uint16_t h_addrtype; /* host address type */
|
||||
uint16_t h_length; /* length of address */
|
||||
char **h_addr_list; /* list of addresses from name server */
|
||||
};
|
||||
#define h_addr h_addr_list[0] /* for backward compatibility */
|
||||
|
||||
#define AI_PASSIVE 0x01
|
||||
#define AI_CANONNAME 0x02
|
||||
#define AI_NUMERICHOST 0x04
|
||||
#define AI_NUMERICSERV 0x00 /* probably 0x08 but services names are never resolved */
|
||||
|
||||
// doesn't apply to 3ds
|
||||
#define AI_ADDRCONFIG 0x00
|
||||
|
||||
|
||||
#define NI_MAXHOST 1025
|
||||
#define NI_MAXSERV 32
|
||||
|
||||
#define NI_NOFQDN 0x01
|
||||
#define NI_NUMERICHOST 0x02
|
||||
#define NI_NAMEREQD 0x04
|
||||
#define NI_NUMERICSERV 0x00 /* probably 0x08 but services names are never resolved */
|
||||
#define NI_DGRAM 0x00 /* probably 0x10 but services names are never resolved */
|
||||
|
||||
#define EAI_FAMILY (-303)
|
||||
#define EAI_MEMORY (-304)
|
||||
#define EAI_NONAME (-305)
|
||||
#define EAI_SOCKTYPE (-307)
|
||||
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
socklen_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
char *h_name;
|
||||
char **h_aliases;
|
||||
int h_addrtype;
|
||||
int h_length;
|
||||
char **h_addr_list;
|
||||
char *h_addr;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -61,17 +27,6 @@ extern "C" {
|
||||
void herror(const char *s);
|
||||
const char* hstrerror(int err);
|
||||
|
||||
int getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
||||
char *host, socklen_t hostlen,
|
||||
char *serv, socklen_t servlen, int flags);
|
||||
|
||||
int getaddrinfo(const char *node, const char *service,
|
||||
const struct addrinfo *hints,
|
||||
struct addrinfo **res);
|
||||
|
||||
void freeaddrinfo(struct addrinfo *ai);
|
||||
|
||||
const char *gai_strerror(int ecode);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
#define POLLIN 0x01
|
||||
#define POLLPRI 0x02
|
||||
#define POLLHUP 0x04 // unknown ???
|
||||
@ -7,7 +9,7 @@
|
||||
#define POLLOUT 0x10
|
||||
#define POLLNVAL 0x20
|
||||
|
||||
typedef unsigned int nfds_t;
|
||||
typedef u32 nfds_t;
|
||||
|
||||
struct pollfd
|
||||
{
|
||||
|
@ -1 +1,13 @@
|
||||
#include_next <sys/select.h>
|
||||
#pragma once
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user