Compare commits

..

116 Commits

Author SHA1 Message Date
GaryOderNichts
3e864b10e7 coreinit/memblockheap: Add padding bytes to MEMBlockHeap struct
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2026-04-04 16:56:21 +02:00
GaryOderNichts
2341956f64 Add semaphore functions for gx2/dmae 2026-04-04 16:49:54 +02:00
Cynthia Coan
6b29dd6ee2
Add OSGetConsoleType, and MCP_GetSystemMode (#441)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
* add OSGetConsoleType, and MCP_GetSystemMode

this adds in two functions that were an exported symbol in the system
libraries, but not included in any headers. these are useful for doing
two things:

- determine what kind of console you're running on (for users who want
  to know if they're running a CAT-DEV, CAT-R, Kiosk Unit, Retail
  Wii-U's, etc.)
- determine if the wii-u is currently running in production/development
  mode. this shouldn't be too useful for many users, as not too much
  changes besides certain extra libraries/etc. are loaded in memory.
  however, users may want to lock things behind development mode as dev
  mode can only be normally enabled when there's extra memory.

* add new comment to mask
2026-03-27 02:17:08 +01:00
GaryOderNichts
2016e429c1 wutnewlib: fix lock_try_acquire
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2026-02-16 19:10:34 +01:00
fincs
afa43f676d
wutnewlib: implement new unified threading syscalls (replaces wutstdc++) (#434)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2026-01-25 19:33:25 +01:00
capitalistspz
26ed8f3b39
Add declarations for some Wiimote audio stuff, +documentation (#433)
* Add declarations for some Wiimote audio stuff, +documentation

* Small comment changes
2026-01-25 13:12:47 +01:00
Cynthia Coan
49fe30fe49
coreinit/filesystem: Label HFIO/PCFS mount source type (#431)
* properly label PCFS mount type

now that we've got an open-source way of booting a cat-dev, and using
PCFS, we can confirm that this second mount source is indeed PCFS.

* fix one space

* pcfs -> hfio
2026-01-25 13:11:43 +01:00
capitalistspz
6cd63fe2b3
Include wut.h in h264/stream.h (#432)
* Include `wut.h` in `h264/stream.h`

Not having `wut.h` included when using this header results in redefinition errors because of `WUT_PACKED`

* Add a space
2025-12-28 17:16:39 +01:00
Daniel K. O.
e3ac119037
Added field to control swkbd keyboard layout. (#429)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
Co-authored-by: Daniel K. O. (dkosmari) <none@none>
2025-11-01 14:30:01 +01:00
Daniel K. O.
1b412d2769
wutsocket fixes: select() handles timeout wrong, and poll() lacks a safety check (#428)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
* - Fix select() to also update the fd_set arguments on timeout condition.
- Move the nfds argument restriction to the nsysnet side.
- Allow user-defined FD_SETSIZE, since newlib's fd_set allow custom sizes.
- Define __socklen_t_defined when socklen_t is typedefed.

* Added safety check for poll(): the nsysnet fd must fit in nsysnet_fd_set.

---------

Co-authored-by: Daniel K. O. (dkosmari) <none@none>
2025-10-10 20:27:42 +02:00
capitalistspz
cac70f560e Correct capitalization to WPADGetGameDataTimeStamp
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2025-08-19 09:28:25 +02:00
GaryOderNichts
2c98cc91aa Run clang-format
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
`find . -regex '.*\.\(cpp\|hpp\|cu\|cuh\|c\|h\)' -exec clang-format -style=file -i {} \;`
2025-06-05 11:06:04 +01:00
GaryOderNichts
4f18f8041a Add formatting check workflow
Bundle clang-format-diff with workflow
2025-06-05 11:06:04 +01:00
GaryOderNichts
2b66122422 Add .clang-format
Co-authored-by: Maschell <Maschell@gmx.de>
2025-06-05 11:06:04 +01:00
Dave Murphy
fa650f92c4
remove unused dist target (#422) 2025-05-29 12:14:44 +01:00
GaryOderNichts
5fdc7ffe85 wutnewlib: Remove obsolete declarations to fix compiling with GCC 15 2025-05-24 20:56:14 +02:00
Daniel K. O.
81db8e5dd4
Add WUT_FORMAT_PRINTF and fix some format string bugs. (#404)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2025-05-17 22:35:56 +02:00
GaryOderNichts
1bbdc75f27 wutsocket/ioctl: Remove unimplemented requests
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2025-05-16 22:13:22 +02:00
capitalistspz
b418690722
h264/decode: Make H264DECSetParam_USER_MEMORY take void** (#418) 2025-05-16 21:47:53 +02:00
capitalistspz
1447a0ed92
padscore: Add KPADSetSamplingCallback, WENCGetEncodeData and documentation improvements (#411)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
* Add `WENCGetEncodeData`

* `const` and out

* WPADInfo changes

* WPADInfo changes

* Add `KPADSetSamplingCallback`

* Miscellaneous comment changes
2025-05-11 19:28:56 +02:00
GaryOderNichts
b35e595a6e nsysccr/cdc: Add lowlevel NFC commands
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2025-03-29 19:10:12 +01:00
GaryOderNichts
a92c2b178b coreinit/debug: Add OSSendFatalError
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2025-03-16 19:34:51 +01:00
Andrew
4847ddce41
bsp: Add all BSP errors (#412)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2025-02-19 12:45:23 +01:00
Dave Murphy
958936de47
update changelog for 1.7.0
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
2024-12-06 09:17:46 +00:00
Dave Murphy
941fd90b39
update changelog for 1.6.0 2024-12-06 09:16:33 +00:00
Daniel K. O.
5c9b87ce75
- Added WPADStatus* structs for various extensions. (#406)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
- Added more enums and enum values.
- Added `padscore/wbc.h` header.
- Added more fields to KPADStatus.
- Added some more WPAD and KPAD functions.

--HG--
branch : padscore-additions-hg

Co-authored-by: Daniel K. O. (dkosmari) <none@none>
2024-10-26 18:22:17 +02:00
Daniel K. O.
6f48526d37
coreinit: Add memory allocator functions (#402)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
Co-authored-by: Daniel K. O. (dkosmari) <none@none>
2024-10-07 22:04:47 +02:00
Daniel K. O.
8b65fd6ce9
Fix typo in nsysnet and add more nn::ac functions. (#401)
Co-authored-by: Daniel K. O. (dkosmari) <none@none>
2024-10-01 21:21:24 +02:00
Daniel K. O.
ad730b9dcb
Added OSSetPerformanceMonitor(). (#400)
* Added `OSSetPerformanceMonitor()`.

--HG--
branch : perf-mon

* Renamed everything.

--HG--
branch : perf-mon

* Added header to tests.

--HG--
branch : perf-mon

---------

Co-authored-by: Daniel K. O. (dkosmari) <none@none>
2024-09-30 11:32:53 +02:00
capitalistspz
7c93c38731
camera: event argument correction (#399)
* Event arg correction from surface to surface buffer

* Correct offset check
2024-09-07 00:34:03 +02:00
GaryOderNichts
34ad45777a avm: Add CEC functions 2024-08-25 18:57:51 +02:00
GaryOderNichts
bbcf70dbc0 tve: Add CEC functions 2024-08-25 18:57:51 +02:00
Maschell
c38b84c175 coreinit: add "MCP_DEVICE_TYPE_AUTO" 2024-08-10 17:43:27 +02:00
Maschell
55a4708ced nn_acp: Add ACPDevice enum values, add save related functions 2024-08-10 17:43:27 +02:00
GaryOderNichts
15b28d8587 nsysccr/cdc: Add CCRCDCSysGetInfo 2024-08-10 17:06:42 +02:00
Maschell
09e3a2440b
nn_idb: Fix copy headers, fix nn::idb::IDBReader::Initialize (#395)
* nn_idb: Fix copy headers, fix nn::idb::IDBReader::Initialize

* Update libraries/nn_idb/src/IDBReader.cpp

Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>

---------

Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
2024-08-04 23:44:54 +02:00
Andrew Hawes
9a32ef1b65 nn_acp: Add ACPRemoveSaveDir* 2024-07-31 16:57:19 +02:00
capitalistspz
327de261b7
camera: corrections and comments (#392)
* camera: correct CAMSetupInfo struct layout, more comments

* offsets

* error -> failed

* Background comment
2024-07-31 16:56:31 +02:00
Maschell
8b05ac3410 nn_ccr: Add CCRSysSetCurrentLCDMode and CCRSysGetCurrentLCDMode 2024-07-23 01:05:43 +02:00
capitalistspz
7044eaa8e4
coreinit/screen: Swap row and column parameters in OSScreenPutFontEx (#391)
* coreinit/OSScreenPutFontEx: Swap row and column parameters

* swap the comment order too
2024-07-19 19:56:49 +02:00
Daniel López Guimaraes
29f5093bf0 nn/dlp: Fix Initialize functions on ServerPrivate
These functions were pointing to the `Server` implementation, and not
the `ServerPrivate` one. Fix the typo using the correct `ServerPrivate`
export instead.
2024-07-19 18:54:10 +02:00
Daniel López Guimaraes
0ae8f8a507 nn/dlp: Add initial headers 2024-07-13 16:35:13 +02:00
Daniel López Guimaraes
4933211d7b
nn/uds: Add initial headers (#387)
* nn/uds: Add initial headers

* nn/uds: Minor fixes and improvements
2024-06-20 16:41:43 +02:00
team-orangeBlue
263c0364d1
More DRX definitions (#385)
* More DRX definitions

Changed DRH state names, notably:
UNK0-> NORADIO
UNK1-> WII
UNK2-> [not renamed]
UNK3-> NODRC
UNK7F-> [not renamed]

DRC EEPROM now defined as data instead of being unknown.
More info yet to be added.

* Unneeded comment removed
2024-06-18 15:41:29 +02:00
GaryOderNichts
a1de926fd3 nsysccr/cdc: Update CCRCDCDrcStateEnum with test menu names 2024-06-18 15:38:17 +02:00
jranderia3
c2682dd964
whb/gfx: Use 4:3 TV buffers on 4:3 TVs (#383)
* square monitor support

* Update gfx.c

Fix typo

* do it using gx2 instead of avm

* Update gfx.c

remove some newlines

* Update gfx.c

newline fix

* Update gfx.c
2024-06-14 20:04:58 +02:00
GaryOderNichts
8474549331 gx2: Add GX2GetSystemTVAspectRatio 2024-06-11 17:21:14 +02:00
GaryOderNichts
9918fea92a nsysnet/netconfig: Add SOGetProxyConfig 2024-06-10 20:02:10 +02:00
GaryOderNichts
09f04f6162 gx2: Add GX2AllocateTilingApertureEx and GX2FreeTilingAperture 2024-06-10 20:01:54 +02:00
Maschell
e47a996a3b nsysccr: Add CCRCDCRegister*AttachCallback functions 2024-06-10 20:00:42 +02:00
Maschell
4ee360097d avm: Add some missing DRC functions 2024-06-10 19:59:47 +02:00
Maschell
ed0c91de16 coreinit: Fix wrong/duplicate OSGetCodegenVirtAddrRange declaration, formatting 2024-06-10 19:42:35 +02:00
Maschell
f17054e3e8 sndcore2: Update AXTransitionAudioBuffer struct 2024-06-10 13:32:51 +02:00
Maschell
151b1d02d1 vpad: Add VPADGetButtonProcMode 2024-06-10 13:31:56 +02:00
Maschell
7520e846ce gx2: add GX2GetMainCoreId 2024-06-10 13:31:19 +02:00
Maschell
e0854333e8
nn_ccr: Add CCRSysCaffeineBootCheckAbort; nsysccr: fix quick start menu value in CCRCDCDrcStateEnum (#372)
* nn_ccr: Add CCRSysCaffeineBootCheckAbort

* nsysccr: Fix quick start menu field in CCRCDCDrcStateEnum

* Update include/nsysccr/cdc.h
2024-06-09 14:29:23 +02:00
GaryOderNichts
48b6c3b32a
wut_types: Implement more operators for WUT_ENUM_BITMASK_TYPE (#369)
* wut_types: Implement more operators for `WUT_ENUM_BITMASK_TYPE`

* wut_types: Use `std::underlying_type_t`

* wut_types: Use an anonymous namespace
2024-06-09 12:56:37 +02:00
capitalistspz
1da14020ee
coreinit: add stopwatch.h and stopwatchatomic.h (#370)
* coreinit: add stopwatch.h and stopwatchatomic.h

* Formatting

* correct function name
2024-06-08 20:19:28 +02:00
Maschell
ef057f145b coreinit: Add __FSAShimDecodeIosErrorToFsaStatus 2024-06-08 17:55:44 +02:00
Maschell
474ae04cb9 nn_acp: Add ACPGetTitleMetaDir and ACPGetTitleMetaDirByTitleListType 2024-06-08 17:47:16 +02:00
Maschell
35aa8b7e80 coreinit: Add "SavedFrame" related functions 2024-06-08 17:46:42 +02:00
Maschell
382a3b2c81 coreinit: Add __OSPhysicalToEffectiveCached and __OSPhysicalToEffectiveUncached 2024-06-06 21:10:30 +02:00
GaryOderNichts
09e36bf299
nsysccr/cdc: Add language and ext update functions (#368)
* nsysccr/cdc: Add language update functions

* nsysccr/cdc: Add `CCRCDCSoftwareExtUpdate`

* nsysccr/cdc: Add more `CCRCDCUicConfigIdEnum` names
2024-05-23 22:15:51 +02:00
capitalistspz
c4368c7822
padscore: Add more functions and types, rename nunchuck -> nunchuk (#348)
* re-sorted and used BOOL

* Added a bit to wpad

* roll back time, name PeripheralSpace correctly, and IsMplsAttached use correct callback

* name WPADPeripheralSpace correctly again

* Add WPADIsMplsIntegrated, correct description of WPADIsMplsAttached

* Add KPADEnableMpls(), KPADDisableMpls() and KPADMplsMode enum

* Spellings, comments and formatting

* Use enum type for KPADEnableMpls param

* Add more WPADDataFormat entries (taken from Cemu)

* Add WPADiQueue and some WPADi functions

* Add WPADGetInfo, WPADGetInfoAsync, and WPADInfo struct (taken from Cemu)

* Add a bunch of game data functions and the rest of the WPADiSend functions

* Add WPADSpeakerMode and speaker functions

* Enum member changes

* Add KPADEnable/DisableDPD, add mpls status functions, typedef KPADMplsMode to WPADMplsMode

* Update WPADSpeakerMode, add WPADGetSpeakerVolume, WPADSetSpeakerVolume

* Add WPADAddress and WPADGetAddress

* WPADIsEnabledURC, WPADEnableWBC, WPADIsEnableWBC

* Add sync functions, update WPADAddress
- Add WPADStartSyncDevice
- Add WPADStartSyncDeviceEx
- Change variable name

* Update WPADExtensionType
- Add WPAD_EXT_DEV_NOT_FOUND

* Update WPADExtensionType and WPADExtensionCallback, add WPADGetDpdFormat
- Add WPAD_EXT_DEV_NOT_FOUND
- Add WPAD_EXT_UNKNOWN
- WPADExtensionType as param to WPADExtensionCallback

* Add PowerSave functions

* Changes:
- More documentation
- More members to WPADMplsMode
- WPADLed as bitmask

* Slight corrections:
- WPADControlLed returns int32
- WPADiHIDParser returns int32
- WPADStartSyncDevice comments fixed

* WPADControlSpeakerMode -> WPADControlSpeaker

* More appropriate enum names

* More info on speaker

* typedef WPADAddress, char16_t -> uint16_t, comment updates

* Update WPADStartSyncDeviceEx comments
2024-05-13 01:43:09 +02:00
Maschell
72ec4f790f nn_ccr: Add CCRSysSetInitBootFlag and CCRSysInitializeSettings 2024-05-05 13:48:17 +02:00
Maschell
536c584989 nsysccr: Add CCRCDCUicConfigIdEnum values 2024-05-05 13:48:17 +02:00
Maschell
2ff0ab7e59 sysapp: Add all possible "jumpTo" targets for SysAppSettingsArgs 2024-05-05 13:45:09 +02:00
Maschell
c2b385cf2c nn_sl: Fix wrong parameters for nn::sl::LaunchInfoDatabase::Unregister 2024-05-05 08:22:49 +02:00
Maschell
c00384924e nn_ccr: Add CCRSysCaffeineSetDRCEnableFlag and CCRSysCaffeineSetEnableFlag 2024-04-27 13:47:37 +02:00
Maschell
0f33ec2121 coreinit: Add MCP_ChangeEcoSettings 2024-04-27 13:47:37 +02:00
Maschell
4e652e196a nn_idb: move include into libraries 2024-04-27 13:38:33 +02:00
Maschell
f0582e2e3e nn_idb: Implement icon database reading 2024-04-26 14:46:56 +02:00
Maschell
8e4e1cb41a nn_ccr: Update CCRAppLaunchParam struct 2024-04-24 14:27:58 +02:00
Maschell
6a1607c0a0 nsysccr: Update CCRCDCDrcStateEnum to add CCR_CDC_DRC_STATE_QUICK_START_MENU 2024-04-24 14:27:58 +02:00
Dave Murphy
bd0156c9ba
wut 1.5.0 changes 2024-04-22 19:54:53 +01:00
Maschell
f01a0b87ac
Implement more functions/classes from nn::sl (#354) 2024-04-22 19:06:02 +01:00
Maschell
c1457779be
wut_newlib: Implement __syscall_abort and __syscall_assert_func (#359) 2024-04-22 19:05:00 +01:00
Andrew
e9abab7cd4 coreinit/mcp: Add MCP_TriggerCrashLogCollection 2024-04-21 15:27:09 +02:00
Maschell
08cfb34e0b
coreinit: Add MEMCheckExpHeap and MEMCheckHeap (#358)
* coreinit: Add MEMCheckExpHeap and MEMCheckHeap

* coreinit: Fix MEMCheckExpHeap and MEMCheckHeap functions
2024-04-20 19:25:24 +02:00
Maschell
669a63bd0c
nsysccr/cdc: Implement CCRCDCSysSetDrhState (#356)
* nsysccr: Implement CCRCDCSysSetDrhState

* nsysccr: Add CCRCDCSysGetDrhState

* nsysccr: Turn CCRCDCDrcState into a struct

* nsysccr: Rename CCRCDCSysDrhState to CCRCDCDrhState to stay consistent with other structs

* Update include/nsysccr/cdc.h

Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>

* Update include/nsysccr/cdc.h

Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>

* Update include/nsysccr/cdc.h

Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>

---------

Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
2024-04-09 11:41:11 +02:00
GaryOderNichts
b38d014a0c padscore: Add missing functions for 7-controller mode 2024-04-06 14:20:49 +02:00
Maschell
31943d2ecd wutmalloc: make sure to set errno properly on error 2024-04-05 21:21:39 +02:00
GaryOderNichts
32426509d0 nn_ccr/sys: Add fw update functions 2024-04-05 18:13:47 +02:00
GaryOderNichts
682f8eb48a nsysccr/cdc: Add software functions 2024-04-02 12:12:13 +02:00
GaryOderNichts
bd6799f158
nsysccr/cdc: Add CCRCDCPerSetUicConfig and CCRCDCCalcCRC16 (#351)
* nsysccr/cdc: Add CCRCDCPerSetUicConfig

* nsysccr/cdc: Add CCRCDCCalcCRC16
2024-03-30 23:04:44 +01:00
GaryOderNichts
4edae90d8b coreinit/mcp: Fix MCPAppType for DRC and DRH 2024-03-28 11:13:41 +01:00
GaryOderNichts
20ef19297e nn/temp: Fix TEMPTargetPreference 2024-03-26 10:10:42 +01:00
GaryOderNichts
9fda122476 vpad: Fix documentation for VPADRead return value 2024-02-22 12:47:41 +01:00
GaryOderNichts
fe45347516
nn/hpad: Add initial headers (#344)
* nn/hpad: Add initial headers

* nn/hpad: Wrap HPADRead to ensure buffer count is 16
2024-02-22 12:47:28 +01:00
Andrew Hawes
c1115e51bb Add AVM headers, functions and enums 2024-02-04 18:04:54 +01:00
Andrew Hawes
e20c2e7517 Add TVE headers, functions and enums 2024-02-04 18:04:54 +01:00
Maschell
1adf4740c7
wutnewlib: implement abort, assert and assert_func (#337)
* wutnewlib: implement abort, assert and assert_func

* wut_newlib: Trigger trap instruction on assert/abort

* wut_newlib: Replace snprintf with cafe-os equivalent.
2024-01-15 18:36:59 +01:00
GaryOderNichts
f1019f63a0 coreinit/im: Add missing IMEvents 2024-01-12 12:09:55 +01:00
GaryOderNichts
430e0c700a coreinit/im: Add IM_SetDeviceState 2024-01-12 12:09:55 +01:00
GaryOderNichts
f797d9741e
docs: Bump runner version (#342) 2023-12-22 20:53:56 +01:00
GaryOderNichts
5cf5d75699
docs: properly handle preprocessing (#341) 2023-12-22 19:47:13 +01:00
GaryOderNichts
af0ccf48b7
nn_nets2: Add somemopt (#338) 2023-11-30 12:22:49 +01:00
Maschell
8cf1780417
Add missing language/region values to nn::erreula and nn::swkbd (#336)
* nn:erreula: add missing LangType values

* nn::swkbd: fix swapped LangType values and add missing RegionType values

* nn:swkbd: Add documentation about LanguageType
2023-11-26 17:03:55 +01:00
Dave Murphy
9cb0dcdb03
Update docs version from git tag (#339) 2023-11-23 21:09:34 +00:00
Dave Murphy
951ac0184d
release 1.4.0 2023-11-10 15:30:30 +00:00
Terry Hearst
554e9f5011
Finalize compile commands (#332) 2023-11-08 13:55:24 +00:00
Andrew
b98f8fc824
procui: Fix ProcUIInForeground and ProcUIIsRunning comments (#330)
* procui: Fix ProcUIInForeground and ProcUIIsRunning comments

* Apply suggestions from code review

Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>

---------

Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
2023-10-18 01:08:39 +02:00
GaryOderNichts
922eb4583e wutsocket: allow sending multicasts 2023-10-17 23:01:41 +02:00
GaryOderNichts
0dc1d00746 Add missing setsockopt optnames 2023-10-17 23:01:41 +02:00
GaryOderNichts
aa40d08787 gx2: Add missing enum values 2023-10-11 21:27:58 +02:00
Fangal-Airbag
ccdc2ea30c Update camera.h 2023-10-11 17:35:24 +02:00
GaryOderNichts
cb9046e776 Add system time update functions 2023-10-07 10:58:26 +02:00
GaryOderNichts
0406a8377c ntag: Add initial header 2023-09-11 12:15:37 +02:00
GaryOderNichts
8395fe1474 nn_nfp: flags -> fontRegion 2023-09-11 12:15:37 +02:00
GaryOderNichts
56a6793869 nfc: fix some documentation issues 2023-09-11 12:15:37 +02:00
Andrew
095a397e7e
nsysccr/cdc: Add CCRCDCWowlWakeDrc and CCRCDCWakeStateEnum (#320) 2023-07-18 23:22:56 +02:00
GaryOderNichts
b408a15fa1 nfc: Add initial header 2023-07-18 23:21:51 +02:00
Dave Murphy
708bd46777
update changelog for 1.3.2 2023-06-24 16:02:59 +01:00
Dave Murphy
71437dbfb9
wut 1.3.2 2023-06-24 15:58:39 +01:00
Maschell
8df8e18e76
wutdevoptab: Add support for opening files with more flag combinations (#322) 2023-06-20 21:36:41 +02:00
Maschell
071345feb2 Implement wut_set_thread_specific/wut_get_thread_specific as weak functions 2023-06-20 21:35:53 +02:00
360 changed files with 21901 additions and 5876 deletions

90
.clang-format Normal file
View File

@ -0,0 +1,90 @@
---
BasedOnStyle: LLVM
AccessModifierOffset: -3
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: AcrossEmptyLinesAndComments
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: All
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- asm
- WUT_FORMAT_PRINTF
BinPackParameters: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: true
AfterExternBlock: false
AfterStruct: true
AfterFunction: true
AfterNamespace: true
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ConstructorInitializerIndentWidth: 3
ContinuationIndentWidth: 3
FixNamespaceComments: true
IncludeBlocks: Preserve
IncludeCategories:
# Include wut headers first
- Regex: '^[<|"]wut'
Priority: 1
- Regex: '^<'
Priority: 2
- Regex: '^"'
Priority: 3
IndentAccessModifiers: false
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 3
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PointerAlignment: Right
ReflowComments: false
SeparateDefinitionBlocks: Leave
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
TypenameMacros:
- BOOL
- RPLWRAP
UseTab: Never

197
.github/workflows/clang-format-diff.py vendored Executable file
View File

@ -0,0 +1,197 @@
#!/usr/bin/env python3
#
# ===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ===------------------------------------------------------------------------===#
"""
This script reads input from a unified diff and reformats all the changed
lines. This is useful to reformat all the lines touched by a specific patch.
Example usage for git/svn users:
git diff -U0 --no-color --relative HEAD^ | {clang_format_diff} -p1 -i
svn diff --diff-cmd=diff -x-U0 | {clang_format_diff} -i
It should be noted that the filename contained in the diff is used unmodified
to determine the source file to update. Users calling this script directly
should be careful to ensure that the path in the diff is correct relative to the
current working directory.
"""
from __future__ import absolute_import, division, print_function
import argparse
import difflib
import re
import subprocess
import sys
if sys.version_info.major >= 3:
from io import StringIO
else:
from io import BytesIO as StringIO
def main():
parser = argparse.ArgumentParser(
description=__doc__.format(clang_format_diff="%(prog)s"),
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument(
"-i",
action="store_true",
default=False,
help="apply edits to files instead of displaying a diff",
)
parser.add_argument(
"-p",
metavar="NUM",
default=0,
help="strip the smallest prefix containing P slashes",
)
parser.add_argument(
"-regex",
metavar="PATTERN",
default=None,
help="custom pattern selecting file paths to reformat "
"(case sensitive, overrides -iregex)",
)
parser.add_argument(
"-iregex",
metavar="PATTERN",
default=r".*\.(?:cpp|cc|c\+\+|cxx|cppm|ccm|cxxm|c\+\+m|c|cl|h|hh|hpp"
r"|hxx|m|mm|inc|js|ts|proto|protodevel|java|cs|json|s?vh?)",
help="custom pattern selecting file paths to reformat "
"(case insensitive, overridden by -regex)",
)
parser.add_argument(
"-sort-includes",
action="store_true",
default=False,
help="let clang-format sort include blocks",
)
parser.add_argument(
"-v",
"--verbose",
action="store_true",
help="be more verbose, ineffective without -i",
)
parser.add_argument(
"-style",
help="formatting style to apply (LLVM, GNU, Google, Chromium, "
"Microsoft, Mozilla, WebKit)",
)
parser.add_argument(
"-fallback-style",
help="The name of the predefined style used as a"
"fallback in case clang-format is invoked with"
"-style=file, but can not find the .clang-format"
"file to use.",
)
parser.add_argument(
"-binary",
default="clang-format",
help="location of binary to use for clang-format",
)
args = parser.parse_args()
# Extract changed lines for each file.
filename = None
lines_by_file = {}
for line in sys.stdin:
match = re.search(r"^\+\+\+\ (.*?/){%s}(\S*)" % args.p, line)
if match:
filename = match.group(2)
if filename is None:
continue
if args.regex is not None:
if not re.match("^%s$" % args.regex, filename):
continue
else:
if not re.match("^%s$" % args.iregex, filename, re.IGNORECASE):
continue
match = re.search(r"^@@.*\+(\d+)(?:,(\d+))?", line)
if match:
start_line = int(match.group(1))
line_count = 1
if match.group(2):
line_count = int(match.group(2))
# The input is something like
#
# @@ -1, +0,0 @@
#
# which means no lines were added.
if line_count == 0:
continue
# Also format lines range if line_count is 0 in case of deleting
# surrounding statements.
end_line = start_line
if line_count != 0:
end_line += line_count - 1
lines_by_file.setdefault(filename, []).extend(
["--lines", str(start_line) + ":" + str(end_line)]
)
# Reformat files containing changes in place.
has_diff = False
for filename, lines in lines_by_file.items():
if args.i and args.verbose:
print("Formatting {}".format(filename))
command = [args.binary, filename]
if args.i:
command.append("-i")
if args.sort_includes:
command.append("--sort-includes")
command.extend(lines)
if args.style:
command.extend(["--style", args.style])
if args.fallback_style:
command.extend(["--fallback-style", args.fallback_style])
try:
p = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=None,
stdin=subprocess.PIPE,
universal_newlines=True,
)
except OSError as e:
# Give the user more context when clang-format isn't
# found/isn't executable, etc.
raise RuntimeError(
'Failed to run "%s" - %s"' % (" ".join(command), e.strerror)
)
stdout, _stderr = p.communicate()
if p.returncode != 0:
return p.returncode
if not args.i:
with open(filename) as f:
code = f.readlines()
formatted_code = StringIO(stdout).readlines()
diff = difflib.unified_diff(
code,
formatted_code,
filename,
filename,
"(before formatting)",
"(after formatting)",
)
diff_string = "".join(diff)
if len(diff_string) > 0:
has_diff = True
sys.stdout.write(diff_string)
if has_diff:
return 1
if __name__ == "__main__":
sys.exit(main())

View File

@ -4,23 +4,32 @@ on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
doc:
name: Deploy documentation
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout the Git repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Fetch tags
run: |
git fetch --tags
- name: Get current tag
id: vars
run: echo "tag=`git tag --sort=-version:refname | head -n 1`" >> "$GITHUB_OUTPUT"
- name: Generate Documentation
run: |
sudo apt-get update
sudo apt-get install -y cmake doxygen doxygen-latex graphviz
cd docs
sudo cmake .
sudo env WUT_VERSION=${{ steps.vars.outputs.tag }} cmake .
doxygen Doxyfile.docs >/dev/null
- name: Deploy to GitHub Pages

47
.github/workflows/format-check.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Formatting check
on: [pull_request]
jobs:
formatting-check:
name: Formatting check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
# To get a diff from the PR we need to fetch 2 commits.
# The checkout action will create a merge commit as {{ github.sha }}.
fetch-depth: 2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -yqq clang-format-18
- name: Format check
id: format-check
run: |
git diff -U0 --no-color ${{ github.sha }}^ -- '*.cpp' '*.c' '*.h' '*.hpp' |
./.github/workflows/clang-format-diff.py -p1 -binary clang-format-18 > clang-format.patch || true
# Check if patch is not empty
if [ -s clang-format.patch ]; then
echo "###############################################################"
echo "# Format checks failed!"
echo "# A patch has been uploaded as an artifact and is shown below."
echo "###############################################################"
# Show patch
cat clang-format.patch
exit 1
fi
- name: Upload format fixes patch
uses: actions/upload-artifact@v4
if: ${{ failure() && steps.format-check.outcome == 'failure' }}
with:
name: clang-format.patch
path: clang-format.patch
if-no-files-found: ignore

View File

@ -1,3 +1,112 @@
#### wut 1.7.0
###### New features / improvements
* nn/dlp: Add initial headers by @DaniElectra in https://github.com/devkitPro/wut/pull/389
* nn/dlp: Fix Initialize functions on ServerPrivate by @DaniElectra in https://github.com/devkitPro/wut/pull/390
* nn_ccr: Add `CCRSysSetCurrentLCDMode` and `CCRSysGetCurrentLCDMode` by @Maschell in https://github.com/devkitPro/wut/pull/393
* nsysccr/cdc: Add CCRCDCSysGetInfo by @GaryOderNichts in https://github.com/devkitPro/wut/pull/398* nn_acp: Add ACPRemoveSaveDir* by @Andrew1Hawes in https://github.com/devkitPro/wut/pull/394
* nn_acp: Add various save related functions by @Maschell in https://github.com/devkitPro/wut/pull/396
* Add HDMI CEC functions by @GaryOderNichts in https://github.com/devkitPro/wut/pull/397
* Added `OSSetPerformanceMonitor()`. by @dkosmari in https://github.com/devkitPro/wut/pull/400
###### Fixes and corrections
* coreinit/screen: Swap row and column parameters in OSScreenPutFontEx by @capitalistspz in https://github.com/devkitPro/wut/pull/391
* camera: corrections and comments by @capitalistspz in https://github.com/devkitPro/wut/pull/392
* nn_idb: Fix copy headers, fix nn::idb::IDBReader::Initialize by @Maschell in https://github.com/devkitPro/wut/pull/395
* camera: event argument correction by @capitalistspz in https://github.com/devkitPro/wut/pull/399
## New Contributors
* @dkosmari made their first contribution in https://github.com/devkitPro/wut/pull/400
#### wut 1.6.0
###### New features / improvements
* nn_idb: Implement icon database reading by @Maschell in https://github.com/devkitPro/wut/pull/357
* nn_idb: move include into libraries directory by @Maschell in https://github.com/devkitPro/wut/pull/365
* wut_types: Implement more operators for `WUT_ENUM_BITMASK_TYPE` by @GaryOderNichts in https://github.com/devkitPro/wut/pull/369
* whb/gfx: Use 4:3 TV buffers on 4:3 TVs by @jranderia3 in https://github.com/devkitPro/wut/pull/383
###### Breaking changes
* padscore: rename `nunchuck` -> `nunchuk` in https://github.com/devkitPro/wut/pull/348
###### CafeOS related changes
* More nn_ccr and nsysccr struct/enum fixes by @Maschell in https://github.com/devkitPro/wut/pull/361
* Add functions to control the Eco mode by @Maschell in https://github.com/devkitPro/wut/pull/363
* nn_sl: Fix wrong parameters for nn::sl::LaunchInfoDatabase::Unregister by @Maschell in https://github.com/devkitPro/wut/pull/362
* sysapp: Add all possible "jumpTo" targets for SysAppSettingsArgs by @Maschell in https://github.com/devkitPro/wut/pull/366
* nn_ccr: Add CCRSysSetInitBootFlag and CCRSysInitializeSettings, add CCRCDCUicConfigIdEnum values by @Maschell in https://github.com/devkitPro/wut/pull/364
* padscore: Add more functions and types in https://github.com/devkitPro/wut/pull/348
* nsysccr/cdc: Add language and ext update functions by @GaryOderNichts in https://github.com/devkitPro/wut/pull/368
* coreinit: Add __OSPhysicalToEffectiveCached and __OSPhysicalToEffectiveUncached by @Maschell in https://github.com/devkitPro/wut/pull/367
* coreinit: Add "SavedFrame" related functions by @Maschell in https://github.com/devkitPro/wut/pull/374
* nn_acp: Add ACPGetTitleMetaDir and ACPGetTitleMetaDirByTitleListType by @Maschell in https://github.com/devkitPro/wut/pull/375
* coreinit: Add __FSAShimDecodeIosErrorToFsaStatus by @Maschell in https://github.com/devkitPro/wut/pull/378
* coreinit: add stopwatch.h and stopwatchatomic.h by @capitalistspz in https://github.com/devkitPro/wut/pull/370
* nn_ccr: Add CCRSysCaffeineBootCheckAbort; nsysccr: fix quick start menu value in CCRCDCDrcStateEnum by @Maschell in https://github.com/devkitPro/wut/pull/372
* gx2: add GX2GetMainCoreId by @Maschell in https://github.com/devkitPro/wut/pull/380
* vpad: Add VPADGetButtonProcMode by @Maschell in https://github.com/devkitPro/wut/pull/376
* sndcore2: Update AXTransitionAudioBuffer struct by @Maschell in https://github.com/devkitPro/wut/pull/373
* coreinit: Fix wrong/duplicate OSGetCodegenVirtAddrRange declaration, formatting by @Maschell in https://github.com/devkitPro/wut/pull/371
* avm: Add some missing DRC functions by @Maschell in https://github.com/devkitPro/wut/pull/379
* nsysccr: Add CCRCDCRegister*AttachCallback functions by @Maschell in https://github.com/devkitPro/wut/pull/377
* gx2: Add GX2AllocateTilingApertureEx and GX2FreeTilingAperture by @GaryOderNichts in https://github.com/devkitPro/wut/pull/381
* nsysnet/netconfig: Add SOGetProxyConfig by @GaryOderNichts in https://github.com/devkitPro/wut/pull/382
* gx2: Add GX2GetSystemTVAspectRatio by @GaryOderNichts in https://github.com/devkitPro/wut/pull/384
* nsysccr/cdc: Update CCRCDCDrcStateEnum with test menu names by @GaryOderNichts in https://github.com/devkitPro/wut/pull/386
* More DRX definitions by @team-orangeBlue in https://github.com/devkitPro/wut/pull/385
* nn/uds: Add initial headers by @DaniElectra in https://github.com/devkitPro/wut/pull/387
#### wut 1.5.0
###### New features / improvements
* wutnewlib: implement abort, assert and assert_func by @Maschell in https://github.com/devkitPro/wut/pull/337 and updated for devkitPPC r45.1 in https://github.com/devkitPro/wut/pull/359
###### Bug fixes
* wutmalloc: make sure to set errno properly on error by @Maschell in https://github.com/devkitPro/wut/pull/347
###### CafeOS related changes
* Add missing language/region values to nn::erreula and nn::swkbd by @Maschell in https://github.com/devkitPro/wut/pull/336
* nn_nets2: Add somemopt by @GaryOderNichts in https://github.com/devkitPro/wut/pull/338
* coreinit/im: Add IM_SetDeviceState and missing `IMEvent`s by @GaryOderNichts in https://github.com/devkitPro/wut/pull/343
* Add AVM and TVE headers, functions and enums by @Andrew1Hawes in https://github.com/devkitPro/wut/pull/345
* nn/hpad: Add initial headers by @GaryOderNichts in https://github.com/devkitPro/wut/pull/344
* vpad: Fix documentation for VPADRead return value by @GaryOderNichts in https://github.com/devkitPro/wut/pull/346
* nn/temp: Fix TEMPTargetPreference by @GaryOderNichts in https://github.com/devkitPro/wut/pull/349
* coreinit/mcp: Fix MCPAppType for DRC and DRH by @GaryOderNichts in https://github.com/devkitPro/wut/pull/350
* nsysccr/cdc: Add CCRCDCPerSetUicConfig by @GaryOderNichts in https://github.com/devkitPro/wut/pull/351
* nsysccr/cdc: Add software functions by @GaryOderNichts in https://github.com/devkitPro/wut/pull/353
* nn_ccr/sys: Add fw update functions by @GaryOderNichts in https://github.com/devkitPro/wut/pull/355
* padscore: Add missing functions for 7-controller mode by @GaryOderNichts in https://github.com/devkitPro/wut/pull/352
* nsysccr/cdc: Implement CCRCDCSysSetDrhState by @Maschell in https://github.com/devkitPro/wut/pull/356
* nn/sl: Implement more functions/classes by @Maschell in https://github.com/devkitPro/wut/pull/354
* coreinit: Add MEMCheckExpHeap and MEMCheckHeap by @Maschell in https://github.com/devkitPro/wut/pull/358
#### wut 1.4.0
## What's Changed
* nfc: Add initial header by @GaryOderNichts in https://github.com/devkitPro/wut/pull/321
* nsysccr/cdc: Add CCRCDCWowlWakeDrc and CCRCDCWakeStateEnum by @Andrew1Hawes in https://github.com/devkitPro/wut/pull/320
* Add NTAG by @GaryOderNichts in https://github.com/devkitPro/wut/pull/326
* Add system time update functions by @GaryOderNichts in https://github.com/devkitPro/wut/pull/328
* Update camera.h by @Fangal-Airbag in https://github.com/devkitPro/wut/pull/329
* Add missing GX2 enum values by @GaryOderNichts in https://github.com/devkitPro/wut/pull/327
* Add missing optnames and multicast support by @GaryOderNichts in https://github.com/devkitPro/wut/pull/331
* procui: Fix ProcUIInForeground and ProcUIIsRunning comments by @Andrew1Hawes in https://github.com/devkitPro/wut/pull/330
* Finalize compile commands by @thearst3rd in https://github.com/devkitPro/wut/pull/332
#### wut 1.3.2
* Implement wut_set_thread_specific/wut_get_thread_specific as weak functions by @Maschell in https://github.com/devkitPro/wut/pull/324
* wutdevoptab: Add support for opening files with more flag combinations by @Maschell in https://github.com/devkitPro/wut/pull/322
#### wut 1.3.1
* wutmalloc: Always align allocated memory to 0x40 to match newlib behaviour by @Maschell in https://github.com/devkitPro/wut/pull/316
* devoptab_fsa: use c++ headers by @WinterMute in https://github.com/devkitPro/wut/pull/317
* Implement __syscall_getreent by @GaryOderNichts in https://github.com/devkitPro/wut/pull/318
* coreinit: Add some missing field to the OSThread struct by @Maschell in https://github.com/devkitPro/wut/pull/319
#### wut 1.3.0
###### Important changes

View File

@ -2,10 +2,6 @@
TOPDIR ?= $(CURDIR)
include $(TOPDIR)/share/wut_rules
export WUT_MAJOR := 1
export WUT_MINOR := 3
export WUT_PATCH := 0
VERSION := $(WUT_MAJOR).$(WUT_MINOR).$(WUT_PATCH)
#---------------------------------------------------------------------------------
@ -20,7 +16,6 @@ TARGET := wut
SOURCES := cafe \
libraries/wutcrt \
libraries/wutnewlib \
libraries/wutstdc++ \
libraries/wutmalloc \
libraries/wutdevoptab \
libraries/wutsocket \
@ -29,12 +24,15 @@ SOURCES := cafe \
libraries/libgfd/src \
libraries/libirc/src \
libraries/nn_erreula \
libraries/nn_sl \
libraries/nn_idb/src \
libraries/nn_swkbd
DATA := data
INCLUDES := include \
libraries/libwhb/include \
libraries/libgfd/include \
libraries/libirc/include
libraries/libirc/include \
libraries/nn_idb/include
#---------------------------------------------------------------------------------
# options for code generation
@ -102,21 +100,13 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
#---------------------------------------------------------------------------------
all: lib/libwut.a lib/libwutd.a
dist-bin: all
@tar --exclude=*~ -cjf wut-$(VERSION).tar.bz2 \
include lib share \
-C libraries/libwhb include \
-C ../libgfd include \
-C ../libirc include
dist-src:
@tar --exclude=*~ -cjf wut-src-$(VERSION).tar.bz2 cafe include libraries share Makefile
dist: dist-src dist-bin
install: dist-bin
mkdir -p $(DESTDIR)$(DEVKITPRO)/wut
bzip2 -cd wut-$(VERSION).tar.bz2 | tar -xf - -C $(DESTDIR)$(DEVKITPRO)/wut
install: all
@mkdir -p $(DESTDIR)$(DEVKITPRO)/wut
@cp -frv include lib share $(DESTDIR)$(DEVKITPRO)/wut
@cp -frv libraries/libwhb/include $(DESTDIR)$(DEVKITPRO)/wut
@cp -frv libraries/nn_idb/include $(DESTDIR)$(DEVKITPRO)/wut
@cp -frv libraries/libgfd/include $(DESTDIR)$(DEVKITPRO)/wut
@cp -frv libraries/libirc/include $(DESTDIR)$(DEVKITPRO)/wut
lib:
@[ -d $@ ] || mkdir -p $@

View File

@ -77,7 +77,6 @@ ACPGetTitleMetaXmlByTitleListType
ACPGetTitleSaveDir
ACPGetTitleSaveDirEx
ACPGetTitleSaveDirExWithoutMetaCheck
ACPGetTitleSaveMetaXml
ACPGetWoodTin
ACPImportSaveDataFromBuffer
ACPImportSaveDirOfAccountWithEncryption
@ -161,3 +160,4 @@ WaitExternalStorage__Q2_2nn3acpFv
:TEXT_WRAP
ACPGetTitleMetaXml
ACPGetTitleSaveMetaXml

View File

@ -9,7 +9,6 @@ BETA_DEBUG_SET_DUMP_MODE
HPADControlMotor
HPADGetGGGGStatus
HPADInit
HPADRead
HPADRecalibrate
HPADResetDevice
HPADSetConnectCallback
@ -17,3 +16,6 @@ HPADSetGgggConnectCallback
HPADSetPowerSupplyCallback
HPADSetSamplingCallback
HPADShutdown
:TEXT_WRAP
HPADRead

View File

@ -11,4 +11,6 @@ icmp_close_handle
icmp_create_handle
icmp_last_code_type
icmp_ping
:TEXT_WRAP
somemopt

View File

@ -123,6 +123,7 @@ inet_ntoa
inet_ntoa_r
ntohl
ntohs
set_multicast_state
socket_lib_finish
socket_lib_init
@ -162,7 +163,6 @@ send
sendto
sendto_multi
sendto_multi_ex
set_multicast_state
set_resolver_allocator
setsocklibopt
setsockopt

View File

@ -7,7 +7,6 @@ NTAGConvertMasterDataToWriteDataForT2T
NTAGConvertT2T
NTAGCreateAllWriteData
NTAGCreateAllWriteDataForT2T
NTAGDetect
NTAGFormat
NTAGInit
NTAGInitEx
@ -28,3 +27,6 @@ NTAGWriteT2TLockArea
NTAGWriteT2TRawData
NTAGWriteT2TRawDataEx
NTAGWriteT2TWithConvert
:TEXT_WRAP
NTAGDetect

View File

@ -6,7 +6,7 @@ if(DOXYGEN_FOUND)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
set(DOXYGEN_PROJECT_NAME "wut")
set(DOXYGEN_PROJECT_NUMBER "1.3.0")
set(DOXYGEN_PROJECT_NUMBER $ENV{WUT_VERSION})
set(DOXYGEN_PROJECT_BRIEF "Wii U Toolchain")
set(DOXYGEN_GENERATE_HTML YES)
@ -22,18 +22,23 @@ if(DOXYGEN_FOUND)
set(DOXYGEN_RECURSIVE YES)
set(DOXYGEN_EXCLUDE_PATTERNS
"wut_structsize.h")
set(DOXYGEN_EXCLUDE_SYMBOLS
"WUT_CHECK_OFFSET"
"WUT_CHECK_SIZE"
"WUT_PADDING_BYTES"
"WUT_UNKNOWN_BYTES"
"WUT_UNKNOWN_SIZE")
set(DOXYGEN_SOURCE_BROWSER YES)
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
set(DOXYGEN_ENUM_VALUES_PER_LINE 1)
set(DOXYGEN_CLASS_DIAGRAMS NO)
set(DOXYGEN_COLLABORATION_GRAPH NO)
set(DOXYGEN_PREDEFINED "__cplusplus")
set(DOXYGEN_ENABLE_PREPROCESSING YES)
set(DOXYGEN_MACRO_EXPANSION YES)
set(DOXYGEN_EXPAND_ONLY_PREDEF YES)
set(DOXYGEN_PREDEFINED
"__cplusplus;"
"WUT_PACKED=;"
"WUT_ALIGNAS(x)=;"
"WUT_CHECK_OFFSET(Type,Offset,Field)=;"
"WUT_CHECK_SIZE(Type,Size)=;"
"WUT_PADDING_BYTES(Size)=;"
"WUT_UNKNOWN_BYTES(Size)=;"
"WUT_UNKNOWN_SIZE(x)=;")
doxygen_add_docs(docs
"${CMAKE_CURRENT_SOURCE_DIR}/../include"

View File

@ -1,5 +1,5 @@
/**
* \defgroup avm avm
*
* AVM
* Audio/Video Manager
*/

92
include/avm/cec.h Normal file
View File

@ -0,0 +1,92 @@
#pragma once
#include <wut.h>
#include <tve/cec.h>
/**
* \defgroup avm_cec AVM HDMI CEC
* \ingroup avm
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Initializes CEC.
*
* \return
* \c TRUE on success.
*/
BOOL
AVMCECInit(void);
/**
* Enable CEC.
*/
void
AVMEnableCEC(void);
/**
* Disable CEC.
*/
void
AVMDisableCEC(void);
/**
* Sends a CEC command.
*
* \param destination
* Logical address of the device where the command should be sent to.
*
* \param opCode
* The op code of the command to send.
*
* \param parameters
* Pointer to optional command parameters.
*
* \param numParameters
* The amount of additional parameters.
*
* \return
* \c TRUE on success.
*/
BOOL
AVMCECSendCommand(TVECECLogicalAddress destination,
TVECECOpCode opCode,
uint8_t *parameters,
uint8_t numParameters);
/**
* Get the last receieved CEC command.
*
* \param outInitiator
* Pointer to store the logical address of the initiator of the command to.
*
* \param outOpCode
* Pointer to store the op code of the command to.
*
* \param outParameters
* Pointer to store additional parameters to.
*
* \param numParameters
* Pointer to store the amount of additional parameters to.
*
* \return
* \c TRUE on success.
*
* \warning
* This will return success even if no new command has been receieved.
* The caller should check that the parameters were actually written to.
*/
BOOL
AVMCECReceiveCommand(TVECECLogicalAddress *outInitiator,
TVECECOpCode *outOpCode,
uint8_t *outParameters,
uint8_t *outNumParameters);
#ifdef __cplusplus
}
#endif
/** @} */

132
include/avm/config.h Normal file
View File

@ -0,0 +1,132 @@
#pragma once
#include <wut.h>
#include <tve/tve.h>
#include "tv.h"
/**
* \defgroup avm_config AVM System Config
* \ingroup avm
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Reads the TV aspect ratio.
*
* \param outAspectRatio
* Pointer to write the aspect ratio to.
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMReadSystemAspectRatioConfig(AVMTvAspectRatio *outAspectRatio);
/**
* Reads the TV port.
*
* \param outPort
* Pointer to write the port to.
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMReadSystemPortConfig(TVEPort *outPort);
/**
* Reads the TV under scan.
*
* \param outUnderScan
* Pointer to write the under scan to.
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMReadSystemTVUnderScanConfig(uint32_t *outUnderScan);
/**
* Reads the TV resolution.
*
* \param outResolution
* Pointer to write the resolution to.
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMReadSystemVideoResConfig(AVMTvResolution *outResolution);
/**
* Writes the TV aspect ratio.
*
* \param aspectRatio
* Must be one of #AVMTvAspectRatio.
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMWriteSystemAspectRatioConfig(AVMTvAspectRatio aspectRatio);
/**
* Writes the TV under scan.
*
* \param underScan
* Must be less than \c 0x15 .
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMWriteSystemTVUnderScanConfig(uint32_t underScan);
/**
* Writes the TV port and resolution.
*
* \param port
* Must be one of #TVEPort.
*
* \param resolution
* Must be one of:
* - #AVM_TV_RESOLUTION_576I
* - #AVM_TV_RESOLUTION_480I
* - #AVM_TV_RESOLUTION_480P
* - #AVM_TV_RESOLUTION_720P
* - #AVM_TV_RESOLUTION_1080I
* - #AVM_TV_RESOLUTION_1080P
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMWriteSystemVideoOutConfig(TVEPort port,
AVMTvResolution resolution);
/**
* Writes the TV resolution.
*
* \param resolution
* Must be one of:
* - #AVM_TV_RESOLUTION_576I
* - #AVM_TV_RESOLUTION_480I
* - #AVM_TV_RESOLUTION_480P
* - #AVM_TV_RESOLUTION_720P
* - #AVM_TV_RESOLUTION_1080I
* - #AVM_TV_RESOLUTION_1080P
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMWriteSystemVideoResConfig(AVMTvResolution resolution);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -26,6 +26,30 @@ typedef enum AVMDrcMode
AVM_DRC_MODE_DOUBLE = 2,
} AVMDrcMode;
typedef enum AVMDrcSystemAudioMode
{
AVM_DRC_SYSTEM_AUDIO_MODE_UNKNOWN_0 = 0, // mono?
AVM_DRC_SYSTEM_AUDIO_MODE_UNKNOWN_1 = 1, // stereo?
AVM_DRC_SYSTEM_AUDIO_MODE_SURROUND = 2,
} AVMDrcSystemAudioMode;
/**
* Uses AVMGetDRCSystemAudioMode internally
* @param outAudioMode
* @return 0 on success, -2 on error
*/
int
AVMGetSystemDRCAudioMode(AVMDrcSystemAudioMode *outAudioMode);
BOOL
AVMGetDRCSystemAudioMode(AVMDrcSystemAudioMode *outAudioMode);
uint32_t
AVMGetDRCVertCount();
BOOL
AVMIsDRCFirstFlippDone();
BOOL
AVMGetDRCScanMode(AVMDrcScanMode *outScanMode);
@ -35,6 +59,12 @@ AVMGetDRCMode(AVMDrcMode *outMode);
uint32_t
AVMProbeDRCNum(void);
BOOL
AVMSetDRCEnable(BOOL enable);
BOOL
AVMSetDRCGamma(float *gamma);
#ifdef __cplusplus
}
#endif

265
include/avm/tv.h Normal file
View File

@ -0,0 +1,265 @@
#pragma once
#include <wut.h>
#include <tve/tve.h>
/**
* \defgroup avm_tv TV
* \ingroup avm
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef enum AVMTvAspectRatio
{
//! 4:3
AVM_TV_ASPECT_RATIO_4_3,
//! 16:9
AVM_TV_ASPECT_RATIO_16_9,
} AVMTvAspectRatio;
typedef enum AVMTvResolution
{
AVM_TV_RESOLUTION_576I = 1,
AVM_TV_RESOLUTION_480I = 2,
AVM_TV_RESOLUTION_480P = 3,
AVM_TV_RESOLUTION_720P = 4,
AVM_TV_RESOLUTION_720P_3D = 5,
AVM_TV_RESOLUTION_1080I = 6,
AVM_TV_RESOLUTION_1080P = 7,
AVM_TV_RESOLUTION_480I_PAL60 = 10,
AVM_TV_RESOLUTION_576P = 11,
AVM_TV_RESOLUTION_720P_50HZ = 12,
AVM_TV_RESOLUTION_1080I_50HZ = 13,
AVM_TV_RESOLUTION_1080P_50HZ = 14,
} AVMTvResolution;
typedef enum AVMTvVideoRegion
{
AVM_TV_VIDEO_REGION_NTSC = 1,
AVM_TV_VIDEO_REGION_PAL,
} AVMTvVideoRegion;
/**
* Gets the TV video region.
*
* \return
* \c TRUE if the region is set to \link AVM_TV_VIDEO_REGION_NTSC NTSC \endlink.
* \c FALSE if the region is set to \link AVM_TV_VIDEO_REGION_PAL PAL \endlink.
*/
BOOL
AVMDebugIsNTSC(void);
/**
* Gets the TV port.
*
* \param outPort
* Pointer to write the port to.
*
* \return
* Always returns \c TRUE .
*
* \sa
* - TVEGetCurrentPort()
*/
BOOL
AVMGetCurrentPort(TVEPort *outPort);
/**
* Gets the HDMI state.
*
* \param outState
* Pointer to write the state to.
*
* \sa
* - TVEGetHDMIErrorStat()
*/
void
AVMGetHDMIState(TVEHdmiState *outState);
/**
* Gets the TV aspect ratio.
*
* \param outAspectRatio
* Pointer to write the aspect ratio to.
*
* \return
* Always returns \c TRUE .
*/
BOOL
AVMGetTVAspectRatio(AVMTvAspectRatio *outAspectRatio);
/**
* Gets the TV resolution.
*
* \warning
* If the resolution is set to #AVM_TV_RESOLUTION_480I_PAL60, this function
* will instead output #AVM_TV_RESOLUTION_480I.
* If the resolution is set to either #AVM_TV_RESOLUTION_720P_50HZ,
* #AVM_TV_RESOLUTION_1080I_50HZ, or #AVM_TV_RESOLUTION_1080P_50HZ, then
* \e nothing will be stored to \a outResolution .
*
* \param outResolution
* Pointer to write the resolution to.
*
* \return
* Always returns \c TRUE .
*/
BOOL
AVMGetTVScanMode(AVMTvResolution *outResolution);
/**
* Gets the TV under scan.
*
* \param outUnderScan
* Pointer to write the under scan to.
*
* \return
* \c 0 on success or \c -1 on failure.
*/
int32_t
AVMGetTVUnderScan(uint32_t *outUnderScan);
/**
* Determines whether a TV is currently connected and displaying the Wii U source.
*
* Internally checks that either the #TVEHdmiState is #TVE_HDMI_STATE_DONE or
* the analog state is \c 1 , depending on whether the \link TVEPort port \endlink is
* set to \link TVE_PORT_HDMI HDMI \endlink or not.
*
* \return
* \c TRUE if a TV is connected, \c FALSE otherwise.
*
* \sa
* - AVMGetHDMIState()
* - TVEGetHDMIErrorStat()
* - TVEGetAnalogStat()
*/
BOOL
AVMIsAVOutReady(void);
/**
* Sets the TV aspect ratio.
*
* \param aspectRatio
* Must be one of #AVMTvAspectRatio.
*
* \return
* \c TRUE on success or \c FALSE on failure.
*/
BOOL
AVMSetTVAspectRatio(AVMTvAspectRatio aspectRatio);
/**
* Sets whether to show or hide the TV video out.
*
* \param enable
* If \c FALSE then a black image is output (i.e. blanks the screen).
* The TV still receives a signal as normal and still plays audio.
*
* \return
* \c TRUE on success or \c FALSE on failure.
*/
BOOL
AVMSetTVEnable(BOOL enable);
/**
* Sets the TV port.
*
* \param port
* Must be one of #TVEPort.
*
* \param resolution
* Must be one of #AVMTvResolution.
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMSetTVOutPort(TVEPort port,
AVMTvResolution resolution);
/**
* Sets the TV resolution and port.
*
* \param resolution
* Must be one of #AVMTvResolution.
*
* \param port
* Must be one of #TVEPort.
*
* \return
* \c 1 on success.
*/
int32_t
AVMSetTVScanMode(AVMTvResolution resolution,
uint32_t unknown,
TVEPort port);
/**
* Sets the TV resolution.
*
* \param resolution
* Must be one of #AVMTvResolution.
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMSetTVScanResolution(AVMTvResolution resolution);
/**
* Sets the TV under scan.
*
* \param underScan
* Must be less than \c 0x15 .
*
* \return
* \c 0 on success or a negative value on error.
*
* \sa
* - AVMSetTVUnderScanParam()
*/
int32_t
AVMSetTVUnderScan(uint32_t underScan);
/**
* \param underScan
* Must be less than \c 0x15 .
*
* \return
* \c 0 on success or \c -1 on failure.
*
* \sa
* - AVMSetTVUnderScan()
*/
int32_t
AVMSetTVUnderScanParam(uint32_t underScan);
/**
* Sets the TV video region.
*
* \param videoRegion
* Must be one of #AVMTvVideoRegion.
*
* \param port
* Must be one of #TVEPort.
*
* \param resolution
* Must be one of #AVMTvResolution.
*
* \return
* \c 0 on success or a negative value on error.
*/
int32_t
AVMSetTVVideoRegion(AVMTvVideoRegion videoRegion,
TVEPort port,
AVMTvResolution resolution);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -37,48 +37,88 @@ typedef enum CamError
CAMERA_ERROR_OK = 0,
CAMERA_ERROR_INVALID_ARG = -1,
CAMERA_ERROR_INVALID_HANDLE = -2,
CAMERA_ERROR_TOO_MANY_SURFACES = -4,
CAMERA_ERROR_INSUFFICIENT_MEMORY = -5,
CAMERA_ERROR_NOT_READY = -6,
CAMERA_ERROR_UNINITIALIZED = -8,
CAMERA_ERROR_UNKNOWN = -10,
CAMERA_ERROR_UVC = -9,
CAMERA_ERROR_UVD_CONTEXT = -10,
CAMERA_ERROR_DEVICE_IN_USE = -12,
CAMERA_ERROR_SEGMENT_VIOLATION = -14
CAMERA_ERROR_UVD_SESSION = -13,
CAMERA_ERROR_SEGMENT_VIOLATION = -15
} CamError;
typedef enum CamFps
{
CAMERA_FPS_15,
CAMERA_FPS_30
CAMERA_FPS_15 = 0,
CAMERA_FPS_30 = 1
} CamFps;
typedef enum CamStreamType
{
CAMERA_STREAM_TYPE_1
CAMERA_STREAM_TYPE_1 = 0
} CamStreamType;
typedef enum CamEventType
{
CAMERA_DECODE_DONE = 0,
CAMERA_DRC_DETACH = 1
} CamEventType;
struct CAMEventData
{
CAMError err;
void *img;
void *arg; // user provided value ??
//! Event type
CamEventType eventType;
union
{
struct
{
//! Pointer to the buffer of the decoded image
void *surfaceBuffer;
//! Handle of instance
CAMHandle handle;
//! TRUE if decode failed
BOOL failed;
} decode;
struct
{
//! Will be FALSE
BOOL connected;
//! Handle of instance
CAMHandle handle;
} detach;
//! Event args
uint32_t args[3];
};
WUT_CHECK_SIZE(CAMEventData, 0x0C);
};
WUT_CHECK_OFFSET(CAMEventData, 0x00, eventType);
WUT_CHECK_OFFSET(CAMEventData, 0x04, decode.surfaceBuffer);
WUT_CHECK_OFFSET(CAMEventData, 0x08, decode.handle);
WUT_CHECK_OFFSET(CAMEventData, 0x0c, decode.failed);
WUT_CHECK_OFFSET(CAMEventData, 0x04, detach.connected);
WUT_CHECK_OFFSET(CAMEventData, 0x08, detach.handle);
WUT_CHECK_OFFSET(CAMEventData, 0x04, args);
WUT_CHECK_SIZE(CAMEventData, 0x10);
typedef void(*CAMEventHandler)(CAMEventData*);
typedef void (*CAMEventHandler)(CAMEventData *camEventData);
struct CAMMode
{
int unk_0x00;
//! If TRUE, the GamePad will display the camera output regardless of what is being rendered
BOOL forceDrc;
//! Framerate setting
CamFps fps;
};
WUT_CHECK_OFFSET(CAMMode, 0x00, unk_0x00);
WUT_CHECK_OFFSET(CAMMode, 0x00, forceDrc);
WUT_CHECK_OFFSET(CAMMode, 0x04, fps);
WUT_CHECK_SIZE(CAMMode, 0x08);
struct CAMWorkMem
{
int size; // size of the work mem
void *pMem; // pointer to the work mem
//! Size of the work memory
uint32_t size;
//! Pointer to the work memory
void *pMem;
};
WUT_CHECK_OFFSET(CAMWorkMem, 0x00, size);
WUT_CHECK_OFFSET(CAMWorkMem, 0x04, pMem);
@ -86,9 +126,12 @@ WUT_CHECK_SIZE(CAMWorkMem, 0x08);
struct CAMStreamInfo
{
//! Stream type, only CAMERA_STREAM_TYPE_1 is valid
CamStreamType type;
int height; // stream height
int width; // stream width
//! Stream height
uint32_t height;
//! Stream width
uint32_t width;
};
WUT_CHECK_OFFSET(CAMStreamInfo, 0x00, type);
WUT_CHECK_OFFSET(CAMStreamInfo, 0x04, height);
@ -97,61 +140,100 @@ WUT_CHECK_SIZE(CAMStreamInfo, 0x0C);
struct CAMSetupInfo
{
//! Stream info
CAMStreamInfo streamInfo;
//! Memory used by library to record and decode frames
CAMWorkMem workMem;
//! Event handler
CAMEventHandler eventHandler;
WUT_UNKNOWN_BYTES(4);
//! Camera mode
CAMMode mode;
//! See \link OS_THREAD_ATTRIB \endlink
uint32_t threadAffinity;
WUT_UNKNOWN_BYTES(0x10);
WUT_PADDING_BYTES(0x10);
};
WUT_CHECK_OFFSET(CAMSetupInfo, 0x00, streamInfo);
WUT_CHECK_OFFSET(CAMSetupInfo, 0x0C, workMem);
WUT_CHECK_OFFSET(CAMSetupInfo, 0x14, eventHandler);
WUT_CHECK_OFFSET(CAMSetupInfo, 0x1C, mode);
WUT_CHECK_OFFSET(CAMSetupInfo, 0x24, threadAffinity);
WUT_CHECK_SIZE(CAMSetupInfo, 0x38);
WUT_CHECK_OFFSET(CAMSetupInfo, 0x18, mode);
WUT_CHECK_OFFSET(CAMSetupInfo, 0x20, threadAffinity);
WUT_CHECK_SIZE(CAMSetupInfo, 0x34);
struct CAMSurface
{
int surfaceSize;
//! Number of bytes allocated to surface buffer
int32_t surfaceSize;
//! Surface buffer data
void *surfaceBuffer;
int height; // surface height
int width; // surface width
int unk_0x10; // pitch related?
int alignment; // surface alignment
int unk_0x18; // surface tile mode related?
int unk_0x1C;
//! Surface height
int32_t height;
//! Surface width
int32_t width;
//! Surface pitch
int32_t pitch;
//! Surface alignment
int32_t alignment;
//! Tile mode, should be zero
int32_t tileMode;
//! Pixel format, Should be zero
int32_t pixelFormat;
};
WUT_CHECK_OFFSET(CAMSurface, 0x00, surfaceSize);
WUT_CHECK_OFFSET(CAMSurface, 0x04, surfaceBuffer);
WUT_CHECK_OFFSET(CAMSurface, 0x08, height);
WUT_CHECK_OFFSET(CAMSurface, 0x0C, width);
WUT_CHECK_OFFSET(CAMSurface, 0x10, unk_0x10);
WUT_CHECK_OFFSET(CAMSurface, 0x10, pitch);
WUT_CHECK_OFFSET(CAMSurface, 0x14, alignment);
WUT_CHECK_OFFSET(CAMSurface, 0x18, unk_0x18);
WUT_CHECK_OFFSET(CAMSurface, 0x1C, unk_0x1C);
WUT_CHECK_OFFSET(CAMSurface, 0x18, tileMode);
WUT_CHECK_OFFSET(CAMSurface, 0x1C, pixelFormat);
WUT_CHECK_SIZE(CAMSurface, 0x20);
/**
* Initialize the camera
* \returns camera handle on success, and -1 on failure
*/
CAMHandle
CAMInit(int instance, CAMSetupInfo *setupInfo, CAMError *err);
/**
* Deinitialize and clean up
*/
void
CAMExit(CAMHandle handle);
/**
* Start recording and decoding frames
*/
CAMError
CAMOpen(CAMHandle handle);
/**
* Stops recording and decoding.
* Automatically called when the process is moved to background
*/
CAMError
CAMClose(CAMHandle handle);
CAMError
/**
* Get the number of bytes requied by the work memory
* \returns number of bytes
* \returns CAM_ERROR_INVALID_ARG if streamInfo is NULL
*/
int32_t
CAMGetMemReq(CAMStreamInfo *streamInfo);
/**
* Submit 1 surface to the working queue.
* Once the frame is captured and decoded, the event handler set in CAMInit will fire, and the frame will be dequeued.
* Up to 20 surfaces may be queued.
* Surface data is returned in the NV12 format
*/
CAMError
CAMSubmitTargetSurface(CAMHandle handle, CAMSurface *surface);
/**
* Checks whether memory is segmented correctly to be used with the camera library
*/
CAMError
CAMCheckMemSegmentation(void *pMem, uint32_t size);

View File

@ -1,8 +1,8 @@
#pragma once
#include <wut.h>
#include "context.h"
#include "threadqueue.h"
#include "time.h"
#include "context.h"
/**
* \defgroup coreinit_alarms Alarms

View File

@ -12,16 +12,32 @@
extern "C" {
#endif
typedef int32_t BSPError;
typedef uint32_t BSPHardwareVersion;
typedef uint32_t BSPConsoleTypeRaw;
typedef enum BSPErrors
typedef enum BSPError
{
BSP_ERROR_OK = 0,
BSP_ERROR_OK = 0x0,
BSP_ERROR_UNKNOWN_ENTITY = 0x1,
BSP_ERROR_UNKNOWN_ATTRIBUTE = 0x2,
BSP_ERROR_INVALID_INSTANCE = 0x4,
BSP_ERROR_CFG_CORRUPTED = 0x8,
BSP_ERROR_DEVICE_ERROR = 0x10,
BSP_ERROR_DEVICE_BUSY = 0x20,
BSP_ERROR_IOS_ERROR = 0x40,
BSP_ERROR_RESPONSE_TOO_LARGE = 0x80,
} BSPErrors;
BSP_ERROR_SPECIFIED_SIZE_INVALID = 0x80,
BSP_ERROR_HEAP_ERROR = 0x100,
BSP_ERROR_ENTITY_LIST_FULL = 0x200,
BSP_ERROR_UNSUPPORTED_METHOD = 0x400,
BSP_ERROR_UNKNOWN_HARDWARE_VERSION = 0x800,
BSP_ERROR_QUERY_UNAVAILABLE = 0x1000,
BSP_ERROR_UNKNOWN_DEVICE = 0x2000,
BSP_ERROR_INVALID_PARAMETER = 0x4000,
BSP_ERROR_DEVICE_NOT_FOUND = 0x8000,
BSP_ERROR_REQUEST_DENIED = 0x10000,
BSP_ERROR_UNSUPPORTED_PARAMETER = 0x20000,
BSP_ERROR_BOARD_CONFIG_INVALID = 0x40000,
} BSPError;
typedef enum BSPHardwareVersions
{

View File

@ -1,4 +1,5 @@
#pragma once
#include <wut.h>
/**
@ -53,7 +54,7 @@ typedef enum OSCodegenSecMode
* - \link OSGetSecCodeGenMode \endlink
*/
void
OSCodegenGetVirtAddrRange(uint32_t* outVirtualAddress,
OSGetCodegenVirtAddrRange(void **outVirtualAddress,
uint32_t *outSize);
/**
@ -119,10 +120,9 @@ OSGetSecCodeGenMode();
* <!-- NOTE this function has a specific bit required in cox.xml: 1 << 30? -->
*/
BOOL
OSCodegenCopy(void* dst, void* src, size_t size);
void
OSGetCodegenVirtAddrRange(void** outAddr, uint32_t* size);
OSCodegenCopy(void *dst,
void *src,
size_t size);
#ifdef __cplusplus
}

View File

@ -15,7 +15,8 @@ extern "C" {
//! A bitfield of enum OS_CONTEXT_STATE.
typedef uint16_t OSContextState;
enum OS_CONTEXT_STATE {
enum OS_CONTEXT_STATE
{
OS_CONTEXT_STATE_OSCALLBACK = 1 << 3,
OS_CONTEXT_STATE_USERMODE_SAVED = 1 << 4
};

View File

@ -14,6 +14,15 @@ extern "C" {
#endif
/**
* Can be used to mask the return value of
* \ref OSGetConsoleType
* for determining the "group" of console. See the function for more
* information around the values the mask gives.
*/
#define OS_CONSOLE_TYPE_MASK 0xF0000000
/**
* Gets the number of cores in the system. On a retail Wii U, this is always 3.
*
@ -58,6 +67,22 @@ BOOL
OSIsMainCore();
/**
* Get the type of console this code is actively running on.
*
* Most of the field is relatively unknown but you can use
* \ref OS_CONSOLE_TYPE_MASK
* which returns whether the unit is a Retail/CAT-R unit with `0x00000000`,
* a CAT-DEV or other CAFE development board with `0x10000000`, and an
* orchestrax unit with `0x20000000`.
*
* \returns
* A number representing the specific console types.
*/
uint32_t
OSGetConsoleType();
#ifdef __cplusplus
}
#endif

View File

@ -12,14 +12,16 @@
extern "C" {
#endif
typedef enum COSReportLevel{
typedef enum COSReportLevel
{
COS_REPORT_LEVEL_ERROR = 0,
COS_REPORT_LEVEL_WARN = 1,
COS_REPORT_LEVEL_INFO = 2,
COS_REPORT_LEVEL_VERBOSE = 3,
} COSReportLevel;
typedef enum COSReportModule{
typedef enum COSReportModule
{
COS_REPORT_MODULE_UNKNOWN_0 = 0,
COS_REPORT_MODULE_UNKNOWN_1 = 1,
COS_REPORT_MODULE_UNKNOWN_2 = 2,
@ -30,27 +32,32 @@ void
COSVReport(COSReportModule module,
COSReportLevel level,
const char *fmt,
...);
...)
WUT_FORMAT_PRINTF(3, 4);
void
COSError(COSReportModule module,
const char *fmt,
...);
...)
WUT_FORMAT_PRINTF(2, 3);
void
COSInfo(COSReportModule module,
const char *fmt,
...);
...)
WUT_FORMAT_PRINTF(2, 3);
void
COSVerbose(COSReportModule module,
const char *fmt,
...);
...)
WUT_FORMAT_PRINTF(2, 3);
void
COSWarn(COSReportModule module,
const char *fmt,
...);
...)
WUT_FORMAT_PRINTF(2, 3);
#ifdef __cplusplus
}

View File

@ -11,6 +11,8 @@
extern "C" {
#endif
typedef struct OSFatalError OSFatalError;
typedef void (*DisassemblyPrintFn)(const char *fmt, ...);
typedef uint32_t (*DisassemblyFindSymbolFn)(uint32_t addr, char *symbolNameBuf, uint32_t symbolNameBufSize);
@ -20,6 +22,39 @@ typedef enum DisassemblePPCFlags
DISASSEMBLE_PPC_FLAGS_NONE = 0,
} DisassemblePPCFlags;
typedef enum OSFatalErrorMessageType
{
OS_FATAL_ERROR_UNKOWN = 0,
OS_FATAL_ERROR_GENERAL = 1,
//! These are only valid for errorCode 1600200 - 1609999
OS_FATAL_ERROR_CORRUPTION = 2,
OS_FATAL_ERROR_FATAL_SYSTEM_OR_USB = 3,
OS_FATAL_ERROR_CORRUPTION_SLC = 4,
OS_FATAL_ERROR_CORRUPTION_USB = 5,
OS_FATAL_ERROR_STORAGE_REMOVED = 6,
OS_FATAL_ERROR_DISC_REMOVED = 7,
OS_FATAL_ERROR_CORRUPTION_DISC = 8,
OS_FATAL_ERROR_WRITE_PROTECT = 9,
} OSFatalErrorMessageType;
struct OSFatalError
{
OSFatalErrorMessageType messageType;
uint32_t errorCode;
uint32_t processId;
uint32_t internalErrorCode;
uint32_t line;
char functionName[64];
WUT_UNKNOWN_BYTES(0x80);
};
WUT_CHECK_OFFSET(OSFatalError, 0x00, messageType);
WUT_CHECK_OFFSET(OSFatalError, 0x04, errorCode);
WUT_CHECK_OFFSET(OSFatalError, 0x08, processId);
WUT_CHECK_OFFSET(OSFatalError, 0x0C, internalErrorCode);
WUT_CHECK_OFFSET(OSFatalError, 0x10, line);
WUT_CHECK_OFFSET(OSFatalError, 0x14, functionName);
WUT_CHECK_SIZE(OSFatalError, 0xD4);
void
OSConsoleWrite(const char *msg,
@ -30,30 +65,40 @@ __OSConsoleWrite(const char *msg,
uint32_t size);
void
OSReport(const char *fmt, ...);
OSReport(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);
void
OSReportVerbose(const char *fmt, ...);
OSReportVerbose(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);
void
OSReportInfo(const char *fmt, ...);
OSReportInfo(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);
void
OSReportWarn(const char *fmt, ...);
OSReportWarn(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);
void
OSPanic(const char *file,
uint32_t line,
const char *fmt, ...);
const char *fmt,
...)
WUT_FORMAT_PRINTF(3, 4);
void
OSFatal(const char *msg);
void
OSSendFatalError(OSFatalError *error,
const char *functionName,
uint32_t line);
uint32_t
OSGetSymbolName(uint32_t addr,

View File

@ -39,7 +39,8 @@ typedef enum OSDynLoad_Error
typedef OSDynLoad_Error (*OSDynLoadAllocFn)(int32_t size, int32_t align, void **outAddr);
typedef void (*OSDynLoadFreeFn)(void *addr);
typedef enum OSDynLoad_ExportType {
typedef enum OSDynLoad_ExportType
{
OS_DYNLOAD_EXPORT_FUNC = 0,
OS_DYNLOAD_EXPORT_DATA = 1,
} OSDynLoad_ExportType;
@ -130,7 +131,8 @@ struct OSDynLoad_LoaderSectionInfo
uint32_t flags;
void *address;
union {
union
{
//! Size of the section, set when type != SHT_RPL_IMPORTS
uint32_t size;

View File

@ -11,8 +11,10 @@
extern "C" {
#endif
// clang-format off
void
RPLWRAP(exit)(int code);
// clang-format on
void
_Exit(int code);

View File

@ -13,8 +13,7 @@ extern "C" {
#endif
typedef void (*OSFiberEntryFn)();
typedef void (*OSFiberExEntryFn)(uint32_t arg1, uint32_t arg2,
uint32_t arg3, uint32_t arg4);
typedef void (*OSFiberExEntryFn)(uint32_t arg1, uint32_t arg2, uint32_t arg3, uint32_t arg4);
int32_t
OSSwitchFiber(OSFiberEntryFn entry,

View File

@ -1,10 +1,10 @@
#pragma once
#include <wut.h>
#include <coreinit/alarm.h>
#include <coreinit/fastmutex.h>
#include <coreinit/ios.h>
#include <coreinit/messagequeue.h>
#include <coreinit/time.h>
#include <coreinit/ios.h>
#include <coreinit/fastmutex.h>
#include <coreinit/alarm.h>
/**
* \defgroup coreinit_fs Filesystem
@ -181,7 +181,8 @@ typedef enum FSVolumeState
FS_VOLUME_STATE_INVALID = 11,
} FSVolumeState;
typedef enum FSMediaState {
typedef enum FSMediaState
{
FS_MEDIA_STATE_READY = 0,
FS_MEDIA_STATE_NO_MEDIA = 1,
FS_MEDIA_STATE_INVALID_MEDIA = 2,
@ -189,9 +190,11 @@ typedef enum FSMediaState {
FS_MEDIA_STATE_MEDIA_ERROR = 4,
} FSMediaState;
typedef enum FSMountSourceType {
typedef enum FSMountSourceType
{
FS_MOUNT_SOURCE_SD = 0,
FS_MOUNT_SOURCE_UNK = 1,
//! Devkit only API currently. Uses the PCFS channel to perform I/O operations on the attached host machine.
FS_MOUNT_SOURCE_HFIO = 1,
} FSMountSourceType;
typedef enum FSOpenFileFlags
@ -397,7 +400,8 @@ WUT_CHECK_OFFSET(FSAsyncResult, 0x20, block);
WUT_CHECK_OFFSET(FSAsyncResult, 0x24, status);
WUT_CHECK_SIZE(FSAsyncResult, 0x28);
struct FSCmdBlockBody {
struct FSCmdBlockBody
{
WUT_UNKNOWN_BYTES(0x96C);
FSAsyncResult asyncResult;
WUT_UNKNOWN_BYTES(0x68);
@ -419,7 +423,8 @@ struct FSMountSource
};
WUT_CHECK_SIZE(FSMountSource, 0x300);
struct WUT_PACKED FSVolumeInfo {
struct WUT_PACKED FSVolumeInfo
{
uint32_t flags;
FSMediaState mediaState;
WUT_UNKNOWN_BYTES(0x4);
@ -450,7 +455,8 @@ WUT_CHECK_SIZE(FSVolumeInfo, 444);
* Get an aligned FSClientBody from an FSClient.
*/
static inline FSClientBody *
FSGetClientBody(FSClient *client) {
FSGetClientBody(FSClient *client)
{
if (!client) {
return NULL;
}
@ -461,7 +467,8 @@ FSGetClientBody(FSClient *client) {
* Get an aligned FSCmdBlockBody from an FSCmdBlock.
*/
static inline FSCmdBlockBody *
FSGetCmdBlockBody(FSCmdBlock *cmdBlock) {
FSGetCmdBlockBody(FSCmdBlock *cmdBlock)
{
if (!cmdBlock) {
return NULL;
}

View File

@ -1,6 +1,5 @@
#pragma once
#include "wut.h"
#include <wut.h>
#include "filesystem.h"
#ifdef __cplusplus
@ -83,7 +82,8 @@ typedef void (*FSAAsyncCallbackFn)(FSError result,
/**
* Block information.
*/
struct FSABlockInfo {
struct FSABlockInfo
{
WUT_UNKNOWN_BYTES(0x14);
};
WUT_CHECK_SIZE(FSABlockInfo, 0x14);
@ -91,7 +91,8 @@ WUT_CHECK_SIZE(FSABlockInfo, 0x14);
/**
* Device information.
*/
struct FSADeviceInfo {
struct FSADeviceInfo
{
WUT_UNKNOWN_BYTES(0x08);
uint64_t deviceSizeInSectors;
uint32_t deviceSectorSize;
@ -104,19 +105,22 @@ WUT_CHECK_SIZE(FSADeviceInfo, 0x28);
/**
* File System information.
*/
struct FSAFileSystemInfo {
struct FSAFileSystemInfo
{
WUT_UNKNOWN_BYTES(0x1E);
};
WUT_CHECK_SIZE(FSAFileSystemInfo, 0x1E);
typedef enum FSAMountPriority {
typedef enum FSAMountPriority
{
FSA_MOUNT_PRIORITY_BASE = 0x1,
FSA_MOUNT_PRIORITY_RAM_DISK_CACHE = 0x4,
FSA_MOUNT_PRIORITY_TITLE_UPDATE = 0x9,
FSA_MOUNT_PRIORITY_UNMOUNT_ALL = 0x80000000,
} FSAMountPriority;
typedef enum FSAQueryInfoType {
typedef enum FSAQueryInfoType
{
FSA_QUERY_INFO_FREE_SPACE_SIZE = 0x0,
FSA_QUERY_INFO_DIR_SIZE = 0x1,
FSA_QUERY_INFO_ENTRY_NUM = 0x2,
@ -128,12 +132,14 @@ typedef enum FSAQueryInfoType {
FSA_QUERY_INFO_FRAGMENT_BLOCK_INFO = 0x8,
} FSAQueryInfoType;
typedef enum FSAReadFlag {
typedef enum FSAReadFlag
{
FSA_READ_FLAG_NONE = 0x0,
FSA_READ_FLAG_READ_WITH_POS = 0x1
} FSAReadFlag;
typedef enum FSAWriteFlag {
typedef enum FSAWriteFlag
{
FSA_WRITE_FLAG_NONE = 0x0,
FSA_WRITE_FLAG_READ_WITH_POS = 0x1
} FSAWriteFlag;
@ -152,19 +158,22 @@ WUT_CHECK_OFFSET(FSAProcessInfo, 0x08, processId);
WUT_CHECK_OFFSET(FSAProcessInfo, 0x0C, groupId);
WUT_CHECK_SIZE(FSAProcessInfo, 0x10);
struct FSARequestRawOpen {
struct FSARequestRawOpen
{
char path[0x280];
};
WUT_CHECK_OFFSET(FSARequestRawOpen, 0x0, path);
WUT_CHECK_SIZE(FSARequestRawOpen, 0x280);
struct FSARequestRawClose {
struct FSARequestRawClose
{
int32_t handle;
};
WUT_CHECK_OFFSET(FSARequestRawClose, 0x0, handle);
WUT_CHECK_SIZE(FSARequestRawClose, 0x04);
struct WUT_PACKED FSARequestRawRead {
struct WUT_PACKED FSARequestRawRead
{
WUT_UNKNOWN_BYTES(0x4);
uint64_t blocks_offset;
uint32_t count;
@ -177,7 +186,8 @@ WUT_CHECK_OFFSET(FSARequestRawRead, 0x10, size);
WUT_CHECK_OFFSET(FSARequestRawRead, 0x14, device_handle);
WUT_CHECK_SIZE(FSARequestRawRead, 0x18);
struct WUT_PACKED FSARequestRawWrite {
struct WUT_PACKED FSARequestRawWrite
{
WUT_UNKNOWN_BYTES(0x4);
uint64_t blocks_offset;
uint32_t count;
@ -572,10 +582,12 @@ WUT_CHECK_OFFSET(FSARequestChangeOwner, 0x284, owner);
WUT_CHECK_OFFSET(FSARequestChangeOwner, 0x28C, group);
WUT_CHECK_SIZE(FSARequestChangeOwner, 0x290);
struct FSARequest {
struct FSARequest
{
FSError emulatedError;
union {
union
{
FSARequestRawOpen rawOpen;
FSARequestRawClose rawClose;
FSARequestRawRead rawRead;
@ -616,7 +628,8 @@ WUT_CHECK_OFFSET(FSARequest, 0x04, rawOpen);
WUT_CHECK_SIZE(FSARequest, 0x520);
struct FSAResponseRawOpen {
struct FSAResponseRawOpen
{
int handle;
};
WUT_CHECK_OFFSET(FSAResponseRawOpen, 0x0, handle);
@ -652,7 +665,8 @@ WUT_CHECK_SIZE(FSAResponseGetVolumeInfo, 0x1BC);
struct WUT_PACKED FSAResponseGetInfoByQuery
{
union WUT_PACKED {
union WUT_PACKED
{
FSABlockInfo badBlockInfo;
FSADeviceInfo deviceInfo;
uint64_t dirSize;
@ -703,9 +717,11 @@ struct FSAResponseStatFile
WUT_CHECK_OFFSET(FSAResponseStatFile, 0x0, stat);
WUT_CHECK_SIZE(FSAResponseStatFile, 0x64);
struct WUT_PACKED FSAResponse {
struct WUT_PACKED FSAResponse
{
uint32_t word0;
union WUT_PACKED {
union WUT_PACKED
{
FSAResponseRawOpen rawOpen;
FSAResponseGetCwd getCwd;
FSAResponseGetFileBlockAddress getFileBlockAddress;
@ -723,7 +739,8 @@ WUT_CHECK_OFFSET(FSAResponse, 0x0, word0);
WUT_CHECK_OFFSET(FSAResponse, 0x4, rawOpen);
WUT_CHECK_SIZE(FSAResponse, 0x293);
enum FSACommandEnum {
enum FSACommandEnum
{
FSA_COMMAND_INVALID = 0x0,
FSA_COMMAND_MOUNT = 0x1,
FSA_COMMAND_UNMOUNT = 0x2,
@ -791,12 +808,14 @@ enum FSACommandEnum {
FSA_COMMAND_SEND_PROFILE_CMD = 0x8E,
};
enum FSAIpcRequestTypeEnum {
enum FSAIpcRequestTypeEnum
{
FSA_IPC_REQUEST_IOCTL = 0,
FSA_IPC_REQUEST_IOCTLV = 1,
};
struct FSAAsyncResult {
struct FSAAsyncResult
{
//! Queue to put a message on when command is complete.
OSMessageQueue *ioMsgQueue;
@ -831,7 +850,8 @@ WUT_CHECK_OFFSET(FSAAsyncResult, 0x24, response);
WUT_CHECK_OFFSET(FSAAsyncResult, 0x28, userContext);
WUT_CHECK_SIZE(FSAAsyncResult, 0x2C);
struct WUT_PACKED FSAShimBuffer {
struct WUT_PACKED FSAShimBuffer
{
//! Buffer for FSA IPC request.
FSARequest request;
WUT_UNKNOWN_BYTES(0x60);
@ -880,7 +900,8 @@ typedef void (*FSAClientAttachAsyncCallbackFn)(FSError result,
FSAResponse *response,
void *userContext);
struct FSAClientAttachAsyncData {
struct FSAClientAttachAsyncData
{
//! Callback to call when an attach has happened.
FSAClientAttachAsyncCallbackFn userCallback;
@ -895,13 +916,15 @@ WUT_CHECK_OFFSET(FSAClientAttachAsyncData, 0x04, userContext);
WUT_CHECK_OFFSET(FSAClientAttachAsyncData, 0x08, ioMsgQueue);
WUT_CHECK_SIZE(FSAClientAttachAsyncData, 0xC);
typedef enum FSAMountFlags {
typedef enum FSAMountFlags
{
FSA_MOUNT_FLAG_LOCAL_MOUNT = 0,
FSA_MOUNT_FLAG_BIND_MOUNT = 1,
FSA_MOUNT_FLAG_GLOBAL_MOUNT = 2,
} FSAMountFlags;
typedef enum FSAUnmountFlags {
typedef enum FSAUnmountFlags
{
FSA_UNMOUNT_FLAG_NONE = 0x00000000,
FSA_UNMOUNT_FLAG_FORCE = 0x00000002,
FSA_UNMOUNT_FLAG_BIND_MOUNT = 0x80000000,
@ -925,6 +948,10 @@ FSADelClient(FSAClientHandle client);
const char *
FSAGetStatusStr(FSError error);
FSError
__FSAShimDecodeIosErrorToFsaStatus(IOSHandle handle,
IOSError err);
FSError
FSAFlushMultiQuota(FSAClientHandle client,
const char *path);

View File

@ -16,8 +16,28 @@ extern "C" {
typedef struct IMRequest IMRequest;
typedef struct IMHomeButtonParams IMHomeButtonParams;
typedef struct IMParameters IMParameters;
typedef struct IMDeviceStateEx IMDeviceStateEx;
typedef uint32_t IMEventMask;
typedef enum IMPadType
{
IM_PAD_TYPE_NONE = 0,
IM_PAD_TYPE_WII_REMOTE = 1,
IM_PAD_TYPE_WIIU_PRO_CONTROLLER = 2,
IM_PAD_TYPE_WII_REMOTE_EXTENSION = 3,
IM_PAD_TYPE_WIIU_GAMEPAD = 4,
} IMPadType;
typedef enum IMDeviceState
{
IM_DEVICE_STATE_CLEAR = 0,
IM_DEVICE_STATE_INACTIVE = 1,
IM_DEVICE_STATE_ACTIVE = 2,
IM_DEVICE_STATE_HOME = 3,
IM_DEVICE_STATE_POWER = 4,
IM_DEVICE_STATE_SYNC = 5,
} IMDeviceState;
struct WUT_PACKED IMRequest
{
uint8_t args[0x80];
@ -42,8 +62,13 @@ WUT_CHECK_SIZE(IMRequest, 0xB4);
struct IMHomeButtonParams
{
WUT_UNKNOWN_BYTES(0x8);
//! The controller type which pressed the home button
IMPadType type;
//! The controller index which pressed the home button
int32_t index;
};
WUT_CHECK_OFFSET(IMHomeButtonParams, 0x0, type);
WUT_CHECK_OFFSET(IMHomeButtonParams, 0x4, index);
WUT_CHECK_SIZE(IMHomeButtonParams, 0x8);
struct IMParameters
@ -61,6 +86,15 @@ WUT_CHECK_OFFSET(IMParameters, 0x0C, apdEnabled);
WUT_CHECK_OFFSET(IMParameters, 0x10, apdPeriod);
WUT_CHECK_SIZE(IMParameters, 0x14);
struct IMDeviceStateEx
{
IMDeviceState state;
IMHomeButtonParams params;
};
WUT_CHECK_OFFSET(IMDeviceStateEx, 0x0, state);
WUT_CHECK_OFFSET(IMDeviceStateEx, 0x4, params);
WUT_CHECK_SIZE(IMDeviceStateEx, 0xC);
typedef enum IMParameter
{
IM_PARAMETER_INACTIVE_SECONDS = 0,
@ -85,14 +119,21 @@ typedef enum IMTimer
typedef enum IMEvent
{
IM_EVENT_UNK1 = 1 << 1,
IM_EVENT_UNK2 = 1 << 2,
IM_EVENT_UNK3 = 1 << 3,
IM_EVENT_ACTIVE = 1 << 0,
IM_EVENT_INACTIVE = 1 << 1,
IM_EVENT_DIM = 1 << 2,
IM_EVENT_UNDIM = 1 << 3,
//! Automatic power down
IM_EVENT_APD = 1 << 4,
IM_EVENT_UNK5 = 1 << 5,
IM_EVENT_UNK6 = 1 << 6,
//! Controller power button was pressed
IM_EVENT_POWER = 1 << 5,
//! Home button was pressed
IM_EVENT_HOME = 1 << 6,
//! Console sync button was pressed
IM_EVENT_SYNC = 1 << 7,
IM_EVENT_UNK8 = 1 << 8,
IM_EVENT_RESET = 1 << 8,
//! Event notify was cancelled
IM_EVENT_CANCELLED = 1 << 31,
} IMEvent;
IOSHandle
@ -172,6 +213,20 @@ IM_CancelGetEventNotify(IOSHandle handle,
IOSAsyncCallbackFn asyncCallback,
void *asyncCallbackContext);
IOSError
IM_SetDeviceState(IOSHandle handle,
IMRequest *request,
IMDeviceState state,
IOSAsyncCallbackFn asyncCallback,
void *asyncCallbackContext);
IOSError
IM_SetDeviceStateEx(IOSHandle handle,
IMRequest *request,
IMDeviceStateEx *state,
IOSAsyncCallbackFn asyncCallback,
void *asyncCallbackContext);
#ifdef __cplusplus
}
#endif

View File

@ -6,7 +6,11 @@ extern "C" {
#endif
int
__os_snprintf(char *buf, size_t n, const char *format, ... );
__os_snprintf(char *buf,
size_t n,
const char *format,
...)
WUT_FORMAT_PRINTF(3, 4);
#ifdef __cplusplus
}

View File

@ -1,8 +1,8 @@
#pragma once
#include <wut.h>
#include "mutex.h"
#include "ios.h"
#include "mutex.h"
#ifdef __cplusplus
extern "C" {
@ -17,7 +17,8 @@ typedef struct IPCBufPool IPCBufPool;
*
* Functions similar to a ring buffer.
*/
struct IPCBufPoolFIFO {
struct IPCBufPoolFIFO
{
//! The current message index to push to.
int32_t pushIndex;
@ -43,7 +44,8 @@ WUT_CHECK_SIZE(IPCBufPoolFIFO, 0x14);
/**
* Attributes returned by IPCBufPoolGetAttributes.
*/
struct IPCBufPoolAttributes {
struct IPCBufPoolAttributes
{
//! Size of a message in the buffer pool.
uint32_t messageSize;
@ -63,7 +65,8 @@ WUT_CHECK_SIZE(IPCBufPoolAttributes, 0x0C);
/**
* A simple message buffer pool used for IPC communication.
*/
struct IPCBufPool {
struct IPCBufPool
{
//! Magic header always set to IPCBufPool::MagicHeader.
uint32_t magic;

View File

@ -12,7 +12,8 @@
extern "C" {
#endif
typedef enum OSICICommand {
typedef enum OSICICommand
{
OS_ICI_COMMAND_INVALID_IC_RANGE = 1,
OS_ICI_COMMAND_RESCHEDULE_CORE = 2,
OS_ICI_COMMAND_HALT_CORE = 3,
@ -36,7 +37,8 @@ typedef void (*KernelTimerCallbackFn)(OSExceptionType exception, OSContext *inte
typedef uint32_t KernelTimerHandle;
typedef struct OSExceptionChainInfo {
typedef struct OSExceptionChainInfo
{
OSExceptionCallbackExFn callback;
void *stack;
OSContext *context;
@ -46,8 +48,10 @@ WUT_CHECK_OFFSET(OSExceptionChainInfo, 4, stack);
WUT_CHECK_OFFSET(OSExceptionChainInfo, 8, context);
WUT_CHECK_SIZE(OSExceptionChainInfo, 12);
typedef struct KernelInfo0 {
struct CoreinitInfo {
typedef struct KernelInfo0
{
struct CoreinitInfo
{
void *loaderHandle;
void *textAddr;
uint32_t textOffset;
@ -127,7 +131,8 @@ WUT_CHECK_OFFSET(KernelInfo0, 0x9C, unk0x9C);
WUT_CHECK_OFFSET(KernelInfo0, 0xA0, titleId);
WUT_CHECK_SIZE(KernelInfo0, 0xA8);
typedef struct KernelInfo6 {
typedef struct KernelInfo6
{
uint64_t osTitleId;
uint32_t unk0x08;
WUT_PADDING_BYTES(0x108 - 0xC);
@ -136,14 +141,33 @@ WUT_CHECK_OFFSET(KernelInfo6, 0x00, osTitleId);
WUT_CHECK_OFFSET(KernelInfo6, 0x08, unk0x08);
WUT_CHECK_SIZE(KernelInfo6, 0x108);
void __KernelSetUserModeExHandler(OSExceptionType exceptionType, OSExceptionChainInfo *chainInfo, OSExceptionChainInfo *prevChainInfo);
void
__KernelSetUserModeExHandler(OSExceptionType exceptionType,
OSExceptionChainInfo *chainInfo,
OSExceptionChainInfo *prevChainInfo);
KernelTimerHandle __KernelAllocateTimer(KernelTimerCallbackFn, void *exceptionStack, OSContext *context);
uint32_t __KernelPrimeTimer(KernelTimerHandle handle, uint64_t startTimeInTicks, uint64_t intervalInTicks, uint32_t unknown);
KernelTimerHandle
__KernelAllocateTimer(KernelTimerCallbackFn,
void *exceptionStack,
OSContext *context);
void __KernelSendICI(OSICICommand cmd, void *arg1, uint32_t unknown1, uint32_t unknown2);
uint32_t
__KernelPrimeTimer(KernelTimerHandle handle,
uint64_t startTimeInTicks,
uint64_t intervalInTicks,
uint32_t unknown);
void __KernelGetInfo(uint32_t type, void *outBuffer, uint32_t outBufferSize, uint32_t core);
void
__KernelSendICI(OSICICommand cmd,
void *arg1,
uint32_t unknown1,
uint32_t unknown2);
void
__KernelGetInfo(uint32_t type,
void *outBuffer,
uint32_t outBufferSize,
uint32_t core);
static inline void
__KernelGetInfo0(KernelInfo0 *outBuffer, uint32_t core)

View File

@ -29,8 +29,8 @@ typedef enum MCPAppType
MCP_APP_TYPE_BOOT1 = 0x10000009,
MCP_APP_TYPE_SYSTEM_LIBRARIES = 0x1000000A,
MCP_APP_TYPE_BLUETOOTH_FIRMWARE = 0x10000012,
MCP_APP_TYPE_DRH_FIRMWARE = 0x10000013,
MCP_APP_TYPE_DRC_FIRMWARE = 0x10000014,
MCP_APP_TYPE_DRC_FIRMWARE = 0x10000013,
MCP_APP_TYPE_DRH_FIRMWARE = 0x10000014,
MCP_APP_TYPE_SYSTEM_VERSION = 0x10000015,
MCP_APP_TYPE_DRC_LANGUAGE = 0x1000001A,
MCP_APP_TYPE_EXCEPTIONS_DATA = 0x18000010,
@ -63,9 +63,11 @@ typedef enum MCPAppType
typedef enum MCPDeviceType
{
MCP_DEVICE_TYPE_AUTO = 1, /* returns result for ODD, MLC and USB */
MCP_DEVICE_TYPE_ODD = 2,
MCP_DEVICE_TYPE_MLC = 3,
MCP_DEVICE_TYPE_USB = 4,
/* any value >= 5 is MCP_DEVICE_TYPE_AUTO */
} MCPDeviceType;
typedef enum MCPDeviceFlags
@ -100,6 +102,16 @@ typedef enum MCPCompatAVFile
MCP_COMPAT_AV_FILE_DEINT = 0x01,
} MCPCompatAVFile;
typedef enum MCPSystemMode
{
//! This unit is in 'retail'/'production' mode.
MCP_PRODUCTION = 0x00,
//! This unit is in 'development' mode (default for CAT-DEV).
MCP_DEVELOPMENT = 0x01,
//! This unit is in 'test' mode.
MCP_TEST = 0x02,
} MCPSystemMode;
struct WUT_PACKED MCPDevice
{
char type[8];
@ -239,6 +251,10 @@ MCPError
MCP_GetOwnTitleInfo(int32_t handle,
MCPTitleListType *titleInfo);
MCPError
MCP_GetSystemMode(int32_t handle,
MCPSystemMode *mode);
MCPError
MCP_GetSysProdSettings(int32_t handle,
MCPSysProdSettings *settings);
@ -310,7 +326,7 @@ MCP_TitleListByUniqueId(int32_t handle,
MCPError
MCP_TitleListByDevice(int32_t handle,
const char *device,
const char *deviceName,
uint32_t *outTitleCount,
MCPTitleListType *titleList,
uint32_t titleListSizeBytes);
@ -324,7 +340,7 @@ MCP_TitleListByDeviceType(int32_t handle,
MCPError
MCP_TitleListByAppAndDevice(int32_t handle,
MCPAppType appType,
const char *device,
const char *deviceName,
uint32_t *outTitleCount,
MCPTitleListType *titleList,
uint32_t titleListSizeBytes);
@ -358,6 +374,44 @@ MCP_CompatLoadAVFile(int32_t handle,
uint32_t *size,
MCPCompatAVFile file);
/**
* Saves the current Cafe log to the SLC logs directory.
* Internally calls IOS_Ioctl() with request \c 0xCD .
*
* \return
* \c 0 on success.
*/
MCPError
MCP_TriggerCrashLogCollection(int32_t handle);
/**
* Sets values to /storage_slc/sys/config/eco.xml
*
* \return
* \c 0 on success.
*/
MCPError
MCP_ChangeEcoSettings(int32_t handle,
uint32_t enable,
uint32_t maxOnTime,
uint16_t defaultOffTime);
static inline const char *
MCP_GetDeviceNameByDeviceType(MCPDeviceType deviceType)
{
switch (deviceType) {
case MCP_DEVICE_TYPE_AUTO:
return "auto";
case MCP_DEVICE_TYPE_ODD:
return "odd";
case MCP_DEVICE_TYPE_MLC:
return "mlc";
case MCP_DEVICE_TYPE_USB:
return "usb";
}
return "auto";
}
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,108 @@
#pragma once
#include <wut.h>
#include "memheap.h"
/**
* \defgroup coreinit_memallocator Allocator
* \ingroup coreinit
*
* Functions for managing generic allocator objects.
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef struct MEMAllocatorFunctions MEMAllocatorFunctions;
typedef struct MEMAllocator MEMAllocator;
typedef void *(*MEMAllocatorAllocFn)(MEMAllocator *allocator, uint32_t size);
typedef void (*MEMAllocatorFreeFn)(MEMAllocator *allocator, void *ptr);
//! Holds context information that will be used to allocate and free memory.
struct MEMAllocator
{
//! Points to the alloc/free functions.
MEMAllocatorFunctions *funcs;
//! The heap handle.
MEMHeapHandle heap;
//! The alignment the allocator will use.
uint32_t align;
WUT_UNKNOWN_BYTES(4);
};
WUT_CHECK_OFFSET(MEMAllocator, 0x0, funcs);
WUT_CHECK_OFFSET(MEMAllocator, 0x4, heap);
WUT_CHECK_OFFSET(MEMAllocator, 0x8, align);
WUT_CHECK_SIZE(MEMAllocator, 0x10);
//! The alloc/free functions.
struct MEMAllocatorFunctions
{
MEMAllocatorAllocFn alloc;
MEMAllocatorFreeFn free;
};
WUT_CHECK_OFFSET(MEMAllocatorFunctions, 0x0, alloc);
WUT_CHECK_OFFSET(MEMAllocatorFunctions, 0x4, free);
WUT_CHECK_SIZE(MEMAllocatorFunctions, 0x8);
/**
* Allocates memory from the allocator.
*
* \return `allocator->funcs.alloc(allocator, size)`.
*/
void *
MEMAllocFromAllocator(MEMAllocator *allocator,
uint32_t size);
/**
* Frees memory back to the allocator.
*
* It simply calls `allocator->funcs.free(allocator, ptr)`.
*/
void
MEMFreeToAllocator(MEMAllocator *allocator,
void *ptr);
/**
* Initializes an allocator from an Expanded Heap.
*/
void
MEMInitAllocatorForExpHeap(MEMAllocator *allocator,
MEMHeapHandle heap,
uint32_t alignment);
/**
* Initializes an allocator from a Frame Heap.
*/
void
MEMInitAllocatorForFrmHeap(MEMAllocator *allocator,
MEMHeapHandle heap,
uint32_t alignment);
/**
* Initializes an allocator from a Unit Heap.
*/
void
MEMInitAllocatorForUnitHeap(MEMAllocator *allocator,
MEMHeapHandle heap);
/**
* Initializes an allocator from the Default Heap.
*/
void
MEMInitAllocatorForDefaultHeap(MEMAllocator *allocator);
/**
* Initializes an allocator from a Block Heap.
*/
void
MEMInitAllocatorForBlockHeap(MEMAllocator *allocator,
MEMHeapHandle heap,
uint32_t alignment);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -75,6 +75,8 @@ struct WUT_PACKED MEMBlockHeap
//! Free block count
uint32_t numFreeBlocks;
WUT_PADDING_BYTES(0xC);
};
WUT_CHECK_OFFSET(MEMBlockHeap, 0x00, header);
WUT_CHECK_OFFSET(MEMBlockHeap, 0x40, defaultTrack);
@ -83,7 +85,7 @@ WUT_CHECK_OFFSET(MEMBlockHeap, 0x64, firstBlock);
WUT_CHECK_OFFSET(MEMBlockHeap, 0x68, lastBlock);
WUT_CHECK_OFFSET(MEMBlockHeap, 0x6C, firstFreeBlock);
WUT_CHECK_OFFSET(MEMBlockHeap, 0x70, numFreeBlocks);
WUT_CHECK_SIZE(MEMBlockHeap, 0x74);
WUT_CHECK_SIZE(MEMBlockHeap, 0x80);
MEMHeapHandle
MEMInitBlockHeap(MEMBlockHeap *heap,

View File

@ -16,8 +16,7 @@ typedef struct MEMExpHeap MEMExpHeap;
typedef struct MEMExpHeapBlock MEMExpHeapBlock;
typedef struct MEMExpHeapBlockList MEMExpHeapBlockList;
typedef void (*MEMExpHeapBlockVisitor)(void *block, MEMHeapHandle heap,
void *context);
typedef void (*MEMExpHeapBlockVisitor)(void *block, MEMHeapHandle heap, void *context);
typedef enum MEMExpHeapMode
{
@ -31,6 +30,12 @@ typedef enum MEMExpHeapDirection
MEM_EXP_HEAP_DIR_FROM_BOTTOM = 1,
} MEMExpHeapDirection;
typedef enum MEMExpHeapCheckFlags
{
MEM_EXP_HEAP_CHECK_FLAGS_NONE = 0,
MEM_EXP_HEAP_CHECK_FLAGS_LOG_ERRORS = 1,
} MEMExpHeapCheckFlags;
struct MEMExpHeapBlock
{
uint32_t attribs;
@ -131,6 +136,10 @@ MEMVisitAllocatedForExpHeap(MEMHeapHandle heap,
MEMExpHeapBlockVisitor callback,
void *context);
BOOL
MEMCheckExpHeap(MEMHeapHandle handle,
MEMExpHeapCheckFlags mode);
#ifdef __cplusplus
}
#endif

View File

@ -1,13 +1,13 @@
#pragma once
#include <wut.h>
#include "spinlock.h"
#include "memlist.h"
#include "spinlock.h"
/**
* \defgroup coreinit_memheap Common Memory Heap
* \ingroup coreinit
*
* Common memory heap fucntions.
* Common memory heap functions.
* @{
*/
@ -144,6 +144,12 @@ void
MEMSetFillValForHeap(MEMHeapFillType type,
uint32_t value);
/**
* Checks the heap for corruption
*/
BOOL
MEMCheckHeap(MEMHeapHandle handle);
#ifdef __cplusplus
}
#endif

View File

@ -26,6 +26,12 @@ typedef enum OSMemoryMapMode
uint32_t
OSEffectiveToPhysical(uint32_t virtualAddress);
uint32_t
__OSPhysicalToEffectiveCached(uint32_t physicalAddress);
uint32_t
__OSPhysicalToEffectiveUncached(uint32_t physicalAddress);
BOOL
OSIsAddressValid(uint32_t virtualAddress);

View File

@ -0,0 +1,206 @@
#pragma once
#include <wut.h>
/**
* \defgroup coreinit_performancemonitor Performance Monitor
* \ingroup coreinit
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/// Used to tell OSSetPerformanceMonitor() which arguments are valid.
typedef enum OSPerfMonArg
{
OS_PM_ARG_MMCR0 = 1u << 0u,
OS_PM_ARG_MMCR1 = 1u << 1u,
OS_PM_ARG_PMC1 = 1u << 2u,
OS_PM_ARG_PMC2 = 1u << 3u,
OS_PM_ARG_PMC3 = 1u << 4u,
OS_PM_ARG_PMC4 = 1u << 5u,
} OSPerfMonArg;
/**
* Flags to write to (U)MMCR0 register.
*
* \sa OSSetPerformanceMonitor
*/
typedef enum OSPerfMonMMCR0Flags
{
OS_PM_MMCR0_PMC1_CURRENT = 0b0000000u << 6,
OS_PM_MMCR0_PMC1_CPU_CYCLES = 0b0000001u << 6,
OS_PM_MMCR0_PMC1_INSTRUCTIONS_COMPLETED = 0b0000010u << 6,
OS_PM_MMCR0_PMC1_TBL_RISING_TRANSITIONS = 0b0000011u << 6,
OS_PM_MMCR0_PMC1_INSTRUCTIONS_DISPATCHED = 0b0000100u << 6,
OS_PM_MMCR0_PMC1_EIEIO_INSTRUCTIONS_COMPLETED = 0b0000101u << 6,
OS_PM_MMCR0_PMC1_ITLB_SEARCH_CYCLES = 0b0000110u << 6,
OS_PM_MMCR0_PMC1_L2_HITS = 0b0000111u << 6,
OS_PM_MMCR0_PMC1_INSTRUCTIONS_EA_DELIVERED = 0b0001000u << 6,
OS_PM_MMCR0_PMC1_INSTRUCTIONS_COMPLETED_MATCHES_IABR = 0b0001001u << 6,
OS_PM_MMCR0_PMC1_SLOW_L1_MISSES = 0b0001010u << 6,
OS_PM_MMCR0_PMC1_UNRESOLVED_BRANCHES = 0b0001011u << 6,
OS_PM_MMCR0_PMC1_UNRESOLVED_STALL_CYCLES = 0b0001100u << 6,
OS_PM_MMCR0_PMC1_L1_SHARED_STORES = 0b0001110u << 6,
OS_PM_MMCR0_PMC1_L2_SHARED_INTERVENTIONS = 0b0001111u << 6,
OS_PM_MMCR0_PMC1_CACHE_PARADOXES = 0b0010000u << 6,
OS_PM_MMCR0_PMC1_CIU_LOAD_REQUESTS = 0b0010100u << 6,
OS_PM_MMCR0_PMC1_BIU_ADDRESS_ONLY_REQUESTS = 0b0010101u << 6,
OS_PM_MMCR0_PMC1_CIU_PARADOXES = 0b0010110u << 6,
OS_PM_MMCR0_PMC1_60XE_BUS_DATA_BEATS = 0b0010111u << 6,
OS_PM_MMCR0_PMC2_CURRENT = 0b000000u,
OS_PM_MMCR0_PMC2_CPU_CYCLES = 0b000001u,
OS_PM_MMCR0_PMC2_INSTRUCTIONS_COMPLETED = 0b000010u,
OS_PM_MMCR0_PMC2_TBL_RISING_TRANSITIONS = 0b000011u,
OS_PM_MMCR0_PMC2_INSTRUCTIONS_DISPATCHED = 0b000100u,
OS_PM_MMCR0_PMC2_L1_ICACHE_MISSES = 0b000101u,
OS_PM_MMCR0_PMC2_ITLB_MISSES = 0b000110u,
OS_PM_MMCR0_PMC2_L2_INSTRUCTION_MISSES = 0b000111u,
OS_PM_MMCR0_PMC2_PRED_BRANCHES_NOT_TAKEN = 0b001000u,
OS_PM_MMCR0_PMC2_RESERVED_LOADS = 0b001010u,
OS_PM_MMCR0_PMC2_LOADS_AND_STORES = 0b001011u,
OS_PM_MMCR0_PMC2_CACHE_SNOOPS = 0b001100u,
OS_PM_MMCR0_PMC2_L1_TO_L2_CASTOUTS = 0b001101u,
OS_PM_MMCR0_PMC2_SYSTEM_UNIT_INSTRUCTIONS = 0b001110u,
OS_PM_MMCR0_PMC2_L1_INSTRUCTION_MISS_CYCLES = 0b001111u,
OS_PM_MMCR0_PMC2_FIRST_SPECULATIVE_BRANCH_RESOLVES = 0b010000u,
OS_PM_MMCR0_PMC2_L2_SHARED_STORES = 0b010001u,
OS_PM_MMCR0_PMC2_L1_SHARED_INTERVENTIONS = 0b010010u,
OS_PM_MMCR0_PMC2_CIU_STORE_REQUESTS = 0b010100u,
OS_PM_MMCR0_PMC2_SLOW_OUTSTANDING_BIU_TRANSACTIONS = 0b010101u,
OS_PM_MMCR0_PMC2_CIU_MODIFIED_INTERVENTIONS = 0b010110u,
} OSPerfMonMMCR0Flags;
/**
* Flags to write to (U)MMCR1 register.
*
* \sa OSSetPerformanceMonitor
*/
typedef enum OSPerfMonMMCR1Flags
{
OS_PM_MMCR1_PMC3_CURRENT = 0b00000u << 27,
OS_PM_MMCR1_PMC3_CPU_CYCLES = 0b00001u << 27,
OS_PM_MMCR1_PMC3_INSTRUCTIONS_COMPLETED = 0b00010u << 27,
OS_PM_MMCR1_PMC3_TBL_RISING_TRANSITIONS = 0b00011u << 27,
OS_PM_MMCR1_PMC3_INSTRUCTIONS_DISPATCHED = 0b00100u << 27,
OS_PM_MMCR1_PMC3_L1_DCACHE_MISSES = 0b00101u << 27,
OS_PM_MMCR1_PMC3_DTLB_MISSES = 0b00110u << 27,
OS_PM_MMCR1_PMC3_L2_DATA_MISSES = 0b00111u << 27,
OS_PM_MMCR1_PMC3_PRED_BRANCHES_TAKEN = 0b01000u << 27,
OS_PM_MMCR1_PMC3_COND_STORES_COMPLETED = 0b01010u << 27,
OS_PM_MMCR1_PMC3_FPU_INSTRUCTIONS_COMPLETED = 0b01011u << 27,
OS_PM_MMCR1_PMC3_L2_CASTOUTS_BY_SNOOPS = 0b01100u << 27,
OS_PM_MMCR1_PMC3_L2_CACHE_OPERATIONS = 0b01101u << 27,
OS_PM_MMCR1_PMC3_L1_LOAD_MISS_CYCLES = 0b01111u << 27,
OS_PM_MMCR1_PMC3_SECOND_SPECULATIVE_BRANCH_RESOLVES = 0b10000u << 27,
OS_PM_MMCR1_PMC3_BPU_STALL_LR_CR_CYCLES = 0b10001u << 27,
OS_PM_MMCR1_PMC3_L1_MODIFIED_INTERVENTIONS = 0b10010u << 27,
OS_PM_MMCR1_PMC3_ICBI_SNOOPS = 0b10011u << 27,
OS_PM_MMCR1_PMC3_CIU_ADDRESS_ONLY_REQUESTS = 0b10100u << 27,
OS_PM_MMCR1_PMC3_BIU_LOAD_REQUESTS = 0b10101u << 27,
OS_PM_MMCR1_PMC3_CIU_SHARED_INTERVENTIONS = 0b10110u << 27,
OS_PM_MMCR1_PMC4_CURRENT = 0b00000u << 22,
OS_PM_MMCR1_PMC4_CPU_CYCLES = 0b00001u << 22,
OS_PM_MMCR1_PMC4_INSTRUCTIONS_COMPLETED = 0b00010u << 22,
OS_PM_MMCR1_PMC4_TBL_RISING_TRANSITIONS = 0b00011u << 22,
OS_PM_MMCR1_PMC4_INSTRUCTIONS_DISPATCHED = 0b00100u << 22,
OS_PM_MMCR1_PMC4_L2_CASTOUTS = 0b00101u << 22,
OS_PM_MMCR1_PMC4_DTLB_SEARCH_CYCLES = 0b00110u << 22,
OS_PM_MMCR1_PMC4_BRANCHES_MISPREDICTED = 0b01000u << 22,
OS_PM_MMCR1_PMC4_INTACT_COND_STORES_COMPLETED = 0b01010u << 22,
OS_PM_MMCR1_PMC4_SYNC_INSTRUCTIONS_COMPLETED = 0b01011u << 22,
OS_PM_MMCR1_PMC4_SNOOP_RETRIES = 0b01100u << 22,
OS_PM_MMCR1_PMC4_INTEGER_OPERATIONS = 0b01101u << 22,
OS_PM_MMCR1_PMC4_BPU_STALL_TWO_BRANCHES_CYCLES = 0b01110u << 22,
OS_PM_MMCR1_PMC4_L2_MODIFIED_INTERVENTIONS = 0b10000u << 22,
OS_PM_MMCR1_PMC4_TLBIE_SNOOPS = 0b10001u << 22,
OS_PM_MMCR1_PMC4_L2_BANK_REFRESH_OVERFLOWS = 0b10010u << 22,
OS_PM_MMCR1_PMC4_CIU_ARTRY_COUNT = 0b10100u << 22,
OS_PM_MMCR1_PMC4_BIU_STORE_REQUESTS = 0b10101u << 22,
OS_PM_MMCR1_PMC4_CIU_TWO_CORE_SHARED_INTERVENTIONS = 0b10110u << 22,
} OSPerfMonMMCR1Flags;
/**
* Write to performance monitor registers.
*
* Performance monitor registers can only be written by the kernel, this allows userspace
* to write to them.
*
* \param arg_mask OR-ed values from `OSPerfMonArg`, indicating which of the following
* arguments are to be written to registers.
*
* \param mmcr0 OR-ed values from `OSPerfMonMMCR0Flags` to write to register MMCR0.
* \param mmcr1 OR-ed values from `OSPerfMonMMCR1Flags` to write to register MMCR1.
* \param pmc1 Value to write to register PMC1.
* \param pmc2 Value to write to register PMC2.
* \param pmc3 Value to write to register PMC3.
* \param pmc4 Value to write to register PMC4.
*/
void
OSSetPerformanceMonitor(uint32_t arg_mask,
uint32_t mmcr0,
uint32_t mmcr1,
uint32_t pmc1,
uint32_t pmc2,
uint32_t pmc3,
uint32_t pmc4);
/**
* Convenience function to read from UPMC1.
*/
static inline uint32_t
OSGetUPMC1()
{
uint32_t result;
asm("mfupmc1 %[result]"
: [result] "=r"(result));
return result;
}
/**
* Convenience function to read from UPMC2.
*/
static inline uint32_t
OSGetUPMC2()
{
uint32_t result;
asm("mfupmc2 %[result]"
: [result] "=r"(result));
return result;
}
/**
* Convenience function to read from UPMC3.
*/
static inline uint32_t
OSGetUPMC3()
{
uint32_t result;
asm("mfupmc3 %[result]"
: [result] "=r"(result));
return result;
}
/**
* Convenience function to read from UPMC4.
*/
static inline uint32_t
OSGetUPMC4()
{
uint32_t result;
asm("mfupmc4 %[result]"
: [result] "=r"(result));
return result;
}
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -0,0 +1,106 @@
#pragma once
#include <wut.h>
/**
* \defgroup coreinit_savedframe
* \ingroup coreinit
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef enum OSSavedFrameType
{
OS_SAVED_FRAME_A = 0,
OS_SAVED_FRAME_B = 1,
} OSSavedFrameType;
typedef enum OSSavedFrameScreen
{
OS_SAVED_FRAME_SCREEN_TV = 2,
OS_SAVED_FRAME_SCREEN_DRC = 4,
} OSSavedFrameScreen;
uint32_t
__OSClearSavedFrame(OSSavedFrameType type,
OSSavedFrameScreen screen);
/**
* Gets the GX2Texture saved via \link __OSSetSavedFrame \endlink
* @param ptr_size must be <= 0x100
*/
void
__OSGetSavedFrame(OSSavedFrameScreen screen,
void *outPtr,
uint32_t ptr_size);
/**
* Gets the GX2Texture saved via \link __OSSetSavedFrame \endlink
* @param ptr_size must be <= 0x100
*/
void
__OSGetSavedFrameA(OSSavedFrameScreen screen,
void *outPtr,
uint32_t ptr_size);
/**
* Gets the GX2Texture saved via \link __OSSetSavedFrame \endlink
* @param ptr_size must be <= 0x100
*/
void
__OSGetSavedFrameB(OSSavedFrameScreen screen,
void *outPtr,
uint32_t ptr_size);
BOOL
__OSGetSavedFrameGammaA(OSSavedFrameScreen screen,
float *outGamma);
BOOL
__OSGetSavedFrameGammaB(OSSavedFrameScreen screen,
float *outGamma);
void *
__OSGetSavedFramePtr(OSSavedFrameType type,
OSSavedFrameScreen screen);
void *
__OSGetSavedFramePtrForRead(OSSavedFrameScreen screen);
void *
__OSGetSavedFramePtrForWrite(OSSavedFrameScreen screen);
uint32_t
__OSGetSavedFrames();
uint32_t
__OSGetSavedFramesA();
uint32_t
__OSGetSavedFramesB();
void
__OSResetSavedFrame(OSSavedFrameScreen screen);
/**
*
* @param data expected to be a GX2Texture
* @param size must be <= 0x100
* @return 0 on succes, -1 on error
*/
int
__OSSetSavedFrame(OSSavedFrameScreen screen,
void *data,
uint32_t size);
void
__OSSetSavedFrameGamma(float gamma,
OSSavedFrameScreen screen);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -154,14 +154,14 @@ OSScreenFlipBuffersEx(OSScreenID screen);
* \param screen
* The ID of the screen to draw to. Only the work buffer will be affected.
*
* \param row
* The row, in characters, to place the text in. 0 corresponds to the top of
* the screen.
*
* \param column
* The column, in characters, to place the text at. 0 corresponds to the left of
* the screen.
*
* \param row
* The row, in characters, to place the text in. 0 corresponds to the top of
* the screen.
*
* \param buffer
* Pointer to the string of text to draw. Null-terminated.
*
@ -176,8 +176,8 @@ OSScreenFlipBuffersEx(OSScreenID screen);
*/
void
OSScreenPutFontEx(OSScreenID screen,
uint32_t row,
uint32_t column,
uint32_t row,
const char *buffer);
/**

View File

@ -79,7 +79,8 @@ struct SmdElement
{
SmdElementType type;
uint32_t size;
union {
union
{
uint8_t data[0xf8];
SmdVector spec;
uint32_t vectorPaddr;
@ -96,7 +97,8 @@ struct SmdReceiveData
{
SmdElementType type;
uint32_t size;
union {
union
{
uint8_t message[0x80];
SmdVector spec;
SmdVector *vector;

View File

@ -0,0 +1,93 @@
#pragma once
#include <wut.h>
#include "spinlock.h"
#include "time.h"
/**
* \defgroup coreinit_stopwatch Lock-based Stopwatch
* \ingroup coreinit
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSStopwatch OSStopwatch;
struct OSStopwatch
{
//! Lock
OSSpinLock lock;
//! Tag
const char *name;
//! Number of times the stopwatch has been stopped
uint32_t hitCount;
//! Total time from first start to last stop
OSTime totalTime;
//! Minimum time between stops
OSTime minTime;
//! Maximum time between stops
OSTime maxTime;
//! Last time the watch was started
OSTime startTime;
//! Whether the stopwatch is running
BOOL running;
WUT_PADDING_BYTES(0x4);
};
WUT_CHECK_OFFSET(OSStopwatch, 0x00, lock);
WUT_CHECK_OFFSET(OSStopwatch, 0x10, name);
WUT_CHECK_OFFSET(OSStopwatch, 0x14, hitCount);
WUT_CHECK_OFFSET(OSStopwatch, 0x18, totalTime);
WUT_CHECK_OFFSET(OSStopwatch, 0x20, minTime);
WUT_CHECK_OFFSET(OSStopwatch, 0x28, maxTime);
WUT_CHECK_OFFSET(OSStopwatch, 0x30, startTime);
WUT_CHECK_OFFSET(OSStopwatch, 0x38, running);
WUT_CHECK_SIZE(OSStopwatch, 0x40);
/**
* Initialises the stopwatch,
* stopwatches must be initialized before any other stopwatch functions are used
*/
void
OSInitStopwatch(OSStopwatch *stopwatch,
const char *name);
/**
* Resets all stopwatch data
*/
void
OSResetStopwatch(OSStopwatch *stopwatch);
/**
* Starts the stopwatch.
* if already started, will update the start time without resetting the total time
*/
void
OSStartStopwatch(OSStopwatch *stopwatch);
/**
* Stops the stopwatch and increments hit count.
* Nothing happens if the stopwatch has already been stopped
*/
void
OSStopStopwatch(OSStopwatch *stopwatch);
/**
* Returns the total time the stopwatch has been running
*/
OSTime
OSCheckStopwatch(OSStopwatch *stopwatch);
/**
* Dumps stopwatch info to the Cafe OS warn log
*/
void
OSDumpStopwatch(OSStopwatch *stopwatch);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -0,0 +1,65 @@
#pragma once
#include <wut.h>
#include "time.h"
/**
* \defgroup coreinit_stopwatchatomic Atomic Stopwatch
* \ingroup coreinit
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSStopWatchAtomic OSStopWatchAtomic;
struct OSStopWatchAtomic
{
//! Last time the watch was started
OSTime startTime;
//! Total time from first start to last stop
OSTime totalTime;
};
WUT_CHECK_OFFSET(OSStopWatchAtomic, 0x00, startTime);
WUT_CHECK_OFFSET(OSStopWatchAtomic, 0x08, totalTime);
WUT_CHECK_SIZE(OSStopWatchAtomic, 0x10);
/**
* Start the stopwatch.
* Only updates the start time
* \returns total time on stopwatch
*/
OSTime
OSStopWatchStart(OSStopWatchAtomic *stopWatch);
/**
* Stop the stopwatch.
* Resets the start time to 0
* \returns total time on stopwatch
*/
OSTime
OSStopWatchStop(OSStopWatchAtomic *stopWatch);
/**
* Get the current time on the stopwatch
* \returns current time on stopwatch
*/
OSTime
OSStopWatchLap(OSStopWatchAtomic *stopWatch);
/**
* Stops and resets the stop watch.
* Clears start and total time
* \returns previous total time
*/
OSTime
OSStopWatchReset(OSStopWatchAtomic *stopWatch);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -3,9 +3,9 @@
#include <time.h>
#include "alarm.h"
#include "context.h"
#include "time.h"
#include "threadqueue.h"
#include "exception.h"
#include "threadqueue.h"
#include "time.h"
/**
* \defgroup coreinit_thread Thread
@ -126,7 +126,8 @@ enum OS_THREAD_ATTRIB
OS_THREAD_ATTRIB_UNKNOWN = 1 << 7
};
enum OS_THREAD_TYPE {
enum OS_THREAD_TYPE
{
OS_THREAD_TYPE_DRIVER = 0,
OS_THREAD_TYPE_IO = 1,
OS_THREAD_TYPE_APP = 2

View File

@ -84,6 +84,9 @@ void
OSTicksToCalendarTime(OSTime time,
OSCalendarTime *calendarTime);
BOOL
__OSSetAbsoluteSystemTime(OSTime time);
#ifdef __cplusplus
}
#endif

View File

@ -11,7 +11,8 @@
extern "C" {
#endif
uint64_t OSGetTitleID(void);
uint64_t
OSGetTitleID(void);
#ifdef __cplusplus
}

View File

@ -9,7 +9,8 @@ extern "C" {
int
__OSGetSavedAudioFlags();
int __OSGetTransitionAudioBuffer(void **buffer,
int
__OSGetTransitionAudioBuffer(void **buffer,
uint32_t *size);
void

View File

@ -1,5 +1,6 @@
#pragma once
#include <wut.h>
#include <gx2/semaphore.h>
/**
* \defgroup dmae_sync Synchronization
@ -14,6 +15,12 @@ extern "C" {
//! Timestamp for a DMAE operation.
typedef uint64_t DMAETimeStamp;
DMAETimeStamp
DMAEGetLastSubmittedTimeStamp(void);
DMAETimeStamp
DMAEGetRetiredTimeStamp(void);
/**
* Waits for a DMAE operation to complete.
*
@ -26,6 +33,16 @@ typedef uint64_t DMAETimeStamp;
BOOL
DMAEWaitDone(DMAETimeStamp timestamp);
uint32_t
DMAEGetTimeout(void);
void
DMAESetTimeout(uint32_t timeout);
void
DMAESemaphore(GX2Semaphore *semaphore,
GX2SemaphoreAction action);
#ifdef __cplusplus
}
#endif

View File

@ -17,30 +17,52 @@ struct FSClient;
namespace Rpl
{
void ErrEulaSetVersion(int version);
bool ErrEulaJump(const char *buffer, uint32_t bufferSize);
void ErrEulaPlayAppearSE(bool playAppearSoundEffect);
bool ErrEulaIsSelectCursorActive();
void ErrEulaChangeLang(nn::erreula::LangType language);
void ErrEulaDisappearHomeNixSign();
bool ErrEulaIsAppearHomeNixSign();
void ErrEulaAppearHomeNixSign(const nn::erreula::HomeNixSignArg &arg);
void ErrEulaSetControllerRemo(nn::erreula::ControllerType controller);
int32_t ErrEulaGetSelectButtonNumError();
int32_t ErrEulaGetResultCode();
nn::erreula::ResultType ErrEulaGetResultType();
nn::erreula::State ErrEulaGetStateErrorViewer();
bool ErrEulaIsDecideSelectRightButtonError();
bool ErrEulaIsDecideSelectLeftButtonError();
bool ErrEulaIsDecideSelectButtonError();
void ErrEulaDisappearError();
void ErrEulaAppearError(const nn::erreula::AppearArg &arg);
void ErrEulaCalc(const nn::erreula::ControllerInfo &controllerInfo);
void ErrEulaDrawDRC();
void ErrEulaDrawTV();
void ErrEulaDestroy();
void ErrEulaCreate(void *workMemory, nn::erreula::RegionType region,
nn::erreula::LangType language, FSClient *fsClient);
void
ErrEulaSetVersion(int version);
bool
ErrEulaJump(const char *buffer, uint32_t bufferSize);
void
ErrEulaPlayAppearSE(bool playAppearSoundEffect);
bool
ErrEulaIsSelectCursorActive();
void
ErrEulaChangeLang(nn::erreula::LangType language);
void
ErrEulaDisappearHomeNixSign();
bool
ErrEulaIsAppearHomeNixSign();
void
ErrEulaAppearHomeNixSign(const nn::erreula::HomeNixSignArg &arg);
void
ErrEulaSetControllerRemo(nn::erreula::ControllerType controller);
int32_t
ErrEulaGetSelectButtonNumError();
int32_t
ErrEulaGetResultCode();
nn::erreula::ResultType
ErrEulaGetResultType();
nn::erreula::State
ErrEulaGetStateErrorViewer();
bool
ErrEulaIsDecideSelectRightButtonError();
bool
ErrEulaIsDecideSelectLeftButtonError();
bool
ErrEulaIsDecideSelectButtonError();
void
ErrEulaDisappearError();
void
ErrEulaAppearError(const nn::erreula::AppearArg &arg);
void
ErrEulaCalc(const nn::erreula::ControllerInfo &controllerInfo);
void
ErrEulaDrawDRC();
void
ErrEulaDrawTV();
void
ErrEulaDestroy();
void
ErrEulaCreate(void *workMemory, nn::erreula::RegionType region, nn::erreula::LangType language, FSClient *fsClient);
} // namespace Rpl

62
include/gx2/aperture.h Normal file
View File

@ -0,0 +1,62 @@
#pragma once
#include <wut.h>
#include "enum.h"
#include "surface.h"
/**
* \defgroup gx2_aperture Aperture
* \ingroup gx2
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef uint32_t GX2ApertureHandle;
/**
* Allocates a tiling aperture.
* This function creates a linear and untiled buffer to read from and write to the surface.
* The total size of the buffer will be width * height * bpp.
*
* \param surface
* A pointer to the surface to create the tiling aperture for.
*
* \param level
* The level of the surface to create the tiling aperture for.
*
* \param depth
* The depth of the surface to create the tiling aperture for.
*
* \param endian
* The endian swap mode.
*
* \param outHandle
* A pointer to store the handle for the aperture.
*
* \param outAddress
* A pointer to store the address for the aperture.
*/
void
GX2AllocateTilingApertureEx(GX2Surface *surface,
uint32_t level,
uint32_t depth,
GX2EndianSwapMode endian,
GX2ApertureHandle *outHandle,
void **outAddress);
/**
* Frees an allocated tiling aperture.
*
* \param handle
* The handle of the tiling aperture which should be freed.
*/
void
GX2FreeTilingAperture(GX2ApertureHandle handle);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -57,6 +57,9 @@ void
GX2SetDRCScale(uint32_t x,
uint32_t y);
GX2AspectRatio
GX2GetSystemTVAspectRatio();
GX2TVScanMode
GX2GetSystemTVScanMode();

View File

@ -22,6 +22,7 @@ extern "C" {
#define GX2_SHADER_PROGRAM_ALIGNMENT (0x100)
#define GX2_VERTEX_BUFFER_ALIGNMENT (0x40)
#define GX2_INDEX_BUFFER_ALIGNMENT (0x20)
#define GX2_UNIFORM_BLOCK_ALIGNMENT (0x100)
#define GX2_COMMAND_BUFFER_SIZE (0x400000)
@ -29,7 +30,8 @@ typedef enum GX2AAMode
{
GX2_AA_MODE1X = 0,
GX2_AA_MODE2X = 1,
GX2_AA_MODE4X = 2
GX2_AA_MODE4X = 2,
GX2_AA_MODE8X = 3,
} GX2AAMode;
typedef enum GX2AlphaToMaskMode
@ -41,6 +43,12 @@ typedef enum GX2AlphaToMaskMode
GX2_ALPHA_TO_MASK_MODE_DITHER_270 = 4,
} GX2AlphaToMaskMode;
typedef enum GX2AspectRatio
{
GX2_ASPECT_RATIO_4_3 = 0,
GX2_ASPECT_RATIO_16_9 = 1,
} GX2AspectRatio;
typedef enum GX2AttribFormat
{
GX2_ATTRIB_TYPE_8 = 0x00,
@ -120,6 +128,8 @@ typedef enum GX2BlendMode
GX2_BLEND_MODE_INV_SRC1_COLOR = 16,
GX2_BLEND_MODE_SRC1_ALPHA = 17,
GX2_BLEND_MODE_INV_SRC1_ALPHA = 18,
GX2_BLEND_MODE_CONSTANT_ALPHA = 19,
GX2_BLEND_MODE_INV_CONSTANT_ALPHA = 20,
} GX2BlendMode;
typedef enum GX2BlendCombineMode
@ -164,6 +174,8 @@ typedef enum GX2ClearFlags
GX2_CLEAR_FLAGS_BOTH = (GX2_CLEAR_FLAGS_DEPTH | GX2_CLEAR_FLAGS_STENCIL),
} GX2ClearFlags;
WUT_ENUM_BITMASK_TYPE(GX2ClearFlags)
typedef enum GX2CompareFunction
{
GX2_COMPARE_FUNC_NEVER = 0,
@ -334,6 +346,14 @@ typedef enum GX2ScanTarget
GX2_SCAN_TARGET_DRC = GX2_SCAN_TARGET_DRC0,
} GX2ScanTarget;
WUT_ENUM_BITMASK_TYPE(GX2ScanTarget)
typedef enum GX2SemaphoreAction
{
GX2_SEMAPHORE_ACTION_WAIT = 0,
GX2_SEMAPHORE_ACTION_SIGNAL = 1,
} GX2SemaphoreAction;
typedef enum GX2ShaderMode
{
GX2_SHADER_MODE_UNIFORM_REGISTER = 0,
@ -518,7 +538,10 @@ typedef enum GX2TexClampMode
GX2_TEX_CLAMP_MODE_MIRROR = 1,
GX2_TEX_CLAMP_MODE_CLAMP = 2,
GX2_TEX_CLAMP_MODE_MIRROR_ONCE = 3,
GX2_TEX_CLAMP_MODE_CLAMP_HALF_BORDER = 4,
GX2_TEX_CLAMP_MODE_MIRROR_ONCE_HALF_BORDER = 5,
GX2_TEX_CLAMP_MODE_CLAMP_BORDER = 6,
GX2_TEX_CLAMP_MODE_MIRROR_ONCE_BORDER = 7,
} GX2TexClampMode;
typedef enum GX2TexMipFilterMode
@ -537,11 +560,16 @@ typedef enum GX2TexXYFilterMode
{
GX2_TEX_XY_FILTER_MODE_POINT = 0,
GX2_TEX_XY_FILTER_MODE_LINEAR = 1,
GX2_TEX_XY_FILTER_MODE_BICUBIC = 2,
} GX2TexXYFilterMode;
typedef enum GX2TexAnisoRatio
{
GX2_TEX_ANISO_RATIO_NONE = 0,
GX2_TEX_ANISO_RATIO_2_TO_1 = 1,
GX2_TEX_ANISO_RATIO_4_TO_1 = 2,
GX2_TEX_ANISO_RATIO_8_TO_1 = 3,
GX2_TEX_ANISO_RATIO_16_TO_1 = 4,
} GX2TexAnisoRatio;
typedef enum GX2TexZFilterMode

34
include/gx2/semaphore.h Normal file
View File

@ -0,0 +1,34 @@
#pragma once
#include <wut.h>
#include "enum.h"
/**
* \defgroup gx2_semaphore Semaphore
* \ingroup gx2
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef uint64_t GX2Semaphore;
/**
* Inserts a semaphore into the command stream.
*
* \param semaphore
* Address of the semaphore. Must be aligned by \c 0x8.
*
* \param action
* Semaphore operation to perform.
*/
void
GX2SetSemaphore(GX2Semaphore *semaphore,
GX2SemaphoreAction action);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,9 +1,9 @@
#pragma once
#include <string.h>
#include <wut.h>
#include <string.h>
#include "enum.h"
#include "sampler.h"
#include "gx2r/buffer.h"
#include "sampler.h"
/**
* \defgroup gx2_shader Shaders
@ -427,9 +427,12 @@ GX2SetGeometryUniformBlock(uint32_t location,
void
GX2SetShaderModeEx(GX2ShaderMode mode,
uint32_t numVsGpr, uint32_t numVsStackEntries,
uint32_t numGsGpr, uint32_t numGsStackEntries,
uint32_t numPsGpr, uint32_t numPsStackEntries);
uint32_t numVsGpr,
uint32_t numVsStackEntries,
uint32_t numGsGpr,
uint32_t numGsStackEntries,
uint32_t numPsGpr,
uint32_t numPsStackEntries);
void
GX2SetStreamOutEnable(BOOL enable);

View File

@ -1,4 +1,5 @@
#pragma once
#include <wut.h>
#include "enum.h"
@ -24,6 +25,12 @@ GX2Flush();
void
GX2ResetGPU(uint32_t unknown);
/**
* @return -1 if GX2 is not running, on success the core where GX2Init has been called is returned.
*/
int
GX2GetMainCoreId();
#ifdef __cplusplus
}
#endif

View File

@ -1,6 +1,6 @@
#pragma once
#include <gx2r/resource.h>
#include <wut.h>
#include <gx2r/resource.h>
#include "enum.h"
/**
@ -28,7 +28,8 @@ struct GX2Surface
uint32_t mipLevels;
GX2SurfaceFormat format;
GX2AAMode aa;
union {
union
{
GX2SurfaceUse use;
GX2RResourceFlags resourceFlags;
};

View File

@ -80,7 +80,7 @@ H264DECSetParam_OUTPUT_PER_FRAME(void *memory,
*/
H264Error
H264DECSetParam_USER_MEMORY(void *memory,
void *value);
void **value);
/**

View File

@ -1,4 +1,5 @@
#pragma once
#include <wut.h>
/**
* \defgroup h264_stream H264 Stream

View File

@ -59,23 +59,31 @@ WUT_CHECK_SIZE(MICStatus, 0x0C);
* The second parameter to MICInit is unused, any value is valid.
*/
MICHandle
MICInit(MICInstance instance, int unused, MICWorkMemory *workMemory,
MICInit(MICInstance instance,
int unused,
MICWorkMemory *workMemory,
MICError *outError);
MICError
MICOpen(MICHandle handle);
MICError
MICGetState(MICHandle handle, int state, uint32_t *outStateVal);
MICGetState(MICHandle handle,
int state,
uint32_t *outStateVal);
MICError
MICSetState(MICHandle handle, int state, uint32_t stateVal);
MICSetState(MICHandle handle,
int state,
uint32_t stateVal);
MICError
MICGetStatus(MICHandle handle, MICStatus *outStatus);
MICGetStatus(MICHandle handle,
MICStatus *outStatus);
MICError
MICSetDataConsumed(MICHandle handle, int dataAmountConsumed);
MICSetDataConsumed(MICHandle handle,
int dataAmountConsumed);
MICError
MICClose(MICHandle handle);

View File

@ -15,17 +15,31 @@
#define IP_TOS 3
#define IP_TTL 4
#define IP_MULTICAST_IF 9
#define IP_MULTICAST_TTL 10
#define IP_MULTICAST_LOOP 11
#define IP_ADD_MEMBERSHIP 12
#define IP_DROP_MEMBERSHIP 13
#define IP_UNKNOWN 14
typedef uint16_t in_port_t;
typedef uint32_t in_addr_t;
struct in_addr {
struct in_addr
{
in_addr_t s_addr;
};
struct sockaddr_in {
struct sockaddr_in
{
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
unsigned char sin_zero[8];
};
struct ip_mreq
{
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
};

View File

@ -6,3 +6,4 @@
#define TCP_NOACKDELAY 0x2002
#define TCP_MAXSEG 0x2003
#define TCP_NODELAY 0x2004
#define TCP_UNKNOWN 0x2005 // amount of mss received before sending an ack

4
include/nfc/nfc.dox Normal file
View File

@ -0,0 +1,4 @@
/**
* \defgroup nfc nfc
* Near Field Communication (NFC).
*/

1287
include/nfc/nfc.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
#pragma once
#include <wut.h>
#include <nn/result.h>
#include <nsysnet/netconfig.h>
/**
* \defgroup nn_ac_cpp Auto Connect C++ API
@ -24,103 +25,55 @@ namespace ac
* An ID number representing a network configuration. These are the same IDs as
* shown in System Settings' Connection List.
*/
typedef uint32_t ConfigIdNum;
using ConfigIdNum = uint32_t;
/**
* C++ linkage for the autoconnect API, see \link nn::ac \endlink for use.
* Cafe provides mangled symbols for C++ APIs, so nn::ac is actually static
* inline calls to the mangled symbols under nn::ac::detail.
* The configuration for a given network profile (from 1 to 6).
* \sa NetConfCfg
*/
namespace detail
using Config = NetConfCfg;
using ErrorCode = uint32_t;
enum Status
{
extern "C"
{
nn::Result Initialize__Q2_2nn2acFv();
void Finalize__Q2_2nn2acFv();
nn::Result Connect__Q2_2nn2acFv();
nn::Result ConnectAsync__Q2_2nn2acFv();
nn::Result Close__Q2_2nn2acFv();
nn::Result GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status();
nn::Result GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(ConfigIdNum *id);
nn::Result Connect__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum(ConfigIdNum id);
nn::Result GetAssignedAddress__Q2_2nn2acFPUl(uint32_t *ip);
} // extern "C"
} // namespace detail
/**
* Initialise the Auto Connect library. Call this function before any other nn::ac
* functions.
*
* \return
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
* and \link nn::Result::IsFailure \endlink.
*
* \sa
* - \link Finalize \endlink
*/
static inline nn::Result
Initialize()
{
return detail::Initialize__Q2_2nn2acFv();
}
/**
* Cleanup the Auto Connect library. Do not call any nn::ac functions (other
* than \link Initialize \endlink) after calling this function.
*
* \sa
* - \link Initialize \endlink
*/
static inline void
Finalize()
{
return detail::Finalize__Q2_2nn2acFv();
}
STATUS_FAILED = -1,
STATUS_OK = 0,
STATUS_PROCESSING = 1,
};
/**
* Gets the default connection configuration id. This is the default as marked
* in System Settings.
*
* \param id
* A pointer to an \link ConfigIdNum \endlink to write the config ID to. Must
* not be a \c nullptr.
*
* \return
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
* and \link nn::Result::IsFailure \endlink.
*/
static inline nn::Result
GetStartupId(ConfigIdNum *id)
{
return detail::GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(id);
}
nn::Result
BeginLocalConnection(bool unknown)
asm("BeginLocalConnection__Q2_2nn2acFb");
static inline nn::Result
Connect()
{
return detail::Connect__Q2_2nn2acFv();
}
void
ClearConfig(Config *cfg)
asm("ClearConfig__Q2_2nn2acFP16netconf_profile_");
static inline nn::Result
ConnectAsync()
{
return detail::ConnectAsync__Q2_2nn2acFv();
}
static inline nn::Result
nn::Result
Close()
{
return detail::Close__Q2_2nn2acFv();
}
asm("Close__Q2_2nn2acFv");
static inline nn::Result
GetCloseStatus()
{
return detail::GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status();
}
nn::Result
CloseAll()
asm("CloseAll__Q2_2nn2acFv");
nn::Result
Connect(const Config *cfg)
asm("Connect__Q2_2nn2acFPC16netconf_profile_");
nn::Result
Connect(ConfigIdNum id)
asm("Connect__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
nn::Result
Connect()
asm("Connect__Q2_2nn2acFv");
nn::Result
ConnectAsync(const Config *cfg)
asm("ConnectAsync__Q2_2nn2acFPC16netconf_profile_");
/**
* Connects to a network, using the configuration represented by the given
@ -133,11 +86,36 @@ GetCloseStatus()
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
* and \link nn::Result::IsFailure \endlink.
*/
static inline nn::Result
Connect(ConfigIdNum id)
{
return detail::Connect__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum(id);
}
nn::Result
ConnectAsync(ConfigIdNum id)
asm("ConnectAsync__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
nn::Result
ConnectAsync()
asm("ConnectAsync__Q2_2nn2acFv");
nn::Result
ConnectWithRetry()
asm("ConnectWithRetry__Q2_2nn2acFv");
nn::Result
DeleteConfig(ConfigIdNum id)
asm("DeleteConfig__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
nn::Result
EndLocalConnection()
asm("EndLocalConnection__Q2_2nn2acFv");
/**
* Cleans up the Auto Connect library. Do not call any nn::ac functions (other
* than \link Initialize \endlink) after calling this function.
*
* \sa
* - \link Initialize \endlink
*/
void
Finalize()
asm("Finalize__Q2_2nn2acFv");
/**
* Gets the IP address assosciated with the currently active connection.
@ -151,11 +129,120 @@ Connect(ConfigIdNum id)
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
* and \link nn::Result::IsFailure \endlink.
*/
static inline nn::Result
nn::Result
GetAssignedAddress(uint32_t *ip)
{
return detail::GetAssignedAddress__Q2_2nn2acFPUl(ip);
}
asm("GetAssignedAddress__Q2_2nn2acFPUl");
nn::Result
GetAssignedAlternativeDns(uint32_t *ip)
asm("GetAssignedAlternativeDns__Q2_2nn2acFPUl");
nn::Result
GetAssignedGateway(uint32_t *ip)
asm("GetAssignedGateway__Q2_2nn2acFPUl");
nn::Result
GetAssignedPreferedDns(uint32_t *ip)
asm("GetAssignedPreferedDns__Q2_2nn2acFPUl");
nn::Result
GetAssignedSubnet(uint32_t *ip)
asm("GetAssignedSubnet__Q2_2nn2acFPUl");
nn::Result
GetCloseStatus(Status *status)
asm("GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status");
nn::Result
GetCompatId(ConfigIdNum *id)
asm("GetCompatId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum");
nn::Result
GetConnectResult(nn::Result *result)
asm("GetConnectResult__Q2_2nn2acFPQ2_2nn6Result");
nn::Result
GetConnectStatus(Status *status)
asm("GetConnectStatus__Q2_2nn2acFPQ3_2nn2ac6Status");
nn::Result
GetLastErrorCode(ErrorCode *error)
asm("GetLastErrorCode__Q2_2nn2acFPUi");
nn::Result
GetRunningConfig(Config *cfg)
asm("GetRunningConfig__Q2_2nn2acFP16netconf_profile_");
/**
* Gets the default connection configuration id. This is the default as marked
* in System Settings.
*
* \param id
* A pointer to an \link ConfigIdNum \endlink to write the config ID to. Must
* not be a \c nullptr.
*
* \return
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
* and \link nn::Result::IsFailure \endlink.
*/
nn::Result
GetStartupId(ConfigIdNum *id)
asm("GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum");
/**
* Initializes the Auto Connect library. Call this function before any other nn::ac
* functions.
*
* \return
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
* and \link nn::Result::IsFailure \endlink.
*
* \sa
* - \link Finalize \endlink
*/
nn::Result
Initialize()
asm("Initialize__Q2_2nn2acFv");
nn::Result
IsAnyKeepingConnect(bool keeping)
asm("IsAnyKeepingConnect__Q2_2nn2acFPb");
nn::Result
IsApplicationConnected(bool *connected)
asm("IsApplicationConnected__Q2_2nn2acFPb");
nn::Result
IsAutoConnectionFatallyFailed(nn::Result *failed)
asm("IsAutoConnectionFatallyFailed__Q2_2nn2acFQ2_2nn6Result");
nn::Result
IsConfigExisting(ConfigIdNum id, bool *existing)
asm("IsConfigExisting__Q2_2nn2acFQ3_2nn2ac11ConfigIdNumPb");
nn::Result
IsKeepingConnect(bool *keeping)
asm("IsKeepingConnect__Q2_2nn2acFPb");
nn::Result
IsReadyToConnect(bool *ready)
asm("IsReadyToConnect__Q2_2nn2acFPb");
nn::Result
ReadConfig(ConfigIdNum id, Config *cfg)
asm("ReadConfig__Q2_2nn2acFQ3_2nn2ac11ConfigIdNumP16netconf_profile_");
nn::Result
SetCompatId(ConfigIdNum id)
asm("SetCompatId__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
nn::Result
SetStartupId(ConfigIdNum id)
asm("SetStartupId__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
nn::Result
WriteConfig(ConfigIdNum id, const Config *cfg)
asm("WriteConfig__Q2_2nn2acFQ3_2nn2ac11ConfigIdNumPC16netconf_profile_");
} // namespace ac
} // namespace nn

View File

@ -7,8 +7,8 @@
#include <nn/acp/client.h>
#include <nn/acp/device.h>
#include <nn/acp/drcled_c.h>
#include <nn/acp/drcled_cpp.h>
#include <nn/acp/result.h>
#include <nn/acp/save.h>
#include <nn/acp/title.h>
#include <nn/acp/drcled_c.h>
#include <nn/acp/drcled_cpp.h>

View File

@ -12,7 +12,15 @@
extern "C" {
#endif
typedef int32_t ACPDeviceType;
typedef enum ACPDeviceType
{
ACP_DEVICE_TYPE_AUTO = 1,
ACP_DEVICE_TYPE_ODD = 2,
ACP_DEVICE_TYPE_HFIODISC = 2, /* when ApplicationDevice is emulated */
ACP_DEVICE_TYPE_MLC = 3,
ACP_DEVICE_TYPE_HFIOMLC = 3, /* when ApplicationDevice is emulated */
ACP_DEVICE_TYPE_USB = 4,
} ACPDeviceType;
ACPResult
ACPCheckApplicationDeviceEmulation(BOOL *emulation);

View File

@ -1,8 +1,8 @@
#pragma once
#include <wut.h>
#include <nn/acp/result.h>
#include <nn/acp/device.h>
#include <nn/acp/result.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,14 +1,16 @@
#pragma once
#include <wut.h>
#include <nn/acp/result.h>
#include <nn/acp/device.h>
#include <nn/acp/result.h>
#ifdef __cplusplus
namespace nn {
namespace nn
{
namespace acp {
namespace acp
{
typedef uint8_t DrcLedStatus;
typedef uint32_t DrcLedPattern;

View File

@ -8,7 +8,8 @@
* @{
*/
typedef enum ACPResult {
typedef enum ACPResult
{
ACP_RESULT_SUCCESS = 0,
ACP_RESULT_INVALID = -200,

View File

@ -1,7 +1,7 @@
#pragma once
#include <wut.h>
#include <nn/acp/result.h>
#include <nn/acp/device.h>
#include <nn/acp/result.h>
/**
* \defgroup nn_acp_save Save
@ -15,6 +15,21 @@
extern "C" {
#endif
typedef uint64_t ACPTitleId;
typedef struct ACPSaveDirInfo ACPSaveDirInfo;
struct WUT_PACKED ACPSaveDirInfo
{
WUT_UNKNOWN_BYTES(0x8);
uint32_t persistentId;
WUT_UNKNOWN_BYTES(0x14);
char path[0x40];
WUT_PADDING_BYTES(0x80 - 0x60);
};
WUT_CHECK_OFFSET(ACPSaveDirInfo, 0x08, persistentId);
WUT_CHECK_OFFSET(ACPSaveDirInfo, 0x20, path);
WUT_CHECK_SIZE(ACPSaveDirInfo, 0x80);
ACPResult
ACPCreateSaveDir(uint32_t persistentId,
ACPDeviceType deviceType);
@ -28,6 +43,48 @@ ACPMountExternalStorage();
ACPResult
ACPMountSaveDir();
/**
* Deletes the given user's save data directory for the given title.
*
* \param persistentId
* The persistent ID of the user. Pass \c 0 to delete the 'common' directory.
*
* \return
* ACP_RESULT_SUCCESS on success.
*/
ACPResult
ACPRemoveSaveDir(uint32_t persistentId,
uint64_t titleId,
ACPDeviceType deviceType);
/**
* Deletes the given user's save data directory for the given title.
*
* \param persistentId
* The persistent ID of the user. Pass \c 0 to delete the 'common' directory.
*
* \return
* ACP_RESULT_SUCCESS on success.
*/
ACPResult
ACPRemoveSaveDirWithoutFlush(uint32_t persistentId,
uint64_t titleId,
ACPDeviceType deviceType);
/**
* Deletes the given user's save data directory for the given title.
*
* \param persistentId
* The persistent ID of the user. Pass \c 0 to delete the 'common' directory.
*
* \return
* ACP_RESULT_SUCCESS on success.
*/
ACPResult
ACPRemoveSaveDirWithoutMetaCheck(uint32_t persistentId,
uint64_t titleId,
ACPDeviceType deviceType);
ACPResult
ACPRepairSaveMetaDir();
@ -37,6 +94,59 @@ ACPUnmountExternalStorage();
ACPResult
ACPUnmountSaveDir();
/**
* Gets all titles id which have save data
*
* @param deviceType
* @param titlesOut needs to be aligned to 0x40
* @param maxCount needs to be a multiple of 8
* @param countOut
* @return ACP_RESULT_SUCCESS on success.
*/
ACPResult
ACPGetSaveDataTitleIdList(ACPDeviceType deviceType,
uint64_t *titlesOut,
uint32_t maxCount,
uint32_t *countOut);
/**
* Gets a list of all saves dir for a given title id
*
* @param titleId
* @param deviceType
* @param u1 seems to be always 0
* @param saveDirInfo needs to be aligned to 0x40
* @param maxCount
* @param countOut
* @return ACP_RESULT_SUCCESS on success.
*/
ACPResult
ACPGetTitleSaveDirEx(uint64_t titleId,
ACPDeviceType deviceType,
uint32_t u1,
ACPSaveDirInfo *saveDirInfo,
uint32_t maxCount,
uint32_t *countOut);
/**
* Gets a list of all saves dir for a given title id
*
* @param titleId
* @param deviceType
* @param u1 seems to be always 0
* @param saveDirInfo needs to be aligned to 0x40
* @param maxCount
* @param countOut
* @return ACP_RESULT_SUCCESS on success.
*/
ACPResult
ACPGetTitleSaveDirExWithoutMetaCheck(uint64_t titleId,
ACPDeviceType deviceType,
uint32_t u1,
ACPSaveDirInfo *saveDirInfo,
uint32_t maxCount,
uint32_t *countOut);
#ifdef __cplusplus
}
#endif

View File

@ -1,9 +1,9 @@
#pragma once
#include <wut.h>
#include <nn/acp/result.h>
#include <nn/acp/device.h>
#include <coreinit/mcp.h>
#include <nn/acp/device.h>
#include <nn/acp/result.h>
/**
* \defgroup nn_acp_title Title
@ -20,7 +20,8 @@ extern "C" {
typedef uint64_t ACPTitleId;
typedef struct ACPMetaXml ACPMetaXml;
struct WUT_PACKED ACPMetaXml {
struct WUT_PACKED ACPMetaXml
{
uint64_t title_id;
uint64_t boss_id;
uint64_t os_version;
@ -249,9 +250,11 @@ ACPGetTitleIdOfMainApplication(ACPTitleId* titleId);
* @param metaXml must be aligned to 0x40
* @return ACP_RESULT_SUCCESS on success
*/
// clang-format off
ACPResult
RPLWRAP(ACPGetTitleMetaXml)(ACPTitleId titleId,
ACPMetaXml *metaXml);
// clang-format on
/**
* Gets the MetaXML for a given title id
@ -262,19 +265,56 @@ RPLWRAP(ACPGetTitleMetaXml)(ACPTitleId titleId,
*/
static inline ACPResult
ACPGetTitleMetaXml(ACPTitleId titleId,
ACPMetaXml *metaXml) {
ACPMetaXml *metaXml)
{
if ((uintptr_t)metaXml & 0x3F) {
return ACP_RESULT_INVALID_PARAMETER;
}
return RPLWRAP(ACPGetTitleMetaXml)(titleId, metaXml);
}
// clang-format off
ACPResult
RPLWRAP(ACPGetTitleSaveMetaXml)(uint64_t titleId,
ACPMetaXml* metaXml,
ACPDeviceType deviceType);
// clang-format on
/**
* Gets the save dir MetaXML for a given title id
* @param titleId
* @param metaXml must be aligned to 0x40
* @param deviceType
* @return ACP_RESULT_SUCCESS on success,
* ACP_RESULT_INVALID_PARAMETER if metaXml is not aligned properly
*/
static inline ACPResult
ACPGetTitleSaveMetaXml(ACPTitleId titleId,
ACPMetaXml *metaXml,
ACPDeviceType deviceType)
{
if ((uintptr_t)metaXml & 0x3F) {
return ACP_RESULT_INVALID_PARAMETER;
}
return RPLWRAP(ACPGetTitleSaveMetaXml)(titleId, metaXml, deviceType);
}
ACPResult
ACPGetTitleMetaDir(ACPTitleId titleId,
char *directory,
size_t directoryLen);
ACPResult
ACPGetTitleMetaDirByDevice(ACPTitleId titleId,
char *directory,
size_t directoryLen,
ACPDeviceType deviceType);
ACPResult
ACPGetTitleMetaDirByTitleListType(MCPTitleListType titleListType,
char *directory,
size_t directoryLen);
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +1,7 @@
#pragma once
#include <wut.h>
#include <nn/result.h>
#include <nn/ffl/miidata.h>
#include <nn/result.h>
/**
* \defgroup nn_act_client Accounts Client API
@ -12,9 +12,11 @@
#ifdef __cplusplus
namespace nn {
namespace nn
{
namespace act {
namespace act
{
//https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/nn/act/nn_act_types.h

View File

@ -1,5 +1,6 @@
#pragma once
#include <wut.h>
#include <coreinit/time.h>
/**
* \defgroup nn_ccr_sys
@ -12,6 +13,8 @@
extern "C" {
#endif
typedef struct CCRSysUpdateState CCRSysUpdateState;
typedef enum CCRSysPairingState
{
//! Pairing is complete / hasn't started yet
@ -22,6 +25,29 @@ typedef enum CCRSysPairingState
CCR_SYS_PAIRING_TIMED_OUT = 2,
} CCRSysPairingState;
typedef enum CCRSysInitBootFlag
{
CCR_SYS_BOOT_FLAG_NONE = 0,
//! Shows "Turn on the TV and Wii U Console.." text on next DRC boot
CCR_SYS_BOOT_FLAG_FIRST_BOOT = 1,
} CCRSysInitBootFlag;
typedef enum CCRSysLCDMode
{
CCR_SYS_LCD_MODE_BRIGHTNESS_1 = 1,
CCR_SYS_LCD_MODE_BRIGHTNESS_2 = 2,
CCR_SYS_LCD_MODE_BRIGHTNESS_3 = 3,
CCR_SYS_LCD_MODE_BRIGHTNESS_4 = 4,
CCR_SYS_LCD_MODE_BRIGHTNESS_5 = 5,
} CCRSysLCDMode;
struct CCRSysUpdateState
{
uint32_t state;
//! Progress from 0-100
uint32_t progress;
};
void
CCRSysInit(void);
@ -105,6 +131,184 @@ CCRSysGetPairingState(void);
int32_t
CCRSysGetPincode(uint32_t *pin);
/**
* Sets the DRH system time.
*
* \param time
* The system time in ticks.
*
* \return
* 0 on success.
*/
int32_t
CCRSysSetSystemTime(OSTime time);
/**
* Check if a DRC firmware update is needed.
* This function additionally verifies the DRC area compared to \link __CCRSysNeedsDRCFWUpdate \endlink.
*
* \param drcSlot
* Slot from 0 to 1.
*
* \param outNeedsUpdate
* Pointer to store the result to.
*
* \return
* 0 on success.
*/
int32_t
CCRSysNeedsDRCFWUpdate(uint32_t drcSlot,
BOOL *outNeedsUpdate);
/**
* Check if a DRC firmware update is needed.
*
* \param drcSlot
* Slot from 0 to 1.
*
* \param outNeedsUpdate
* Pointer to store the result to.
*
* \param allowDowngrade
* Only check if the installed version doesn't match the running version,
* instead of checking that it's greater.
*
* \return
* 0 on success.
*/
int32_t
__CCRSysNeedsDRCFWUpdate(uint32_t drcSlot,
BOOL *outNeedsUpdate,
BOOL allowDowngrade);
/**
* Starts a DRC firmware update if necessary and region matches.
*
* \note
* This function will wait for \link CCRSysDRCFWUpdateForward \endlink to be called once done.
* See \link CCRSysGetUpdateState \endlink for status and progress.
*
* \param drcSlot
* Slot from 0 to 1.
*
* \return
* 0 on success.
*/
int32_t
CCRSysDRCFWUpdate(uint32_t drcSlot);
/**
* Starts a DRC firmware update if necessary.
*
* \note
* This function will wait for \link CCRSysDRCFWUpdateForward \endlink to be called once done.
* See \link CCRSysGetUpdateState \endlink for status and progress.
*
* \param drcSlot
* Slot from 0 to 1.
*
* \param allowDowngrade
* Only check if the installed version doesn't match the running version,
* instead of checking that it's greater.
* There are additional checks on the IOS side and this doesn't actually allow downgrading the firmware.
*
* \return
* 0 on success.
*/
int32_t
__CCRSysDRCFWUpdate(uint32_t drcSlot,
BOOL allowDowngrade);
/**
* Finish a pending DRC firmware update.
*/
void
CCRSysDRCFWUpdateForward(void);
/**
* Get the update state during a pending DRC firmware update.
*
* \param outUpdateState
* Pointer to store the state to.
*/
void
CCRSysGetUpdateState(CCRSysUpdateState *outUpdateState);
/**
* Initialize a DRC reattach.
*
* \param drcSlot
* Slot from 0 to 1.
*/
void
__CCRSysInitReattach(uint32_t drcSlot);
/**
* Wait for the DRC to reattach.
* This returns once the DRC disconnects and reconnects or a timeout is reached.
*
* \param drcSlot
* Slot from 0 to 1.
*
* \return
* 0 on success.
*/
int32_t
__CCRSysWaitReattach(uint32_t drcSlot,
BOOL unknown);
/**
* Get the version check flag.
*
* \param outFlag
* Pointer to write the flag to.
*
* \return
* 0 on success.
*/
int32_t
CCRSysGetVersionCheckFlag(uint32_t *outFlag);
/**
* Set the version check flag.
*
* \param outFlag
* The flag to set.
*
* \return
* 0 on success.
*/
int32_t
CCRSysSetVersionCheckFlag(uint32_t flag);
int32_t
CCRSysCaffeineSetCaffeineSlot(uint32_t slot);
int32_t
CCRSysSetInitBootFlag(CCRSysInitBootFlag flag);
/**
* Resets the DRC (It'll show "Turn on the TV and Wii U console" until paired)
* @return 0 on success, -1 on error.
*/
int32_t
CCRSysInitializeSettings();
/**
* Sets the brightness of the DRC.
* @return 0 on success, -1 on error.
*/
int32_t
CCRSysSetCurrentLCDMode(CCRSysLCDMode mode);
/**
* Gets the brightness of the DRC.
* @return 0 on success, -1 on error.
*/
int32_t
CCRSysGetCurrentLCDMode(CCRSysLCDMode *mode);
#ifdef __cplusplus
}
#endif

View File

@ -16,11 +16,11 @@ typedef struct CCRAppLaunchParam CCRAppLaunchParam;
struct WUT_PACKED CCRAppLaunchParam
{
uint64_t titleId;
char uuid[16];
uint64_t launchInfoDatabaseEntryId; // id used in the \link nn::sl::LaunchInfoDatabase
char uuid[16]; // account uuid
WUT_UNKNOWN_BYTES(0xE7);
};
WUT_CHECK_OFFSET(CCRAppLaunchParam, 0x00, titleId);
WUT_CHECK_OFFSET(CCRAppLaunchParam, 0x00, launchInfoDatabaseEntryId);
WUT_CHECK_OFFSET(CCRAppLaunchParam, 0x08, uuid);
WUT_CHECK_SIZE(CCRAppLaunchParam, 0xFF);
@ -30,6 +30,21 @@ CCRSysCaffeineGetAppLaunchParam(CCRAppLaunchParam * data);
uint32_t
CCRSysCaffeineBootCheck();
void
CCRSysCaffeineBootCheckAbort();
/**
* @return 0 on success, -1 on error
*/
int32_t
CCRSysCaffeineSetDRCEnableFlag(int32_t enabled);
/**
* @return 0 on success, -1 on error
*/
int32_t
CCRSysCaffeineSetEnableFlag(int32_t enabled);
#ifdef __cplusplus
}
#endif

29
include/nn/cfg/CTR.h Normal file
View File

@ -0,0 +1,29 @@
#pragma once
#include <wut.h>
#ifdef __cplusplus
namespace nn
{
namespace cfg
{
namespace CTR
{
//! Represents a console username, used in UDS and DLP
struct UserName
{
char16_t name[12];
};
WUT_CHECK_SIZE(UserName, 0x18);
} // namespace CTR
} // namespace cfg
} // namespace nn
#endif

View File

@ -12,7 +12,8 @@
extern "C" {
#endif
typedef enum CmptScreenType {
typedef enum CmptScreenType
{
CMPT_SCREEN_TYPE_TV = 1,
CMPT_SCREEN_TYPE_DRC,
CMPT_SCREEN_TYPE_BOTH,

8
include/nn/dlp.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
/**
* \defgroup nn_dlp nn_dlp
* Download Play functions
*/
#include <nn/dlp/Cafe.h>

359
include/nn/dlp/Cafe.h Normal file
View File

@ -0,0 +1,359 @@
#pragma once
#include <wut.h>
#include <nn/cfg/CTR.h>
#include <nn/result.h>
#include <nn/uds/NodeInformation.h>
/**
* \defgroup nn_dlp nn_dlp
* \ingroup nn_dlp
* Download Play functions (see \link nn::dlp \endlink)
* @{
*/
#ifdef __cplusplus
namespace nn
{
namespace dlp
{
namespace Cafe
{
enum PollStateChangeFlags : uint8_t
{
//! Prevents \c PollStateChange from blocking if no new data is available
DLP_POLL_NONBLOCK = 1 << 0,
};
WUT_CHECK_SIZE(PollStateChangeFlags, 0x1);
//! Represents the client state
enum class ClientState : uint32_t
{
//! The client is accepted for the DLP child distribution
Accepted = 5,
//! The client is receiving the distributed DLP child
Receiving = 6,
//! The client has received the distribution and is ready to boot the DLP child
Ready = 7,
//! The client is connected to the session and pending to be accepted
Connecting = 64
};
WUT_CHECK_SIZE(ClientState, 0x4);
//! Represents the server state. All values between 3 and 7 are considered internal state
enum class ServerState : uint32_t
{
//! The server is not initialized
Uninitialized = 0,
//! The server is initialized but there is no active network
Idle = 1,
//! The server is open to new connections
Open = 2,
//! The server is distributing the DLP child to the clients
DistributingInternal = 7,
//! The server has distributed the DLP child
Distributed = 8,
//! The server has finished distribution and clients are booted into the DLP child
Finished = 9,
//! The server failed to distribute the DLP child to the clients
Failed = 10,
//! Public value for internal states
Distributing = 11
};
WUT_CHECK_SIZE(ServerState, 0x4);
class Server
{
public:
/**
* Accepts a client into the DLP child distribution.
*
* \param nodeId
* The node ID of the client.
*/
static nn::Result
AcceptClient(uint16_t nodeId)
asm("AcceptClient__Q4_2nn3dlp4Cafe6ServerSFUs");
/**
* Closes the DLP session.
*/
static nn::Result
CloseSessions()
asm("CloseSessions__Q4_2nn3dlp4Cafe6ServerSFv");
/**
* Disconnects a client from the DLP session. This cannot be done after starting distribution.
*
* \param nodeId
* The node ID of the client.
*/
static nn::Result
DisconnectClient(uint16_t nodeId)
asm("DisconnectClient__Q4_2nn3dlp4Cafe6ServerSFUs");
/**
* Finalizes DLP.
*/
static nn::Result
Finalize()
asm("Finalize__Q4_2nn3dlp4Cafe6ServerSFv");
/**
* Gets information about a client.
*
* \param clientInfo
* Pointer where the client information is written.
*
* \param nodeId
* Node ID of the client.
*/
static nn::Result
GetClientInfo(nn::uds::Cafe::NodeInformation *clientInfo, uint16_t nodeId)
asm("GetClientInfo__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3uds4Cafe15NodeInformationUs");
/**
* Gets a client state.
*
* \param state
* Pointer where the client state is filled in.
*
* \param nodeId
* Node ID of the client.
*/
static nn::Result
GetClientState(ClientState *state, uint16_t nodeId)
asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStateUs");
/**
* Gets a client state.
*
* \param state
* Pointer where the client state is filled in.
*
* \param unitsTotal
* Pointer filled with the total number of units being distributed.
* Only filled when starting distribution and the DLP child isn't cached.
*
* \param unitsReceived
* Pointer filled with the number of units that the client has received.
* Only filled when starting distribution and the DLP child isn't cached.
*
* \param nodeId
* Node ID of the client.
*/
static nn::Result
GetClientState(ClientState *state,
uint32_t *unitsTotal,
uint32_t *unitsReceived,
uint16_t nodeId)
asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStatePUiT2Us");
/**
* Gets the clients that are connected to the DLP session.
*
* \param receivedLength
* Pointer where the number of clients written to the array is stored.
*
* \param connectingClients
* Array where the node IDs of the clients are written.
*
* \param length
* Number of nodes that the \c connectingClients array can hold.
*/
static nn::Result
GetConnectingClients(uint16_t *receivedLength,
uint16_t *connectingClients,
uint16_t length)
asm("GetConnectingClients__Q4_2nn3dlp4Cafe6ServerSFPUsT1Us");
/**
* Gets the server state. Internal states are filtered as \link Distributing \endlink .
*
* \param state
* Pointer where the server state is written.
*/
static nn::Result
GetState(ServerState *state)
asm("GetState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ServerState");
/**
* Initializes DLP.
*
* \param maxClientNum
* Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively.
*
* \param uniqueId
* Unique ID of the DLP child to be distributed.
*
* \param childIndex
* Index of the DLP child to be distributed.
*
* \param userName
* Username that will be displayed to the clients. If \c NULL, the Mii name will be used.
*/
static nn::Result
Initialize(uint8_t maxClientNum,
uint32_t uniqueId,
uint8_t childIndex,
nn::cfg::CTR::UserName *userName)
asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFUcUiT1PQ4_2nn3cfg3CTR8UserName");
/**
* Initializes DLP.
*
* \param dupNoticeNeed
* Unknown output bool, always false on the Wii U.
*
* \param maxClientNum
* Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively.
*
* \param uniqueId
* Unique ID of the DLP child to be distributed.
*
* \param childIndex
* Index of the DLP child to be distributed.
*
* \param userName
* Username that will be displayed to the clients. If \c NULL, the Mii name will be used.
*/
static nn::Result
Initialize(bool *dupNoticeNeed,
uint8_t maxClientNum,
uint32_t uniqueId,
uint8_t childIndex,
nn::cfg::CTR::UserName *userName)
asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFPbUcUiT2PQ4_2nn3cfg3CTR8UserName");
/**
* Opens the DLP session.
*
* \param isManualAccept
* If set, all clients must be accepted to allow them to join the session.
*
* \param channel
* The channel to be used for hosting the session. Use 0 to choose a channel automatically.
* Must be either 0, 1, 6 or 11.
*/
static nn::Result
OpenSessions(bool isManualAccept, uint8_t channel)
asm("OpenSessions__Q4_2nn3dlp4Cafe6ServerSFbUc");
/**
* Checks if the server state chas changed, and waits until it changes if specified.
*
* \param flags
* Flags, see \link PollStateChangeFlags \endlink for all flags.
*/
static nn::Result
PollStateChange(uint8_t flags)
asm("PollStateChange__Q4_2nn3dlp4Cafe6ServerSFUc");
/**
* Reboots all clients into the Download Play child.
*
* \param passPhrase
* Passphrase to be used by the client when connecting to the main UDS network.
* If \c NULL, it will be set to an empty string.
*/
static nn::Result
RebootAllClients(const char *passPhrase)
asm("RebootAllClients__Q4_2nn3dlp4Cafe6ServerSFPCc");
/**
* Starts distribution of the Download Play child.
*/
static nn::Result
StartDistribution()
asm("StartDistribute__Q4_2nn3dlp4Cafe6ServerSFv");
};
class ServerPrivate
{
public:
/**
* Gets the server state. Internal states are not filtered.
*
* \param state
* Pointer where the server state is written.
*/
static nn::Result
GetInternalState(ServerState *state)
asm("GetInternalState__Q4_2nn3dlp4Cafe13ServerPrivateSFPQ4_2nn3dlp4Cafe11ServerState");
/**
* Initializes DLP.
*
* \param maxClientNum
* Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively.
*
* \param uniqueId
* Unique ID of the DLP child to be distributed.
*
* \param childIndex
* Index of the DLP child to be distributed.
*
* \param blockBufferSize
* Unknown parameter (default: 0xC000). Must be bigger than 0x4000 and smaller than 0x80000 inclusively.
*
* \param blockBufferNum
* Unknown parameter (default: 2). Must be a number between 2 and 4 inclusively.
*
* \param userName
* Username that will be displayed to the clients. If \c NULL, the Mii name will be used.
*/
static nn::Result
Initialize(uint8_t maxClientNum,
uint32_t uniqueId,
uint8_t childIndex,
uint32_t blockBufferSize,
uint32_t blockBufferNum,
nn::cfg::CTR::UserName *userName)
asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFUcUiT1N22PQ4_2nn3cfg3CTR8UserName");
/**
* Initializes DLP.
*
* \param dupNoticeNeed
* Unknown output bool, always false on the Wii U.
*
* \param maxClientNum
* Maximum number of clients allowed for distribution. Must be between 1 and 8 inclusively.
*
* \param uniqueId
* Unique ID of the DLP child to be distributed.
*
* \param childIndex
* Index of the DLP child to be distributed.
*
* \param blockBufferSize
* Unknown parameter (default: 0xC000). Must be bigger than 0x4000 and smaller than 0x80000 inclusively.
*
* \param blockBufferNum
* Unknown parameter (default: 2). Must be a number between 2 and 4 inclusively.
*
* \param userName
* Username that will be displayed to the clients. If \c NULL, the Mii name will be used.
*/
static nn::Result
Initialize(bool *dupNoticeNeed,
uint8_t maxClientNum,
uint32_t uniqueId,
uint8_t childIndex,
uint32_t blockBufferSize,
uint32_t blockBufferNum,
nn::cfg::CTR::UserName *userName)
asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFPbUcUiT2N23PQ4_2nn3cfg3CTR8UserName");
};
} // namespace Cafe
} // namespace dlp
} // namespace nn
/** @} */
#endif

View File

@ -3,8 +3,8 @@
#include <coreinit/filesystem.h>
#include <nn/result.h>
#include <padscore/kpad.h>
#include <vpad/input.h>
#include <string.h>
#include <vpad/input.h>
/**
* \defgroup nn_erreula_erreula Error Viewer
@ -43,7 +43,17 @@ enum class LangType
{
Japanese = 0,
English = 1,
// TODO: More languages
French = 2,
German = 3,
Italian = 4,
Spanish = 5,
SimplifiedChinese = 6,
Korean = 7,
Dutch = 8,
Portuguese = 9,
Russian = 10,
TraditionalChinese = 11,
Invalid = 12,
};
enum class RegionType

View File

@ -14,13 +14,15 @@ extern "C" {
// https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/nn/ffl/nn_ffl_miidata.h
typedef enum FFLCreateIDFlags {
typedef enum FFLCreateIDFlags
{
FFL_CREATE_ID_FLAG_WII_U = 0x1 | 0x4,
FFL_CREATE_ID_FLAG_TEMPORARY = 0x2,
FFL_CREATE_ID_FLAG_NORMAL = 0x8,
} FFLCreateIDFlags;
typedef struct WUT_PACKED FFLCreateID {
typedef struct WUT_PACKED FFLCreateID
{
FFLCreateIDFlags flags : 4;
uint32_t timestamp : 28;
@ -31,7 +33,8 @@ WUT_CHECK_OFFSET(FFLCreateID, 4, deviceHash);
WUT_CHECK_SIZE(FFLCreateID, 10);
//Note: the endian may be wrong here
typedef struct WUT_PACKED FFLiMiiDataCore {
typedef struct WUT_PACKED FFLiMiiDataCore
{
// 0x00
uint8_t birth_platform : 4;
uint8_t unk_0x00_b4 : 4;
@ -150,14 +153,16 @@ WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x2F, fatness);
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x33, hair_type);
WUT_CHECK_SIZE(FFLiMiiDataCore, 0x48);
typedef struct WUT_PACKED FFLiMiiDataOfficial {
typedef struct WUT_PACKED FFLiMiiDataOfficial
{
FFLiMiiDataCore core;
uint16_t creator_name[10];
} FFLiMiiDataOfficial;
WUT_CHECK_OFFSET(FFLiMiiDataOfficial, 0x48, creator_name);
WUT_CHECK_SIZE(FFLiMiiDataOfficial, 0x5C);
typedef struct WUT_PACKED FFLStoreData {
typedef struct WUT_PACKED FFLStoreData
{
FFLiMiiDataOfficial data;
uint16_t unk_0x5C;
uint16_t checksum;

View File

@ -1,8 +1,8 @@
#pragma once
#include <wut.h>
#include <nn/result.h>
#include <nn/ffl/miidata.h>
#include <nn/act.h>
#include <nn/ffl/miidata.h>
#include <nn/result.h>
/**
* \defgroup nn_fp_fp Friends Presence

9
include/nn/hpad.h Normal file
View File

@ -0,0 +1,9 @@
#pragma once
/**
* \defgroup nn_hpad nn_hpad
* Library for using the USB Gamecube Controller Adapter (HID Pad?).
*/
#include <nn/hpad/beta.h>
#include <nn/hpad/hpad.h>

64
include/nn/hpad/beta.h Normal file
View File

@ -0,0 +1,64 @@
#pragma once
#include <wut.h>
#include <nn/hpad/hpad.h>
/**
* \defgroup nn_hpad_beta
* \ingroup nn_hpad
* Beta functions for HPAD.
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Prints internal state info to the COS shell.
*/
void
BETA_DEBUG_DUMP(void);
/**
* Gets the command queue size of the specified adapter.
*
* \param chan
* The channel to get the size of.
*
* \return
* The command queue size.
*/
int32_t
BETA_DEBUG_GET_QUEUE_SIZE(HPADGGGGChan chan);
/**
* Sends a report to the specified adapter.
*
* \param chan
* The channel to send the report to.
*
* \param reptId
* The ID of the report to send.
*/
void
BETA_DEBUG_SEND_REPT_ID(HPADGGGGChan chan,
uint32_t reptId);
/**
* Returns immediately.
*/
void
BETA_DEBUG_GET_RAW_DATA(void);
/**
* Returns immediately.
*/
void
BETA_DEBUG_SET_DUMP_MODE(void);
#ifdef __cplusplus
}
#endif
/** @} */

342
include/nn/hpad/hpad.h Normal file
View File

@ -0,0 +1,342 @@
#pragma once
#include <wut.h>
/**
* \defgroup nn_hpad_hpad
* \ingroup nn_hpad
* Functions for using the USB Gamecube Controller Adapter.
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
//! The minimum value of the stick axis
#define HPAD_STICK_AXIS_MIN -56
//! The maximum value of the stick axis
#define HPAD_STICK_AXIS_MAX 56
//! The minimum value of the substick axis
#define HPAD_SUBSTICK_AXIS_MIN -44
//! The maximum value of the substick axis
#define HPAD_SUBSTICK_AXIS_MAX 44
//! The minimum value of the trigger
#define HPAD_TRIGGER_MIN 0
//! The maximum value of the trigger
#define HPAD_TRIGGER_MAX 150
typedef struct HPADStatus HPADStatus;
typedef struct HPADGGGGStatus HPADGGGGStatus;
typedef enum HPADChan
{
HPAD_CHAN_0 = 0,
HPAD_CHAN_1 = 1,
HPAD_CHAN_2 = 2,
HPAD_CHAN_3 = 3,
HPAD_CHAN_4 = 4,
HPAD_CHAN_5 = 5,
HPAD_CHAN_6 = 6,
HPAD_CHAN_7 = 7,
} HPADChan;
typedef enum HPADGGGGChan
{
//! Adapter Channel 0
HPAD_GGGG_CHAN_0 = 0,
//! Adapter Channel 1
HPAD_GGGG_CHAN_1 = 1,
} HPADGGGGChan;
typedef enum HPADButtons
{
HPAD_BUTTON_A = 0x0001,
HPAD_BUTTON_B = 0x0002,
HPAD_BUTTON_X = 0x0004,
HPAD_BUTTON_Y = 0x0008,
HPAD_BUTTON_LEFT = 0x0010,
HPAD_BUTTON_RIGHT = 0x0020,
HPAD_BUTTON_DOWN = 0x0040,
HPAD_BUTTON_UP = 0x0080,
HPAD_BUTTON_START = 0x0100,
HPAD_TRIGGER_Z = 0x0200,
HPAD_TRIGGER_R = 0x0400,
HPAD_TRIGGER_L = 0x0800,
HPAD_STICK_EMULATION_LEFT = 0x00001000,
HPAD_STICK_EMULATION_RIGHT = 0x00002000,
HPAD_STICK_EMULATION_DOWN = 0x00004000,
HPAD_STICK_EMULATION_UP = 0x00008000,
HPAD_SUBSTICK_EMULATION_LEFT = 0x00010000,
HPAD_SUBSTICK_EMULATION_RIGHT = 0x00020000,
HPAD_SUBSTICK_EMULATION_DOWN = 0x00040000,
HPAD_SUBSTICK_EMULATION_UP = 0x00080000,
} HPADButtons;
typedef enum HPADMotorCommand
{
HPAD_MOTOR_COMMAND_STOP = 0,
HPAD_MOTOR_COMMAND_RUMBLE = 1,
HPAD_MOTOR_COMMAND_STOP_HARD = 2,
} HPADMotorCommand;
struct HPADStatus
{
//! Indicates what HPADButtons are held down.
int32_t hold;
//! Indicates what HPADButtons have been pressed since last sample.
int32_t trigger;
//! Indicates what HPADButtons have been released since last sample.
int32_t release;
//! X-Position of the analog stick
int8_t stickX;
//! Y-Position of the analog stick
int8_t stickY;
//! X-Position of the analog substick/C-Stick
int8_t substickX;
//! Y-Position of the analog substick/C-Stick
int8_t substickY;
//! Position of the left analog trigger
uint8_t triggerL;
//! Position of the right analog trigger
uint8_t triggerR;
//! Status of the controller
uint8_t status;
WUT_PADDING_BYTES(0x1);
//! Read error, 0 for success
int32_t error;
};
WUT_CHECK_OFFSET(HPADStatus, 0x00, hold);
WUT_CHECK_OFFSET(HPADStatus, 0x04, trigger);
WUT_CHECK_OFFSET(HPADStatus, 0x08, release);
WUT_CHECK_OFFSET(HPADStatus, 0x0C, stickX);
WUT_CHECK_OFFSET(HPADStatus, 0x0D, stickY);
WUT_CHECK_OFFSET(HPADStatus, 0x0E, substickX);
WUT_CHECK_OFFSET(HPADStatus, 0x0F, substickY);
WUT_CHECK_OFFSET(HPADStatus, 0x10, triggerL);
WUT_CHECK_OFFSET(HPADStatus, 0x11, triggerR);
WUT_CHECK_OFFSET(HPADStatus, 0x12, status);
WUT_CHECK_OFFSET(HPADStatus, 0x14, error);
WUT_CHECK_SIZE(HPADStatus, 0x18);
struct HPADGGGGStatus
{
//! \c TRUE if the adapeter is connected
BOOL connected;
//! \c TRUE if the power supply is connected
BOOL powerSupplyConnected;
//! \c TRUE if the adapter is active/is sending samples
BOOL active;
};
WUT_CHECK_OFFSET(HPADGGGGStatus, 0x0, connected);
WUT_CHECK_OFFSET(HPADGGGGStatus, 0x4, powerSupplyConnected);
WUT_CHECK_OFFSET(HPADGGGGStatus, 0x8, active);
WUT_CHECK_SIZE(HPADGGGGStatus, 0xC);
typedef void (*HPADConnectCallback)(HPADChan chan, int32_t status);
typedef void (*HPADGGGGConnectCallback)(HPADGGGGChan chan, BOOL connected);
typedef void (*HPADPowerSupplyCallback)(HPADGGGGChan chan, BOOL connected);
typedef void (*HPADSamplingCallback)(HPADGGGGChan chan);
typedef void (*HPADResetCallback)(HPADGGGGChan chan, int32_t status);
/**
* Initializes the HPAD library.
*
* \return
* 0 on success.
*/
int32_t
HPADInit(void);
/**
* Shuts down the HPAD library.
*
* \return
* 0 on success.
*/
int32_t
HPADShutdown(void);
/**
* Reads status buffers from a specified HPAD channel.
*
* \warning
* The count parameter is ignored and this function will always fill up to 16 sampling buffers.
* Make sure to always make space for 16 buffers.
*
* \param chan
* The channel to read from.
*
* \param buffers
* Pointer to an array of HPADStatus buffers to fill.
*
* \param count
* Number of buffers to fill.
*
* \return
* The amount of buffers read or a negative value on error.
*/
// clang-format off
int32_t
RPLWRAP(HPADRead)(HPADChan chan,
HPADStatus *buffers,
int32_t count);
// clang-format on
/**
* Reads status buffers from a specified HPAD channel.
*
* \param chan
* The channel to read from.
*
* \param buffers
* Pointer to an array of HPADStatus buffers to fill.
*
* \param count
* Number of buffers to fill. Must be 16.
*
* \return
* The amount of buffers read or a negative value on error.
*/
static inline int32_t
HPADRead(HPADChan chan,
HPADStatus *buffers,
int32_t count)
{
// HPADRead ignores the count and will always fill up to 16 sampling buffers
if (count != 16) {
return -6;
}
return RPLWRAP(HPADRead)(chan, buffers, count);
}
/**
* Sends a motor/rumble command to the specified HPAD channel.
*
* \param chan
* The channel to send the command to.
*
* \param command
* The motor command to send.
*
* \return
* 0 on success.
*/
int32_t
HPADControlMotor(HPADChan chan,
HPADMotorCommand command);
/**
* Invalidates calibration data of the specified HPAD channel.
*
* \param chan
* The channel to invalidate data.
*
* \return
* 0 on success.
*/
int32_t
HPADRecalibrate(HPADChan chan);
/**
* Sets a callback for once the specified HPAD channel is connected.
*
* \param chan
* The channel to set the callback.
*
* \param callback
* A pointer to the callback function.
*
* \return
* A pointer to the previous callback or \c NULL.
*/
HPADConnectCallback
HPADSetConnectCallback(HPADChan chan,
HPADConnectCallback callback);
/**
* Get the status of the specified GGGG channel (GC Adapter).
*
* \param chan
* The channel to get the status from.
*
* \param status
* A pointer to write the status to.
*
* \return
* 0 on success.
*/
int32_t
HPADGetGGGGStatus(HPADGGGGChan chan,
HPADGGGGStatus *status);
/**
* Sets a callback for once the specified GGGG Adapter is connected.
*
* \param chan
* The channel to set the callback.
*
* \param callback
* A pointer to the callback function.
*
* \return
* A pointer to the previous callback or \c NULL.
*/
HPADGGGGConnectCallback
HPADSetGgggConnectCallback(HPADGGGGChan chan,
HPADGGGGConnectCallback callback);
/**
* Sets a callback for once the power supply of the specified GGGG Adapter is connected.
*
* \param chan
* The channel to set the callback.
*
* \param callback
* A pointer to the callback function.
*
* \return
* A pointer to the previous callback or \c NULL.
*/
HPADPowerSupplyCallback
HPADSetPowerSupplyCallback(HPADGGGGChan chan,
HPADPowerSupplyCallback callback);
/**
* Sets a callback for once a sample is received from the specified GGGG Adapter.
*
* \param chan
* The channel to set the callback.
*
* \param callback
* A pointer to the callback function.
*
* \return
* A pointer to the previous callback or \c NULL.
*/
HPADSamplingCallback
HPADSetSamplingCallback(HPADGGGGChan chan,
HPADSamplingCallback callback);
/**
* Resets the specified GGGG Adapter.
*
* \param chan
* The channel to reset.
*
* \param callback
* A pointer to a callback function after resetting is complete.
*
* \return
* 0 on success.
*/
int32_t
HPADResetDevice(HPADGGGGChan chan,
HPADResetCallback callback);
#ifdef __cplusplus
}
#endif
/** @} */

8
include/nn/idb.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
/**
* \defgroup nn_idb nn_idb
*/
#include <nn/idb/IDBReader.h>
#include <nn/idb/idb_cpp.h>

8
include/nn/nets2.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
/**
* \defgroup nn_nets2 nn_nets2
* Network functions 2.
*/
#include <nn/nets2/somemopt.h>

View File

@ -0,0 +1,70 @@
#pragma once
#include <wut.h>
/**
* \defgroup nn_nets2_somemopt
* \ingroup nn_nets2
* User provided socket memory options.
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef enum SOMemOptRequest
{
//! Initialize buffer managment from user-provided buffer.
//! This is a blocking request, which only returns once nsysnet is shut down/the application quits.
SOMEMOPT_REQUEST_INIT = 1,
//! Return the amount of bytes used for buffer management.
SOMEMOPT_REQUEST_GET_BYTES_USED = 2,
//! Wait for buffer management initialization to be done.
SOMEMOPT_REQUEST_WAIT_FOR_INIT = 3,
//! Cancel pending wait for init.
SOMEMOPT_REQUEST_CANCEL_WAIT = 4,
} SOMemOptRequest;
typedef enum SOMemOptFlags
{
SOMEMOPT_FLAGS_NONE = 0,
//! Changes the distribution between small and big buffers to 50-50 instead of 80-20.
SOMEMOPT_FLAGS_BIG_BUFFERS = 1 << 0,
} SOMemOptFlags;
/**
* Perform a somemopt request.
*
* \param request
* The request to perform.
*
* \param buffer
* A 0x40 aligned buffer for \link SOMEMOPT_REQUEST_INIT \endlink.
*
* \param size
* The size of the buffer for \link SOMEMOPT_REQUEST_INIT \endlink.
* Minimum size is \c 0x20000 bytes, maximum size is \c 0x300000.
*
* \param flags
* A combination of flags.
*
* \return
* -1 on error.
*/
int
somemopt(SOMemOptRequest request,
void *buffer,
uint32_t size,
SOMemOptFlags flags);
// clang-format off
int
RPLWRAP(somemopt)(SOMemOptRequest request,
void *buffer,
uint32_t size,
SOMemOptFlags flags);
// clang-format on
#ifdef __cplusplus
}
#endif

View File

@ -5,5 +5,5 @@
* Nintendo Figurine (amiibo) Platform library.
*/
#include <nn/nfp/nfp_cpp.h>
#include <nn/nfp/amiibo_settings_cpp.h>
#include <nn/nfp/nfp_cpp.h>

View File

@ -12,9 +12,11 @@
#ifdef __cplusplus
namespace nn {
namespace nn
{
namespace nfp {
namespace nfp
{
enum class AmiiboSettingsMode : uint32_t
{

View File

@ -1,8 +1,9 @@
#pragma once
#include <wut.h>
#include <nn/result.h>
#include <nn/ffl/miidata.h>
#include <coreinit/event.h>
#include <nfc/nfc.h>
#include <nn/ffl/miidata.h>
#include <nn/result.h>
/**
* \defgroup nn_nfp
@ -13,9 +14,11 @@
#ifdef __cplusplus
namespace nn {
namespace nn
{
namespace nfp {
namespace nfp
{
//! NN_NFP result descriptions for \link nn::Result::GetDescription \endlink.
enum ResultDescription
@ -71,6 +74,16 @@ enum class AdminFlags : uint8_t
};
WUT_CHECK_SIZE(AdminFlags, 0x1);
enum class TagType : uint8_t
{
Unknown = 0,
Type1Tag = 1 << 0,
Type2Tag = 1 << 1,
Type3Tag = 1 << 2,
Iso15693 = 1 << 5,
};
WUT_CHECK_SIZE(TagType, 0x1);
struct Date
{
//! Year (Starting at 0)
@ -119,16 +132,16 @@ struct TagInfo
TagId id;
//! reserved bytes
uint8_t reserved0[0x15];
//! Tag protocol (always 0x00)
uint8_t protocol;
//! Tag type (always 0x02)
uint8_t tag_type;
//! Technology (always \link NFC_TECHNOLOGY_A \endlink)
NFCTechnology technology;
//! Tag type (always \link TagType::Type2Tag \endlink)
TagType tag_type;
//! reserved bytes
uint8_t reserved1[0x32];
};
WUT_CHECK_OFFSET(TagInfo, 0x0, id);
WUT_CHECK_OFFSET(TagInfo, 0xB, reserved0);
WUT_CHECK_OFFSET(TagInfo, 0x20, protocol);
WUT_CHECK_OFFSET(TagInfo, 0x20, technology);
WUT_CHECK_OFFSET(TagInfo, 0x21, tag_type);
WUT_CHECK_OFFSET(TagInfo, 0x22, reserved1);
WUT_CHECK_SIZE(TagInfo, 0x54);
@ -171,8 +184,8 @@ struct WUT_PACKED RegisterInfo
FFLStoreData mii;
//! The name of this amiibo
uint16_t name[11];
//! Flags (see \link RegisterInfoSet \endlink)
uint8_t flags;
//! Font region
uint8_t fontRegion;
//! Country code
uint8_t country;
//! The date when the amiibo was registered
@ -182,7 +195,7 @@ struct WUT_PACKED RegisterInfo
};
WUT_CHECK_OFFSET(RegisterInfo, 0x0, mii);
WUT_CHECK_OFFSET(RegisterInfo, 0x60, name);
WUT_CHECK_OFFSET(RegisterInfo, 0x76, flags);
WUT_CHECK_OFFSET(RegisterInfo, 0x76, fontRegion);
WUT_CHECK_OFFSET(RegisterInfo, 0x77, country);
WUT_CHECK_OFFSET(RegisterInfo, 0x78, registerDate);
WUT_CHECK_OFFSET(RegisterInfo, 0x7C, reserved);
@ -219,14 +232,14 @@ struct WUT_PACKED RegisterInfoSet
FFLStoreData mii;
//! The name of this amiibo
uint16_t name[11];
//! Flags (can be retrieved from \link RegisterInfo \endlink)
uint8_t flags;
//! Font region
uint8_t fontRegion;
//! reserved bytes, must be 0
uint8_t reserved[0x2d];
};
WUT_CHECK_OFFSET(RegisterInfoSet, 0x0, mii);
WUT_CHECK_OFFSET(RegisterInfoSet, 0x60, name);
WUT_CHECK_OFFSET(RegisterInfoSet, 0x76, flags);
WUT_CHECK_OFFSET(RegisterInfoSet, 0x76, fontRegion);
WUT_CHECK_OFFSET(RegisterInfoSet, 0x77, reserved);
WUT_CHECK_SIZE(RegisterInfoSet, 0xA4);

View File

@ -10,9 +10,11 @@
#ifdef __cplusplus
namespace nn {
namespace nn
{
namespace pdm {
namespace pdm
{
//! Flags for PlayDiary
typedef enum PlayDiaryFlags : uint16_t

View File

@ -34,7 +34,8 @@ struct NNResult
* \sa
* - \link NNResult_IsFailure \endlink
*/
static inline int NNResult_IsSuccess(NNResult result)
static inline int
NNResult_IsSuccess(NNResult result)
{
return result.value >= 0;
}
@ -51,7 +52,8 @@ static inline int NNResult_IsSuccess(NNResult result)
* \sa
* - \link NNResult_IsSuccess \endlink
*/
static inline int NNResult_IsFailure(NNResult result)
static inline int
NNResult_IsFailure(NNResult result)
{
return result.value < 0;
}
@ -228,6 +230,11 @@ public:
};
public:
Result() :
mValue(0)
{
}
Result(Level level, Module module, unsigned description) :
mValue(((level & 0x7) << 29) | ((module & 0x1FF) << 20) | (description & 0xFFFFF))
{
@ -247,7 +254,8 @@ public:
* \sa
* - \link IsSuccess \endlink
*/
bool IsFailure() const
bool
IsFailure() const
{
return !IsSuccess();
}
@ -261,22 +269,26 @@ public:
* \sa
* - \link IsFailure \endlink
*/
bool IsSuccess() const
bool
IsSuccess() const
{
return mValue >= 0; // level >= 0
}
bool IsLegacy() const
bool
IsLegacy() const
{
return ((mValue >> 27) & 0x3) == SIGNATURE_IS_LEGACY;
}
unsigned GetDescription() const
unsigned
GetDescription() const
{
return mValue & (IsLegacy() ? 0x3FF : 0xFFFFF);
}
int GetLevel() const
int
GetLevel() const
{
if (IsLegacy()) {
return (mValue << 14) >> 28; // cause arithmetic shift
@ -285,12 +297,14 @@ public:
return mValue >> 29;
}
unsigned GetModule() const
unsigned
GetModule() const
{
return (mValue >> 20) & (IsLegacy() ? 0x7F : 0x1FF);
}
unsigned GetSummary() const
unsigned
GetSummary() const
{
if (IsLegacy()) {
return (mValue >> 10) & 0xF;
@ -311,12 +325,14 @@ public:
return result;
}
bool operator==(const Result &other) const
bool
operator==(const Result &other) const
{
return mValue == other.mValue;
}
bool operator!=(const Result &other) const
bool
operator!=(const Result &other) const
{
return mValue != other.mValue;
}

View File

@ -1,8 +1,8 @@
#pragma once
#include <wut.h>
#include <nn/acp/device.h>
#include <coreinit/filesystem.h>
#include <nn/acp/device.h>
#ifdef __cplusplus
extern "C" {

View File

@ -4,6 +4,32 @@
* \defgroup nn_sl nn_sl
*/
#include <nn/sl/sl_cpp.h>
#include <nn/sl/LaunchInfoDatabase.h>
#include <nn/sl/CacheManager.h>
#include <nn/sl/Condition.h>
#include <nn/sl/DataCreator.h>
#include <nn/sl/DrcManager.h>
#include <nn/sl/FileStream.h>
#include <nn/sl/IAccountInfoAccessor.h>
#include <nn/sl/IBlackListAccessor.h>
#include <nn/sl/IDefaultTitleAccessor.h>
#include <nn/sl/IKillerNotificationAccessor.h>
#include <nn/sl/ILaunchedTitleListAccessor.h>
#include <nn/sl/IPreferentialTitleAccessor.h>
#include <nn/sl/ISerializer.h>
#include <nn/sl/ISettingAccessor.h>
#include <nn/sl/IStream.h>
#include <nn/sl/ITimeAccessor.h>
#include <nn/sl/ITitleIconCache.h>
#include <nn/sl/ITitleListAccessor.h>
#include <nn/sl/ITransferrer.h>
#include <nn/sl/IUpdatePackageAccessor.h>
#include <nn/sl/IWhiteListAccessor.h>
#include <nn/sl/KillerNotification.h>
#include <nn/sl/KillerNotificationSelector.h>
#include <nn/sl/KillerNotificationTransferRecordManager.h>
#include <nn/sl/KillerNotificationTransferRecordStream.h>
#include <nn/sl/LaunchInfoDatabase.h>
#include <nn/sl/QuickStartApplicationSelector.h>
#include <nn/sl/TitleIconCache.h>
#include <nn/sl/TitleListCache.h>
#include <nn/sl/sl_cpp.h>

View File

@ -0,0 +1,123 @@
#pragma once
#include <wut.h>
#include <nn/result.h>
#include <nn/sl/ISerializer.h>
#include <nn/sl/KillerNotification.h>
#include <nn/sl/sl_cpp.h>
#ifdef __cplusplus
namespace nn::sl
{
namespace details
{
typedef struct WUT_PACKED CacheManagerInternal
{
ISerializerInternal *quickStartTitleInfoSerializer;
ISerializerInternal *killerNotificationSerializer;
ISerializerInternal *jumpTitleInfoSerializer;
} CacheManagerInternal;
WUT_CHECK_SIZE(CacheManagerInternal, 0x0c);
WUT_CHECK_OFFSET(CacheManagerInternal, 0x00, quickStartTitleInfoSerializer);
WUT_CHECK_OFFSET(CacheManagerInternal, 0x04, killerNotificationSerializer);
WUT_CHECK_OFFSET(CacheManagerInternal, 0x08, jumpTitleInfoSerializer);
extern "C" CacheManagerInternal *
__ct__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *);
extern "C" void
SetupInitialCache__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *);
extern "C" nn::Result
GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(CacheManagerInternal *, KillerNotification *, TitleInfo *);
extern "C" nn::Result
GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(CacheManagerInternal *, TitleInfo *, int);
extern "C" nn::Result
Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(CacheManagerInternal *, TitleInfo *, int, KillerNotification *, TitleInfo *);
extern "C" nn::Result
Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1(
CacheManagerInternal *,
ISerializerInternal *,
ISerializerInternal *,
ISerializerInternal *);
} // namespace details
class CacheManager
{
public:
CacheManager() :
mQuickStartTitleInfoSerializer(nullptr),
mKillerNotificationSerializer(nullptr),
mJumpTitleInfoSerializer(nullptr)
{
if (__ct__Q3_2nn2sl12CacheManagerFv(&mInstance) != nullptr) {
mQuickStartTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(mInstance.quickStartTitleInfoSerializer);
mKillerNotificationSerializer = details::SerializerFromPtr<KillerNotification>(mInstance.killerNotificationSerializer);
mJumpTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(mInstance.jumpTitleInfoSerializer);
}
}
[[nodiscard]] details::ISerializerBase<TitleInfo> &
GetQuickStartTitleInfoSerializer()
{
return mQuickStartTitleInfoSerializer;
}
[[nodiscard]] details::ISerializerBase<KillerNotification> &
GetKillerNotificationSerializer()
{
return mKillerNotificationSerializer;
}
[[nodiscard]] details::ISerializerBase<TitleInfo> &
GetJumpTitleInfoSerializer()
{
return mJumpTitleInfoSerializer;
}
void
SetupInitialCache()
{
SetupInitialCache__Q3_2nn2sl12CacheManagerFv(&mInstance);
}
nn::Result
GetKillerNotificationCache(KillerNotification *u1, TitleInfo *u2)
{
return GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(&mInstance, u1, u2);
}
nn::Result
GetQuickStartCache(TitleInfo *u1, int u2)
{
return GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(&mInstance, u1, u2);
}
nn::Result
Get(TitleInfo *u1, int u2, KillerNotification *u3, TitleInfo *u4)
{
return Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(&mInstance, u1, u2, u3, u4);
}
void
Initialize(details::ISerializerBase<TitleInfo> &quickStartTitleInfoSerializer, details::ISerializerBase<KillerNotification> &killerNotificationSerializer, details::ISerializerBase<TitleInfo> &jumpTitleInfoSerializer)
{
Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1(&mInstance,
quickStartTitleInfoSerializer.GetInternal(),
killerNotificationSerializer.GetInternal(),
jumpTitleInfoSerializer.GetInternal());
mQuickStartTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(quickStartTitleInfoSerializer.GetInternal());
mKillerNotificationSerializer = details::SerializerFromPtr<KillerNotification>(killerNotificationSerializer.GetInternal());
mJumpTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(jumpTitleInfoSerializer.GetInternal());
}
~CacheManager() = default;
private:
details::CacheManagerInternal mInstance{};
details::SerializerFromPtr<TitleInfo> mQuickStartTitleInfoSerializer;
details::SerializerFromPtr<KillerNotification> mKillerNotificationSerializer;
details::SerializerFromPtr<TitleInfo> mJumpTitleInfoSerializer;
};
} // namespace nn::sl
#endif

145
include/nn/sl/Condition.h Normal file
View File

@ -0,0 +1,145 @@
#pragma once
#include <wut.h>
#include <coreinit/time.h>
#include <nn/result.h>
#include <nn/sl/ISettingAccessor.h>
#include <nn/sl/ITimeAccessor.h>
#include <nn/sl/IUpdatePackageAccessor.h>
#include <nn/sl/details/ISerializerDetails.h>
#ifdef __cplusplus
namespace nn::sl
{
namespace details
{
typedef struct WUT_PACKED ConditionInternal
{
ISettingAccessorInternal *settingAccessor;
IUpdatePackageAccessorInternal *updatePackageAccessor;
ISerializerInternal *previousSendingTimeSerializer;
ITimeAccessorInternal *timeAccessor;
void *vtable;
} ConditionInternal;
WUT_CHECK_SIZE(ConditionInternal, 0x14);
WUT_CHECK_OFFSET(ConditionInternal, 0x00, settingAccessor);
WUT_CHECK_OFFSET(ConditionInternal, 0x04, updatePackageAccessor);
WUT_CHECK_OFFSET(ConditionInternal, 0x08, previousSendingTimeSerializer);
WUT_CHECK_OFFSET(ConditionInternal, 0x0C, timeAccessor);
WUT_CHECK_OFFSET(ConditionInternal, 0x10, vtable);
extern "C" ConditionInternal *
__ct__Q3_2nn2sl9ConditionFv(ConditionInternal *);
extern "C" nn::Result
GetEnability__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
extern "C" nn::Result
StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
extern "C" nn::Result
NeedsUpdate__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
extern "C" nn::Result
GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(ConditionInternal *, int64_t *outTime);
extern "C" void
Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(ConditionInternal *,
ISettingAccessorInternal *,
IUpdatePackageAccessorInternal *,
ISerializerInternal *,
ITimeAccessorInternal *);
} // namespace details
class Condition
{
public:
Condition() :
mSettingAccessor(nullptr),
mUpdatePackageAccessor(nullptr),
mPreviousSendingTimeSerializer(nullptr),
mTimeAccessor(nullptr)
{
if (__ct__Q3_2nn2sl9ConditionFv(&mInstance) != nullptr) {
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingAccessor);
mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(mInstance.updatePackageAccessor);
mPreviousSendingTimeSerializer = details::SerializerFromPtr<OSTime>(mInstance.previousSendingTimeSerializer);
mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor);
}
}
~Condition() = default;
[[nodiscard]] details::ISettingAccessorBase &
GetSettingAccessor()
{
return mSettingAccessor;
}
[[nodiscard]] details::IUpdatePackageAccessorBase &
GetUpdatePackageAccessor()
{
return mUpdatePackageAccessor;
}
[[nodiscard]] details::ISerializerBase<OSTime> &
GetPreviousSendingTimeSerializer()
{
return mPreviousSendingTimeSerializer;
}
[[nodiscard]] details::ITimeAccessorBase &
GetTimeAccessor()
{
return mTimeAccessor;
}
nn::Result
GetEnability()
{
return GetEnability__Q3_2nn2sl9ConditionCFv(&mInstance);
}
nn::Result
NeedsUpdate()
{
return NeedsUpdate__Q3_2nn2sl9ConditionCFv(&mInstance);
}
nn::Result
StoreCurrentTimeAsPreviousSendingTime()
{
return StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(&mInstance);
}
nn::Result
GetPreviousSendingTime(int64_t *outTime)
{
return GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(&mInstance, outTime);
}
void
Initialize(details::ISettingAccessorBase &settingAccessor,
details::IUpdatePackageAccessorBase &updatePackageAccessor,
details::ISerializerBase<OSTime> &previousSendingTimeSerializer,
details::ITimeAccessorBase &timeAccessor)
{
Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(
&mInstance,
settingAccessor.GetInternal(),
updatePackageAccessor.GetInternal(),
previousSendingTimeSerializer.GetInternal(),
timeAccessor.GetInternal());
mSettingAccessor = details::SettingAccessorFromPtr(settingAccessor.GetInternal());
mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(updatePackageAccessor.GetInternal());
mPreviousSendingTimeSerializer = details::SerializerFromPtr<OSTime>(previousSendingTimeSerializer.GetInternal());
mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal());
}
private:
details::ConditionInternal mInstance = {};
details::SettingAccessorFromPtr mSettingAccessor;
details::UpdatePackageAccessorFromPtr mUpdatePackageAccessor;
details::SerializerFromPtr<OSTime> mPreviousSendingTimeSerializer;
details::TimeAccessorFromPtr mTimeAccessor;
};
} // namespace nn::sl
#endif

130
include/nn/sl/DataCreator.h Normal file
View File

@ -0,0 +1,130 @@
#pragma once
#include <wut.h>
#include <nn/result.h>
#include <nn/sl/IIconInfoAccessor.h>
#include <nn/sl/ISettingAccessor.h>
#include <nn/sl/ITitleIconCache.h>
#include <nn/sl/KillerNotification.h>
#include <nn/sl/LaunchInfoDatabase.h>
#include <nn/sl/details/IAccountInfoAccessorDetails.h>
#include <nn/sl/sl_cpp.h>
#ifdef __cplusplus
namespace nn ::sl
{
namespace details
{
typedef struct WUT_PACKED DataCreatorInternal
{
IIconInfoAccessorInternal *iconInfoAccessor;
IAccountInfoAccessorInternal *accountInfoAccessor;
ISettingAccessorInternal *settingInfoAccessor;
ITitleIconCacheInternal *titleIconCache;
void *vtable;
} DataCreatorInternal;
WUT_CHECK_SIZE(DataCreatorInternal, 0x14);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x00, iconInfoAccessor);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x04, accountInfoAccessor);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x08, settingInfoAccessor);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x0c, titleIconCache);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x10, vtable);
extern "C" DataCreatorInternal *
__ct__Q3_2nn2sl11DataCreatorFv(DataCreatorInternal *);
extern "C" nn::Result
Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase(
DataCreatorInternal *,
TransferableInfo *,
const TitleInfo *,
int,
const KillerNotification &,
const TitleInfo &,
LaunchInfoDatabase &);
extern "C" nn::Result
Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache(
DataCreatorInternal *,
IIconInfoAccessorInternal *,
IAccountInfoAccessorInternal *,
ISettingAccessorInternal *,
ITitleIconCacheInternal *);
} // namespace details
class DataCreator
{
public:
DataCreator() :
mIconInfoAccessor(nullptr),
mAccountInfoAccessor(nullptr),
mSettingAccessor(nullptr),
mTitleIconCache(nullptr)
{
if (__ct__Q3_2nn2sl11DataCreatorFv(&mInstance) != nullptr) {
mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor);
mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor);
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor);
mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache);
}
}
[[nodiscard]] details::IIconInfoAccessorBase &
getIconInfoAccessor()
{
return mIconInfoAccessor;
}
[[nodiscard]] details::IAccountInfoAccessorBase &
getAccountInfoAccessor()
{
return mAccountInfoAccessor;
}
[[nodiscard]] details::ISettingAccessorBase &
getSettingAccessor()
{
return mSettingAccessor;
}
[[nodiscard]] details::ITitleIconCacheBase &
getTitleIconCache()
{
return mTitleIconCache;
}
nn::Result
Create(TransferableInfo *outTransferableInfo,
const TitleInfo *quickstartTitleInfos,
int numQuickstartTitleInfos,
const KillerNotification &killerNotification,
const TitleInfo &killerNotificationTitleInfo,
LaunchInfoDatabase &launchInfoDatabase)
{
return details::Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase(
&mInstance, outTransferableInfo, quickstartTitleInfos, numQuickstartTitleInfos, killerNotification, killerNotificationTitleInfo, launchInfoDatabase);
}
void
Initialize(details::IIconInfoAccessorBase &iconInfoAccessor, details::IAccountInfoAccessorBase &accountInfoAccessor, details::ISettingAccessorBase &settingAccessor, details::ITitleIconCacheBase &titleIconCache)
{
details::Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache(
&mInstance, iconInfoAccessor.GetInternal(), accountInfoAccessor.GetInternal(), settingAccessor.GetInternal(), titleIconCache.GetInternal());
mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor);
mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor);
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor);
mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache);
}
~DataCreator() = default;
private:
details::DataCreatorInternal mInstance = {};
details::IconInfoAccessorFromPtr mIconInfoAccessor;
details::AccountInfoAccessorFromPtr mAccountInfoAccessor;
details::SettingAccessorFromPtr mSettingAccessor;
details::TitleIconCacheFromPtr mTitleIconCache;
};
}; // namespace nn::sl
#endif

Some files were not shown because too many files have changed in this diff Show More