Compare commits

..

No commits in common. "master" and "1.0.0-beta8" have entirely different histories.

231 changed files with 4795 additions and 7849 deletions

View File

@ -1,17 +0,0 @@
# https://EditorConfig.org
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 3
[{Makefile,*/Makefile,*.mk,*_rules}]
indent_style = tab
indent_size = 4
[*.yml]
indent_style = space
indent_size = 2

View File

@ -1,43 +0,0 @@
name: C/C++ CI
on: [push, pull_request]
jobs:
build:
name: ubuntu-18.04
runs-on: ubuntu-18.04
container: devkitpro/devkitppc:latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: install cmake
run: |
apt-get install -y cmake
- name: Build
run: |
make -j2
make install
- name: Build Test
run: |
cd tests
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/wut/share/wut.toolchain.cmake ../
make -j2
- name: Build Samples (Make)
run: |
cd samples/make
make -j2
- name: Build Samples (CMake)
run: |
cd samples/cmake
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/wut/share/wut.toolchain.cmake ../
make -j2

9
.gitignore vendored
View File

@ -1,16 +1,9 @@
.*/
!.github/
build/
release/
debug/
lib/
*.a
*.o
*.d
*.elf
*.rpl
*.rpx
*.wuhb
*.bz2
docs/html/
.vs/
CMakeSettings.json

0
.gitmodules vendored Normal file
View File

66
.travis.yml Normal file
View File

@ -0,0 +1,66 @@
language: cpp
matrix:
include:
- os: linux
dist: xenial
sudo: required
env: DEPLOY_FILE=wut.7z
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:cginternals/backports-ppa'
packages:
- p7zip-full
cache:
directories:
- "$HOME/.local"
- "/opt/devkitpro"
git:
submodules: true
install:
- wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb -O /tmp/devkitpro-pacman.deb
- sudo dpkg -i /tmp/devkitpro-pacman.deb
- yes | sudo dkp-pacman -Syu devkitPPC wut-tools
- export DEVKITPRO=/opt/devkitpro
- export DEVKITPPC=/opt/devkitpro/devkitPPC
script:
- cd "$TRAVIS_BUILD_DIR"
# Build wut
- mkdir build && cd build
- cmake -DCMAKE_INSTALL_PREFIX=wut_install ../
- make -j4 install
- export WUT_ROOT=$PWD/wut_install
- cd ../
# Build tests
- cd tests
- mkdir build && cd build
- cmake ../
- make -j4 VERBOSE=TRUE
- cd ../../
# Build samples
- cd samples
- mkdir build && cd build
- cmake -DCMAKE_INSTALL_PREFIX=$WUT_ROOT/samples ../
- make -j4 VERBOSE=TRUE install
- cd ../../
# Create deploy zips
- cd $WUT_ROOT
- 7z a $DEPLOY_FILE .
deploy:
provider: releases
skip_cleanup: true
api_key:
secure: gH3xndfXg4xCXUaqYvGecr9mzLXMMPOZfpqhnwuTIVnlAcR3jKeJ/3jlLs2Rm+GL1Mhby6f1YmtlhRX+G+OzDnp67m3kZaPsdZxqdn7SnBrVFEAbyv92wVullZB5O4mi7hYz5kAqFl0nzzfv7x5O1UtAqM3btFQAM4hiLDo2yqxsGCZsAsOlGCrwt6602hz0qnJ7PeOFAsxygdhdCmF+oWSzXVt0CZ1QfCZQzflZNO0M/CbYRtEcRE3iiHSWo6GRvMkTPw5o5Xca4cyuf1E86Aaym/ccwjKbrEIj77tImiH5iGhF7urXnjk2AxmpXHcDHSdB1WFLHdkbE7tdyhc11ahBJeOcof/LN3t/+HVqwjpse17kBBemc0y4pHyxSRZFoERQaP2mEvUMS1dVQXVdHm0RT3IKk7QBlRw0WTJX7sE836dhRenO03WyFgDRxNC6AT7DZsyN2UDEbOPFosBboiU73I3r8gvQtOKpMuDji6RPqUTUgEsB5HHXK1HLyijTAVbZPErNX97ucl6LdQ/uxmd/xgbZFc0jBUKa50H1/UN9LDlbw4Lf51Frl4rxg6DdZtDVx+6FTNaALm1iwAnVa7lhCDoH5Z+KVKJjKY1xW8P+OtTVFs1ZR/hkwblgc72hDShRyWkycYQTYgHwnRHL3OOObXDT6hZzggE5NwZJ8wg=
file_glob: true
file: $WUT_ROOT/$DEPLOY_FILE
on:
repo: devkitPro/wut
tags: true

View File

@ -1,51 +0,0 @@
#### wut 1.0.0-beta10
###### Breaking changes
- libwhb's network command server (`WHBCommandServer`) functions and the associated `<whb/commandserver.h>` header have been removed.
###### Deprecations
- The CMake macro `wut_create_rpl` has been re-implemented. The new version doesn't create a build target for the rpx/rpl binary, and only regenerates the rpx/rpl when actually necessary. The new syntax is `wut_create_rpl(<TARGET>)`. Deprecated calls in the form `wut_create_rpl(file.rpx <TARGET>)` will fall through to the old implementation.
###### API additions
- Cafe functions `inet_ntoa_r`, `inet_ntop`, and `inet_pton` have been added to `<nsysnet/socket.h>` (thanks [@Crayon2000](https://github.com/devkitPro/wut/commit/df93bf758f54c1d3a65bc7205a81a6da382c31a0)!)
- Cafe functions `VPADGetTPCalibratedPointEx`, `VPADGetTPCalibrationParam`, and `VPADSetTPCalibrationParam` have been added to `<vpad/input.h>`.
- Cafe functions `OSGetOSID` and `__OSGetProcessSDKVersion` have been added to `<coreinit/systeminfo.h>` (thanks [@Maschell](https://github.com/devkitPro/wut/commit/fe230e06ccf43f3b13d25643399dd9a04bf7eb43)!)
- Cafe function `_SYSGetSystemApplicationTitleId` has been added to `<sysapp/title.h>` (thanks [@Maschell](https://github.com/devkitPro/wut/commit/35c20d8700cddd46f5e37789617629e010a8ad1f)!)
- Cafe functions `SYSGetCallerPFID`, `_SYSGetSystemApplicationTitleIdByProdArea`, and `SYSGetCallerTitleId` have been added `<sysapp/title.h>`.
- Cafe functions `OSReportVerbose`, `OSReportInfo`, and `OSReportWarn` have been added to `<coreinit/debug.h>`.
- New libwhb functions `WHBGfxGetTVColourBuffer`, `WHBGfxGetTVDepthBuffer`, `WHBGfxGetTVContextState`, and equivalents for the DRC, have been added to `<whb/gfx.h>`.
- [Helper functions](https://github.com/devkitPro/wut/commit/f0ed4fb91ff7f738f5e36e54094935530cbbbefe) have been added to `<gx2/shaders.h>` which can look up shader uniforms by name.
- A new header file, `<nn/acp.h>`, has been added for nn_acp's meta.xml functionality (thanks [@Maschell](https://github.com/devkitPro/wut/commit/7f2c9b5d696b609d1be8f95597e4be02097f2608)!)
- Cafe structure `KPADStatus` (from `<padscore/kpad.h>`) has been documented, had accelerometer data added, and had nunchuk-specific values added (thanks [@Crayon2000](https://github.com/devkitPro/wut/commit/78ee1c51bc11ae53edd6b6025f8bdb984e05b497)!)
- Various Cafe structures in `<coreinit/mcp.h>` have been updated with newly-discovered members (thanks [@Maschell](https://github.com/devkitPro/wut/commit/b712686c388a7a9cb0a03a82358386df105ac7f7), [again](https://github.com/devkitPro/wut/commit/d1d2da63adabc55de70e82310f312b1b5fe450c2)!)
- Cafe enum `GX2PrimitiveMode` has been updated to include the `LINES_ADJACENCY`, `LINE_STRIP_ADJACENCY`, `TRIANGLES_ADJACENCY`, `TRIANGLE_STRIP_ADJACENCY`, `RECTS`, and `LINE_LOOP` primitives.
###### Other changes
- Cafe functions throughout the GX2 headers have had `const` applied as appropriate, allowing for better compiler optimisations.
- libwhb's Console and graphics helpers have been refactored to better support Cafe's multitasking and home menu overlay. Applications using WHBConsole can now be backgrounded and resumed without issue.
- Cafe's KPAD library has been documented, WPAD has been partially documented, and various fixes were made to the VPAD documentation (thanks [@Crayon2000](https://github.com/devkitPro/wut/commit/78ee1c51bc11ae53edd6b6025f8bdb984e05b497)!)
- CMake now searches for libraries in internal devkitPPC folders, allowing `find_library(m)` (and CMake pkg-config equivalents) to work as expected.
- CMake now sets the pkg-config binary to `powerpc-eabi-pkg-config`, installable from the `dkp-libs` repo as `wiiu-pkg-config`. Application scripts no longer need to set `PKG_CONFIG_EXECUTABLE`.
- wutstdc++'s threading implementation has been changed to behave more like a pre-emptive scheduler, yielding a thread after 1ms runtime. This applies to `std::thread` and `<threads.h>`, not applications working with `OSThread` directly.
#### wut 1.0.0-beta9
###### Breaking changes
- coreinit's `exit` is no longer defined in `<coreinit/exit.h>`. Please use `<stdlib.h>` instead, which pulls in newlib's exit.
- RPL import sections (`.fimport_coreinit` etc.) are now garbage-collected when using wut-tools 1.1.0 or above (required). Code relying on weak links to Cafe functions may exhibit different behaviour.
- `snd_core` and `snd_user` are no longer linked, due to naming conflicts with `sndcore2` and `snduser2`. wut has never shipped headers for these libraries, but if you are using them, please switch to `sndcore2` and `snduser2`.
- Changes to CMake's linker flags may cause existing build trees to fail. Please delete any old build files and re-run CMake.
- Two new symbols, `__rpx_start` and `__rpl_start`, are now used internally by the toolchain, while `_start` is now undefined. As usual, applications are strongly discouraged from prefixing any symbol with two underscores, in order to avoid conflicts of this type.
###### Deprecations
- `WUT_ROOT` should no longer be defined in the user's environment, and will be set to `$DEVKITPRO/wut` internally. CMake lists and makefiles that use `$WUT_ROOT/share` to find `wut.mk` or `wut.toolchain.cmake` should be changed to `$DEVKITPRO/wut/share`.
- All of wut's static libraries (`-lcoreinit`, `-lwhb`, etc.) have been merged into a single `libwut`, which gets automatically linked in for all builds. While empty static libraries have been provided for CMake builds to ease the transition, these will be removed eventually. Applications should remove the build flags to link any of wut's libraries.
- Similarly, wut's build configuration options (devoptab, wutmalloc, newlib) are now integrated into `libwut`. For CMake builds, the `wut_enable_*` macros will now log a deprecation warning, and should be removed as soon as possible.
- Use of `wut.mk` as a build system is now deprecated. Applications should move to `wut_rules` and devkitPro-style makefiles, such as those in [the samples](/samples/make). `wut.mk` will not be updated further, and will be removed in a future release.
###### Other changes
- Builds refactored: wut now uses Makefiles to build itself, as well as providing a devkitPro-style `wut_rules` file - see the `samples/make` folder. The cmake samples are now in `samples/cmake`.
- A new linking feature, `__rplwrap`, was added to help deal with conflicts between newlib's and Cafe's functions. Because of this, wut 1.0.0-beta9 requires wut-tools 1.1.0 or newer.
- Using rplwrap, newlib's `exit` is now correctly chained with coreinit's - calls like `atexit` should work; whether calling `exit` or just returning from `main`. Applications using coreinit's `_Exit` are encouraged to migrate to a normal `exit` call.
- A new header file, `<coreinit/codegen.h>`, has been added and documented for OSCodegen functionality.
#### wut 1.0.0-beta8

38
CMakeLists.txt Normal file
View File

@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.2)
set(WUT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(ENV{WUT_ROOT} "${WUT_ROOT}")
set(CMAKE_TOOLCHAIN_FILE "${WUT_ROOT}/share/wut.toolchain.cmake")
project(wut)
option(WUT_BUILD_DOCS "Build documentation" OFF)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin")
if(WUT_BUILD_DOCS)
add_subdirectory(docs)
endif()
find_program(WUT_RPLIMPORTGEN NAMES rplimportgen PATHS "${DEVKITPRO}/tools/bin")
if(NOT WUT_RPLIMPORTGEN)
message(FATAL_ERROR "Could not find rplimportgen.")
endif()
add_subdirectory(cafe)
add_subdirectory(libraries)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/share/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share")

164
Makefile
View File

@ -1,164 +0,0 @@
TOPDIR ?= $(CURDIR)
include $(TOPDIR)/share/wut_rules
export WUT_MAJOR := 1
export WUT_MINOR := 0
export WUT_PATCH := 0
VERSION := $(WUT_MAJOR).$(WUT_MINOR).$(WUT_PATCH)
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET := wut
#BUILD := build
SOURCES := cafe \
libraries/wutcrt \
libraries/wutnewlib \
libraries/wutstdc++ \
libraries/wutmalloc \
libraries/wutdevoptab \
libraries/wutsocket \
libraries/libwhb/src \
libraries/libgfd/src \
libraries/nn_swkbd
DATA := data
INCLUDES := include \
libraries/libwhb/include \
libraries/libgfd/include \
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS := -g -Wall -Werror -save-temps \
-ffunction-sections -fdata-sections \
$(MACHDEP) \
$(BUILD_CFLAGS)
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
CXXFLAGS := $(CFLAGS) -std=gnu++17
ASFLAGS := -g $(MACHDEP)
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS :=
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
DEFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.def)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(DEFFILES:.def=.o) $(SFILES:.s=.o) $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I.
.PHONY: all dist-bin dist-src dist install clean
#---------------------------------------------------------------------------------
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
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
lib:
@[ -d $@ ] || mkdir -p $@
release:
@[ -d $@ ] || mkdir -p $@
debug:
@[ -d $@ ] || mkdir -p $@
lib/libwut.a : lib release $(SOURCES) $(INCLUDES)
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
BUILD_CFLAGS="-DNDEBUG=1 -O2" \
DEPSDIR=$(CURDIR)/release \
--no-print-directory -C release \
-f $(CURDIR)/Makefile
lib/libwutd.a : lib debug $(SOURCES) $(INCLUDES)
@$(MAKE) BUILD=debug OUTPUT=$(CURDIR)/$@ \
BUILD_CFLAGS="-DDEBUG=1 -Og" \
DEPSDIR=$(CURDIR)/debug \
--no-print-directory -C debug \
-f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -rf release debug lib
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES)
$(OFILES_SRC) : $(HFILES)
#---------------------------------------------------------------------------------
%_bin.h %.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
[![Build status](https://github.com/devkitPro/wut/workflows/C%2FC%2B%2B%20CI/badge.svg)](https://github.com/devkitPro/wut/actions?workflow=C%2FC%2B%2B+CI)
[![Build Status](https://travis-ci.org/devkitPro/wut.svg)](https://travis-ci.org/devkitPro/wut)
# wut
Let's try make a Wii U Toolchain / SDK for creating rpx/rpl.
@ -17,15 +17,39 @@ sudo dkp-pacman -Syu devkitPPC wut-tools wut
## Usage
See [samples](samples) for examples of how to use wut.
The [share/wut.cmake](share/wut.cmake) file provides some helpers for your build:
- `wut_create_rpx(target)` - Will create an .rpx file from your CMake target generated by `add_executable`
- `wut_create_rpl(target)` - Will create an .rpl file from your CMake target generated by `add_executable`
- `wut_add_exports(target exports.def)` - Will add exports specified in exports.def for the given target
The [share/wut.cmake](share/wut.cmake) file provides several helpers for your build:
- `wut_create_rpx(target.rpx executable)` - Will create an .rpx file from your CMake target generated by `add_executable`
- `wut_enable_newlib(target)` - Links against the wut implementation of newlib, this is useful for using any function from the C standard library
- `wut_enable_stdcpp(target)` - Links against the wut implementation of stdcpp, this is useful for using any function from the C++ standard library. This will call wut_enable_newlib if you have not already done so.
- `wut_default_malloc(target)` - By default newlib will allocate 90% of the default heap for use with sbrk & malloc, if this is unacceptable to you then you should use this as it replaces the newlib malloc functions which ones which redirect to the CafeOS default heap functions such as MEMAllocFromDefaultHeap.
- `wut_enable_devoptab(target)` - This links in wutdevoptab which is useful for using the libc file functions with paths such as `fopen("sd:/file.txt", "r")` to read files from the sd card
## Building from source
A minimal CMakeLists.txt file for a C++ project might look like:
```
cmake_minimum_required(VERSION 3.2)
project(helloworld_cpp CXX)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
add_executable(helloworld_cpp
main.cpp)
wut_enable_stdcpp(helloworld_cpp)
wut_create_rpx(helloworld_cpp.rpx helloworld_cpp)
```
Which you would compile with
```
export DEVKITPPC=/opt/devkitpro/devkitPPC
export WUT_ROOT=<path/to/install>
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake ../
make
```
## Building
Requires:
- CMake
- [devkitPPC](https://devkitpro.org/wiki/Getting_Started)
- [wut-tools](https://github.com/devkitPro/wut-tools)
### Building with devkitPPC
Ensure you have the devkitPPC and wut-tools packages provided by [devkitPro](https://devkitpro.org/wiki/Getting_Started):
@ -35,45 +59,30 @@ export DEVKITPRO=/opt/devkitpro
export DEVKITPPC=/opt/devkitpro/devkitPPC
```
Then it's as simple as running make or make install:
Then you can build wut like any other CMake project:
```
make
git clone --recursive https://github.com/devkitPro/wut.git
cd wut
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=<path/to/install> ../
make install
export WUT_ROOT=<path/to/install>
```
Then for any wut project you want to build you must use the wut.toolchain.cmake script:
```
cd ../samples/helloworld
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake ../
make
```
### Building with a locally built wut-tools
If you have locally built wut-tools then just add the directory containing the built binaries to PATH and they should be used instead:
```
export PATH=/path/to/wut-tools/bin:$PATH
make
```
## Building wut projects
### Building wut projects with make
Simply export the required variables and call make.
```
export DEVKITPRO=/opt/devkitpro
export DEVKITPPC=/opt/devkitpro/devkitPPC
make
```
### Building wut projects with CMake
For any wut project you want to build with CMake you must use the wut.toolchain.cmake toolchain file:
```
export DEVKITPRO=/opt/devkitpro
cd samples/cmake/helloworld
cd wut
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/wut/share/wut.toolchain.cmake ../
cmake ../
make
```
A minimal CMakeLists.txt file for a C++ project might look like:
```
cmake_minimum_required(VERSION 3.2)
project(helloworld_cpp CXX)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_executable(helloworld_cpp main.cpp)
wut_create_rpx(helloworld_cpp.rpx helloworld_cpp)
```

87
cafe/CMakeLists.txt Normal file
View File

@ -0,0 +1,87 @@
cmake_minimum_required(VERSION 3.2)
# Load up the in-tree toolchain
set(WUT_ROOT "{CMAKE_CURRENT_SOURCE_DIR}/.." CACHE STRING "")
set(WUT_RPLIMPORTGEN "" CACHE STRING "")
set(ENV{WUT_ROOT} ${WUT_ROOT})
set(CMAKE_TOOLCHAIN_FILE $ENV{WUT_ROOT}/share/wut.toolchain.cmake)
project(cafe C CXX)
enable_language(ASM)
macro(add_cafe_library target)
add_custom_command(
OUTPUT ${target}.s
COMMAND ${WUT_RPLIMPORTGEN} ${CMAKE_CURRENT_SOURCE_DIR}/${target}.def ${target}.s
DEPENDS ${target}.def)
add_library(${target} STATIC ${target}.s)
install(TARGETS ${target} ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
endmacro()
add_cafe_library(avm)
add_cafe_library(camera)
add_cafe_library(coreinit)
add_cafe_library(dc)
add_cafe_library(dmae)
add_cafe_library(drmapp)
add_cafe_library(erreula)
add_cafe_library(gx2)
add_cafe_library(h264)
add_cafe_library(lzma920)
add_cafe_library(mic)
add_cafe_library(nfc)
add_cafe_library(nio_prof)
add_cafe_library(nlibcurl)
add_cafe_library(nlibnss)
add_cafe_library(nlibnss2)
add_cafe_library(nn_ac)
add_cafe_library(nn_acp)
add_cafe_library(nn_act)
add_cafe_library(nn_aoc)
add_cafe_library(nn_boss)
add_cafe_library(nn_ccr)
add_cafe_library(nn_cmpt)
add_cafe_library(nn_dlp)
add_cafe_library(nn_ec)
add_cafe_library(nn_fp)
add_cafe_library(nn_hai)
add_cafe_library(nn_hpad)
add_cafe_library(nn_idbe)
add_cafe_library(nn_ndm)
add_cafe_library(nn_nets2)
add_cafe_library(nn_nfp)
add_cafe_library(nn_nim)
add_cafe_library(nn_olv)
add_cafe_library(nn_pdm)
add_cafe_library(nn_save)
add_cafe_library(nn_sl)
add_cafe_library(nn_spm)
add_cafe_library(nn_temp)
add_cafe_library(nn_uds)
add_cafe_library(nn_vctl)
add_cafe_library(nsysccr)
add_cafe_library(nsyshid)
add_cafe_library(nsyskbd)
add_cafe_library(nsysnet)
add_cafe_library(nsysuhs)
add_cafe_library(nsysuvd)
add_cafe_library(ntag)
add_cafe_library(padscore)
add_cafe_library(proc_ui)
add_cafe_library(snd_core)
add_cafe_library(snd_user)
add_cafe_library(sndcore2)
add_cafe_library(snduser2)
add_cafe_library(swkbd)
add_cafe_library(sysapp)
add_cafe_library(tcl)
add_cafe_library(tve)
add_cafe_library(uac)
add_cafe_library(uac_rpl)
add_cafe_library(usb_mic)
add_cafe_library(uvc)
add_cafe_library(uvd)
add_cafe_library(vpad)
add_cafe_library(vpadbase)
add_cafe_library(zlib125)

View File

@ -1210,6 +1210,7 @@ bspQuery
bspRead
bspShutdown
bspWrite
exit
//memclr
//memcpy
//memmove
@ -1228,9 +1229,6 @@ smdSimpleBufFree
smdSimpleBufGetStatistics
smdSimpleBufPoolCreate
:TEXT_WRAP
exit
:DATA
MEMAllocFromDefaultHeap
MEMAllocFromDefaultHeapEx

View File

@ -4,6 +4,7 @@
NSSLAddServerPKI
NSSLAddServerPKIExternal
NSSLAddServerPKIGroups
NSSLCreateConnection
NSSLCreateContext
NSSLDestroyConnection
NSSLDestroyContext
@ -70,16 +71,6 @@ WDUdsUninitParent
WDWpsStart
WDWpsStartAsync
WDWpsStop
htonl
htons
inet_aton
inet_ntoa
inet_ntoa_r
ntohl
ntohs
:TEXT_WRAP
NSSLCreateConnection
accept
bind
clear_resolver_cache
@ -101,6 +92,11 @@ getpeername
getsocklibopt
getsockname
getsockopt
htonl
htons
inet_aton
inet_ntoa
inet_ntoa_r
inet_ntop
inet_pton
listen
@ -151,6 +147,8 @@ netconf_set_wifi_cfg
netconf_setopt
netconf_write_aoss_config
netconf_write_compat_profile_id
ntohl
ntohs
recv
recvfrom
recvfrom_ex

272
cafe/snd_core.def Normal file
View File

@ -0,0 +1,272 @@
:NAME snd_core
:TEXT
AI2CheckInit
AI2GetDMABytesLeft
AI2GetDMAEnableFlag
AI2GetDMALength
AI2GetDMAStartAddr
AI2GetDSPSampleRate
AI2Init
AI2InitDMA
AI2RegisterDMACallback
AI2Reset
AI2SetDSPSampleRate
AI2StartDMA
AI2StopDMA
AICheckInit
AIDRCGetDMALength
AIDRCGetDMAStartAddr
AIDRCRegisterDMACallback
AIGetAudioFrameCount
AIGetDMABytesLeft
AIGetDMAEnableFlag
AIGetDMALength
AIGetDMARange
AIGetDMAStartAddr
AIGetDSPSampleRate
AII2S3Init
AII2S5Init
AIInit
AIInitDMA
AIQuit
AIRegisterDMABuffer
AIRegisterDMACallback
AIReset
AISetChannel
AISetCloneMode
AISetDSPSampleRate
AISetFormatChangeState
AIStartDMA
AIStopDMA
AXAcquireVoice
AXAcquireVoiceEx
AXCheckVoiceOffsets
AXComputeLpfCoefs
AXDecodeAdpcmData
AXDeregisterAppFrameCallback
AXFreeVoice
AXGetAdpcmData
AXGetAdpcmOutputSize
AXGetAdpcmWorkSize
AXGetAuxACallback
AXGetAuxAReturnVolume
AXGetAuxBCallback
AXGetAuxBReturnVolume
AXGetAuxCCallback
AXGetAuxCReturnVolume
AXGetAuxCallback
AXGetAuxDRCCallback
AXGetAuxReturnVolume
AXGetDRCAuxReturnVolume
AXGetDRCVSMode
AXGetDSPCyclesFudgeFactor
AXGetDefaultMixerSelect
AXGetDeviceChannelCount
AXGetDeviceFinalMixCallback
AXGetDeviceFinalOutput
AXGetDeviceMode
AXGetDeviceRemixMatrix
AXGetDeviceUpsampleStage
AXGetDeviceVolume
AXGetDroppedVoiceCount
AXGetDspCycles
AXGetDspLoad
AXGetDspLoadLimit
AXGetMasterDRCVolume
AXGetMasterVolume
AXGetMaxDspCycles
AXGetMaxDspVoices
AXGetMaxVoices
AXGetMode
AXGetNumDspVoices
AXGetNumVoices
AXGetPostFinalMixCallback
AXGetPpcLoad
AXGetPpcLoadLimit
AXGetProfile
AXGetSwapProfile
AXGetVoiceCurrentOffsetEx
AXGetVoiceLoopCount
AXGetVoiceMixerSelect
AXGetVoiceOffsets
AXGetVoiceOffsetsEx
AXGlitch_GetCount
AXGlitch_PrintTrace
AXGlitch_RegisterCatcher
AXGlitch_trace
AXInit
AXInitEx
AXInitExSpecifyMem
AXInitProfile
AXInitSpecifyMem
AXIsAudioOutReady
AXIsInit
AXIsTransitionAudioDone
AXIsVoiceRunning
AXMakeCompressorTable
AXMixGetSwapProfile
AXPrepareEfxData
AXQuit
AXRegisterAppFrameCallback
AXRegisterAuxACallback
AXRegisterAuxBCallback
AXRegisterAuxCCallback
AXRegisterAuxCallback
AXRegisterAuxDRCCallback
AXRegisterCallback
AXRegisterDRCCallback
AXRegisterDeviceFinalMixCallback
AXRegisterExceedCallback
AXRegisterFrameCallback
AXRegisterPostFinalMixCallback
AXRmtAdvancePtr
AXRmtGetSamples
AXRmtGetSamplesLeft
AXSetAuxAReturnVolume
AXSetAuxBReturnVolume
AXSetAuxCReturnVolume
AXSetAuxReturnVolume
AXSetDRCAuxReturnVolume
AXSetDRCVSDownmixBalance
AXSetDRCVSLC
AXSetDRCVSLimiter
AXSetDRCVSLimiterThreshold
AXSetDRCVSMode
AXSetDRCVSOutputGain
AXSetDRCVSSpeakerPosition
AXSetDRCVSSurroundDepth
AXSetDRCVSSurroundLevelGain
AXSetDSPCyclesFudgeFactor
AXSetDefaultMixerSelect
AXSetDeviceCompressor
AXSetDeviceCompressorTable
AXSetDeviceLinearUpsampler
AXSetDeviceMode
AXSetDeviceRemixMatrix
AXSetDeviceUpsampleStage
AXSetDeviceVolume
AXSetDspLoadLimit
AXSetMasterDRCVolume
AXSetMasterVolume
AXSetMaxDspCycles
AXSetMaxDspVoices
AXSetMaxVoices
AXSetMode
AXSetPpcLoadLimit
AXSetStepMode
AXSetUpTransitionAudio
AXSetVoiceAdpcm
AXSetVoiceAdpcmLoop
AXSetVoiceBiquad
AXSetVoiceBiquadCoefs
AXSetVoiceCurrentOffset
AXSetVoiceCurrentOffsetEx
AXSetVoiceDRCMix
AXSetVoiceDeviceMix
AXSetVoiceEndOffset
AXSetVoiceEndOffsetEx
AXSetVoiceItdOn
AXSetVoiceItdTarget
AXSetVoiceLoop
AXSetVoiceLoopOffset
AXSetVoiceLoopOffsetEx
AXSetVoiceLpf
AXSetVoiceLpfCoefs
AXSetVoiceMix
AXSetVoiceMixerSelect
AXSetVoiceOffsets
AXSetVoiceOffsetsEx
AXSetVoicePriority
AXSetVoiceRmtIIR
AXSetVoiceRmtIIRCoefs
AXSetVoiceRmtMix
AXSetVoiceRmtOn
AXSetVoiceRmtSrc
AXSetVoiceSamplesAddr
AXSetVoiceSrc
AXSetVoiceSrcRatio
AXSetVoiceSrcType
AXSetVoiceState
AXSetVoiceType
AXSetVoiceVe
AXSetVoiceVeDelta
AXStartTransitionAudio
AXUpdateDeviceModes
AXUserBegin
AXUserEnd
AXUserIsProtected
AXVoiceBegin
AXVoiceEnd
AXVoiceIsProtected
DRCVS_GetVersion
DRCVS_Initialize
DRCVS_Process
DRCVS_Quit
DRCVS_SetDirectionFilterCoef
DRCVS_SetDownmixBalance
DRCVS_SetEqCoef
DRCVS_SetHeadphoneGain
DRCVS_SetLimiter
DRCVS_SetLimiterThreshold
DRCVS_SetOutputMode
DRCVS_SetSampleFreq
DRCVS_SetSlevGain
DRCVS_SetSpacialFilterCoef
DRCVS_SetSpeakerGain
DRCVS_SetSurroundDepth
DSPAddTask
DSPAssertInt
DSPAssertTask
DSPCancelTask
DSPCheckInit
DSPCheckMailFromDSP
DSPCheckMailToDSP
DSPGetDMAStatus
DSPH_RunTask
DSPH_WaitTaskComplete
DSPHalt
DSPInit
DSPQuit
DSPReadCPUToDSPMbox
DSPReadMailFromDSP
DSPReset
DSPSendMailToDSP
DSPUnhalt
ISRREnable
ISRRGetMsgQ
ISRRGetNewMsg
ISRRInit
ISRRQuit
ISRSendMessage
_CheckMailFromDSP
_CheckMailToDSP
_InitDsp
_ReadMailFromDSP
_SendMailToDSP
__AXGetAppIoMode
__AXGetMixMode
__AXSetAppIoMode
aiBSPHardwareVersion
axDspSlave
axDspSlaveBalanced
axDspSlaveBalancedLength
axDspSlaveLength
check_os_audio_transition_flag
dsp_os_switch
dsp_os_switchLength
dump_dsp_data
ex_addr_reg_stat
pcd
ppf_dn_e_coef
ppf_dn_o_coef
ppf_up_0_coef
ppf_up_1_coef
ppf_up_2_coef
s_board_type
set_os_audio_transition_flag
slaveData
slaveLength
start_os_audio_transition
stop_os_audio_transition
vs

379
cafe/snd_user.def Normal file
View File

@ -0,0 +1,379 @@
:NAME snd_user
:TEXT
AXART3DSound
AXARTAddArticulator
AXARTAddSound
AXARTCents
AXARTInit
AXARTInitArt3D
AXARTInitArtAuxAVolume
AXARTInitArtAuxAVolumeEnv
AXARTInitArtAuxAVolumeMod
AXARTInitArtAuxBVolume
AXARTInitArtAuxBVolumeEnv
AXARTInitArtAuxBVolumeMod
AXARTInitArtAuxCVolume
AXARTInitArtAuxCVolumeEnv
AXARTInitArtAuxCVolumeMod
AXARTInitArtFader
AXARTInitArtItd
AXARTInitArtLpf
AXARTInitArtPanning
AXARTInitArtPitch
AXARTInitArtPitchEnv
AXARTInitArtPitchMod
AXARTInitArtRmt
AXARTInitArtRmtAuxVolume
AXARTInitArtRmtFader
AXARTInitArtSrctype
AXARTInitArtVolume
AXARTInitArtVolumeEnv
AXARTInitArtVolumeMod
AXARTInitLfo
AXARTInitSound
AXARTLfo
AXARTLpf
AXARTNoise
AXARTPitchEnv
AXARTQuit
AXARTRemoveArticulator
AXARTRemoveSound
AXARTReverseSaw
AXARTSaw
AXARTServiceSound
AXARTServiceSounds
AXARTSet3DDistanceScale
AXARTSet3DDopplerScale
AXARTSine
AXARTSquare
AXARTTriangle
AXARTVolumeEnv
AXFX2GetMemAllocFns
AXFX2SetMemAllocFns
AXFX2chChorusCallback
AXFX2chChorusGetMemSize
AXFX2chChorusInit
AXFX2chChorusSettings
AXFX2chChorusSettingsUpdate
AXFX2chChorusShutdown
AXFX2chMultiDelayCallback
AXFX2chMultiDelayGetMemSize
AXFX2chMultiDelayInit
AXFX2chMultiDelaySettingsUpdate
AXFX2chMultiDelayShutdown
AXFX2chReverbCallback
AXFX2chReverbGetMemSize
AXFX2chReverbInit
AXFX2chReverbParametersPreset
AXFX2chReverbSettingsUpdate
AXFX2chReverbShutdown
AXFX4chChorusCallback
AXFX4chChorusGetMemSize
AXFX4chChorusInit
AXFX4chChorusSettings
AXFX4chChorusSettingsUpdate
AXFX4chChorusShutdown
AXFX4chMultiDelayCallback
AXFX4chMultiDelayGetMemSize
AXFX4chMultiDelayInit
AXFX4chMultiDelaySettingsUpdate
AXFX4chMultiDelayShutdown
AXFX4chReverbCallback
AXFX4chReverbGetMemSize
AXFX4chReverbInit
AXFX4chReverbParametersPreset
AXFX4chReverbSettingsUpdate
AXFX4chReverbShutdown
AXFX6ch6chReverbCallback
AXFX6ch6chReverbGetMemSize
AXFX6ch6chReverbInit
AXFX6ch6chReverbParametersPreset
AXFX6ch6chReverbSettingsUpdate
AXFX6ch6chReverbShutdown
AXFX6chChorusCallback
AXFX6chChorusGetMemSize
AXFX6chChorusInit
AXFX6chChorusSettings
AXFX6chChorusSettingsUpdate
AXFX6chChorusShutdown
AXFX6chMultiDelayCallback
AXFX6chMultiDelayGetMemSize
AXFX6chMultiDelayInit
AXFX6chMultiDelaySettingsUpdate
AXFX6chMultiDelayShutdown
AXFX6chReverbCallback
AXFX6chReverbGetMemSize
AXFX6chReverbInit
AXFX6chReverbParametersPreset
AXFX6chReverbSettingsUpdate
AXFX6chReverbShutdown
AXFXChorusCallback
AXFXChorusCallbackDpl2
AXFXChorusExpCallback
AXFXChorusExpCallbackDpl2
AXFXChorusExpGetMemSize
AXFXChorusExpGetMemSizeDpl2
AXFXChorusExpInit
AXFXChorusExpInitDpl2
AXFXChorusExpSettings
AXFXChorusExpSettingsDpl2
AXFXChorusExpSettingsUpdate
AXFXChorusExpSettingsUpdateDpl2
AXFXChorusExpShutdown
AXFXChorusExpShutdownDpl2
AXFXChorusGetMemSize
AXFXChorusGetMemSizeDpl2
AXFXChorusInit
AXFXChorusInitDpl2
AXFXChorusSettings
AXFXChorusSettingsDpl2
AXFXChorusShutdown
AXFXChorusShutdownDpl2
AXFXDelayCallback
AXFXDelayCallbackDpl2
AXFXDelayExpCallback
AXFXDelayExpCallbackDpl2
AXFXDelayExpGetMemSize
AXFXDelayExpGetMemSizeDpl2
AXFXDelayExpInit
AXFXDelayExpInitDpl2
AXFXDelayExpSettings
AXFXDelayExpSettingsDpl2
AXFXDelayExpSettingsUpdate
AXFXDelayExpSettingsUpdateDpl2
AXFXDelayExpShutdown
AXFXDelayExpShutdownDpl2
AXFXDelayGetMemSize
AXFXDelayGetMemSizeDpl2
AXFXDelayInit
AXFXDelayInitDpl2
AXFXDelaySettings
AXFXDelaySettingsDpl2
AXFXDelayShutdown
AXFXDelayShutdownDpl2
AXFXGetHooks
AXFXMultiChChorusCallback
AXFXMultiChChorusGetMemSize
AXFXMultiChChorusInit
AXFXMultiChChorusSettings
AXFXMultiChChorusSettingsUpdate
AXFXMultiChChorusSettingsUpdateNoReset
AXFXMultiChChorusShutdown
AXFXMultiChDelayCallback
AXFXMultiChDelayGetMemSize
AXFXMultiChDelayInit
AXFXMultiChDelaySettingsUpdate
AXFXMultiChDelaySettingsUpdateNoReset
AXFXMultiChDelayShutdown
AXFXMultiChReverbCallback
AXFXMultiChReverbGetMemSize
AXFXMultiChReverbInit
AXFXMultiChReverbParametersPreset
AXFXMultiChReverbSettingsUpdate
AXFXMultiChReverbSettingsUpdateNoReset
AXFXMultiChReverbShutdown
AXFXReverbHiCallback
AXFXReverbHiCallbackDpl2
AXFXReverbHiExpCallback
AXFXReverbHiExpCallbackDpl2
AXFXReverbHiExpGetMemSize
AXFXReverbHiExpGetMemSizeDpl2
AXFXReverbHiExpInit
AXFXReverbHiExpInitDpl2
AXFXReverbHiExpSettings
AXFXReverbHiExpSettingsDpl2
AXFXReverbHiExpSettingsUpdate
AXFXReverbHiExpSettingsUpdateDpl2
AXFXReverbHiExpShutdown
AXFXReverbHiExpShutdownDpl2
AXFXReverbHiGetMemSize
AXFXReverbHiGetMemSizeDpl2
AXFXReverbHiInit
AXFXReverbHiInitDpl2
AXFXReverbHiSettings
AXFXReverbHiSettingsDpl2
AXFXReverbHiShutdown
AXFXReverbHiShutdownDpl2
AXFXReverbSettingsUpdate
AXFXReverbSettingsUpdateNoReset
AXFXReverbStdCallback
AXFXReverbStdCallbackDpl2
AXFXReverbStdExpCallback
AXFXReverbStdExpCallbackDpl2
AXFXReverbStdExpGetMemSize
AXFXReverbStdExpGetMemSizeDpl2
AXFXReverbStdExpInit
AXFXReverbStdExpInitDpl2
AXFXReverbStdExpSettings
AXFXReverbStdExpSettingsDpl2
AXFXReverbStdExpSettingsUpdate
AXFXReverbStdExpSettingsUpdateDpl2
AXFXReverbStdExpShutdown
AXFXReverbStdExpShutdownDpl2
AXFXReverbStdGetMemSize
AXFXReverbStdGetMemSizeDpl2
AXFXReverbStdInit
AXFXReverbStdInitDpl2
AXFXReverbStdSettings
AXFXReverbStdSettingsDpl2
AXFXReverbStdShutdown
AXFXReverbStdShutdownDpl2
AXFXSetHooks
AXFX_AllPass_Free
AXFX_AllPass_GetLen
AXFX_AllPass_Initialize
AXFX_AllPass_SetCoef
AXFX_AllPass_Tick
AXFX_Delay_Clear
AXFX_Delay_Free
AXFX_Delay_GetDelay
AXFX_Delay_GetMaximumDelay
AXFX_Delay_Initialize
AXFX_Delay_NextOut
AXFX_Delay_SetDelay
AXFX_Delay_TapOut
AXFX_Delay_TapOut_Interpolate
AXFX_Delay_Tick
AXFX_PS_Delay_Clear
AXFX_PS_Delay_Free
AXFX_PS_Delay_GetDelay
AXFX_PS_Delay_GetMaximumDelay
AXFX_PS_Delay_Initialize
AXFX_PS_Delay_NextOut
AXFX_PS_Delay_SetDelay
AXFX_PS_Delay_TapOut
AXFX_PS_Delay_TapOut_Interpolate
AXFX_PS_Delay_Tick
AXFX_PS_Dual_Delay_TapOut
AXFX_PS_Single_Delay_TapOut
ArticulationMutex
MIXAdjustAuxA
MIXAdjustAuxB
MIXAdjustAuxC
MIXAdjustDeviceAux
MIXAdjustDeviceFader
MIXAdjustDeviceLFE
MIXAdjustDevicePan
MIXAdjustDeviceSPan
MIXAdjustFader
MIXAdjustInput
MIXAdjustPan
MIXAdjustSPan
MIXAssignChannel
MIXAuxAIsPostFader
MIXAuxAPostFader
MIXAuxAPreFader
MIXAuxBIsPostFader
MIXAuxBPostFader
MIXAuxBPreFader
MIXAuxCIsPostFader
MIXAuxCPostFader
MIXAuxCPreFader
MIXDRCAdjustAux
MIXDRCAdjustFader
MIXDRCAdjustPan
MIXDRCAuxIsPostFader
MIXDRCAuxPostFader
MIXDRCAuxPreFader
MIXDRCGetAux
MIXDRCGetFader
MIXDRCGetPan
MIXDRCInitChannel
MIXDRCSetAux
MIXDRCSetFader
MIXDRCSetPan
MIXDeviceAuxIsPostFader
MIXDeviceAuxPostFader
MIXDeviceAuxPreFader
MIXGetAuxA
MIXGetAuxB
MIXGetAuxC
MIXGetDeviceAux
MIXGetDeviceFader
MIXGetDeviceLFE
MIXGetDevicePan
MIXGetDeviceSPan
MIXGetDeviceSoundMode
MIXGetFader
MIXGetInput
MIXGetPan
MIXGetSPan
MIXGetSoundMode
MIXInit
MIXInitChannel
MIXInitDeviceControl
MIXInitInputControl
MIXInitSpecifyMem
MIXIsMute
MIXMute
MIXQuit
MIXReleaseChannel
MIXResetAllDeviceControls
MIXResetControls
MIXResetDeviceControl
MIXRmtAdjustAux
MIXRmtAdjustFader
MIXRmtAuxIsPostFader
MIXRmtAuxPostFader
MIXRmtAuxPreFader
MIXRmtGetAux
MIXRmtGetFader
MIXRmtSetAux
MIXRmtSetFader
MIXRmtSetVolumes
MIXSetAuxA
MIXSetAuxB
MIXSetAuxC
MIXSetDeviceAux
MIXSetDeviceFader
MIXSetDeviceLFE
MIXSetDevicePan
MIXSetDeviceSPan
MIXSetDeviceSoundMode
MIXSetFader
MIXSetInput
MIXSetPan
MIXSetSPan
MIXSetSoundMode
MIXUnMute
MIXUpdateSettings
SEQAddSequence
SEQDRCGetVolume
SEQDRCSetVolume
SEQGetMixerSelect
SEQGetState
SEQGetTempo
SEQGetVolume
SEQInit
SEQQuit
SEQRegisterControllerCallback
SEQRemoveSequence
SEQRunAudioFrame
SEQSetMixerSelect
SEQSetState
SEQSetTempo
SEQSetVolume
SPGetSoundEntry
SPInitSoundTable
SPPrepareEnd
SPPrepareSound
SYNDRCGetMasterVolume
SYNDRCSetMasterVolume
SYNGetActiveNotes
SYNGetMasterVolume
SYNGetMidiController
SYNGetMixerSelect
SYNInit
SYNInitSpecifyMem
SYNInitSynth
SYNMidiInput
SYNQuit
SYNQuitSynth
SYNRunAudioFrame
SYNSetInitCallback
SYNSetMasterVolume
SYNSetMixerSelect
SYNSetUpdateCallback
SeqMutex
SynthMutex

38
cafe/zlib125.def Normal file
View File

@ -0,0 +1,38 @@
:NAME zlib125
:TEXT
adler32
compress
compress2
compressBound
crc32
deflate
deflateBound
deflateCopy
deflateEnd
deflateInit2_
deflateInit_
deflateParams
deflatePrime
deflateReset
deflateSetDictionary
deflateSetHeader
deflateTune
inflate
inflateBack
inflateBackEnd
inflateBackInit_
inflateCopy
inflateEnd
inflateGetHeader
inflateInit2_
inflateInit_
inflateMark
inflatePrime
inflateReset
inflateReset2
inflateSetDictionary
inflateSync
uncompress
zlibCompileFlags
zlibVersion

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.0.0-beta")
set(DOXYGEN_PROJECT_NUMBER "1.0.0-alpha")
set(DOXYGEN_PROJECT_BRIEF "Wii U Toolchain")
set(DOXYGEN_GENERATE_HTML YES)

View File

@ -3,7 +3,7 @@
*
* \section Introduction
* An experimental in-development Wii U toolchain, the source can be found at
* https://github.com/devkitPro/wut
* https://github.com/decaf-emu/wut
*
* \section Usage
* TODO.

View File

@ -1,48 +0,0 @@
#pragma once
#include <netinet/in.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
uint32_t
htonl(uint32_t hostlong);
uint16_t
htons(uint16_t hostshort);
uint32_t
ntohl(uint32_t netlong);
uint16_t
ntohs(uint16_t netshort);
in_addr_t
inet_addr(const char *cp);
int
inet_aton(const char *cp,
struct in_addr *inp);
char *
inet_ntoa(struct in_addr in);
char *
inet_ntoa_r(struct in_addr in,
char *buf);
const char *
inet_ntop(int af,
const void *src,
char *dst,
socklen_t size);
int
inet_pton(int af,
const char *src,
void *dst);
#ifdef __cplusplus
}
#endif

View File

@ -1,70 +0,0 @@
#pragma once
#include <wut.h>
/**
* \defgroup coreinit_bsp BSP
* \ingroup coreinit
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef int32_t BSPError;
typedef uint32_t BSPHardwareVersion;
typedef enum BSPErrors
{
BSP_ERROR_OK = 0,
BSP_ERROR_IOS_ERROR = 0x40,
BSP_ERROR_RESPONSE_TOO_LARGE = 0x80,
} BSPErrors;
typedef enum BSPHardwareVersions
{
BSP_HARDWARE_VERSION_UNKNOWN = 0x00000000,
// vWii Hardware Versions
BSP_HARDWARE_VERSION_HOLLYWOOD_ENG_SAMPLE_1 = 0x00000001,
BSP_HARDWARE_VERSION_HOLLYWOOD_ENG_SAMPLE_2 = 0x10000001,
BSP_HARDWARE_VERSION_HOLLYWOOD_PROD_FOR_WII = 0x10100001,
BSP_HARDWARE_VERSION_HOLLYWOOD_CORTADO = 0x10100008,
BSP_HARDWARE_VERSION_HOLLYWOOD_CORTADO_ESPRESSO = 0x1010000C,
BSP_HARDWARE_VERSION_BOLLYWOOD = 0x20000001,
BSP_HARDWARE_VERSION_BOLLYWOOD_PROD_FOR_WII = 0x20100001,
// WiiU Hardware Versions
BSP_HARDWARE_VERSION_LATTE_A11_EV = 0x21100010,
BSP_HARDWARE_VERSION_LATTE_A11_CAT = 0x21100020,
BSP_HARDWARE_VERSION_LATTE_A12_EV = 0x21200010,
BSP_HARDWARE_VERSION_LATTE_A12_CAT = 0x21200020,
BSP_HARDWARE_VERSION_LATTE_A2X_EV = 0x22100010,
BSP_HARDWARE_VERSION_LATTE_A2X_CAT = 0x22100020,
BSP_HARDWARE_VERSION_LATTE_A3X_EV = 0x23100010,
BSP_HARDWARE_VERSION_LATTE_A3X_CAT = 0x23100020,
BSP_HARDWARE_VERSION_LATTE_A3X_CAFE = 0x23100028,
BSP_HARDWARE_VERSION_LATTE_A4X_EV = 0x24100010,
BSP_HARDWARE_VERSION_LATTE_A4X_CAT = 0x24100020,
BSP_HARDWARE_VERSION_LATTE_A4X_CAFE = 0x24100028,
BSP_HARDWARE_VERSION_LATTE_A5X_EV = 0x25100010,
BSP_HARDWARE_VERSION_LATTE_A5X_EV_Y = 0x25100011,
BSP_HARDWARE_VERSION_LATTE_A5X_CAT = 0x25100020,
BSP_HARDWARE_VERSION_LATTE_A5X_CAFE = 0x25100028,
BSP_HARDWARE_VERSION_LATTE_B1X_EV = 0x26100010,
BSP_HARDWARE_VERSION_LATTE_B1X_EV_Y = 0x26100011,
BSP_HARDWARE_VERSION_LATTE_B1X_CAT = 0x26100020,
BSP_HARDWARE_VERSION_LATTE_B1X_CAFE = 0x26100028
} BSPHardwareVersions;
BSPError
bspInitializeShimInterface();
BSPError
bspGetHardwareVersion(BSPHardwareVersion* version);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -192,9 +192,6 @@ void
ICInvalidateRange(void *addr,
uint32_t size);
void
OSMemoryBarrier();
#ifdef __cplusplus
}
#endif

View File

@ -1,128 +0,0 @@
#pragma once
#include <wut.h>
/**
* \defgroup coreinit_codegen Codegen
* \ingroup coreinit
*
* Controls a memory area that can switch between writable and
* executable states, allowing dynamic code generation.
* For some applications, a codegen area is avilable for things like JIT or
* otherwise generating CPU instructions on the fly. Enabled apps can use
* \link OSCodegenGetVirtAddrRange \endlink to discover this area, then use
* \link OSSwitchSecCodeGenMode \endlink or \link OSCodegenCopy \endlink to
* move instructions in and out before executing them. Codegen can only be used
* from a specific, predetermined CPU core - see
* \link OSGetCodegenCore \endlink. Codegen can only be used when enabled in an
* app's cos.xml.
*
* <!-- TODO mark up cos.xml permission requirements, figure out sizing -->
* <!--
* sources:
* https://web.archive.org/web/20190327131828/https://wiiubrew.org/wiki/Coreinit.rpl#Codegen
* https://web.archive.org/web/20190421120656/https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/cafe/libraries/coreinit/coreinit_codegen.cpp
* -->
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
//! The memory permissions for the codegen area.
typedef enum OSCodegenSecMode
{
//! The area can be read or written to, but not executed.
CODEGEN_RW_ = 0,
//! The area can be read or executed, but not written to.
CODEGEN_R_X = 1,
} OSCodegenSecMode;
/**
* Gets the location and size of codegen memory, if available.
*
* \param outVirtualAddress
* Pointer to write the virtual address of the codegen area to. Will write 0 if
* codegen isn't available.
*
* \param outSize
* Pointer to write the size of the codegen area to. Will write 0 if codegen
* isn't available.
*
* \sa
* - \link OSGetSecCodeGenMode \endlink
*/
void
OSCodegenGetVirtAddrRange(uint32_t* outVirtualAddress,
uint32_t* outSize);
/**
* Gets the CPU core that's allowed to use codegen.
*
* \return
* The core id of the core that can use codegen.
*
* \sa
* - \link OSGetCoreId \endlink
*
* <!-- NOTE this appears to come from cos.xml: bottom few bits -->
*/
uint32_t
OSGetCodegenCore();
uint32_t
OSGetCodegenMode();
/**
* Switches the permissions on the codegen memory area. Use this function to
* move between writing code and executing it.
*
* \param mode
* The memory permission mode to use - one of \link OSCodegenSecMode \endlink.
*
* \returns
* \c true on success, or \c false on a failure, such as codegen not being
* available for this app or CPU core.
*/
BOOL
OSSwitchSecCodeGenMode(OSCodegenSecMode mode);
//TODO: online docs imply this returns true if codegen is *enabled*, though the
//name would imply it gets rw/rx status.
uint32_t
OSGetSecCodeGenMode();
/**
* Copies data from normal memory into the codegen area, leaving the area in
* \link CODEGEN_R_X \endlink mode.
* This function copies into the codegen area regardless
* of the current permission status by switching modes as required for the copy.
*
* \param dst
* The starting virtual address of the area in codegen memory to copy to. Must
* be a valid pointer
*
* \param src
* The starting virtual address of the source to copy from. Must be a valid
* pointer.
*
* \param size
* The size of the data to copy. Must not be 0, and must be small
* enough such that <tt>dst + size</tt> does not pass the end of the codegen
* area (see \link OSCodegenGetVirtAddrRange \endlink).
*
* \return
* \c TRUE on success, indicating the codegen area is now in
* \link CODEGEN_R_X \endlink, or \c FALSE on an error, such as invalid pointers
* or codegen not being available.
*
* <!-- NOTE this function has a specific bit required in cox.xml: 1 << 30? -->
*/
BOOL
OSCodegenCopy(void* dst, void* src, size_t size);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,59 +0,0 @@
#pragma once
#include <wut.h>
/**
* \defgroup coreinit_cosreport COS Report
* \ingroup coreinit
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
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{
COS_REPORT_MODULE_UNKNOWN_0 = 0,
COS_REPORT_MODULE_UNKNOWN_1 = 1,
COS_REPORT_MODULE_UNKNOWN_2 = 2,
COS_REPORT_MODULE_UNKNOWN_5 = 5,
} COSReportModule;
void
COSVReport(COSReportModule module,
COSReportLevel level,
const char* fmt,
...);
void
COSError(COSReportModule module,
const char* fmt,
...);
void
COSInfo(COSReportModule module,
const char* fmt,
...);
void
COSVerbose(COSReportModule module,
const char* fmt,
...);
void
COSWarn(COSReportModule module,
const char* fmt,
...);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -29,18 +29,6 @@ void
OSReport(const char *fmt, ...);
void
OSReportVerbose(const char *fmt, ...);
void
OSReportInfo(const char *fmt, ...);
void
OSReportWarn(const char *fmt, ...);
void
OSPanic(const char *file,
uint32_t line,
@ -60,19 +48,8 @@ OSGetSymbolName(uint32_t addr,
uint32_t
OSGetUPID();
BOOL
OSIsDebuggerInitialized();
BOOL
OSIsDebuggerPresent();
BOOL
OSIsECOBoot();
BOOL
OSIsECOMode();
BOOL
void
DisassemblePPCOpcode(uint32_t *opcode,
char *buffer,
uint32_t bufferSize,

View File

@ -13,9 +13,6 @@
extern "C" {
#endif
typedef struct OSDynLoad_NotifyData OSDynLoad_NotifyData;
typedef void *OSDynLoad_Module;
typedef enum OSDynLoad_Error
{
OS_DYNLOAD_OK = 0,
@ -30,53 +27,17 @@ typedef enum OSDynLoad_Error
OS_DYNLOAD_TLS_ALLOCATOR_LOCKED = 0xBAD10031,
} OSDynLoad_Error;
typedef OSDynLoad_Error (*OSDynLoadAllocFn)(int32_t size, int32_t align, void **outAddr);
typedef void (*OSDynLoadFreeFn)(void *addr);
typedef enum OSDynLoad_EntryReason
{
OS_DYNLOAD_LOADED = 0,
OS_DYNLOAD_UNLOADED = 1,
} OSDynLoad_EntryReason;
struct OSDynLoad_NotifyData
{
char *name;
typedef void *OSDynLoad_Module;
uint32_t textAddr;
uint32_t textOffset;
uint32_t textSize;
typedef OSDynLoad_Error (*OSDynLoadAllocFn)(int32_t size, int32_t align, void **outAddr);
typedef void (*OSDynLoadFreeFn)(void *addr);
uint32_t dataAddr;
uint32_t dataOffset;
uint32_t dataSize;
uint32_t readAddr;
uint32_t readOffset;
uint32_t readSize;
};
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x00, name);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x04, textAddr);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x08, textOffset);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x0C, textSize);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x10, dataAddr);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x14, dataOffset);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x18, dataSize);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x1C, readAddr);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x20, readOffset);
WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x24, readSize);
WUT_CHECK_SIZE(OSDynLoad_NotifyData, 0x28);
typedef enum OSDynLoad_NotifyReason
{
OS_DYNLOAD_NOTIFY_UNLOADED = 0,
OS_DYNLOAD_NOTIFY_LOADED = 1
} OSDynLoad_NotifyReason;
typedef void (*OSDynLoadNotifyFunc)(OSDynLoad_Module module,
void *userContext,
OSDynLoad_NotifyReason notifyReason,
OSDynLoad_NotifyData *infos);
/**
* Load a module.
@ -149,58 +110,8 @@ OSDynLoad_GetTLSAllocator(OSDynLoadAllocFn *outAllocFn,
**/
OSDynLoad_Error
OSDynLoad_GetModuleName(OSDynLoad_Module module,
char *nameBuf,
int32_t *nameBufSize);
/**
* Gets the number of currently loaded RPLs.
*
* Always returns 0 on release versions of CafeOS.
* Requires OSGetSecurityLevel() > 0.
*/
int32_t
OSDynLoad_GetNumberOfRPLs();
/**
* Get information about the currently loaded RPLs.
*
* \param first the index of the first RPL to retrieve info for.
* \param count the number of RPLs to retrieve info for
* \param outInfos buffer of RPL info to be filled, should be an array of at
* least count size.
*
* Always returns FALSE on release versions of CafeOS.
* Requires OSGetSecurityLevel() > 0.
*/
BOOL
OSDynLoad_GetRPLInfo(uint32_t first,
uint32_t count,
OSDynLoad_NotifyData *outInfos);
/**
* Checks if a module is already loaded. Does not load any modules.
*
* Returns OS_DYNLOAD_OK on success.
**/
OSDynLoad_Error
OSDynLoad_IsModuleLoaded(char const *name,
OSDynLoad_Module *outModule);
/**
* Registers a callback that's called whenever a new .rpl is loaded or unloaded
**/
OSDynLoad_Error
OSDynLoad_AddNotifyCallback(OSDynLoadNotifyFunc notifyFn,
void *userContext);
/**
* Removes a previously added a callback
**/
OSDynLoad_Error
OSDynLoad_DelNotifyCallback(OSDynLoadNotifyFunc notifyFn,
void *userContext);
char * nameBuf,
int32_t * nameBufSize);
/**
* The prototype for an RPL entry point.

View File

@ -35,10 +35,10 @@ IMError
IMIsDimEnabled(uint32_t *outValue);
IMError
IMGetDimEnableDRC(uint32_t *outValue);
IMGetDimEnableDrc(uint32_t *outValue);
IMError
IMGetDimEnableTV(uint32_t *outValue);
IMGetDimEnableTv(uint32_t *outValue);
IMError
IMGetDimPeriod(uint32_t *outValue);
@ -50,10 +50,10 @@ IMError
IMGetTimeBeforeDimming(uint32_t *outSeconds);
IMError
IMSetDimEnableDRC(BOOL value);
IMSetDimEnableDrc(BOOL value);
IMError
IMSetDimEnableTV(BOOL value);
IMSetDimEnableTv(BOOL value);
IMError
IMStartAPDVideoMode();

View File

@ -12,7 +12,7 @@ extern "C" {
#endif
void
RPLWRAP(exit)(int code);
exit(int code);
void
_Exit(int code);

View File

@ -35,24 +35,6 @@ typedef struct FSMountSource FSMountSource;
typedef struct FSStat FSStat;
typedef struct FSStateChangeInfo FSStateChangeInfo;
typedef enum FSErrorFlag
{
FS_ERROR_FLAG_NONE = 0x0,
FS_ERROR_FLAG_MAX = 0x1,
FS_ERROR_FLAG_ALREADY_OPEN = 0x2,
FS_ERROR_FLAG_EXISTS = 0x4,
FS_ERROR_FLAG_NOT_FOUND = 0x8,
FS_ERROR_FLAG_NOT_FILE = 0x10,
FS_ERROR_FLAG_NOT_DIR = 0x20,
FS_ERROR_FLAG_ACCESS_ERROR = 0x40,
FS_ERROR_FLAG_PERMISSION_ERROR = 0x80,
FS_ERROR_FLAG_FILE_TOO_BIG = 0x100,
FS_ERROR_FLAG_STORAGE_FULL = 0x200,
FS_ERROR_FLAG_UNSUPPORTED_CMD = 0x400,
FS_ERROR_FLAG_JOURNAL_FULL = 0x800,
FS_ERROR_FLAG_ALL = 0xFFFFFFFF,
} FSErrorFlag;
typedef enum FSStatus
{
FS_STATUS_OK = 0,
@ -279,11 +261,11 @@ FSShutdown();
FSStatus
FSAddClient(FSClient *client,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSDelClient(FSClient *client,
FSErrorFlag errorMask);
uint32_t flags);
uint32_t
FSGetClientNum();
@ -304,19 +286,19 @@ FSGetCwd(FSClient *client,
FSCmdBlock *block,
char *buffer,
uint32_t bufferSize,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSChangeDir(FSClient *client,
FSCmdBlock *block,
const char *path,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSChangeDirAsync(FSClient *client,
FSCmdBlock *block,
const char *path,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSAsyncResult *
@ -327,27 +309,27 @@ FSGetStat(FSClient *client,
FSCmdBlock *block,
const char *path,
FSStat *stat,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSGetStatAsync(FSClient *client,
FSCmdBlock *block,
const char *path,
FSStat *stat,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
FSRemove(FSClient *client,
FSCmdBlock *block,
const char *path,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSRemoveAsync(FSClient *client,
FSCmdBlock *block,
const char *path,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
@ -357,7 +339,7 @@ FSOpenFile(FSClient *client,
const char *path,
const char *mode,
FSFileHandle *handle,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSOpenFileAsync(FSClient *client,
@ -365,20 +347,20 @@ FSOpenFileAsync(FSClient *client,
const char *path,
const char *mode,
FSFileHandle *outHandle,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
FSCloseFile(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSCloseFileAsync(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -386,27 +368,27 @@ FSOpenDir(FSClient *client,
FSCmdBlock *block,
const char *path,
FSDirectoryHandle *handle,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSOpenDirAsync(FSClient *client,
FSCmdBlock *block,
const char *path,
FSDirectoryHandle *handle,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
FSMakeDir(FSClient *client,
FSCmdBlock *block,
const char *path,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSMakeDirAsync(FSClient *client,
FSCmdBlock *block,
const char *path,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -414,47 +396,47 @@ FSReadDir(FSClient *client,
FSCmdBlock *block,
FSDirectoryHandle handle,
FSDirectoryEntry *entry,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSReadDirAsync(FSClient *client,
FSCmdBlock *block,
FSDirectoryHandle handle,
FSDirectoryEntry *entry,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
FSRewindDir(FSClient *client,
FSCmdBlock *block,
FSDirectoryHandle handle,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSCloseDir(FSClient *client,
FSCmdBlock *block,
FSDirectoryHandle handle,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSCloseDirAsync(FSClient *client,
FSCmdBlock *block,
FSDirectoryHandle handle,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
FSChangeMode(FSClient *client,
FSCmdBlock *block,
char *path,
FSMode mode,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSChangeModeAsync(FSClient *client,
FSCmdBlock *block,
char *path,
FSMode mode,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -462,14 +444,14 @@ FSGetFreeSpaceSize(FSClient *client,
FSCmdBlock *block,
char *path,
uint64_t *outSize,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSGetFreeSpaceSizeAsync(FSClient *client,
FSCmdBlock *block,
char *path,
uint64_t *outSize,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -477,14 +459,14 @@ FSGetStatFile(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
FSStat *stat,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSGetStatFileAsync(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
FSStat *stat,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -495,7 +477,7 @@ FSReadFile(FSClient *client,
uint32_t count,
FSFileHandle handle,
uint32_t unk1,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSReadFileAsync(FSClient *client,
@ -505,7 +487,7 @@ FSReadFileAsync(FSClient *client,
uint32_t count,
FSFileHandle handle,
uint32_t unk1,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -517,7 +499,7 @@ FSReadFileWithPos(FSClient *client,
uint32_t pos,
FSFileHandle handle,
uint32_t unk1,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSReadFileWithPosAsync(FSClient *client,
@ -528,7 +510,7 @@ FSReadFileWithPosAsync(FSClient *client,
uint32_t pos,
FSFileHandle handle,
uint32_t unk1,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -539,7 +521,7 @@ FSWriteFile(FSClient *client,
uint32_t count,
FSFileHandle handle,
uint32_t unk1,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSWriteFileAsync(FSClient *client,
@ -549,7 +531,7 @@ FSWriteFileAsync(FSClient *client,
uint32_t count,
FSFileHandle handle,
uint32_t unk1,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -561,7 +543,7 @@ FSWriteFileWithPos(FSClient *client,
uint32_t pos,
FSFileHandle handle,
uint32_t unk1,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSWriteFileWithPosAsync(FSClient *client,
@ -572,7 +554,7 @@ FSWriteFileWithPosAsync(FSClient *client,
uint32_t pos,
FSFileHandle handle,
uint32_t unk1,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -580,14 +562,14 @@ FSGetPosFile(FSClient *client,
FSCmdBlock *block,
FSFileHandle fileHandle,
uint32_t *pos,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSGetPosFileAsync(FSClient *client,
FSCmdBlock *block,
FSFileHandle fileHandle,
uint32_t *pos,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -595,40 +577,40 @@ FSSetPosFile(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
uint32_t pos,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSSetPosFileAsync(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
uint32_t pos,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
FSFlushFile(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSFlushFileAsync(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
FSTruncateFile(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSTruncateFileAsync(FSClient *client,
FSCmdBlock *block,
FSFileHandle handle,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSStatus
@ -636,14 +618,14 @@ FSRename(FSClient *client,
FSCmdBlock *block,
const char *oldPath,
const char *newPath,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSRenameAsync(FSClient *client,
FSCmdBlock *block,
const char *oldPath,
const char *newPath,
FSErrorFlag errorMask,
uint32_t flags,
FSAsyncData *asyncData);
FSVolumeState
@ -657,7 +639,7 @@ FSGetMountSource(FSClient *client,
FSCmdBlock *cmd,
FSMountSourceType type,
FSMountSource *out,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSMount(FSClient *client,
@ -665,26 +647,26 @@ FSMount(FSClient *client,
FSMountSource *source,
const char *target,
uint32_t bytes,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSUnmount(FSClient *client,
FSCmdBlock *cmd,
const char *target,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSBindMount(FSClient *client,
FSCmdBlock *cmd,
const char *source,
const char *target,
FSErrorFlag errorMask);
uint32_t flags);
FSStatus
FSbindUnmount(FSClient *client,
FSCmdBlock *cmd,
const char *target,
FSErrorFlag errorMask);
uint32_t flags);
#ifdef __cplusplus
}

View File

@ -23,51 +23,9 @@ typedef struct MCPTitleListType MCPTitleListType;
typedef enum MCPAppType
{
MCP_APP_TYPE_GAME_UPDATE = 0x0800001B,
MCP_APP_TYPE_GAME_DLC = 0x0800000E,
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_SYSTEM_VERSION = 0x10000015,
MCP_APP_TYPE_DRC_LANGUAGE = 0x1000001A,
MCP_APP_TYPE_EXCEPTIONS_DATA = 0x18000010,
MCP_APP_TYPE_SHARED_DATA = 0x1800001C,
MCP_APP_TYPE_CERT_STORE = 0x1800001E,
MCP_APP_TYPE_PATCH_MAP_DATA = 0x18000023,
MCP_APP_TYPE_WAGONU_MIGRATION_LIST = 0x18000029,
MCP_APP_TYPE_CAFFEINE_TITLE_LIST = 0x18000030,
MCP_APP_TYPE_MCP_TITLE_LIST = 0x18000031,
MCP_APP_TYPE_GAME = 0x80000000,
MCP_APP_TYPE_GAME_WII = 0x8000002E,
MCP_APP_TYPE_SYSTEM_MENU = 0x90000001,
MCP_APP_TYPE_SYSTEM_UPDATER = 0x9000000B,
MCP_APP_TYPE_SYSTEM_APPS = 0x90000020,
MCP_APP_TYPE_ACCOUNT_APPS = 0x90000021,
MCP_APP_TYPE_SYSTEM_SETTINGS = 0x90000022,
MCP_APP_TYPE_ECO_PROCESS = 0x9000002F,
MCP_APP_TYPE_EMANUAL = 0xD0000003,
MCP_APP_TYPE_HOME_MENU = 0xD0000004,
MCP_APP_TYPE_ERROR_DISPLAY = 0xD0000005,
MCP_APP_TYPE_BROWSER = 0xD0000006,
MCP_APP_TYPE_MIIVERSE_POST = 0xD000000D,
MCP_APP_TYPE_MIIVERSE = 0xD0000016,
MCP_APP_TYPE_ESHOP = 0xD0000017,
MCP_APP_TYPE_FRIEND_LIST = 0xD0000018,
MCP_APP_TYPE_DOWNLOAD_MANAGEMENT = 0xD0000019,
MCP_APP_TYPE_AOC_OVERLAY = 0xD000002C,
MCP_APP_TYPE_AMIIBO_SETTINGS = 0xD0000033,
MCP_APP_TYPE_UNKNOWN_0x0800000E = 0x0800000E,
} MCPAppType;
typedef enum MCPDeviceFlags
{
MCP_DEVICE_FLAG_UNK_1 = 0x1,
MCP_DEVICE_FLAG_UNK_2 = 0x2,
MCP_DEVICE_FLAG_UNK_4 = 0x4,
MCP_DEVICE_FLAG_UNK_8 = 0x8,
} MCPDeviceFlags;
typedef enum MCPInstallTarget
{
MCP_INSTALL_TARGET_MLC = 0,
@ -84,25 +42,18 @@ typedef enum MCPRegion
MCP_REGION_TAIWAN = 0x40,
} MCPRegion;
struct WUT_PACKED MCPDevice
struct MCPDevice
{
char type[8];
char unk0x08[128];
char filesystem[8];
char path[0x27F];
MCPDeviceFlags flags;
uint32_t uid;
uint32_t index;
char name[0x31B];
};
WUT_CHECK_OFFSET(MCPDevice, 0x00, type);
WUT_CHECK_OFFSET(MCPDevice, 0x08, unk0x08);
WUT_CHECK_OFFSET(MCPDevice, 0x88, filesystem);
WUT_CHECK_OFFSET(MCPDevice, 0x90, path);
WUT_CHECK_OFFSET(MCPDevice, 0x30F, flags);
WUT_CHECK_OFFSET(MCPDevice, 0x313, uid);
WUT_CHECK_OFFSET(MCPDevice, 0x317, index);
WUT_CHECK_SIZE(MCPDevice, 0x31B);
struct MCPDeviceList
{
MCPDevice devices[32];
};
WUT_CHECK_SIZE(MCPDeviceList, 0x6360);
struct MCPInstallInfo
{
WUT_UNKNOWN_BYTES(0x27F);
@ -168,22 +119,19 @@ WUT_CHECK_SIZE(MCPSysProdSettings, 0x46);
struct WUT_PACKED MCPTitleListType
{
uint64_t titleId;
uint32_t groupId;
WUT_UNKNOWN_BYTES(4);
char path[56];
MCPAppType appType;
uint16_t titleVersion;
uint64_t osVersion;
uint32_t sdkVersion;
WUT_UNKNOWN_BYTES(0x54 - 0x48);
uint8_t device;
WUT_UNKNOWN_BYTES(1);
char indexedDevice[10];
uint8_t unk0x60;
};
WUT_CHECK_OFFSET(MCPTitleListType, 0x00, titleId);
WUT_CHECK_OFFSET(MCPTitleListType, 0x08, groupId);
WUT_CHECK_OFFSET(MCPTitleListType, 0x0C, path);
WUT_CHECK_OFFSET(MCPTitleListType, 0x44, appType);
WUT_CHECK_OFFSET(MCPTitleListType, 0x48, titleVersion);
WUT_CHECK_OFFSET(MCPTitleListType, 0x4A, osVersion);
WUT_CHECK_OFFSET(MCPTitleListType, 0x52, sdkVersion);
WUT_CHECK_OFFSET(MCPTitleListType, 0x54, device);
WUT_CHECK_OFFSET(MCPTitleListType, 0x56, indexedDevice);
WUT_CHECK_OFFSET(MCPTitleListType, 0x60, unk0x60);
WUT_CHECK_SIZE(MCPTitleListType, 0x61);
@ -197,14 +145,14 @@ MCP_Close(int handle);
MCPError
MCP_DeviceList(int handle,
int *numDevices,
MCPDevice *outDeviceList,
uint32_t deviceListSizeInBytes);
MCPDeviceList *outDevices,
uint32_t outBufferSize);
MCPError
MCP_FullDeviceList(int handle,
int *numDevices,
MCPDevice *outDeviceList,
uint32_t deviceListSizeInBytes);
MCPDeviceList *outDevices,
uint32_t outBufferSize);
MCPError
MCP_GetOwnTitleInfo(int32_t handle,

View File

@ -18,21 +18,6 @@ typedef enum OSMemoryType
OS_MEM2 = 2,
} OSMemoryType;
typedef enum OSSharedDataType
{
OS_SHAREDDATATYPE_FONT_CHINESE = 0,
OS_SHAREDDATATYPE_FONT_KOREAN = 1,
OS_SHAREDDATATYPE_FONT_STANDARD = 2,
OS_SHAREDDATATYPE_FONT_TAIWANESE = 3,
OS_SHAREDDATATYPE_FONT_MAX = 4,
} OSSharedDataType;
BOOL
OSGetSharedData(OSSharedDataType type,
uint32_t unk_r4,
void **outPtr,
uint32_t *outSize);
/**
* Moves chunks of memory around, similarly to memmove. Overlapping source and
* destination regions are supported.
@ -146,13 +131,6 @@ OSGetMemBound(OSMemoryType type,
uint32_t *outAddr,
uint32_t *outSize);
/**
* Zeros the memory for a given proccessID.
* Works only inside the ROOT process.
**/
void
__OSZeroProcessMemory(uint32_t proccesID);
#ifdef __cplusplus
}
#endif

View File

@ -98,9 +98,6 @@ OSPeekMessage(OSMessageQueue *queue,
OSMessageQueue *
OSGetSystemMessageQueue();
OSMessageQueue *
OSGetDefaultAppIOQueue();
#ifdef __cplusplus
}
#endif

View File

@ -34,12 +34,6 @@ OSEnableHomeButtonMenu(BOOL enable);
BOOL
OSIsHomeButtonMenuEnabled();
uint64_t
OSGetOSID();
uint32_t
__OSGetProcessSDKVersion();
#ifdef __cplusplus
}
#endif

View File

@ -20,25 +20,15 @@ typedef int64_t OSTime;
//! Same as std c struct tm but with msec and usec added.
struct OSCalendarTime
{
//! Seconds after the minute. The range is 0-59.
int32_t tm_sec;
//! Minutes after the hour. The range is 0-59.
int32_t tm_min;
//! Hours since midnight. The range is 0-23.
int32_t tm_hour;
//! Day of the month. The range is 1-31.
int32_t tm_mday;
//! Month since January. The range is 0-11.
int32_t tm_mon;
//! Years in AD. The range is 1-....
int32_t tm_year;
//! Days since Sunday. The range is 0-6.
int32_t tm_wday;
//! Days since January 1. The range is 0-365.
int32_t tm_yday;
//! Milliseconds after the second. The range is 0-999.
int32_t tm_msec;
//! Microseconds after the millisecond. The range is 0-999.
int32_t tm_usec;
};
WUT_CHECK_OFFSET(OSCalendarTime, 0x00, tm_sec);

View File

@ -1,181 +0,0 @@
#pragma once
#include <wut.h>
#include <coreinit/ios.h>
/**
* \defgroup coreinit_userconfig User Config
* \ingroup coreinit
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef int32_t UCError;
typedef struct UCSysConfig UCSysConfig;
typedef struct UCAsyncParams UCAsyncParams;
typedef enum UCCommand
{
UC_CMD_READ_SYS_CONFIG = 0x30,
UC_CMD_WRITE_SYS_CONFIG = 0x31,
UC_CMD_DELETE_SYS_CONFIG = 0x32,
UC_CMD_QUERY_SYS_CONFIG = 0x33,
UC_CMD_LIST_SYS_CONFIG = 0x34,
} UCCommand;
typedef enum UCDataType
{
UC_DATATYPE_UNDEFINED = 0x00,
UC_DATATYPE_UNSIGNED_BYTE = 0x01,
UC_DATATYPE_UNSIGNED_SHORT = 0x02,
UC_DATATYPE_UNSIGNED_INT = 0x03,
UC_DATATYPE_SIGNED_INT = 0x04,
UC_DATATYPE_FLOAT = 0x05,
UC_DATATYPE_STRING = 0x06,
UC_DATATYPE_HEXBINARY = 0x07,
UC_DATATYPE_COMPLEX = 0x08,
UC_DATATYPE_INVALID = 0xFF,
} UCDataType;
typedef enum UCErrors
{
UC_ERROR_OK = 0,
UC_ERROR_ERROR = -1,
UC_ERROR_OTHER = -0x200001,
UC_ERROR_SYSTEM = -0x200002,
UC_ERROR_ALLOC = -0x200003,
UC_ERROR_OPCODE = -0x200004,
UC_ERROR_INVALID_PARAM = -0x200005,
UC_ERROR_INVALID_TYPE = -0x200006,
UC_ERROR_UNSUPPORTED = -0x200007,
UC_ERROR_NON_LEAF_NODE = -0x200008,
UC_ERROR_KEY_NOT_FOUND = -0x200009,
UC_ERROR_MODIFY = -0x20000A,
UC_ERROR_STRING_TOO_LONG = -0x20000B,
UC_ERROR_ROOT_KEYS_DIFFER = -0x20000C,
UC_ERROR_INVALID_LOCATION = -0x20000D,
UC_ERROR_BAD_COMMENT = -0x20000E,
UC_ERROR_READ_ACCESS = -0x20000F,
UC_ERROR_WRITE_ACCESS = -0x200010,
UC_ERROR_CREATE_ACCESS = -0x200011,
UC_ERROR_FILE_SYS_NAME = -0x200012,
UC_ERROR_FILE_SYS_INIT = -0x200013,
UC_ERROR_FILE_SYS_MOUNT = -0x200014,
UC_ERROR_FILE_OPEN = -0x200015,
UC_ERROR_FILE_STAT = -0x200016,
UC_ERROR_FILE_READ = -0x200017,
UC_ERROR_FILE_WRITE = -0x200018,
UC_ERROR_FILE_TOO_BIG = -0x200019,
UC_ERROR_FILE_REMOVE = -0x20001A,
UC_ERROR_FILE_RENAME = -0x20001B,
UC_ERROR_FILE_CLOSE = -0x20001C,
UC_ERROR_FILE_SEEK = -0x20001D,
UC_ERROR_FILE_CONFIRM = -0x20001E,
UC_ERROR_FILE_BACKUP = -0x20001F,
UC_ERROR_MALFORMED_XML = -0x200020,
UC_ERROR_VERSION = -0x200021,
UC_ERROR_NO_IPC_BUFFERS = -0x200022,
UC_ERROR_FILE_LOCK_NEEDED = -0x200024,
UC_ERROR_SYS_PROT = -0x200028,
} UCErrors;
typedef enum UCFileSys
{
UC_FILE_SYS_INVALID = 0x00,
UC_FILE_SYS_SYS = 0x01,
UC_FILE_SYS_SLC = 0x02,
UC_FILE_SYS_RAM = 0x03,
} UCFileSys;
#pragma pack(push, 1)
struct UCSysConfig
{
char name[64];
uint32_t access;
UCDataType dataType;
UCError error;
uint32_t dataSize;
void *data;
};
#pragma pack(pop)
WUT_CHECK_OFFSET(UCSysConfig, 0x00, name);
WUT_CHECK_OFFSET(UCSysConfig, 0x40, access);
WUT_CHECK_OFFSET(UCSysConfig, 0x44, dataType);
WUT_CHECK_OFFSET(UCSysConfig, 0x48, error);
WUT_CHECK_OFFSET(UCSysConfig, 0x4C, dataSize);
WUT_CHECK_OFFSET(UCSysConfig, 0x50, data);
WUT_CHECK_SIZE(UCSysConfig, 0x54);
typedef void (*UCAsyncCallbackFn)(UCError result,
UCCommand command,
uint32_t count,
UCSysConfig *settings,
void *context);
#pragma pack(push, 1)
struct UCAsyncParams
{
UCAsyncCallbackFn callback;
void *context;
UCCommand command;
uint32_t unk0x0C;
uint32_t count;
UCSysConfig *settings;
IOSVec *vecs;
};
#pragma pack(pop)
WUT_CHECK_OFFSET(UCAsyncParams, 0x00, callback);
WUT_CHECK_OFFSET(UCAsyncParams, 0x04, context);
WUT_CHECK_OFFSET(UCAsyncParams, 0x08, command);
WUT_CHECK_OFFSET(UCAsyncParams, 0x0C, unk0x0C);
WUT_CHECK_OFFSET(UCAsyncParams, 0x10, count);
WUT_CHECK_OFFSET(UCAsyncParams, 0x14, settings);
WUT_CHECK_OFFSET(UCAsyncParams, 0x18, vecs);
WUT_CHECK_SIZE(UCAsyncParams, 0x1C);
UCError
UCOpen();
UCError
UCClose(IOSHandle handle);
UCError
UCDeleteSysConfig(int32_t handle,
uint32_t count,
UCSysConfig *settings);
UCError
UCDeleteSysConfigAsync(int32_t handle,
uint32_t count,
UCSysConfig *settings,
UCAsyncParams *asyncParams);
UCError
UCReadSysConfig(int32_t handle,
uint32_t count,
UCSysConfig *settings);
UCError
UCReadSysConfigAsync(int32_t handle,
uint32_t count,
UCSysConfig *settings,
UCAsyncParams *asyncParams);
UCError
UCWriteSysConfig(int32_t handle,
uint32_t count,
UCSysConfig *settings);
UCError
UCWriteSysConfigAsync(int32_t handle,
uint32_t count,
UCSysConfig *settings,
UCAsyncParams *asyncParams);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -53,7 +53,7 @@
*
*/
#include <sys/socket.h>
#include <nsysnet/socket.h>
/* ================================================================ */
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */

View File

@ -69,26 +69,6 @@ DMAEFillMem(void *dst,
uint32_t val,
uint32_t wordCount);
/**
* Starts a DMAE fill operation for a physical address.
*
* \param dst
* Pointer to the destination buffer (physical address).
*
* \param val
* The value to fill the destination buffer.
*
* \param wordCount
* Number of 32 bit words to fill.
*
* \return
* DMAE operations queue timestamp.
*/
DMAETimeStamp
DMAEFillMemPhys(void *dst,
uint32_t val,
uint32_t wordCount);
#ifdef __cplusplus
}
#endif

View File

@ -52,7 +52,7 @@ GX2SetupContextStateEx(GX2ContextState *state,
BOOL unk1);
void
GX2GetContextStateDisplayList(const GX2ContextState *state,
GX2GetContextStateDisplayList(GX2ContextState *state,
void *outDisplayList,
uint32_t *outSize);

View File

@ -19,23 +19,19 @@ typedef enum GX2DebugCaptureInterfaceVersion
GX2_DEBUG_CAPTURE_INTERFACE_VERSION = 1,
} GX2DebugCaptureInterfaceVersion;
//! Options for \link GX2DebugCaptureStart \endlink.
typedef enum GX2DebugCaptureStartFlags
{
//! When set \link GX2DebugCaptureStart \endlink will call \link GX2DrawDone \endlink before the capture is started.
GX2_DEBUG_CAPTURE_START_FLAGS_NONE = 0,
//! When set \link GX2DebugCaptureStart \endlink will NOT call \link GX2DrawDone \endlink.
//! When set GX2DebugCaptureEnd will NOT call GX2DrawDone.
GX2_DEBUG_CAPTURE_START_FLAGS_DISABLE_GX2DRAWDONE = 1,
} GX2DebugCaptureStartFlags;
//! Options for \link GX2DebugCaptureEnd \endlink.
typedef enum GX2DebugCaptureEndFlags
{
//! When set \link GX2DebugCaptureEnd \endlink will call \link GX2Flush \endlink before the capture is completed.
GX2_DEBUG_CAPTURE_END_FLAGS_NONE = 0,
//! When set \link GX2DebugCaptureEnd \endlink will NOT call \link GX2Flush \endlink.
//! When set GX2DebugCaptureEnd will NOT call GX2Flush.
GX2_DEBUG_CAPTURE_END_FLAGS_DISABLE_GX2FLUSH = 1,
} GX2DebugCaptureEndFlags;
@ -112,9 +108,6 @@ _GX2DebugSetCaptureInterface(GX2DebugCaptureInterface *interface);
*
* \param filename
* This is passed as first argument to GX2DebugCaptureInterface.onCaptureStart
*
* \param flags
* A \link GX2DebugCaptureStartFlags \endlink option.
*/
void
GX2DebugCaptureStart(const char *filename,
@ -123,9 +116,6 @@ GX2DebugCaptureStart(const char *filename,
/**
* Ends a debug capture.
*
* \param flags
* A \link GX2DebugCaptureEndFlags \endlink option.
*/
void
GX2DebugCaptureEnd(GX2DebugCaptureEndFlags flags);

View File

@ -20,11 +20,11 @@ uint32_t
GX2EndDisplayList(void *displayList);
void
GX2DirectCallDisplayList(const void *displayList,
GX2DirectCallDisplayList(void *displayList,
uint32_t bytes);
void
GX2CallDisplayList(const void *displayList,
GX2CallDisplayList(void *displayList,
uint32_t bytes);
BOOL
@ -35,7 +35,7 @@ GX2GetCurrentDisplayList(void **outDisplayList,
uint32_t *outSize);
void
GX2CopyDisplayList(const void *displayList,
GX2CopyDisplayList(void *displayList,
uint32_t bytes);
#ifdef __cplusplus

View File

@ -16,7 +16,7 @@ void
GX2SetAttribBuffer(uint32_t index,
uint32_t size,
uint32_t stride,
const void *buffer);
void *buffer);
void
GX2DrawEx(GX2PrimitiveMode mode,
@ -35,7 +35,7 @@ void
GX2DrawIndexedEx(GX2PrimitiveMode mode,
uint32_t count,
GX2IndexType indexType,
const void *indices,
void *indices,
uint32_t offset,
uint32_t numInstances);
@ -43,7 +43,7 @@ void
GX2DrawIndexedEx2(GX2PrimitiveMode mode,
uint32_t count,
GX2IndexType indexType,
const void *indices,
void *indices,
uint32_t offset,
uint32_t numInstances,
uint32_t baseInstance);
@ -52,7 +52,7 @@ void
GX2DrawIndexedImmediateEx(GX2PrimitiveMode mode,
uint32_t count,
GX2IndexType indexType,
const void *indices,
void *indices,
uint32_t offset,
uint32_t numInstances);

View File

@ -43,56 +43,28 @@ typedef enum GX2AlphaToMaskMode
typedef enum GX2AttribFormat
{
GX2_ATTRIB_TYPE_8 = 0x00,
GX2_ATTRIB_TYPE_4_4 = 0x01,
GX2_ATTRIB_TYPE_16 = 0x02,
GX2_ATTRIB_TYPE_16_FLOAT = 0x03,
GX2_ATTRIB_TYPE_8_8 = 0x04,
GX2_ATTRIB_TYPE_32 = 0x05,
GX2_ATTRIB_TYPE_32_FLOAT = 0x06,
GX2_ATTRIB_TYPE_16_16 = 0x07,
GX2_ATTRIB_TYPE_16_16_FLOAT = 0x08,
GX2_ATTRIB_TYPE_10_11_11_FLOAT = 0x09,
GX2_ATTRIB_TYPE_8_8_8_8 = 0x0A,
GX2_ATTRIB_TYPE_10_10_10_2 = 0x0B,
GX2_ATTRIB_TYPE_32_32 = 0x0C,
GX2_ATTRIB_TYPE_32_32_FLOAT = 0x0D,
GX2_ATTRIB_TYPE_16_16_16_16 = 0x0E,
GX2_ATTRIB_TYPE_16_16_16_16_FLOAT = 0x0F,
GX2_ATTRIB_TYPE_32_32_32 = 0x10,
GX2_ATTRIB_TYPE_32_32_32_FLOAT = 0x11,
GX2_ATTRIB_TYPE_32_32_32_32 = 0x12,
GX2_ATTRIB_TYPE_32_32_32_32_FLOAT = 0x13,
GX2_ATTRIB_FORMAT_UNORM_8 = 0x0,
GX2_ATTRIB_FORMAT_UNORM_8_8 = 0x04,
GX2_ATTRIB_FORMAT_UNORM_8_8_8_8 = 0x0A,
GX2_ATTRIB_FLAG_INTEGER = 0x100,
GX2_ATTRIB_FLAG_SIGNED = 0x200,
GX2_ATTRIB_FLAG_DEGAMMA = 0x400,
GX2_ATTRIB_FLAG_SCALED = 0x800,
GX2_ATTRIB_FORMAT_UINT_8 = 0x100,
GX2_ATTRIB_FORMAT_UINT_8_8 = 0x104,
GX2_ATTRIB_FORMAT_UINT_8_8_8_8 = 0x10A,
GX2_ATTRIB_FORMAT_UNORM_8 = GX2_ATTRIB_TYPE_8,
GX2_ATTRIB_FORMAT_UNORM_8_8 = GX2_ATTRIB_TYPE_8_8,
GX2_ATTRIB_FORMAT_UNORM_8_8_8_8 = GX2_ATTRIB_TYPE_8_8_8_8,
GX2_ATTRIB_FORMAT_SNORM_8 = 0x200,
GX2_ATTRIB_FORMAT_SNORM_8_8 = 0x204,
GX2_ATTRIB_FORMAT_SNORM_8_8_8_8 = 0x20A,
GX2_ATTRIB_FORMAT_UINT_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8,
GX2_ATTRIB_FORMAT_UINT_8_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8,
GX2_ATTRIB_FORMAT_UINT_8_8_8_8 = GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8_8_8,
GX2_ATTRIB_FORMAT_SINT_8 = 0x300,
GX2_ATTRIB_FORMAT_SINT_8_8 = 0x304,
GX2_ATTRIB_FORMAT_SINT_8_8_8_8 = 0x30A,
GX2_ATTRIB_FORMAT_SNORM_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8,
GX2_ATTRIB_FORMAT_SNORM_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8_8,
GX2_ATTRIB_FORMAT_SNORM_8_8_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_TYPE_8_8_8_8,
GX2_ATTRIB_FORMAT_SINT_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8,
GX2_ATTRIB_FORMAT_SINT_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8,
GX2_ATTRIB_FORMAT_SINT_8_8_8_8 = GX2_ATTRIB_FLAG_SIGNED | GX2_ATTRIB_FLAG_INTEGER | GX2_ATTRIB_TYPE_8_8_8_8,
GX2_ATTRIB_FORMAT_FLOAT_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_FLOAT,
GX2_ATTRIB_FORMAT_FLOAT_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_FLOAT,
GX2_ATTRIB_FORMAT_FLOAT_32_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_32_FLOAT,
GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32 = GX2_ATTRIB_FLAG_SCALED | GX2_ATTRIB_TYPE_32_32_32_32_FLOAT,
GX2_ATTRIB_FORMAT_FLOAT_32 = 0x806,
GX2_ATTRIB_FORMAT_FLOAT_32_32 = 0x80d,
GX2_ATTRIB_FORMAT_FLOAT_32_32_32 = 0x811,
GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32 = 0x813,
} GX2AttribFormat;
WUT_ENUM_BITMASK_TYPE(GX2AttribFormat)
typedef enum GX2AttribIndexType
{
GX2_ATTRIB_INDEX_PER_VERTEX = 0,
@ -184,8 +156,6 @@ typedef enum GX2DrcRenderMode
typedef enum GX2EventType
{
GX2_EVENT_TYPE_START_OF_PIPE_INTERRUPT = 0,
GX2_EVENT_TYPE_END_OF_PIPE_INTERRUPT = 1,
GX2_EVENT_TYPE_VSYNC = 2,
GX2_EVENT_TYPE_FLIP = 3,
GX2_EVENT_TYPE_DISPLAY_LIST_OVERRUN = 4,
@ -223,7 +193,6 @@ typedef enum GX2IndexType
typedef enum GX2InvalidateMode
{
GX2_INVALIDATE_MODE_NONE = 0,
GX2_INVALIDATE_MODE_ATTRIBUTE_BUFFER = 1 << 0,
GX2_INVALIDATE_MODE_TEXTURE = 1 << 1,
GX2_INVALIDATE_MODE_UNIFORM_BLOCK = 1 << 2,
@ -238,8 +207,6 @@ typedef enum GX2InvalidateMode
GX2_INVALIDATE_MODE_CPU_SHADER = GX2_INVALIDATE_MODE_CPU | GX2_INVALIDATE_MODE_SHADER,
} GX2InvalidateMode;
WUT_ENUM_BITMASK_TYPE(GX2InvalidateMode)
typedef enum GX2InitAttributes
{
GX2_INIT_END = 0,
@ -247,9 +214,6 @@ typedef enum GX2InitAttributes
GX2_INIT_CMD_BUF_POOL_SIZE = 2,
GX2_INIT_ARGC = 7,
GX2_INIT_ARGV = 8,
GX2_INIT_PROFILE_MODE = 9,
GX2_INIT_TOSS_STAGE = 10,
GX2_INIT_APP_IO_THREAD_STACK_SIZE = 11,
} GX2InitAttributes;
typedef enum GX2LogicOp
@ -280,12 +244,6 @@ typedef enum GX2PrimitiveMode
GX2_PRIMITIVE_MODE_TRIANGLES = 4,
GX2_PRIMITIVE_MODE_TRIANGLE_FAN = 5,
GX2_PRIMITIVE_MODE_TRIANGLE_STRIP = 6,
GX2_PRIMITIVE_MODE_LINES_ADJACENCY = 10,
GX2_PRIMITIVE_MODE_LINE_STRIP_ADJACENCY = 11,
GX2_PRIMITIVE_MODE_TRIANGLES_ADJACENCY = 12,
GX2_PRIMITIVE_MODE_TRIANGLE_STRIP_ADJACENCY = 13,
GX2_PRIMITIVE_MODE_RECTS = 17,
GX2_PRIMITIVE_MODE_LINE_LOOP = 18,
GX2_PRIMITIVE_MODE_QUADS = 19,
GX2_PRIMITIVE_MODE_QUAD_STRIP = 20,
} GX2PrimitiveMode;
@ -306,7 +264,6 @@ typedef enum GX2RenderTarget
GX2_RENDER_TARGET_4 = 4,
GX2_RENDER_TARGET_5 = 5,
GX2_RENDER_TARGET_6 = 6,
GX2_RENDER_TARGET_7 = 7,
} GX2RenderTarget;
typedef enum GX2RoundingMode
@ -339,45 +296,15 @@ typedef enum GX2ShaderMode
typedef enum GX2ShaderVarType
{
GX2_SHADER_VAR_TYPE_VOID = 0,
GX2_SHADER_VAR_TYPE_BOOL = 1,
GX2_SHADER_VAR_TYPE_INT = 2,
GX2_SHADER_VAR_TYPE_UINT = 3,
GX2_SHADER_VAR_TYPE_FLOAT = 4,
GX2_SHADER_VAR_TYPE_DOUBLE = 5,
GX2_SHADER_VAR_TYPE_DOUBLE2 = 6,
GX2_SHADER_VAR_TYPE_DOUBLE3 = 7,
GX2_SHADER_VAR_TYPE_DOUBLE4 = 8,
GX2_SHADER_VAR_TYPE_FLOAT2 = 9,
GX2_SHADER_VAR_TYPE_FLOAT3 = 10,
GX2_SHADER_VAR_TYPE_FLOAT4 = 11,
GX2_SHADER_VAR_TYPE_BOOL2 = 12,
GX2_SHADER_VAR_TYPE_BOOL3 = 13,
GX2_SHADER_VAR_TYPE_BOOL4 = 14,
GX2_SHADER_VAR_TYPE_INT2 = 15,
GX2_SHADER_VAR_TYPE_INT3 = 16,
GX2_SHADER_VAR_TYPE_INT4 = 17,
GX2_SHADER_VAR_TYPE_UINT2 = 18,
GX2_SHADER_VAR_TYPE_UINT3 = 19,
GX2_SHADER_VAR_TYPE_UINT4 = 20,
GX2_SHADER_VAR_TYPE_FLOAT2X2 = 21,
GX2_SHADER_VAR_TYPE_FLOAT2X3 = 22,
GX2_SHADER_VAR_TYPE_FLOAT2X4 = 23,
GX2_SHADER_VAR_TYPE_FLOAT3X2 = 24,
GX2_SHADER_VAR_TYPE_FLOAT3X3 = 25,
GX2_SHADER_VAR_TYPE_FLOAT3X4 = 26,
GX2_SHADER_VAR_TYPE_FLOAT4X2 = 27,
GX2_SHADER_VAR_TYPE_FLOAT4X3 = 28,
GX2_SHADER_VAR_TYPE_FLOAT4X4 = 29,
GX2_SHADER_VAR_TYPE_DOUBLE2X2 = 30,
GX2_SHADER_VAR_TYPE_DOUBLE2X3 = 31,
GX2_SHADER_VAR_TYPE_DOUBLE2X4 = 32,
GX2_SHADER_VAR_TYPE_DOUBLE3X2 = 33,
GX2_SHADER_VAR_TYPE_DOUBLE3X3 = 34,
GX2_SHADER_VAR_TYPE_DOUBLE3X4 = 35,
GX2_SHADER_VAR_TYPE_DOUBLE4X2 = 36,
GX2_SHADER_VAR_TYPE_DOUBLE4X3 = 37,
GX2_SHADER_VAR_TYPE_DOUBLE4X4 = 38,
GX2_SHADER_VAR_TYPE_MATRIX4X4 = 29,
} GX2ShaderVarType;
typedef enum GX2StencilFunction
@ -481,7 +408,6 @@ typedef enum GX2SurfaceFormat
typedef enum GX2SurfaceUse
{
GX2_SURFACE_USE_NONE = 0,
GX2_SURFACE_USE_TEXTURE = 1 << 0,
GX2_SURFACE_USE_COLOR_BUFFER = 1 << 1,
GX2_SURFACE_USE_DEPTH_BUFFER = 1 << 2,
@ -490,8 +416,6 @@ typedef enum GX2SurfaceUse
GX2_SURFACE_USE_TEXTURE_COLOR_BUFFER_TV = (GX2_SURFACE_USE_TEXTURE | GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_TV)
} GX2SurfaceUse;
WUT_ENUM_BITMASK_TYPE(GX2SurfaceUse)
typedef enum GX2TessellationMode
{
GX2_TESSELLATION_MODE_DISCRETE = 0,
@ -574,7 +498,6 @@ typedef enum GX2TileMode
typedef enum GX2TVRenderMode
{
GX2_TV_RENDER_MODE_DISABLED = 0,
GX2_TV_RENDER_MODE_STANDARD_480P = 1,
GX2_TV_RENDER_MODE_WIDE_480P = 2,
GX2_TV_RENDER_MODE_WIDE_720P = 3,
@ -584,12 +507,11 @@ typedef enum GX2TVRenderMode
typedef enum GX2TVScanMode
{
GX2_TV_SCAN_MODE_NONE = 0,
GX2_TV_SCAN_MODE_576I = 1,
GX2_TV_SCAN_MODE_480I = 2,
GX2_TV_SCAN_MODE_480P = 3,
GX2_TV_SCAN_MODE_720P = 4,
GX2_TV_SCAN_MODE_1080I = 6,
GX2_TV_SCAN_MODE_1080P = 7,
GX2_TV_SCAN_MODE_480I = 1,
GX2_TV_SCAN_MODE_480P = 2,
GX2_TV_SCAN_MODE_720P = 3,
GX2_TV_SCAN_MODE_1080I = 5,
GX2_TV_SCAN_MODE_1080P = 6,
} GX2TVScanMode;
#ifdef __cplusplus

View File

@ -207,7 +207,7 @@ GX2GetAAMaskReg(GX2AAMaskReg *reg,
uint8_t *lowerRight);
void
GX2SetAAMaskReg(const GX2AAMaskReg *reg);
GX2SetAAMaskReg(GX2AAMaskReg *reg);
void
GX2SetAlphaTest(BOOL alphaTest,
@ -227,7 +227,7 @@ GX2GetAlphaTestReg(const GX2AlphaTestReg *reg,
float *ref);
void
GX2SetAlphaTestReg(const GX2AlphaTestReg *reg);
GX2SetAlphaTestReg(GX2AlphaTestReg *reg);
void
GX2SetAlphaToMask(BOOL alphaToMask,
@ -244,7 +244,7 @@ GX2GetAlphaToMaskReg(const GX2AlphaToMaskReg *reg,
GX2AlphaToMaskMode *mode);
void
GX2SetAlphaToMaskReg(const GX2AlphaToMaskReg *reg);
GX2SetAlphaToMaskReg(GX2AlphaToMaskReg *reg);
void
GX2SetBlendConstantColor(float red,
@ -267,7 +267,7 @@ GX2GetBlendConstantColorReg(GX2BlendConstantColorReg *reg,
float *alpha);
void
GX2SetBlendConstantColorReg(const GX2BlendConstantColorReg *reg);
GX2SetBlendConstantColorReg(GX2BlendConstantColorReg *reg);
void
GX2SetBlendControl(GX2RenderTarget target,
@ -302,7 +302,7 @@ GX2GetBlendControlReg(GX2BlendControlReg *reg,
GX2BlendCombineMode *alphaCombine);
void
GX2SetBlendControlReg(const GX2BlendControlReg *reg);
GX2SetBlendControlReg(GX2BlendControlReg *reg);
void
GX2SetColorControl(GX2LogicOp rop3,
@ -325,7 +325,7 @@ GX2GetColorControlReg(GX2ColorControlReg *reg,
BOOL *colorWriteEnable);
void
GX2SetColorControlReg(const GX2ColorControlReg *reg);
GX2SetColorControlReg(GX2ColorControlReg *reg);
void
GX2SetDepthOnlyControl(BOOL depthTest,
@ -380,7 +380,7 @@ GX2GetDepthStencilControlReg(GX2DepthStencilControlReg *reg,
GX2StencilFunction *backStencilFail);
void
GX2SetDepthStencilControlReg(const GX2DepthStencilControlReg *reg);
GX2SetDepthStencilControlReg(GX2DepthStencilControlReg *reg);
void
GX2SetStencilMask(uint8_t frontMask,
@ -409,7 +409,7 @@ GX2GetStencilMaskReg(GX2StencilMaskReg *reg,
uint8_t *backRef);
void
GX2SetStencilMaskReg(const GX2StencilMaskReg *reg);
GX2SetStencilMaskReg(GX2StencilMaskReg *reg);
void
GX2SetLineWidth(float width);
@ -423,7 +423,7 @@ GX2GetLineWidthReg(GX2LineWidthReg *reg,
float *width);
void
GX2SetLineWidthReg(const GX2LineWidthReg *reg);
GX2SetLineWidthReg(GX2LineWidthReg *reg);
void
GX2SetPointSize(float width,
@ -440,7 +440,7 @@ GX2GetPointSizeReg(GX2PointSizeReg *reg,
float *height);
void
GX2SetPointSizeReg(const GX2PointSizeReg *reg);
GX2SetPointSizeReg(GX2PointSizeReg *reg);
void
GX2SetPointLimits(float min,
@ -457,7 +457,7 @@ GX2GetPointLimitsReg(GX2PointLimitsReg *reg,
float *max);
void
GX2SetPointLimitsReg(const GX2PointLimitsReg *reg);
GX2SetPointLimitsReg(GX2PointLimitsReg *reg);
void
GX2SetCullOnlyControl(GX2FrontFace frontFace,
@ -500,7 +500,7 @@ GX2GetPolygonControlReg(GX2PolygonControlReg *reg,
BOOL *polyOffsetParaEnable);
void
GX2SetPolygonControlReg(const GX2PolygonControlReg *reg);
GX2SetPolygonControlReg(GX2PolygonControlReg *reg);
void
GX2SetPolygonOffset(float frontOffset,
@ -526,7 +526,7 @@ GX2GetPolygonOffsetReg(GX2PolygonOffsetReg *reg,
float *clamp);
void
GX2SetPolygonOffsetReg(const GX2PolygonOffsetReg *reg);
GX2SetPolygonOffsetReg(GX2PolygonOffsetReg *reg);
void
GX2SetScissor(uint32_t x,
@ -549,7 +549,7 @@ GX2GetScissorReg(GX2ScissorReg *reg,
uint32_t *height);
void
GX2SetScissorReg(const GX2ScissorReg *reg);
GX2SetScissorReg(GX2ScissorReg *reg);
void
GX2SetTargetChannelMasks(GX2ChannelMask mask0,
@ -584,7 +584,7 @@ GX2GetTargetChannelMasksReg(GX2TargetChannelMaskReg *reg,
GX2ChannelMask *mask7);
void
GX2SetTargetChannelMasksReg(const GX2TargetChannelMaskReg *reg);
GX2SetTargetChannelMasksReg(GX2TargetChannelMaskReg *reg);
void
GX2SetViewport(float x,
@ -613,7 +613,7 @@ GX2GetViewportReg(GX2ViewportReg *reg,
float *farZ);
void
GX2SetViewportReg(const GX2ViewportReg *reg);
GX2SetViewportReg(GX2ViewportReg *reg);
#ifdef __cplusplus
}

View File

@ -1,5 +1,4 @@
#pragma once
#include <string.h>
#include <wut.h>
#include "enum.h"
#include "sampler.h"
@ -372,43 +371,43 @@ void
GX2InitFetchShaderEx(GX2FetchShader *fetchShader,
uint8_t *buffer,
uint32_t attribCount,
const GX2AttribStream *attribs,
GX2AttribStream *attribs,
GX2FetchShaderType type,
GX2TessellationMode tessMode);
void
GX2SetFetchShader(const GX2FetchShader *shader);
GX2SetFetchShader(GX2FetchShader *shader);
void
GX2SetVertexShader(const GX2VertexShader *shader);
GX2SetVertexShader(GX2VertexShader *shader);
void
GX2SetPixelShader(const GX2PixelShader *shader);
GX2SetPixelShader(GX2PixelShader *shader);
void
GX2SetGeometryShader(const GX2GeometryShader *shader);
GX2SetGeometryShader(GX2GeometryShader *shader);
void
GX2SetVertexSampler(const GX2Sampler *sampler,
GX2SetVertexSampler(GX2Sampler *sampler,
uint32_t id);
void
GX2SetPixelSampler(const GX2Sampler *sampler,
GX2SetPixelSampler(GX2Sampler *sampler,
uint32_t id);
void
GX2SetGeometrySampler(const GX2Sampler *sampler,
GX2SetGeometrySampler(GX2Sampler *sampler,
uint32_t id);
void
GX2SetVertexUniformReg(uint32_t offset,
uint32_t count,
const void *data);
uint32_t *data);
void
GX2SetPixelUniformReg(uint32_t offset,
uint32_t count,
const void *data);
uint32_t *data);
void
GX2SetVertexUniformBlock(uint32_t location,
@ -435,7 +434,7 @@ void
GX2SetStreamOutEnable(BOOL enable);
void
GX2SetGeometryShaderInputRingBuffer(const void *buffer,
GX2SetGeometryShaderInputRingBuffer(void *buffer,
uint32_t size);
void
@ -443,100 +442,22 @@ GX2SetGeometryShaderOutputRingBuffer(void *buffer,
uint32_t size);
uint32_t
GX2GetPixelShaderGPRs(const GX2PixelShader *shader);
GX2GetPixelShaderGPRs(GX2PixelShader *shader);
uint32_t
GX2GetPixelShaderStackEntries(const GX2PixelShader *shader);
GX2GetPixelShaderStackEntries(GX2PixelShader *shader);
uint32_t
GX2GetVertexShaderGPRs(const GX2VertexShader *shader);
GX2GetVertexShaderGPRs(GX2VertexShader *shader);
uint32_t
GX2GetVertexShaderStackEntries(const GX2VertexShader *shader);
GX2GetVertexShaderStackEntries(GX2VertexShader *shader);
uint32_t
GX2GetGeometryShaderGPRs(const GX2GeometryShader *shader);
GX2GetGeometryShaderGPRs(GX2GeometryShader *shader);
uint32_t
GX2GetGeometryShaderStackEntries(const GX2GeometryShader *shader);
static inline GX2UniformBlock *
GX2GetGeometryUniformBlock(const GX2GeometryShader *shader,
const char *name)
{
for (uint32_t i = 0; i < shader->uniformBlockCount; ++i) {
if (strcmp(name, shader->uniformBlocks[i].name) == 0) {
return &shader->uniformBlocks[i];
}
}
return NULL;
}
static inline GX2UniformBlock *
GX2GetPixelUniformBlock(const GX2PixelShader *shader,
const char *name)
{
for (uint32_t i = 0; i < shader->uniformBlockCount; ++i) {
if (strcmp(name, shader->uniformBlocks[i].name) == 0) {
return &shader->uniformBlocks[i];
}
}
return NULL;
}
static inline GX2UniformBlock *
GX2GetVertexUniformBlock(const GX2VertexShader *shader,
const char *name)
{
for (uint32_t i = 0; i < shader->uniformBlockCount; ++i) {
if (strcmp(name, shader->uniformBlocks[i].name) == 0) {
return &shader->uniformBlocks[i];
}
}
return NULL;
}
static inline GX2UniformVar *
GX2GetGeometryUniformVar(const GX2GeometryShader *shader,
const char *name)
{
for (uint32_t i = 0; i < shader->uniformVarCount; ++i) {
if (strcmp(name, shader->uniformVars[i].name) == 0) {
return &shader->uniformVars[i];
}
}
return NULL;
}
static inline GX2UniformVar *
GX2GetPixelUniformVar(const GX2PixelShader *shader,
const char *name)
{
for (uint32_t i = 0; i < shader->uniformVarCount; ++i) {
if (strcmp(name, shader->uniformVars[i].name) == 0) {
return &shader->uniformVars[i];
}
}
return NULL;
}
static inline GX2UniformVar *
GX2GetVertexUniformVar(const GX2VertexShader *shader,
const char *name)
{
for (uint32_t i = 0; i < shader->uniformVarCount; ++i) {
if (strcmp(name, shader->uniformVars[i].name) == 0) {
return &shader->uniformVars[i];
}
}
return NULL;
}
GX2GetGeometryShaderStackEntries(GX2GeometryShader *shader);
#ifdef __cplusplus
}

View File

@ -118,11 +118,11 @@ GX2CalcColorBufferAuxInfo(GX2ColorBuffer *surface,
uint32_t *outAlignment);
void
GX2SetColorBuffer(const GX2ColorBuffer *colorBuffer,
GX2SetColorBuffer(GX2ColorBuffer *colorBuffer,
GX2RenderTarget target);
void
GX2SetDepthBuffer(const GX2DepthBuffer *depthBuffer);
GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer);
void
GX2InitColorBufferRegs(GX2ColorBuffer *colorBuffer);
@ -135,14 +135,14 @@ GX2InitDepthBufferHiZEnable(GX2DepthBuffer *depthBuffer,
BOOL enable);
uint32_t
GX2GetSurfaceSwizzle(const GX2Surface *surface);
GX2GetSurfaceSwizzle(GX2Surface *surface);
void
GX2SetSurfaceSwizzle(GX2Surface *surface,
uint32_t swizzle);
void
GX2CopySurface(const GX2Surface *src,
GX2CopySurface(GX2Surface *src,
uint32_t srcLevel,
uint32_t srcDepth,
GX2Surface *dst,

View File

@ -16,7 +16,7 @@ typedef struct GX2ColorBuffer GX2ColorBuffer;
typedef struct GX2Texture GX2Texture;
void
GX2CopyColorBufferToScanBuffer(const GX2ColorBuffer *buffer,
GX2CopyColorBufferToScanBuffer(GX2ColorBuffer *buffer,
GX2ScanTarget scanTarget);
void

View File

@ -38,15 +38,15 @@ void
GX2InitTextureRegs(GX2Texture *texture);
void
GX2SetPixelTexture(const GX2Texture *texture,
GX2SetPixelTexture(GX2Texture *texture,
uint32_t unit);
void
GX2SetVertexTexture(const GX2Texture *texture,
GX2SetVertexTexture(GX2Texture *texture,
uint32_t unit);
void
GX2SetGeometryTexture(const GX2Texture *texture,
GX2SetGeometryTexture(GX2Texture *texture,
uint32_t unit);
#ifdef __cplusplus

View File

@ -13,9 +13,6 @@ extern "C" {
typedef enum GX2RResourceFlags
{
//! No resource flags specified
GX2R_RESOURCE_BIND_NONE = 0,
//! This resource is to be used as a texture
GX2R_RESOURCE_BIND_TEXTURE = 1 << 0,
@ -89,7 +86,6 @@ typedef enum GX2RResourceFlags
GX2R_RESOURCE_LOCKED = 1 << 30,
} GX2RResourceFlags;
WUT_ENUM_BITMASK_TYPE(GX2RResourceFlags)
#ifdef __cplusplus
}

View File

@ -1,151 +0,0 @@
#pragma once
#include "stream.h"
/**
* \defgroup h264_decode H264 Decode
* \ingroup h264
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
//! h264 decoder parameters for H264DECSetParam.
typedef enum H264Parameter
{
//! Set the callback which is called when a frame is output from the decoder.
H264_PARAMETER_FRAME_POINTER_OUTPUT = 1,
//! Set whether the decoder should internally buffer frames or call the callback
//! immediately as soon as a frame is emitted.
H264_PARAMETER_OUTPUT_PER_FRAME = 0x20000002,
H264_PARAMETER_UNKNOWN_20000010 = 0x20000010,
H264_PARAMETER_UNKNOWN_20000030 = 0x20000030,
H264_PARAMETER_UNKNOWN_20000040 = 0x20000040,
//! Set a user memory pointer which is passed to the frame output callback.
H264_PARAMETER_USER_MEMORY = 0x70000001,
} H264Parameter;
/**
* Calculate the amount of memory required for the specified parameters.
*/
H264Error
H264DECMemoryRequirement(int32_t profile,
int32_t level,
int32_t maxWidth,
int32_t maxHeight,
uint32_t *outMemoryRequirement);
/**
* Initialise a H264 decoder in the given memory.
*/
H264Error
H264DECInitParam(int32_t memorySize,
void *memory);
/**
* Set H264 decoder parameter.
*/
H264Error
H264DECSetParam(void *memory,
H264Parameter parameter,
void *value);
/**
* Set the callback which is called when a frame is output from the decoder.
*/
H264Error
H264DECSetParam_FPTR_OUTPUT(void *memory,
H264DECFptrOutputFn value);
/**
* Set whether the decoder should internally buffer frames or call the callback
* immediately as soon as a frame is emitted.
*/
H264Error
H264DECSetParam_OUTPUT_PER_FRAME(void *memory,
uint32_t value);
/**
* Set a user memory pointer which is passed to the frame output callback.
*/
H264Error
H264DECSetParam_USER_MEMORY(void *memory,
void *value);
/**
* Check if the provided memory can be used for decoding.
*/
H264Error
H264DECCheckMemSegmentation(void *memory,
uint32_t size);
/**
* Open a H264 decoder.
*/
H264Error
H264DECOpen(void *memory);
/**
* Prepare for decoding.
*/
H264Error
H264DECBegin(void *memory);
/**
* Set the bit stream to be read for decoding.
*/
H264Error
H264DECSetBitstream(void *memory,
uint8_t *buffer,
uint32_t bufferLength,
double timestamp);
/**
* Perform decoding of the bitstream and put the output frame into frameBuffer.
*/
H264Error
H264DECExecute(void *memory,
void *frameBuffer);
/**
* Flush any internally buffered frames.
*/
H264Error
H264DECFlush(void *memory);
/**
* End decoding of the current stream.
*/
H264Error
H264DECEnd(void *memory);
/**
* Cleanup the decoder.
*/
H264Error
H264DECClose(void *memory);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,241 +0,0 @@
#pragma once
/**
* \defgroup h264_stream H264 Stream
* \ingroup h264
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef struct H264DecodedVuiParameters H264DecodedVuiParameters;
typedef struct H264DecodeResult H264DecodeResult;
typedef struct H264DecodeOutput H264DecodeOutput;
typedef void (*H264DECFptrOutputFn)(H264DecodeOutput *output);
//! h264 library errors.
typedef enum H264Error
{
//! No errors.
H264_ERROR_OK = 0,
//! Invalid picture parameter set.
H264_ERROR_INVALID_PPS = 24,
//! Invalid sequence parameter set.
H264_ERROR_INVALID_SPS = 26,
//! Invalid slice header.
H264_ERROR_INVALID_SLICEHEADER = 61,
//! Generic h264 error.
H264_ERROR_GENERIC = 0x1000000,
//! Invalid parameters passed.
H264_ERROR_INVALID_PARAMETER = 0x1010000,
//! The amount of memory provided to the h264 library
//! is insufficient.
H264_ERROR_OUT_OF_MEMORY = 0x1020000,
//! Invalid h264 stream profile. Only the baseline (66),
//! main (77) and high (100) profiles are allowed.
H264_ERROR_INVALID_PROFILE = 0x1080000,
} H264Error;
struct WUT_PACKED H264DecodedVuiParameters
{
uint8_t aspect_ratio_info_present_flag;
uint8_t aspect_ratio_idc;
int16_t sar_width;
int16_t sar_height;
uint8_t overscan_info_present_flag;
uint8_t overscan_appropriate_flag;
uint8_t video_signal_type_present_flag;
uint8_t video_format;
uint8_t video_full_range_flag;
uint8_t colour_description_present_flag;
uint8_t colour_primaries;
uint8_t transfer_characteristics;
uint8_t matrix_coefficients;
uint8_t chroma_loc_info_present_flag;
uint8_t chroma_sample_loc_type_top_field;
uint8_t chroma_sample_loc_type_bottom_field;
uint8_t timing_info_present_flag;
WUT_PADDING_BYTES(1);
uint32_t num_units_in_tick;
uint32_t time_scale;
uint8_t fixed_frame_rate_flag;
uint8_t nal_hrd_parameters_present_flag;
uint8_t vcl_hrd_parameters_present_flag;
uint8_t low_delay_hrd_flag;
uint8_t pic_struct_present_flag;
uint8_t bitstream_restriction_flag;
uint8_t motion_vectors_over_pic_boundaries_flag;
WUT_PADDING_BYTES(1);
int16_t max_bytes_per_pic_denom;
int16_t max_bits_per_mb_denom;
int16_t log2_max_mv_length_horizontal;
int16_t log2_max_mv_length_vertical;
int16_t num_reorder_frames;
int16_t max_dec_frame_buffering;
};
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x00, aspect_ratio_info_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x01, aspect_ratio_idc);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x02, sar_width);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x04, sar_height);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x06, overscan_info_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x07, overscan_appropriate_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x08, video_signal_type_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x09, video_format);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0A, video_full_range_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0B, colour_description_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0C, colour_primaries);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0D, transfer_characteristics);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0E, matrix_coefficients);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0F, chroma_loc_info_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x10, chroma_sample_loc_type_top_field);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x11, chroma_sample_loc_type_bottom_field);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x12, timing_info_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x14, num_units_in_tick);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x18, time_scale);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1C, fixed_frame_rate_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1D, nal_hrd_parameters_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1E, vcl_hrd_parameters_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1F, low_delay_hrd_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x20, pic_struct_present_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x21, bitstream_restriction_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x22, motion_vectors_over_pic_boundaries_flag);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x24, max_bytes_per_pic_denom);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x26, max_bits_per_mb_denom);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x28, log2_max_mv_length_horizontal);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2A, log2_max_mv_length_vertical);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2C, num_reorder_frames);
WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2E, max_dec_frame_buffering);
WUT_CHECK_SIZE(H264DecodedVuiParameters, 0x30);
struct WUT_PACKED H264DecodeResult
{
int32_t status;
WUT_PADDING_BYTES(4);
double timestamp;
int32_t width;
int32_t height;
int32_t nextLine;
uint8_t cropEnableFlag;
WUT_PADDING_BYTES(3);
int32_t cropTop;
int32_t cropBottom;
int32_t cropLeft;
int32_t cropRight;
uint8_t panScanEnableFlag;
WUT_PADDING_BYTES(3);
int32_t panScanTop;
int32_t panScanBottom;
int32_t panScanLeft;
int32_t panScanRight;
void *framebuffer;
uint8_t vui_parameters_present_flag;
WUT_PADDING_BYTES(3);
H264DecodedVuiParameters *vui_parameters;
WUT_UNKNOWN_BYTES(40);
};
WUT_CHECK_OFFSET(H264DecodeResult, 0x00, status);
WUT_CHECK_OFFSET(H264DecodeResult, 0x08, timestamp);
WUT_CHECK_OFFSET(H264DecodeResult, 0x10, width);
WUT_CHECK_OFFSET(H264DecodeResult, 0x14, height);
WUT_CHECK_OFFSET(H264DecodeResult, 0x18, nextLine);
WUT_CHECK_OFFSET(H264DecodeResult, 0x1C, cropEnableFlag);
WUT_CHECK_OFFSET(H264DecodeResult, 0x20, cropTop);
WUT_CHECK_OFFSET(H264DecodeResult, 0x24, cropBottom);
WUT_CHECK_OFFSET(H264DecodeResult, 0x28, cropLeft);
WUT_CHECK_OFFSET(H264DecodeResult, 0x2C, cropRight);
WUT_CHECK_OFFSET(H264DecodeResult, 0x30, panScanEnableFlag);
WUT_CHECK_OFFSET(H264DecodeResult, 0x34, panScanTop);
WUT_CHECK_OFFSET(H264DecodeResult, 0x38, panScanBottom);
WUT_CHECK_OFFSET(H264DecodeResult, 0x3C, panScanLeft);
WUT_CHECK_OFFSET(H264DecodeResult, 0x40, panScanRight);
WUT_CHECK_OFFSET(H264DecodeResult, 0x44, framebuffer);
WUT_CHECK_OFFSET(H264DecodeResult, 0x48, vui_parameters_present_flag);
WUT_CHECK_OFFSET(H264DecodeResult, 0x4C, vui_parameters);
WUT_CHECK_SIZE(H264DecodeResult, 0x78);
struct WUT_PACKED H264DecodeOutput
{
//! Number of frames output
int32_t frameCount;
//! Frames
H264DecodeResult **decodeResults;
//! User memory pointer passed into SetParam
void *userMemory;
};
WUT_CHECK_OFFSET(H264DecodeOutput, 0x00, frameCount);
WUT_CHECK_OFFSET(H264DecodeOutput, 0x04, decodeResults);
WUT_CHECK_OFFSET(H264DecodeOutput, 0x08, userMemory);
WUT_CHECK_SIZE(H264DecodeOutput, 0x0C);
/**
* Check that the stream contains sufficient data to decode an entire frame.
*/
H264Error
H264DECCheckDecunitLength(void *memory,
const uint8_t *buffer,
int32_t bufferLength,
int32_t offset,
int32_t *outLength);
/**
* Check if the next NALU can be skipped without breaking decoding.
*/
H264Error
H264DECCheckSkipableFrame(const uint8_t *buffer,
int32_t bufferLength,
BOOL *outSkippable);
/**
* Find the first SPS in the stream.
*/
H264Error
H264DECFindDecstartpoint(const uint8_t *buffer,
int32_t bufferLength,
int32_t *outOffset);
/**
* Find the first "IDR point" in the stream.
*
* An IDR point is either:
* - If an SPS or PPS header is found before the IDR and there are no non-IDR
* inbetween the SPS/PPS and IDR then return the first of the SPS/PPS.
* - The first found IDR.
*/
int32_t
H264DECFindIdrpoint(const uint8_t *buffer,
int32_t bufferLength,
int32_t *outOffset);
/**
* Parse the H264 stream and read the width & height from the first found SPS.
*/
H264Error
H264DECGetImageSize(const uint8_t *buffer,
int32_t bufferLength,
int32_t offset,
int32_t *outWidth,
int32_t *outHeight);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,129 +0,0 @@
#pragma once
#include <stdint.h>
#include <sys/socket.h>
extern int h_errno;
struct hostent
{
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char **h_addr_list;
#define h_addr h_addr_list[0]
};
struct servent
{
char *s_name;
char **s_aliases;
int s_port;
char *s_proto;
};
struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#define NETDB_INTERNAL -1
#define NETDB_SUCCESS 0
#define HOST_NOT_FOUND 1
#define TRY_AGAIN 2
#define NO_RECOVERY 3
#define NO_DATA 4
#define NO_ADDRESS NO_DATA
#define EAI_ADDRFAMILY 1
#define EAI_AGAIN 2
#define EAI_BADFLAGS 3
#define EAI_FAIL 4
#define EAI_FAMILY 5
#define EAI_MEMORY 6
#define EAI_NODATA 7
#define EAI_NONAME 8
#define EAI_SERVICE 9
#define EAI_SOCKTYPE 10
#define EAI_SYSTEM 11
#define EAI_BADHINTS 12
#define EAI_PROTOCOL 13
#define EAI_OVERFLOW 14
#define EAI_MAX 15
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
// nsysnet only implements NI_NOFQDN, NI_NUMERICHOST and NI_NUMERICSERV
#define NI_NOFQDN 0x0001
#define NI_NUMERICHOST 0x0002
#define NI_NAMEREQD 0x0004
#define NI_NUMERICSERV 0x0008
#define NI_DGRAM 0x0010
#define NI_NUMERICSCOPE 0x0020
// nsysnet only implements AI_PASSIVE, AI_CANONNAME and AI_NUMERICHOST
#define AI_PASSIVE 0x0001
#define AI_CANONNAME 0x0002
#define AI_NUMERICHOST 0x0004
#define AI_V4MAPPED 0x0008
#define AI_ALL 0x0010
#define AI_ADDRCONFIG 0x0020
#ifdef __cplusplus
extern "C" {
#endif
struct hostent *
gethostbyname(const char *name);
struct hostent *
gethostbyaddr(const void *addr,
socklen_t len,
int type);
struct hostent *
gethostent(void);
struct servent *
getservbyname(const char *name,
const char *proto);
struct servent *
getservbyport(int port,
const char *proto);
struct servent *
getservent(void);
int
getaddrinfo(const char *node,
const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
void
freeaddrinfo(struct addrinfo *res);
int
getnameinfo(const struct sockaddr *addr,
socklen_t addrlen,
char *host,
socklen_t hostlen,
char *serv,
socklen_t servlen,
int flags);
const char *
gai_strerror(int ecode);
#ifdef __cplusplus
}
#endif

View File

@ -1,31 +0,0 @@
#pragma once
#include <stdint.h>
#include <sys/socket.h>
#define INADDR_ANY 0x00000000
#define INADDR_LOOPBACK 0x7F000001
#define INADDR_BROADCAST 0xFFFFFFFF
#define INADDR_NONE 0xFFFFFFFF
#define INET_ADDRSTRLEN 16
#define IPPROTO_IP 0
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
#define IP_TOS 3
#define IP_TTL 4
typedef uint16_t in_port_t;
typedef uint32_t in_addr_t;
struct in_addr {
in_addr_t s_addr;
};
struct sockaddr_in {
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
unsigned char sin_zero[8];
};

View File

@ -1,8 +0,0 @@
#pragma once
#define SOL_TCP 6
#define TCP_ACKDELAYTIME 0x2001
#define TCP_NOACKDELAY 0x2002
#define TCP_MAXSEG 0x2003
#define TCP_NODELAY 0x2004

View File

@ -43,50 +43,6 @@ ACInitialize();
void
ACFinalize();
/**
* Connects synchronically to a network, using the default configuration
* May be blocking until the console successfully connects or has an timeout.
*
* \return
* A \link nn_result Result\endlink - see \link NNResult_IsSuccess \endlink
* and \link NNResult_IsFailure \endlink.
*/
NNResult
ACConnect();
/**
* Connects asynchronically to a network, using the default configuration
*
* \return
* A \link nn_result Result\endlink - see \link NNResult_IsSuccess \endlink
* and \link NNResult_IsFailure \endlink.
*/
NNResult
ACConnectAsync();
/**
* Closes connections made with ACConnect. Use GetCloseStatus to get the status.
*
* \return
* A \link nn_result Result\endlink - see \link NNResult_IsSuccess \endlink
* and \link NNResult_IsFailure \endlink.
*/
NNResult
ACClose();
NNResult
ACGetCloseStatus();
/**
* Checks whether the console is currently connected to a network.
*
* \return
* A \link nn_result Result\endlink - see \link NNResult_IsSuccess \endlink
* and \link NNResult_IsFailure \endlink.
*/
NNResult
ACIsApplicationConnected(BOOL *connected);
/**
* Gets the default connection configuration id. This is the default as marked
* in System Settings.

View File

@ -38,10 +38,6 @@ 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);
@ -98,30 +94,6 @@ GetStartupId(ConfigIdNum *id)
return detail::GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(id);
}
static inline nn::Result
Connect()
{
return detail::Connect__Q2_2nn2acFv();
}
static inline nn::Result
ConnectAsync()
{
return detail::ConnectAsync__Q2_2nn2acFv();
}
static inline nn::Result
Close()
{
return detail::Close__Q2_2nn2acFv();
}
static inline nn::Result
GetCloseStatus()
{
return detail::GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status();
}
/**
* Connects to a network, using the configuration represented by the given
* \link ConfigIdNum \endlink.

View File

@ -1,11 +0,0 @@
#pragma once
/**
* \defgroup nn_acp nn_acp
*
*/
#include <nn/acp/device.h>
#include <nn/acp/result.h>
#include <nn/acp/save.h>
#include <nn/acp/title.h>

View File

@ -1,24 +0,0 @@
#pragma once
#include <wut.h>
#include <nn/acp/result.h>
/**
* \defgroup nn_acp_device
* \ingroup nn_acp
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef int32_t ACPDeviceType;
ACPResult
ACPCheckApplicationDeviceEmulation(BOOL* emulation);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,7 +0,0 @@
#pragma once
#include <nn/acp/title.h>
/* Included for compatibility - though this header was never in a released
* version of wut. It had the definition of ACPMetaXml.
*/
//#warning "<nn/acp/nn_acp_types.h> is deprecated! Please use <nn/acp/title.h>."

View File

@ -1,97 +0,0 @@
#pragma once
#include <wut.h>
/**
* \defgroup nn_acp_result Result
* \ingroup nn_acp
* Result codes used by nn_acp
* @{
*/
typedef enum ACPResult {
ACP_RESULT_SUCCESS = 0,
ACP_RESULT_INVALID = -200,
ACP_RESULT_INVALID_PARAMETER = -201,
ACP_RESULT_INVALID_FILE = -202,
ACP_RESULT_INVALID_XML_FILE = -203,
ACP_RESULT_FILE_ACCESS_MODE = -204,
ACP_RESULT_INVALID_NETWORK_TIME = -205,
ACP_RESULT_NOT_FOUND = -500,
ACP_RESULT_FILE_NOT_FOUND = -501,
ACP_RESULT_DIR_NOT_FOUND = -502,
ACP_RESULT_DEVICE_NOT_FOUND = -503,
ACP_RESULT_TITLE_NOT_FOUND = -504,
ACP_RESULT_APPLICATION_NOT_FOUND = -505,
ACP_RESULT_SYSTEM_CONFIG_NOT_FOUND = -506,
ACP_RESULT_XML_ITEM_NOT_FOUND = -507,
ACP_RESULT_ALREADY_EXISTS = -600,
ACP_RESULT_FILE_ALREADY_EXISTS = -601,
ACP_RESULT_DIR_ALREADY_EXISTS = -602,
ACP_RESULT_ALREADY_DONE = -700,
ACP_RESULT_AUTHENTICATION = -1000,
ACP_RESULT_INVALID_REGION = -1001,
ACP_RESULT_RESTRICTED_RATING = -1002,
ACP_RESULT_NOT_PRESENT_RATING = -1003,
ACP_RESULT_PENDING_RATING = -1004,
ACP_RESULT_NET_SETTING_REQUIRED = -1005,
ACP_RESULT_NET_ACCOUNT_REQUIRED = -1006,
ACP_RESULT_NET_ACCOUNT_ERROR = -1007,
ACP_RESULT_BROWSER_REQUIRED = -1008,
ACP_RESULT_OLV_REQUIRED = -1009,
ACP_RESULT_PINCODE_REQUIRED = -1010,
ACP_RESULT_INCORRECT_PINCODE = -1011,
ACP_RESULT_INVALID_LOGO = -1012,
ACP_RESULT_DEMO_EXPIRED_NUMBER = -1013,
ACP_RESULT_DRC_REQUIRED = -1014,
ACP_RESULT_NO_PERMISSION = -1100,
ACP_RESULT_NO_FILE_PERMISSION = -1101,
ACP_RESULT_NO_DIR_PERMISSION = -1102,
ACP_RESULT_BUSY = -1300,
ACP_RESULT_USB_STORAGE_NOT_READY = -1301,
ACP_RESULT_CANCELLED = -1400,
ACP_RESULT_RESOURCE = -1500,
ACP_RESULT_DEVICE_FULL = -1501,
ACP_RESULT_JOURNAL_FULL = -1502,
ACP_RESULT_SYSTEM_MEMORY = -1503,
ACP_RESULT_FS_RESOURCE = -1504,
ACP_RESULT_IPC_RESOURCE = -1505,
ACP_RESULT_NOT_INITIALISED = -1600,
ACP_RESULT_ACCOUNT_ERROR = -1700,
ACP_RESULT_UNSUPPORTED = -1800,
ACP_RESULT_DATA_CORRUPTED = -2000,
ACP_RESULT_DEVICE = -2001,
ACP_RESULT_SLC_DATA_CORRUPTED = -2002,
ACP_RESULT_MLC_DATA_CORRUPTED = -2003,
ACP_RESULT_USB_DATA_CORRUPTED = -2004,
ACP_RESULT_MEDIA = -2100,
ACP_RESULT_MEDIA_NOT_READY = -2101,
ACP_RESULT_MEDIA_BROKEN = -2102,
ACP_RESULT_ODD_MEDIA_NOT_READY = -2103,
ACP_RESULT_ODD_MEDIA_BROKEN = -2104,
ACP_RESULT_USB_MEDIA_NOT_READY = -2105,
ACP_RESULT_USB_MEDIA_BROKEN = -2106,
ACP_RESULT_MEDIA_WRITE_PROTECTED = -2107,
ACP_RESULT_USB_WRITE_PROTECTED = -2108,
ACP_RESULT_MII = -2200,
ACP_RESULT_ENCRYPTION_ERROR = -2201,
ACP_RESULT_GENERIC_ERROR = -4096,
} ACPResult;
WUT_CHECK_SIZE(ACPResult, 0x4);
/** @} */

View File

@ -1,44 +0,0 @@
#pragma once
#include <wut.h>
#include <nn/acp/result.h>
#include <nn/acp/device.h>
/**
* \defgroup nn_acp_save Save
* \ingroup nn_acp
*
* Save data services
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
ACPResult
ACPCreateSaveDir(uint32_t persistentId,
ACPDeviceType deviceType);
ACPResult
ACPIsExternalStorageRequired(BOOL* required);
ACPResult
ACPMountExternalStorage();
ACPResult
ACPMountSaveDir();
ACPResult
ACPRepairSaveMetaDir();
ACPResult
ACPUnmountExternalStorage();
ACPResult
ACPUnmountSaveDir();
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,255 +0,0 @@
#pragma once
#include <wut.h>
#include <nn/acp/result.h>
#include <nn/acp/device.h>
/**
* \defgroup nn_acp_title Title
* \ingroup nn_acp
*
* Information and control of installed title metadata
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef uint64_t ACPTitleId;
typedef struct ACPMetaXml ACPMetaXml;
struct WUT_PACKED ACPMetaXml {
uint64_t title_id;
uint64_t boss_id;
uint64_t os_version;
uint64_t app_size;
uint64_t common_save_size;
uint64_t account_save_size;
uint64_t common_boss_size;
uint64_t account_boss_size;
uint64_t join_game_mode_mask;
uint32_t version;
char product_code[32];
char content_platform[32];
char company_code[8];
char mastering_date[32];
uint32_t logo_type;
uint32_t app_launch_type;
uint32_t invisible_flag;
uint32_t no_managed_flag;
uint32_t no_event_log;
uint32_t no_icon_database;
uint32_t launching_flag;
uint32_t install_flag;
uint32_t closing_msg;
uint32_t title_version;
uint32_t group_id;
uint32_t save_no_rollback;
uint32_t bg_daemon_enable;
uint32_t join_game_id;
uint32_t olv_accesskey;
uint32_t wood_tin;
uint32_t e_manual;
uint32_t e_manual_version;
uint32_t region;
uint32_t pc_cero;
uint32_t pc_esrb;
uint32_t pc_bbfc;
uint32_t pc_usk;
uint32_t pc_pegi_gen;
uint32_t pc_pegi_fin;
uint32_t pc_pegi_prt;
uint32_t pc_pegi_bbfc;
uint32_t pc_cob;
uint32_t pc_grb;
uint32_t pc_cgsrr;
uint32_t pc_oflc;
uint32_t pc_reserved0;
uint32_t pc_reserved1;
uint32_t pc_reserved2;
uint32_t pc_reserved3;
uint32_t ext_dev_nunchaku;
uint32_t ext_dev_classic;
uint32_t ext_dev_urcc;
uint32_t ext_dev_board;
uint32_t ext_dev_usb_keyboard;
uint32_t ext_dev_etc;
char ext_dev_etc_name[512];
uint32_t eula_version;
uint32_t drc_use;
uint32_t network_use;
uint32_t online_account_use;
uint32_t direct_boot;
uint32_t reserved_flag0;
uint32_t reserved_flag1;
uint32_t reserved_flag2;
uint32_t reserved_flag3;
uint32_t reserved_flag4;
uint32_t reserved_flag5;
uint32_t reserved_flag6;
uint32_t reserved_flag7;
char longname_ja[512];
char longname_en[512];
char longname_fr[512];
char longname_de[512];
char longname_it[512];
char longname_es[512];
char longname_zhs[512];
char longname_ko[512];
char longname_nl[512];
char longname_pt[512];
char longname_ru[512];
char longname_zht[512];
char shortname_ja[256];
char shortname_en[256];
char shortname_fr[256];
char shortname_de[256];
char shortname_it[256];
char shortname_es[256];
char shortname_zhs[256];
char shortname_ko[256];
char shortname_nl[256];
char shortname_pt[256];
char shortname_ru[256];
char shortname_zht[256];
char publisher_ja[256];
char publisher_en[256];
char publisher_fr[256];
char publisher_de[256];
char publisher_it[256];
char publisher_es[256];
char publisher_zhs[256];
char publisher_ko[256];
char publisher_nl[256];
char publisher_pt[256];
char publisher_ru[256];
char publisher_zht[256];
uint32_t add_on_unique_id[32];
WUT_UNKNOWN_BYTES(52);
};
WUT_CHECK_OFFSET(ACPMetaXml, 0x00, title_id);
WUT_CHECK_OFFSET(ACPMetaXml, 0x08, boss_id);
WUT_CHECK_OFFSET(ACPMetaXml, 0x10, os_version);
WUT_CHECK_OFFSET(ACPMetaXml, 0x18, app_size);
WUT_CHECK_OFFSET(ACPMetaXml, 0x20, common_save_size);
WUT_CHECK_OFFSET(ACPMetaXml, 0x28, account_save_size);
WUT_CHECK_OFFSET(ACPMetaXml, 0x30, common_boss_size);
WUT_CHECK_OFFSET(ACPMetaXml, 0x38, account_boss_size);
WUT_CHECK_OFFSET(ACPMetaXml, 0x40, join_game_mode_mask);
WUT_CHECK_OFFSET(ACPMetaXml, 0x48, version);
WUT_CHECK_OFFSET(ACPMetaXml, 0x4C, product_code);
WUT_CHECK_OFFSET(ACPMetaXml, 0x6C, content_platform);
WUT_CHECK_OFFSET(ACPMetaXml, 0x8C, company_code);
WUT_CHECK_OFFSET(ACPMetaXml, 0x94, mastering_date);
WUT_CHECK_OFFSET(ACPMetaXml, 0xB4, logo_type);
WUT_CHECK_OFFSET(ACPMetaXml, 0xB8, app_launch_type);
WUT_CHECK_OFFSET(ACPMetaXml, 0xBC, invisible_flag);
WUT_CHECK_OFFSET(ACPMetaXml, 0xC0, no_managed_flag);
WUT_CHECK_OFFSET(ACPMetaXml, 0xC4, no_event_log);
WUT_CHECK_OFFSET(ACPMetaXml, 0xC8, no_icon_database);
WUT_CHECK_OFFSET(ACPMetaXml, 0xCC, launching_flag);
WUT_CHECK_OFFSET(ACPMetaXml, 0xD0, install_flag);
WUT_CHECK_OFFSET(ACPMetaXml, 0xD4, closing_msg);
WUT_CHECK_OFFSET(ACPMetaXml, 0xD8, title_version);
WUT_CHECK_OFFSET(ACPMetaXml, 0xDC, group_id);
WUT_CHECK_OFFSET(ACPMetaXml, 0xE0, save_no_rollback);
WUT_CHECK_OFFSET(ACPMetaXml, 0xE4, bg_daemon_enable);
WUT_CHECK_OFFSET(ACPMetaXml, 0xE8, join_game_id);
WUT_CHECK_OFFSET(ACPMetaXml, 0xEC, olv_accesskey);
WUT_CHECK_OFFSET(ACPMetaXml, 0xF0, wood_tin);
WUT_CHECK_OFFSET(ACPMetaXml, 0xF4, e_manual);
WUT_CHECK_OFFSET(ACPMetaXml, 0xF8, e_manual_version);
WUT_CHECK_OFFSET(ACPMetaXml, 0xFC, region);
WUT_CHECK_OFFSET(ACPMetaXml, 0x100, pc_cero);
WUT_CHECK_OFFSET(ACPMetaXml, 0x104, pc_esrb);
WUT_CHECK_OFFSET(ACPMetaXml, 0x108, pc_bbfc);
WUT_CHECK_OFFSET(ACPMetaXml, 0x10C, pc_usk);
WUT_CHECK_OFFSET(ACPMetaXml, 0x110, pc_pegi_gen);
WUT_CHECK_OFFSET(ACPMetaXml, 0x114, pc_pegi_fin);
WUT_CHECK_OFFSET(ACPMetaXml, 0x118, pc_pegi_prt);
WUT_CHECK_OFFSET(ACPMetaXml, 0x11C, pc_pegi_bbfc);
WUT_CHECK_OFFSET(ACPMetaXml, 0x120, pc_cob);
WUT_CHECK_OFFSET(ACPMetaXml, 0x124, pc_grb);
WUT_CHECK_OFFSET(ACPMetaXml, 0x128, pc_cgsrr);
WUT_CHECK_OFFSET(ACPMetaXml, 0x12C, pc_oflc);
WUT_CHECK_OFFSET(ACPMetaXml, 0x130, pc_reserved0);
WUT_CHECK_OFFSET(ACPMetaXml, 0x134, pc_reserved1);
WUT_CHECK_OFFSET(ACPMetaXml, 0x138, pc_reserved2);
WUT_CHECK_OFFSET(ACPMetaXml, 0x13C, pc_reserved3);
WUT_CHECK_OFFSET(ACPMetaXml, 0x140, ext_dev_nunchaku);
WUT_CHECK_OFFSET(ACPMetaXml, 0x144, ext_dev_classic);
WUT_CHECK_OFFSET(ACPMetaXml, 0x148, ext_dev_urcc);
WUT_CHECK_OFFSET(ACPMetaXml, 0x14C, ext_dev_board);
WUT_CHECK_OFFSET(ACPMetaXml, 0x150, ext_dev_usb_keyboard);
WUT_CHECK_OFFSET(ACPMetaXml, 0x154, ext_dev_etc);
WUT_CHECK_OFFSET(ACPMetaXml, 0x158, ext_dev_etc_name);
WUT_CHECK_OFFSET(ACPMetaXml, 0x358, eula_version);
WUT_CHECK_OFFSET(ACPMetaXml, 0x35C, drc_use);
WUT_CHECK_OFFSET(ACPMetaXml, 0x360, network_use);
WUT_CHECK_OFFSET(ACPMetaXml, 0x364, online_account_use);
WUT_CHECK_OFFSET(ACPMetaXml, 0x368, direct_boot);
WUT_CHECK_OFFSET(ACPMetaXml, 0x36C, reserved_flag0);
WUT_CHECK_OFFSET(ACPMetaXml, 0x370, reserved_flag1);
WUT_CHECK_OFFSET(ACPMetaXml, 0x374, reserved_flag2);
WUT_CHECK_OFFSET(ACPMetaXml, 0x378, reserved_flag3);
WUT_CHECK_OFFSET(ACPMetaXml, 0x37C, reserved_flag4);
WUT_CHECK_OFFSET(ACPMetaXml, 0x380, reserved_flag5);
WUT_CHECK_OFFSET(ACPMetaXml, 0x384, reserved_flag6);
WUT_CHECK_OFFSET(ACPMetaXml, 0x388, reserved_flag7);
WUT_CHECK_OFFSET(ACPMetaXml, 0x38C, longname_ja);
WUT_CHECK_OFFSET(ACPMetaXml, 0x58C, longname_en);
WUT_CHECK_OFFSET(ACPMetaXml, 0x78C, longname_fr);
WUT_CHECK_OFFSET(ACPMetaXml, 0x98C, longname_de);
WUT_CHECK_OFFSET(ACPMetaXml, 0xB8C, longname_it);
WUT_CHECK_OFFSET(ACPMetaXml, 0xD8C, longname_es);
WUT_CHECK_OFFSET(ACPMetaXml, 0xF8C, longname_zhs);
WUT_CHECK_OFFSET(ACPMetaXml, 0x118C, longname_ko);
WUT_CHECK_OFFSET(ACPMetaXml, 0x138C, longname_nl);
WUT_CHECK_OFFSET(ACPMetaXml, 0x158C, longname_pt);
WUT_CHECK_OFFSET(ACPMetaXml, 0x178C, longname_ru);
WUT_CHECK_OFFSET(ACPMetaXml, 0x198C, longname_zht);
WUT_CHECK_OFFSET(ACPMetaXml, 0x1B8C, shortname_ja);
WUT_CHECK_OFFSET(ACPMetaXml, 0x1C8C, shortname_en);
WUT_CHECK_OFFSET(ACPMetaXml, 0x1D8C, shortname_fr);
WUT_CHECK_OFFSET(ACPMetaXml, 0x1E8C, shortname_de);
WUT_CHECK_OFFSET(ACPMetaXml, 0x1F8C, shortname_it);
WUT_CHECK_OFFSET(ACPMetaXml, 0x208C, shortname_es);
WUT_CHECK_OFFSET(ACPMetaXml, 0x218C, shortname_zhs);
WUT_CHECK_OFFSET(ACPMetaXml, 0x228C, shortname_ko);
WUT_CHECK_OFFSET(ACPMetaXml, 0x238C, shortname_nl);
WUT_CHECK_OFFSET(ACPMetaXml, 0x248C, shortname_pt);
WUT_CHECK_OFFSET(ACPMetaXml, 0x258C, shortname_ru);
WUT_CHECK_OFFSET(ACPMetaXml, 0x268C, shortname_zht);
WUT_CHECK_OFFSET(ACPMetaXml, 0x278C, publisher_ja);
WUT_CHECK_OFFSET(ACPMetaXml, 0x288C, publisher_en);
WUT_CHECK_OFFSET(ACPMetaXml, 0x298C, publisher_fr);
WUT_CHECK_OFFSET(ACPMetaXml, 0x2A8C, publisher_de);
WUT_CHECK_OFFSET(ACPMetaXml, 0x2B8C, publisher_it);
WUT_CHECK_OFFSET(ACPMetaXml, 0x2C8C, publisher_es);
WUT_CHECK_OFFSET(ACPMetaXml, 0x2D8C, publisher_zhs);
WUT_CHECK_OFFSET(ACPMetaXml, 0x2E8C, publisher_ko);
WUT_CHECK_OFFSET(ACPMetaXml, 0x2F8C, publisher_nl);
WUT_CHECK_OFFSET(ACPMetaXml, 0x308C, publisher_pt);
WUT_CHECK_OFFSET(ACPMetaXml, 0x318C, publisher_ru);
WUT_CHECK_OFFSET(ACPMetaXml, 0x328C, publisher_zht);
WUT_CHECK_OFFSET(ACPMetaXml, 0x338C, add_on_unique_id);
WUT_CHECK_SIZE(ACPMetaXml,0x3440);
ACPResult
ACPGetTitleIdOfMainApplication(ACPTitleId* titleId);
ACPResult
ACPGetTitleMetaXml(ACPTitleId titleId,
ACPMetaXml* metaXml);
ACPResult
ACPGetTitleMetaDirByDevice(ACPTitleId titleId,
char* directory,
size_t directoryLen,
ACPDeviceType deviceType);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,8 +0,0 @@
#pragma once
/**
* \defgroup nn_act nn_act
* Accounts API, manages user profiles and personal info.
*/
#include <nn/act/client_cpp.h>

View File

@ -1,216 +0,0 @@
#pragma once
#include <wut.h>
#include <nn/result.h>
#include <nn/ffl/miidata.h>
/**
* \defgroup nn_act_client Accounts Client API
* \ingroup nn_act
* Personal information and accounts service client managment (see nn::act)
* @{
*/
#ifdef __cplusplus
namespace nn {
namespace act {
//https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/nn/act/nn_act_types.h
using SlotNo = uint8_t;
using LocalFriendCode = uint64_t;
using PersistentId = uint32_t;
using PrincipalId = uint32_t;
using SimpleAddressId = uint32_t;
using TransferrableId = uint64_t;
static constexpr size_t AccountIdSize = 17;
static constexpr size_t DeviceHashSize = 8;
static constexpr size_t NfsPasswordSize = 17;
static constexpr size_t MiiNameSize = 11;
static constexpr size_t UuidSize = 16;
//https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/cafe/libraries/nn_act/nn_act_client.cpp
nn::Result
Initialize(void)
asm("Initialize__Q2_2nn3actFv");
nn::Result
Finalize(void)
asm("Finalize__Q2_2nn3actFv");
//https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/cafe/libraries/nn_act/nn_act_clientstandardservice.cpp
nn::Result
GetAccountId(char outAccountId[AccountIdSize])
asm("GetAccountId__Q2_2nn3actFPc");
nn::Result
GetAccountIdEx(char outAccountId[AccountIdSize], SlotNo slot)
asm("GetAccountIdEx__Q2_2nn3actFPcUc");
nn::Result
GetBirthday(uint16_t* outYear, uint8_t* outMonth, uint8_t* outDay)
asm("GetBirthday__Q2_2nn3actFPUsPUcT2");
nn::Result
GetBirthdayEx(uint16_t* outYear, uint8_t* outMonth, uint8_t* outDay, SlotNo slot)
asm("GetBirthdayEx__Q2_2nn3actFPUsPUcT2Uc");
SlotNo
GetDefaultAccount(void)
asm("GetDefaultAccount__Q2_2nn3actFv");
nn::Result
GetDeviceHash(char outHash[DeviceHashSize])
asm("GetDeviceHash__Q2_2nn3actFPUL");
nn::Result
GetMii(FFLStoreData* mii)
asm("GetMii__Q2_2nn3actFP12FFLStoreData");
nn::Result
GetMiiEx(FFLStoreData* mii, SlotNo slot)
asm("GetMiiEx__Q2_2nn3actFP12FFLStoreDataUc");
nn::Result
GetMiiImageEx(size_t* outImageSize, void* buffer, size_t bufferSize, int unk, SlotNo slot)
asm("GetMiiImageEx__Q2_2nn3actFPUiPvUi15ACTMiiImageTypeUc");
nn::Result
GetMiiName(int16_t outName[MiiNameSize])
asm("GetMiiName__Q2_2nn3actFPw");
nn::Result
GetMiiNameEx(int16_t outName[MiiNameSize], SlotNo slot)
asm("GetMiiNameEx__Q2_2nn3actFPwUc");
nn::Result
GetNfsPassword(char outPassword[NfsPasswordSize])
asm("GetNfsPassword__Q2_2nn3actFPc");
nn::Result
GetNfsPasswordEx(char outPassword[NfsPasswordSize], SlotNo slot)
asm("GetNfsPasswordEx__Q2_2nn3actFPcUc");
uint8_t
GetNumOfAccounts(void)
asm("GetNumOfAccounts__Q2_2nn3actFv");
SlotNo
GetParentalControlsSlotNo(void)
asm("GetParentalControlSlotNo__Q2_2nn3actFv");
nn::Result
GetParentalControlsSlotNoEx(void)
asm("GetParentalControlSlotNoEx__Q2_2nn3actFPUcUc");
PersistentId
GetPersistentId(void)
asm("GetPersistentId__Q2_2nn3actFv");
PersistentId
GetPersistentIdEx(SlotNo slot)
asm("GetPersistentIdEx__Q2_2nn3actFUc");
PrincipalId
GetPrincipalId(void)
asm("GetPrincipalId__Q2_2nn3actFv");
nn::Result
GetPrincipalIdEx(PrincipalId* outId, SlotNo slot)
asm("GetPrincipalIdEx__Q2_2nn3actFPUiUc");
SimpleAddressId
GetSimpleAddressId(void)
asm("GetSimpleAddressId__Q2_2nn3actFv");
nn::Result
GetSimpleAddressId(SimpleAddressId* outId, SlotNo slot)
asm("GetSimpleAddressIdEx__Q2_2nn3actFPUiUc");
SlotNo
GetSlotNo(void)
asm("GetSlotNo__Q2_2nn3actFv");
TransferrableId
GetTransferableId(uint32_t unk1)
asm("GetTransferableId__Q2_2nn3actFUi");
nn::Result
GetTransferableIdEx(TransferrableId* outId, uint32_t unk1, SlotNo slot)
asm("GetTransferableIdEx__Q2_2nn3actFPULUiUc");
nn::Result
GetUuidEx(char outUuid[UuidSize], SlotNo slot, int32_t unk1)
asm("GetUuidEx__Q2_2nn3actFP7ACTUuidUcUi");
nn::Result
GetUuidEx(char outUuid[UuidSize], SlotNo slot)
asm("GetUuidEx__Q2_2nn3actFP7ACTUuidUc");
nn::Result
GetUuid(char outUuid[UuidSize], int32_t unk1)
asm("GetUuid__Q2_2nn3actFP7ACTUuidUi");
nn::Result
GetUuid(char outUuid[UuidSize])
asm("GetUuid__Q2_2nn3actFP7ACTUuid");
BOOL
HasNfsAccount(void)
asm("HasNfsAccount__Q2_2nn3actFv");
BOOL
IsCommitted(void)
asm("IsCommitted__Q2_2nn3actFv");
BOOL
IsCommittedEx(SlotNo slot)
asm("IsCommittedEx__Q2_2nn3actFUc");
BOOL
IsPasswordCacheEnabled(void)
asm("IsPasswordCacheEnabled__Q2_2nn3actFv");
BOOL
IsPasswordCacheEnabledEx(SlotNo slot)
asm("IsPasswordCacheEnabledEx__Q2_2nn3actFUc");
BOOL
IsNetworkAccount(void)
asm("IsNetworkAccount__Q2_2nn3actFv");
BOOL
IsNetworkAccountEx(SlotNo slot)
asm("IsNetworkAccountEx__Q2_2nn3actFUc");
BOOL
IsServerAccountActive(void)
asm("IsServerAccountActive__Q2_2nn3actFv");
BOOL
IsServerAccountActiveEx(SlotNo slot)
asm("IsServerAccountActiveEx__Q2_2nn3actFUc");
BOOL
IsServerAccountDeleted(void)
asm("IsServerAccountDeleted__Q2_2nn3actFv");
BOOL
IsServerAccountDeletedEx(SlotNo slot)
asm("IsServerAccountDeletedEx__Q2_2nn3actFUc");
BOOL
IsSlotOccupied(SlotNo slot)
asm("IsSlotOccupied__Q2_2nn3actFUc");
} //namespace act
} //namespace nn
#endif //__cplusplus
/** @} */

View File

@ -1,173 +0,0 @@
#pragma once
#include <wut.h>
/**
* \defgroup nn_ffl_miidata Mii binary format
* \ingroup nn_ffl
* Binary format for Mii storage and exchange
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
// https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/nn/ffl/nn_ffl_miidata.h
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 {
FFLCreateIDFlags flags : 4;
uint32_t timestamp : 28;
uint8_t deviceHash[6];
} FFLCreateID;
WUT_CHECK_OFFSET(FFLCreateID, 4, deviceHash);
WUT_CHECK_SIZE(FFLCreateID, 10);
//Note: the endian may be wrong here
typedef struct WUT_PACKED FFLiMiiDataCore {
// 0x00
uint8_t birth_platform : 4;
uint8_t unk_0x00_b4 : 4;
// 0x01
uint8_t unk_0x01_b0 : 4;
uint8_t unk_0x01_b4 : 4;
// 0x02
uint8_t font_region : 4;
uint8_t region_move : 2;
uint8_t unk_0x02_b6 : 1;
uint8_t copyable : 1;
// 0x03
uint8_t mii_version;
// 0x4
uint64_t author_id;
// 0xC
FFLCreateID mii_id;
// 0x16
uint16_t unk_0x16;
// 0x18
uint16_t unk_0x18_b0 : 1;
uint16_t unk_0x18_b1 : 1;
uint16_t color : 4;
uint16_t birth_day : 5;
uint16_t birth_month : 4;
uint16_t gender : 1;
// 0x1A
uint16_t mii_name[10];
// 0x2E
uint8_t size;
// 0x2F
uint8_t fatness;
// 0x30
uint8_t blush_type : 4;
uint8_t face_style : 4;
// 0x31
uint8_t face_color : 3;
uint8_t face_type : 4;
uint8_t local_only : 1;
// 0x32
uint8_t hair_mirrored : 5;
uint8_t hair_color : 3;
// 0x33
uint8_t hair_type;
// 0x34
uint32_t eye_thickness : 3;
uint32_t eye_scale : 4;
uint32_t eye_color : 3;
uint32_t eye_type : 6;
uint32_t eye_height : 7;
uint32_t eye_distance : 4;
uint32_t eye_rotation : 5;
// 0x38
uint32_t eyebrow_thickness : 4;
uint32_t eyebrow_scale : 4;
uint32_t eyebrow_color : 3;
uint32_t eyebrow_type : 5;
uint32_t eyebrow_height : 7;
uint32_t eyebrow_distance : 4;
uint32_t eyebrow_rotation : 5;
// 0x3c
uint32_t nose_height : 7;
uint32_t nose_scale : 4;
uint32_t nose_type : 5;
uint32_t mouth_thickness : 3;
uint32_t mouth_scale : 4;
uint32_t mouth_color : 3;
uint32_t mouth_type : 6;
// 0x40
uint32_t unk_0x40 : 8;
uint32_t mustache_type : 3;
uint32_t mouth_height : 5;
uint32_t mustache_height : 6;
uint32_t mustache_scale : 4;
uint32_t beard_color : 3;
uint32_t beard_type : 3;
// 0x44
uint16_t glass_height : 5;
uint16_t glass_scale : 4;
uint16_t glass_color : 3;
uint16_t glass_type : 4;
// 0x46
uint16_t unk_0x46_b0 : 1;
uint16_t mole_ypos : 5;
uint16_t mole_xpos : 5;
uint16_t mole_scale : 4;
uint16_t mole_enabled : 1;
} FFLiMiiDataCore;
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x03, mii_version);
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x04, author_id);
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x0C, mii_id);
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x16, unk_0x16);
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x1A, mii_name);
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x2E, size);
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x2F, fatness);
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x33, hair_type);
WUT_CHECK_SIZE(FFLiMiiDataCore, 0x48);
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 {
FFLiMiiDataOfficial data;
uint16_t unk_0x5C;
uint16_t checksum;
} FFLStoreData;
WUT_CHECK_OFFSET(FFLStoreData, 0x5C, unk_0x5C);
WUT_CHECK_OFFSET(FFLStoreData, 0x5E, checksum);
WUT_CHECK_SIZE(FFLStoreData, 0x60);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,9 +0,0 @@
#pragma once
/**
* \defgroup nn_pdm nn_pdm
* Log Activities for Titles
*/
#include <nn/pdm/pdm_c.h>
#include <nn/pdm/pdm_cpp.h>

View File

@ -1,47 +0,0 @@
#pragma once
#include <wut.h>
/**
* \defgroup nn_pdm_c
* \ingroup nn_pdm
* C functions for PDM
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Initializes PDM.
* Needs to be called before using other functions.
*
* \return
* 0 on success.
*/
uint32_t
PDMInitialize();
/**
* Finalize PDM.
*/
void
PDMFinalize();
/**
* Close all opened PDM Files.
*/
void
PDMCloseAllFiles();
void
PDMNotifySetTimeBeginEvent();
void
PDMNotifySetTimeEndEvent();
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,466 +0,0 @@
#pragma once
#include <wut.h>
/**
* \defgroup nn_pdm
* \ingroup nn_pdm
* Log Activities for Titles (see nn::pdm)
* @{
*/
#ifdef __cplusplus
namespace nn {
namespace pdm {
//! Flags for PlayDiary
typedef enum PlayDiaryFlags : uint16_t
{
PLAYDIARY_FLAG_DEFAULT = 0x0000,
//! Set when the user played in Wii Mode
//! Note: Title Id should be ffff ffff ffff ffff when set
PLAYDIARY_FLAG_PLAYED_IN_WII_MODE = 0x0100,
PLAYDIARY_FLAG_UNKNOWN_0A00 = 0x0a00
} PlayDiaryFlags;
WUT_CHECK_SIZE(PlayDiaryFlags, 0x02);
//! Stores PlayData for each Day
struct WUT_PACKED PlayDiary
{
//! Title ID of the title
uint64_t title_id;
//! Playtime in Minutes
uint32_t playtime;
//! Date in days since 01/01/2000
uint16_t date;
//! flags \link PlayDiaryFlags \endlink
PlayDiaryFlags flags;
};
WUT_CHECK_OFFSET(PlayDiary, 0x00, title_id);
WUT_CHECK_OFFSET(PlayDiary, 0x08, playtime);
WUT_CHECK_OFFSET(PlayDiary, 0x0c, date);
WUT_CHECK_OFFSET(PlayDiary, 0x0e, flags);
//! Stores total stats
struct WUT_PACKED PlayStats
{
//! Title ID of the title
uint64_t title_id;
//! Total Playtime in minutes
uint32_t playtime;
//! Total amount of times played
uint16_t times_played;
//! Date when the title was first played in days since 01/01/2000
uint16_t first_time_played;
//! Date when the title was last played in days since 01/01/2000
uint16_t last_time_played;
//! Unknown seems to be always 0x0000
WUT_UNKNOWN_BYTES(2);
};
WUT_CHECK_OFFSET(PlayStats, 0x00, title_id);
WUT_CHECK_OFFSET(PlayStats, 0x08, playtime);
WUT_CHECK_OFFSET(PlayStats, 0x0c, times_played);
WUT_CHECK_OFFSET(PlayStats, 0x0e, first_time_played);
WUT_CHECK_OFFSET(PlayStats, 0x10, last_time_played);
//! Unknown
struct WUT_PACKED PlayEvent
{
uint64_t title_id;
WUT_UNKNOWN_BYTES(12);
};
WUT_CHECK_OFFSET(PlayEvent, 0x00, title_id);
//! Unknown
struct WUT_PACKED PlayLog
{
uint64_t title_id;
WUT_UNKNOWN_BYTES(16);
};
WUT_CHECK_OFFSET(PlayLog, 0x00, title_id);
/**
* Initializes PDM.
* Needs to be called before using other functions-
*
* \return
* 0 on success.
*/
uint32_t
Initialize()
asm("Initialize__Q2_2nn3pdmFv");
/**
* Finalize PDM.
*/
void
Finalize()
asm("Finalize__Q2_2nn3pdmFv");
/**
* Close all opened PDM Files.
*/
void
CloseAllFiles()
asm("CloseAllFiles__Q2_2nn3pdmFv");
/**
* Convert an users PDM Save to a newer save version.
*
* \return
* 0 on success.
*/
uint32_t
Convert(uint32_t userId)
asm("Convert__Q2_2nn3pdmFi");
/**
* Wait until convert is done.
*
* \return
* 0 on success.
*/
uint32_t
WaitForConvertDone()
asm("WaitForConvertDone__Q2_2nn3pdmFv");
/**
* The max amount of \link PlayDiary \endlink that can
* be written into the save.
*
* \param outMaxLength
* A pointer to write the size to. Must not be \c NULL.
*
* \return
* 0 on success.
*/
uint32_t
GetPlayDiaryMaxLength(uint32_t* outMaxLength)
asm("GetPlayDiaryMaxLength__Q2_2nn3pdmFPi");
/**
* Gets the amount of an users \link PlayDiary \endlink entries.
*
* \param outLength
* A pointer to write the size to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \return
* 0 on success.
*/
uint32_t
GetPlayDiaryLength(uint32_t* outLength, uint32_t userId)
asm("GetPlayDiaryLength__Q2_2nn3pdmFPii");
/**
*
*
* \param outStart
* A pointer to write the start to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \return
* 0 on success.
*/
uint32_t
GetPlayDiaryStart(uint32_t* outStart, uint32_t userId)
asm("GetPlayDiaryStart__Q2_2nn3pdmFPii");
/**
* Gets an array of \link PlayDiary \endlink entries.
*
* \param outAmount
* A pointer to write the amount of entries that have been
* written to the array. Must not be \c NULL.
* May be smaller than the amount passed to the function.
*
* \param outPlayDiaries
* A pointer to write an array of \link PlayDiary \endlink
* to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \param amount
* The max amount of entries to be written to the array
*
* \return
* 0 on success.
*/
uint32_t
GetPlayDiary(uint32_t* outAmount, PlayDiary* outPlayDiaries, uint32_t userId, uint32_t amount)
asm("GetPlayDiary__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayDiaryiT3");
/**
* Gets an array of \link PlayDiary \endlink entries.
*
* \param outPlayDiaries
* A pointer to write an array of \link PlayDiary \endlink
* to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \param amount
* The max amount of entries to be written to the array
*
* \return
* Either the amount of entries that have been
* written to the array or 0xFFFFFF on error.
* May be smaller than the amount passed to the function.
*/
uint32_t
GetPlayDiary(PlayDiary* outPlayDiaries, uint32_t userId, uint32_t amount)
asm("GetPlayDiary__Q2_2nn3pdmFPQ3_2nn3pdm9PlayDiaryiT2");
/**
* The max amount of \link PlayEvent \endlink that can
* be written into the save.
*
* \param outMaxLength
* A pointer to write the size to. Must not be \c NULL.
*
* \return
* 0 on success.
*/
uint32_t
GetPlayEventMaxLength(uint32_t* outMaxLength)
asm("GetPlayEventMaxLength__Q2_2nn3pdmFPi");
/**
* Gets an array of \link PlayEvent \endlink entries.
*
* \param outAmount
* A pointer to write the amount of entries that have been
* written to the array. Must not be \c NULL.
* May be smaller than the amount passed to the function.
*
* \param outPlayEvents
* A pointer to write an array of \link PlayEvent \endlink
* to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \param amount
* The max amount of entries to be written to the array
*
* \return
* 0 on success.
*/
uint32_t
GetPlayEvent(uint32_t* outAmount, PlayEvent* outPlayEvents, uint32_t userId, uint32_t amount)
asm("GetPlayEvent__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayEventiT3");
/**
* The max amount of \link PlayLog \endlink that can
* be written into the save.
*
* \param outMaxLength
* A pointer to write the size to. Must not be \c NULL.
*
* \return
* 0 on success.
*/
uint32_t
GetPlayLogMaxLength(uint32_t* outMaxLength)
asm("GetPlayLogMaxLength__Q2_2nn3pdmFPi");
/**
* Gets the amount of an users \link PlayLog \endlink entries.
*
* \param outLength
* A pointer to write the size to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \return
* 0 on success.
*/
uint32_t
GetPlayLogLength(uint32_t* outLength, uint32_t userId)
asm("GetPlayLogLength__Q2_2nn3pdmFPii");
/**
*
*
* \param outStart
* A pointer to write the start to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \return
* 0 on success.
*/
uint32_t
GetPlayLogStart(uint32_t* outStart, uint32_t userId)
asm("GetPlayLogStart__Q2_2nn3pdmFPii");
/**
* Gets an array of \link PlayLog \endlink entries.
*
* \param outAmount
* A pointer to write the amount of entries that have been
* written to the array. Must not be \c NULL.
* May be smaller than the amount passed to the function.
*
* \param outPlayLogs
* A pointer to write an array of \link PlayLog \endlink
* to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \param amount
* The max amount of entries to be written to the array
*
* \return
* 0 on success.
*/
uint32_t
GetPlayLog(uint32_t* outAmount, PlayLog* outPlayLogs, uint32_t userId, uint32_t amount)
asm("GetPlayLog__Q2_2nn3pdmFPiPQ3_2nn3pdm7PlayLogiT3");
/**
* Gets an array of \link PlayLog \endlink entries.
*
* \param outPlayLogs
* A pointer to write an array of \link PlayLog \endlink
* to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \param amount
* The max amount of entries to be written to the array
*
* \return
* Either the amount of entries that have been
* written to the array or 0xFFFFFF on error.
* May be smaller than the amount passed to the function.
*/
uint32_t
GetPlayLog(PlayLog* outPlayLogs, uint32_t userId, uint32_t amount)
asm("GetPlayLog__Q2_2nn3pdmFPQ3_2nn3pdm7PlayLogiT2");
/**
* The max amount of \link PlayStats \endlink that can
* be written into the save.
*
* \param outMaxLength
* A pointer to write the size to. Must not be \c NULL.
*
* \return
* 0 on success.
*/
uint32_t
GetPlayStatsMaxLength(uint32_t* outMaxLength)
asm("GetPlayStatsMaxLength__Q2_2nn3pdmFPi");
/**
* Gets the amount of an users \link PlayStats \endlink entries.
*
* \param outLength
* A pointer to write the size to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \return
* 0 on success.
*/
uint32_t
GetPlayStatsLength(uint32_t* outLength, uint32_t userId)
asm("GetPlayStatsLength__Q2_2nn3pdmFPii");
/**
* Gets \link PlayLog \endlink entry of a Title ID.
*
* \param outPlayStats
* A pointer to write a \link PlayLog \endlink to.
* Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \param titleId
* The titleId of the \link PlayLog \endlink
*
* \return
* 0 on success
*/
uint32_t
GetPlayStatsOfTitleId(PlayStats* outPlayStats, uint32_t userId, uint64_t titleId)
asm("GetPlayStatsOfTitleId__Q2_2nn3pdmFPQ3_2nn3pdm9PlayStatsiUL");
/**
* Gets an array of \link PlayStats \endlink entries.
*
* \param outAmount
* A pointer to write the amount of entries that have been
* written to the array. Must not be \c NULL.
* May be smaller than the amount passed to the function.
*
* \param outPlayStats
* A pointer to write an array of \link PlayStats \endlink
* to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \param amount
* The max amount of entries to be written to the array
*
* \return
* 0 on success.
*/
uint32_t
GetPlayStats(uint32_t* outAmount, PlayStats* outPlayStats, uint32_t userId, uint32_t amount)
asm("GetPlayStats__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayStatsiT3");
/**
* Gets an array of \link PlayStats \endlink entries.
*
* \param outPlayStats
* A pointer to write an array of \link PlayStats \endlink
* to. Must not be \c NULL.
*
* \param userId
* A user ID from 1-12 to indicate the User
*
* \param amount
* The max amount of entries to be written to the array
*
* \return
* Either the amount of entries that have been
* written to the array or 0xFFFFFF on error.
* May be smaller than the amount passed to the function.
*/
uint32_t
GetPlayStats(PlayStats* outPlayStats, uint32_t userId, uint32_t amount)
asm("GetPlayStats__Q2_2nn3pdmFPQ3_2nn3pdm9PlayStatsiT2");
void
NotifySetTimeBeginEvent()
asm("NotifySetTimeBeginEvent__Q2_2nn3pdmFv");
void
NotifySetTimeEndEvent()
asm("NotifySetTimeEndEvent__Q2_2nn3pdmFv");
} //namespace pdm
} //namespace nn
#endif
/** @} */

View File

@ -222,7 +222,9 @@ public:
public:
Result(Level level, Module module, unsigned description) :
mValue(((level & 0x7) << 29) | ((module & 0x1FF) << 20) | (description & 0xFFFFF))
mDescription(description),
mModule(module),
mLevel(level)
{
}
@ -256,37 +258,45 @@ public:
*/
bool IsSuccess() const
{
return mValue >= 0; // level >= 0
return mLevel >= 0;
}
bool IsLegacy() const
{
return ((mValue >> 27) & 0x3) == SIGNATURE_IS_LEGACY;
return mLegacy.signature == SIGNATURE_IS_LEGACY;
}
unsigned GetDescription() const
{
return mValue & (IsLegacy() ? 0x3FF : 0xFFFFF);
if (IsLegacy()) {
return mLegacy.description;
}
return mDescription;
}
int GetLevel() const
{
if (IsLegacy()) {
return (mValue << 14) >> 28; // cause arithmetic shift
return mLegacy.level;
}
return mValue >> 29;
return mLevel;
}
unsigned GetModule() const
{
return (mValue >> 20) & (IsLegacy() ? 0x7F : 0x1FF);
if (IsLegacy()) {
return mLegacy.module;
}
return mModule;
}
unsigned GetSummary() const
{
if (IsLegacy()) {
return (mValue >> 10) & 0xF;
return mLegacy.summary;
}
return 0;
@ -315,7 +325,24 @@ public:
}
private:
union {
struct {
uint32_t description : 10;
uint32_t summary : 4;
int32_t level : 4;
uint32_t : 2;
uint32_t module : 7;
uint32_t signature : 2;
} mLegacy;
struct {
uint32_t mDescription : 20;
uint32_t mModule : 9;
int32_t mLevel : 3;
};
int32_t mValue;
};
};
} // namespace nn

View File

@ -55,14 +55,7 @@ enum class RegionType
enum class State
{
//! The input form / keyboard is completely hidden.
Hidden = 0,
//! The input form / keyboard is drawing the fade in animation.
FadeIn = 1,
//! The input form / keyboard is done drawing the fade in animation and completely visible.
Visible = 2,
//! The input form / keyboard is drawing the fade out animation.
FadeOut = 3,
Unknown0 = 0,
};
//! Configuration options for the virtual keyboard.
@ -388,12 +381,6 @@ GetInputFormString();
void
GetKeyboardCondition(KeyboardCondition *keyboardCondition);
/**
* Get the current state of the input form.
*
* \returns
* The current \link nn::swkbd::State State \endlink of the input form.
*/
State
GetStateInputForm();

View File

@ -1,57 +0,0 @@
#pragma once
#include <wut.h>
#include <netdb.h>
/**
* \defgroup nsysnet_netdb Netdb
* \ingroup nsysnet
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
struct hostent *
RPLWRAP(gethostbyaddr)(const void *addr,
size_t len,
int type);
struct hostent *
RPLWRAP(gethostbyname)(const char *name);
int
RPLWRAP(getaddrinfo)(const char *node,
const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
void
RPLWRAP(freeaddrinfo)(struct addrinfo *res);
int
RPLWRAP(getnameinfo)(const struct sockaddr *addr,
socklen_t addrlen,
char *host,
socklen_t hostlen,
char *serv,
socklen_t servlen,
int flags);
void
RPLWRAP(clear_resolver_cache)(void);
int
RPLWRAP(set_resolver_allocator)(void* (*alloc)(uint32_t),
void (*free)(void*));
int *
RPLWRAP(get_h_errno)(void);
const char *
RPLWRAP(gai_strerror)(int ecode);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,158 +0,0 @@
#pragma once
#include <wut.h>
#include <wut_rplwrap.h>
#include <stdint.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/**
* \defgroup nsysnet_socket Socket
* \ingroup nsysnet
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* fd_set for select()
*/
#define NSYSNET_FD_SETSIZE 32
#define NSYSNET_FD_SET(n, p) ((p)->fds_bits |= (1L << (n)))
#define NSYSNET_FD_CLR(n, p) ((p)->fds_bits &= ~(1L << (n)))
#define NSYSNET_FD_ISSET(n, p) ((p)->fds_bits & (1L << (n)))
#define NSYSNET_FD_ZERO(p) ((p)->fds_bits = 0L)
typedef uint32_t nsysnet_fd_mask;
typedef struct nsysnet_fd_set nsysnet_fd_set;
struct nsysnet_fd_set
{
nsysnet_fd_mask fds_bits;
};
struct nsysnet_timeval
{
long tv_sec;
long tv_usec;
};
void
RPLWRAP(socket_lib_init)();
void
RPLWRAP(socket_lib_finish)();
int
RPLWRAP(accept)(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
RPLWRAP(bind)(int sockfd,
const struct sockaddr *addr,
socklen_t addrlen);
int
RPLWRAP(socketclose)(int sockfd);
int
RPLWRAP(connect)(int sockfd,
const struct sockaddr *addr,
socklen_t addrlen);
int
RPLWRAP(getpeername)(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
RPLWRAP(getsockname)(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
RPLWRAP(getsockopt)(int sockfd,
int level,
int optname,
void *optval,
socklen_t *optlen);
int
RPLWRAP(listen)(int sockfd,
int backlog);
int
RPLWRAP(recv)(int sockfd,
void *buf,
size_t len,
int flags);
int
RPLWRAP(recvfrom)(int sockfd,
void *buf,
size_t len,
int flags,
struct sockaddr *src_addr,
socklen_t *addrlen);
int
RPLWRAP(send)(int sockfd,
const void *buf,
size_t len,
int flags);
int
RPLWRAP(sendto)(int sockfd,
const void *buf,
size_t len,
int flags,
const struct sockaddr *dest_addr,
socklen_t addrlen);
int
RPLWRAP(setsockopt)(int sockfd,
int level,
int optname,
const void *optval,
socklen_t optlen);
int
RPLWRAP(shutdown)(int sockfd,
int how);
int
RPLWRAP(socket)(int domain,
int type,
int protocol);
int
RPLWRAP(select)(int nfds,
nsysnet_fd_set *readfds,
nsysnet_fd_set *writefds,
nsysnet_fd_set *exceptfds,
struct nsysnet_timeval *timeout);
const char *
RPLWRAP(inet_ntop)(int af,
const void *src,
char *dst,
socklen_t size);
int
RPLWRAP(inet_pton)(int af,
const char *src,
void *dst);
int
RPLWRAP(socketlasterr)();
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -24,71 +24,11 @@
extern "C" {
#endif
//! An NSSL library return code.
typedef int32_t NSSLError;
//! A handle to a NSSL context created with NSSLCreateContext().
typedef int32_t NSSLContextHandle;
//! A handle to a NSSL connection created with NSSLCreateConnection().
typedef int32_t NSSLConnectionHandle;
/**
* List of errors returned by the NSSL library.
*/
typedef enum NSSLErrors
{
NSSL_ERROR_OK = 0x0,
NSSL_ERROR_GENERIC = -0x1,
NSSL_ERROR_INVALID_NSSL_CONTEXT = -0x280001,
NSSL_ERROR_INVALID_CERT_ID = -0x280002,
NSSL_ERROR_CERT_LIMIT = -0x280003,
NSSL_ERROR_INVALID_NSSL_CONNECTION = -0x280004,
NSSL_ERROR_INVALID_CERT = -0x280005,
NSSL_ERROR_ZERO_RETURN = -0x280006,
NSSL_ERROR_WANT_READ = -0x280007,
NSSL_ERROR_WANT_WRITE = -0x280008,
NSSL_ERROR_IO_ERROR = -0x280009,
NSSL_ERROR_NSSL_LIB_ERROR = -0x28000a,
NSSL_ERROR_UNKNOWN = -0x28000b,
NSSL_ERROR_OUT_OF_MEMORY = -0x28000c,
NSSL_ERROR_INVALID_STATE = -0x28000d,
NSSL_ERROR_HANDSHAKE_ERROR = -0x28000e,
NSSL_ERROR_NO_CERT = -0x28000f,
NSSL_ERROR_INVALID_FD = -0x280010,
NSSL_ERROR_LIB_NOT_READY = -0x280011,
NSSL_ERROR_IPC_ERROR = -0x280012,
NSSL_ERROR_RESOURCE_LIMIT = -0x280013,
NSSL_ERROR_INVALID_HANDLE = -0x280014,
NSSL_ERROR_INVALID_CERT_TYPE = -0x280015,
NSSL_ERROR_INVALID_KEY_TYPE = -0x280016,
NSSL_ERROR_INVALID_SIZE = -0x280017,
NSSL_ERROR_NO_PEER_CERT = -0x280018,
NSSL_ERROR_INSUFFICIENT_SIZE = -0x280019,
NSSL_ERROR_NO_CIPHER = -0x28001a,
NSSL_ERROR_INVALID_ARG = -0x28001b,
NSSL_ERROR_INVALID_NSSL_SESSION = -0x28001c,
NSSL_ERROR_NO_SESSION = -0x28001d,
NSSL_ERROR_SSL_SHUTDOWN_ERROR = -0x28001e,
NSSL_ERROR_CERT_SIZE_LIMIT = -0x28001f,
NSSL_ERROR_CERT_NO_ACCESS = -0x280020,
NSSL_ERROR_INVALID_CERT_ID2 = -0x280021,
NSSL_ERROR_CERT_READ_ERROR = -0x280022,
NSSL_ERROR_CERT_STORE_INIT_FAILURE = -0x280023,
NSSL_ERROR_INVALID_CERT_ENCODING = -0x280024,
NSSL_ERROR_CERT_STORE_ERROR = -0x280025,
NSSL_ERROR_PRIVATE_KEY_READ_ERROR = -0x280026,
NSSL_ERROR_INVALID_PRIVATE_KEY = -0x280027,
NSSL_ERROR_NOT_READY = -0x280028,
NSSL_ERROR_ENCRYPTION_ERROR = -0x280029,
NSSL_ERROR_NO_CERT_STORE = -0x28002a,
NSSL_ERROR_PRIVATE_KEY_SIZE_LIMIT = -0x28002b,
NSSL_ERROR_PROCESS_MAX_EXT_CERTS = -0x28002c,
NSSL_ERROR_PROCESS_MAX_CONTEXTS = -0x28002d,
NSSL_ERROR_PROCESS_MAX_CONNECTIONS = -0x28002e,
NSSL_ERROR_CERT_NOT_EXPORTABLE = -0x28002f,
NSSL_ERROR_INVALID_CERT_SIZE = -0x280030,
NSSL_ERROR_INVALID_KEY_SIZE = -0x280031,
} NSSLErrors;
/**
* The IDs of a system CA. These certificates are built-in to the system and can
* be added to a NSSL context with NSSLAddServerPKI().
@ -251,7 +191,7 @@ typedef enum NSSLServerCertId
* \sa
* - NSSLFinish()
*/
NSSLError
int32_t
NSSLInit();
/**
@ -260,7 +200,7 @@ NSSLInit();
* \returns
* 0 on success, or -1 on error.
*/
NSSLError
int32_t
NSSLFinish();
/**
@ -272,7 +212,7 @@ NSSLFinish();
*
* \returns
* A #NSSLContextHandle representing the newly created context, or a negative
* value among NSSLErrors on error.
* value on error.
*
* \sa
* - NSSLDestroyContext()
@ -287,9 +227,9 @@ NSSLCreateContext(int32_t unk);
* The NSSL context to destroy.
*
* \returns
* 0 on success, or a negative value if an error occurred.
* 0 on success, or a negative value if an error occured.
*/
NSSLError
int32_t
NSSLDestroyContext(NSSLContextHandle context);
/**
@ -318,7 +258,7 @@ NSSLDestroyContext(NSSLContextHandle context);
* x509 in binary DER. What's a working value for unk? 0?
* \endif
*/
NSSLError
int32_t
NSSLAddServerPKIExternal(NSSLContextHandle context,
const void *cert,
int32_t length,
@ -339,7 +279,7 @@ NSSLAddServerPKIExternal(NSSLContextHandle context,
* \sa
* - NSSLAddServerPKIExternal()
*/
NSSLError
int32_t
NSSLAddServerPKI(NSSLContextHandle context,
NSSLServerCertId pki);
@ -365,8 +305,7 @@ NSSLAddServerPKI(NSSLContextHandle context,
* If opening a new underlying socket, whether to open it in blocking mode.
*
* \returns
* A #NSSLConnectionHandle representing the current connection, or a negative
* value among NSSLErrors on error.
* A #NSSLConnectionHandle representing the current connection.
*
* \sa
* - NSSLRead()
@ -394,7 +333,7 @@ NSSLCreateConnection(NSSLContextHandle context,
* \returns
* 0 on success or a negative error value.
*/
NSSLError
int32_t
NSSLDestroyConnection(NSSLConnectionHandle connection);
/**
@ -419,7 +358,7 @@ NSSLDestroyConnection(NSSLConnectionHandle connection);
* \sa
* - NSSLWrite()
*/
NSSLError
int32_t
NSSLRead(NSSLConnectionHandle connection,
const void *buffer,
int32_t length,
@ -447,7 +386,7 @@ NSSLRead(NSSLConnectionHandle connection,
* \sa
* - NSSLRead()
*/
NSSLError
int32_t
NSSLWrite(NSSLConnectionHandle connection,
const void *buffer,
int32_t length,

View File

@ -1,38 +1,229 @@
#pragma once
#include <wut.h>
#include <stdint.h>
#define FD_SETSIZE 32
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
#warning "nsysnet/socket.h is deprecated; please use standard socket headers instead."
#include <sys/select.h>
/**
* \defgroup nsysnet_socket Socket
* \ingroup nsysnet
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
#define NSN_EAGAIN EAGAIN
#define NSN_EWOULDBLOCK EWOULDBLOCK
#define SOL_SOCKET -1
__attribute__ ((deprecated))
static inline int
socketclose(int sockfd)
{
return close(sockfd);
}
#define INADDR_ANY 0
#define INADDR_BROADCAST 0xFFFFFFFF
__attribute__ ((deprecated))
static inline int
socketlasterr()
#define PF_UNSPEC 0
#define PF_INET 2
#define PF_INET6 23
#define AF_UNSPEC PF_UNSPEC
#define AF_INET PF_INET
#define AF_INET6 PF_INET6
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define MSG_OOB 0x0001
#define MSG_PEEK 0x0002
#define MSG_DONTROUTE 0x0004
#define MSG_DONTWAIT 0x0020
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
#define IPPROTO_IP 0
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
/*
* SOL_SOCKET options
*/
#define SO_REUSEADDR 0x0004 // reuse address
#define SO_BROADCAST 0x0020 // broadcast
#define SO_LINGER 0x0080 // linger (no effect?)
#define SO_OOBINLINE 0x0100 // out-of-band data inline (no effect?)
#define SO_TCPSACK 0x0200 // set tcp selective acknowledgment
#define SO_WINSCALE 0x0400 // set tcp window scaling
#define SO_SNDBUF 0x1001 // send buffer size
#define SO_RCVBUF 0x1002 // receive buffer size
#define SO_SNDLOWAT 0x1003 // send low-water mark (no effect?)
#define SO_RCVLOWAT 0x1004 // receive low-water mark
#define SO_TYPE 0x1008 // get socket type
#define SO_ERROR 0x1009 // get socket error
#define SO_NBIO 0x1014 // set socket to NON-blocking mode
#define SO_BIO 0x1015 // set socket to blocking mode
#define SO_NONBLOCK 0x1016 // set/get blocking mode via optval param
/*
* Errors returned by nsysnet socket functions
* WARNING: these do not match with sys/errno.h (where EAGAIN is 11 for example).
*/
#define NSN_EAGAIN 6
#define NSN_EWOULDBLOCK 6
typedef uint32_t socklen_t;
typedef uint16_t sa_family_t;
struct sockaddr
{
return errno;
}
sa_family_t sa_family;
char sa_data[];
};
struct sockaddr_storage
{
sa_family_t ss_family;
char ss_padding[14];
};
struct linger
{
int l_onoff;
int l_linger;
};
struct in_addr
{
unsigned int s_addr;
};
struct sockaddr_in
{
unsigned short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
void
socket_lib_init();
void
socket_lib_finish();
int
accept(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
bind(int sockfd,
const struct sockaddr *addr,
socklen_t addrlen);
int
socketclose(int sockfd);
int
connect(int sockfd,
const struct sockaddr *addr,
socklen_t addrlen);
int
getpeername(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
getsockname(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
getsockopt(int sockfd,
int level,
int optname,
void *optval,
socklen_t *optlen);
int
listen(int sockfd,
int backlog);
int
recv(int sockfd,
void *buf,
size_t len,
int flags);
int
recvfrom(int sockfd,
void *buf,
size_t len,
int flags,
struct sockaddr *src_addr,
socklen_t *addrlen);
int
send(int sockfd,
const void *buf,
size_t len,
int flags);
int
sendto(int sockfd,
const void *buf,
size_t len,
int flags,
const struct sockaddr *dest_addr,
socklen_t addrlen);
int
setsockopt(int sockfd,
int level,
int optname,
const void *optval,
socklen_t optlen);
int
shutdown(int sockfd,
int how);
int
socket(int domain,
int type,
int protocol);
int
select(int nfds,
fd_set *readfds,
fd_set *writefds,
fd_set *exceptfds,
struct timeval *timeout);
const char *
inet_ntoa(struct in_addr in);
int
inet_aton(const char *cp, struct in_addr *inp);
int
socketlasterr();
uint32_t
htonl(uint32_t val);
uint16_t
htons(uint16_t val);
uint32_t
ntohl(uint32_t val);
uint16_t
ntohs(uint16_t val);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,4 +0,0 @@
/**
* \defgroup nsysuhs nsysuhs
*
*/

View File

@ -1,245 +0,0 @@
#pragma once
#include <wut.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "uhs_usbspec.h"
typedef struct UhsInterfaceFilter UhsInterfaceFilter;
typedef struct UhsInterfaceProfile UhsInterfaceProfile;
typedef struct UhsEndpointDescriptor UhsEndpointDescriptor;
typedef struct UhsHandle UhsHandle;
typedef struct UhsConfig UhsConfig;
/* Determines which interface parameters to check */
#define MATCH_ANY 0x000
#define MATCH_DEV_VID 0x001
#define MATCH_DEV_PID 0x002
#define MATCH_DEV_CLASS 0x010
#define MATCH_DEV_SUBCLASS 0x020
#define MATCH_DEV_PROTOCOL 0x040
#define MATCH_IF_CLASS 0x080
#define MATCH_IF_SUBCLASS 0x100
#define MATCH_IF_PROTOCOL 0x200
typedef enum UHSStatus
{
UHS_STATUS_OK = 0,
UHS_STATUS_HANDLE_INVALID_ARGS = 0xffdefffd,
UHS_STATUS_HANDLE_INVALID_STATE = 0xffdefffc,
} UHSStatus;
typedef enum UHSHandleState
{
UHS_HANDLE_STATE_INIT = 0x00,
UHS_HANDLE_STATE_OPENING = 0x01,
UHS_HANDLE_STATE_OPENED = 0x02,
UHS_HANDLE_STATE_CLOSING = 0x03,
UHS_HANDLE_STATE_CLOSED = 0x04,
UHS_HANDLE_STATE_ERROR = 0x05,
} UHSHandleState;
struct WUT_PACKED UhsConfig
{
uint32_t controller_num;
void* buffer;
uint32_t buffer_size;
};
WUT_CHECK_OFFSET(UhsConfig, 0x00, controller_num);
WUT_CHECK_OFFSET(UhsConfig, 0x04, buffer);
WUT_CHECK_OFFSET(UhsConfig, 0x08, buffer_size);
WUT_CHECK_SIZE(UhsConfig, 0x0C);
struct WUT_PACKED UhsHandle
{
UHSHandleState state;
void* ipc_buffer;
WUT_UNKNOWN_BYTES(4); /* always 0xFFFFFFFF after init */
uint32_t handle;
UhsConfig * config;
WUT_UNKNOWN_BYTES(4);
};
WUT_CHECK_OFFSET(UhsHandle, 0x00, state);
WUT_CHECK_OFFSET(UhsHandle, 0x04, ipc_buffer);
WUT_CHECK_OFFSET(UhsHandle, 0x0C, handle);
WUT_CHECK_OFFSET(UhsHandle, 0x10, config);
WUT_CHECK_SIZE(UhsHandle, 0x18);
/* Endpoint transfer directions */
#define ENDPOINT_TRANSFER_OUT 1
#define ENDPOINT_TRANSFER_IN 2
/* Special timeout values */
#define TIMEOUT_NONE -1
/* Interface filter */
struct WUT_PACKED UhsInterfaceFilter
{
uint16_t match_params; /* Bitmask of above flags */
uint16_t vid; /* Vendor ID */
uint16_t pid; /* Product ID */
WUT_UNKNOWN_BYTES(4);
uint8_t dev_class; /* Device class */
uint8_t dev_subclass; /* Device subclass */
uint8_t dev_protocol; /* Device protocol */
uint8_t if_class; /* Interface class */
uint8_t if_subclass; /* Interface subclass */
uint8_t if_protocol; /* Interface protocol */
};
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x00, match_params);
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x02, vid);
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x04, pid);
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x0A, dev_class);
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x0B, dev_subclass);
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x0C, dev_protocol);
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x0D, if_class);
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x0E, if_subclass);
WUT_CHECK_OFFSET(UhsInterfaceFilter, 0x0F, if_protocol);
WUT_CHECK_SIZE(UhsInterfaceFilter, 0x10);
/* Interface profile */
struct WUT_PACKED UhsEndpointDescriptor
{
uint8_t bLength;
uint8_t bDescriptorType;
uint8_t bEndpointAddress;
uint8_t bmAttributes;
uint16_t wMaxPacketSize;
uint8_t bInterval;
WUT_UNKNOWN_BYTES(0x2);
};
WUT_CHECK_OFFSET(UhsEndpointDescriptor, 0x00, bLength);
WUT_CHECK_OFFSET(UhsEndpointDescriptor, 0x01, bDescriptorType);
WUT_CHECK_OFFSET(UhsEndpointDescriptor, 0x02, bEndpointAddress);
WUT_CHECK_OFFSET(UhsEndpointDescriptor, 0x03, bmAttributes);
WUT_CHECK_OFFSET(UhsEndpointDescriptor, 0x04, wMaxPacketSize);
WUT_CHECK_OFFSET(UhsEndpointDescriptor, 0x06, bInterval);
WUT_CHECK_SIZE(UhsEndpointDescriptor, 0x09);
/* Interface profile */
struct WUT_PACKED UhsInterfaceProfile
{
uint32_t if_handle;
WUT_UNKNOWN_BYTES(0x24);
UhsDeviceDescriptor dev_desc;
UhsConfigDescriptor cfg_desc;
UhsInterfaceDescriptor if_desc;
UhsEndpointDescriptor in_endpoints[16];
UhsEndpointDescriptor out_endpoints[16];
};
WUT_CHECK_OFFSET(UhsInterfaceProfile, 0x00, if_handle);
WUT_CHECK_OFFSET(UhsInterfaceProfile, 0x28, dev_desc);
WUT_CHECK_OFFSET(UhsInterfaceProfile, 0x3A, cfg_desc);
WUT_CHECK_OFFSET(UhsInterfaceProfile, 0x43, if_desc);
WUT_CHECK_OFFSET(UhsInterfaceProfile, 0x4c, in_endpoints);
WUT_CHECK_OFFSET(UhsInterfaceProfile, 0xdc, out_endpoints);
WUT_CHECK_SIZE(UhsInterfaceProfile, 0x16C);
/* Open a specific controller under /dev/uhs */
UHSStatus UhsClientOpen(UhsHandle* handle,
UhsConfig* config);
UHSStatus UhsClientClose(UhsHandle* handle);
typedef void(*UHSDrvRegCallback)(void * context, UhsInterfaceProfile * profile);
/* Register a USB class driver */
UHSStatus
UhsClassDrvReg(UhsHandle* handle,
UhsInterfaceFilter *filter,
void *context,
UHSDrvRegCallback callback);
UHSStatus UhsGetFullConfigDescriptor(UhsHandle* handle,
uint32_t if_handle,
void* data,
uint32_t size);
/* Determine which USB device interfaces are plugged in and available */
UHSStatus
UhsQueryInterfaces(UhsHandle* handle,
UhsInterfaceFilter *filter,
UhsInterfaceProfile *profiles,
int32_t max_profiles);
typedef void(*UhsAcquireInterfaceCallback)(void * context, int32_t arg1, int32_t arg2);
/* Acquire a USB device interface for use */
UHSStatus
UhsAcquireInterface(UhsHandle* handle,
uint32_t if_handle,
void * context,
UhsAcquireInterfaceCallback callback);
/* Release a currently-held USB device interface */
UHSStatus
UhsReleaseInterface(UhsHandle* handle,
uint32_t if_handle,
bool no_reacquire);
/* Administer a USB device */
UHSStatus
UhsAdministerDevice(UhsHandle* handle,
uint32_t if_handle,
int32_t arg2,
int32_t arg3);
/* Submit a control request to endpoint 0 */
UHSStatus
UhsSubmitControlRequest(UhsHandle* handle,
uint32_t if_handle,
void *buffer,
uint8_t bRequest,
uint8_t bmRequestType,
uint16_t wValue,
uint16_t wIndex,
uint16_t wLength,
int32_t timeout);
/* Submit a bulk request to an endpoint */
UHSStatus
UhsSubmitBulkRequest(UhsHandle* handle,
uint32_t if_handle,
uint8_t endpoint,
int32_t direction,
void *buffer,
int32_t length,
int32_t timeout);
UHSStatus
UhsAdministerEndpoint(UhsHandle* handle,
uint32_t if_handle,
uint32_t u1,
uint32_t endpointMask,
int32_t u2,
uint32_t u3);
static inline uint32_t UHSEndpointDirIsIn(UhsEndpointDescriptor * endpoint_descriptor){
return ((endpoint_descriptor->bEndpointAddress & 0x80) == 0x80);
}
static inline uint32_t UHSEndpointGetNum(UhsEndpointDescriptor * endpoint_descriptor){
return (endpoint_descriptor->bEndpointAddress & 0x0F);
}
static inline uint32_t UHSEndpointGetMask(UhsEndpointDescriptor * endpoint_descriptor){
uint32_t endpoint_mask;
if (UHSEndpointDirIsIn(endpoint_descriptor)) {
endpoint_mask = (1 << (UHSEndpointGetNum(endpoint_descriptor) + 16));
} else {
endpoint_mask = (1 << UHSEndpointGetNum(endpoint_descriptor));
}
return endpoint_mask;
}
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -1,117 +0,0 @@
#pragma once
#include <wut.h>
#ifdef __cplusplus
extern "C" {
#endif
/* USB class codes */
#define USBCLASS_DEVICE 0x00
#define USBCLASS_AUDIO 0x01
#define USBCLASS_HID 0x03
#define USBCLASS_STORAGE 0x08
typedef struct UhsDeviceDescriptor UhsDeviceDescriptor;
typedef struct UhsConfigDescriptor UhsConfigDescriptor;
typedef struct UhsInterfaceDescriptor UhsInterfaceDescriptor;
typedef struct UhsSetupPacket UhsSetupPacket;
/* USB device descriptor */
struct WUT_PACKED UhsDeviceDescriptor
{
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t bcdUsb;
uint8_t bDeviceClass;
uint8_t bDeviceSubclass;
uint8_t bDeviceProtocol;
uint8_t bMaxPacketSize;
uint16_t idVendor;
uint16_t idProduct;
uint16_t bcdDevice;
uint8_t iManufacturer;
uint8_t iProduct;
uint8_t iSerialNumber;
uint8_t bNumConfigurations;
};
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x00, bLength);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x01, bDescriptorType);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x02, bcdUsb);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x04, bDeviceClass);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x05, bDeviceSubclass);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x06, bDeviceProtocol);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x07, bMaxPacketSize);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x08, idVendor);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x0A, idProduct);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x0C, bcdDevice);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x0E, iManufacturer);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x0F, iProduct);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x10, iSerialNumber);
WUT_CHECK_OFFSET(UhsDeviceDescriptor, 0x11, bNumConfigurations);
WUT_CHECK_SIZE(UhsDeviceDescriptor, 0x12);
/* USB configuration descriptor */
struct WUT_PACKED UhsConfigDescriptor
{
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wTotalLength;
uint8_t bNumInterfaces;
uint8_t bConfigurationValue;
uint8_t iConfiguration;
uint8_t bmAttributes;
uint8_t bMaxPower;
};
WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x00, bLength);
WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x01, bDescriptorType);
WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x02, wTotalLength);
WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x04, bNumInterfaces);
WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x05, bConfigurationValue);
WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x06, iConfiguration);
WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x07, bmAttributes);
WUT_CHECK_OFFSET(UhsConfigDescriptor, 0x08, bMaxPower);
WUT_CHECK_SIZE(UhsConfigDescriptor, 0x09);
/* USB interface descriptor */
struct WUT_PACKED UhsInterfaceDescriptor
{
uint8_t bLength;
uint8_t bDescriptorType;
uint8_t bInterfaceNumber;
uint8_t bAlternateSetting;
uint8_t bNumEndpoints;
uint8_t bInterfaceClass;
uint8_t bInterfaceSubClass;
uint8_t bInterfaceProtocol;
uint8_t iInterface;
};
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x00, bLength);
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x01, bDescriptorType);
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x02, bInterfaceNumber);
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x03, bAlternateSetting);
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x04, bNumEndpoints);
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x05, bInterfaceClass);
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x06, bInterfaceSubClass);
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x07, bInterfaceProtocol);
WUT_CHECK_OFFSET(UhsInterfaceDescriptor, 0x08, iInterface);
WUT_CHECK_SIZE(UhsInterfaceDescriptor, 0x09);
/* USB setup packet */
struct WUT_PACKED UhsSetupPacket
{
uint8_t bmRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
};
WUT_CHECK_OFFSET(UhsSetupPacket, 0x00, bmRequestType);
WUT_CHECK_OFFSET(UhsSetupPacket, 0x01, bRequest);
WUT_CHECK_OFFSET(UhsSetupPacket, 0x02, wValue);
WUT_CHECK_OFFSET(UhsSetupPacket, 0x04, wIndex);
WUT_CHECK_OFFSET(UhsSetupPacket, 0x06, wLength);
WUT_CHECK_SIZE(UhsSetupPacket, 0x08);
#ifdef __cplusplus
}
#endif

View File

@ -5,160 +5,95 @@
/**
* \defgroup padscore_kpad KPAD
* \ingroup padscore
*
* KPAD is a high-level library over WPAD.
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
//! Wii Remote channel.
typedef enum WPADChan KPADChan;
//! Data format.
typedef enum WPADDataFormat KPADDataFormat;
//! Extension type.
typedef enum WPADExtensionType KPADExtensionType;
typedef struct KPADStatus KPADStatus;
typedef struct KPADVec2D KPADVec2D;
typedef struct KPADVec3D KPADVec3D;
//! Error.
typedef enum KPADError
{
//! No errors.
KPAD_ERROR_OK = 0,
} KPADError;
//! 2D vector.
struct KPADVec2D
{
//! x.
float x;
//! y.
float y;
};
WUT_CHECK_OFFSET(KPADVec2D, 0x00, x);
WUT_CHECK_OFFSET(KPADVec2D, 0x04, y);
WUT_CHECK_SIZE(KPADVec2D, 0x08);
//! 3D vector.
struct KPADVec3D
{
//! x.
float x;
//! y.
float y;
//! z.
float z;
};
WUT_CHECK_OFFSET(KPADVec3D, 0x00, x);
WUT_CHECK_OFFSET(KPADVec3D, 0x04, y);
WUT_CHECK_OFFSET(KPADVec3D, 0x08, z);
WUT_CHECK_SIZE(KPADVec3D, 0x0C);
//! A structure conataining the Wii Remote data.
struct KPADStatus
{
//! Indicates what KPADButtons are held down.
//! Indicates what KPADButtons are held down
uint32_t hold;
//! Indicates what KPADButtons have been pressed since last sample.
//! Indicates what KPADButtons have been pressed since last sample
uint32_t trigger;
//! Indicates what KPADButtons have been released since last sample.
//! Indicates what KPADButtons have been released since last sample
uint32_t release;
//! Indicates the value of the acceleration sensor.
KPADVec3D acc;
WUT_UNKNOWN_BYTES(5 * 4);
//! Indicates the magnitude of acceleration.
float accMagnitude;
//! Indicates the variation in acceleration.
float accVariation;
//! Indicates the position where the Wii Remote is pointing.
KPADVec2D pos;
WUT_UNKNOWN_BYTES(3 * 4);
//! Angle.
KPADVec2D angle;
WUT_UNKNOWN_BYTES(8 * 4);
//! Value from KPADExtensionType.
//! Value from KPADExtensionType
uint8_t extensionType;
//! Value from KPADError.
//! Value from KPADError
int8_t error;
//! Validity of the result.
int8_t posValid;
uint8_t posValid;
//! Value from KPADDataFormat.
//! Value from KPADDataFormat
uint8_t format;
//! Extension data, check with extensionType to see what is valid to read.
// Extension data, check with extensionType to see what is valid to read
union
{
//! Structure to use when extension type is set to \link WPAD_EXT_NUNCHUK \endlink.
// For WPAD_EXT_NUNCHUK
struct
{
//! Position of the analog stick.
KPADVec2D stick;
//! Indicates the value of the acceleration sensor.
KPADVec3D acc;
//! Indicates the magnitude of acceleration.
float accMagnitude;
//! Indicates the variation in acceleration.
float accVariation;
//! Indicates what buttons are held down.
uint32_t hold;
//! Indicates what buttons have been pressed since last sample.
uint32_t trigger;
//! Indicates what buttons have been released since last sample.
uint32_t release;
} nunchuck;
//! Structure to use when extension type is set to \link WPAD_EXT_CLASSIC \endlink.
// For WPAD_EXT_CLASSIC
struct
{
//! Indicates what buttons are held down.
uint32_t hold;
//! Indicates what buttons have been pressed since last sample.
uint32_t trigger;
//! Indicates what buttons have been released since last sample.
uint32_t release;
//! Position of left analog stick.
KPADVec2D leftStick;
//! Position of right analog stick.
KPADVec2D rightStick;
//! Left trigger.
float leftTrigger;
//! Right trigger.
float rightTrigger;
} classic;
//! Structure to use when extension type is set to \link WPAD_EXT_PRO_CONTROLLER \endlink.
// For WPAD_EXT_PRO_CONTROLLER
struct
{
//! Indicates what buttons are held down.
uint32_t hold;
//! Indicates what buttons have been pressed since last sample.
uint32_t trigger;
//! Indicates what buttons have been released since last sample.
uint32_t release;
//! Position of left analog stick.
KPADVec2D leftStick;
//! Position of right analog stick.
KPADVec2D rightStick;
//! Is charging flag.
int32_t charging;
//! Is wired flag.
int32_t wired;
} pro;
@ -170,9 +105,6 @@ struct KPADStatus
WUT_CHECK_OFFSET(KPADStatus, 0x00, hold);
WUT_CHECK_OFFSET(KPADStatus, 0x04, trigger);
WUT_CHECK_OFFSET(KPADStatus, 0x08, release);
WUT_CHECK_OFFSET(KPADStatus, 0x0C, acc);
WUT_CHECK_OFFSET(KPADStatus, 0x18, accMagnitude);
WUT_CHECK_OFFSET(KPADStatus, 0x1C, accVariation);
WUT_CHECK_OFFSET(KPADStatus, 0x20, pos);
WUT_CHECK_OFFSET(KPADStatus, 0x34, angle);
WUT_CHECK_OFFSET(KPADStatus, 0x5C, extensionType);
@ -181,12 +113,6 @@ WUT_CHECK_OFFSET(KPADStatus, 0x5E, posValid);
WUT_CHECK_OFFSET(KPADStatus, 0x5F, format);
// For WPAD_EXT_NUNCHUK
WUT_CHECK_OFFSET(KPADStatus, 0x60, nunchuck.stick);
WUT_CHECK_OFFSET(KPADStatus, 0x68, nunchuck.acc);
WUT_CHECK_OFFSET(KPADStatus, 0x74, nunchuck.accMagnitude);
WUT_CHECK_OFFSET(KPADStatus, 0x78, nunchuck.accVariation);
WUT_CHECK_OFFSET(KPADStatus, 0x7C, nunchuck.hold);
WUT_CHECK_OFFSET(KPADStatus, 0x80, nunchuck.trigger);
WUT_CHECK_OFFSET(KPADStatus, 0x84, nunchuck.release);
// For WPAD_EXT_CLASSIC
WUT_CHECK_OFFSET(KPADStatus, 0x60, classic.hold);
WUT_CHECK_OFFSET(KPADStatus, 0x64, classic.trigger);
@ -205,50 +131,14 @@ WUT_CHECK_OFFSET(KPADStatus, 0x7C, pro.charging);
WUT_CHECK_OFFSET(KPADStatus, 0x80, pro.wired);
WUT_CHECK_SIZE(KPADStatus, 0xF0);
/**
* Initialises the KPAD library for use.
*/
void
KPADInit();
/**
* Read data from the desired Wii Remote.
*
* \param chan
* The channel of the controller to read from.
*
* \param data
* The KPADStatus to fill.
*
* \param size
* The maximum number of data to read.
*
* \return
* The number of data read.
*/
int32_t
KPADRead(KPADChan chan,
KPADStatus *data,
uint32_t size);
/**
* Read data from the desired Wii Remote.
*
* \param chan
* The channel of the controller to read from.
*
* \param data
* The KPADStatus to fill.
*
* \param size
* The maximum number of data to read.
*
* \param error
* A pointer to an error code.
*
* \return
* The number of data read.
*/
int32_t
KPADReadEx(KPADChan chan,
KPADStatus *data,

View File

@ -4,9 +4,6 @@
/**
* \defgroup padscore_wpad WPAD
* \ingroup padscore
*
* WPAD is a low-level library under KPAD.
*
* @{
*/
#ifdef __cplusplus
@ -16,206 +13,99 @@ extern "C" {
typedef struct WPADStatusProController WPADStatusProController;
typedef struct WPADVec2D WPADVec2D;
//! Wii Remote channel.
typedef enum WPADChan
{
//! Channel 0.
WPAD_CHAN_0 = 0,
//! Channel 1.
WPAD_CHAN_1 = 1,
//! Channel 2.
WPAD_CHAN_2 = 2,
//! Channel 3.
WPAD_CHAN_3 = 3,
} WPADChan;
//! Data format.
typedef enum WPADDataFormat
{
WPAD_FMT_PRO_CONTROLLER = 22,
} WPADDataFormat;
//! Extension type.
typedef enum WPADExtensionType
{
//! Wii Remote with no extension.
WPAD_EXT_CORE = 0,
//! Nunchuk.
WPAD_EXT_NUNCHUK = 1,
//! Classic Controller.
WPAD_EXT_CLASSIC = 2,
//! Motion Plus.
WPAD_EXT_MPLUS = 5,
//! Motion Plus with Nunchuk.
WPAD_EXT_MPLUS_NUNCHUK = 6,
//! Motion Plus with Classic Controller.
WPAD_EXT_MPLUS_CLASSIC = 7,
//! Pro Controller.
WPAD_EXT_PRO_CONTROLLER = 31,
} WPADExtensionType;
//! Wii Remote buttons.
typedef enum WPADButton
{
//! The left button of the D-pad.
WPAD_BUTTON_LEFT = 0x0001,
//! The right button of the D-pad.
WPAD_BUTTON_RIGHT = 0x0002,
//! The down button of the D-pad.
WPAD_BUTTON_DOWN = 0x0004,
//! The up button of the D-pad.
WPAD_BUTTON_UP = 0x0008,
//! The + button.
WPAD_BUTTON_PLUS = 0x0010,
//! The 2 button.
WPAD_BUTTON_2 = 0x0100,
//! The 1 button.
WPAD_BUTTON_1 = 0x0200,
//! The B button.
WPAD_BUTTON_B = 0x0400,
//! The A button.
WPAD_BUTTON_A = 0x0800,
//! The - button.
WPAD_BUTTON_MINUS = 0x1000,
//! The Z button on the Nunchuk extension.
WPAD_BUTTON_Z = 0x2000,
//! The C button on the Nunchuk extension.
WPAD_BUTTON_C = 0x4000,
//! The HOME button.
WPAD_BUTTON_HOME = 0x8000,
} WPADButton;
//! Nunchuk buttons.
typedef enum WPADNunchukButton
{
//! The emulated left button on the Nunchuk stick or the left button of the D-pad on the Wii Remote.
WPAD_NUNCHUK_STICK_EMULATION_LEFT = 0x0001,
//! The emulated right button on the Nunchuk stick or the right button of the D-pad on the Wii Remote.
WPAD_NUNCHUK_STICK_EMULATION_RIGHT = 0x0002,
//! The emulated down button on the Nunchuk stick or the down button of the D-pad on the Wii Remote.
WPAD_NUNCHUK_STICK_EMULATION_DOWN = 0x0004,
//! The emulated up button on the Nunchuk stick or the up button of the D-pad on the Wii Remote.
WPAD_NUNCHUK_STICK_EMULATION_UP = 0x0008,
//! The Z button.
WPAD_NUNCHUK_BUTTON_Z = 0x2000,
//! The C button.
WPAD_NUNCHUK_BUTTON_C = 0x4000,
} WPADNunchukButton;
//! Classic Controller buttons.
typedef enum WPADClassicButton
{
//! The up button of the D-pad.
WPAD_CLASSIC_BUTTON_UP = 0x00000001,
//! The left button of the D-pad.
WPAD_CLASSIC_BUTTON_LEFT = 0x00000002,
//! The ZR button.
WPAD_CLASSIC_BUTTON_ZR = 0x00000004,
//! The X button.
WPAD_CLASSIC_BUTTON_X = 0x00000008,
//! The A button.
WPAD_CLASSIC_BUTTON_A = 0x00000010,
//! The Y button.
WPAD_CLASSIC_BUTTON_Y = 0x00000020,
//! The B button.
WPAD_CLASSIC_BUTTON_B = 0x00000040,
//! The ZL button.
WPAD_CLASSIC_BUTTON_ZL = 0x00000080,
//! The R button.
WPAD_CLASSIC_BUTTON_R = 0x00000200,
//! The + button.
WPAD_CLASSIC_BUTTON_PLUS = 0x00000400,
//! The HOME button.
WPAD_CLASSIC_BUTTON_HOME = 0x00000800,
//! The - button.
WPAD_CLASSIC_BUTTON_MINUS = 0x00001000,
//! The L button.
WPAD_CLASSIC_BUTTON_L = 0x00002000,
//! The down button of the D-pad.
WPAD_CLASSIC_BUTTON_DOWN = 0x00004000,
//! The right button of the D-pad.
WPAD_CLASSIC_BUTTON_RIGHT = 0x00008000,
//! The emulated left button on the left stick.
WPAD_CLASSIC_STICK_L_EMULATION_LEFT = 0x00010000,
//! The emulated right button on the left stick.
WPAD_CLASSIC_STICK_L_EMULATION_RIGHT = 0x00020000,
//! The emulated down button on the left stick.
WPAD_CLASSIC_STICK_L_EMULATION_DOWN = 0x00040000,
//! The emulated up button on the left stick.
WPAD_CLASSIC_STICK_L_EMULATION_UP = 0x00080000,
//! The emulated left button on the right stick.
WPAD_CLASSIC_STICK_R_EMULATION_LEFT = 0x00100000,
//! The emulated right button on the right stick.
WPAD_CLASSIC_STICK_R_EMULATION_RIGHT = 0x00200000,
//! The emulated down button on the right stick.
WPAD_CLASSIC_STICK_R_EMULATION_DOWN = 0x00400000,
//! The emulated up button on the right stick.
WPAD_CLASSIC_STICK_R_EMULATION_UP = 0x00800000,
WPAD_CLASSIC_BUTTON_UP = 0x0001,
WPAD_CLASSIC_BUTTON_LEFT = 0x0002,
WPAD_CLASSIC_BUTTON_ZR = 0x0004,
WPAD_CLASSIC_BUTTON_X = 0x0008,
WPAD_CLASSIC_BUTTON_A = 0x0010,
WPAD_CLASSIC_BUTTON_Y = 0x0020,
WPAD_CLASSIC_BUTTON_B = 0x0040,
WPAD_CLASSIC_BUTTON_ZL = 0x0080,
WPAD_CLASSIC_BUTTON_R = 0x0200,
WPAD_CLASSIC_BUTTON_PLUS = 0x0400,
WPAD_CLASSIC_BUTTON_HOME = 0x0800,
WPAD_CLASSIC_BUTTON_MINUS = 0x1000,
WPAD_CLASSIC_BUTTON_L = 0x2000,
WPAD_CLASSIC_BUTTON_DOWN = 0x4000,
WPAD_CLASSIC_BUTTON_RIGHT = 0x8000,
} WPADClassicButton;
//! Pro Controller buttons.
typedef enum WPADProButton
{
//! The up button of the D-pad.
WPAD_PRO_BUTTON_UP = 0x00000001,
//! The left button of the D-pad.
WPAD_PRO_BUTTON_LEFT = 0x00000002,
//! The ZR button.
WPAD_PRO_TRIGGER_ZR = 0x00000004,
//! The X button.
WPAD_PRO_BUTTON_X = 0x00000008,
//! The A button.
WPAD_PRO_BUTTON_A = 0x00000010,
//! The Y button.
WPAD_PRO_BUTTON_Y = 0x00000020,
//! The B button.
WPAD_PRO_BUTTON_B = 0x00000040,
//! The ZL button.
WPAD_PRO_TRIGGER_ZL = 0x00000080,
//! Reserved.
WPAD_PRO_RESERVED = 0x00000100,
//! The right trigger button.
WPAD_PRO_TRIGGER_R = 0x00000200,
//! The + button.
WPAD_PRO_BUTTON_PLUS = 0x00000400,
//! The HOME button.
WPAD_PRO_BUTTON_HOME = 0x00000800,
//! The - button.
WPAD_PRO_BUTTON_MINUS = 0x00001000,
//! The left trigger button.
WPAD_PRO_TRIGGER_L = 0x00002000,
//! The down button of the D-pad.
WPAD_PRO_BUTTON_DOWN = 0x00004000,
//! The right button of the D-pad.
WPAD_PRO_BUTTON_RIGHT = 0x00008000,
//! The right stick button.
WPAD_PRO_BUTTON_STICK_R = 0x00010000,
//! The left stick button.
WPAD_PRO_BUTTON_STICK_L = 0x00020000,
//! The emulated up button on the left stick.
WPAD_PRO_STICK_L_EMULATION_UP = 0x00200000,
//! The emulated down button on the left stick.
WPAD_PRO_STICK_L_EMULATION_DOWN = 0x00100000,
//! The emulated left button on the left stick.
WPAD_PRO_STICK_L_EMULATION_LEFT = 0x00040000,
//! The emulated right button on the left stick.
WPAD_PRO_STICK_L_EMULATION_RIGHT = 0x00080000,
//! The emulated up button on the right stick.
WPAD_PRO_STICK_R_EMULATION_UP = 0x02000000,
//! The emulated down button on the right stick.
WPAD_PRO_STICK_R_EMULATION_DOWN = 0x01000000,
//! The emulated left button on the right stick.
WPAD_PRO_STICK_R_EMULATION_LEFT = 0x00400000,
//! The emulated right button on the right stick.
WPAD_PRO_STICK_R_EMULATION_RIGHT = 0x00800000,
} WPADProButton;
//! 2D vector.
struct WPADVec2D
{
//! x.
int16_t x;
//! y.
int16_t y;
};
WUT_CHECK_OFFSET(WPADVec2D, 0x00, x);
@ -226,7 +116,7 @@ struct WPADStatusProController
{
WUT_UNKNOWN_BYTES(0x28);
//! A value from WPADExtensionType.
//! A value from WPADExtensionType
uint8_t extensionType;
uint8_t err;
@ -249,15 +139,9 @@ typedef void (*WPADSamplingCallback)(WPADChan chan);
typedef void (*WPADExtensionCallback)(WPADChan chan, int32_t status);
typedef void (*WPADConnectCallback)(WPADChan chan, int32_t status);
/**
* Initialises the WPAD library for use.
*/
void
WPADInit();
/**
* Cleans up and frees the WPAD library.
*/
void
WPADShutdown();

View File

@ -1,31 +0,0 @@
#pragma once
#define POLLIN 0x01
#define POLLPRI 0x02
#define POLLOUT 0x04
#define POLLERR 0x08
#define POLLHUP 0x10
#define POLLNVAL 0x20
typedef unsigned long nfds_t;
struct pollfd
{
int fd;
int events;
int revents;
};
#ifdef __cplusplus
extern "C" {
#endif
int
poll(struct pollfd *fds,
nfds_t nfds,
int timeout);
#ifdef __cplusplus
}
#endif

View File

@ -77,9 +77,6 @@ AXSetDefaultMixerSelect(uint32_t unk0);
AXResult
AXRegisterAppFrameCallback(AXFrameCallback callback);
AXResult
AXDeregisterAppFrameCallback(AXFrameCallback callback);
AXFrameCallback
AXRegisterFrameCallback(AXFrameCallback callback);

View File

@ -1,21 +0,0 @@
#pragma once
#include <sys/ioccom.h>
/* Generic file-descriptor ioctl's. */
#define FIOCLEX _IO('f', 1) /* set close on exec on fd */
#define FIONCLEX _IO('f', 2) /* remove close on exec */
#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */
#define FIONWRITE _IOR('f', 119, int) /* get # bytes (yet) to write */
#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */
#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */
#define FIOSETOWN _IOW('f', 124, int) /* set owner */
#define FIOGETOWN _IOR('f', 123, int) /* get owner */
#define FIODTYPE _IOR('f', 122, int) /* get d_flags type part */
#define FIOGETLBA _IOR('f', 121, int) /* get start blk # */
struct fiodgname_arg {
int len;
void *buf;
};
#define FIODGNAME _IOW('f', 120, struct fiodgname_arg) /* get dev. name */
#define FIONSPACE _IOR('f', 118, int) /* get space in send queue */

View File

@ -1,40 +0,0 @@
#pragma once
/*
* Ioctl's have the command encoded in the lower word, and the size of
* any in or out parameters in the upper word. The high 3 bits of the
* upper word are used to encode the in/out status of the parameter.
*/
#define IOCPARM_SHIFT 13 /* number of bits for ioctl size */
#define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */
#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))
#define IOCGROUP(x) (((x) >> 8) & 0xff)
#define IOCPARM_MAX (1 << IOCPARM_SHIFT) /* max size of ioctl */
#define IOC_VOID 0x20000000 /* no parameters */
#define IOC_OUT 0x40000000 /* copy out parameters */
#define IOC_IN 0x80000000 /* copy in parameters */
#define IOC_INOUT (IOC_IN|IOC_OUT)
#define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN)
#define _IOC(inout,group,num,len) ((int) \
((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
#define _IOWINT(g,n) _IOC(IOC_VOID, (g), (n), sizeof(int))
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
/* this should be _IORW, but stdio got there first */
#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
#ifdef __cplusplus
extern "C" {
#endif
int ioctl(int fd,
int request,
...);
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +0,0 @@
#pragma once
#include <sys/ioccom.h>
#include <sys/filio.h>

View File

@ -1,5 +0,0 @@
#pragma once
#define FD_SETSIZE 32
#include_next <sys/select.h>

View File

@ -1,166 +0,0 @@
#pragma once
#include <stdint.h>
#include <sys/time.h>
#define SOL_SOCKET -1
#define PF_UNSPEC 0
#define PF_INET 2
#define AF_UNSPEC PF_UNSPEC
#define AF_INET PF_INET
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define MSG_OOB 0x0001
#define MSG_PEEK 0x0002
#define MSG_DONTROUTE 0x0004
#define MSG_DONTWAIT 0x0020
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
/*
* SOL_SOCKET options
*/
#define SO_REUSEADDR 0x0004 // reuse address
#define SO_KEEPALIVE 0x0008 // keep connections alive
#define SO_BROADCAST 0x0020 // broadcast
#define SO_LINGER 0x0080 // linger (no effect?)
#define SO_OOBINLINE 0x0100 // out-of-band data inline (no effect?)
#define SO_TCPSACK 0x0200 // set tcp selective acknowledgment
#define SO_WINSCALE 0x0400 // set tcp window scaling
#define SO_SNDBUF 0x1001 // send buffer size
#define SO_RCVBUF 0x1002 // receive buffer size
#define SO_SNDLOWAT 0x1003 // send low-water mark (no effect?)
#define SO_RCVLOWAT 0x1004 // receive low-water mark
#define SO_TYPE 0x1008 // get socket type
#define SO_ERROR 0x1009 // get socket error
#define SO_RXDATA 0x1011 // get count of bytes in sb_rcv
#define SO_TXDATA 0x1012 // get count of bytes in sb_snd
#define SO_NBIO 0x1014 // set socket to NON-blocking mode
#define SO_BIO 0x1015 // set socket to blocking mode
#define SO_NONBLOCK 0x1016 // set/get blocking mode via optval param
typedef uint32_t socklen_t;
typedef uint16_t sa_family_t;
struct sockaddr
{
sa_family_t sa_family;
char sa_data[];
};
struct sockaddr_storage
{
sa_family_t ss_family;
char ss_padding[14];
};
struct linger
{
int l_onoff;
int l_linger;
};
#ifdef __cplusplus
extern "C" {
#endif
// Wii U "extension"
void
socket_lib_init();
// Wii U "extension"
void
socket_lib_finish();
int
accept(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
bind(int sockfd,
const struct sockaddr *addr,
socklen_t addrlen);
int
connect(int sockfd,
const struct sockaddr *addr,
socklen_t addrlen);
int
getpeername(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
getsockname(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
int
getsockopt(int sockfd,
int level,
int optname,
void *optval,
socklen_t *optlen);
int
listen(int sockfd,
int backlog);
ssize_t
recv(int sockfd,
void *buf,
size_t len,
int flags);
ssize_t
recvfrom(int sockfd,
void *buf,
size_t len,
int flags,
struct sockaddr *src_addr,
socklen_t *addrlen);
ssize_t
send(int sockfd,
const void *buf,
size_t len,
int flags);
ssize_t
sendto(int sockfd,
const void *buf,
size_t len,
int flags,
const struct sockaddr *dest_addr,
socklen_t addrlen);
int
setsockopt(int sockfd,
int level,
int optname,
const void *optval,
socklen_t optlen);
int
shutdown(int sockfd,
int how);
int
socket(int domain,
int type,
int protocol);
int
sockatmark(int sockfd);
#ifdef __cplusplus
}
#endif

View File

@ -1,6 +1,5 @@
#pragma once
#include <wut.h>
#include <coreinit/mcp.h>
/**
* \defgroup sysapp_title SYSAPP Title
@ -15,26 +14,6 @@
extern "C" {
#endif
typedef enum SYSTEM_APP_ID
{
SYSTEM_APP_ID_HOME_MENU = 0,
SYSTEM_APP_ID_SYSTEM_SETTINGS = 1,
SYSTEM_APP_ID_PARENTAL_CONTROLS = 2,
SYSTEM_APP_ID_USER_SETTINGS = 3,
SYSTEM_APP_ID_MII_MAKER = 4,
SYSTEM_APP_ID_ACCOUNT_SETTINGS = 5,
SYSTEM_APP_ID_DAILY_LOG = 6,
SYSTEM_APP_ID_NOTIFICATIONS = 7,
SYSTEM_APP_ID_HEALTH_AND_SAFETY = 8,
SYSTEM_APP_ID_ELECTRONIC_MANUAL = 9,
SYSTEM_APP_ID_WIIU_CHAT = 10,
SYSTEM_APP_ID_SOFTWARE_DATA_TRANSFER = 11,
} SYSTEM_APP_ID;
// for compatibility
WUT_DEPRECATED("This enum name is misleading and incorrect. Please use SYSTEM_APP_ID_HOME_MENU")
static const SYSTEM_APP_ID SYSTEM_APP_ID_UPDATER = SYSTEM_APP_ID_HOME_MENU;
/**
* Check if a given title exists and is installed on the system.
*
@ -77,46 +56,6 @@ SYSGetPFIDFromTitleID(uint64_t TitleId);
int32_t
SYSGetUPIDFromTitleID(uint64_t TitleId);
/**
* Gets the PFID/UPID of the calling (current) application.
*
* \note
* This function is identical to \link SYSGetCallerPFID \endlink.
*/
int32_t
SYSGetCallerUPID();
/**
* Gets the PFID/UPID of the calling (current) application.
*
* \note
* This function is identical to \link SYSGetCallerUPID \endlink.
*/
int32_t
SYSGetCallerPFID();
/**
* Gets the title id for a given SYSTEM_APP_ID.
*
*/
uint64_t
_SYSGetSystemApplicationTitleId(SYSTEM_APP_ID id);
/**
* Gets the title id for a given SYSTEM_APP_ID in the given region.
*
*/
uint64_t
_SYSGetSystemApplicationTitleIdByProdArea(SYSTEM_APP_ID id,
MCPRegion prod_area);
/**
* Gets the title id of the calling (current) application.
*
*/
uint64_t
SYSGetCallerTitleId();
#ifdef __cplusplus
}
#endif

View File

@ -15,105 +15,61 @@ typedef struct VPADAccStatus VPADAccStatus;
typedef struct VPADDirection VPADDirection;
typedef struct VPADGyroStatus VPADGyroStatus;
typedef struct VPADStatus VPADStatus;
typedef struct VPADTouchCalibrationParam VPADTouchCalibrationParam;
typedef struct VPADTouchData VPADTouchData;
typedef struct VPADVec2D VPADVec2D;
typedef struct VPADVec3D VPADVec3D;
//! Wii U GamePad buttons.
typedef enum VPADButtons
{
//! The A button.
VPAD_BUTTON_A = 0x8000,
//! The B button.
VPAD_BUTTON_B = 0x4000,
//! The X button.
VPAD_BUTTON_X = 0x2000,
//! The Y button.
VPAD_BUTTON_Y = 0x1000,
//! The left button of the D-pad.
VPAD_BUTTON_LEFT = 0x0800,
//! The right button of the D-pad.
VPAD_BUTTON_RIGHT = 0x0400,
//! The up button of the D-pad.
VPAD_BUTTON_UP = 0x0200,
//! The down button of the D-pad.
VPAD_BUTTON_DOWN = 0x0100,
//! The ZL button.
VPAD_BUTTON_ZL = 0x0080,
//! The ZR button.
VPAD_BUTTON_ZR = 0x0040,
//! The L button.
VPAD_BUTTON_L = 0x0020,
//! The R button.
VPAD_BUTTON_R = 0x0010,
//! The + button.
VPAD_BUTTON_PLUS = 0x0008,
//! The - button.
VPAD_BUTTON_MINUS = 0x0004,
//! The HOME button.
VPAD_BUTTON_HOME = 0x0002,
//! The SYNC button.
VPAD_BUTTON_SYNC = 0x0001,
//! The right stick button.
VPAD_BUTTON_STICK_R = 0x00020000,
//! The left stick button.
VPAD_BUTTON_STICK_L = 0x00040000,
//! The TV button.
VPAD_BUTTON_TV = 0x00010000,
//! The emulated left button on the right stick.
VPAD_STICK_R_EMULATION_LEFT = 0x04000000,
//! The emulated right button on the right stick.
VPAD_STICK_R_EMULATION_RIGHT = 0x02000000,
//! The emulated up button on the right stick.
VPAD_STICK_R_EMULATION_UP = 0x01000000,
//! The emulated down button on the right stick.
VPAD_STICK_R_EMULATION_DOWN = 0x00800000,
//! The emulated left button on the left stick.
VPAD_STICK_L_EMULATION_LEFT = 0x40000000,
//! The emulated right button on the left stick.
VPAD_STICK_L_EMULATION_RIGHT = 0x20000000,
//! The emulated up button on the left stick.
VPAD_STICK_L_EMULATION_UP = 0x10000000,
//! The emulated down button on the left stick.
VPAD_STICK_L_EMULATION_DOWN = 0x08000000,
} VPADButtons;
//! Wii U GamePad channel.
typedef enum VPADChan
{
//! Channel 0.
VPAD_CHAN_0 = 0,
} VPADChan;
//! Touch pad validity.
typedef enum VPADTouchPadValidity
{
//! Both X and Y touchpad positions are accurate.
//! Both X and Y touchpad positions are accurate
VPAD_VALID = 0x0,
//! X position is inaccurate.
//! X position is inaccurate
VPAD_INVALID_X = 0x1,
//! Y position is inaccurate.
//! Y position is inaccurate
VPAD_INVALID_Y = 0x2,
} VPADTouchPadValidity;
//! Touch pad resolution.
typedef enum VPADTouchPadResolution
{
//! 1920 x 1080 resolution.
VPAD_TP_1920X1080 = 0,
//! 1280 x 720 resolution.
VPAD_TP_1280X720 = 1,
//! 854 x 480 resolution.
VPAD_TP_854X480 = 2,
} VPADTouchPadResolution;
//! Read error.
typedef enum VPADReadError
{
//! No error occurred, and data was written to the buffers.
//! No error occured, and data was written to the buffers.
VPAD_READ_SUCCESS = 0,
//! There was no sample new data available to write.
VPAD_READ_NO_SAMPLES = -1,
@ -121,7 +77,6 @@ typedef enum VPADReadError
VPAD_READ_INVALID_CONTROLLER = -2,
} VPADReadError;
//! LCD mode.
typedef enum VPADLcdMode
{
//! Display is in standby and will turn back on if any buttons are pressed.
@ -132,35 +87,19 @@ typedef enum VPADLcdMode
VPAD_LCD_ON = 0xFF,
} VPADLcdMode;
//! Gyro zero drift mode.
typedef enum VPADGyroZeroDriftMode
{
VPAD_GYRO_ZERODRIFT_LOOSE = 0,
VPAD_GYRO_ZERODRIFT_STANDARD,
VPAD_GYRO_ZERODRIFT_TIGHT,
VPAD_GYRO_ZERODRIFT_NONE
} VPADGyroZeroDriftMode;
//! 2D vector.
struct VPADVec2D
{
//! x.
float x;
//! y.
float y;
};
WUT_CHECK_OFFSET(VPADVec2D, 0x00, x);
WUT_CHECK_OFFSET(VPADVec2D, 0x04, y);
WUT_CHECK_SIZE(VPADVec2D, 0x08);
//! 3D vector.
struct VPADVec3D
{
//! x.
float x;
//! y.
float y;
//! z.
float z;
};
WUT_CHECK_OFFSET(VPADVec3D, 0x00, x);
@ -168,14 +107,10 @@ WUT_CHECK_OFFSET(VPADVec3D, 0x04, y);
WUT_CHECK_OFFSET(VPADVec3D, 0x08, z);
WUT_CHECK_SIZE(VPADVec3D, 0x0C);
//! Direction.
struct VPADDirection
{
//! x.
VPADVec3D x;
//! y.
VPADVec3D y;
//! z.
VPADVec3D z;
};
WUT_CHECK_OFFSET(VPADDirection, 0x00, x);
@ -183,25 +118,6 @@ WUT_CHECK_OFFSET(VPADDirection, 0x0C, y);
WUT_CHECK_OFFSET(VPADDirection, 0x18, z);
WUT_CHECK_SIZE(VPADDirection, 0x24);
//! Touch calibration parameter.
struct VPADTouchCalibrationParam
{
//! X offset.
uint16_t adjustX;
//! Y offset.
uint16_t adjustY;
//! X scale.
float scaleX;
//! Y scale.
float scaleY;
};
WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x00, adjustX);
WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x02, adjustY);
WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x04, scaleX);
WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x08, scaleY);
WUT_CHECK_SIZE(VPADTouchCalibrationParam, 0x0C);
//! Touch data.
struct VPADTouchData
{
//! The x-coordinate of a touched point.
@ -209,10 +125,10 @@ struct VPADTouchData
//! The y-coordinate of a touched point.
uint16_t y;
//! 0 if screen is not currently being touched.
//! 0 if screen is not currently being touched
uint16_t touched;
//! Bitfield of #VPADTouchPadValidity to indicate how touch sample accuracy.
//! Bitfield of #VPADTouchPadValidity to indicate how touch sample accuracy
uint16_t validity;
};
WUT_CHECK_OFFSET(VPADTouchData, 0x00, x);
@ -234,65 +150,65 @@ WUT_CHECK_OFFSET(VPADAccStatus, 0x10, variation);
WUT_CHECK_OFFSET(VPADAccStatus, 0x14, vertical);
WUT_CHECK_SIZE(VPADAccStatus, 0x1c);
struct VPADStatus
struct WUT_PACKED VPADStatus
{
//! Indicates what VPADButtons are held down.
//! Indicates what VPADButtons are held down
uint32_t hold;
//! Indicates what VPADButtons have been pressed since last sample.
//! Indicates what VPADButtons have been pressed since last sample
uint32_t trigger;
//! Indicates what VPADButtons have been released since last sample.
//! Indicates what VPADButtons have been released since last sample
uint32_t release;
//! Position of left analog stick.
//! Position of left analog stick
VPADVec2D leftStick;
//! Position of right analog stick.
//! Position of right analog stick
VPADVec2D rightStick;
//! Status of DRC accelorometer.
//! Status of DRC accelorometer
VPADAccStatus accelorometer;
//! Status of DRC gyro.
//! Status of DRC gyro
VPADVec3D gyro;
//! Status of DRC angle.
//! Status of DRC angle
VPADVec3D angle;
uint8_t error;
WUT_UNKNOWN_BYTES(0x01);
//! Current touch position on DRC.
//! Current touch position on DRC
VPADTouchData tpNormal;
//! Filtered touch position, first level of smoothing.
//! Filtered touch position, first level of smoothing
VPADTouchData tpFiltered1;
//! Filtered touch position, second level of smoothing.
//! Filtered touch position, second level of smoothing
VPADTouchData tpFiltered2;
WUT_UNKNOWN_BYTES(0x02);
VPADDirection direction;
//! Set to 1 if headphones are plugged in, 0 otherwise.
//! Set to 1 if headphones are plugged in, 0 otherwise
BOOL usingHeadphones;
//! Status of DRC magnetometer.
//! Status of DRC magnetometer
VPADVec3D mag;
//! Current volume set by the slide control.
//! Current volume set by the slide control
uint8_t slideVolume;
//! Battery level of controller.
//! Battery level of controller
uint8_t battery;
//! Status of DRC microphone.
//! Status of DRC microphone
uint8_t micStatus;
//! Unknown volume related value.
//! Unknown volume related value
uint8_t slideVolumeEx;
WUT_UNKNOWN_BYTES(0x8);
@ -317,7 +233,6 @@ WUT_CHECK_OFFSET(VPADStatus, 0xA2, micStatus);
WUT_CHECK_OFFSET(VPADStatus, 0xA3, slideVolumeEx);
WUT_CHECK_SIZE(VPADStatus, 0xAC);
/**
* Initialises the VPAD library for use.
*
@ -365,7 +280,7 @@ VPADShutdown();
*
* \warning
* You must check outError - the VPADStatus buffers may be filled with random
* or invalid data on error, not necessarily zeroes.
* or invalid data on error, not neccesarily zeroes.
*
* \return
* 0 on success or 1 on failure. Check outError for reason.
@ -379,40 +294,6 @@ VPADRead(VPADChan chan,
uint32_t count,
VPADReadError *outError);
/**
* Get touch pad calibration parameters.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* Denotes which channel to get the calibration parameter from.
*
* \param outParam
* Pointer to the calibration to get.
*/
void
VPADGetTPCalibrationParam(VPADChan chan,
VPADTouchCalibrationParam *outParam);
/**
* Set touch pad calibration parameters.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* Denotes which channel to set the calibration parameter to.
*
* \param param
* Pointer to the calibration to set.
*/
void
VPADSetTPCalibrationParam(VPADChan chan,
const VPADTouchCalibrationParam *param);
/**
* Transform touch data according to the current calibration data.
* The calibration used may either be the system default or set by the
@ -437,35 +318,7 @@ VPADSetTPCalibrationParam(VPADChan chan,
void
VPADGetTPCalibratedPoint(VPADChan chan,
VPADTouchData *calibratedData,
const VPADTouchData *uncalibratedData);
/**
* Transform touch data according to the current calibration data.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* Denotes which channel to get the calibration data from.
*
* \param tpResolution
* Touchpad resolution.
*
* \param calibratedData
* Pointer to write calibrated touch data to.
*
* \param uncalibratedData
* Pointer to the source data to apply the calibration to.
*
* \sa
* - VPADTouchData
*/
void
VPADGetTPCalibratedPointEx(VPADChan chan,
VPADTouchPadResolution tpResolution,
VPADTouchData *calibratedData,
const VPADTouchData *uncalibratedData);
VPADTouchData *uncalibratedData);
/**
* Return a count representing the amount of time left for the given Gamepad's
@ -552,14 +405,6 @@ VPADSetRStickClampThreshold(VPADChan chan,
int32_t max,
int32_t min);
void
VPADGetGyroDirReviseParam(VPADChan chan,
float *param);
void
VPADGetGyroZeroDriftMode(VPADChan chan,
VPADGyroZeroDriftMode *mode);
void
VPADGetLStickClampThreshold(VPADChan chan,
int32_t *max,
@ -615,14 +460,6 @@ VPADSetGyroAngle(VPADChan chan,
float ay,
float az);
void
VPADSetGyroDirReviseBase(VPADChan chan,
VPADDirection *base);
void
VPADSetGyroDirReviseParam(VPADChan chan,
float param);
void
VPADSetGyroDirection(VPADChan chan,
VPADDirection *dir);
@ -637,10 +474,6 @@ VPADSetGyroMagnification(VPADChan chan,
float yaw,
float roll);
void
VPADSetGyroZeroDriftMode(VPADChan chan,
VPADGyroZeroDriftMode mode);
void
VPADEnableGyroZeroPlay(VPADChan chan);
@ -685,84 +518,9 @@ VPADInitGyroDirReviseParam(VPADChan chan);
void
VPADInitGyroAccReviseParam(VPADChan chan);
void
VPADStartGyroMagRevise(VPADChan chan);
void
VPADStopGyroMagRevise(VPADChan chan);
/**
* Initializes the zero drift mode on the desired Gamepad.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to initialize.
*/
void
VPADInitGyroZeroDriftMode(VPADChan chan);
/**
* Get the TV menu status.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to get the TV status from.
*
* \returns
* TRUE if the TV menu is shown, FALSE otherwise.
*/
BOOL
VPADGetTVMenuStatus(VPADChan chan);
/**
* Enable or disable the TV menu.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to enable or disable the TV menu from.
*
* \param invalid
* Set to TRUE to disable the TV menu or FALSE to enable it.
*/
void
VPADSetTVMenuInvalid(VPADChan chan,
BOOL invalid);
/**
* Disable the power button.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to disable the power button from.
*/
void
VPADDisablePowerButton(VPADChan chan);
/**
* Enable the power button.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to enable the power button from.
*/
void
VPADEnablePowerButton(VPADChan chan);
/**
* Turns on the rumble motor on the desired Gamepad.
* A custom rumble pattern can be set by setting bytes in the input buffer.
@ -854,112 +612,6 @@ void
VPADBASEGetSensorBarSetting(VPADChan chan,
int8_t *outSetting);
/**
* Get the headphone status.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to get the headphone status from.
*
* \returns
* Returns 1 if headphones are connected, 0 otherwise.
*/
int32_t
VPADBASEGetHeadphoneStatus(VPADChan chan);
/**
* Get the controller mode.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to get the controller mode from.
*
* \param mode
* Pointer to write a value of the controller mode into.
*/
void
VPADBASEGetGameControllerMode(VPADChan chan,
int32_t* mode);
/**
* Set the controller mode.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to set the controller mode to.
*
* \param mode
* Any non-zero mode will turn off the display, like the "Display Off" button under Controller Settings.
* Inputs are not disabled.
*/
void
VPADBASESetGameControllerMode(VPADChan chan,
int32_t mode);
/**
* Get the POWER button press status.
*
* \note
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
* VPAD_CHAN_0. \endlink
*
* \param chan
* The channel of the Gamepad to get the POWER button press status from.
*
* \param tick
* The value given by \link OSGetTick \endlink when the button was pressed.
*
* \param status
* The status is set to 0 if the POWER button is not pressed.
*/
void
VPADBASEGetPowerButtonPressStatus(VPADChan chan,
uint32_t* tick,
uint32_t *status);
/**
* Set the POWER button press status.
*
* \param chan
* The channel of the Gamepad to set the POWER button press status to.
*
* \param tick
* The tick value to set.
*
* \param status
* The status to set.
*/
void
VPADBASESetPowerButtonPressStatus(VPADChan chan,
uint32_t tick,
uint32_t status);
/**
* Set the POWER button mode.
*
* \param chan
* The channel of the Gamepad to set the POWER button disable mode to.
*
* \param mode
* Set to 0 to enable and set to 1 to disable.
*
* \sa
* - \link VPADDisablePowerButton \endlink
* - \link VPADEnablePowerButton \endlink
*/
void
VPADBASESetPowerButtonDisableMode(VPADChan chan,
uint32_t mode);
/**
* Turn the given Gamepad's sensor bar on or off. Enabling the sensor bar allows
* any Wii Remote to position itself relative to the GamePad.

View File

@ -1,21 +1,10 @@
#pragma once
/*
* wut 1.0.0-beta
* wut 1.0.0-alpha
*
* https://github.com/devkitPro/wut
* https://github.com/decaf-emu/wut
*/
#include "wut_structsize.h"
#include "wut_types.h"
#include "wut_rplwrap.h"
#ifdef __GNUC__
#define WUT_DEPRECATED(reason) __attribute__((deprecated(reason)))
#else // not __GNUC__
#define WUT_DEPRECATED(reason)
#endif //__GNUC__

View File

@ -1,3 +0,0 @@
#pragma once
#define RPLWRAP(func) __rplwrap_##func

View File

@ -1,8 +1,5 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdalign.h>
typedef int32_t BOOL;
@ -13,12 +10,3 @@ typedef int32_t BOOL;
#ifndef FALSE
#define FALSE 0
#endif
#if __cplusplus >= 201402L
#define WUT_ENUM_BITMASK_TYPE(_type) \
extern "C++" { static constexpr inline _type operator|(_type lhs, _type rhs) { \
return static_cast<_type>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs)); \
} }
#else
#define WUT_ENUM_BITMASK_TYPE(_type)
#endif

428
include/zconf.h Normal file
View File

@ -0,0 +1,428 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2010 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# define uncompress z_uncompress
# define zError z_zError
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# define gzFile z_gzFile
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef STDC
# include <sys/types.h> /* for off_t */
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define z_off64_t off64_t
#else
# define z_off64_t z_off_t
#endif
#if defined(__OS400__)
# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

1613
include/zlib.h Normal file

File diff suppressed because it is too large Load Diff

18
libraries/CMakeLists.txt Normal file
View File

@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.2)
# Load up the in-tree toolchain
set(WUT_ROOT "{CMAKE_CURRENT_SOURCE_DIR}/.." CACHE STRING "")
set(ENV{WUT_ROOT} ${WUT_ROOT})
set(CMAKE_TOOLCHAIN_FILE $ENV{WUT_ROOT}/share/wut.toolchain.cmake)
project(libraries C)
add_definitions(-Wall -Werror)
add_subdirectory(libgfd)
add_subdirectory(libwhb)
add_subdirectory(nn_swkbd)
add_subdirectory(wutcrt)
add_subdirectory(wutdevoptab)
add_subdirectory(wutmalloc)
add_subdirectory(wutnewlib)
add_subdirectory(wutstdc++)

View File

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.2)
project(libgfd)
add_library(gfd STATIC
src/gfd.c
include/gfd.h)
target_include_directories(gfd PRIVATE "../../include")
target_include_directories(gfd PUBLIC "include")
install(TARGETS gfd
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")

View File

@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.2)
project(libwhb)
add_library(whb STATIC
src/commandserver.c
src/console.c
src/crash.c
src/file.c
src/gfx.c
src/gfx_heap.c
src/gfx_heap.h
src/gfx_shader.c
src/gfx_texture.c
src/libmanager.c
src/log.c
src/log_cafe.c
src/log_udp.c
src/proc.c
src/sdcard.c
include/whb/align.h
include/whb/commandserver.h
include/whb/crash.h
include/whb/file.h
include/whb/gfx.h
include/whb/libmanager.h
include/whb/log_cafe.h
include/whb/log_console.h
include/whb/log.h
include/whb/log_udp.h
include/whb/proc.h
include/whb/sdcard.h)
target_include_directories(whb PRIVATE "../../include")
target_include_directories(whb PRIVATE "../libgfd/include")
target_include_directories(whb PUBLIC "include")
install(TARGETS whb
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")

View File

@ -0,0 +1,29 @@
#pragma once
#include <wut.h>
/**
* \defgroup whb_commandserver Network Command Server
* \ingroup whb
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
#define WHB_SERVER_BUFFER_SIZE 1024
BOOL
WHBCommandServerInit();
void
WHBCommandServerStop();
BOOL
WHBCommandServerListen(char * stringLocation);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -17,9 +17,6 @@ typedef enum WHBFileError
WHB_FILE_FATAL_ERROR = -1,
} WHBFileError;
BOOL
WHBDeInitFileSystem();
int32_t
WHBOpenFile(const char *path,
const char *mode);

View File

@ -1,6 +1,5 @@
#pragma once
#include <wut.h>
#include <gx2/context.h>
#include <gx2/shaders.h>
#include <gx2/texture.h>
@ -92,24 +91,6 @@ WHBGfxLoadGFDTexture(uint32_t index,
BOOL
WHBGfxFreeTexture(GX2Texture *texture);
GX2ColorBuffer *
WHBGfxGetTVColourBuffer();
GX2DepthBuffer *
WHBGfxGetTVDepthBuffer();
GX2ContextState *
WHBGfxGetTVContextState();
GX2ColorBuffer *
WHBGfxGetDRCColourBuffer();
GX2DepthBuffer *
WHBGfxGetDRCDepthBuffer();
GX2ContextState *
WHBGfxGetDRCContextState();
#ifdef __cplusplus
}
#endif

View File

@ -14,10 +14,10 @@ extern "C" {
* Socket Library (nsysnet.rpl)
*/
__attribute__ ((deprecated)) void
void
WHBInitializeSocketLibrary();
__attribute__ ((deprecated)) void
void
WHBDeinitializeSocketLibrary();
#ifdef __cplusplus

View File

@ -19,9 +19,6 @@ WHBLogConsoleInit();
void
WHBLogConsoleFree();
void
WHBLogConsoleSetColor(uint32_t color);
void
WHBLogConsoleDraw();

View File

@ -0,0 +1,136 @@
#include <nsysnet/socket.h>
#include <whb/commandserver.h>
#include <whb/libmanager.h>
#include <whb/log.h>
#include <string.h>
#define SERVER_PORT 4406
int
sSocket = -1;
int
sClient = -1;
struct sockaddr_in
sAddr;
static inline void
closeSocket(const char * funcName)
{
int ret = socketclose(sSocket);
if(ret < 0) {
WHBLogPrintf("%s: Error occurred closing socket: %d", funcName, socketlasterr());
}
else {
sSocket = -1;
}
}
static inline void
closeClient(const char * funcName)
{
int ret = socketclose(sClient);
if(ret < 0) {
WHBLogPrintf("%s: Error occurred closing client socket: %d", funcName, socketlasterr());
}
else {
sClient = -1;
}
}
BOOL
WHBCommandServerInit()
{
int ret = 0;
if(sSocket >= 0) {
WHBLogPrintf("%s: Command server is already running.", __FUNCTION__);
return TRUE;
}
WHBInitializeSocketLibrary();
sSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(sSocket < 0) {
WHBLogPrintf("%s: Error occurred while creating socket: %d", __FUNCTION__, socketlasterr());
sSocket = -1;
return FALSE;
}
memset(&sAddr, 0, sizeof(struct sockaddr_in));
sAddr.sin_family = AF_INET;
sAddr.sin_port = htons(SERVER_PORT);
sAddr.sin_addr.s_addr = htonl(INADDR_ANY);
ret = bind(sSocket, (struct sockaddr *)&sAddr, sizeof(struct sockaddr_in));
if(ret < 0) {
WHBLogPrintf("%s: Error occurred while binding to socket: %d", __FUNCTION__, socketlasterr());
closeSocket(__FUNCTION__);
return FALSE;
}
ret = listen(sSocket, 3);
if(ret < 0) {
WHBLogPrintf("%s: Error occurred while setting socket to listen mode: %d", __FUNCTION__, socketlasterr());
closeSocket(__FUNCTION__);
return FALSE;
}
return TRUE;
}
void
WHBCommandServerStop()
{
if(sSocket < 0) {
WHBLogPrintf("%s: Socket is already closed.", __FUNCTION__);
return;
}
if(sClient >= 0) {
closeClient(__FUNCTION__);
}
closeSocket(__FUNCTION__);
WHBDeinitializeSocketLibrary();
}
BOOL
WHBCommandServerListen(char * stringLocation)
{
char buffer[WHB_SERVER_BUFFER_SIZE];
memset(buffer, 0, WHB_SERVER_BUFFER_SIZE);
int ret;
struct sockaddr_in sClientAddr;
socklen_t sClientAddrLen = sizeof(struct sockaddr_in);
if(sSocket < 0) {
WHBLogPrintf("%s: Socket is not open. Please run WHBCommandServerInit() first.", __FUNCTION__);
return FALSE;
}
if(sClient < 0) {
sClient = accept(sSocket, (struct sockaddr *)&sClientAddr, &sClientAddrLen);
if(sClient < 0) {
WHBLogPrintf("%s: Error occurred while accepting a client connection: %d", __FUNCTION__, socketlasterr());
return FALSE;
}
}
ret = recv(sClient, buffer, WHB_SERVER_BUFFER_SIZE, 0);
if(ret < 0) {
WHBLogPrintf("%s: Error occurred while receiving data from client: %d", __FUNCTION__, socketlasterr());
closeClient(__FUNCTION__);
return FALSE;
}
if(ret == 0) {
WHBLogPrintf("%s: Remote socket was closed. Closing client connection...", __FUNCTION__);
closeClient(__FUNCTION__);
return FALSE;
}
memcpy(stringLocation, buffer, WHB_SERVER_BUFFER_SIZE);
return TRUE;
}

View File

@ -4,25 +4,80 @@
#include <coreinit/memheap.h>
#include <coreinit/cache.h>
#include <coreinit/memfrmheap.h>
#include <coreinit/memory.h>
#include <coreinit/screen.h>
#include <proc_ui/procui.h>
#include <string.h>
#define NUM_LINES (16)
#define LINE_LENGTH (128)
#define CONSOLE_FRAME_HEAP_TAG (0x000DECAF)
#define FRAME_HEAP_TAG (0x000DECAF)
static char sConsoleBuffer[NUM_LINES][LINE_LENGTH];
static int sLineNum = 0;
static void *sBufferTV = NULL, *sBufferDRC = NULL;
static uint32_t sBufferSizeTV = 0, sBufferSizeDRC = 0;
static BOOL sConsoleHasForeground = TRUE;
static uint32_t consoleColor = 0x993333FF;
static void *sBufferTV, *sBufferDRC;
static uint32_t sBufferSizeTV, sBufferSizeDRC;
static void
ConsoleAddLine(const char *line)
consoleAddLine(const char *line);
BOOL
WHBLogConsoleInit()
{
MEMHeapHandle heap = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM1);
MEMRecordStateForFrmHeap(heap, FRAME_HEAP_TAG);
OSScreenInit();
sBufferSizeTV = OSScreenGetBufferSizeEx(SCREEN_TV);
sBufferSizeDRC = OSScreenGetBufferSizeEx(SCREEN_DRC);
sBufferTV = MEMAllocFromFrmHeapEx(heap, sBufferSizeTV, 4);
if (!sBufferTV) {
WHBLogPrintf("sBufferTV = MEMAllocFromFrmHeapEx(heap, 0x%X, 4) returned NULL", sBufferSizeTV);
return FALSE;
}
sBufferDRC = MEMAllocFromFrmHeapEx(heap, sBufferSizeDRC, 4);
if (!sBufferDRC) {
WHBLogPrintf("sBufferDRC = MEMAllocFromFrmHeapEx(heap, 0x%X, 4) returned NULL", sBufferSizeDRC);
return FALSE;
}
OSScreenSetBufferEx(SCREEN_TV, sBufferTV);
OSScreenSetBufferEx(SCREEN_DRC, sBufferDRC);
OSScreenEnableEx(SCREEN_TV, 1);
OSScreenEnableEx(SCREEN_DRC, 1);
WHBAddLogHandler(consoleAddLine);
return FALSE;
}
void
WHBLogConsoleFree()
{
MEMHeapHandle heap = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM1);
OSScreenShutdown();
MEMFreeByStateToFrmHeap(heap, FRAME_HEAP_TAG);
}
void
WHBLogConsoleDraw()
{
OSScreenClearBufferEx(SCREEN_TV, 0x993333FF);
OSScreenClearBufferEx(SCREEN_DRC, 0x993333FF);
for (int y = 0; y < NUM_LINES; ++y) {
OSScreenPutFontEx(SCREEN_TV, 0, y, sConsoleBuffer[y]);
OSScreenPutFontEx(SCREEN_DRC, 0, y, sConsoleBuffer[y]);
}
DCFlushRange(sBufferTV, sBufferSizeTV);
DCFlushRange(sBufferDRC, sBufferSizeDRC);
OSScreenFlipBuffersEx(SCREEN_TV);
OSScreenFlipBuffersEx(SCREEN_DRC);
}
static void
consoleAddLine(const char *line)
{
int length = strlen(line);
@ -43,83 +98,3 @@ ConsoleAddLine(const char *line)
++sLineNum;
}
}
static uint32_t
ConsoleProcCallbackAcquired(void *context)
{
MEMHeapHandle heap = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM1);
if (sBufferSizeTV) {
sBufferTV = MEMAllocFromFrmHeapEx(heap, sBufferSizeTV, 4);
}
if (sBufferSizeDRC) {
sBufferDRC = MEMAllocFromFrmHeapEx(heap, sBufferSizeDRC, 4);
}
sConsoleHasForeground = TRUE;
OSScreenSetBufferEx(SCREEN_TV, sBufferTV);
OSScreenSetBufferEx(SCREEN_DRC, sBufferDRC);
return 0;
}
static uint32_t
ConsoleProcCallbackReleased(void *context)
{
MEMHeapHandle heap = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM1);
MEMFreeByStateToFrmHeap(heap, CONSOLE_FRAME_HEAP_TAG);
sConsoleHasForeground = FALSE;
return 0;
}
BOOL
WHBLogConsoleInit()
{
OSScreenInit();
sBufferSizeTV = OSScreenGetBufferSizeEx(SCREEN_TV);
sBufferSizeDRC = OSScreenGetBufferSizeEx(SCREEN_DRC);
ConsoleProcCallbackAcquired(NULL);
OSScreenEnableEx(SCREEN_TV, 1);
OSScreenEnableEx(SCREEN_DRC, 1);
ProcUIRegisterCallback(PROCUI_CALLBACK_ACQUIRE, ConsoleProcCallbackAcquired, NULL, 100);
ProcUIRegisterCallback(PROCUI_CALLBACK_RELEASE, ConsoleProcCallbackReleased, NULL, 100);
WHBAddLogHandler(ConsoleAddLine);
return FALSE;
}
void
WHBLogConsoleFree()
{
if (sConsoleHasForeground) {
OSScreenShutdown();
ConsoleProcCallbackReleased(NULL);
}
}
void
WHBLogConsoleSetColor(uint32_t color)
{
consoleColor = color;
}
void
WHBLogConsoleDraw()
{
if (!sConsoleHasForeground) {
return;
}
OSScreenClearBufferEx(SCREEN_TV, consoleColor);
OSScreenClearBufferEx(SCREEN_DRC, consoleColor);
for (int y = 0; y < NUM_LINES; ++y) {
OSScreenPutFontEx(SCREEN_TV, 0, y, sConsoleBuffer[y]);
OSScreenPutFontEx(SCREEN_DRC, 0, y, sConsoleBuffer[y]);
}
DCFlushRange(sBufferTV, sBufferSizeTV);
DCFlushRange(sBufferDRC, sBufferSizeDRC);
OSScreenFlipBuffersEx(SCREEN_TV);
OSScreenFlipBuffersEx(SCREEN_DRC);
}

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