Merge remote-tracking branch 'origin/master' into dmacman

This commit is contained in:
Arthur Blot 2022-05-21 18:22:39 +02:00
commit 84af3a7c0d
264 changed files with 43059 additions and 8106 deletions

12
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,12 @@
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
<!--- Use the syntax "Closes #1234" or "Fixes #5678" so that GitHub will close the issue once the PR is complete. -->
## How Has This Been Tested?
<!--- Please describe how you tested your changes. -->

38
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Build uOFW
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
container:
image: pspdev/pspdev:latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: |
apk add build-base
- name: Build project
run: |
make -k
documentation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get install doxygen
- name: Build documentation
run: |
mkdir github-pages
cd github-pages
doxygen ../docs/Doxyfile
- name: Deploy documentation
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@4.1.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: github-pages
CLEAN: true

47
.gitignore vendored
View File

@ -1,6 +1,41 @@
html/
nbproject/
*.o
*.elf
*.prx
*.*~
html/
nbproject/
github-pages/
*.o
*.elf
*.prx
*.exe
*.*~
exports.c
/lib/libdebug.a
/lib/build_mod.mak
## Ignore Visual Studio project files, Visual Studio temporary files, build results.
# Visual Studio project files
*.sln
# User-specific files
*.suo
*.user
*.sln.docstates
*.vcxproj
*.vcxproj.*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
/.vs
# Other VS-generated files
/Debug

View File

@ -1,38 +0,0 @@
language: cpp
branches:
only:
- master
env:
global:
- secure: "aiH0ZGvhmY7ldfRxngIZHDuWE7ZF5UpVL577hIOUW1P+t+5lOq4hXpTaJgbaEgl0ZQ9GudeFpwx+OvUoxGwLa1wofGGSygeYRl0rfui3XkNx+5RevZ+KOuRQcv+4gJ15twvhP4+XHKfE/B8HWTO5IGN+ntRn+NzXJQLUZFXnOW8=" # GH_AUTH
before_install:
- sudo apt-get update
install:
- sudo apt-get install doxygen
script:
- mkdir gh-pages && cd gh-pages || exit
- export GIT_ROOT=`git rev-parse --show-toplevel`
- doxygen ../docs/Doxyfile
- cd $GIT_ROOT
after_success:
- if [[ $TRAVIS_PULL_REQUEST == 'false' ]]; then
- cd gh-pages/html || exit
- git init
- git config user.email "travis@example.com"
- git config user.name "uOFW Doc builder"
- git checkout --orphan master
- git add .
- git commit -am "Rebuilt docs for $TRAVIS_COMMIT"
- git remote add origin "https://${GH_AUTH}@github.com/$TRAVIS_REPO_SLUG.git"
- git push origin +master:gh-pages 2>&1 | sed "s/${GH_AUTH}/[secure]/gi"
- fi

View File

@ -1,14 +1,33 @@
#uOFW PSP kernel coding style
This document is about the preferred uOFW coding style. Please stick to the style
presented in this guide to make working on uOFW as a team easier as far as possible.
This document outlines uOFW's workflow and preferred code style. Please make yourself familiar with this document before you begin working.
## Workflow
We tend to be generous in giving collaborator status which gives you direct push access to uOFW. To keep some degree of stability in the repo, please follow these guidlines:
* Use topic branches
* Get reviews before merging pull requests into master
* Merge your branch to master only when it is stable
* Delete your branch after merging
A few do-nots:
* Do not push anything that could break a build directly to master (use a PR)
* Do not rewrite public branch history (e.g. don't rebase a branch you've already pushed)
* Do not merge/cherry pick across branches
* Avoid merging/cherry picking from master
All of these rules are meant to keep history clean and to avoid stepping on other developers toes. If you are unsure, do not hesitate to ask us on IRC.
## Coding style
Please stick to the style presented in this guide to make working on uOFW as a team easier as far as possible.
We know that coding style is very personal and we don't say you have to completely
follow it, however, your own used coding style for uOFW should not differ too much
from this one.
Thank you.
##Chapter 1: Indentation
###Chapter 1: Indentation
Indentations are 4 bytes wide. The reason behind this is to visibly show
where a block starts and where it ends.
@ -34,7 +53,7 @@ For example:
}
##Chapter 2: Breaking long lines
###Chapter 2: Breaking long lines
Make sure to not write code lines longer than 120 characters. If necessary,
break lines exceeding the 120 characters limit like below:
@ -51,7 +70,7 @@ Long `if`-lines (same as `while`-, `for`-lines) are broken into several lines li
doSomething();
##Chapter 3: Placing Braces and Spaces
###Chapter 3: Placing Braces and Spaces
Put the opening brace last on the line, and put the closing brace first, thusly:
@ -102,7 +121,7 @@ first on the last line:
doSomethingCool();
}
###Space policy:
####Space policy:
Put a space after these keywords: `if`, `switch`, `case`, `do`, `while`, `for`, `return`.
@ -150,7 +169,7 @@ When declaring a pointer to a function, this way suffices:
s32 (*funcPtr)(void);
##Chapter 4: Type using
###Chapter 4: Type using
Don't use type's like `(unsigned) short`, `(unsigned) int` as their size is NOT
the same on all machines.
@ -197,7 +216,7 @@ references itself. In that case, use:
} Point;
##Chapter 5: Naming
###Chapter 5: Naming
Use simple, short names, easy to understand. For local variables, it is even okay
to use a variable name consisting of only one letter:
@ -243,7 +262,38 @@ Instead, use capital letters.
SceBool isUofwCool = SCE_TRUE; /* Indeed. */
##Chapter 6: Magic numbers
###Chapter 6: Variable declarations
Variables which are used throughout the function, or variables which are important in all the function, are declared at the beginning, the other ones where they are first used.
Do not use the C99-specific `for (u32 i = 0; ...; i++)`.
/* Bad code */
u32 sceGetStatus(void) {
u32 i;
initializeThings();
u32 status = 0;
for (i = 0; i < ...; i++)
/* ... */
for (u32 j = 0; j < ...; j++)
/* ... */
return status;
}
/* Good code */
u32 sceGetStatus(void) {
/* Declared first because it is the most important variable of the function */
u32 status = 0;
initializeThings();
u32 i = 0;
for (i = 0; i < ...; i++)
/* ... */
for (i = 0; i < ...; i++)
/* ... */
return status;
}
###Chapter 7: Magic numbers
Using magic numbers is bad, as only the author of the C file in which they occur
will know (for a little while) what they express.
@ -285,7 +335,7 @@ A similar approach for `for`/`while`-loops:
g_Array[i] = 0;
##Chapter 7: Structure initialization
###Chapter 8: Structure initialization
Assume we have the following structure:
@ -309,7 +359,7 @@ Use the `sizeof` operator when a structure has a `size` field to be filled with
structure size (sizeof(structureType);)
##Chapter 8: Accessing hardware registers
###Chapter 9: Accessing hardware registers
Hardware registers are stored in memory starting at `0xBC000000` and are _special_
compared to global variables. They have to be written synchronously, which means
@ -324,7 +374,7 @@ You can find this macro, and other useful `#define`s, in `/include/common/hardwa
HW(HW_RAM_SIZE) = RAM_TYPE_64_MB;
##Chapter 9: Comments
###Chapter 10: Comments
All exported functions of a module and important data structures as well as
`#defines` shared among `.c` files have to be put into a header file used as a module
@ -396,7 +446,7 @@ with included address comments and, optionally, TODO-comments, and upload a file
WITHOUT address-, TODO-comments to the uOFW repositiory, as soon as your module fully works.
##Chapter 10: Switches
###Chapter 11: Switches
Put a break at the end of each `case` and at the end of the `default`.
Don't skip lines between the different labels (`case`s and `default`s).
@ -418,7 +468,7 @@ For example:
}
##Chapter 11: Export files
###Chapter 12: Export files
Only use the `PSP_EXPORT_NID` command, so a function or variable name can easily be found from
the NID using the `exports.exp` file, and to sometimes avoid mistakes with user functions.

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
MODULES=debug audio chnnlsv clockgen codec ctrl exceptionman ge init interruptman \
iofilemgr led libatrac3plus loadcore loadexec mediaman me_wrapper modulemgr \
syscon sysmem systimer usersystemlib wlanfirm
all: $(MODULES)
utils:
@$(MAKE) -C $@
$(MODULES): utils
@$(MAKE) -C "src/$@"
clean:
@$(foreach module, $(MODULES), $(MAKE) -C "src/$(module)" $@;)
@$(MAKE) -C utils $@
mrproper: clean
@$(MAKE) -C utils $@
.PHONY: utils clean mrproper

View File

@ -1,76 +1,33 @@
uOFW
uOFW [![CI status](https://github.com/uofw/uofw/workflows/Build%20uOFW/badge.svg?branch=master&event=push)](https://github.com/uofw/uofw/actions?query=branch%3Amaster)
====
The unofficial Official FirmWare, a complete latest PSP firmware reverse engineering project.
This project aims to reverse engineer the basic PSP kernel & hardware to create an up-to-date technical documentation of the system as well as to provide a free and open source vanilla firmware.
To learn more about uOFW (including examples where it has been used by the PSP community), please check out [this presentation](https://github.com/uofw/uofw/blob/master/docs/presentations/HDC_04_03_2021.pdf).
The current progress on the project can be found on the [Current Modules Status](//github.com/uofw/uofw/wiki/Current-Modules-Status) wiki page.
## Documentation
* [PSP Kernel API Documentation](http://uofw.github.io/uofw/)
* PSP Hardware and Software information can be found at [uofw/upspd](https://github.com/uofw/upspd).
Doxygen documentation: http://uofw.github.com/uofw/
Module status list: https://github.com/uofw/uofw/wiki/Current-Modules-Status
For more information: https://github.com/uofw/uofw/wiki
## Installation
You can run components of uOFW by following the directions at [uofw/uofwinst](https://github.com/uofw/uofwinst).
## Getting started
## Contributing
In order to contribute to uOFW, you need advanced knowledge in MIPS ASM and C. Some good MIPS ASM
online resources can be found [on the official MIPS page](http://www.imgtec.com/mips/mips32-architecture.asp).
MIPS ASM Instruction Set Reference: http://math-atlas.sourceforge.net/devel/assembly/mips-iv.pdf
This project is far from complete. We welcome everyone to help us.
In addition, there is a nice MIPS runtime simulator and debugger which can be found at:
http://courses.missouristate.edu/kenvollmar/mars/
To get started, please read the [wiki](//github.com/uofw/uofw/wiki). It contains the necessary information to contribute to uOFW.
The next step is to improve your reverse engineering skills (if needed). We suggest reading [this excellent guide]
(https://github.com/uofw/uofw/wiki/Reverse-engineering-tutorial) about reverse engineering for the PSP.
Make sure to check out [uOFW's wiki](https://github.com/uofw/uofw/wiki) for more information!
## Installation & Running
For information on how to install and run uOFW, please look [here](https://github.com/uofw/uofwinst).
## Repository structure
uOFW's Github repository contains one 'master' branch and several sub-branches.
The master branch is aimed to contain only tested and working code (in fact, it should contain working modules).
Please note that this is not entirely the case right now as we still need to test, and fix, some of the code in the
master branch due to the past repository structure.
Then there are sub-branches which are aimed to each represent a module currently being worked on. Such a branch
contains unfinished, untested and undocumented code about the module it is named after. Once such a branch contains
finished, documented code (that is, the module has been finished reverse-engineering) it will be merged into
the 'master' branch.
Current branches are listed on [the branches page](https://github.com/uofw/uofw/branches).
## Additional Information
While you reverse-engineer parts of the PSP's kernel, you may will find yourself in a position
where you would like to know more about how Operating Systems work in general. We suggest to check
out [this webpage](http://wiki.osdev.org/Expanded_Main_Page).
If you are looking for more PSP-related resources, you should consider checking out the following links
below:
* [LAN.st - IdStorage](http://lan.st/archive/index.php/t-151.html)
* [LAN.st - General PSP questions](http://lan.st/archive/index.php/t-3013.html)
* [LAN.st - PSP Motherboard information](http://lan.st/archive/index.php/t-372.html)
* [Yet Another Playstation Portable Documentation](http://hitmen.c02.at/files/yapspd/psp_doc.pdf.tar.gz)
* [PSP Module Tutorial](http://pspdev1.com/wp-content/uploads/2007/03/moduletutorialv1.pdf)
* [24C3 - TyRaNiD on early PSP hacking + Pandorra hack](https://www.youtube.com/watch?v=INdUZk4NFIA)
Other websites are:
* http://wololo.net
* http://ps2dev.org
## License
This project is licensed under the MIT license. It includes code from the PSPSDK which is licensed under the BSD license. For more copyright and license information, see [COPYING](COPYING).
## Questions or need help?
You can stay in touch with us and discuss project-related topics with us via the following ways:
* via IRC on the [FreeNode server](http://webchat.freenode.net/) (irc.freenode.net) (join the channel #uofw)
* via e-mail at the team's common email address uofwteam@gmail.com
## Copyright and License
For copyright and license information, please check [this file](https://github.com/uofw/uofw/blob/master/COPYING).
You can chat with us the following ways:
* via the [PSP Homebrew Community](https://discord.com/invite/bePrj9W) Discord server (preferred)
* via e-mail: uofwteam@gmail.com

View File

@ -613,8 +613,8 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = "$(GIT_ROOT)/docs/mainpage.dox" \
"$(GIT_ROOT)/include/" \
INPUT = "../docs/mainpage.dox" \
"../include/" \
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@ -822,7 +822,7 @@ GENERATE_HTML = YES
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = html
HTML_OUTPUT = .
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank

Binary file not shown.

View File

@ -16,6 +16,21 @@
* @{
*/
/* Specific error codes for the Audio Driver. */
#define SCE_AUDIO_ERROR_NOT_INITIALIZED (0x80260001)
#define SCE_AUDIO_ERROR_OUTPUT_BUSY (0x80260002)
#define SCE_AUDIO_ERROR_INVALID_CH (0x80260003)
#define SCE_AUDIO_ERROR_PRIV_REQUIRED (0x80260004)
#define SCE_AUDIO_ERROR_NOT_FOUND (0x80260005)
#define SCE_AUDIO_ERROR_INVALID_SIZE (0x80260006)
#define SCE_AUDIO_ERROR_INVALID_FORMAT (0x80260007)
#define SCE_AUDIO_ERROR_NOT_RESERVED (0x80260008)
#define SCE_AUDIO_ERROR_NOT_OUTPUT (0x80260009)
#define SCE_AUDIO_ERROR_INVALID_FREQUENCY (0x8026000A)
#define SCE_AUDIO_ERROR_INVALID_VOLUME (0x8026000B)
#define SCE_AUDIO_ERROR_INPUT_BUSY (0x80260010)
/** The input parameters structure, used by sceAudioInputInitEx() */
typedef struct
{

View File

@ -9,21 +9,37 @@ typedef struct
s32 unk0;
s32 unk4;
s32 err; // 8
s32 edramAddr; // 12
void *edramAddr; // 12
s32 neededMem; // 16
s32 unk20;
void *inBuf; // 24
s32 unk28;
s32 readSample; // 28
void *outBuf; // 32
s32 unk36;
s8 unk40;
s8 unk41;
s8 unk42;
s8 unk43;
s8 unk44;
s8 unk45;
s8 unk46;
s8 unk47;
s32 decodedSample; // 36
/* Note: this part is probably completely different depending on the codec. This should be cleaned up. */
union {
struct {
s8 u40;
s8 u41;
s8 u42;
s8 u43;
} v8;
s32 v32;
} unk40; // samplerate?
union {
struct {
u8 u44;
s8 u45;
s8 u46;
s8 u47;
} v8;
struct {
s16 u44;
s16 u46;
} v16;
s32 v32;
} unk44;
s32 unk48;
s32 unk52;
s32 unk56;

17
include/common/allegrex.h Normal file
View File

@ -0,0 +1,17 @@
/* Copyright (C) The uOFW team
See the file COPYING for copying permission.
*/
#ifndef COMMON_INCLUDED
# error "Only include common_imp.h or common_header.h!"
#endif
/*
* Some macros for Allegrex (MIPS generally) opcodes
*/
#define ALLEGREX_MAKE_SYSCALL(n) (0x03FFFFFF & (((u32)(n) << 6) | 0x0000000C))
#define ALLEGREX_MAKE_J(f) (0x08000000 | ((u32)(f) & 0x0FFFFFFC))
#define ALLEGREX_MAKE_JR_RA (0x03E00008)
#define ALLEGREX_MAKE_NOP (0x00000000)

View File

@ -40,3 +40,11 @@ static inline void dbg_puts()
}
#endif
/* Fills the framebuffer with the (r, g, b) color */
static inline void dbg_fbfill(u8 r, u8 g, u8 b) {
u32 i;
for (i = 0; i < 480 * 272 * 2; i++)
*(int*)(0x44000000 + i * 4) = r | (g << 8) | (b << 16);
}

View File

@ -1,383 +1,442 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef COMMON_INCLUDED
# error "Only include common_asm.h, common_imp.h or common_header.h!"
#endif
#define SCE_ERROR_OK 0x0
#define SCE_ERROR_NOT_SUPPORTED 0x80000004
#define SCE_ERROR_ALREADY 0x80000020
#define SCE_ERROR_BUSY 0x80000021
#define SCE_ERROR_OUT_OF_MEMORY 0x80000022
#define SCE_ERROR_PRIV_REQUIRED 0x80000023
#define SCE_ERROR_NOT_FOUND 0x80000025
#define SCE_ERROR_ILLEGAL_CONTEXT 0x80000030
#define SCE_ERROR_CPUDI 0x80000031
#define SCE_ERROR_SEMAPHORE 0x80000041
#define SCE_ERROR_INVALID_ID 0x80000100
#define SCE_ERROR_INVALID_NAME 0x80000101
#define SCE_ERROR_INVALID_INDEX 0x80000102
#define SCE_ERROR_INVALID_POINTER 0x80000103
#define SCE_ERROR_INVALID_SIZE 0x80000104
#define SCE_ERROR_INVALID_FLAG 0x80000105
#define SCE_ERROR_INVALID_COMMAND 0x80000106
#define SCE_ERROR_INVALID_MODE 0x80000107
#define SCE_ERROR_INVALID_FORMAT 0x80000108
#define SCE_ERROR_INVALID_VALUE 0x800001FE
#define SCE_ERROR_INVALID_ARGUMENT 0x800001FF
#define SCE_ERROR_NOENT 0x80000202
#define SCE_ERROR_BAD_FILE 0x80000209
#define SCE_ERROR_ACCESS_ERROR 0x8000020D
#define SCE_ERROR_EXIST 0x80000211
#define SCE_ERROR_INVAL 0x80000216
#define SCE_ERROR_MFILE 0x80000218
#define SCE_ERROR_NOSPC 0x8000021C
#define SCE_ERROR_DFUNC 0x800002FF
#define SCE_ERROR_ERRNO_OPERATION_NOT_PERMITTED 0x80010001
#define SCE_ERROR_ERRNO_FILE_NOT_FOUND 0x80010002
#define SCE_ERROR_ERRNO_FILE_OPEN_ERROR 0x80010003
#define SCE_ERROR_ERRNO_IO_ERROR 0x80010005
#define SCE_ERROR_ERRNO_ARG_LIST_TOO_LONG 0x80010007
#define SCE_ERROR_ERRNO_INVALID_FILE_DESCRIPTOR 0x80010009
#define SCE_ERROR_ERRNO_RESOURCE_UNAVAILABLE 0x8001000B
#define SCE_ERROR_ERRNO_NO_MEMORY 0x8001000C
#define SCE_ERROR_ERRNO_NO_PERM 0x8001000D
#define SCE_ERROR_ERRNO_FILE_INVALID_ADDR 0x8001000E
#define SCE_ERROR_ERRNO_DEVICE_BUSY 0x80010010
#define SCE_ERROR_ERRNO_FILE_ALREADY_EXISTS 0x80010011
#define SCE_ERROR_ERRNO_CROSS_DEV_LINK 0x80010012
#define SCE_ERROR_ERRNO_DEVICE_NOT_FOUND 0x80010013
#define SCE_ERROR_ERRNO_NOT_A_DIRECTORY 0x80010014
#define SCE_ERROR_ERRNO_IS_DIRECTORY 0x80010015
#define SCE_ERROR_ERRNO_INVALID_ARGUMENT 0x80010016
#define SCE_ERROR_ERRNO_TOO_MANY_OPEN_SYSTEM_FILES 0x80010018
#define SCE_ERROR_ERRNO_FILE_IS_TOO_BIG 0x8001001B
#define SCE_ERROR_ERRNO_DEVICE_NO_FREE_SPACE 0x8001001C
#define SCE_ERROR_ERRNO_READ_ONLY 0x8001001E
#define SCE_ERROR_ERRNO_CLOSED 0x80010020
// #define SCE_ERROR_ERRNO_EIDRM 0x80010024 -- Note: Keep this undefined.
#define SCE_ERROR_ERRNO_FILE_PROTOCOL 0x80010047
#define SCE_ERROR_ERRNO_DIRECTORY_IS_NOT_EMPTY 0x8001005A
#define SCE_ERROR_ERRNO_NAME_TOO_LONG 0x8001005B /* File name or path name too long */
#define SCE_ERROR_ERRNO_TOO_MANY_SYMBOLIC_LINKS 0x8001005C
#define SCE_ERROR_ERRNO_CONNECTION_RESET 0x80010068
#define SCE_ERROR_ERRNO_NO_FREE_BUF_SPACE 0x80010069
#define SCE_ERROR_ERRNO_ESHUTDOWN 0x8001006E /* Error sending package after socket was shutdown */
#define SCE_ERROR_ERRNO_EADDRINUSE 0x80010070 /* The address is already in use. */
#define SCE_ERROR_ERRNO_CONNECTION_ABORTED 0x80010071 /* Connection was aborted by software. */
#define SCE_ERROR_ERRNO_ETIMEDOUT 0x80010074 /* Operation timed out. */
#define SCE_ERROR_ERRNO_IN_PROGRESS 0x80010077
#define SCE_ERROR_ERRNO_ALREADY 0x80010078
#define SCE_ERROR_ERRNO_INVALID_PROTOCOL 0x8001007B /* Protocol is not supported. */
#define SCE_ERROR_ERRNO_INVALID_SOCKET_TYPE 0x8001007C /* Unsupported socket type. */
#define SCE_ERROR_ERRNO_ADDRESS_NOT_AVAILABLE 0x8001007D
#define SCE_ERROR_ERRNO_IS_ALREADY_CONNECTED 0x8001007F
#define SCE_ERROR_ERRNO_NOT_CONNECTED 0x80010080
#define SCE_ERROR_ERRNO_FILE_QUOTA_EXCEEDED 0x80010084
#define SCE_ERROR_ERRNO_NOT_SUPPORTED 0x80010086
#define SCE_ERROR_ERRNO_ENOMEDIUM 0x80010087 /* No medium was found. */
/* Non-standard error code definitions */
#define SCE_ERROR_ERRNO_ADDR_OUT_OF_MAIN_MEM 0x8001B001
#define SCE_ERROR_ERRNO_INVALID_UNIT_NUM 0x8001B002
#define SCE_ERROR_ERRNO_INVALID_FILE_SIZE 0x8001B003
#define SCE_ERROR_ERRNO_INVALID_FLAG 0x8001B004
#define SCE_ERROR_ERRNO_NO_CACHE 0x8001B005
#define SCE_ERROR_ERRNO_WRONG_MEDIUM_TYPE 0x8001B006
/* Flash memory (UMD, MS) up to 1.5.0 mistakenly had returned these values. */
#define SCE_ERROR_ERRNO150_ENAMETOOLONG 0x80010024
#define SCE_ERROR_ERRNO150_EADDRINUSE 0x80010062
#define SCE_ERROR_ERRNO150_ECONNABORTED 0x80010067
#define SCE_ERROR_ERRNO150_ETIMEDOUT 0x8001006E
#define SCE_ERROR_ERRNO150_ENOMEDIUM 0x8001007B
#define SCE_ERROR_ERRNO150_EMEDIUMTYPE 0x8001007C
#define SCE_ERROR_ERRNO150_ENOTSUP 0x8001B000
#define SCE_ERROR_KERNEL_ERROR 0x80020001
#define SCE_ERROR_KERNEL_NOT_IMPLEMENTED 0x80020002
#define SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT 0x80020064
#define SCE_ERROR_KERNEL_INTERRUPTS_ALREADY_DISABLED 0x80020066
#define SCE_ERROR_KERNEL_NO_TIMER 0x80020096
#define SCE_ERROR_KERNEL_ILLEGAL_TIMER_ID 0x80020097
#define SCE_ERROR_KERNEL_ILLEGAL_PRESCALE 0x80020099
#define SCE_ERROR_KERNEL_TIMER_BUSY 0x8002009A
#define SCE_ERROR_KERNEL_UNKNOWN_UID 0x800200CB
#define SCE_ERROR_KERNEL_UNMATCH_TYPE_UID 0x800200CC
#define SCE_ERROR_KERNEL_NOT_EXIST_ID 0x800200CD
#define SCE_ERROR_KERNEL_NOT_FOUND_FUNCTION_UID 0x800200CE
#define SCE_ERROR_KERNEL_ALREADY_HOLDER_UID 0x800200CF
#define SCE_ERROR_KERNEL_NOT_HOLDER_UID 0x800200D0
#define SCE_ERROR_KERNEL_ILLEGAL_PERMISSION 0x800200D1
#define SCE_ERROR_KERNEL_ILLEGAL_ARGUMENT 0x800200D2
#define SCE_ERROR_KERNEL_ILLEGAL_ADDR 0x800200D3
#define SCE_ERROR_KERNEL_MEMORY_AREA_OUT_OF_RANGE 0x800200D4
#define SCE_ERROR_KERNEL_MEMORY_AREA_IS_OVERLAP 0x800200D5
#define SCE_ERROR_KERNEL_ILLEGAL_PARTITION_ID 0x800200D6
#define SCE_ERROR_KERNEL_PARTITION_IN_USE 0x800200D7
#define SCE_ERROR_KERNEL_ILLEGAL_MEMBLOCK_ALLOC_TYPE 0x800200D8
#define SCE_ERROR_KERNEL_FAILED_ALLOC_MEMBLOCK 0x800200D9
#define SCE_ERROR_KERNEL_INHIBITED_RESIZE_MEMBLOCK 0x800200DA
#define SCE_ERROR_KERNEL_FAILED_RESIZE_MEMBLOCK 0x800200DB
#define SCE_ERROR_KERNEL_FAILED_ALLOC_HEAPBLOCK 0x800200DC
#define SCE_ERROR_KERNEL_FAILED_ALLOC_HEAP 0x800200DD
#define SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID 0x800200DE
#define SCE_ERROR_KERNEL_CANNOT_FIND_CHUNK_NAME 0x800200DF
#define SCE_ERROR_KERNEL_NO_FREE_CHUNK 0x800200E0
#define SCE_ERROR_KERNEL_MEMBLOCK_FRAGMENTED 0x800200E1
#define SCE_ERROR_KERNEL_MEMBLOCK_CANNOT_JOINT 0x800200E2
#define SCE_ERROR_KERNEL_MEMBLOCK_CANNOT_SEPARATE 0x800200E3
#define SCE_ERROR_KERNEL_ILLEGAL_ALIGNMENT_SIZE 0x800200E4
#define SCE_ERROR_KERNEL_ILLEGAL_DEVKIT_VER 0x800200E5
#define SCE_ERROR_KERNEL_MODULE_LINK_ERROR 0x8002012C
#define SCE_ERROR_KERNEL_ILLEGAL_OBJECT_FORMAT 0x8002012D
#define SCE_ERROR_KERNEL_UNKNOWN_MODULE 0x8002012E
#define SCE_ERROR_KERNEL_UNKNOWN_MODULE_FILE 0x8002012F
#define SCE_ERROR_KERNEL_FILE_READ_ERROR 0x80020130
#define SCE_ERROR_KERNEL_MEMORY_IN_USE 0x80020131
#define SCE_ERROR_KERNEL_PARTITION_MISMATCH 0x80020132
#define SCE_ERROR_KERNEL_MODULE_ALREADY_STARTED 0x80020133
#define SCE_ERROR_KERNEL_MODULE_NOT_STARTED 0x80020134
#define SCE_ERROR_KERNEL_MODULE_ALREADY_STOPPED 0x80020135
#define SCE_ERROR_KERNEL_MODULE_CANNOT_STOP 0x80020136
#define SCE_ERROR_KERNEL_MODULE_NOT_STOPPED 0x80020137
#define SCE_ERROR_KERNEL_MODULE_CANNOT_REMOVE 0x80020138
#define SCE_ERROR_KERNEL_EXCLUSIVE_LOAD 0x80020139
#define SCE_ERROR_KERNEL_LIBRARY_IS_NOT_LINKED 0x8002013A
#define SCE_ERROR_KERNEL_LIBRARY_ALREADY_EXISTS 0x8002013B
#define SCE_ERROR_KERNEL_LIBRARY_NOT_FOUND 0x8002013C
#define SCE_ERROR_KERNEL_ILLEGAL_LIBRARY_HEADER 0x8002013D
#define SCE_ERROR_KERNEL_LIBRARY_IN_USE 0x8002013E
#define SCE_ERROR_KERNEL_MODULE_ALREADY_STOPPING 0x8002013F
#define SCE_ERROR_KERNEL_ILLEGAL_OFFSET_VALUE 0x80020140
#define SCE_ERROR_KERNEL_ILLEGAL_POSITION_CODE 0x80020141
#define SCE_ERROR_KERNEL_ILLEGAL_ACCESS_CODE 0x80020142
#define SCE_ERROR_KERNEL_MODULE_MANAGER_BUSY 0x80020143
#define SCE_ERROR_KERNEL_ILLEGAL_FLAG 0x80020144
#define SCE_ERROR_KERNEL_CANNOT_GET_MODULE_LIST 0x80020145
#define SCE_ERROR_KERNEL_PROHIBIT_LOADMODULE_DEVICE 0x80020146
#define SCE_ERROR_KERNEL_PROHIBIT_LOADEXEC_DEVICE 0x80020147
#define SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE 0x80020148
#define SCE_ERROR_KERNEL_ILLEGAL_PERMISSION_CALL 0x80020149
#define SCE_ERROR_KERNEL_CANNOT_GET_MODULE_INFO 0x8002014A
#define SCE_ERROR_KERNEL_ILLEGAL_LOADEXEC_BUFFER 0x8002014B
#define SCE_ERROR_KERNEL_ILLEGAL_LOADEXEC_FILENAME 0x8002014C
#define SCE_ERROR_KERNEL_NO_EXIT_CALLBACK 0x8002014D
#define SCE_ERROR_KERNEL_MEDIA_CHANGED 0x8002014E
#define SCE_ERROR_KERNEL_CANNOT_USE_BETA_VER_MODULE 0x8002014F
#define SCE_ERROR_KERNEL_NO_MEMORY 0x80020190
#define SCE_ERROR_KERNEL_ILLEGAL_ATTR 0x80020191
#define SCE_ERROR_KERNEL_ILLEGAL_THREAD_ENTRY_ADDR 0x80020192
#define SCE_ERROR_KERNEL_ILLEGAL_PRIORITY 0x80020193
#define SCE_ERROR_KERNEL_ILLEGAL_STACK_SIZE 0x80020194
#define SCE_ERROR_KERNEL_ILLEGAL_MODE 0x80020195
#define SCE_ERROR_KERNEL_ILLEGAL_MASK 0x80020196
#define SCE_ERROR_KERNEL_ILLEGAL_THREAD 0x80020197
#define SCE_ERROR_KERNEL_NOT_FOUND_THREAD 0x80020198
#define SCE_ERROR_KERNEL_NOT_FOUND_SEMAPHORE 0x80020199
#define SCE_ERROR_KERNEL_NOT_FOUND_EVENT_FLAG 0x8002019A
#define SCE_ERROR_KERNEL_NOT_FOUND_MESSAGE_BOX 0x8002019B
#define SCE_ERROR_KERNEL_NOT_FOUND_VPOOL 0x8002019C
#define SCE_ERROR_KERNEL_NOT_FOUND_FPOOL 0x8002019D
#define SCE_ERROR_KERNEL_NOT_FOUND_MESSAGE_PIPE 0x8002019E
#define SCE_ERROR_KERNEL_NOT_FOUND_ALARM 0x8002019F
#define SCE_ERROR_KERNEL_NOT_FOUND_THREAD_EVENT_HANDLER 0x800201A0
#define SCE_ERROR_KERNEL_NOT_FOUND_CALLBACK 0x800201A1
#define SCE_ERROR_KERNEL_THREAD_ALREADY_DORMANT 0x800201A2
#define SCE_ERROR_KERNEL_THREAD_ALREADY_SUSPEND 0x800201A3
#define SCE_ERROR_KERNEL_THREAD_IS_NOT_DORMANT 0x800201A4
#define SCE_ERROR_KERNEL_THREAD_IS_NOT_SUSPEND 0x800201A5
#define SCE_ERROR_KERNEL_THREAD_IS_NOT_WAIT 0x800201A6
#define SCE_ERROR_KERNEL_WAIT_CAN_NOT_WAIT 0x800201A7
#define SCE_ERROR_KERNEL_WAIT_TIMEOUT 0x800201A8
#define SCE_ERROR_KERNEL_WAIT_CANCELLED 0x800201A9
#define SCE_ERROR_KERNEL_WAIT_STATUS_RELEASED 0x800201AA
#define SCE_ERROR_KERNEL_WAIT_STATUS_RELEASED_CALLBACK 0x800201AB
#define SCE_ERROR_KERNEL_THREAD_IS_TERMINATED 0x800201AC
#define SCE_ERROR_KERNEL_SEMA_ZERO 0x800201AD
#define SCE_ERROR_KERNEL_SEMA_OVERFLOW 0x800201AE
#define SCE_ERROR_KERNEL_EVENT_FLAG_POLL_FAILED 0x800201AF
#define SCE_ERROR_KERNEL_EVENT_FLAG_NO_MULTI_PERM 0x800201B0
#define SCE_ERROR_KERNEL_EVENT_FLAG_ILLEGAL_WAIT_PATTERN 0x800201B1
#define SCE_ERROR_KERNEL_MESSAGEBOX_NO_MESSAGE 0x800201B2
#define SCE_ERROR_KERNEL_MESSAGE_PIPE_FULL 0x800201B3
#define SCE_ERROR_KERNEL_MESSAGE_PIPE_EMPTY 0x800201B4
#define SCE_ERROR_KERNEL_WAIT_DELETE 0x800201B5
#define SCE_ERROR_KERNEL_ILLEGAL_MEMBLOCK 0x800201B6
#define SCE_ERROR_KERNEL_ILLEGAL_MEMSIZE 0x800201B7
#define SCE_ERROR_KERNEL_ILLEGAL_SCRATCHPAD_ADDR 0x800201B8
#define SCE_ERROR_KERNEL_SCRATCHPAD_IN_USE 0x800201B9
#define SCE_ERROR_KERNEL_SCRATCHPAD_NOT_IN_USE 0x800201BA
#define SCE_ERROR_KERNEL_ILLEGAL_TYPE 0x800201BB
#define SCE_ERROR_KERNEL_ILLEGAL_SIZE 0x800201BC
#define SCE_ERROR_KERNEL_ILLEGAL_COUNT 0x800201BD
#define SCE_ERROR_KERNEL_NOT_FOUND_VTIMER 0x800201BE
#define SCE_ERROR_KERNEL_ILLEGAL_VTIMER 0x800201BF
#define SCE_ERROR_KERNEL_ILLEGAL_KTLS 0x800201C0
#define SCE_ERROR_KERNEL_KTLS_IS_FULL 0x800201C1
#define SCE_ERROR_KERNEL_KTLS_IS_BUSY 0x800201C2
#define SCE_ERROR_KERNEL_MUTEX_NOT_FOUND 0x800201C3
#define SCE_ERROR_KERNEL_MUTEX_LOCKED 0x800201C4
#define SCE_ERROR_KERNEL_MUTEX_UNLOCKED 0x800201C5
#define SCE_ERROR_KERNEL_MUTEX_LOCK_OVERFLOW 0x800201C6
#define SCE_ERROR_KERNEL_MUTEX_UNLOCK_UNDERFLOW 0x800201C7
#define SCE_ERROR_KERNEL_MUTEX_RECURSIVE_NOT_ALLOWED 0x800201C8
#define SCE_ERROR_KERNEL_MESSAGEBOX_DUPLICATE_MESSAGE 0x800201C9
#define SCE_ERROR_KERNEL_LWMUTEX_NOT_FOUND 0x800201CA
#define SCE_ERROR_KERNEL_LWMUTEX_LOCKED 0x800201CB
#define SCE_ERROR_KERNEL_LWMUTEX_UNLOCKED 0x800201CC
#define SCE_ERROR_KERNEL_LWMUTEX_LOCK_OVERFLOW 0x800201CD
#define SCE_ERROR_KERNEL_LWMUTEX_UNLOCK_UNDERFLOW 0x800201CE
#define SCE_ERROR_KERNEL_LWMUTEX_RECURSIVE_NOT_ALLOWED 0x800201CF
#define SCE_ERROR_KERNEL_POWER_CANNOT_CANCEL 0x80020261
#define SCE_ERROR_KERNEL_TOO_MANY_OPEN_FILES 0x80020320
#define SCE_ERROR_KERNEL_NO_SUCH_DEVICE 0x80020321
#define SCE_ERROR_KERNEL_BAD_FILE_DESCRIPTOR 0x80020323
#define SCE_ERROR_KERNEL_INVALID_ARGUMENT 0x80020324
#define SCE_ERROR_KERNEL_UNSUPPORTED_OPERATION 0x80020325
#define SCE_ERROR_KERNEL_NOCWD 0x8002032C
#define SCE_ERROR_KERNEL_FILENAME_TOO_LONG 0x8002032D
#define SCE_ERROR_KERNEL_ASYNC_BUSY 0x80020329
#define SCE_ERROR_KERNEL_NO_ASYNC_OP 0x8002032A
#define SCE_ERROR_KERNEL_NOT_CACHE_ALIGNED 0x8002044C
#define SCE_ERROR_KERNEL_MAX_ERROR 0x8002044D
#define SCE_ERROR_UTILITY_INVALID_STATUS 0x80110001
#define SCE_ERROR_UTILITY_INVALID_PARAM_ADDR 0x80110002
#define SCE_ERROR_UTILITY_IS_UNKNOWN 0x80110003
#define SCE_ERROR_UTILITY_INVALID_PARAM_SIZE 0x80110004
#define SCE_ERROR_UTILITY_WRONG_TYPE 0x80110005
#define SCE_ERROR_UTILITY_MODULE_NOT_FOUND 0x80110006
#define SCE_ERROR_SAVEDATA_LOAD_NO_MEMSTICK 0x80110301
#define SCE_ERROR_SAVEDATA_LOAD_MEMSTICK_REMOVED 0x80110302
#define SCE_ERROR_SAVEDATA_LOAD_ACCESS_ERROR 0x80110305
#define SCE_ERROR_SAVEDATA_LOAD_DATA_BROKEN 0x80110306
#define SCE_ERROR_SAVEDATA_LOAD_NO_DATA 0x80110307
#define SCE_ERROR_SAVEDATA_LOAD_BAD_PARAMS 0x80110308
#define SCE_ERROR_SAVEDATA_LOAD_NO_UMD 0x80110309
#define SCE_ERROR_SAVEDATA_LOAD_INTERNAL_ERROR 0x80110309
#define SCE_ERROR_SAVEDATA_RW_NO_MEMSTICK 0x80110321
#define SCE_ERROR_SAVEDATA_RW_MEMSTICK_REMOVED 0x80110322
#define SCE_ERROR_SAVEDATA_RW_MEMSTICK_FULL 0x80110323
#define SCE_ERROR_SAVEDATA_RW_MEMSTICK_PROTECTED 0x80110324
#define SCE_ERROR_SAVEDATA_RW_ACCESS_ERROR 0x80110325
#define SCE_ERROR_SAVEDATA_RW_DATA_BROKEN 0x80110326
#define SCE_ERROR_SAVEDATA_RW_NO_DATA 0x80110327
#define SCE_ERROR_SAVEDATA_RW_BAD_PARAMS 0x80110328
#define SCE_ERROR_SAVEDATA_RW_FILE_NOT_FOUND 0x80110329
#define SCE_ERROR_SAVEDATA_RW_CAN_NOT_SUSPEND 0x8011032A
#define SCE_ERROR_SAVEDATA_RW_INTERNAL_ERROR 0x8011032B
#define SCE_ERROR_SAVEDATA_RW_BAD_STATUS 0x8011032C
#define SCE_ERROR_SAVEDATA_RW_SECURE_FILE_FULL 0x8011032D
#define SCE_ERROR_SAVEDATA_DELETE_NO_MEMSTICK 0x80110341
#define SCE_ERROR_SAVEDATA_DELETE_MEMSTICK_REMOVED 0x80110342
#define SCE_ERROR_SAVEDATA_DELETE_MEMSTICK_PROTECTED 0x80110344
#define SCE_ERROR_SAVEDATA_DELETE_ACCESS_ERROR 0x80110345
#define SCE_ERROR_SAVEDATA_DELETE_DATA_BROKEN 0x80110346
#define SCE_ERROR_SAVEDATA_DELETE_NO_DATA 0x80110347
#define SCE_ERROR_SAVEDATA_DELETE_BAD_PARAMS 0x80110348
#define SCE_ERROR_SAVEDATA_DELETE_INTERNAL_ERROR 0x8011034B
#define SCE_ERROR_SAVEDATA_SAVE_NO_MEMSTICK 0x80110381
#define SCE_ERROR_SAVEDATA_SAVE_MEMSTICK_REMOVED 0x80110382
#define SCE_ERROR_SAVEDATA_SAVE_NO_SPACE 0x80110383
#define SCE_ERROR_SAVEDATA_SAVE_MEMSTICK_PROTECTED 0x80110384
#define SCE_ERROR_SAVEDATA_SAVE_ACCESS_ERROR 0x80110385
#define SCE_ERROR_SAVEDATA_SAVE_BAD_PARAMS 0x80110388
#define SCE_ERROR_SAVEDATA_SAVE_NO_UMD 0x80110389
#define SCE_ERROR_SAVEDATA_SAVE_WRONG_UMD 0x8011038A
#define SCE_ERROR_SAVEDATA_SAVE_INTERNAL_ERROR 0x8011038B
#define SCE_ERROR_SAVEDATA_SIZES_NO_MEMSTICK 0x801103C1
#define SCE_ERROR_SAVEDATA_SIZES_MEMSTICK_REMOVED 0x801103C2
#define SCE_ERROR_SAVEDATA_SIZES_ACCESS_ERROR 0x801103C5
#define SCE_ERROR_SAVEDATA_SIZES_DATA_BROKEN 0x801103C6
#define SCE_ERROR_SAVEDATA_SIZES_NO_DATA 0x801103C7
#define SCE_ERROR_SAVEDATA_SIZES_BAD_PARAMS 0x801103C8
#define SCE_ERROR_SAVEDATA_SIZES_INTERNAL_ERROR 0x801103CB
#define SCE_ERROR_NETPARAM_BAD_NETCONF 0x80110601
#define SCE_ERROR_NETPARAM_BAD_PARAM 0x80110604
#define SCE_ERROR_NET_MODULE_BAD_ID 0x80110801
#define SCE_ERROR_NET_MODULE_ALREADY_LOADED 0x80110802
#define SCE_ERROR_NET_MODULE_NOT_LOADED 0x80110803
#define SCE_ERROR_AV_MODULE_BAD_ID 0x80110901
#define SCE_ERROR_AV_MODULE_ALREADY_LOADED 0x80110902
#define SCE_ERROR_AV_MODULE_NOT_LOADED 0x80110903
#define SCE_ERROR_MODULE_BAD_ID 0x80111101
#define SCE_ERROR_MODULE_ALREADY_LOADED 0x80111102
#define SCE_ERROR_MODULE_NOT_LOADED 0x80111103
#define SCE_ERROR_SCREENSHOT_CONT_MODE_NOT_INIT 0x80111229
#define SCE_ERROR_MEMSTICK_DEVCTL_BAD_PARAMS 0x80220081
#define SCE_ERROR_MEMSTICK_DEVCTL_TOO_MANY_CALLBACKS 0x80220082
#define SCE_ERROR_AUDIO_NOT_INITIALIZED 0x80260001
#define SCE_ERROR_AUDIO_OUTPUT_BUSY 0x80260002
#define SCE_ERROR_AUDIO_INVALID_CH 0x80260003
#define SCE_ERROR_AUDIO_PRIV_REQUIRED 0x80260004
#define SCE_ERROR_AUDIO_NOT_FOUND 0x80260005
#define SCE_ERROR_AUDIO_INVALID_SIZE 0x80260006
#define SCE_ERROR_AUDIO_INVALID_FORMAT 0x80260007
#define SCE_ERROR_AUDIO_NOT_RESERVED 0x80260008
#define SCE_ERROR_AUDIO_NOT_OUTPUT 0x80260009
#define SCE_ERROR_AUDIO_INVALID_FREQUENCY 0x8026000A
#define SCE_ERROR_AUDIO_INVALID_VOLUME 0x8026000B
#define SCE_ERROR_AUDIO_INPUT_BUSY 0x80260010
#define SCE_ERROR_POWER_VMEM_IN_USE 0x802B0200
#define SCE_ERROR_NET_RESOLVER_BAD_ID 0x80410408
#define SCE_ERROR_NET_RESOLVER_ALREADY_STOPPED 0x8041040A
#define SCE_ERROR_NET_RESOLVER_INVALID_HOST 0x80410414
#define SCE_ERROR_WLAN_BAD_PARAMS 0x80410D13
#define SCE_ERROR_SAS_INVALID_VOICE 0x80420010
#define SCE_ERROR_SAS_INVALID_ADSR_CURVE_MODE 0x80420013
#define SCE_ERROR_SAS_INVALID_PARAMETER 0x80420014
#define SCE_ERROR_SAS_VOICE_PAUSED 0x80420016
#define SCE_ERROR_SAS_BUSY 0x80420030
#define SCE_ERROR_SAS_NOT_INIT 0x80420100
#define SCE_ERROR_HTTP_NOT_INIT 0x80431001
#define SCE_ERROR_HTTP_ALREADY_INIT 0x80431020
#define SCE_ERROR_HTTP_NO_MEMORY 0x80431077
#define SCE_ERROR_HTTP_SYSTEM_COOKIE_NOT_LOADED 0x80431078
#define SCE_ERROR_HTTP_INVALID_PARAMETER 0x804311FE
#define SCE_ERROR_SSL_NOT_INIT 0x80435001
#define SCE_ERROR_SSL_ALREADY_INIT 0x80435020
#define SCE_ERROR_SSL_OUT_OF_MEMORY 0x80435022
#define SCE_ERROR_HTTPS_CERT_ERROR 0x80435060
#define SCE_ERROR_HTTPS_HANDSHAKE_ERROR 0x80435061
#define SCE_ERROR_HTTPS_IO_ERROR 0x80435062
#define SCE_ERROR_HTTPS_INTERNAL_ERROR 0x80435063
#define SCE_ERROR_HTTPS_PROXY_ERROR 0x80435064
#define SCE_ERROR_SSL_INVALID_PARAMETER 0x804351FE
#define SCE_ERROR_WAVE_NOT_INIT 0x80440001
#define SCE_ERROR_WAVE_FAILED_EXIT 0x80440002
#define SCE_ERROR_WAVE_BAD_VOL 0x8044000A
#define SCE_ERROR_WAVE_INVALID_CHANNEL 0x80440010
#define SCE_ERROR_WAVE_INVALID_SAMPLE_COUNT 0x80440011
#define SCE_ERROR_FONT_INVALID_LIBID 0x80460002
#define SCE_ERROR_FONT_INVALID_PARAMETER 0x80460003
#define SCE_ERROR_FONT_TOO_MANY_OPEN_FONTS 0x80460009
#define SCE_ERROR_MPEG_BAD_VERSION 0x80610002
#define SCE_ERROR_MPEG_NO_MEMORY 0x80610022
#define SCE_ERROR_MPEG_INVALID_ADDR 0x80610103
#define SCE_ERROR_MPEG_INVALID_VALUE 0x806101FE
#define SCE_ERROR_PSMF_NOT_INITIALIZED 0x80615001
#define SCE_ERROR_PSMF_BAD_VERSION 0x80615002
#define SCE_ERROR_PSMF_NOT_FOUND 0x80615025
#define SCE_ERROR_PSMF_INVALID_ID 0x80615100
#define SCE_ERROR_PSMF_INVALID_VALUE 0x806151FE
#define SCE_ERROR_PSMF_INVALID_TIMESTAMP 0x80615500
#define SCE_ERROR_PSMF_INVALID_PSMF 0x80615501
#define SCE_ERROR_PSMFPLAYER_NOT_INITIALIZED 0x80616001
#define SCE_ERROR_PSMFPLAYER_NO_MORE_DATA 0x8061600C
#define SCE_ERROR_MPEG_NO_DATA 0x80618001
#define SCE_ERROR_AVC_VIDEO_FATAL 0x80628002
#define SCE_ERROR_ATRAC_NO_ID 0x80630003
#define SCE_ERROR_ATRAC_INVALID_CODEC 0x80630004
#define SCE_ERROR_ATRAC_BAD_ID 0x80630005
#define SCE_ERROR_ATRAC_ALL_DATA_LOADED 0x80630009
#define SCE_ERROR_ATRAC_NO_DATA 0x80630010
#define SCE_ERROR_ATRAC_SECOND_BUFFER_NEEDED 0x80630012
#define SCE_ERROR_ATRAC_SECOND_BUFFER_NOT_NEEDED 0x80630022
#define SCE_ERROR_ATRAC_BUFFER_IS_EMPTY 0x80630023
#define SCE_ERROR_ATRAC_ALL_DATA_DECODED 0x80630024
#define SCE_ERROR_CODEC_AUDIO_FATAL 0x807F00FC
/* Copyright (C) 2011 - 2021 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef COMMON_INCLUDED
# error "Only include common_asm.h, common_imp.h or common_header.h!"
#endif
/**
* uofw/include/common/errors.h
*
* Defines error codes used by the system software. Throughout the kernel, error codes
* are organized as negative values expressed in hexadecimal notation.
*/
/**
* PSP error value format
*
* 31 30 29 28 27 16 15 0
* +---+---+-------+------------------+-----------------------+
* | E | C | Rsrvd | F A C I L I T Y | E R R O R C O D E |
* +---+---+-------+------------------+-----------------------+
*
* bit 31: Error
* 1 = Error
* 0 = Success
*
* bit 30: Critical
* 1 = Critical error
* 0 = Normal error
*
* bits 29-28: Reserved
* always zero
*
* bits 27-16: Facility
* One of the below facility codes
*
* bits 15-0: Error code
* Define the concrete meaning of the error code. The meaning is depending
* on the facility code, in other words, if for two error values the
* error code fields are equal, but the facility differs, then the meaning of the
* error value might differ as well.
*
*/
/*
* Definition of facility codes
*/
#define SCE_ERROR_FACILITY_NULL 0x000
#define SCE_ERROR_FACILITY_ERRNO 0x001
#define SCE_ERROR_FACILITY_KERNEL 0x002
#define SCE_ERROR_FACILITY_REGISTRY 0x008
#define SCE_ERROR_FACILITY_VSH 0x010
#define SCE_ERROR_FACILITY_UTILITY 0x011
#define SCE_ERROR_FACILITY_SYSFILE 0x012
#define SCE_ERROR_FACILITY_MSAPP 0x013
#define SCE_ERROR_FACILITY_UMD 0x021
#define SCE_ERROR_FACILITY_MEMSTICK 0x022
#define SCE_ERROR_FACILITY_FLASH 0x023
#define SCE_ERROR_FACILITY_USB 0x024
#define SCE_ERROR_FACILITY_SYSCON 0x025
#define SCE_ERROR_FACILITY_AUDIO 0x026
#define SCE_ERROR_FACILITY_LFLASH 0x027
#define SCE_ERROR_FACILITY_LFATFS 0x028
#define SCE_ERROR_FACILITY_SIRCS 0x029
#define SCE_ERROR_FACILITY_IRDA 0x02A
#define SCE_ERROR_FACILITY_POWER 0x02B
#define SCE_ERROR_FACILITY_AUDIOROUTING 0x02C
#define SCE_ERROR_FACILITY_MEDIASYNC 0x02D
#define SCE_ERROR_FACILITY_PERIPH 0x03F
#define SCE_ERROR_FACILITY_NETWORK 0x041
#define SCE_ERROR_FACILITY_SAS 0x042
#define SCE_ERROR_FACILITY_HTTP 0x043
#define SCE_ERROR_FACILITY_WAVE 0x044
#define SCE_ERROR_FACILITY_SND 0x045
#define SCE_ERROR_FACILITY_FONT 0x046
#define SCE_ERROR_FACILITY_P3DA 0x047
#define SCE_ERROR_FACILITY_MAGICGATE 0x050
#define SCE_ERROR_FACILITY_CPHIO 0x051
#define SCE_ERROR_FACILITY_OPENPSID 0x052
#define SCE_ERROR_FACILITY_DNAS 0x053
#define SCE_ERROR_FACILITY_MTP 0x054
#define SCE_ERROR_FACILITY_NP 0x055
#define SCE_ERROR_FACILITY_GAMEUPDATE 0x056
#define SCE_ERROR_FACILITY_FMAC 0x057
#define SCE_ERROR_FACILITY_FACE 0x058
#define SCE_ERROR_FACILITY_LIBRARY 0x05F
#define SCE_ERROR_FACILITY_MPEG 0x061
#define SCE_ERROR_FACILITY_AVC 0x062
#define SCE_ERROR_FACILITY_ATRAC 0x063
#define SCE_ERROR_FACILITY_ASF 0x064
#define SCE_ERROR_FACILITY_JPEG 0x065
#define SCE_ERROR_FACILITY_AVI 0x066
#define SCE_ERROR_FACILITY_MP3 0x067
#define SCE_ERROR_FACILITY_G729 0x068
#define SCE_ERROR_FACILITY_AAC 0x069
#define SCE_ERROR_FACILITY_CODEC 0x07F
/*
* Error definitions belonging to SCE_ERROR_FACILITY_NULL
*/
#define SCE_ERROR_OK 0x0
#define SCE_ERROR_NOT_IMPLEMENTED 0x80000003
#define SCE_ERROR_NOT_SUPPORTED 0x80000004
#define SCE_ERROR_ALREADY 0x80000020
#define SCE_ERROR_BUSY 0x80000021
#define SCE_ERROR_OUT_OF_MEMORY 0x80000022
#define SCE_ERROR_PRIV_REQUIRED 0x80000023
#define SCE_ERROR_NOT_FOUND 0x80000025
#define SCE_ERROR_ILLEGAL_CONTEXT 0x80000030
#define SCE_ERROR_CPUDI 0x80000031
#define SCE_ERROR_SEMAPHORE 0x80000041
#define SCE_ERROR_INVALID_ID 0x80000100
#define SCE_ERROR_INVALID_NAME 0x80000101
#define SCE_ERROR_INVALID_INDEX 0x80000102
#define SCE_ERROR_INVALID_POINTER 0x80000103
#define SCE_ERROR_INVALID_SIZE 0x80000104
#define SCE_ERROR_INVALID_FLAG 0x80000105
#define SCE_ERROR_INVALID_COMMAND 0x80000106
#define SCE_ERROR_INVALID_MODE 0x80000107
#define SCE_ERROR_INVALID_FORMAT 0x80000108
#define SCE_ERROR_INVALID_VALUE 0x800001FE
#define SCE_ERROR_INVALID_ARGUMENT 0x800001FF
#define SCE_ERROR_NOENT 0x80000202
#define SCE_ERROR_BAD_FILE 0x80000209
#define SCE_ERROR_ACCESS_ERROR 0x8000020D
#define SCE_ERROR_EXIST 0x80000211
#define SCE_ERROR_INVAL 0x80000216
#define SCE_ERROR_MFILE 0x80000218
#define SCE_ERROR_NOSPC 0x8000021C
#define SCE_ERROR_DFUNC 0x800002FF
/*
* Error definitions belonging to SCE_ERROR_FACILITY_ERRNO
*/
#define SCE_ERROR_ERRNO_OPERATION_NOT_PERMITTED 0x80010001
#define SCE_ERROR_ERRNO_FILE_NOT_FOUND 0x80010002
#define SCE_ERROR_ERRNO_FILE_OPEN_ERROR 0x80010003
#define SCE_ERROR_ERRNO_IO_ERROR 0x80010005
#define SCE_ERROR_ERRNO_ARG_LIST_TOO_LONG 0x80010007
#define SCE_ERROR_ERRNO_INVALID_FILE_DESCRIPTOR 0x80010009
#define SCE_ERROR_ERRNO_RESOURCE_UNAVAILABLE 0x8001000B
#define SCE_ERROR_ERRNO_NO_MEMORY 0x8001000C
#define SCE_ERROR_ERRNO_NO_PERM 0x8001000D
#define SCE_ERROR_ERRNO_FILE_INVALID_ADDR 0x8001000E
#define SCE_ERROR_ERRNO_DEVICE_BUSY 0x80010010
#define SCE_ERROR_ERRNO_FILE_ALREADY_EXISTS 0x80010011
#define SCE_ERROR_ERRNO_CROSS_DEV_LINK 0x80010012
#define SCE_ERROR_ERRNO_DEVICE_NOT_FOUND 0x80010013
#define SCE_ERROR_ERRNO_NOT_A_DIRECTORY 0x80010014
#define SCE_ERROR_ERRNO_IS_DIRECTORY 0x80010015
#define SCE_ERROR_ERRNO_INVALID_ARGUMENT 0x80010016
#define SCE_ERROR_ERRNO_TOO_MANY_OPEN_SYSTEM_FILES 0x80010018
#define SCE_ERROR_ERRNO_FILE_IS_TOO_BIG 0x8001001B
#define SCE_ERROR_ERRNO_DEVICE_NO_FREE_SPACE 0x8001001C
#define SCE_ERROR_ERRNO_READ_ONLY 0x8001001E
#define SCE_ERROR_ERRNO_CLOSED 0x80010020
// #define SCE_ERROR_ERRNO_EIDRM 0x80010024 -- Note: Keep this undefined.
#define SCE_ERROR_ERRNO_FILE_PROTOCOL 0x80010047
#define SCE_ERROR_ERRNO_DIRECTORY_IS_NOT_EMPTY 0x8001005A
#define SCE_ERROR_ERRNO_NAME_TOO_LONG 0x8001005B /* File name or path name too long */
#define SCE_ERROR_ERRNO_TOO_MANY_SYMBOLIC_LINKS 0x8001005C
#define SCE_ERROR_ERRNO_CONNECTION_RESET 0x80010068
#define SCE_ERROR_ERRNO_NO_FREE_BUF_SPACE 0x80010069
#define SCE_ERROR_ERRNO_ESHUTDOWN 0x8001006E /* Error sending package after socket was shutdown */
#define SCE_ERROR_ERRNO_EADDRINUSE 0x80010070 /* The address is already in use. */
#define SCE_ERROR_ERRNO_CONNECTION_ABORTED 0x80010071 /* Connection was aborted by software. */
#define SCE_ERROR_ERRNO_ETIMEDOUT 0x80010074 /* Operation timed out. */
#define SCE_ERROR_ERRNO_IN_PROGRESS 0x80010077
#define SCE_ERROR_ERRNO_ALREADY 0x80010078
#define SCE_ERROR_ERRNO_INVALID_PROTOCOL 0x8001007B /* Protocol is not supported. */
#define SCE_ERROR_ERRNO_INVALID_SOCKET_TYPE 0x8001007C /* Unsupported socket type. */
#define SCE_ERROR_ERRNO_ADDRESS_NOT_AVAILABLE 0x8001007D
#define SCE_ERROR_ERRNO_IS_ALREADY_CONNECTED 0x8001007F
#define SCE_ERROR_ERRNO_NOT_CONNECTED 0x80010080
#define SCE_ERROR_ERRNO_FILE_QUOTA_EXCEEDED 0x80010084
#define SCE_ERROR_ERRNO_NOT_SUPPORTED 0x80010086
#define SCE_ERROR_ERRNO_ENOMEDIUM 0x80010087 /* No medium was found. */
/*
* Non-standard error code definitions
*/
#define SCE_ERROR_ERRNO_ADDR_OUT_OF_MAIN_MEM 0x8001B001
#define SCE_ERROR_ERRNO_INVALID_UNIT_NUM 0x8001B002
#define SCE_ERROR_ERRNO_INVALID_FILE_SIZE 0x8001B003
#define SCE_ERROR_ERRNO_INVALID_FLAG 0x8001B004
#define SCE_ERROR_ERRNO_NO_CACHE 0x8001B005
#define SCE_ERROR_ERRNO_WRONG_MEDIUM_TYPE 0x8001B006
/*
* Flash memory (UMD, MS) up to 1.5.0 mistakenly had returned these values.
*/
#define SCE_ERROR_ERRNO150_ENAMETOOLONG 0x80010024
#define SCE_ERROR_ERRNO150_EADDRINUSE 0x80010062
#define SCE_ERROR_ERRNO150_ECONNABORTED 0x80010067
#define SCE_ERROR_ERRNO150_ETIMEDOUT 0x8001006E
#define SCE_ERROR_ERRNO150_ENOMEDIUM 0x8001007B
#define SCE_ERROR_ERRNO150_EMEDIUMTYPE 0x8001007C
#define SCE_ERROR_ERRNO150_ENOTSUP 0x8001B000
/*
* Error definitions belonging to SCE_ERROR_FACILITY_KERNEL
*/
#define SCE_ERROR_KERNEL_ERROR 0x80020001
#define SCE_ERROR_KERNEL_NOT_IMPLEMENTED 0x80020002
#define SCE_ERROR_KERNEL_ILLEGAL_EXPCODE 0x80020032
#define SCE_ERROR_KERNEL_EXPHANDLER_NOUSE 0x80020033
#define SCE_ERROR_KERNEL_EXPHANDLER_USED 0x80020034
#define SCE_ERROR_KERNEL_SYSCALLTABLE_NOUSED 0x80020035
#define SCE_ERROR_KERNEL_SYSCALLTABLE_ALREADY_REGISTERED 0x80020036
#define SCE_ERROR_KERNEL_INVALID_SYSCALLTABLE 0x80020037
#define SCE_ERROR_KERNEL_INVALID_SYSCALL_ID 0x80020038
#define SCE_ERROR_KERNEL_SYSCALL_HANDLER_ALREADY_EXISTS 0x80020039
#define SCE_ERROR_KERNEL_INVALID_NMI 0x8002003A
#define SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT 0x80020064
#define SCE_ERROR_KERNEL_INVALID_INTERRUPT 0x80020065
#define SCE_ERROR_KERNEL_INTERRUPTS_ALREADY_DISABLED 0x80020066
#define SCE_ERROR_KERNEL_HANDLER_ALREADY_EXISTS 0x80020067
#define SCE_ERROR_KERNEL_HANDLER_NOTFOUND 0x80020068
#define SCE_ERROR_KERNEL_INVALID_INTERRUPT_LEVEL 0x80020069
#define SCE_ERROR_KERNEL_INVALID_INTERRUPT_ARGUMENT 0x8002006B
#define SCE_ERROR_KERNEL_INVALID_STACK_ADDRESS 0x8002006C
#define SCE_ERROR_KERNEL_STACK_ALREADY_SET 0x8002006D
#define SCE_ERROR_KERNEL_NO_TIMER 0x80020096
#define SCE_ERROR_KERNEL_ILLEGAL_TIMER_ID 0x80020097
#define SCE_ERROR_KERNEL_ILLEGAL_PRESCALE 0x80020099
#define SCE_ERROR_KERNEL_TIMER_BUSY 0x8002009A
#define SCE_ERROR_KERNEL_TIMER_NOT_SETUP 0x8002009B
#define SCE_ERROR_KERNEL_TIMER_NOT_INUSE 0x8002009C
#define SCE_ERROR_KERNEL_UNIT_USED 0x800200A0
#define SCE_ERROR_KERNEL_UNIT_NOUSE 0x800200A1
#define SCE_ERROR_KERNEL_UNIT_NO_ROMDIR 0x800200A2
#define SCE_ERROR_KERNEL_UIDTYPE_ALREADY_EXISTS 0x800200C8
#define SCE_ERROR_KERNEL_UIDTYPE_NOT_FOUND 0x800200C9
#define SCE_ERROR_KERNEL_UIDTYPE_NOT_EMPTY 0x800200CA
#define SCE_ERROR_KERNEL_UNKNOWN_UID 0x800200CB
#define SCE_ERROR_KERNEL_UNMATCH_TYPE_UID 0x800200CC
#define SCE_ERROR_KERNEL_NOT_EXIST_ID 0x800200CD
#define SCE_ERROR_KERNEL_NOT_FOUND_FUNCTION_UID 0x800200CE
#define SCE_ERROR_KERNEL_ALREADY_HOLDER_UID 0x800200CF
#define SCE_ERROR_KERNEL_NOT_HOLDER_UID 0x800200D0
#define SCE_ERROR_KERNEL_ILLEGAL_PERMISSION 0x800200D1
#define SCE_ERROR_KERNEL_ILLEGAL_ARGUMENT 0x800200D2
#define SCE_ERROR_KERNEL_ILLEGAL_ADDR 0x800200D3
#define SCE_ERROR_KERNEL_MEMORY_AREA_OUT_OF_RANGE 0x800200D4
#define SCE_ERROR_KERNEL_MEMORY_AREA_IS_OVERLAP 0x800200D5
#define SCE_ERROR_KERNEL_ILLEGAL_PARTITION_ID 0x800200D6
#define SCE_ERROR_KERNEL_PARTITION_IN_USE 0x800200D7
#define SCE_ERROR_KERNEL_ILLEGAL_MEMBLOCK_ALLOC_TYPE 0x800200D8
#define SCE_ERROR_KERNEL_FAILED_ALLOC_MEMBLOCK 0x800200D9
#define SCE_ERROR_KERNEL_INHIBITED_RESIZE_MEMBLOCK 0x800200DA
#define SCE_ERROR_KERNEL_FAILED_RESIZE_MEMBLOCK 0x800200DB
#define SCE_ERROR_KERNEL_FAILED_ALLOC_HEAPBLOCK 0x800200DC
#define SCE_ERROR_KERNEL_FAILED_ALLOC_HEAP 0x800200DD
#define SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID 0x800200DE
#define SCE_ERROR_KERNEL_CANNOT_FIND_CHUNK_NAME 0x800200DF
#define SCE_ERROR_KERNEL_NO_FREE_CHUNK 0x800200E0
#define SCE_ERROR_KERNEL_MEMBLOCK_FRAGMENTED 0x800200E1
#define SCE_ERROR_KERNEL_MEMBLOCK_CANNOT_JOINT 0x800200E2
#define SCE_ERROR_KERNEL_MEMBLOCK_CANNOT_SEPARATE 0x800200E3
#define SCE_ERROR_KERNEL_ILLEGAL_ALIGNMENT_SIZE 0x800200E4
#define SCE_ERROR_KERNEL_ILLEGAL_DEVKIT_VER 0x800200E5
#define SCE_ERROR_KERNEL_MODULE_LINK_ERROR 0x8002012C
#define SCE_ERROR_KERNEL_ILLEGAL_OBJECT_FORMAT 0x8002012D
#define SCE_ERROR_KERNEL_UNKNOWN_MODULE 0x8002012E
#define SCE_ERROR_KERNEL_UNKNOWN_MODULE_FILE 0x8002012F
#define SCE_ERROR_KERNEL_FILE_READ_ERROR 0x80020130
#define SCE_ERROR_KERNEL_MEMORY_IN_USE 0x80020131
#define SCE_ERROR_KERNEL_PARTITION_MISMATCH 0x80020132
#define SCE_ERROR_KERNEL_MODULE_ALREADY_STARTED 0x80020133
#define SCE_ERROR_KERNEL_MODULE_NOT_STARTED 0x80020134
#define SCE_ERROR_KERNEL_MODULE_ALREADY_STOPPED 0x80020135
#define SCE_ERROR_KERNEL_MODULE_CANNOT_STOP 0x80020136
#define SCE_ERROR_KERNEL_MODULE_NOT_STOPPED 0x80020137
#define SCE_ERROR_KERNEL_MODULE_CANNOT_REMOVE 0x80020138
#define SCE_ERROR_KERNEL_EXCLUSIVE_LOAD 0x80020139
#define SCE_ERROR_KERNEL_LIBRARY_IS_NOT_LINKED 0x8002013A
#define SCE_ERROR_KERNEL_LIBRARY_ALREADY_EXISTS 0x8002013B
#define SCE_ERROR_KERNEL_LIBRARY_NOT_FOUND 0x8002013C
#define SCE_ERROR_KERNEL_ILLEGAL_LIBRARY_HEADER 0x8002013D
#define SCE_ERROR_KERNEL_LIBRARY_IN_USE 0x8002013E
#define SCE_ERROR_KERNEL_MODULE_ALREADY_STOPPING 0x8002013F
#define SCE_ERROR_KERNEL_ILLEGAL_OFFSET_VALUE 0x80020140
#define SCE_ERROR_KERNEL_ILLEGAL_POSITION_CODE 0x80020141
#define SCE_ERROR_KERNEL_ILLEGAL_ACCESS_CODE 0x80020142
#define SCE_ERROR_KERNEL_MODULE_MANAGER_BUSY 0x80020143
#define SCE_ERROR_KERNEL_ILLEGAL_FLAG 0x80020144
#define SCE_ERROR_KERNEL_CANNOT_GET_MODULE_LIST 0x80020145
#define SCE_ERROR_KERNEL_PROHIBIT_LOADMODULE_DEVICE 0x80020146
#define SCE_ERROR_KERNEL_PROHIBIT_LOADEXEC_DEVICE 0x80020147
#define SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE 0x80020148
#define SCE_ERROR_KERNEL_ILLEGAL_PERMISSION_CALL 0x80020149
#define SCE_ERROR_KERNEL_CANNOT_GET_MODULE_INFO 0x8002014A
#define SCE_ERROR_KERNEL_ILLEGAL_LOADEXEC_BUFFER 0x8002014B
#define SCE_ERROR_KERNEL_ILLEGAL_LOADEXEC_FILENAME 0x8002014C
#define SCE_ERROR_KERNEL_NO_EXIT_CALLBACK 0x8002014D
#define SCE_ERROR_KERNEL_MEDIA_CHANGED 0x8002014E
#define SCE_ERROR_KERNEL_CANNOT_USE_BETA_VER_MODULE 0x8002014F
#define SCE_ERROR_KERNEL_NO_MEMORY 0x80020190
#define SCE_ERROR_KERNEL_ILLEGAL_ATTR 0x80020191
#define SCE_ERROR_KERNEL_ILLEGAL_THREAD_ENTRY_ADDR 0x80020192
#define SCE_ERROR_KERNEL_ILLEGAL_PRIORITY 0x80020193
#define SCE_ERROR_KERNEL_ILLEGAL_STACK_SIZE 0x80020194
#define SCE_ERROR_KERNEL_ILLEGAL_MODE 0x80020195
#define SCE_ERROR_KERNEL_ILLEGAL_MASK 0x80020196
#define SCE_ERROR_KERNEL_ILLEGAL_THREAD 0x80020197
#define SCE_ERROR_KERNEL_NOT_FOUND_THREAD 0x80020198
#define SCE_ERROR_KERNEL_NOT_FOUND_SEMAPHORE 0x80020199
#define SCE_ERROR_KERNEL_NOT_FOUND_EVENT_FLAG 0x8002019A
#define SCE_ERROR_KERNEL_NOT_FOUND_MESSAGE_BOX 0x8002019B
#define SCE_ERROR_KERNEL_NOT_FOUND_VPOOL 0x8002019C
#define SCE_ERROR_KERNEL_NOT_FOUND_FPOOL 0x8002019D
#define SCE_ERROR_KERNEL_NOT_FOUND_MESSAGE_PIPE 0x8002019E
#define SCE_ERROR_KERNEL_NOT_FOUND_ALARM 0x8002019F
#define SCE_ERROR_KERNEL_NOT_FOUND_THREAD_EVENT_HANDLER 0x800201A0
#define SCE_ERROR_KERNEL_NOT_FOUND_CALLBACK 0x800201A1
#define SCE_ERROR_KERNEL_THREAD_ALREADY_DORMANT 0x800201A2
#define SCE_ERROR_KERNEL_THREAD_ALREADY_SUSPEND 0x800201A3
#define SCE_ERROR_KERNEL_THREAD_IS_NOT_DORMANT 0x800201A4
#define SCE_ERROR_KERNEL_THREAD_IS_NOT_SUSPEND 0x800201A5
#define SCE_ERROR_KERNEL_THREAD_IS_NOT_WAIT 0x800201A6
#define SCE_ERROR_KERNEL_WAIT_CAN_NOT_WAIT 0x800201A7
#define SCE_ERROR_KERNEL_WAIT_TIMEOUT 0x800201A8
#define SCE_ERROR_KERNEL_WAIT_CANCELLED 0x800201A9
#define SCE_ERROR_KERNEL_WAIT_STATUS_RELEASED 0x800201AA
#define SCE_ERROR_KERNEL_WAIT_STATUS_RELEASED_CALLBACK 0x800201AB
#define SCE_ERROR_KERNEL_THREAD_IS_TERMINATED 0x800201AC
#define SCE_ERROR_KERNEL_SEMA_ZERO 0x800201AD
#define SCE_ERROR_KERNEL_SEMA_OVERFLOW 0x800201AE
#define SCE_ERROR_KERNEL_EVENT_FLAG_POLL_FAILED 0x800201AF
#define SCE_ERROR_KERNEL_EVENT_FLAG_NO_MULTI_PERM 0x800201B0
#define SCE_ERROR_KERNEL_EVENT_FLAG_ILLEGAL_WAIT_PATTERN 0x800201B1
#define SCE_ERROR_KERNEL_MESSAGEBOX_NO_MESSAGE 0x800201B2
#define SCE_ERROR_KERNEL_MESSAGE_PIPE_FULL 0x800201B3
#define SCE_ERROR_KERNEL_MESSAGE_PIPE_EMPTY 0x800201B4
#define SCE_ERROR_KERNEL_WAIT_DELETE 0x800201B5
#define SCE_ERROR_KERNEL_ILLEGAL_MEMBLOCK 0x800201B6
#define SCE_ERROR_KERNEL_ILLEGAL_MEMSIZE 0x800201B7
#define SCE_ERROR_KERNEL_ILLEGAL_SCRATCHPAD_ADDR 0x800201B8
#define SCE_ERROR_KERNEL_SCRATCHPAD_IN_USE 0x800201B9
#define SCE_ERROR_KERNEL_SCRATCHPAD_NOT_IN_USE 0x800201BA
#define SCE_ERROR_KERNEL_ILLEGAL_TYPE 0x800201BB
#define SCE_ERROR_KERNEL_ILLEGAL_SIZE 0x800201BC
#define SCE_ERROR_KERNEL_ILLEGAL_COUNT 0x800201BD
#define SCE_ERROR_KERNEL_NOT_FOUND_VTIMER 0x800201BE
#define SCE_ERROR_KERNEL_ILLEGAL_VTIMER 0x800201BF
#define SCE_ERROR_KERNEL_ILLEGAL_KTLS 0x800201C0
#define SCE_ERROR_KERNEL_KTLS_IS_FULL 0x800201C1
#define SCE_ERROR_KERNEL_KTLS_IS_BUSY 0x800201C2
#define SCE_ERROR_KERNEL_MUTEX_NOT_FOUND 0x800201C3
#define SCE_ERROR_KERNEL_MUTEX_LOCKED 0x800201C4
#define SCE_ERROR_KERNEL_MUTEX_UNLOCKED 0x800201C5
#define SCE_ERROR_KERNEL_MUTEX_LOCK_OVERFLOW 0x800201C6
#define SCE_ERROR_KERNEL_MUTEX_UNLOCK_UNDERFLOW 0x800201C7
#define SCE_ERROR_KERNEL_MUTEX_RECURSIVE_NOT_ALLOWED 0x800201C8
#define SCE_ERROR_KERNEL_MESSAGEBOX_DUPLICATE_MESSAGE 0x800201C9
#define SCE_ERROR_KERNEL_LWMUTEX_NOT_FOUND 0x800201CA
#define SCE_ERROR_KERNEL_LWMUTEX_LOCKED 0x800201CB
#define SCE_ERROR_KERNEL_LWMUTEX_UNLOCKED 0x800201CC
#define SCE_ERROR_KERNEL_LWMUTEX_LOCK_OVERFLOW 0x800201CD
#define SCE_ERROR_KERNEL_LWMUTEX_UNLOCK_UNDERFLOW 0x800201CE
#define SCE_ERROR_KERNEL_LWMUTEX_RECURSIVE_NOT_ALLOWED 0x800201CF
#define SCE_ERROR_KERNEL_UNKNOWN_TLSPLID 0x800201D0
#define SCE_ERROR_KERNEL_UTLS_FULL 0x800201D1
#define SCE_ERROR_KERNEL_UTLS_BUSY 0x800201D2
#define SCE_ERROR_KERNEL_PM_INVALID_PRIORITY 0x80020258
#define SCE_ERROR_KERNEL_PM_INVALID_DEVNAME 0x80020259
#define SCE_ERROR_KERNEL_PM_UNKNOWN_DEVNAME 0x8002025A
#define SCE_ERROR_KERNEL_PM_PMINFO_REGISTERED 0x8002025B
#define SCE_ERROR_KERNEL_PM_PMINFO_UNREGISTERED 0x8002025C
#define SCE_ERROR_KERNEL_PM_INVALID_MAJOR_STATE 0x8002025D
#define SCE_ERROR_KERNEL_PM_INVALID_REQUEST 0x8002025E
#define SCE_ERROR_KERNEL_PM_UNKNOWN_REQUEST 0x8002025F
#define SCE_ERROR_KERNEL_PM_INVALID_UNIT 0x80020260
#define SCE_ERROR_KERNEL_PM_CANNOT_CANCEL 0x80020261
#define SCE_ERROR_KERNEL_PM_INVALID_PMINFO 0x80020262
#define SCE_ERROR_KERNEL_PM_INVALID_ARGUMENT 0x80020263
#define SCE_ERROR_KERNEL_PM_ALREADY_TARGET_PWRSTATE 0x80020264
#define SCE_ERROR_KERNEL_PM_CHANGE_PWRSTATE_FAILED 0x80020265
#define SCE_ERROR_KERNEL_PM_CANNOT_CHANGE_DEVPWR_STATE 0x80020266
#define SCE_ERROR_KERNEL_PM_NO_SUPPORT_DEVPWR_STATE 0x80020267
#define SCE_ERROR_KERNEL_DMAC_REQUEST_FAILED 0x800202BC
#define SCE_ERROR_KERNEL_DMAC_REQUEST_DENIED 0x800202BD
#define SCE_ERROR_KERNEL_DMAC_OP_QUEUED 0x800202BE
#define SCE_ERROR_KERNEL_DMAC_OP_NOT_QUEUED 0x800202BF
#define SCE_ERROR_KERNEL_DMAC_OP_RUNNING 0x800202C0
#define SCE_ERROR_KERNEL_DMAC_OP_NOT_ASSIGNED 0x800202C1
#define SCE_ERROR_KERNEL_DMAC_OP_TIMEOUT 0x800202C2
#define SCE_ERROR_KERNEL_DMAC_OP_FREED 0x800202C3
#define SCE_ERROR_KERNEL_DMAC_OP_USED 0x800202C4
#define SCE_ERROR_KERNEL_DMAC_OP_EMPTY 0x800202C5
#define SCE_ERROR_KERNEL_DMAC_OP_ABORTED 0x800202C6
#define SCE_ERROR_KERNEL_DMAC_OP_ERROR 0x800202C7
#define SCE_ERROR_KERNEL_DMAC_CHANNEL_RESERVED 0x800202C8
#define SCE_ERROR_KERNEL_DMAC_CHANNEL_EXCLUDED 0x800202C9
#define SCE_ERROR_KERNEL_DMAC_PRIVILEGE_ADDRESS 0x800202CA
#define SCE_ERROR_KERNEL_DMAC_NO_ENOUGHSPACE 0x800202CB
#define SCE_ERROR_KERNEL_DMAC_CHANNEL_NOT_ASSIGNED 0x800202CC
#define SCE_ERROR_KERNEL_DMAC_CHILD_OPERATION 0x800202CD
#define SCE_ERROR_KERNEL_DMAC_TOO_MUCH_SIZE 0x800202CE
#define SCE_ERROR_KERNEL_DMAC_INVALID_ARGUMENT 0x800202CF
#define SCE_ERROR_KERNEL_TOO_MANY_OPEN_FILES 0x80020320
#define SCE_ERROR_KERNEL_NO_SUCH_DEVICE 0x80020321
#define SCE_ERROR_KERNEL_XDEV 0x80020322
#define SCE_ERROR_KERNEL_BAD_FILE_DESCRIPTOR 0x80020323
#define SCE_ERROR_KERNEL_INVALID_ARGUMENT 0x80020324
#define SCE_ERROR_KERNEL_UNSUPPORTED_OPERATION 0x80020325
#define SCE_ERROR_KERNEL_ALIAS_USED 0x80020326
#define SCE_ERROR_KERNEL_DRIVER_DELETED 0x80020328
#define SCE_ERROR_KERNEL_ASYNC_BUSY 0x80020329
#define SCE_ERROR_KERNEL_NO_ASYNC_OP 0x8002032A
#define SCE_ERROR_KERNEL_REGDEV 0x8002032B
#define SCE_ERROR_KERNEL_NOCWD 0x8002032C
#define SCE_ERROR_KERNEL_FILENAME_TOO_LONG 0x8002032D
#define SCE_ERROR_KERNEL_STDIO_NOT_OPENED 0x80020384
#define SCE_ERROR_KERNEL_DECI2P_UNKNOWN_SID 0x800203E8
#define SCE_ERROR_KERNEL_DECI2P_ALREADYUSE_PROTOCOL 0x800203E9
#define SCE_ERROR_KERNEL_DECI2P_TOOMANY_PROTOCOL 0x800203EA
#define SCE_ERROR_KERNEL_DECI2P_TOOSMALL_BUFFER 0x800203EB
#define SCE_ERROR_KERNEL_DECI2P_INVALID_PROTOCOL 0x800203EC
#define SCE_ERROR_KERNEL_DECI2P_INVALID_HEADER 0x800203ED
#define SCE_ERROR_KERNEL_DECI2P_NO_ROUTE 0x800203EE
#define SCE_ERROR_KERNEL_DECI2P_NO_SPACE 0x800203EF
#define SCE_ERROR_KERNEL_DECI2P_NO_HOSTIF 0x800203F0
#define SCE_ERROR_KERNEL_NOT_CACHE_ALIGNED 0x8002044C
#define SCE_ERROR_KERNEL_MAX_ERROR 0x8002044D
/*
* Error-similar definitions.
*/
#define SCE_KERNEL_VALUE_UNITIALIZED (-1)
#define SCE_KERNEL_PTR_UNITIALIZED ((void *)SCE_KERNEL_VALUE_UNITIALIZED)

View File

@ -21,3 +21,121 @@
#define HW_RESET_VECTOR 0xBFC00000
#define HW_RESET_VECTOR_SIZE (0x1000)
/*
* GE hardware registers
*/
/*
* Main GE stuff
*/
// RW bit 1: set to 1 to reset, wait until bit is 0 to know the GE has been reset
#define HW_GE_RESET HW(0xBD400000)
// Unknown (possibly read-only?); accessible through sceGeSet/GetReg() (SCE_GE_REG_UNK004),
// saved on suspend and passed in the interrupt handling functions but never used
#define HW_GE_UNK004 HW(0xBD400004)
// RO bits 0x0000FFFF: shifted left by 10, gives the EDRAM hardware size
// (sceGeEdramGetHwSize()) (only used for tachyon < 0x00500000)
#define HW_GE_EDRAM_HW_SIZE HW(0xBD400008)
/*
* GE execution/display list handling
*/
// RW bit 0x001: 0 = stopped, 1 = running
// R bit 0x002: 0 = branching condition true, 1 = false
// R bit 0x100: 1 = is at depth 1 (or 2) of calls
// R bit 0x200: 1 = is at depth 2 of calls
#define HW_GE_EXEC HW(0xBD400100)
#define HW_GE_EXEC_RUNNING 0x001
#define HW_GE_EXEC_BRANCHING 0x002
#define HW_GE_EXEC_DEPTH1 0x100
#define HW_GE_EXEC_DEPTH2 0x200
// Never used, accessible through sceGeSet/GetReg() (SCE_GE_REG_UNK104)
#define HW_GE_UNK104 HW(0xBD400104)
// RW: address of the display list currently being run (not sure if it's the current point of
// execution or the starting address)
#define HW_GE_LISTADDR HW(0xBD400108)
// RW: stall address of the display list (0 = no stall address)
#define HW_GE_STALLADDR HW(0xBD40010C)
// RW: first return address (after the first CALL command)
#define HW_GE_RADR1 HW(0xBD400110)
// RW: second return address (after the second CALL command)
#define HW_GE_RADR2 HW(0xBD400114)
// RW: address of vertices (for bezier etc)
#define HW_GE_VADR HW(0xBD400118)
// RW: address of indices (for bezier etc)
#define HW_GE_IADR HW(0xBD40011C)
// RW: address of the origin (set by ORIGIN, destination address for JUMP/BJUMP/CALL after adding BASE and the address specified in the command)
#define HW_GE_OADR HW(0xBD400120)
// RW: same, for the first call
#define HW_GE_OADR1 HW(0xBD400124)
// RW: same, for the second call
#define HW_GE_OADR2 HW(0xBD400128)
/*
* GE geometry clock
*/
// RW, bit 1 set by sceGeSetGeometryClock(), exact usage unknown
#define HW_GE_GEOMETRY_CLOCK HW(0xBD400200)
// Never used, accessible through sceGeSet/GetReg() (SCE_GE_REG_UNK300)
#define HW_GE_UNK300 HW(0xBD400300)
// RO memory for the commands
// Each type a command is executed by the GE, its value, including arguments,
// is saved there.
#define HW_GE_CMD(i) HW(0xBD400800 + i * 4)
// RO registers for the different matrices
#define HW_GE_BONES ((vs32*)HWPTR(0xBD400C00))
#define HW_GE_BONE(i) ((vs32*)HWPTR(0xBD400C00 + i * 48))
#define HW_GE_WORLDS ((vs32*)HWPTR(0xBD400D80))
#define HW_GE_VIEWS ((vs32*)HWPTR(0xBD400DB0))
#define HW_GE_PROJS ((vs32*)HWPTR(0xBD400DE0))
#define HW_GE_TGENS ((vs32*)HWPTR(0xBD400E20))
// Interrupt statuses
// Triggered by the SIGNAL command
#define HW_GE_INTSIG 1
// Triggered by the END command
#define HW_GE_INTEND 2
// Triggered by the FINISH command
#define HW_GE_INTFIN 4
// Triggered by an error (?)
#define HW_GE_INTERR 8
// RO: current interrupt status?
#define HW_GE_INTERRUPT_TYPE1 HW(0xBD400304)
// RW: currently accepted interrupts?
// Set to HW_GE_INTSIG | HW_GE_INTEND | HW_GE_INTFIN on init & reset
#define HW_GE_INTERRUPT_TYPE2 HW(0xBD400308)
// WO: set to HW_GE_INTERRUPT_TYPE2 on init & reset
#define HW_GE_INTERRUPT_TYPE3 HW(0xBD40030C)
// WO: set current interrupt status? set to HW_GE_INTERRUPT_TYPE1 on init & reset
#define HW_GE_INTERRUPT_TYPE4 HW(0xBD400310)
// RW: set to 4 when the used edram size is 0x00200000 and 2 when it's 0x00400000 (!)
#define HW_GE_EDRAM_ENABLED_SIZE HW(0xBD400400)
// RW: unknown, bits 0x00F00000 set by sceGeEdramSetRefreshParam's 4th argument
#define HW_GE_EDRAM_REFRESH_UNK1 HW(0xBD500000)
// RW: set to 2 before reset and 0 after reset is done, bit 1 seems to be initialization
// (used by sceGeEdramInit())
#define HW_GE_EDRAM_UNK10 HW(0xBD500010)
// RW, set to 0x6C4 by default and bits 0x007FFFFF set by sceGeEdramSetRefreshParam's second argument
#define HW_GE_EDRAM_REFRESH_UNK2 HW(0xBD500020)
// RW, bits 0x000003FF set by sceGeEdramSetRefreshParam's third argument
#define HW_GE_EDRAM_REFRESH_UNK3 HW(0xBD500030)
// RW, set to 1 in sceGeEdramInit(), and to 3 if sceGeEdramSetRefreshParam's first argument (mode) is 1
// and the bit 2 isn't set
#define HW_GE_EDRAM_UNK40 HW(0xBD500040)
// Unknown, accessible through sceGeSetReg/GetReg() (SCE_GE_REG_EDRAM_UNK50)
#define HW_GE_EDRAM_UNK50 HW(0xBD500050)
// Unknown, accessible through sceGeSetReg/GetReg() (SCE_GE_REG_EDRAM_UNK60)
#define HW_GE_EDRAM_UNK60 HW(0xBD500060)
// RW bit 1: disable address translation
#define HW_GE_EDRAM_ADDR_TRANS_DISABLE HW(0xBD500070)
// RW: the address translation value
#define HW_GE_EDRAM_ADDR_TRANS_VALUE HW(0xBD500080)
// Unknown, set to 3 in sceGeEdramInit(), accessible through sceGeSetReg/GetReg() (SCE_GE_REG_EDRAM_UNK90)
#define HW_GE_EDRAM_UNK90 HW(0xBD500090)
// Unknown, accessible through sceGeSetReg/GetReg() (SCE_GE_REG_EDRAM_UNKA0)
#define HW_GE_EDRAM_UNKA0 HW(0xBD5000A0)

View File

@ -1,70 +1,86 @@
/* Copyright (C) 2011, 2012 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef COMMON_INCLUDED
# error "Only include common_imp.h or common_header.h!"
#endif
inline static s32 pspMax(s32 a, s32 b)
{
s32 ret;
asm __volatile__ ("max %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b));
return ret;
}
inline static s32 pspMin(s32 a, s32 b)
{
s32 ret;
asm __volatile__ ("min %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b));
return ret;
}
inline static void pspSync(void)
{
asm __volatile__ ("sync");
}
inline static void pspCache(char op, const void *ptr)
{
asm __volatile__ ("cache %0, 0(%1)" : : "ri" (op), "r" (ptr));
}
inline static void pspBreak(s32 op)
{
asm __volatile__ ("break %0" : : "ri" (op));
}
inline static void pspHalt(void)
{
/* The 'HALT' instruction */
asm __volatile__ (".word 0x70000000");
}
inline static s32 pspMfic(void)
{
s32 ret;
asm __volatile__ ("mfic %0, $0" : "=r" (ret));
return ret;
}
inline static s32 pspLl(s32 *ptr)
{
s32 ret;
asm __volatile__ ("ll %0, (%1)" : "=r" (ret) : "r" (ptr));
return ret;
}
inline static s32 pspSc(s32 value, s32 *ptr)
{
s32 ret = value;
asm __volatile__ ("sc %0, (%1)" : "=r" (ret) : "r" (ptr));
return ret;
}
inline static u32 pspWsbw(u32 value)
{
asm __volatile__ ("wsbw %0, %0" : "=r" (value) : "r" (value));
return value;
}
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef COMMON_INCLUDED
# error "Only include common_imp.h or common_header.h!"
#endif
inline static s32 pspMax(s32 a, s32 b)
{
s32 ret;
asm __volatile__ ("max %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b));
return ret;
}
inline static s32 pspMin(s32 a, s32 b)
{
s32 ret;
asm __volatile__ ("min %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b));
return ret;
}
inline static void pspSync(void)
{
asm __volatile__ ("sync");
}
inline static void pspCache(char op, const void *ptr)
{
asm __volatile__ ("cache %0, 0(%1)" : : "ri" (op), "r" (ptr));
}
/*
* BREAK instruction
*
* 31 26 25 6 5 0
* +------+---------------------+------+
* |000000| break code |001101|
* +------+---------------------+------+
*/
/* break codes */
#define SCE_BREAKCODE_ZERO 0x00000
#define SCE_BREAKCODE_ONE 0x00001
#define SCE_BREAKCODE_DIVZERO 0x00007 /* Divide by zero check. */
#define MAKE_BREAKCODE_INSTR(op) ((((op) & 0xFFFFF) << 6) | 0xD)
inline static void pspBreak(s32 op)
{
asm __volatile__ ("break %0" : : "ri" (op));
}
inline static void pspHalt(void)
{
/* The 'HALT' instruction */
asm __volatile__ (".word 0x70000000");
}
inline static s32 pspMfic(void)
{
s32 ret;
asm __volatile__ ("mfic %0, $0" : "=r" (ret));
return ret;
}
inline static s32 pspLl(s32 *ptr)
{
s32 ret;
asm __volatile__ ("ll %0, (%1)" : "=r" (ret) : "r" (ptr));
return ret;
}
inline static s32 pspSc(s32 value, s32 *ptr)
{
s32 ret = value;
asm __volatile__ ("sc %0, (%1)" : "=r" (ret) : "r" (ptr));
return ret;
}
inline static u32 pspWsbw(u32 value)
{
asm __volatile__ ("wsbw %0, %0" : "=r" (value) : "r" (value));
return value;
}

View File

@ -20,11 +20,11 @@
#define K3_SIZE 0x20000000 /* 512 MB */
/* Scratchpad segment base address and size */
#define SCE_SCRATCHPAD_ADDR 0x00010000 /* Physical memory */
#define SCE_SCRATCHPAD_ADDR_KU0 0x00010000 /* KU segment 0 (cached) */
#define SCE_SCRATCHPAD_ADDR_KU1 0x40010000 /* KU segment 1 (uncached) */
#define SCE_SCRATCHPAD_ADDR 0x00010000 /* Physical memory */
#define SCE_SCRATCHPAD_ADDR_KU0 0x00010000 /* KU segment 0 (cached) */
#define SCE_SCRATCHPAD_ADDR_KU1 0x40010000 /* KU segment 1 (uncached) */
#define SCE_SCRATCHPAD_ADDR_K0 0x80010000 /* K0 segment (cached) */
#define SCE_SCRATCHPAD_SIZE 0x00004000 /* 16 KB */
#define SCE_SCRATCHPAD_SIZE 0x00004000 /* 16 KB */
#define REBOOT_BASE_ADDR_K0 0x88600000 /* K0 segment (cached) */
@ -49,3 +49,57 @@
#define UPALIGN8(v) (((v) + 0x7) & 0xFFFFFFF8)
#define UPALIGN4(v) (((v) + 0x3) & 0xFFFFFFFC)
#define ISALIGN4(v) (((u32)(v) & 0x03) == 0)
/* Clear memory partitioned in 1-Byte blocks. */
static inline void pspClearMemory8(void *ptr, int size) {
int i;
for (i = 0; i < size; i++)
((u8 *)ptr)[i] = 0;
}
/* Clear memory partitioned in 2-Byte blocks. */
static inline void pspClearMemory16(void *ptr, int size) {
int i;
for (i = 0; i < (int)(size / sizeof(u16)); i++)
((u16 *)ptr)[i] = 0;
}
/* Clear memory partitioned in 4-Byte blocks. */
static inline void pspClearMemory32(void *ptr, int size) {
int i;
for (i = 0; i < (int)(size / sizeof(u32)); i++)
((u32 *)ptr)[i] = 0;
}
// TODO: Remove size handling in above's clear functions.
// Replace instances of above functions with this one.
static inline void pspClearMemory(void *ptr, int size) {
if (size % 4 == 0)
pspClearMemory32(ptr, size / 4);
else if (size % 2 == 0)
pspClearMemory16(ptr, size / 2);
else
pspClearMemory8(ptr, size);
}
/* If we believe in the sysmem NIDs, 04g+ seem to have a "L2" cache
* we can send commands to through this address */
#define L2_CACHE_CMD (vu32*)0xA7F00000
static inline void pspL2CacheWriteback0(void *ptr, u8 align) {
*L2_CACHE_CMD = 0xA0000000 | ((u32)ptr & 0x07FFFFC0) | align;
*L2_CACHE_CMD;
}
static inline void pspL2CacheWriteback1(void *ptr, u8 align) {
*L2_CACHE_CMD = 0xA0000000 | 0x08000000 | ((u32)ptr & 0x07FFFFC0) | align;
*L2_CACHE_CMD;
}
static inline void pspL2CacheWriteback10(void *ptr, u8 align) {
*L2_CACHE_CMD = 0xA0000000 | 0x08000000 | ((u32)ptr & 0x07FFFFC0) | align;
*L2_CACHE_CMD = 0xA0000000 | ((u32)ptr & 0x07FFFFC0) | align;
*L2_CACHE_CMD;
}

View File

@ -1,166 +1,186 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef COMMON_INCLUDED
# error "Only include common_imp.h or common_header.h!"
#endif
#include "../pspmoduleexport.h"
/** The maximum length of a module name. */
#define SCE_MODULE_NAME_LEN (27)
/** SceModuleInfo.modVersion */
#define MODULE_VERSION_MINOR (0)
#define MODULE_VERSION_MAJOR (1)
#define MODULE_VERSION_NUMBER_CATEGORY_SIZE (2) /* current number category size */
/** Module Info section data. */
typedef struct {
/**
* The attributes of a module. Bitwise OR'ed values from ::SceModuleAttribute
* and ::SceModulePrivilegeLevel.
*/
u16 modAttribute;
/** The module version. Contains two number categories, minor, major. */
u8 modVersion[MODULE_VERSION_NUMBER_CATEGORY_SIZE];
/** The name of the module. */
char modName[SCE_MODULE_NAME_LEN];
/** Unknown. */
s8 terminal;
/** The global pointer of the module. */
void *gpValue;
/**
* Pointer to the first resident library entry table of the module.
* This section is known as ".lib.ent".
*/
void *entTop;
/**
* Pointer to the last line of the ,lib.ent section. This line is always 0 and
* is known as ".lib.ent.btm".
*/
void *entEnd;
/**
* Pointer to the first stub library entry table of the module.
* This section is known as "lib.stub".
*/
void *stubTop;
/**
* Pointer to the last line of the lib.stub section. This line is always 0 and
* is known as ".lib.stub.btm".
*/
void *stubEnd;
} SceModuleInfo;
/*
* Entry thread structure - an entry thread is used for executing the
* module entry functions.
*/
typedef struct {
/* The number of entry thread parameters, typically 3. */
u32 numParams;
/* The initial priority of the entry thread. */
u32 initPriority;
/* The stack size of the entry thread. */
u32 stackSize;
/* The attributes of the entry thread. */
u32 attr;
} SceModuleEntryThread;
extern char _gp[];
/**
* Module type attributes.
*/
enum SceModuleAttribute {
/** No module attributes. */
SCE_MODULE_ATTR_NONE = 0x0000,
/** Resident module - stays in memory. You cannot unload such a module. */
SCE_MODULE_ATTR_CANT_STOP = 0x0001,
/**
* Only one instance of the module (one version) can be loaded into the system. If you want to load another
* version of that module, you have to delete the loaded version first.
*/
SCE_MODULE_ATTR_EXCLUSIVE_LOAD = 0x0002,
/**
* Only one instance of the module (one version) can be started. If you want to start another
* version of that module, you have to stop the currently running version first.
*/
SCE_MODULE_ATTR_EXCLUSIVE_START = 0x0004,
};
/**
* Module Privilege Levels - These levels define the permissions a
* module can have.
*/
enum SceModulePrivilegeLevel {
/** Lowest permission. */
SCE_MODULE_USER = 0x0000,
/** POPS/Demo. */
SCE_MODULE_MS = 0x0200,
/** Module Gamesharing. */
SCE_MODULE_USB_WLAN = 0x0400,
/** Application module. */
SCE_MODULE_APP = 0x0600,
/** VSH module. */
SCE_MODULE_VSH = 0x0800,
/** Highest permission. */
SCE_MODULE_KERNEL = 0x1000,
/** The module uses KIRK's memlmd resident library. */
SCE_MODULE_KIRK_MEMLMD_LIB = 0x2000,
/** The module uses KIRK's semaphore resident library. */
SCE_MODULE_KIRK_SEMAPHORE_LIB = 0x4000,
};
#define SCE_MODINFO_SECTION_NAME ".rodata.sceModuleInfo"
/** Release X.Y.Z -> 0xXXYYZZZZ */
#define SDK_VERSION 0x06060010
#define SCE_SDK_VERSION(ver) const int module_sdk_version = ver
#define SCE_MODULE_BOOTSTART(name) int module_start(int arglen, void *argp) __attribute__((alias(name))); \
int module_bootstart(int arglen, void *argp) __attribute__((alias(name)))
#define SCE_MODULE_REBOOT_BEFORE(name) int module_reboot_before(void) __attribute__((alias(name)))
#define SCE_MODULE_REBOOT_PHASE(name) int module_reboot_phase(void) __attribute__((alias(name)))
#define SCE_MODULE_STOP(name) int module_stop(void) __attribute__((alias(name)))
#define SCE_MODULE_INFO(name, attributes, majorVersion, minorVersion) \
__asm__ ( \
" .set push\n" \
" .section .lib.ent.top, \"a\", @progbits\n" \
" .align 2\n" \
" .word 0\n" \
"__lib_ent_top:\n" \
" .section .lib.ent.btm, \"a\", @progbits\n" \
" .align 2\n" \
"__lib_ent_bottom:\n" \
" .word 0\n" \
" .section .lib.stub.top, \"a\", @progbits\n" \
" .align 2\n" \
" .word 0\n" \
"__lib_stub_top:\n" \
" .section .lib.stub.btm, \"a\", @progbits\n" \
" .align 2\n" \
"__lib_stub_bottom:\n" \
" .word 0\n" \
" .set pop\n" \
" .text\n" \
); \
extern char __lib_ent_top[], __lib_ent_bottom[]; \
extern char __lib_stub_top[], __lib_stub_bottom[]; \
const SceModuleInfo module_info \
__attribute__((section(SCE_MODINFO_SECTION_NAME), \
aligned(16), unused)) = { \
attributes, { minorVersion, majorVersion }, name, 0, _gp, \
__lib_ent_top, __lib_ent_bottom, \
__lib_stub_top, __lib_stub_bottom \
}
#define SCE_MODULE_START_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
const SceModuleEntryThread module_start_thread_parameter = { numParams, initPriority, stackSize, attr };
#define SCE_MODULE_STOP_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
const SceModuleEntryThread module_stop_thread_parameter = { numParams, initPriority, stackSize, attr };
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef COMMON_INCLUDED
# error "Only include common_imp.h or common_header.h!"
#endif
#include "../pspmoduleexport.h"
/** The maximum length of a module name. */
#define SCE_MODULE_NAME_LEN (27)
/** SceModuleInfo.modVersion */
#define MODULE_VERSION_MINOR (0)
#define MODULE_VERSION_MAJOR (1)
#define MODULE_VERSION_NUMBER_CATEGORY_SIZE (2) /* current number category size */
/** Module Info section data. */
typedef struct {
/**
* The attributes of a module. Bitwise OR'ed values from ::SceModuleAttribute
* and ::SceModulePrivilegeLevel.
*/
u16 modAttribute;
/** The module version. Contains two number categories, minor, major. */
u8 modVersion[MODULE_VERSION_NUMBER_CATEGORY_SIZE];
/** The name of the module. */
char modName[SCE_MODULE_NAME_LEN];
/** String terminator (always '\0'). */
s8 terminal;
/** The global pointer of the module. */
void *gpValue;
/**
* Pointer to the first resident library entry table of the module.
* This section is known as ".lib.ent".
*/
void *entTop;
/**
* Pointer to the last line of the .lib.ent section. This line is always 0 and
* is known as ".lib.ent.btm".
*/
void *entEnd;
/**
* Pointer to the first stub library entry table of the module.
* This section is known as "lib.stub".
*/
void *stubTop;
/**
* Pointer to the last line of the lib.stub section. This line is always 0 and
* is known as ".lib.stub.btm".
*/
void *stubEnd;
} SceModuleInfo;
/*
* Entry thread structure - an entry thread is used for executing the
* module entry functions.
*/
typedef struct {
/* The number of entry thread parameters, typically 3. */
u32 numParams;
/* The initial priority of the entry thread. */
u32 initPriority;
/* The stack size of the entry thread. */
u32 stackSize;
/* The attributes of the entry thread. */
u32 attr;
} SceModuleEntryThread;
extern char _gp[];
/**
* Module type attributes.
*/
enum SceModuleAttribute {
/** No module attributes. */
SCE_MODULE_ATTR_NONE = 0x0000,
/** Resident module - stays in memory. You cannot unload such a module. */
SCE_MODULE_ATTR_CANT_STOP = 0x0001,
/**
* Only one instance of the module (one version) can be loaded into the system. If you want to load another
* version of that module, you have to delete the loaded version first.
*/
SCE_MODULE_ATTR_EXCLUSIVE_LOAD = 0x0002,
/**
* Only one instance of the module (one version) can be started. If you want to start another
* version of that module, you have to stop the currently running version first.
*/
SCE_MODULE_ATTR_EXCLUSIVE_START = 0x0004,
};
/**
* Module Privilege Levels - These levels define the permissions a
* module can have.
*/
enum SceModulePrivilegeLevel {
/** Lowest permission. */
SCE_MODULE_USER = 0x0000,
/** POPS/Demo. */
SCE_MODULE_MS = 0x0200,
/** Module Gamesharing. */
SCE_MODULE_USB_WLAN = 0x0400,
/** Application module. */
SCE_MODULE_APP = 0x0600,
/** VSH module. */
SCE_MODULE_VSH = 0x0800,
/** Highest permission. */
SCE_MODULE_KERNEL = 0x1000,
/** The module uses KIRK's memlmd resident library. */
SCE_MODULE_KIRK_MEMLMD_LIB = 0x2000,
/** The module uses KIRK's semaphore resident library. */
SCE_MODULE_KIRK_SEMAPHORE_LIB = 0x4000,
};
#define SCE_MODULE_PRIVILEGE_LEVELS (SCE_MODULE_MS | SCE_MODULE_USB_WLAN | SCE_MODULE_APP | SCE_MODULE_VSH | SCE_MODULE_KERNEL)
#define SCE_MODINFO_SECTION_NAME ".rodata.sceModuleInfo"
#define SDK_VERSION 0x06060010 /** Release X.Y.Z -> 0xXXYYZZZZ */
#define SCE_SDK_VERSION(ver) const int module_sdk_version = ver
/**
* module START thread return value
*/
#define SCE_KERNEL_START_SUCCESS (0) /** The module could be started successfully. */
#define SCE_KERNEL_START_FAIL (1) /** The module could not be started successfully. */
#define SCE_KERNEL_RESIDENT (SCE_KERNEL_START_SUCCESS) /** After executing its start function, the module will remain in memory (resident library). */
#define SCE_KERNEL_NO_RESIDENT (SCE_KERNEL_START_FAIL) /** The module will be unloaded after executing its start function. */
/**
* module STOP thread return value
*/
#define SCE_KERNEL_STOP_SUCCESS (0) /** The module could be stopped successfully. */
#define SCE_KERNEL_STOP_FAIL (1) /** The module could not be stopped successfully. */
/**
* Module entry functions.
*/
#define SCE_MODULE_BOOTSTART(name) int module_start(SceSize argSize, const void *argBlock) __attribute__((alias(name))); \
int module_bootstart(SceSize argSize, const void *argBlock) __attribute__((alias(name)))
#define SCE_MODULE_REBOOT_BEFORE(name) int module_reboot_before(void *arg0, s32 arg1, s32 arg2, s32 arg3) __attribute__((alias(name)))
#define SCE_MODULE_REBOOT_BEFORE_FOR_USER(name) int module_reboot_before(SceSize arglen, void *argp) __attribute__((alias(name)))
#define SCE_MODULE_REBOOT_PHASE(name) int module_reboot_phase(s32 arg1, void *arg2, s32 arg3, s32 arg4) __attribute__((alias(name)))
#define SCE_MODULE_STOP(name) int module_stop(SceSize argSize, const void *argBlock) __attribute__((alias(name)))
#define SCE_MODULE_INFO(name, attributes, majorVersion, minorVersion) \
__asm__ ( \
" .set push\n" \
" .section .lib.ent.top, \"a\", @progbits\n" \
" .align 2\n" \
" .word 0\n" \
"__lib_ent_top:\n" \
" .section .lib.ent.btm, \"a\", @progbits\n" \
" .align 2\n" \
"__lib_ent_bottom:\n" \
" .word 0\n" \
" .section .lib.stub.top, \"a\", @progbits\n" \
" .align 2\n" \
" .word 0\n" \
"__lib_stub_top:\n" \
" .section .lib.stub.btm, \"a\", @progbits\n" \
" .align 2\n" \
"__lib_stub_bottom:\n" \
" .word 0\n" \
" .set pop\n" \
" .text\n" \
); \
extern char __lib_ent_top[], __lib_ent_bottom[]; \
extern char __lib_stub_top[], __lib_stub_bottom[]; \
const SceModuleInfo module_info \
__attribute__((section(SCE_MODINFO_SECTION_NAME), \
aligned(16), unused)) = { \
attributes, { minorVersion, majorVersion }, name, 0, _gp, \
__lib_ent_top, __lib_ent_bottom, \
__lib_stub_top, __lib_stub_bottom \
}
#define SCE_MODULE_START_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
const SceModuleEntryThread module_start_thread_parameter = { numParams, initPriority, stackSize, attr };
#define SCE_MODULE_STOP_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
const SceModuleEntryThread module_stop_thread_parameter = { numParams, initPriority, stackSize, attr };

View File

@ -50,6 +50,7 @@ typedef volatile int64_t vs64;
/* ID of most kernel objects */
typedef s32 SceUID;
#define SCE_UID_NAME_LEN 31 /* Maximum name length of a kernel object. */
/* Size, unsigned or signed (for memory blocks, etc.) */
typedef u32 SceSize;
@ -83,7 +84,7 @@ typedef s32 SceBool;
typedef void SceVoid;
typedef void * ScePVoid;
/* Permission mode when creating a file (in octal, like the chmod function and UNIX command */
/* Permission mode when creating a file (in octal, like the chmod function and UNIX command) */
typedef s32 SceMode;
/* An offset inside a file */
typedef SceInt64 SceOff;

View File

@ -11,6 +11,7 @@
#include "common/types.h"
#include "common/allegrex.h"
#include "common/cop0.h"
#include "common/debug.h"
#include "common/errors.h"

73
include/crypto/kirk.h Normal file
View File

@ -0,0 +1,73 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* @defgroup Crypto Crypto
* PSP Cryptography modules.
*/
/**
* @defgroup KIRK KIRK
* @ingroup Crypto
*
* The hardware crypto engine responsible for almost all aspects of the PSP's security, \n
* including decryption of EBOOTs & PRX's, savefile and adhoc encryption, and idstorage verification.
*
* @{
*/
#ifndef KIRK_H
#define KIRK_H
#include <common_header.h>
/* KIRK commands */
#define KIRK_CMD_ENCRYPT_AES_CBC_IV_NONE (0x04)
#define KIRK_CMD_ENCRYPT_AES_CBC_IV_FUSE (0x05)
#define KIRK_CMD_ENCRYPT_AES_CBC_IV_USER (0x06)
#define KIRK_CMD_DECRYPT_AES_CBC_IV_NONE (0x07)
#define KIRK_CMD_DECRYPT_AES_CBC_IV_FUSE (0x08)
#define KIRK_CMD_DECRYPT_AES_CBC_IV_USER (0x09)
#define KIRK_CMD_HASH_GEN_SHA1 (0x0B)
#define KIRK_CMD_KEY_GEN_ECDSA (0x0C)
#define KIRK_CMD_POINT_MULTIPLICATION_ECDSA (0x0D)
#define KIRK_CMD_PRN_GEN (0x0E)
#define KIRK_CMD_SIG_GEN_ECDSA (0x10)
#define KIRK_CMD_SIG_VER_ECDSA (0x11)
#define KIRK_CMD_CERT_VER (0x12)
/* Specific values for algorithms used by KIRK. */
#define KIRK_SHA1_DIGEST_LEN (20) /*!< The length (160 bit) of a SHA-1 hash value. */
#define KIRK_PRN_LEN (20) /*!< The length (160 bit) of a computed pseudo-random number. */
#define KIRK_ECDSA_POINT_LEN (40) /*!< The length (320 bit) of an elliptic curve point p = (x,y), with len(x) = 160 bit = len(y). */
#define KIRK_ECDSA_PUBLIC_KEY_LEN (KIRK_ECDSA_POINT_LEN) /*!< The length (320 bit) of the public key for ECDSA. */
#define KIRK_ECDSA_PRIVATE_KEY_LEN (20) /*!< The length (256 bit) of the private key for ECDSA. */
#define KIRK_ECDSA_SRC_DATA_LEN (20) /*!< The length (160 bit) of the data to compute the signature for using ECDSA. */
#define KIRK_ECDSA_SIG_LEN (40) /*!< The length (320 bit) of the signature computed by ECDSA. */
#define KIRK_AES_BLOCK_LEN (16) /*!< The length (128 bit) of a block to encrypt using AES. */
#define KIRK_CERT_LEN (184) /*!< The length (1472 bit) of the certification to verify. */
typedef struct {
SceSize dataSize;
} KirkSHA1Hdr;
typedef struct {
s32 mode;
s32 unk4;
s32 unk8;
s32 keyIndex;
SceSize dataSize;
} KirkAESHeader;
#endif /* KIRK_H */
/** @} */

View File

@ -1,4 +1,4 @@
/** Copyright (C) 2011, 2012, 2013, 2014 The uOFW team
/** Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
@ -17,8 +17,7 @@ typedef void (*SceKernelButtonCallbackFunction)(u32 curButtons, u32 lastButtons,
/**
* This structure is for obtaining button data (button/analog stick information) from the
* controller using ::sceCtrlPeekBufferPositive(), ::sceCtrlReadBufferNegative() and similar
* functions.
* controller using ::sceCtrlPeekBufferPositive(), ::sceCtrlReadBufferNegative() etc...
*/
typedef struct {
/**
@ -32,14 +31,19 @@ typedef struct {
u8 aX;
/** Analog Stick Y-axis offset (0 - 0xFF). Up = 0, Down = 0xFF. */
u8 aY;
/** Reserved. Values are normally set to 0. */
u8 rsrv[6];
/** DS3 right analog x-axis. Filled with 0 if input source doesn't allow second analog input. */
u8 rX;
/** DS3 right analog y-axis. Filled with 0 if input source doesn't allow second analog input. */
u8 rY;
/** Reserved. */
u8 rsrv[4];
} SceCtrlData;
/**
* This structure is for obtaining button data (button/stick information) from the
* controller using ::sceCtrlPeekBufferPositiveExtra(), ::sceCtrlReadBufferNegativeExtra()
* and similar functions.
* This structure is for obtaining button data (button/analog stick information) from the
* controller using ::sceCtrlPeekBufferPositive2(), ::sceCtrlReadBufferNegative2() etc....
* In addition to PSP controller state it can contain input state of external input devices
* such as a wireless controller.
*/
typedef struct {
/**
@ -53,51 +57,102 @@ typedef struct {
u8 aX;
/** Analog Stick Y-axis offset (0 - 0xFF). Up = 0, Down = 0xFF. */
u8 aY;
/** Reserved. Values are normally set to 0. */
u8 rsrv[6];
/** Unknown. */
s32 unk1;
/** Unknown. */
s32 unk2;
/** Unknown. */
s32 unk3;
/** Unknown. */
s32 unk4;
/** Unknown. */
s32 unk5;
/** Unknown. */
s32 unk6;
/** Unknown. */
s32 unk7;
/** Unknown. */
s32 unk8;
} SceCtrlDataExt;
/** DS3 right analog x-axis. Filled with 0 if input source doesn't allow second analog input. */
u8 rX;
/** DS3 right analog y-axis. Filled with 0 if input source doesn't allow second analog input. */
u8 rY;
/** Reserved. */
u8 rsrv[4];
/** D-pad pressure sensitivity.
* Byte 1: D-Pad right.
* Byte 3: D-Pad left.
*/
s32 DPadSenseA;
/** D-pad pressure sensitivity.
* Byte 1: D-Pad up.
* Byte 3: D-Pad down.
*/
s32 DPadSenseB;
/** Gamepad pressure sensitivity.
* Byte 1: Triangle.
* Byte 3: Circle.
*/
s32 GPadSenseA;
/** Gamepad pressure sensitivity.
* Byte 1: Cross.
* Byte 3: Square.
*/
s32 GPadSenseB;
/** Axis pressure sensitivity.
* Byte 1: L1.
* Byte 3: R1.
*/
s32 AxisSenseA;
/** Axis pressure sensitivity.
* Byte 1: L2.
* Byte 3: R2.
*/
s32 AxisSenseB;
/** DS3 sixaxis. This is the return value for tilting the x-axis. */
s32 TiltA;
/** DS3 sixaxis. This is the return value for tilting the y-axis. */
s32 TiltB;
} SceCtrlData2;
/**
* This structure is for obtaining button status values from the controller using
* ::sceCtrlPeekLatch() and ::sceCtrlReadLatch(). Each structure member contains button
* values of ::SceCtrlPadButtons.
* This structure represents controller button latch data.
*
* With each sampling cycle, the controller service compares the new pressed & released button states
* with the previously collected pressed button states. This comparison will result in the following possible
* states for each button:
*
* [make]: The button has just been pressed with its prior state being the released state. Transition from
* 'released' state to 'pressed' state.\n
* [press]: The button is currently in the 'pressed' state.\n
* [break]: The button has just been released with its prior state being the 'pressed' state. Transition from
* 'pressed' state to 'release' state.\n
* [release]: The button is currently in the 'released' state.
*
* It is possible for a button to (briefly) be in two states at the same time. Valid combinations are as follows:
*
* [make] & [press]\n
* [break] & [release]
*
* In other words, if a button is in the [make] state, then it is also in the [press] state. However, this is not the case
* for the inverse. A button in the [press] state does not need to be in the [make] state.
*
* These comparison results are stored internally as latch data and can be retrieved using the APIs ::sceCtrlPeekLatch() and
* ::sceCtrlReadLatch(). ::SceCtrlPadButtons can be used to find out the state of each button.
*
* @remark The same can be accomplished by using the different sceCtrl[Read/Peek]Buffer[Positive/Negative]() APIs
* and comparing the currently collected button sampling data with the previously collected one.
*
* @see ::sceCtrlPeekLatch()
* @see ::sceCtrlReadLatch()
*/
typedef struct {
/** Button is newly pressed (was not already been pressed). */
/** Button transitioned to pressed state. */
u32 buttonMake;
/** Stop of button press. It was pressed one frame before the current one. */
/** Button transitioned to released state. */
u32 buttonBreak;
/** Button is pressed. */
/** Button is in the pressed state. */
u32 buttonPress;
/** Button is not pressed. */
/** Button is in the released state. */
u32 buttonRelease;
} SceCtrlLatch;
/**
* Unknown structure.
* This structure is used to copy external input data into PSP internal controller buffers.
*/
typedef struct {
/** Unknown. */
/** Unknown. Is set to 0xC by Sony. */
s32 unk1;
/** Unknown. */
s32 (*func)(s32);
} SceCtrlUnkStruct;
/**
* Pointer to a transfer function to copy input data into a PSP internal controller buffer.
* The function should return a value >= 0 on success, < 0 otherwise.
*/
s32 (*copyInputData)(void *pSrc, SceCtrlData2 *pDst);
} SceCtrlInputDataTransferHandler;
/**
* Enumeration for the digital controller buttons in positive logic.
@ -107,53 +162,63 @@ typedef struct {
*/
enum SceCtrlPadButtons {
/** Select button. */
SCE_CTRL_SELECT = 0x1,
SCE_CTRL_SELECT = 0x00000001,
/** DS3 L3 button. */
SCE_CTRL_L3 = 0x00000002,
/** DS3 R3 button. */
SCE_CTRL_R3 = 0x00000004,
/** Start button. */
SCE_CTRL_START = 0x8,
SCE_CTRL_START = 0x00000008,
/** Up D-Pad button. */
SCE_CTRL_UP = 0x10,
SCE_CTRL_UP = 0x00000010,
/** Right D-Pad button. */
SCE_CTRL_RIGHT = 0x20,
SCE_CTRL_RIGHT = 0x00000020,
/** Down D-Pad button. */
SCE_CTRL_DOWN = 0x40,
SCE_CTRL_DOWN = 0x00000040,
/** Left D-Pad button. */
SCE_CTRL_LEFT = 0x80,
/** Left trigger. */
SCE_CTRL_LTRIGGER = 0x100,
/** Right trigger. */
SCE_CTRL_RTRIGGER = 0x200,
SCE_CTRL_LEFT = 0x00000080,
/** Left trigger. This accounts for the DS3 L2 trigger as well. */
SCE_CTRL_LTRIGGER = 0x00000100,
/** Right trigger. This accounts for the DS3 R2 trigger as well. */
SCE_CTRL_RTRIGGER = 0x00000200,
/** DS3 L1 trigger. */
SCE_CTRL_L1TRIGGER = 0x00000400,
/** DS3 R1 trigger. */
SCE_CTRL_R1TRIGGER = 0x00000800,
/** Triangle button. */
SCE_CTRL_TRIANGLE = 0x1000,
SCE_CTRL_TRIANGLE = 0x00001000,
/** Circle button. */
SCE_CTRL_CIRCLE = 0x2000,
SCE_CTRL_CIRCLE = 0x00002000,
/** Cross button. */
SCE_CTRL_CROSS = 0x4000,
SCE_CTRL_CROSS = 0x00004000,
/** Square button. */
SCE_CTRL_SQUARE = 0x8000,
SCE_CTRL_SQUARE = 0x00008000,
/**
* If this bit is set, then controller input is being intercepted by the
* system software or another application. For example, this is the case
* when the PSP's HOME menu is being shown.
*/
SCE_CTRL_INTERCEPTED = 0x10000,
SCE_CTRL_INTERCEPTED = 0x00010000,
/** Hold button. */
SCE_CTRL_HOLD = 0x20000,
SCE_CTRL_HOLD = 0x00020000,
/** W-LAN switch up. */
SCE_CTRL_WLAN_UP = 0x40000,
SCE_CTRL_WLAN_UP = 0x00040000,
/** Remote hold position. */
SCE_CTRL_REMOTE = 0x80000,
SCE_CTRL_REMOTE = 0x00080000,
/** Volume up button. */
SCE_CTRL_VOLUP = 0x100000,
SCE_CTRL_VOLUP = 0x00100000,
/** Volume down button. */
SCE_CTRL_VOLDOWN = 0x200000,
SCE_CTRL_VOLDOWN = 0x00200000,
/** Screen button. */
SCE_CTRL_SCREEN = 0x400000,
SCE_CTRL_SCREEN = 0x00400000,
/** Music Note button. */
SCE_CTRL_NOTE = 0x800000,
SCE_CTRL_NOTE = 0x00800000,
/** Disc present. */
SCE_CTRL_DISC = 0x1000000,
SCE_CTRL_DISC = 0x01000000,
/** Memory stick present. */
SCE_CTRL_MS = 0x2000000,
SCE_CTRL_MS = 0x02000000,
SCE_CTRL_UNK_10000000 = 0x10000000,
SCE_CTRL_UNK_20000000 = 0x20000000,
};
/** Controller input modes. */
@ -172,6 +237,16 @@ enum SceCtrlPadPollMode {
SCE_CTRL_POLL_ACTIVE = 1,
};
/** Specifies the type of input data to be obtained. */
enum SceCtrlPort {
/* Input is only obtained from the PSP. */
SCE_CRTL_PORT_PSP = 0,
/* Input is obtained from the PSP and a connected DualShock3 controller. */
SCE_CTRL_PORT_DS3 = 1,
/* Input is obtained from the PSP and an unknown connected external device. */
SCE_CTRL_PORT_UNKNOWN_2 = 2
};
/** Button mask settings. */
enum SceCtrlPadButtonMaskMode {
/** No mask for the specified buttons. Button input is normally recognized. */
@ -189,36 +264,39 @@ enum SceCtrlPadButtonMaskMode {
SCE_CTRL_MASK_APPLY_BUTTONS = 2,
};
/* The center position of the analog stick on both axes. */
#define SCE_CTRL_ANALOG_PAD_CENTER_VALUE 0x80
/**
* Initialize the controller device. Bind the controller driver to the controller device.
* Initializes the controller device. Bind the controller driver to the controller device.
*
* @return 0 on success.
*/
s32 sceCtrlInit(void);
/**
* Terminate the controller device. Unbind the controller driver from the controller device.
* Terminates the controller device. Unbind the controller driver from the controller device.
*
* @return 0.
*/
s32 sceCtrlEnd(void);
/**
* Suspend the controller driver and put the controller device into a low-power state.
* Suspends the controller driver and put the controller device into a low-power state.
*
* @return 0.
*/
s32 sceCtrlSuspend(void);
/**
* Resume the controller driver after and bring the controller device back from a low-power state.
* Resumes the controller driver after and bring the controller device back from a low-power state.
*
* @return 0.
*/
s32 sceCtrlResume(void);
/**
* Enable/disable controller device input.
* Enables/disables controller device input.
*
* @param pollMode One of ::SceCtrlPadPollMode. If set to 0, no button/analog input is recognized.
* Set to 1 to enable button/analog input.
@ -228,16 +306,16 @@ s32 sceCtrlResume(void);
u32 sceCtrlSetPollingMode(u8 pollMode);
/**
* Get the current controller device input mode.
* Gets the current controller device input mode.
*
* @param mode Receiving the current controller mode. One of ::SceCtrlPadInputMode.
* @param pMode Pointer to an u8 variable which is to receive the current controller mode. One of ::SceCtrlPadInputMode.
*
* @return 0.
*/
u32 sceCtrlGetSamplingMode(u8 *mode);
u32 sceCtrlGetSamplingMode(u8 *pMode);
/**
* Set the controller device input mode.
* Sets the controller device input mode.
*
* @param mode The new controller input mode. One of ::SceCtrlPadInputMode.
*
@ -246,22 +324,22 @@ u32 sceCtrlGetSamplingMode(u8 *mode);
s32 sceCtrlSetSamplingMode(u8 mode);
/**
* Get the current update interval of the internal controller data buffers.
* Gets the current update interval of the internal controller data buffers.
*
* @param cycle Receiving the current update interval (in microseconds).
* @param pCycle Pointer to an u32 variable which is to receive the current update interval (in microseconds).
*
* @return 0.
*/
u32 sceCtrlGetSamplingCycle(u32 *cycle);
u32 sceCtrlGetSamplingCycle(u32 *pCycle);
/**
* Set the update frequency of the internal controller buffer. Default update interval
* Sets the update frequency of the internal controller buffer. Default update interval
* is the VBlank interrupt (approximately 60 times per second).
*
* @param cycle The new interval between two samplings of controller attributes in microseconds.
* Setting to 0 enables the VBlank-Interrupt-Update process. If you want to set an own
* interval for updating the internal controller buffers, cycle has to be greater 5554
* and less than 20001.
* interval for updating the internal controller buffers, cycle has to in the range of
* 5555 - 20000 (the range from about 180 Hz to 50 Hz).
* This will disable the VBlank-Interrupt-Update process.
*
* @return The previous cycle on success.
@ -269,98 +347,95 @@ u32 sceCtrlGetSamplingCycle(u32 *cycle);
s32 sceCtrlSetSamplingCycle(u32 cycle);
/**
* Obtain the different cancel-idle-timer buttons.
* Obtains the different cancel-idle-timer buttons.
*
* @param oneTimeResetButtons Pointer retrieving the buttons reseting the timer when being pressed a
* new time (not being pressed immediately before).
* @param allTimeResetButtons Pointer retrieving the buttons reseting the timer when being pressed.
* @param oneTimeHoldResetButtons Pointer retrieving the buttons reseting the timer when being pressed
* a new time (not being pressed immediately before). These buttons are
* checked for when HOLD mode is active.
* @param allTimeHoldResetButtons Pointer retrieving the buttons reseting the timer when being pressed
* a new time. These buttons are checked for when HOLD mode is active.
* @param pResetButtonsMake Pointer to an u32 variable which is to receive the buttons resetting the idle timer when
* being pressed a new time (not already being pressed). Not used when the system is in HOLD mode.
* @param pResetButtonsPress Pointer to an u32 variable which is to receive the buttons resetting the idle timer when
* being pressed. Not used when the system is in HOLD mode.
* @param pResetButtonsMakeHoldMode Pointer to an u32 variable which is to receive the buttons resetting the idle timer when
* being pressed a new time (not already being pressed). Used when the system is in HOLD mode.
* @param pResetButtonsPressHoldMode Pointer to an u32 variable which is to receive the buttons resetting the idle timer when
* being pressed a new time. Used when the system is in HOLD mode.
*
* @return 0 on success.
*/
u32 sceCtrlGetIdleCancelKey(u32 *oneTimeResetButtons, u32 *allTimeResetButtons, u32 *oneTimeHoldResetButtons,
u32 *allTimeHoldResetButtons);
u32 sceCtrlGetIdleCancelKey(u32 *pResetButtonsMake, u32 *pResetButtonsPress, u32 *pResetButtonsMakeHoldMode,
u32 *pResetButtonsPressHoldMode);
/**
* Specify the buttons which, when being pressed, reset the idle timer. It is satisfying to press only
* one button of the specified buttons to reset it.
* @brief Specifies the buttons which, when being pressed, reset the idle timer.
*
* @param oneTimeResetButtons The buttons needed to be pressed to reset the timer. One or more of
* ::SceCtrlPadButtons. If you keep pressing these buttons after resetting
* the timer, they will not reset the timer anymore. You will have to
* release the buttons first, before they can reset it again. In case HOLD
* mode is active, pressing these buttons will not reset the timer.
* @param allTimeResetButtons The buttons needed to be pressed to reset the timer. One or more of
* ::SceCtrlPadButtons. As long as you press one of these buttons, the timer
* is reset. In case HOLD mode is active, pressing these buttons will not
* reset the timer.
* @param oneTimeHoldResetButtons The buttons needed to be pressed to reset the timer when HOLD mode is
* active. One or more of ::SceCtrlPadButtons. If you keep pressing these
* buttons after resetting the timer, they will not reset it anymore. You
* will have to release the buttons first, before they can reset the timer
* again.
* @param allTimeHoldResetButtons The buttons needed to be pressed to reset the timer when HOLD mode is
* active.
* One or more of ::SceCtrlPadButtons. As long as you press one of these
* buttons, the timer is reset.
* This function lets you specify buttons which reset the idle timer. If multiple buttons are specified the timer can be
* resetted by simply pressing one of the specified buttons. A button combination is also possible.
*
* @param resetButtonsMake Buttons which will reset the timer if pressed. One or more of ::SceCtrlPadButtons.
* If you keep pressing one or more of these buttons after resetting the timer, they will not reset the timer anymore.
* You will have to release the buttons first, before they can reset it again. In case HOLD mode is active, pressing
* these buttons will not reset the timer.
* @param resetButtonsPress Buttons which will reset the timer if pressed. One or more of ::SceCtrlPadButtons.
* As long as you press one of these buttons, the timer is resetted. In case HOLD mode is active, pressing these buttons
* will not reset the timer.
* @param resetButtonsMakeHoldMode Buttons which will reset the timer if pressed while HOLD mode is active. One or
* more of ::SceCtrlPadButtons. If you keep pressing these buttons after resetting the timer, they will not reset it
* anymore. You will have to release the buttons first, before they can reset the timer again.
* @param resetButtonsPressHoldMode Buttons which will reset the timer if pressed while HOLD mode is active. One or
* more of ::SceCtrlPadButtons. As long as you press one of these buttons, the timer is resetted.
*
* @return 0 on success.
*
* @par Example:
* @code
* // Pressing the select will reset the idle timer. No other button will reset it.
* sceCtrlSetIdleCancelKey(0, SCE_CTRL_SELECT, 0, 0);
* // Pressing the START button will reset the idle timer. Button needs to be released and pressed again to reset the
* // idle timer another time. HOLD mode has to be inactive.
* // Pressing the SELECT button will reset the idle timer. The button can be kept pressed (held down) to keep resetting
* // the idle timer. HOLD mode has to be inactive.
* sceCtrlSetIdleCancelKey(SCE_CTRL_START, SCE_CTRL_SELECT, 0, 0);
* @endcode
*/
u32 sceCtrlSetIdleCancelKey(u32 oneTimeResetButtons, u32 allTimeResetButtons, u32 oneTimeHoldResetButtons,
u32 allTimeHoldResetButtons);
u32 sceCtrlSetIdleCancelKey(u32 resetButtonsMake, u32 resetButtonsPress, u32 resetButtonsMakeHoldMode,
u32 resetButtonsPressHoldMode);
/* This constant defines that analog stick movement does not cancel the idle timer. */
#define SCE_CTRL_IDLE_CANCEL_TRESHOLD_NO_CANCELLATION (-1)
/**
* Get the idle timer cancel threshold values for the analog stick.
* Gets the idle timer cancel movement threshold values for the analog stick.
*
* @param iUnHoldThreshold Movement needed by the analog stick to reset the idle timer. Used when
* HOLD mode is inactive. -1 is obtained when the analog stick cannot cancel the idle timer,
* otherwise the movement needed by the analog stick to cancel the idle timer.
* @param iHoldThreshold Movement needed by the analog stick to reset the idle timer. Used when
* HOLD mode is active. -1 is obtained when the analog stick cannot cancel the
* idle timer, otherwise the movement needed by the analog stick to cancel the idle timer.
* @param pUnHoldThreshold Pointer to a s32 variable which is to receive the treshold value when HOLD mode is inactive.
* @param pHoldThreshold Pointer to a s32 variable which is to receive the treshold value when HOLD mode is active.
*
* @return 0 on success.
*/
s32 sceCtrlGetIdleCancelThreshold(s32 *iUnHoldThreshold, s32 *iHoldThreshold);
s32 sceCtrlGetIdleCancelThreshold(s32 *pUnHoldThreshold, s32 *pHoldThreshold);
/**
* Set analog stick threshold values canceling the idle timer.
*
* @param iUnHoldThreshold Movement needed by the analog stick to reset the idle timer. Used when
* HOLD mode is inactive.
* Set between 1 - 128 to specify the movement on either axis.
* Set to 0 for idle timer to be canceled even if the analog stick is not moved.
* Set to -1 for analog stick not canceling idle timer (although it is moved).
* @param iHoldThreshold Movement needed by the analog stick to reset the idle timer. Used when
* HOLD mode is active.
* Set between 1 - 128 to specify the movement on either axis.
* Set to 0 for idle timer to be canceled even if the analog stick is not moved.
* Set to -1 for analog stick not canceling idle timer (although it is moved).
* Sets analog stick movement threshold values for cancelling the idle timer. In case SCE_CTRL_INPUT_DIGITAL_ONLY is set as the
* input mode for the controller, analog stick movements will not result in cancelling the idle timer.
*
* @param unHoldThreshold Movement needed by the analog stick to reset the idle timer. Used when
* HOLD mode is inactive.
* Set between 1 - 128 to specify the movement on either axis.
* Set to 0 for idle timer to be canceled even if the analog stick is not moved (that is, the idle timer itself stops running).
* Specify SCE_CTRL_IDLE_CANCEL_TRESHOLD_NO_CANCELLATION for analog stick movement to not cancel the idle timer.
* @param holdThreshold Movement needed by the analog stick to reset the idle timer. Used when HOLD mode is active.
* Set between 1 - 128 to specify the movement on either axis.
* Set to 0 for idle timer to be canceled even if the analog stick is not moved (that is, the idle timer itself stops running).
* Specify SCE_CTRL_IDLE_CANCEL_TRESHOLD_NO_CANCELLATION for analog stick movement to not cancel the idle timer.
*
* @return 0 on success.
*/
s32 sceCtrlSetIdleCancelThreshold(s32 iUnHoldThreshold, s32 iHoldThreshold);
s32 sceCtrlSetIdleCancelThreshold(s32 unHoldThreshold, s32 holdThreshold);
/**
* Get the number of VBlanks which will be waited for when the PSP device is being suspended.
* Gets the number of VBlanks which will be waited for when the PSP device is being suspended.
*
* @return The number of VBlanks to wait for.
*/
s16 sceCtrlGetSuspendingExtraSamples(void);
/**
* Set a number of VBlanks which will be waited for when the PSP device is being suspended.
* Sets a number of VBlanks which will be waited for when the PSP device is being suspended.
*
* @param suspendSamples The number of VBlanks. Between 0 - 300.
*
@ -369,69 +444,112 @@ s16 sceCtrlGetSuspendingExtraSamples(void);
s32 sceCtrlSetSuspendingExtraSamples(s16 suspendSamples);
/**
* Extend the 64 internal controller buffers to represent SceCtrlDataExt structures.
* By default, an internal controller buffer is equivalent to a SceCtrlData structure. This function
* has to be called before using the extended read/peekBuffer functions (only the first time).
* Sets up internal controller buffers to receive external input data. Each input mode has its own
* set of buffers. These buffers are of type ::SceCtrlData2.
* Note: This function has to be called initially in order to obtain external input data via the corresponding
* Peek/Read functions.
*
* @param mode Seems to be an index. Pass either 1 or 2.
* @param arg2 Unknown. Pointer to a ctrlUnkStruct structure?
* @param arg3 Unknown.
* @param externalPort Pass a valid element of ::SceCtrlPort (either 1 or 2).
* @param transferHandler Pointer to a SceCtrlInputDataTransferHandler containing a function to copy the @p inputSource
* into the PSP's controller buffers.
* @param inputSource Pointer to buffer containing the Controller input data to copy to the PSP's
* controller buffers. It is passed as the source argument to the given transfer function.
*
* @return 0 on success.
*/
s32 sceCtrlExtendInternalCtrlBuffers(u8 mode, SceCtrlUnkStruct *arg2, s32 arg3);
s32 sceCtrl_driver_E467BEC8(u8 externalPort, SceCtrlInputDataTransferHandler *transferHandler, void *inputSource);
/**
* Obtain button latch data stored in the internal latch controller buffers. The following button
* states can be obtained:
* Button is pressed, button is not pressed, button has been newly pressed
* and button has been newly released.
* Once a button has been, for example, pressed, its value is stored into the specific latch member
* (buttonMake in this case) until you manually reset the specific latch buffer field.
* @brief Gets the latch data.
*
* This function reads the latch data collected by the controller service. At each sampling
* interval, the controller service compares the new pressed/released button states with the previously sampled pressed
* button states and stores that comparison as latch data.
*
* Compared to ::sceCtrlReadLatch(), calling this API will not result in clearing the internal latch data. As such,
* the data returned is the accumulated latch data since the last time ::sceCtrlReadLatch() was called. Consequently,
* the returned data should not be relied on whether a button is currently in a pressed or released state.
*
* @param pLatch Pointer to a ::SceCtrlLatch variable which is to receive the accumulated button latch data.
*
* @return On success, the number of times the controller service performed sampling since the last time
* ::sceCtrlReadLatch() was called.
* @return < 0 on error.
*
* @param latch Pointer to a SceCtrlLatch structure retrieving the current button latch data.
* @see ::SceCtrlLatch
* @see ::sceCtrlReadLatch()
*/
s32 sceCtrlPeekLatch(SceCtrlLatch *pLatch);
/**
* @brief Gets the latch data.
*
* @return The number of reads of the internal latch buffer, without being reset, on success.
* This function reads the most recent latch data collected by the controller service. At each sampling
* interval, the controller service compares the new pressed/released button states with the previously sampled pressed
* button states and stores that comparison as latch data.
*
* Compared to ::sceCtrlPeekLatch(), calling this API will result in clearing the internal latch data. As such,
* calling code might have to explicitly wait for the controller service to update its collected latch data.
*
* @param pLatch Pointer to a ::SceCtrlLatch variable which is to receive the current button latch data.
*
* @return On success, the number of times the controller service performed sampling since the last time
* ::sceCtrlReadLatch() was called.
* @return < 0 on error.
*
* @par Example:
* @code
* SceCtrlLatch latch;
* SceCtrlLatch latchData;
*
* sceCtrlPeekLatch(&latch);
* while (1) {
* // Cross button pressed
* if (latch.buttonPress & SCE_CTRL_CROSS) {
* // do something
* }
* // Obtain latch data
* sceCtrlReadLatch(&latchData);
*
* if (latchData.buttonMake & SCE_CTRL_CROSS)
* {
* // The Cross button has just been pressed (transition from 'released' state to 'pressed' state)
* }
*
* if (latchData.buttonPress & SCE_CTRL_SQUARE)
* {
* // The Square button is currently in the 'pressed' state
* }
*
* if (latchData.buttonBreak & SCE_CTRL_TRIANGLE)
* {
* // The Triangle button has just been released (transition from 'pressed' state to 'released' state)
* }
*
* if (latchData.buttonRelease & SCE_CTRL_CIRCLE)
* {
* // The Circle button is currently in the 'released' state
* }
*
* // As we clear the internal latch data with the ReadLatch() call, we can explicitly wait for the VBLANK interval
* // to give the controller service the time it needs to collect new latch data again. This guarantees the next call
* // to sceCtrlReadLatch() will return collected data again.
* //
* // Note: The sceCtrlReadBuffer*() APIs are implicitly waiting for a VBLANK interval if necessary.
* sceDisplayWaitVBlank();
* }
* @endcode
*
* @see ::SceCtrlLatch
* @see ::sceCtrlPeekLatch()
*/
s32 sceCtrlPeekLatch(SceCtrlLatch *latch);
s32 sceCtrlReadLatch(SceCtrlLatch *pLatch);
/**
* Obtain button latch data stored in the internal latch controller buffers. The following button
* states can be obtained:
* Button is pressed, button is not pressed, button has been newly pressed
* and button has been newly released.
* After the internal latch data has been read, it will be reset to zero again.
*
* @param latch Pointer to a SceCtrlLatch structure retrieving the current button latch data.
*
* @return The number of reads of the internal latch buffer, without being reset, (typically 1) on
* success.
*/
s32 sceCtrlReadLatch(SceCtrlLatch *latch);
/**
* Obtain button data stored in the internal controller buffers. Does not wait for the next
* @brief Retrieves controller state data by polling (positive logic).
*
* This function obtains button data stored in the internal controller buffers. Does not wait for the next
* update interval to be performed.
* The obtained data will be the latest transfered button data into the internal controller buffers.
*
* @param data Pointer to controller data structure in which button information is stored. The obtained
* button data is represented in positive logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
* @param pData Pointer to one or more ::SceCtrlData variables to receive controller state data. The obtained
* button data is represented in positive logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
*
* @return The number of read internal controller buffers on success.
*
@ -452,17 +570,19 @@ s32 sceCtrlReadLatch(SceCtrlLatch *latch);
* @endcode
*/
s32 sceCtrlPeekBufferPositive(SceCtrlData *data, u8 nBufs);
s32 sceCtrlPeekBufferPositive(SceCtrlData *pData, u8 nBufs);
/**
* Obtain button data stored in the internal controller buffers. Does not wait for the next
* @brief Retrieves controller state data by polling (negative logic).
*
* This fucntion obtains button data stored in the internal controller buffers. Does not wait for the next
* update interval to be performed.
* The obtained data will be the latest transfered button data into the internal controller buffers.
*
* @param data Pointer to controller data structure in which button information is stored. The obtained
* button data is represented in negative logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
* @param pData Pointer to one or more ::SceCtrlData variables to receive controller state data. The obtained
* button data is represented in negative logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
*
* @return The number of read internal controller buffers on success.
*
@ -482,94 +602,118 @@ s32 sceCtrlPeekBufferPositive(SceCtrlData *data, u8 nBufs);
* }
* @endcode
*/
s32 sceCtrlPeekBufferNegative(SceCtrlData *data, u8 nBufs);
s32 sceCtrlPeekBufferNegative(SceCtrlData *pData, u8 nBufs);
/**
* Obtain button data stored in the internal controller buffers. Waits for the next update interval
* @brief Retrieves controller state data by blocking (positive logic).
*
* This function obtains button data stored in the internal controller buffers. Waits for the next update interval
* before obtaining the data. The read data is the newest transfered data into the internal controller
* buffers.
*
* @param data Pointer to controller data structure in which button information is stored. The obtained
* button data is represented in positive logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
* @param pData Pointer to one or more ::SceCtrlData variables to receive controller state data. The obtained
* data is represented in positive logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
*
* @return The number of read internal controller buffers on success.
*/
s32 sceCtrlReadBufferPositive(SceCtrlData *data, u8 nBufs);
s32 sceCtrlReadBufferPositive(SceCtrlData *pData, u8 nBufs);
/**
* Obtain button data stored in the internal controller buffers. Waits for the next update interval
* @brief Retrieves controller state data by blocking (negative logic).
*
* This function obtains button data stored in the internal controller buffers. Waits for the next update interval
* before obtaining the data. The read data is the newest transfered data into the internal controller
* buffers.
*
* @param data Pointer to controller data structure in which button information is stored. The obtained
* button data is represented in negative logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
* @param pData Pointer to one or more ::SceCtrlData variables to receive controller state data. The obtained
* data is represented in negative logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
*
* @return The number of read internal controller buffers on success.
*/
s32 sceCtrlReadBufferNegative(SceCtrlData *data, u8 nBufs);
s32 sceCtrlReadBufferNegative(SceCtrlData *pData, u8 nBufs);
/**
* Extended ::sceCtrlPeekBufferPositive(). See description for more info.
* You need to call ::SceCtrlExtendInternalCtrlBuffers() before use.
* @brief Retrieves controller state data by polling (positive logic) with support for wireless controllers.
*
* This function Obtains button data stored in the internal controller buffers. Waits for the next update interval
* before obtaining the data. The read data is the newest transfered data into the internal controller
* buffers and can contain input state provided by external input devices such as a wireless controller.
*
* @param arg1 Pass 1 or 2.
* @param data Pointer to controller data structure in which button information is stored. The obtained
* button data is represented in positive logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
* @remark You need to call ::sceCtrl_driver_E467BEC8() before initial use of this API or its related ones.
*
* @param port Pass a valid element of ::SceCtrlPort (either 1 or 2).
* @param pData Pointer to one or more ::SceCtrlData2 variables to receive controller state data. The obtained
* button data is represented in positive logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
*
* @return The number of read internal controller buffers on success.
*/
s32 sceCtrlPeekBufferPositiveExtra(s32 arg1, SceCtrlDataExt *data, u8 nBufs);
s32 sceCtrlPeekBufferPositive2(u32 port, SceCtrlData2 *pData, u8 nBufs);
/**
* Extended ::sceCtrlPeekBufferNegative(). See description for more info.
* You need to call ::sceCtrlExtendInternalCtrlBuffers() before use.
* @brief Retrieves controller state data by polling (negative logic) with support for wireless controllers.
*
* This function obtains button data stored in the internal controller buffers. Waits for the next update interval
* before obtaining the data. The read data is the newest transfered data into the internal controller
* buffers and can contain input state provided by external input devices such as a wireless controller.
*
* @remark You need to call ::sceCtrl_driver_E467BEC8() before initial use of this API or its related ones.
*
* @param arg1 Unknown. Pass 1 or 2.
* @param data Pointer to controller data structure in which button information is stored. The obtained
* button data is represented in negative logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
* @param port Pass a valid element of ::SceCtrlPort (either 1 or 2).
* @param pData Pointer to one or more ::SceCtrlData2 variables to receive controller state data. The obtained
* button data is represented in negative logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
*
* @return The number of read internal controller buffers on success.
*/
s32 sceCtrlPeekBufferNegativeExtra(s32 arg1, SceCtrlDataExt *data, u8 nBufs);
s32 sceCtrlPeekBufferNegative2(u32 port, SceCtrlData2 *pData, u8 nBufs);
/**
* Extended ::sceCtrlReadBufferPositive(). See description for more info.
* You need to call ::sceCtrlExtendInternalCtrlBuffers() before use.
* @brief Retrieves controller state data by blocking (positive logic) with support for wireless controllers.
*
* This function obtains button data stored in the internal controller buffers. Waits for the next update interval
* before obtaining the data. The read data is the newest transfered data into the internal controller
* buffers and can contain input state provided by external input devices such as a wireless controller.
*
* @remark You need to call ::sceCtrl_driver_E467BEC8() before initial use of this API or its related ones.
*
* @param arg1 Pass 1 or 2.
* @param data Pointer to controller data structure in which button information is stored. The obtained
* button data is represented in positive logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
* @param port Pass a valid element of ::SceCtrlPort (either 1 or 2).
* @param pData Pointer to one or more ::SceCtrlData2 variables to receive controller state data. The obtained
* button data is represented in positive logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
*
* @return The number of read internal controller buffers on success.
*/
s32 sceCtrlReadBufferPositiveExtra(s32 arg1, SceCtrlDataExt *data, u8 nBufs);
s32 sceCtrlReadBufferPositive2(u32 port, SceCtrlData2 *pData, u8 nBufs);
/**
* Extended ::sceCtrlReadBufferNegative(). See description for more info.
* You need to call ::sceCtrlExtendInternalCtrlBuffers() before use.
* @brief Retrieves controller state data by blocking (negative logic) with support for wireless controllers.
*
* This function obtains button data stored in the internal controller buffers. Waits for the next update interval
* before obtaining the data. The read data is the newest transfered data into the internal controller
* buffers and can contain input state provided by external input devices such as a wireless controller.
*
* @remark You need to call ::sceCtrl_driver_E467BEC8() before initial use of this API or its related ones.
*
* @param arg1 Pass 1 or 2.
* @param data Pointer to controller data structure in which button information is stored. The obtained
* button data is represented in negative logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
* @param port Pass a valid element of ::SceCtrlPort (either 1 or 2).
* @param pData Pointer to one or more ::SceCtrlData2 variables to receive controller state data. The obtained
* button data is represented in negative logic.
* @param nBufs The number of internal controller buffers to read. There are 64 internal controller
* buffers which can be read. Has to be set to a value in the range of 1 - 64.
*
* @return The number of read internal controller buffers on success.
*/
s32 sceCtrlReadBufferNegativeExtra(s32 arg1, SceCtrlDataExt *data, u8 nBufs);
s32 sceCtrlReadBufferNegative2(u32 port, SceCtrlData2 *pData, u8 nBufs);
/**
* Disable a rapid-fire button event.
* Disables a rapid-fire button event.
*
* @param slot The slot of the event to clear. Between 0 - 15.
*
@ -578,28 +722,28 @@ s32 sceCtrlReadBufferNegativeExtra(s32 arg1, SceCtrlDataExt *data, u8 nBufs);
s32 sceCtrlClearRapidFire(u8 slot);
/**
* Specify a rapid-fire event for one or more buttons.
* Specifies a rapid-fire event for one or more buttons.
*
* @param slot The slot used to set the custom values. Between 0 - 15. Up to 16 slots can be used.
* @param uiMask Comparison mask of the button operation for rapid-fire trigger. In order for the <uiTrigger> buttons
* @param uiMask Comparison mask of the button operation for rapid-fire trigger. In order for the @p uiTrigger buttons
* to trigger the event, they need to be included in these buttons.
* One or more buttons of ::SceCtrlPadButtons.
* @param uiTrigger The buttons which will start the rapid fire event for the specified
* <uiTarget> buttons when being pressed.
* @p uiTarget buttons when being pressed.
* @param uiTarget The buttons for which the rapid-fire event will be applied to. User mode
* buttons only. <uiMake> and <uiBreak> define the rapid-fire cycle.
* buttons only. @p uiMake and @p uiBreak define the rapid-fire cycle.
* @param uiDelay Dead time of rapid-fire trigger (sampling count). Specifies the rapid-fire start timing.
* It will only be applied for the first ON period of a (not cancelled) rapid-fire event.
* Set to 0 - 63.
* @param uiMake The press time for the <uiTarget> buttons. This "ON-time" is set after
* <uiDelay> was applied and the <uiTrigger> buttons were turned OFF. It will be
* @param uiMake The press time for the @p uiTarget buttons. This "ON-time" is set after
* @p uiDelay was applied and the @p uiTrigger buttons were turned OFF. It will be
* applied for as long as the same rapid fire event is called without a
* break (i.e. pressing of a different PSP button). Set to 0 - 63.
* If set to 0, the <uiTarget> button(s) will be turned ON for one sampling count.
* @param uiBreak The release time for <uiTarget> buttons. This "OFF-time" is set after <uiDelay> was
* If set to 0, the @p uiTarget button(s) will be turned ON for one sampling count.
* @param uiBreak The release time for @p uiTarget buttons. This "OFF-time" is set after @p uiDelay was
* applied. It will be applied as long as the same rapid fire event is called
* without a break (i.e. the pressing of a different PSP button). Set to 0 - 63.
* If set to 0, the <uiTarget> button will be turned OFF for 64 consecutive sampling counts.
* If set to 0, the @p uiTarget button will be turned OFF for 64 consecutive sampling counts.
*
* @return 0 on success.
*
@ -615,13 +759,12 @@ s32 sceCtrlClearRapidFire(u8 slot);
* // (as long as D-Pad-Up is pressed).
* sceCtrlSetRapidFire(0, SCE_CTRL_UP, SCE_CTRL_UP, SCE_CTRL_RTRIGGER, 0, 40, 40);
* @endcode
*
*/
s32 sceCtrlSetRapidFire(u8 slot, u32 uiMask, u32 uiTrigger, u32 uiTarget, u8 uiDelay,
u8 uiMake, u8 uiBreak);
/**
* Emulate values for the analog pad's X- and Y-axis.
* Emulates values for the analog pad's X- and Y-axis.
*
* @param slot The slot used to set the custom values. Between 0 - 3. If multiple slots are used,
* their settings are combined.
@ -634,7 +777,7 @@ s32 sceCtrlSetRapidFire(u8 slot, u32 uiMask, u32 uiTrigger, u32 uiTarget, u8 uiD
s32 sceCtrlSetAnalogEmulation(u8 slot, u8 aX, u8 aY, u32 uiMake);
/**
* Emulate buttons for the digital pad.
* Emulates buttons for the digital pad.
*
* @param slot The slot used to set the custom values. Between 0 - 3. If multiple slots are used,
* their settings are combined.
@ -651,16 +794,16 @@ s32 sceCtrlSetAnalogEmulation(u8 slot, u8 aX, u8 aY, u32 uiMake);
s32 sceCtrlSetButtonEmulation(u8 slot, u32 userButtons, u32 kernelButtons, u32 uiMake);
/**
* Get the button mask settings applied to PSP buttons.
*
* Gets the button mask settings applied to PSP buttons.
*
* @param buttons The buttons to check for. One or more buttons of ::SceCtrlPadButtons.
*
* @return The button mask mode for the given buttons. One of ::SceCtrlPadButtonMaskMode.
*
* @return The button mask mode for the given buttons. One of ::SceCtrlPadButtonMaskMode.
*/
u32 sceCtrlGetButtonIntercept(u32 buttons);
/**
* Set a button mask mode for one or more buttons. You can only mask user mode buttons in user applications.
* Sets a button mask mode for one or more buttons. You can only mask user mode buttons in user applications.
* Masking of kernel mode buttons is ignored as well as buttons used in kernel mode applications.
*
* @param buttons The button value for which the button mask mode will be applied for.
@ -682,7 +825,7 @@ u32 sceCtrlGetButtonIntercept(u32 buttons);
u32 sceCtrlSetButtonIntercept(u32 buttons, u32 buttonMaskMode);
/**
* Register a button callback.
* Registers a button callback.
*
* @param slot The slot used to register the callback. Between 0 - 3.
* @param buttonMask Bitwise OR'ed button values which will be checked for being pressed. One or more
@ -695,7 +838,7 @@ u32 sceCtrlSetButtonIntercept(u32 buttons, u32 buttonMaskMode);
s32 sceCtrlSetSpecialButtonCallback(u32 slot, u32 buttonMask, SceKernelButtonCallbackFunction callback, void *opt);
/**
* Unknown purpose.
* Unknown.
*
* @param arg1 Unknown argument.
*
@ -704,7 +847,7 @@ s32 sceCtrlSetSpecialButtonCallback(u32 slot, u32 buttonMask, SceKernelButtonCal
u32 sceCtrl_driver_6C86AF22(s32 arg1);
/**
* Unknown purpose.
* Unknown.
*
* @param arg1 Unknown argument.
*
@ -713,7 +856,7 @@ u32 sceCtrl_driver_6C86AF22(s32 arg1);
u32 sceCtrl_driver_5886194C(s8 arg1);
/**
* Unknown purpose.
* Unknown.
*
* @return 0.
*/

40
include/dnas_error.h Normal file
View File

@ -0,0 +1,40 @@
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
/**
* @defgroup DNAS_ERROR DNAS Errors
* @ingroup DNAS
*
* uofw/include/dnas_error.h \n
* Defines error codes specifically for the DNAS facility. \n
*
* @{
*/
#ifndef DNAS_ERROR_H
#define DNAS_ERROR_H
#include "common_header.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
DNAS error codes
SCE_ERROR_FACILITY_DNAS = 0x053
*/
#define SCE_DNAS_ERROR_OPERATION_FAILED 0x80530300 /*!< The requested operation failed. */
#define SCE_DNAS_ERROR_INVALID_ARGUMENTS 0x80530301 /*!< The provided arguments are not correct. */
#ifdef __cplusplus
}
#endif
#endif /* DNAS_ERROR_H */
/** @} */

357
include/ge_kernel.h Normal file
View File

@ -0,0 +1,357 @@
/* Copyright (C) 2011, 2012 The uOFW team
See the file COPYING for copying permission.
*/
/**
* @author artart78
* @version 6.60
*
* The ge.prx module RE'ing.
*/
#include "common_header.h"
#include "ge_user.h"
/** @defgroup GE sceGE_Manager Module
*
* @{
*/
/** Internal state of a display list */
typedef enum
{
/** No state assigned, the list is empty */
SCE_GE_DL_STATE_NONE = 0,
/** The list has been queued */
SCE_GE_DL_STATE_QUEUED, // 1
/** The list is being executed */
SCE_GE_DL_STATE_RUNNING, // 2
/** The list was completed and will be removed */
SCE_GE_DL_STATE_COMPLETED, // 3
/** The list has been paused by a signal */
SCE_GE_DL_STATE_PAUSED // 4
} SceGeDisplayListState;
/** Internal signal state of a display list */
typedef enum
{
/** No signal received */
SCE_GE_DL_SIGNAL_NONE = 0,
/** The break signal was received */
SCE_GE_DL_SIGNAL_BREAK, // 1
/** The pause signal was received */
SCE_GE_DL_SIGNAL_PAUSE, // 2
/** The sync signal was received */
SCE_GE_DL_SIGNAL_SYNC // 3
} SceGeDisplayListSignal;
/** Structure holding a display list */
typedef struct SceGeDisplayList
{
/** Next display list of the queue */
struct SceGeDisplayList *next; // 0
/** Previous display list */
struct SceGeDisplayList *prev; // 4
/** Current display list state */
u8 state; // SceGeDisplayListState / 8
/** Current display list received signal */
u8 signal; // SceGeDisplayListSignal / 9
/** 1 if the list is busy (ie has been running at least once and was not completed+sync'ed with a SceGeDrawSync() yet), 0 otherwise */
u8 isBusy;
/* (padding) */
char unused11;
/** The display list context */
SceGeContext *ctx; // 12
/** The display list execution state (see HW_GE_EXEC) */
int execState;
/** Pointer to the list of commands */
void *list; // 20
/** Pointer to the stall address, where the display list will stop being executed */
void *stall; // 24
/** Internal data */
int radr1; // 28
/** Internal data */
int radr2; // 32
/** Internal data */
int oadr; // 36
/** Internal data */
int oadr1; // 40
/** Internal data */
int oadr2; // 44
/** Internal data */
int base; // 48
/** The callbacks id set with sceGeSetCallback() */
short cbId; // 52
/** Some argument passed to the interrupt handler when calling the subintrs */
u16 signalData;
/** The number of stacks of the display list */
short numStacks; // 56
/** The offset of the current stack */
u16 stackOff; // 58
/** A pointer to the list of stacks */
SceGeStack *stack; // 60
} SceGeDisplayList; // size: 64
/** Structure storing a GE context (kernel definition of SceGeContext) */
typedef struct
{
u32 exec; // 0
u32 ladr; // 4
u32 sadr; // 8
u32 radr1; // 12
u32 radr2; // 16
u32 vadr; // 20
u32 iadr; // 24
u32 oadr; // 28
u32 oadr1; // 32
u32 oadr2; // 36
u32 edramTransDisable; // 40
u32 edramTransVal; // 44
u32 edramRefresh1; // 48
u32 edramRefresh2; // 52
u32 edramRefresh3; // 56
u32 edramUnk40; // 60
u32 geometryClock; // 64
u32 dl[495]; // 68
} _SceGeContext;
/**
* Inits the GE subsystem.
*
* @return Zero.
*/
int sceGeInit();
/**
* Ends the GE subsystem.
*
* @return Zero.
*/
int sceGeEnd();
/**
* Identifiers for the GE hardware (DMA) registers which can be read and written
* by sceGeGetReg() and sceGeSetReg(). See the hardware documentation for more details. */
typedef enum SceGeReg {
SCE_GE_REG_RESET = 0,
SCE_GE_REG_UNK004 = 1,
SCE_GE_REG_EDRAM_HW_SIZE = 2,
SCE_GE_REG_EXEC = 3,
SCE_GE_REG_UNK104 = 4,
SCE_GE_REG_LISTADDR = 5,
SCE_GE_REG_STALLADDR = 6,
SCE_GE_REG_RADR1 = 7,
SCE_GE_REG_RADR2 = 8,
SCE_GE_REG_VADR = 9,
SCE_GE_REG_IADR = 10,
SCE_GE_REG_OADR = 11,
SCE_GE_REG_OADR1 = 12,
SCE_GE_REG_OADR2 = 13,
SCE_GE_REG_UNK300 = 14,
SCE_GE_REG_INTERRUPT_TYPE1 = 15,
SCE_GE_REG_INTERRUPT_TYPE2 = 16,
SCE_GE_REG_INTERRUPT_TYPE3 = 17,
SCE_GE_REG_INTERRUPT_TYPE4 = 18,
SCE_GE_REG_EDRAM_ENABLED_SIZE = 19,
SCE_GE_REG_GEOMETRY_CLOCK = 20,
SCE_GE_REG_EDRAM_REFRESH_UNK1 = 21,
SCE_GE_REG_EDRAM_UNK10 = 22,
SCE_GE_REG_EDRAM_REFRESH_UNK2 = 23,
SCE_GE_REG_EDRAM_REFRESH_UNK3 = 24,
SCE_GE_REG_EDRAM_UNK40 = 25,
SCE_GE_REG_EDRAM_UNK50 = 26,
SCE_GE_REG_EDRAM_UNK60 = 27,
SCE_GE_REG_EDRAM_ADDR_TRANS_DISABLE = 28,
SCE_GE_REG_EDRAM_ADDR_TRANS_VALUE = 29,
SCE_GE_REG_EDRAM_UNK90 = 30,
SCE_GE_REG_EDRAM_UNKA0 = 31
} SceGeReg;
/**
* Gets the value of a GE hardware register.
*
* @param regId The register ID.
*
* @return The content of the register on success, otherwise less than zero.
*/
int sceGeGetReg(SceGeReg regId);
/**
* Sets a GE hardware register.
*
* @param regId The register ID.
* @param value The value to set the register to.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeSetReg(SceGeReg regId, u32 value);
/**
* Sets the value of a command register, as if the command was executed.
*
* @param cmdOff The command ID.
* @param cmd The value to set the command to. (Only the least significant 24 bits are used.)
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeSetCmd(u32 cmdOff, u32 cmd);
/**
* Sets a matrix.
*
* @param id The matrix ID, one of SCE_GE_MTX_*.
* @param mtx The buffer storing the matrix.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeSetMtx(int id, int *mtx);
/**
* The value of the first argument passed to the log handler registered by sceGeRegisterLogHandler().
* The following arguments passed to the log handler depend on this.
*/
typedef enum SceGeLogType {
/** Display list was enqueued.
* Four arguments: display list ID, was enqueued as head, pointer to the command list,
* pointer to the stall address. */
SCE_GE_LOG_DL_ENQUEUED = 0,
/** Display list was dequeued.
* One argument: the display list ID. */
SCE_GE_LOG_DL_DEQUEUED = 1,
/** Display list's stall address was updated.
* Two arguments: the display list ID, and the new stall address. */
SCE_GE_LOG_DL_SADR_UPDATE = 2,
/** sceGeBreak() was triggered.
* One argument: whether the flag to reset the display list queue was set. */
SCE_GE_LOG_DL_BREAK = 3,
/** sceGeContinue() was triggered.
* One argument, always zero. */
SCE_GE_LOG_DL_CONTINUE = 4,
/** Display list is now running (when enqueued, when another display list finished,
* or when doing a sceGeContinue()). Three arguments: the display list ID, the pointer to
* its command list, the pointer to its stall address. */
SCE_GE_LOG_DL_RUNNING = 5,
/** Display list reached the ending FINISH/END sequence.
* Four arguments: display list ID, current pointer to the command list,
* and the two commands before it (in their running order). */
SCE_GE_LOG_DL_END = 6,
/** Display list caught a signal.
* Four arguments: display list ID, current pointer to the command list,
* and the two commands before it (in their running order). */
SCE_GE_LOG_DL_SIGNAL = 7,
} SceGeLogType;
/**
* A GE logging handler function. Takes a variable number of arguments depending on the
* logging type.
*/
typedef void (*SceGeLogHandler)(SceGeLogType logType, ...);
/**
* Registers a logging handler.
*
* @param handler The handler function.
*
* @return Zero.
*/
int sceGeRegisterLogHandler(SceGeLogHandler handler);
/**
* Sets or unsets the geometry clock.
*
* @param opt The value whose first bit enables or disables the geometry clock.
*
* @return The old state.
*/
int sceGeSetGeometryClock(int opt);
/**
* Inits the EDRAM memory.
*
* @return Zero.
*/
int sceGeEdramInit();
/**
* Sets the EDRAM refresh parameters.
*
* @param arg0 Unknown (0 or 1).
* @param arg1 Unknown (0 to 0x7FFFFF).
* @param arg2 Unknown (0 to 0x3FF).
* @param arg3 Unknown (0 to 0xF).
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeEdramSetRefreshParam(int arg0, int arg1, int arg2, int arg3);
/**
* Sets the EDRAM size to be enabled.
*
* @param size The size (0x200000 or 0x400000). Will return an error if 0x400000 is specified for the PSP FAT.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeEdramSetSize(int size);
/**
* Gets the EDRAM physical size.
*
* @return The EDRAM physical size.
*/
int sceGeEdramGetHwSize();
/**
* A GE breakpoint.
*/
typedef struct SceGeBreakpoint {
/** The address of the command where to break. */
u32 bpAddr;
/** The number of times to break there. */
int bpCount;
} SceGeBreakpoint;
/**
* Put breakpoints in the display list execution.
*
* @param inPtr A list of breakpoints to set.
* @param size The number of breakpoints to set.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGePutBreakpoint(SceGeBreakpoint *bp, int size);
/**
* Gets a breakpoint.
*
* @param outPtr The list of breakpoints (check sceGePutBreakpoint()).
* @param size The number of breakpoints to read.
* @param arg2 A pointer where will be stored the total number of breakpoints.
*
* @return The number of stored breakpoints on success, otherwise less than zero.
*/
int sceGeGetBreakpoint(SceGeBreakpoint *bp, int size, int *arg2);
/**
* Gets a list of the IDs of the display lists currently being in the queue.
*
* @param outPtr A buffer that will store the display lists' ID.
* @param size The number of IDs to store.
* @param totalCountPtr A point where will be stored the total number of display lists.
*
* @return The number of stored list IDs on success, otherwise less than zero.
*/
int sceGeGetListIdList(int *outPtr, int size, int *totalCountPtr);
/**
* Gets a display list from its ID.
*
* @param dlId The display list ID.
* @param outDl A pointer where the display list will be stored.
* @param outFlag A pointer where will be stored (outDl->state << 2) | outDl->signal.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeGetList(int dlId, SceGeDisplayList *outDl, int *outFlag);
/** @} */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011, 2012 The uOFW team
/* Copyright (C) The uOFW team
See the file COPYING for copying permission.
*/
@ -16,6 +16,9 @@
* @{
*/
/*
* List of commands accepted by the GE.
*/
#define SCE_GE_CMD_NOP 0x00
#define SCE_GE_CMD_VADR 0x01
#define SCE_GE_CMD_IADR 0x02
@ -76,8 +79,8 @@
#define SCE_GE_CMD_TGENN 0x40
#define SCE_GE_CMD_TGEND 0x41
#define SCE_GE_CMD_SX 0x42
#define SCE_GE_CMD_SY 0x43
#define SCE_GE_CMD_SZ 0x44
#define SCE_GE_CMD_SY 0x43
#define SCE_GE_CMD_SZ 0x44
#define SCE_GE_CMD_TX 0x45
#define SCE_GE_CMD_TY 0x46
#define SCE_GE_CMD_TZ 0x47
@ -262,6 +265,102 @@
#define SCE_GE_MTX_VIEW 9
#define SCE_GE_MTX_PROJ 10
#define SCE_GE_MTX_TGEN 11
#define SCE_GE_MTX_COUNT 12
/*
* List of signals which can be sent using the SIGNAL command.
*/
/**
* In SDK versions <= 0x02000010, pause the display list, call the callback with the SIGNAL argument,
* and restart the display list in the state specified in the END instruction.
* Otherwise, just call the callback. Resume GE execution afterwards.
*/
#define SCE_GE_SIGNAL_HANDLER_SUSPEND 0x01
/**
* Resume GE execution, then call the signal callback with the SIGNAL argument.
*/
#define SCE_GE_SIGNAL_HANDLER_CONTINUE 0x02
/**
* Set the current display list's status to PAUSE, its signal to the END argument and its signal data
* to the SIGNAL command, then resume GE execution.
*/
#define SCE_GE_SIGNAL_HANDLER_PAUSE 0x03
/**
* Set the current display list's signal to SYNC, then resume GE execution.
*/
#define SCE_GE_SIGNAL_SYNC 0x08
/**
* Jump to the (s << 16) | (e & 0xFFFF) address, where s is SIGNAL's argument and e is END's
*/
#define SCE_GE_SIGNAL_JUMP 0x10
/**
* Same as SCE_GE_SIGNAL_JUMP, but saving the status so we can use SCE_GE_SIGNAL_RET to return to the caller.
*/
#define SCE_GE_SIGNAL_CALL 0x11
/**
* Return after using a SCE_GE_SIGNAL_*CALL signal.
*/
#define SCE_GE_SIGNAL_RET 0x12
/**
* Same as SCE_GE_SIGNAL_JUMP, but where the address is relative to the current one.
*/
#define SCE_GE_SIGNAL_RJUMP 0x13
/**
* Same as SCE_GE_SIGNAL_CALL, but where the address is relative to the current one.
*/
#define SCE_GE_SIGNAL_RCALL 0x14
/**
* Same as SCE_GE_SIGNAL_JUMP, but where the address is relative to ORIGIN.
*/
#define SCE_GE_SIGNAL_OJUMP 0x15
/**
* Same as SCE_GE_SIGNAL_CALL, but where the address is relative to ORIGIN.
*/
#define SCE_GE_SIGNAL_OCALL 0x16
/**
* Run a TBP0/TBW0 pair with the same address as for SCE_GE_SIGNAL_RJUMP,
* taking ((e >> 16) & 0xFF) for the size.
*/
#define SCE_GE_SIGNAL_RTBP0 0x20
#define SCE_GE_SIGNAL_RTBP1 0x21
#define SCE_GE_SIGNAL_RTBP2 0x22
#define SCE_GE_SIGNAL_RTBP3 0x23
#define SCE_GE_SIGNAL_RTBP4 0x24
#define SCE_GE_SIGNAL_RTBP5 0x25
#define SCE_GE_SIGNAL_RTBP6 0x26
#define SCE_GE_SIGNAL_RTBP7 0x27
/**
* Run a TBP0/TBW0 pair with the same address as for SCE_GE_SIGNAL_OJUMP,
* taking ((e >> 16) & 0xFF) for the size.
*/
#define SCE_GE_SIGNAL_OTBP0 0x28
#define SCE_GE_SIGNAL_OTBP1 0x29
#define SCE_GE_SIGNAL_OTBP2 0x2A
#define SCE_GE_SIGNAL_OTBP3 0x2B
#define SCE_GE_SIGNAL_OTBP4 0x2C
#define SCE_GE_SIGNAL_OTBP5 0x2D
#define SCE_GE_SIGNAL_OTBP6 0x2E
#define SCE_GE_SIGNAL_OTBP7 0x2F
/**
* Same as SCE_GE_SIGNAL_RTBP0, for a CBP/CBW pair.
*/
#define SCE_GE_SIGNAL_RCBP 0x30
/**
* Same as SCE_GE_SIGNAL_OTBP0, for a CBP/CBW pair.
*/
#define SCE_GE_SIGNAL_OCBP 0x38
/**
* If deci2p operations are defined, break here and run the SCE_DECI2OP_GE_BREAK operation
* until it resumes operation.
*/
#define SCE_GE_SIGNAL_BREAK1 0xF0
/**
* Same as SCE_GE_SIGNAL_BREAK1, but break only if the breakpoint counter is -1 or equal
* to the defined value (ie, we reached the breakpoint the number of times specified when
* the breakpoint was created).
*/
#define SCE_GE_SIGNAL_BREAK2 0xFF
/** Structure storing a stack (for CALL/RET) */
typedef struct
@ -282,7 +381,7 @@ typedef void (*SceGeCallback)(int id, void *arg);
/** Structure to hold the callback data */
typedef struct
{
{
/** GE callback for the signal interrupt */
SceGeCallback signal_func;
/** GE callback argument for signal interrupt */
@ -321,81 +420,6 @@ typedef enum
SCE_GE_LIST_PAUSED
} SceGeListState;
/** State of a display list, internally */
typedef enum
{
/** No state assigned, the list is empty */
SCE_GE_DL_STATE_NONE = 0,
/** The list has been queued */
SCE_GE_DL_STATE_QUEUED, // 1
/** The list is being executed */
SCE_GE_DL_STATE_RUNNING, // 2
/** The list was completed and will be removed */
SCE_GE_DL_STATE_COMPLETED, // 3
/** The list has been paused by a signal */
SCE_GE_DL_STATE_PAUSED // 4
} SceGeDisplayListState;
/** Signal state of a display list */
typedef enum
{
/** No signal received */
SCE_GE_DL_SIGNAL_NONE = 0,
/** The break signal was received */
SCE_GE_DL_SIGNAL_BREAK, // 1
/** The pause signal was received */
SCE_GE_DL_SIGNAL_PAUSE, // 2
/** The sync signal was received */
SCE_GE_DL_SIGNAL_SYNC // 3
} SceGeDisplayListSignal;
/** Structure holding a display list */
typedef struct SceGeDisplayList
{
/** Next display list of the queue */
struct SceGeDisplayList *next;
/** Previous display list */
struct SceGeDisplayList *prev;
/** Current display list state */
SceGeDisplayListState state;
/** Current display list received signal */
SceGeDisplayListSignal signal;
/** 1 if context is up to date, 0 otherwise */
u8 ctxUpToDate;
/* (padding) */
char unused11;
/** The display list context */
SceGeContext *ctx; // 12
/** The display list flags */
int flags;
/** Pointer to the list of commands */
void *list; // 20
/** Pointer to the stall address, where the display list will stop being executed */
void *stall; // 24
/** Internal data */
int unk28;
/** Internal data */
int unk32;
/** Internal data */
int unk36;
/** Internal data */
int unk40;
/** Internal data */
int unk44;
/** Internal data */
int unk48;
/** The callbacks id set with sceGeSetCallback() */
short cbId; // 52
/** Some argument passed to the interrupt handler when calling the subintrs */
u16 unk54;
/** The number of stacks of the display list */
short numStacks; // 56
/** The offset of the current stack */
u16 stackOff; // 58
/** A pointer to the list of stacks */
SceGeStack *stack; // 60
} SceGeDisplayList; // size: 64
/**
* Updates the stall address.
*
@ -406,39 +430,6 @@ typedef struct SceGeDisplayList
int sceGeListUpdateStallAddr(int dlId, void *stall);
/**
* Inits the GE subsystem.
*
* @return Zero.
*/
int sceGeInit();
/**
* Ends the GE subsystem.
*
* @return Zer.o
*/
int sceGeEnd();
/**
* Gets a GE hardware register.
*
* @param regId The register ID.
*
* @return The content of the register on success, otherwise less than zero.
*/
int sceGeGetReg(u32 regId);
/**
* Sets a GE hardware register.
*
* @param regId The register ID.
* @param value The value to set the register to.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeSetReg(u32 regId, u32 value);
/**
* Gets a command (?).
*
* @param cmdOff The command ID.
@ -447,16 +438,6 @@ int sceGeSetReg(u32 regId, u32 value);
*/
int sceGeGetCmd(u32 cmdOff);
/**
* Sets a command (?).
*
* @param cmdOff The command ID.
* @param cmd The value to set the command to.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeSetCmd(u32 cmdOff, u32 cmd);
/**
* Gets a matrix.
*
@ -468,17 +449,7 @@ int sceGeSetCmd(u32 cmdOff, u32 cmd);
int sceGeGetMtx(int id, int *mtx);
/**
* Sets a matrix.
*
* @param id The matrix ID (0 - 11)
* @param mtx The buffer storing the matrix.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeSetMtx(int id, int *mtx);
/**
* Saves the current GE context into a structure.
* Saves the GE context of the current display list into a structure.
*
* @param ctx The structure to save the GE context in.
*
@ -495,52 +466,6 @@ int sceGeSaveContext(SceGeContext *ctx);
*/
int sceGeRestoreContext(SceGeContext *ctx);
/**
* Registers a logging handler.
*
* @param handler The handler function.
*
* @return Zero.
*/
int sceGeRegisterLogHandler(void (*handler)());
/**
* Sets or unsets the geometry clock.
*
* @param opt The value whose first bit enables or disables the geometry clock.
*
* @return The old state.
*/
int sceGeSetGeometryClock(int opt);
/**
* Inits the EDRAM memory.
*
* @return Zero.
*/
int sceGeEdramInit();
/**
* Sets the EDRAM refresh parameters.
*
* @param arg0 Unknown (0 or 1).
* @param arg1 Unknown (0 to 0x7FFFFF).
* @param arg2 Unknown (0 to 0x3FF).
* @param arg3 Unknown (0 to 0xF).
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeEdramSetRefreshParam(int arg0, int arg1, int arg2, int arg3);
/**
* Sets the EDRAM size.
*
* @param size The size (0x200000 or 0x400000).
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeEdramSetSize(int size);
/**
* Gets the EDRAM address.
*
@ -564,13 +489,6 @@ int sceGeEdramSetAddrTranslation(int arg);
*/
int sceGeEdramGetSize();
/**
* Gets the EDRAM physical size.
*
* @return The EDRAM physical size.
*/
int sceGeEdramGetHwSize();
/**
* Dequeues a list.
*
@ -625,49 +543,6 @@ int sceGeContinue();
*/
int sceGeSetCallback(SceGeCallbackData *cb);
/**
* Puts a breakpoint (used for debugging).
*
* @param inPtr A list of breakpoints, each one using 2 ints: one for the breakpoint address, and another one for the number of stops to do at the specified address.
* @param size The number of breakpoints to set.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGePutBreakpoint(int *inPtr, int size);
/**
* Gets a breakpoint.
*
* @param outPtr The list of breakpoints (check sceGePutBreakpoint()).
* @param size The number of breakpoints to read.
* @param arg2 A pointer where will be stored the total number of breakpoints.
*
* @return The number of stored breakpoints on success, otherwise less than zero.
*/
int sceGeGetBreakpoint(int *outPtr, int size, int *arg2);
/**
* Gets a list of the IDs of the display lists currently being in the queue.
*
* @param outPtr A buffer that will store the display lists' ID.
* @param size The number of IDs to store.
* @param totalCountPtr A point where will be stored the total number of display lists.
*
* @return The number of stored list IDs on success, otherwise less than zero.
*/
int sceGeGetListIdList(int *outPtr, int size, int *totalCountPtr);
/**
* Gets a display list from its ID.
*
* @param dlId The display list ID.
* @param outDl A pointer where the display list will be stored.
* @param outFlag A pointer where will be stored (outDl->state << 2) | outDl->signal.
*
* @return Zero on success, otherwise less than zero.
*/
int sceGeGetList(int dlId, SceGeDisplayList *outDl, int *outFlag);
/**
* Gets a stack from the current display list, using its ID.
*

View File

@ -0,0 +1,42 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/graphics/lib_font.h
*
* The lib_font library provides font glyph images to an application program.
*
*/
#ifndef LIB_FONT_H
#define LIB_FONT_H
#include "../common/errors.h"
/* lib_font specific error codes. */
#define SCE_FONT_NOERROR (SCE_ERROR_OK)
#define SCE_FONT_ERROR_NOMEMORY (0x80460001) /*!< Failed to allocate memory. */
#define SCE_FONT_ERROR_LIBID (0x80460002) /*!< Invalid library instance. */
#define SCE_FONT_ERROR_ARG (0x80460003) /*!< Invalid argument. */
#define SCE_FONT_ERROR_NOFILE (0x80460004) /*!< No file. */
#define SCE_FONT_ERROR_FILEOPEN (0x80460005) /*!< Failed to open specified file. */
#define SCE_FONT_ERROR_FILECLOSE (0x80460006) /*!< Failed to close specified file. */
#define SCE_FONT_ERROR_FILEREAD (0x80460007) /*!< Failed to read specified file. */
#define SCE_FONT_ERROR_FILESEEK (0x80460008) /*!< Failed to perform file seek operation. */
#define SCE_FONT_ERROR_TOOMANYOPENED (0x80460009) /*!< Too many opened fonts. */
#define SCE_FONT_ERROR_ILLEGALVERSION (0x8046000a) /*!< Unsupported font version. */
#define SCE_FONT_ERROR_DATAINCONSISTENT (0x8046000b) /*!< Font data is inconsistent. */
#define SCE_FONT_ERROR_EXPIRED (0x8046000c) /*!< Usage period expired. */
#define SCE_FONT_ERROR_REGISTRY (0x8046000d) /*!< System registry-related error. */
#define SCE_FONT_ERROR_NOSUPPORT (0x8046000e) /*!< Not supported. */
#define SCE_FONT_ERR_UNKNOWN (0x8046ffff) /*!< Unknown error. */
#endif /* LIB_FONT_H */

View File

@ -1,286 +1,306 @@
/* Copyright (C) 2011, 2012 The uOFW team
See the file COPYING for copying permission.
*/
#include "common_header.h"
#define SCE_O_RDONLY 0x0001
#define SCE_O_WRONLY 0x0002
#define SCE_O_RDWR (SCE_O_RDONLY | SCE_O_WRONLY)
#define SCE_O_NBLOCK 0x0004
#define SCE_O_DIROPEN 0x0008 // Internal use for dopen
#define SCE_O_APPEND 0x0100
#define SCE_O_CREAT 0x0200
#define SCE_O_TRUNC 0x0400
#define SCE_O_EXCL 0x0800
#define SCE_O_NOWAIT 0x8000
#define SCE_O_UNKNOWN0 0x04000000
/** user read/write/execute permission. */
#define SCE_STM_RWXU 00700
/** user read permission. */
#define SCE_STM_RUSR 00400
/** user write permission. */
#define SCE_STM_WUSR 00200
/** user execute permission. */
#define SCE_STM_XUSR 00100
/** group read/write/execute permission. */
#define SCE_STM_RWXG 00070
/** group read permission. */
#define SCE_STM_RGRP 00040
/** group write permission. */
#define SCE_STM_WGRP 00020
/** group execute permission. */
#define SCE_STM_XGRP 00010
/** other read/write/execute permission. */
#define SCE_STM_RWXO 00007
/** other read permission. */
#define SCE_STM_ROTH 00004
/** other write permission. */
#define SCE_STM_WOTH 00002
/** other execute permission. */
#define SCE_STM_XOTH 00001
/** user/group/other - read/write/execute. */
#define SCE_STM_RWXUGO (SCE_STM_RWXU|SCE_STM_RWXG|SCE_STM_RWXO)
/** user/group/other - read. */
#define SCE_STM_RUGO (SCE_STM_RUSR|SCE_STM_RGRP|SCE_STM_ROTH)
/** user/group/other - write. */
#define SCE_STM_WUGO (SCE_STM_WUSR|SCE_STM_WGRP|SCE_STM_WOTH)
/** user/group/other - execute. */
#define SCE_STM_XUGO (SCE_STM_XUSR|SCE_STM_XGRP|SCE_STM_XOTH)
#define SCE_SEEK_SET 0
#define SCE_SEEK_CUR 1
#define SCE_SEEK_END 2
typedef struct ScePspDateTime {
u16 year;
u16 month;
u16 day;
u16 hour;
u16 minute;
u16 second;
u32 microsecond;
} ScePspDateTime;
struct SceIoDeviceArg;
typedef struct SceIoDeviceArg SceIoDeviceArg;
struct SceIoIob;
typedef struct SceIoIob SceIoIob;
typedef struct
{
SceMode st_mode;
u32 st_attr;
SceOff st_size;
ScePspDateTime st_ctime;
ScePspDateTime st_atime;
ScePspDateTime st_mtime;
u32 st_private[6];
} SceIoStat;
typedef struct
{
SceIoStat d_stat;
char d_name[256];
void *d_private;
int dummy;
} SceIoDirent;
typedef struct
{
int (*IoInit)(SceIoDeviceArg *dev);
int (*IoExit)(SceIoDeviceArg *dev);
int (*IoOpen)(SceIoIob *iob, char *file, int flags, SceMode mode);
int (*IoClose)(SceIoIob *iob);
int (*IoRead)(SceIoIob *iob, char *data, int len);
int (*IoWrite)(SceIoIob *iob, const char *data, int len);
SceOff (*IoLseek)(SceIoIob *iob, SceOff ofs, int whence);
int (*IoIoctl)(SceIoIob *iob, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
int (*IoRemove)(SceIoIob *iob, const char *name);
int (*IoMkdir)(SceIoIob *iob, const char *name, SceMode mode);
int (*IoRmdir)(SceIoIob *iob, const char *name);
int (*IoDopen)(SceIoIob *iob, const char *dirname);
int (*IoDclose)(SceIoIob *iob);
int (*IoDread)(SceIoIob *iob, SceIoDirent *dir);
int (*IoGetstat)(SceIoIob *iob, const char *file, SceIoStat *stat);
int (*IoChstat)(SceIoIob *iob, const char *file, SceIoStat *stat, int bits);
int (*IoRename)(SceIoIob *iob, const char *oldname, const char *newname);
int (*IoChdir)(SceIoIob *iob, const char *dir);
int (*IoMount)(SceIoIob *iob, const char *fs, const char *blockDev, int mode, void *unk1, int unk2);
int (*IoUmount)(SceIoIob *iob, const char *blockDev);
int (*IoDevctl)(SceIoIob *iob, const char *devname, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
int (*IoCancel)(SceIoIob *iob);
} SceIoDrvFuncs;
typedef struct
{
const char *name;
u32 dev_type;
u32 unk2;
const char *name2;
SceIoDrvFuncs *funcs;
} SceIoDrv;
struct SceIoDeviceArg
{
SceIoDrv *drv;
void *argp;
int openedFiles;
};
struct SceIoHookType;
typedef struct SceIoHookType SceIoHookType;
struct SceIoHook;
typedef struct SceIoHook SceIoHook;
typedef struct
{
void (*Add)(SceIoHookType **hook);
int unused4;
int (*Preobe)(SceIoHook *hook, char *file, int flags, SceMode mode);
int (*Open)(SceIoHook *hook, char *file, int flags, SceMode mode);
int (*Close)(SceIoHook *hook);
int (*Read)(SceIoHook *hook, void *data, SceSize size);
int (*Write)(SceIoHook *hook, const void *data, SceSize size);
SceOff (*Lseek)(SceIoHook *hook, SceOff ofs, int whence);
int (*Ioctl)(SceIoHook *iob, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
} SceIoHookFuncs;
struct SceIoHookType
{
char *name;
int unk4;
int unk8;
char *name2;
SceIoHookFuncs *funcs;
};
typedef struct
{
int size; // 0
char name[32]; // 4
int attribute; // 36
int unk40; // 40
const char *drvName; // 44
int fsNum; // 48
char *newPath; // 52
int retAddr; // 56
int curThread; // 60
int asyncThread; // 64
int isAsync; // 68
int asyncCmd; // 72
SceIoIob *iob; // 76
int unk80; // 80
int unk84; // 84
} SceIoFdDebugInfo;
typedef struct
{
SceIoHookType *hook;
void *argp;
} SceIoHookArg;
struct SceIoHook
{
SceIoHookArg *arg;
SceIoIob *iob;
SceIoDrvFuncs *funcs;
};
struct SceIoIob
{
int unk000; // some ID
int fsNum; // 4
SceIoDeviceArg *dev; // 8
int dev_type; // 12
int unk016; // 16
int unk020; // 20
int unk024; // 24
int unk028; // 28
int unk032; // 32
int unk036; // 36
int unk040; // 40
SceUID curThread; // 44
char userMode; // 48
char powerLocked; // 49
char unk050;
char asyncPrio; // 51
SceUID asyncThread; // 52
SceUID asyncSema; // 56
SceUID asyncEvFlag; // 60
SceUID asyncCb; // 64
void *asyncCbArgp; // 68
int unused72; // 72
int k1; // 76
s64 asyncRet; // 80
int asyncArgs[6]; // 88
int asyncCmd; // 112
int userLevel; // 116
SceIoHook hook; // 120
int unk132; // 132
char *newPath; // 136
int retAddr; // 140
};
int sceIoChangeAsyncPriority(int fd, int prio);
void sceIoCloseAll();
int sceIoReopen(const char *file, int flags, SceMode mode, int fd);
SceUID sceIoDopen(const char *dirname);
int sceIoDread(int fd, SceIoDirent *dir);
int sceIoDclose(int fd);
int sceIoRemove(const char *file);
int sceIoRename(const char *oldname, const char *newname);
int sceIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
/* IO-Assign mount mode flags. */
#define SCE_MT_RDWR 0x00 /** Mount as read/write enabled. */
#define SCE_MT_RDONLY 0x01 /** Mount as read-only. */
#define SCE_MT_ROBUST 0x02 /** Mount in ROBUST mode. */
#define SCE_MT_ERRCHECK 0x04 /** Set an error if there is anythign abnormal in the file system when mounting. */
int sceIoAssign(const char *dev, const char *blockDev, const char *fs, int mode, void* unk1, int unk2);
int sceIoUnassign(const char *dev);
int sceIoChangeThreadCwd(SceUID threadId, const char *path);
int sceIoCancel(int fd);
int sceIoGetFdList(SceUID *fds, int numFd, int *count);
int sceIoGetFdDebugInfo(int fd, SceIoFdDebugInfo *outInfo);
int sceIoAddDrv(SceIoDrv *drv);
int sceIoDelDrv(const char *drv);
int sceIoGetUID(int fd);
int sceIoPollAsync(SceUID fd, SceInt64 *res);
int sceIoWaitAsync(SceUID fd, SceInt64 *res);
int sceIoWaitAsyncCB(SceUID fd, SceInt64 *res);
int sceIoGetAsyncStat(SceUID fd, int poll, SceInt64 *res);
int sceIoSetAsyncCallback(SceUID fd, SceUID cb, void *argp);
int sceIoValidateFd(SceUID fd, int arg1);
int sceIoClose(SceUID fd);
int sceIoCloseAsync(SceUID fd);
SceUID sceIoOpen(const char *file, int flags, SceMode mode);
SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode);
int sceIoRead(SceUID fd, void *data, SceSize size);
int sceIoReadAsync(SceUID fd, void *data, SceSize size);
int sceIoWrite(SceUID fd, const void *data, SceSize size);
int sceIoWriteAsync(SceUID fd, const void *data, SceSize size);
SceOff sceIoLseek(SceUID fd, SceOff offset, int whence);
SceOff sceIoLseekAsync(SceUID fd, SceOff offset, int whence);
int sceIoLseek32(SceUID fd, int offset, int whence);
int sceIoLseek32Async(SceUID fd, int offset, int whence);
int sceIoIoctl(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
int sceIoIoctlAsync(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
int sceIoMkdir(const char *path, SceMode mode);
int sceIoRmdir(const char *path);
int sceIoChdir(const char *path);
int sceIoGetstat(const char *file, SceIoStat *stat);
int sceIoChstat(const char *file, SceIoStat *stat, int bits);
int sceIoSync(const char *device, unsigned int unk);
int sceIoGetDevType(SceUID fd);
int sceIoGetThreadCwd(SceUID uid, char *dir, int len);
int sceIoTerminateFd(char *drive);
int sceIoAddHook(SceIoHookType *hook);
int sceIoGetIobUserLevel(SceIoIob *iob);
/* Copyright (C) 2011, 2012 The uOFW team
See the file COPYING for copying permission.
*/
#include "common_header.h"
/* flags */
#define SCE_FREAD (0x0001) /* readable */
#define SCE_FWRITE (0x0002) /* writable */
#define SCE_FNBLOCK (0x0004) /* Reserved: non-blocking reads */
#define SCE_FDIRO (0x0008) /* internal use for dopen */
#define SCE_FRLOCK (0x0010) /* Reserved: read locked (non-shared) */
#define SCE_FWLOCK (0x0020) /* Reserved: write locked (non-shared) */
#define SCE_FAPPEND (0x0100) /* append on each write */
#define SCE_FCREAT (0x0200) /* create if nonexistant */
#define SCE_FTRUNC (0x0400) /* truncate to zero length */
#define SCE_EXCL (0x0800) /* exclusive create */
#define SCE_FSCAN (0x1000) /* Reserved: scan type */
#define SCE_FRCOM (0x2000) /* Reserved: remote command entry */
#define SCE_FNBUF (0x4000) /* Reserved: no ring buf. and console interrupt */
#define SCE_FASYNC (0x8000) /* Reserved: asyncronous i/o */
#define SCE_FFDEXCL (0x01000000) /* exclusive access */
#define SCE_FPWLOCK (0x02000000) /* power control lock */
#define SCE_FENCRYPTED (0x04000000)
#define SCE_FGAMEDATA (0x40000000)
/* flags for sceIoOpen() */
#define SCE_O_RDONLY (SCE_FREAD) /* readable */
#define SCE_O_WRONLY (SCE_FWRITE) /* writable */
#define SCE_O_RDWR (SCE_FREAD|SCE_FWRITE) /* readable & writable */
#define SCE_O_NBLOCK (SCE_FNBLOCK) /* Reserved: Non-Blocking I/O */
#define SCE_O_APPEND (SCE_FAPPEND) /* append (writes guaranteed at the end) */
#define SCE_O_CREAT (SCE_FCREAT) /* open with file create */
#define SCE_O_TRUNC (SCE_FTRUNC) /* open with truncation */
#define SCE_O_EXCL (SCE_EXCL) /* exclusive create */
#define SCE_O_NOBUF (SCE_FNBUF) /* Reserved: no device buffer and console interrupt */
#define SCE_O_NOWAIT (SCE_FASYNC) /* Reserved: asyncronous i/o */
#define SCE_O_FDEXCL (SCE_FFDEXCL) /* exclusive access */
#define SCE_O_PWLOCK (SCE_FPWLOCK) /* power control lock */
#define SCE_O_ENCRYPTED (SCE_FENCRYPTED) /* encrypted file (uses Kernel/DNAS/NPDRM-encryption) */
#define SCE_O_FGAMEDATA (SCE_FGAMEDATA)
/* sceIoOpen().mode permission bits */
#define SCE_STM_RWXU 00700 /* user read/write/execute permission. */
#define SCE_STM_RUSR 00400 /* user read permission. */
#define SCE_STM_WUSR 00200 /* user write permission. */
#define SCE_STM_XUSR 00100 /* user execute permission. */
#define SCE_STM_RWXG 00070 /* group read/write/execute permission. */
#define SCE_STM_RGRP 00040 /* group read permission. */
#define SCE_STM_WGRP 00020 /* group write permission. */
#define SCE_STM_XGRP 00010 /* group execute permission. */
#define SCE_STM_RWXO 00007 /* other read/write/execute permission. */
#define SCE_STM_ROTH 00004 /* other read permission. */
#define SCE_STM_WOTH 00002 /* other write permission. */
#define SCE_STM_XOTH 00001 /* other execute permission. */
#define SCE_STM_RWXUGO (SCE_STM_RWXU|SCE_STM_RWXG|SCE_STM_RWXO) /* user/group/other - read/write/execute. */
#define SCE_STM_RUGO (SCE_STM_RUSR|SCE_STM_RGRP|SCE_STM_ROTH) /* user/group/other - read. */
#define SCE_STM_WUGO (SCE_STM_WUSR|SCE_STM_WGRP|SCE_STM_WOTH) /* user/group/other - write. */
#define SCE_STM_XUGO (SCE_STM_XUSR|SCE_STM_XGRP|SCE_STM_XOTH) /* user/group/other - execute. */
/* flags for sceIoLseek().whence */
#define SCE_SEEK_SET 0 /* Offset is the distance from the start of the file. */
#define SCE_SEEK_CUR 1 /* Offset is the relative distance from the current position in the file. */
#define SCE_SEEK_END 2 /* Offset is the distance from the end of the file. */
typedef struct ScePspDateTime {
u16 year;
u16 month;
u16 day;
u16 hour;
u16 minute;
u16 second;
u32 microsecond;
} ScePspDateTime;
struct SceIoDeviceArg;
typedef struct SceIoDeviceArg SceIoDeviceArg;
struct SceIoIob;
typedef struct SceIoIob SceIoIob;
typedef struct
{
SceMode st_mode;
u32 st_attr;
SceOff st_size;
ScePspDateTime st_ctime;
ScePspDateTime st_atime;
ScePspDateTime st_mtime;
u32 st_private[6];
} SceIoStat;
typedef struct
{
SceIoStat d_stat;
char d_name[256];
void *d_private;
int dummy;
} SceIoDirent;
typedef struct
{
int (*IoInit)(SceIoDeviceArg *dev);
int (*IoExit)(SceIoDeviceArg *dev);
int (*IoOpen)(SceIoIob *iob, char *file, int flags, SceMode mode);
int (*IoClose)(SceIoIob *iob);
int (*IoRead)(SceIoIob *iob, char *data, int len);
int (*IoWrite)(SceIoIob *iob, const char *data, int len);
SceOff (*IoLseek)(SceIoIob *iob, SceOff ofs, int whence);
int (*IoIoctl)(SceIoIob *iob, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
int (*IoRemove)(SceIoIob *iob, const char *name);
int (*IoMkdir)(SceIoIob *iob, const char *name, SceMode mode);
int (*IoRmdir)(SceIoIob *iob, const char *name);
int (*IoDopen)(SceIoIob *iob, const char *dirname);
int (*IoDclose)(SceIoIob *iob);
int (*IoDread)(SceIoIob *iob, SceIoDirent *dir);
int (*IoGetstat)(SceIoIob *iob, const char *file, SceIoStat *stat);
int (*IoChstat)(SceIoIob *iob, const char *file, SceIoStat *stat, int bits);
int (*IoRename)(SceIoIob *iob, const char *oldname, const char *newname);
int (*IoChdir)(SceIoIob *iob, const char *dir);
int (*IoMount)(SceIoIob *iob, const char *fs, const char *blockDev, int mode, void *unk1, int unk2);
int (*IoUmount)(SceIoIob *iob, const char *blockDev);
int (*IoDevctl)(SceIoIob *iob, const char *devname, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
int (*IoCancel)(SceIoIob *iob);
} SceIoDrvFuncs;
typedef struct
{
const char *name;
u32 dev_type;
u32 unk2;
const char *name2;
SceIoDrvFuncs *funcs;
} SceIoDrv;
struct SceIoDeviceArg
{
SceIoDrv *drv;
void *argp;
int openedFiles;
};
struct SceIoHookType;
typedef struct SceIoHookType SceIoHookType;
struct SceIoHook;
typedef struct SceIoHook SceIoHook;
typedef struct
{
void (*Add)(SceIoHookType **hook);
int unused4;
int (*Preobe)(SceIoHook *hook, char *file, int flags, SceMode mode);
int (*Open)(SceIoHook *hook, char *file, int flags, SceMode mode);
int (*Close)(SceIoHook *hook);
int (*Read)(SceIoHook *hook, void *data, SceSize size);
int (*Write)(SceIoHook *hook, const void *data, SceSize size);
SceOff (*Lseek)(SceIoHook *hook, SceOff ofs, int whence);
int (*Ioctl)(SceIoHook *iob, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
} SceIoHookFuncs;
struct SceIoHookType
{
char *name;
int unk4;
int unk8;
char *name2;
SceIoHookFuncs *funcs;
};
typedef struct
{
int size; // 0
char name[32]; // 4
int attribute; // 36
int unk40; // 40
const char *drvName; // 44
int fsNum; // 48
char *newPath; // 52
int retAddr; // 56
int curThread; // 60
int asyncThread; // 64
int isAsync; // 68
int asyncCmd; // 72
SceIoIob *iob; // 76
int unk80; // 80
int unk84; // 84
} SceIoFdDebugInfo;
typedef struct
{
SceIoHookType *hook;
void *argp;
} SceIoHookArg;
struct SceIoHook
{
SceIoHookArg *arg;
SceIoIob *iob;
SceIoDrvFuncs *funcs;
};
struct SceIoIob
{
int unk000; // some ID
int fsNum; // 4
SceIoDeviceArg *dev; // 8
int dev_type; // 12
int unk016; // 16
int unk020; // 20
int unk024; // 24
int unk028; // 28
int unk032; // 32
int unk036; // 36
int unk040; // 40
SceUID curThread; // 44
char userMode; // 48
char powerLocked; // 49
char unk050;
char asyncPrio; // 51
SceUID asyncThread; // 52
SceUID asyncSema; // 56
SceUID asyncEvFlag; // 60
SceUID asyncCb; // 64
void *asyncCbArgp; // 68
int unused72; // 72
int k1; // 76
s64 asyncRet; // 80
int asyncArgs[6]; // 88
int asyncCmd; // 112
int userLevel; // 116
SceIoHook hook; // 120
int unk132; // 132
char *newPath; // 136
int retAddr; // 140
};
int sceIoChangeAsyncPriority(int fd, int prio);
void sceIoCloseAll();
int sceIoReopen(const char *file, int flags, SceMode mode, int fd);
SceUID sceIoDopen(const char *dirname);
int sceIoDread(int fd, SceIoDirent *dir);
int sceIoDclose(int fd);
int sceIoRemove(const char *file);
int sceIoRename(const char *oldname, const char *newname);
int sceIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
/* IO-Assign mount mode flags. */
#define SCE_MT_RDWR 0x00 /** Mount as read/write enabled. */
#define SCE_MT_RDONLY 0x01 /** Mount as read-only. */
#define SCE_MT_ROBUST 0x02 /** Mount in ROBUST mode. */
#define SCE_MT_ERRCHECK 0x04 /** Set an error if there is anything abnormal in the file system when mounting. */
int sceIoAssign(const char *dev, const char *blockDev, const char *fs, int mode, void* unk1, int unk2);
int sceIoUnassign(const char *dev);
int sceIoChangeThreadCwd(SceUID threadId, const char *path);
int sceIoCancel(int fd);
int sceIoGetFdList(SceUID *fds, int numFd, int *count);
int sceIoGetFdDebugInfo(int fd, SceIoFdDebugInfo *outInfo);
int sceIoAddDrv(SceIoDrv *drv);
int sceIoDelDrv(const char *drv);
int sceIoGetUID(int fd);
int sceIoPollAsync(SceUID fd, SceInt64 *res);
int sceIoWaitAsync(SceUID fd, SceInt64 *res);
int sceIoWaitAsyncCB(SceUID fd, SceInt64 *res);
int sceIoGetAsyncStat(SceUID fd, int poll, SceInt64 *res);
int sceIoSetAsyncCallback(SceUID fd, SceUID cb, void *argp);
int sceIoValidateFd(SceUID fd, int arg1);
int sceIoClose(SceUID fd);
int sceIoCloseAsync(SceUID fd);
SceUID sceIoOpen(const char *file, int flags, SceMode mode);
SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode);
int sceIoRead(SceUID fd, void *data, SceSize size);
int sceIoReadAsync(SceUID fd, void *data, SceSize size);
int sceIoWrite(SceUID fd, const void *data, SceSize size);
int sceIoWriteAsync(SceUID fd, const void *data, SceSize size);
SceOff sceIoLseek(SceUID fd, SceOff offset, int whence);
SceOff sceIoLseekAsync(SceUID fd, SceOff offset, int whence);
int sceIoLseek32(SceUID fd, int offset, int whence);
int sceIoLseek32Async(SceUID fd, int offset, int whence);
/* IOCTL */
/* ioctl commands */
#define SCE_GAMEDATA_SET_SECURE_INSTALL_ID (0x04100001)
int sceIoIoctl(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
int sceIoIoctlAsync(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
/* Directory functions */
int sceIoMkdir(const char *path, SceMode mode);
int sceIoRmdir(const char *path);
int sceIoChdir(const char *path);
int sceIoGetstat(const char *file, SceIoStat *stat);
int sceIoChstat(const char *file, SceIoStat *stat, int bits);
int sceIoSync(const char *device, unsigned int unk);
int sceIoGetDevType(SceUID fd);
int sceIoGetThreadCwd(SceUID uid, char *dir, int len);
int sceIoTerminateFd(char *drive);
int sceIoAddHook(SceIoHookType *hook);
int sceIoGetIobUserLevel(SceIoIob *iob);

41
include/libaac.h Normal file
View File

@ -0,0 +1,41 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef LIBAAC_H
#define LIBAAC_H
#include <common_header.h>
typedef struct {
s32 streamStart; // 0
s32 start; // 4
s32 streamEnd; // 8
s32 end; // 12
void *encBuf; // 16
s32 encSize; // 20
void *decBuf; // 24
s32 decSize; // 28
s32 sampleRate; // 32
s32 zero; // 36
} SceAacInitArg;
s32 sceAacEndEntry(void);
s32 sceAacInitResource(s32 nbr);
s32 sceAacTermResource(void);
s32 sceAacInit(SceAacInitArg *arg);
s32 sceAac_E955E83A(s32 *sampleRate);
s32 sceAacExit(s32 id);
s32 sceAacDecode(s32 id, void** src);
s32 sceAac_FA01FCB6(s32 id, void *arg1, s32 *arg2, void *arg3, s32 *arg4);
s32 sceAacCheckStreamDataNeeded(s32 id);
s32 sceAacGetInfoToAddStreamData(s32 id, s32 **arg1, s32 *arg2, s32 *arg3);
s32 sceAacNotifyAddStreamData(s32 id, s32 size);
s32 sceAacResetPlayPosition(s32 id);
s32 sceAacSetLoopNum(s32 id, s32 loopNum);
s32 sceAacGetMaxOutputSample(s32 id);
s32 sceAacGetSumDecodedSample(s32 id);
s32 sceAacGetLoopNum(s32 id);
s32 sceAacStartEntry(SceSize argc, void *argp);
#endif /* LIBAAC_H */

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
* Manages the UMD drive and accessing data on it.
*/
/** @defgroup Mediaman Mediaman
/** @defgroup MediaMan Media_Manager
* @ingroup UMDDriveManagement
*
* Mediaman enables users to access the UMD drive. The drive can be accessed through files or sectors. \n
@ -42,7 +42,7 @@ extern "C" {
#endif
/** UMD file system alias name. */
#define SCE_UMD_ALIAS_NAME "disc0:"
#define SCE_UMD_ALIAS_NAME "disc0:"
/** LBA raw sector access. */
#define SCE_UMD_LBA_DEVICE_NAME "umd1:"
@ -52,7 +52,7 @@ extern "C" {
*/
enum SceUmdDiscStates {
/** The UMD driver has been initiated. */
SCE_UMD_INIT = (0),
SCE_UMD_INIT = (0),
/** A medium has been removed. */
SCE_UMD_MEDIA_OUT = (1 << 0),
/** A medium has been inserted. */
@ -62,7 +62,7 @@ enum SceUmdDiscStates {
/** The UMD device is not ready. */
SCE_UMD_NOT_READY = (1 << 3),
/** The UMD device is ready. */
SCE_UMD_READY = (1 << 4),
SCE_UMD_READY = (1 << 4),
/** The inserted medium is readable. */
SCE_UMD_READABLE = (1 << 5),
};
@ -92,9 +92,9 @@ enum SceUmdMediaTypeFormats {
typedef struct {
/** The size of the used SceUmdDiscInfo version. uiSize = sizeof(SceUmdDiscInfo). */
SceSize uiSize;
SceSize uiSize;
/** Defines the media type of the UMD. One of ::SceUmdMediaTypeFormats. */
u32 uiMediaType;
u32 uiMediaType;
} SceUmdDiscInfo;

View File

@ -1,11 +1,13 @@
/* Copyright (C) 2011, 2012, 2013, 2014 The uOFW team
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
#include "common_header.h"
/** @defgroup MediamanKernel Mediaman Kernel
* @ingroup Mediaman
#include "mediaman.h"
/** @defgroup MediaManKernel Media_Manager Kernel
* @ingroup MediaMan
*
* Kernel application API.
* @{
@ -48,9 +50,9 @@ u32 sceUmdRegisterGetUMDInfoCallBack(s32 (*umdInfoCallback)(SceUmdDiscInfo *), S
u32 sceUmdUnRegisterGetUMDInfoCallBack(void);
u32 sceUmd_63517CBA(s32 (*arg0)(void *), void *arg1);
u32 sceUmdRegisterMediaPresentCallBack(s32(*MediaPresentCallback)(void *), void *param);
u32 sceUmd_1471F63D(void);
u32 sceUmdUnRegisterMediaPresentCallBack(void);
void sceUmdUnRegisterActivateCallBack(void);
@ -93,7 +95,7 @@ s32 sceUmdDeactivate(s32 mode, const char *aliasName);
* @param pDiscInfo Pointer to a SceUmdDiscInfo structure to retrieve the disc information.
*
* @return SCE_ERROR_OK on success, otherwise SCE_ERROR_ERRNO_INVALID_ARGUMENT on invalid arguments;
* SCE_ERROR_UMD_NO_MEDIUM if there is no UMD medium inserted.
* SCE_UMD_ERROR_NO_MEDIUM if there is no UMD medium inserted.
*/
s32 sceUmdGetDiscInfo(SceUmdDiscInfo *pDiscInfo);

View File

@ -5,8 +5,8 @@
#include "common_header.h"
#include "mediaman.h"
/** @defgroup MediamanUser Mediaman User
* @ingroup Mediaman
/** @defgroup MediaManUser Media_Manager User
* @ingroup MediaMan
*
* User application API.
* @{
@ -46,7 +46,7 @@ s32 sceUmdDeactivate(s32 mode, const char *aliasName);
* @param pDiscInfo Pointer to a SceUmdDiscInfo structure to retrieve the disc information.
*
* @return SCE_ERROR_OK on success, otherwise SCE_ERROR_ERRNO_INVALID_ARGUMENT on invalid arguments;
* SCE_ERROR_UMD_NO_MEDIUM if there is no UMD medium inserted.
* SCE_UMD_ERROR_NO_MEDIUM if there is no UMD medium inserted.
*/
s32 sceUmdGetDiscInfo(SceUmdDiscInfo *pDiscInfo);

View File

@ -24,7 +24,7 @@
*
* @return 0 on success.
*/
s32 memlmd_EF73E85B(u8 *prx, u32 size, u32 *newsize);
s32 memlmd_EF73E85B(u8 *prx, u32 size, u32 * newSize);
/**
* Checks the param against a magic value (unknown usage)
@ -65,7 +65,7 @@ s32 memlmd_F26A33C3(u32 unk, vs32 *hashAddr);
*
* @return 0 on success.
*/
s32 memlmd_CF03556B(u8 *prx, u32 size, u32 *newsize);
s32 memlmd_CF03556B(u8 *prx, u32 size, u32 * newSize);
/**
* Unsign a module. Asynced mode.
@ -85,5 +85,22 @@ s32 memlmd_6192F715(u8 *addr, u32 size);
*/
s32 memlmd_2F3D7E2D(void);
/**
* Enables KIRK, then performs a command in asynchronised mode (refreshes
* CPU D cache for input and output buffer), and disables KIRK.
*
* @param outbuff Output buffer.
* @param outsize Output size.
* @param inbuff Input buffer.
* @param insize Input size.
* @param cmd Number of KIRK command to perform.
*
* @return 0 on success.
*/
int sceUtilsBufferCopyWithRange(u8* outbuff, int outsize, u8* inbuff, int insize, int cmd);
int sceUtilsBufferCopyByPollingWithRange(u8* outbuff, int outsize, u8* inbuff, int insize, int cmd);
int sceUtilsBufferCopy(u8* outbuff, u8 *inbuff, int cmd);
int sceUtilsBufferCopyByPolling(u8* outbuff, u8 *inbuff, int cmd);
#endif /* MEMLMD_H */

View File

@ -16,11 +16,11 @@ s32 sceMesgLed_driver_B2CDAC3F(u8 *buf, u32 size, u32 *newSize);
s32 sceMesgLed_driver_C79E3488(u8 *buf, u32 size, u32 *newSize);
s32 sceMesgLed_driver_21AFFAAC(u8 *buf, u32 size, u32 *newSize);
s32 sceMesgLed_driver_C00DAD75(u8 *buf, u32 size, u32 *newSize);
s32 sceMesgLed_driver_CED2C075(u8 *buf, u32 size, u32 *newSize, u32 arg4);
s32 sceMesgLed_driver_C7D1C16B(u8 *buf, u32 size, u32 *newSize, u32 arg4);
s32 sceMesgLed_driver_EBB4613D(u8 *buf, u32 size, u32 *newSize, u32 arg4);
s32 sceMesgLed_driver_66B348B2(u8 *buf, u32 size, u32 *newSize, u32 arg4);
s32 sceMesgLed_driver_CED2C075(u8 *buf, u32 size, u32 *newSize, void *arg4);
s32 sceMesgLed_driver_C7D1C16B(u8 *buf, u32 size, u32 *newSize, void *arg4);
s32 sceMesgLed_driver_EBB4613D(u8 *buf, u32 size, u32 *newSize, void *arg4);
s32 sceMesgLed_driver_66B348B2(u8 *buf, u32 size, u32 *newSize, void *arg4);
s32 sceMesgLed_driver_B2D95FDF(u8 *buf, u32 size, u32 *newSize);
s32 sceMesgLed_driver_91E0A9AD(u8 *buf, u32 size, u32 *newSize, u32 arg4);
s32 sceMesgLed_driver_31D6D8AA(u8 *buf, u32 size, u32 *newSize, u32 arg4);
s32 sceMesgLed_driver_91E0A9AD(u8 *buf, u32 size, u32 *newSize, void *arg4);
s32 sceMesgLed_driver_31D6D8AA(u8 *buf, u32 size, u32 *newSize, void *arg4);

View File

@ -1,47 +0,0 @@
/* Copyright (C) 2011, 2012 The uOFW team
See the file COPYING for copying permission.
*/
/*
* modulemgr.h
*
* The module manager API.
*
*/
#include "common_header.h"
#ifndef MODULEMGR_H
#define MODULEMGR_H
/** The maximum number of segments a module can have. */
#define SCE_KERNEL_MAX_MODULE_SEGMENT (4)
/** The module will remain in memory and act as a resident library. */
#define SCE_KERNEL_RESIDENT (0)
/** The module is not a resident one, meaning it won't stay in memory and act as a resident library. */
#define SCE_KERNEL_NO_RESIDENT (1)
#define SCE_KERNEL_STOP_SUCCESS (0)
#define SCE_KERNEL_STOP_FAIL (1)
enum ModuleMgrMcbStatus {
MCB_STATUS_NOT_LOADED = 0,
MCB_STATUS_LOADING = 1,
MCB_STATUS_LOADED = 2,
MCB_STATUS_RELOCATED = 3,
MCB_STATUS_STARTING = 4,
MCB_STATUS_STARTED = 5,
MCB_STATUS_STOPPING = 6,
MCB_STATUS_STOPPED = 7,
MCB_STATUS_UNLOADED = 8
};
s32 ModuleMgrForKernel_C3DDABEF(SceUID, void *, void *);
s32 sceKernelRebootBeforeForUser(void *);
s32 sceKernelRebootPhaseForKernel(s32, void *, s32, s32);
s32 sceKernelRebootBeforeForKernel(void *, s32, s32, s32);
#endif /* MODULEMGR_H */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
@ -57,89 +57,108 @@ enum SceApplicationType {
/**
* API types of an executable.
*/
enum SceInitApiType {
enum SceFileExecApiType {
SCE_EXEC_FILE_APITYPE_MODULE_KERNEL = 0x000,
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_KERNEL = 0x002,
SCE_EXEC_FILE_APITYPE_MODULE_KERNEL_BLOCK = 0x003,
SCE_EXEC_FILE_APITYPE_MODULE_USER = 0x010,
SCE_EXEC_FILE_APITYPE_MODULE_MS = 0x011,
SCE_EXEC_FILE_APITYPE_MODULE_DNAS = 0x013,
SCE_EXEC_FILE_APITYPE_MODULE_NPDRM = 0x014,
SCE_EXEC_FILE_APITYPE_MODULE_VSH = 0x020,
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_VSH = 0x021,
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_USBWLAN = 0x030,
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_MS = 0x042,
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_APP = 0x043,
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_BOOT_INIT_BTCNF = 0x051,
SCE_EXEC_FILE_APITYPE_MODULE_BOOT_INIT_CONFIG = 0x052,
SCE_EXEC_FILE_APITYPE_MODULE_DECI = 0x070,
/** Unknown. */
SCE_INIT_APITYPE_UNK0x100 = 0x100,
SCE_EXEC_FILE_APITYPE_UNK100 = 0x100,
/** GAME EBOOT. */
SCE_INIT_APITYPE_GAME_EBOOT = 0x110,
SCE_EXEC_FILE_APITYPE_GAME_EBOOT = 0x110,
/** GAME BOOT. */
SCE_INIT_APITYPE_GAME_BOOT = 0x111,
SCE_EXEC_FILE_APITYPE_GAME_BOOT = 0x111,
/** Emulated EBOOT Memory-Stick. */
SCE_INIT_APITYPE_EMU_EBOOT_MS = 0x112,
SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS = 0x112,
/** Emulated BOOT Memory-Stick. */
SCE_INIT_APITYPE_EMU_BOOT_MS = 0x113,
SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS = 0x113,
/** Emulated EBOOT EF. */
SCE_INIT_APITYPE_EMU_EBOOT_EF = 0x114,
SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF = 0x114,
/** Emulated BOOT EF. */
SCE_INIT_APITYPE_EMU_BOOT_EF = 0x115,
SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF = 0x115,
/** NP-DRM Memory-Stick. */
SCE_INIT_APITYPE_NPDRM_MS = 0x116, /* Distributed programs and data through the Playstation Store. */
SCE_EXEC_FILE_APITYPE_NPDRM_MS = 0x116, /* Distributed programs and data through the Playstation Store. */
/** Unknown. */
SCE_EXEC_FILE_APITYPE_UNK117 = 0x117,
/** NP-DRM EF. */
SCE_INIT_APITYPE_NPDRM_EF = 0x118, /* NP-DRM: PlayStation Network Platform Digital Rights Management */
SCE_EXEC_FILE_APITYPE_NPDRM_EF = 0x118, /* NP-DRM: PlayStation Network Platform Digital Rights Management */
/** Unknown. */
SCE_EXEC_FILE_APITYPE_UNK119 = 0x119,
/** Executable on a disc. */
SCE_INIT_APITYPE_DISC = 0x120,
SCE_EXEC_FILE_APITYPE_DISC = 0x120,
/** Updater executable on a disc.*/
SCE_INIT_APITYPE_DISC_UPDATER = 0x121,
SCE_EXEC_FILE_APITYPE_DISC_UPDATER = 0x121,
/** Disc debugger. */
SCE_INIT_APITYPE_DISC_DEBUG = 0x122,
SCE_EXEC_FILE_APITYPE_DISC_DEBUG = 0x122,
/** NP-9660 game. */
SCE_INIT_APITYPE_DISC_EMU_MS1 = 0x123,
SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1 = 0x123,
/** Unknown. */
SCE_INIT_APITYPE_DISC_EMU_MS2 = 0x124,
SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2 = 0x124,
/** Unknown. */
SCE_INIT_APITYPE_DISC_EMU_EF1 = 0x125,
SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1 = 0x125,
/** Unknown. */
SCE_INIT_APITYPE_DISC_EMU_EF2 = 0x126,
SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2 = 0x126,
/** Game-sharing executable. */
SCE_INIT_APITYPE_USBWLAN = 0x130,
SCE_EXEC_FILE_APITYPE_USBWLAN = 0x130,
/** Unknown. */
SCE_INIT_APITYPE_USBWLAN_DEBUG = 0x131,
SCE_EXEC_FILE_APITYPE_USBWLAN_DEBUG = 0x131,
/** Unknown. */
SCE_INIT_APITYPE_UNK = 0x132,
SCE_EXEC_FILE_APITYPE_UNK132 = 0x132,
/** Unknown. */
SCE_INIT_APITYPE_UNK_DEBUG = 0x133,
SCE_EXEC_FILE_APITYPE_UNK133 = 0x133,
/** Unknown. */
SCE_INIT_APITYPE_MS1 = 0x140,
SCE_EXEC_FILE_APITYPE_MS1 = 0x140,
/** Unknown. */
SCE_INIT_APITYPE_MS2 = 0x141,
SCE_EXEC_FILE_APITYPE_MS2 = 0x141,
/** Unknown. */
SCE_INIT_APITYPE_MS3 = 0x142,
SCE_EXEC_FILE_APITYPE_MS3 = 0x142,
/** Applications (i.e. Comic Reader) */
SCE_INIT_APITYPE_MS4 = 0x143,
SCE_EXEC_FILE_APITYPE_MS4 = 0x143,
/** Playstation One executable. */
SCE_INIT_APITYPE_MS5 = 0x144,
SCE_EXEC_FILE_APITYPE_MS5 = 0x144,
/** Unknown. */
SCE_INIT_APITYPE_MS6 = 0x145,
SCE_EXEC_FILE_APITYPE_MS6 = 0x145,
/** Unknown. */
SCE_INIT_APITYPE_EF1 = 0x151,
SCE_EXEC_FILE_APITYPE_EF1 = 0x151,
/** Unknown. */
SCE_INIT_APITYPE_EF2 = 0x152,
SCE_EXEC_FILE_APITYPE_EF2 = 0x152,
/** Unknown. */
SCE_INIT_APITYPE_EF3 = 0x153,
SCE_EXEC_FILE_APITYPE_EF3 = 0x153,
/** Unknown. */
SCE_INIT_APITYPE_EF4 = 0x154,
SCE_EXEC_FILE_APITYPE_EF4 = 0x154,
/** Unknown. */
SCE_INIT_APITYPE_EF5 = 0x155,
SCE_EXEC_FILE_APITYPE_EF5 = 0x155,
/** Unknown. */
SCE_INIT_APITYPE_EF6 = 0x156,
SCE_EXEC_FILE_APITYPE_EF6 = 0x156,
/** Unknown. */
SCE_INIT_APITYPE_UNK_GAME1 = 0x160,
SCE_EXEC_FILE_APITYPE_UNK160 = 0x160,
/** Unknown. */
SCE_INIT_APITYPE_UNK_GAME2 = 0x161,
SCE_EXEC_FILE_APITYPE_UNK161 = 0x161,
/** Unknown. */
SCE_INIT_APITYPE_MLNAPP_MS = 0x170,
SCE_EXEC_FILE_APITYPE_MLNAPP_MS = 0x170,
/** Unknown. */
SCE_INIT_APITYPE_MLNAPP_EF = 0x171,
SCE_EXEC_FILE_APITYPE_MLNAPP_EF = 0x171,
/** Unknown. */
SCE_INIT_APITYPE_KERNEL_1 = 0x200,
SCE_EXEC_FILE_APITYPE_KERNEL_1 = 0x200,
/** Exit Game. */
SCE_INIT_APITYPE_VSH_1 = 0x210,
SCE_EXEC_FILE_APITYPE_VSH_1 = 0x210,
/** Exit VSH. */
SCE_INIT_APITYPE_VSH_2 = 0x220,
SCE_EXEC_FILE_APITYPE_VSH_2 = 0x220,
/** Kernel reboot. */
SCE_INIT_APITYPE_KERNEL_REBOOT = 0x300,
SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT = 0x300,
/** Debug. */
SCE_INIT_APITYPE_DEBUG = 0x420 /* doesn't start reboot */
SCE_EXEC_FILE_APITYPE_DEBUG = 0x420 /* doesn't start reboot */
};
/**
@ -147,7 +166,7 @@ enum SceInitApiType {
* currently booted module by Init.
*/
typedef struct {
/** The API type of the currently loaded module. One of ::SceInitApiType. */
/** The API type of the currently loaded module. One of ::SceFileExecApiType. */
s32 apiType; //0
/** The address of a memory protection block of type ::SCE_PROTECT_INFO_TYPE_FILE_NAME. */
void *fileModAddr; //4
@ -196,14 +215,14 @@ typedef struct {
*
* @return The boot medium type. One of ::SceBootMediumType.
*/
s32 sceKernelBootFrom(void);
u32 sceKernelBootFrom(void);
/**
* Get the boot medium of the executable calling this function. For PSP-GO only?
*
* @return The boot medium type. One of ::SceBootMediumType.
*/
s32 InitForKernel_9D33A110(void);
u32 InitForKernel_9D33A110(void);
/**
* Get the application type of a module.
@ -215,7 +234,7 @@ s32 sceKernelApplicationType(void);
/**
* Get the API type of a module.
*
* @return The API type. One of ::SceInitApiType.
* @return The API type. One of ::SceFileExecApiType.
*/
s32 sceKernelInitApitype(void);
@ -227,13 +246,13 @@ s32 sceKernelInitApitype(void);
* @param flag Defines the execute order of the callbacks. Pass 0 for earliest execution, 3 for latest.
* 1 and 2 are between these two. Pass 4 - 7 for execution after Init loaded all modules, again
* 4 is earliest, 7 is latest.
* @param status The returned status of bootCBFunc in case it was executed directly.
* @param pStatus The returned status of bootCBFunc in case it was executed directly.
*
* @return SCE_ERROR_OK for directly executing the boot callback function. SCE_BOOT_CALLBACK_FUNCTION_QUEUED
* indicates boot callback function was enqueued into other existing boot callbacks and will be called
* when Init boots the rest of the system modules.
*/
u32 sceKernelSetInitCallback(SceKernelBootCallbackFunction bootCBFunc, u32 flag, s32 *status);
u32 sceKernelSetInitCallback(SceKernelBootCallbackFunction bootCBFunc, u32 flag, s32 *pStatus);
/**
* Disabled debug function.
@ -281,11 +300,11 @@ void *sceKernelInitDiscImage(void);
/**
* Get information about a paramSfo block of a module to boot.
*
* @param size The size of the paramSfo block.
* @param pSize The size of the paramSfo block.
*
* @return A pointer to the head address of the paramSfo block.
*/
void *sceKernelInitParamSfo(SceSize *size);
void *sceKernelInitParamSfo(SceSize *pSize);
/**
* Get the LPT summary. Unknown.
@ -303,7 +322,7 @@ s32 sceKernelInitLptSummary(void);
* @return The memory block ID on success (greater than or equal to 0) or
* SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID.
*/
SceUID sceKernelGetChunk(SceUID chunkId);
SceUID sceKernelGetChunk(s32 chunkId);
/**
* Register a chunk in the system.
@ -314,7 +333,7 @@ SceUID sceKernelGetChunk(SceUID chunkId);
* @return The blockId stored into the chunk on success, otherwise
* SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID.
*/
SceUID sceKernelRegisterChunk(SceUID chunkId, SceUID blockId);
SceUID sceKernelRegisterChunk(s32 chunkId, SceUID blockId);
/**
* Release a used chunk.
@ -324,7 +343,7 @@ SceUID sceKernelRegisterChunk(SceUID chunkId, SceUID blockId);
* @return The new value of the chunk, typically -1, on success, otherwise
* SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID.
*/
SceUID sceKernelReleaseChunk(SceUID chunkId);
s32 sceKernelReleaseChunk(SceUID chunkId);
#endif /* MODULEMGR_INIT_H */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
@ -6,41 +6,117 @@
#define MODULEMGR_KERNEL_H
#include "common_header.h"
#include "modulemgr_moduleInfo.h"
#include "modulemgr_options.h"
#define SCE_SECURE_INSTALL_ID_LEN (16)
#define SCE_NPDRM_LICENSEE_KEY_LEN (16)
typedef struct {
SceSize size; //0
s32 unk4; //4
SceOff fileOffset; //8
u8 keyData[16]; //16 -- TODO: Confirm
u8 keyData[SCE_NPDRM_LICENSEE_KEY_LEN]; //16 -- TODO: Confirm
} SceNpDrm;
s32 sceKernelLoadModuleForLoadExecForUser(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecNpDrm(s32 apiType, const char *file, SceOff fileOffset, u8 keyData[16], s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHDisc(const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHDiscUpdater(const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHDiscDebug(const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHDiscEmu(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 ModuleMgrForKernel_C2A5E6CA(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHMs1(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHMs2(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHMs3(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHMs4(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHMs5(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleForLoadExecVSHMs6(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
s32 ModuleMgrForKernel_8DD336D4(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
/* load module */
SceUID sceKernelLoadModuleForLoadExecForUser(s32 apiType, const char *file, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHDisc(const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHDiscUpdater(const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHDiscDebug(const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHDiscEmu(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID ModuleMgrForKernel_C2A5E6CA(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHMs1(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHMs2(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHMs3(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHMs4(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHMs5(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecVSHMs6(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID ModuleMgrForKernel_8DD336D4(s32 apiType, const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForLoadExecNpDrm(s32 apiType, const char *path, SceOff fileOffset,
const char *secureInstallId, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleVSH(const char *path, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleVSHByID(SceUID inputId, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleForKernel(const char *path, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleByIDForKernel(SceUID inputId, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleToBlock(const char *path, SceUID blockId, SceUID *pNewBlockId,
s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleBootInitConfig(const char *path, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleDeci(const char *path, s32 flag, const SceKernelLMOption *pOption);
s32 sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlan(s32 apiType, u32 *modBuf, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug(s32 apiType, u32 *modBuf, s32 flags, SceKernelLMOption *option);
s32 sceKernelLoadModuleBufferForExitVSHKernel(u32 *modBuf, s32 flags, SceKernelLMOption *option, int);
s32 sceKernelLoadModuleBufferForExitGame(u32 *modBuf, s32 flags, SceKernelLMOption *option, int);
s32 sceKernelLoadModuleBufferForExitVSHVSH(u32 *modBuf, s32 flags, SceKernelLMOption *option, int);
s32 sceKernelLoadModuleBufferForRebootKernel(u32 *modBuf, s32 flags, SceKernelLMOption *option, int);
/* load module buffer */
SceUID sceKernelLoadModuleBufferMs(SceSize size, void *base, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleBufferApp(SceSize size, void *base, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleBufferVSH(SceSize size, void *base, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleBufferForKernel(SceSize size, void *base, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleBufferBootInitBtcnf(SceSize size, void *base, s32 flag,
const SceKernelLMOption *pOption, s32 opt);
s32 sceKernelLoadModuleBufferBootInitConfig(void);
s32 sceKernelLoadModuleBootInitBtcnf(u32 *modBuf, s32 flags, SceKernelLMOption *option); /* Disabled - returns error */
s32 sceKernelLoadModuleBufferBootInitBtcnf(SceSize modSize, u32 *modBuf, s32 flags, SceKernelLMOption *option, s32);
SceUID sceKernelLoadModuleBufferForExitGame(void *base, s32 flag, const SceKernelLMOption *pOption, s32 opt);
SceUID sceKernelLoadModuleBufferForExitVSHKernel(void *base, s32 flag, const SceKernelLMOption *pOption, s32 opt);
SceUID sceKernelLoadModuleBufferForRebootKernel(void *base, s32 flag, const SceKernelLMOption *pOption, s32 opt);
SceUID sceKernelLoadModuleBufferForExitVSHVSH(void *base, s32 flag, const SceKernelLMOption *pOption, s32 opt);
s32 sceKernelStopUnloadSelfModuleWithStatusKernel(s32 exitStatus, SceSize args, void *argp, s32 *status, SceKernelSMOption *option);
SceUID sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlan(s32 apiType, void *base, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug(s32 apiType, void *base, s32 flag,
const SceKernelLMOption *pOption);
s32 sceKernelLoadModuleBootInitBtcnf(void *base, s32 flag, const SceKernelLMOption *pOption);
/* start module */
s32 sceKernelStartModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
const SceKernelSMOption *pOption);
/* stop module */
s32 sceKernelStopModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
const SceKernelSMOption *pOption);
/* unload module */
SceUID sceKernelUnloadModule(SceUID modId);
s32 sceKernelStopUnloadSelfModuleWithStatus(s32 exitStatus, SceSize args, void *argp,
s32 *pModResult, const SceKernelSMOption *pOption);
s32 sceKernelStopUnloadSelfModule(SceSize args, void *argp, s32 *pModResult,
const SceKernelSMOption *pOption);
s32 sceKernelSelfStopUnloadModule(s32 exitStatus, SceSize args, void *argp); /* backward compatibility. */
/* obtain module information */
s32 sceKernelQueryModuleInfo(SceUID modId, SceKernelModuleInfo *pModInfo);
SceUID sceKernelGetModuleId(void);
SceUID sceKernelGetModuleIdByAddress(const void *addr);
SceUID sceKernelSearchModuleByName(const char *name);
SceUID sceKernelSearchModuleByAddress(const void *addr);
s32 sceKernelGetModuleIdList(SceUID *pModIdList, SceSize size, u32 *pIdCount);
/* PSP reboot phase functions */
s32 sceKernelRebootBeforeForUser(void *arg);
s32 sceKernelRebootPhaseForKernel(s32 arg1, void *argp, s32 arg3, s32 arg4);
s32 sceKernelRebootBeforeForKernel(void *argp, s32 arg2, s32 arg3, s32 arg4);
/* NP-DRM key functions */
s32 sceKernelSetNpDrmGetModuleKeyFunction(s32(*function)(SceUID fd, void *, void *));
s32 sceKernelNpDrmGetModuleKey(SceUID fd, void *arg2, void *arg3);
/* Misc */
s32 sceKernelModuleMgrMode(s32 mode);
#endif /* MODULEMGR_KERNEL_H */

View File

@ -0,0 +1,73 @@
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef MODULEMGR_MODULEINFO_H
#define MODULEMGR_MODULEINFO_H
#include "common_header.h"
#include "loadcore.h"
/** Holds various information about a module, can be obtained using sceKernelQueryModuleInfo() */
typedef struct {
/** Size of this structure. size = sizeof(SceKernelModuleInfo). */
SceSize size; //0
/** Number of segments of the module */
u8 nsegment; //4
/** Reserved, unused */
u8 reserved[3]; //5
/** Start address of the segment */
u32 segmentAddr[SCE_KERNEL_MAX_MODULE_SEGMENT]; //8
/** Size of the segment */
SceSize segmentSize[SCE_KERNEL_MAX_MODULE_SEGMENT]; //24
/** Entry address of the module */
u32 entryAddr; //40
/** Value of gp */
u32 gpValue; //44
/** Start address of the text segment */
u32 textAddr; //48
/** Size of the text segment. */
SceSize textSize; //52
/** Size of the data segment. */
SceSize dataSize; //56
/** Size of the bss segment. */
SceSize bssSize; //60
/** Module attribute */
u16 attribute; //64
/** Module version */
u8 version[MODULE_VERSION_NUMBER_CATEGORY_SIZE]; //66
/** Module name */
char modName[SCE_MODULE_NAME_LEN]; //68
/** String terminator (always '\0') */
char terminal; //95
} SceKernelModuleInfo; // size = 96
/** Deprecated since firmware 1.50, use SceKernelModuleInfo instead. Holds various information about a module, can be obtained using sceKernelQueryModuleInfo()
* @see :SceKernelModuleInfo
**/
typedef struct {
/** Size of this structure. size = sizeof(SceKernelModuleInfoV1). */
SceSize size; //0
/** Number of segments of the module */
u8 nsegment; //4
/** Reserved, unused */
u8 reserved[3]; //5
/** Start address of the segment */
u32 segmentAddr[SCE_KERNEL_MAX_MODULE_SEGMENT]; //8
/** Size of the segment */
SceSize segmentSize[SCE_KERNEL_MAX_MODULE_SEGMENT]; //24
/** Entry address of the module */
u32 entryAddr; //40
/** Value of gp */
u32 gpValue; //44
/** Start address of the text segment */
u32 textAddr; //48
/** Size of the text segment */
SceSize textSize; //52
/** Size of the data segment. */
SceSize dataSize; //56
/** Size of the bss segment. */
SceSize bssSize; //60
} SceKernelModuleInfoV1; // size = 64
#endif /* MODULEMGR_MODULEINFO_H */

34
include/modulemgr_nids.h Normal file
View File

@ -0,0 +1,34 @@
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef MODULEMGR_NIDS_H
#define MODULEMGR_NIDS_H
#ifdef __cplusplus
extern "C" {
#endif
/* function NIDs */
#define NID_MODULE_BOOTSTART 0xD3744BE0
#define NID_MODULE_REBOOT_PHASE 0xADF12745
#define NID_MODULE_REBOOT_BEFORE 0x2F064FA6
#define NID_MODULE_START 0xD632ACDB
#define NID_MODULE_STOP 0xCEE8593C
#define NID_592743D8 0x592743D8
/* variable NIDs*/
#define NID_MODULE_REBOOT_BEFORE_THREAD_PARAM 0xF4F4299D
#define NID_MODULE_START_THREAD_PARAM 0x0F7C276C
#define NID_MODULE_STOP_THREAD_PARAM 0xCF0CC697
#define NID_MODULE_INFO 0xF01D73A7
#define NID_MODULE_SDK_VERSION 0x11B97506
#define NID_1D4042A5 0x1D4042A5
#ifdef __cplusplus
}
#endif
#endif /* MODULEMGR_NIDS_H */

View File

@ -1,36 +1,54 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
*/
#ifndef MODULEMGR_OPTIONS_H
#define MODULEMGR_OPTIONS_H
#include "common_imp.h"
#include "sysmem_user.h"
/* SceKernelLMOption.position */
#define SCE_KERNEL_LM_POS_LOW (SCE_KERNEL_SMEM_Low)
#define SCE_KERNEL_LM_POS_HIGH (SCE_KERNEL_SMEM_High)
#define SCE_KERNEL_LM_POS_LOW (SCE_KERNEL_SMEM_Low) /** Place module at lowest possible address. */
#define SCE_KERNEL_LM_POS_HIGH (SCE_KERNEL_SMEM_High) /** Place module at highest possible address. */
#define SCE_KERNEL_LM_POS_ADDR (SCE_KERNEL_SMEM_Addr)
/* SceKernelLMOption.access */
#define SCE_KERNEL_LM_ACCESS_NOSEEK (1)
/** This structure specifies options for loading a module (via LoadModule()). */
typedef struct {
SceSize size;
SceUID mpIdText; /* partition text */
SceUID mpIdData; /* partition data */
u32 flags;
s8 position; /* module allocation type */
s8 access; /* file access type */
s8 creserved[2];
/** The size of this structure. size = sizeof(SceKernelLMOption). */
SceSize size;
/** The memory partition where the program of the module will be stored. */
SceUID mpIdText;
/** The memory partition where the data of the module will be stored. */
SceUID mpIdData;
/** Unused for now. */
u32 flags;
/** Specify module placement policy in memory. */
u8 position;
/** Unused for now. */
s8 access;
/** Reserved. */
s8 creserved[2];
} SceKernelLMOption;
/** This structure specifies options for starting/stopping a module. */
typedef struct {
SceSize size;
SceUID mpidstack; /* partition stack */
SceSize stacksize;
s32 priority;
u32 attribute; /* thread attribute */
/** The size of the structure. size = sizeof(SceKernelSMOption). */
SceSize size;
/**
* Partition of the stack of the running thread. If 0 is specified then the stack is allocated
* in the same partition as the data segment of the module.
*/
SceUID mpIdStack;
/** Stack size. If 0 is specified then the default system value is used. */
SceSize stackSize;
/** Priority of the running thread. */
s32 priority;
/** Attribute of the running thread. */
u32 attribute;
} SceKernelSMOption;
#endif /* MODULEMGR_OPTIONS_H */

View File

@ -1,18 +1,65 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef MODULEMGR_USER_H
#define MODULEMGR_USER_H
#include "common_header.h"
#include "modulemgr_options.h"
#include "sysmem_user.h"
SceUID sceKernelLoadModule(const char *path, s32 flags, SceKernelLMOption *option);
s32 sceKernelStartModule(SceUID modId, SceSize args, void *argp, s32 *result, SceKernelSMOption *option);
s32 sceKernelUnloadModule(SceUID modId);
#endif /* MODULEMGR_USER_H */
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef MODULEMGR_USER_H
#define MODULEMGR_USER_H
#include "common_header.h"
#include "modulemgr_moduleInfo.h"
#include "modulemgr_options.h"
#include "sysmem_user.h"
#define SCE_SECURE_INSTALL_ID_LEN (16)
/* load module */
SceUID sceKernelLoadModule(const char *path, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleByID(SceUID inputId, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleWithBlockOffset(const char *path, SceUID blockId, SceOff offset);
SceUID sceKernelLoadModuleByIDWithBlockOffset(SceUID inputId, SceUID blockId, SceOff offset);
SceUID sceKernelLoadModuleNpDrm(const char *path, s32 flag, const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleDNAS(const char *path, const char *secureInstallId, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleMs(const char *path, s32 flag, const SceKernelLMOption *pOption);
/* load module buffer */
SceUID sceKernelLoadModuleBufferUsbWlan(SceSize size, void *base, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleBufferMs(SceSize bufSize, void *base, s32 flag,
const SceKernelLMOption *pOption);
SceUID sceKernelLoadModuleBufferApp(SceSize size, void *base, s32 flag,
const SceKernelLMOption *pOption);
/* start module */
s32 sceKernelStartModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
const SceKernelSMOption *pOption);
/* stop module */
s32 sceKernelStopModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
const SceKernelSMOption *pOption);
/* unload module */
SceUID sceKernelUnloadModule(SceUID modId);
s32 sceKernelStopUnloadSelfModuleWithStatus(s32 exitStatus, SceSize args, void *argp,
s32 *pModResult, const SceKernelSMOption *pOption);
s32 sceKernelStopUnloadSelfModule(SceSize args, void *argp, s32 *pModResult,
const SceKernelSMOption *pOption);
s32 sceKernelSelfStopUnloadModule(s32 exitStatus, SceSize args, void *argp); /* backward compatibility. */
/* obtain module information */
s32 sceKernelQueryModuleInfo(SceUID modId, SceKernelModuleInfo *pModInfo);
SceUID sceKernelGetModuleId(void);
SceUID sceKernelGetModuleIdByAddress(const void *addr);
s32 sceKernelGetModuleGPByAddress(const void *addr, u32 *pGP);
s32 sceKernelGetModuleIdList(SceUID *pModIdList, SceSize size, u32 *pIdCount);
/* Misc */
SceBool sceKernelCheckTextSegment(void);
#endif /* MODULEMGR_USER_H */

30
include/ms_cm_error.h Normal file
View File

@ -0,0 +1,30 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/ms_cm_error.h
*
* PSP Memory Stick Class Manager
*/
#ifndef MS_CM_ERROR_H
#define MS_CM_ERROR_H
/* PSP CM specific error codes. */
#define SCE_MSCM_ERROR_INVALID_PARAM 0x80220081
#define SCE_MSCM_ERROR_NOMEM 0x80220082
#define SCE_MSCM_ERROR_OUT_OF_SERVICE 0x80220083
#define SCE_MSCM_ERROR_NOT_FOUND 0x80220084
#define SCE_MSCM_ERROR_ALREADY 0x80220085
#define SCE_MSCM_ERROR_BUSY 0x80220086
#define SCE_MSCM_ERROR_TIMEOUT 0x80220087
#define SCE_MSCM_ERROR_CRC 0x80220088
#define SCE_MSCM_ERROR_TOE 0x80220089
#define SCE_MSCM_ERROR_DMA 0x8022008A
#define SCE_MSCM_ERROR_CMDNK 0x8022008B
#define SCE_MSCM_ERROR_FLASH 0x8022008C
#endif /* MS_CM_ERROR_H */

28
include/net/lib_http.h Normal file
View File

@ -0,0 +1,28 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/net/lib_http.h
*
*/
#ifndef LIB_HTTP_H
#define LIB_HTTP_H
/* lib_http specific error codes. */
#define SCE_HTTP_ERROR_BEFORE_INIT 0x80431001
#define SCE_HTTP_ERROR_NOT_SUPPORTED 0x80431004
#define SCE_HTTP_ERROR_ALREADY_INITED 0x80431020
#define SCE_HTTP_ERROR_BUSY 0x80431021
#define SCE_HTTP_ERROR_OUT_OF_MEMORY 0x80431022
#define SCE_HTTP_ERROR_NOT_FOUND 0x80431025
#define SCE_HTTP_ERROR_INSUFFICIENT_HEAPSIZE 0x80431077
#define SCE_HTTP_ERROR_BEFORE_COOKIE_LOAD 0x80431078
#define SCE_HTTP_ERROR_INVALID_ID 0x80431100
#define SCE_HTTP_ERROR_OUT_OF_SIZE 0x80431104
#define SCE_HTTP_INVALID_VALUE 0x804311FE
#endif /* LIB_HTTP_H */

23
include/net/lib_https.h Normal file
View File

@ -0,0 +1,23 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/net/lib_https.h
*
*/
#ifndef LIB_HTTPS_H
#define LIB_HTTPS_H
/* lib_https specific error codes. */
#define SCE_HTTPS_ERROR_OUT_OF_MEMORY 0x80435022
#define SCE_HTTPS_ERROR_CERT 0x80435060
#define SCE_HTTPS_ERROR_HANDSHAKE 0x80435061
#define SCE_HTTPS_ERROR_IO 0x80435062
#define SCE_HTTPS_ERROR_INTERNAL 0x80435063
#define SCE_HTTPS_ERROR_PROXY 0x80435064
#endif /* LIB_HTTPS_H */

26
include/net/lib_ssl.h Normal file
View File

@ -0,0 +1,26 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/net/lib_ssl.h
*
* This library is needed to perform HTTPS connections.
*/
#ifndef LIB_SSL_H
#define LIB_SSL_H
#define SCE_SSL_LEAST_STACK_SIZE (1*1024) /* 1KiB */
/* lib_ssl specific error codes. */
#define SCE_SSL_ERROR_BEFORE_INIT 0x80435001
#define SCE_SSL_ERROR_ALREADY_INITED 0x80435020
#define SCE_SSL_ERROR_OUT_OF_MEMORY 0x80435022
#define SCE_SSL_ERROR_NOT_FOUND 0x80435025
#define SCE_SSL_ERROR_INVALID_VALUE 0x804351FE
#define SCE_SSL_ERROR_INVALID_FORMAT 0x80435108
#endif /* LIB_SSL_H */

118
include/net/psp_net_error.h Normal file
View File

@ -0,0 +1,118 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/net/psp_net_error.h
*
* Defines PSP network specific error codes.
*
*/
/**
* PSP error value format
*
* 31 30 29 28 27 16 15 0
* +---+---+-------+------------------+-----------------------+
* | E | C | Rsrvd | F A C I L I T Y | E R R O R C O D E |
* +---+---+-------+------------------+-----------------------+
*
* bit 31: Error
* 1 = Error
* 0 = Success
*
* bit 30: Critical
* 1 = Critical error
* 0 = Normal error
*
* bits 29-28: Reserved
* always zero
*
* bits 27-16: Facility
* 0x041 = SCE_ERROR_FACILITY_NETWORK
*
* Error code format for psp_net:
*
* 15 8 7 0
* +----------------+----------------+
* | MODULE ID | ERROR CODE |
* +----------------+----------------+
*
* bits 15-8: MODULE ID
* 0x00 common error (NULL FACILITY)
* 0x01 pspnet
* 0x02 pspnet_inet
* 0x03 poeclient
* 0x04 pspnet_resolver
* 0x05 dhcp
* 0x06 pspnet_adhoc_auth
* 0x07 pspnet_adhoc
* 0x08 pspnet_adhoc_matching
* 0x09 pspnet_netcnf
* 0x0a pspnet_apctl
* 0x0b pspnet_adhocctl
* 0x0c reserved01
* 0x0d wlan
* 0x0e eapol
* 0x0f 8021x
* 0x10 wpa_supplicant
* 0x11 reserved02
* 0x12 pspnet_adhoc_transfer (sample library)
* 0x13 pspnet_adhoc_discover
* 0x14 adhoc_dialog
* 0x15 wispr
* 0x16 reserved03
* 0x17 reserved04
* 0x18 reserved05
* 0x19 reserved06
*
* bits 7-0: PSP_net module specific error codes
*
*/
#ifndef PSP_NET_ERROR_H
#define PSP_NET_ERROR_H
/* PSP_NET MODULE ID */
#define SCE_ERROR_NET_MODULE_ID_COMMON 0x00
#define SCE_ERROR_NET_MODULE_ID_CORE 0x01
#define SCE_ERROR_NET_MODULE_ID_INET 0x02
#define SCE_ERROR_NET_MODULE_ID_POECLIENT 0x03
#define SCE_ERROR_NET_MODULE_ID_RESOLVER 0x04
#define SCE_ERROR_NET_MODULE_ID_DHCP 0x05
#define SCE_ERROR_NET_MODULE_ID_ADHOC_AUTH 0x06
#define SCE_ERROR_NET_MODULE_ID_ADHOC 0x07
#define SCE_ERROR_NET_MODULE_ID_ADHOC_MATCHING 0x08
#define SCE_ERROR_NET_MODULE_ID_NETCNF 0x09
#define SCE_ERROR_NET_MODULE_ID_APCTL 0x0a
#define SCE_ERROR_NET_MODULE_ID_ADHOCCTL 0x0b
#define SCE_ERROR_NET_MODULE_ID_RESERVED01 0x0c
#define SCE_ERROR_NET_MODULE_ID_WLAN 0x0d
#define SCE_ERROR_NET_MODULE_ID_EAPOL 0x0e
#define SCE_ERROR_NET_MODULE_ID_8021x 0x0f
#define SCE_ERROR_NET_MODULE_ID_WPA 0x10
#define SCE_ERROR_NET_MODULE_ID_RESERVED02 0x11
#define SCE_ERROR_NET_MODULE_ID_TRANSFER 0x12
#define SCE_ERROR_NET_MODULE_ID_ADHOC_DISCOVER 0x13
#define SCE_ERROR_NET_MODULE_ID_ADHOC_DIALOG 0x14
#define SCE_ERROR_NET_MODULE_ID_WISPR 0x15
#define SCE_ERROR_NET_MODULE_ID_RESERVED03 0x16
#define SCE_ERROR_NET_MODULE_ID_RESERVED04 0x17
#define SCE_ERROR_NET_MODULE_ID_RESERVED05 0x18
#define SCE_ERROR_NET_MODULE_ID_RESERVED06 0x19
/* PSP network specific error codes. */
/* 0x04 psp_net_resolver */
#define SCE_NET_RESOLVER_ERROR_ID_NOT_FOUND 0x80410408
#define SCE_NET_RESOLVER_ERROR_ALREADY_STOPPED 0x8041040A
#define SCE_NET_RESOLVER_ERROR_NO_HOST 0x80410414
/* 0x0d wlan */
#define SCE_NET_WLAN_ERROR_INVALID_ARG 0x80410D13
#endif /* PSP_NET_ERROR_H */

View File

@ -1,18 +1,21 @@
/* Copyright (C) 2011, 2012 The uOFW team
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* ddrdb.h
*
* @author _Felix_
* @version 6.60
*
* Reverse engineered ddrdb library of the SCE PSP system.
/** @defgroup DNAS Dynamic Network Authentication System
* An authentication system used for online authentication \n
* (for example with a game server).
*/
#ifndef DDRDB_H
#define DDRDB_H
/**
* @defgroup OpenPSID OpenPSID
* @ingroup DNAS
*
* @{
*/
#ifndef OPENPSID_DDRDB_H
#define OPENPSID_DDRDB_H
#include "common_header.h"
@ -20,105 +23,142 @@
extern "C" {
#endif
/** Maximal size of a source buffer in KB. */
#define SCE_DDRDB_MAX_BUFFER_SIZE 2048
/** Size of the added header to the buffer to encrypt. */
#define SCE_DDRDB_ENCRYPTED_BUFFER_HEADER_SIZE 20
/** Size of the added header to the buffer to decrypt. */
#define SCE_DDRDB_DECRYPTED_BUFFER_HEADER_SIZE 20
/** Size of the added header to the buffer to create a hash for. */
#define SCE_DDRDB_HASH_BUFFER_HEADER_SIZE 4
/** Size of the generated hash buffer. */
#define SCE_DDRDB_HASH_BUFFER_SIZE 20
/** Size of the generated MUL1 buffer. */
#define SCE_DDRDB_MUL1_BUFFER_SIZE 60
/** Size of the generated MUL2 buffer. */
#define SCE_DDRDB_MUL2_DEST_BUFFER_SIZE 40
/** Size of source buffer used to generate the MUL2 buffer. */
#define SCE_DDRDB_MUL2_SOURCE_BUFFER_SIZE 60
/** Size of source buffer used to check for. */
#define SCE_DDRDB_SIGVRY_BUFFER_SIZE 100
/** Size of source buffer used to check for. */
#define SCE_DDRDB_CERTVRY_BUFFER_SIZE 184
/** Size of generated Prng buffer. */
#define SCE_DDRDB_PRNG_BUFFER_SIZE 20
/** Maximum size of a source buffer in byte. */
#define SCE_DNAS_USER_DATA_MAX_LEN 2048
/**
* Decrypt a buffer.
* Decrypt the provided data. The data has to be AES encrypted.
*
* @note The used key is provided by the PSP.
*
* @note The 20-byte header for buf into sema function:
* header[0] = 5;
* header[1] = 0;
* header[2] = 0;
* header[3] = 0xB;
* header[4] = size;
*
* @param buf The buffer to decrypt.
* @param size The size of the buffer. Max size = 2048 Bytes.
* @param pSrcData Pointer to data to decrypt. The decrypted data will be written \n
* back into this buffer.
* @param size The size of the data to decrypt. The size needs to be a multiple of ::KIRK_AES_BLOCK_LEN. \n
Max size: ::SCE_DNAS_USER_DATA_MAX_LEN.
*
* @return 0 on success, otherwise < 0.
*/
int sceDdrdbDecrypt(u8 buf[], int size);
s32 sceDdrdbDecrypt(u8 *pSrcData, SceSize size);
/**
* Encrypt a buffer.
* Encrypt the provided data. It will be encrypted using AES.
*
* @note The used key is provided by the PSP.
*
* @note The 20-byte header for buf into sema function:
* header[0] = 4;
* header[1] = 0;
* header[2] = 0;
* header[3] = 0xB;
* header[4] = size;
*
* @param buf The buffer to encrypt.
* @param size The size of the buffer. Max size = 2048 Bytes.
* @param pSrcData Pointer to data to encrypt. The encrypted data will be written
* back into this buffer.
* @param size The size of the data to encrypt. The size needs to be a multiple of ::KIRK_AES_BLOCK_LEN. \n
Max size: ::SCE_DNAS_USER_DATA_MAX_LEN.
*
* @return 0 on success, otherwise < 0.
*/
int sceDdrdbEncrypt(u8 buf[], int size);
s32 sceDdrdbEncrypt(u8 *pSrcData, SceSize size);
/**
* Generate a SHA-1 hash buffer of the source buffer.
* Generate a SHA-1 hash value of the provided data.
*
* @note The 4-byte header for srcBuf into sema function:
* header[0] = size;
*
* @param buf The source buffer to generate the hash from.
* @param size The size of source buffer. Max size = 2048 Bytes
* @param hash The destination buffer for the hash. Size = 20.
* @param pSrcData Pointer to data to generate the hash for.
* @param size The size of the source data. Max size: ::SCE_DNAS_USER_DATA_MAX_LEN.
* @param pDigest Pointer to buffer receiving the hash. Size: ::KIRK_SHA1_DIGEST_LEN.
*
* @return 0 on success, otherwise < 0.
*/
int sceDdrdbHash(u8 srcBuf[], int size, u8 hash[SCE_DDRDB_HASH_BUFFER_SIZE]);
int sceDdrdbMul1(u8 destBuf[SCE_DDRDB_MUL1_BUFFER_SIZE]);
int sceDdrdbMul2(u8 srcBuf[20], u8 srcBuf1[40], u8 destBuf[SCE_DDRDB_MUL2_DEST_BUFFER_SIZE]);
int sceDdrdbSigvry(u8 srcBuf0[40], u8 sha1[20], u8 srcBuf2[40]);
int sceDdrdbCertvry(u8 buf[SCE_DDRDB_CERTVRY_BUFFER_SIZE]);
int sceDdrdbSiggen(u8 inbuf[32], u8 sha1[20], u8 outbuf[40]);
s32 sceDdrdbHash(u8 *pSrcData, SceSize size, u8 *pDigest);
/**
* Generate a 20-Byte pseudorandom number.
*
* @note No need to seed it as KIRK is initialized automatically on boot.
*
* @param buf The destination buffer for the pseudorandom number. Size = 20.
* Generate a new (public,private) key pair to use with ECDSA.
*
* @param pKeyData Pointer to buffer receiving the computed key pair. \n
* The first ::KIRK_ECDSA_PRIVATE_KEY_LEN byte will contain the private key. \n
* The rest of the bytes will contain the public key (elliptic curve) point p = (x,y), \n
* with the x-value being first. Both coordinates have size ::KIRK_ECDSA_POINT_LEN / 2.
*
* @return 0 on success, otherwise < 0.
*/
int sceDdrdbPrngen(u8 buf[SCE_DDRDB_PRNG_BUFFER_SIZE]);
s32 sceDdrdbMul1(u8 *pKeyData);
/**
*
* Compute a new elliptic curve point by multiplying the provided private key with the \n
* provided base point of the elliptic curve.
*
* @param pPrivKey Pointer to the private key of a (public,private) key pair usable for ECDSA.
*
* @param pBasePoint Pointer to a base point of the elliptic curve. Point size: ::KIRK_ECDSA_POINT_LEN
* @param pNewPoint Pointer to a buffer receiving the new curve point. Buffer size: ::KIRK_ECDSA_POINT_LEN
*
* @return 0 on success, otherwise < 0.
*/
s32 sceDdrdbMul2(u8 *pPrivKey, u8 *pBasePoint, u8 *pNewPoint);
int sceDdrdb_F013F8BF(u8 srcBuf1[20], u8 srcBuf2[40]);
/**
* Verify if the provided signature is valid for the specified data given the public key.
*
* @note The ECDSA algorithm is used to verify a signature.
*
* @param pPubKey The public key used for validating the (data,signature) pair. \n
* Size has to be ::KIRK_ECDSA_PUBLIC_KEY_LEN.
* @param pData Pointer to data the signature has to be verified for. \n
Data length: ::KIRK_ECDSA_SRC_DATA_LEN \n
* @param pSig Pointer to the signature to verify. Signature length: ::KIRK_ECDSA_SIG_LEN
*
* @return 0 on success, otherwise < 0.
*/
s32 sceDdrdbSigvry(u8 *pPubKey, u8 *pData, u8 *pSig);
/**
* Verify a certificate.
*
* @param pCert Pointer to the certificate to verify. Certificate length: ::KIRK_CERT_LEN.
*
* @return 0 on success, otherwise < 0.
*/
s32 sceDdrdbCertvry(u8 *pCert);
/**
* Generate a valid signature for the specified data using the specified private key.
*
* @note The ECDSA algorithm is used to generate a signature.
*
* @param pPrivKey Pointer to the private key used to generate the signature. \n
* CONFIRM: The key has to be AES encrypted before.
* @param pData Pointer to data a signature has to be computed for. Data length: ::KIRK_ECDSA_SRC_DATA_LEN
* @param pSig Pointer to a buffer receiving the signature. Signature length: ::KIRK_ECDSA_SIG_LEN
*
* @return 0 on success, otherwise < 0.
*/
s32 sceDdrdbSiggen(u8 *pPrivKey, u8 *pSrcData, u8 *pSig);
/**
* Generate a ::KIRK_PRN_LEN large pseudorandom number (PRN).
*
* @note The seed is automatically set by the system software.
*
* @param pDstData Pointer to buffer receiving the PRN. Size has to be ::KIRK_PRN_LEN.
*
* @return 0 on success, otherwise < 0.
*/
s32 sceDdrdbPrngen(u8 *pDstData);
/**
* Verify if the provided signature is valid for the specified data. The public key\n
* is provided by the system software.
*
* @note The ECDSA algorithm is used to verify a signature.
*
* @param pData Pointer to data the signature has to be verified for. \n
* Data length: ::KIRK_ECDSA_SRC_DATA_LEN.
* @param pSig Pointer to the signature to verify. Signature length: ::KIRK_ECDSA_SIG_LEN.
*
* @return 0 on success, otherwise < 0.
*/
s32 sceDdrdb_F013F8BF(u8 *pData, u8 *pSig);
#ifdef __cplusplus
}
#endif
#endif /* DDRDB_H */
#endif /* OPENPSID_DDRDB_H */
/** @} */

20
include/power_error.h Normal file
View File

@ -0,0 +1,20 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/power_error.h
*
* Specific error codes for the Power Service.
*/
#ifndef POWER_ERROR_H
#define POWER_ERROR_H
#define SCE_POWER_ERROR_NO_BATTERY (0x802B0100) /*!< No battery is present. */
#define SCE_POWER_ERROR_DETECTING (0x802B0101) /*!< Failed to obtain battery information. */
#define SCE_POWER_ERROR_CANNOT_LOCK_VMEM (0x802B0200) /*!< Failed to lock volatile memory. */
#define SCE_POWER_ERROR_BAD_PRECONDITION (0x802B0300) /*!< Invalid pre-conditions for an operation. */
#endif /* POWER_ERROR_H */

View File

@ -13,7 +13,7 @@ struct SceLibraryEntry {
unsigned char entLen;
unsigned char varCount;
unsigned short funcCount;
void * entrytable;
const void * entrytable;
};
#endif

View File

@ -0,0 +1,57 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/sound/lib_atrac3plus.h
*
* library for the ATRAC3/ATRAC3PLUS audio file format.
*/
#ifndef LIB_ATRAC3PLUS_H
#define LIB_ATRAC3PLUS_H
#include "../common/errors.h"
/* ATRAC3 driver specific error codes. */
#define SCE_ATRAC_SUCCESS SCE_ERROR_OK
#define SCE_ATRAC_ERROR_PARAM_FAIL (0x80630001)
#define SCE_ATRAC_ERROR_API_FAIL (0x80630002)
#define SCE_ATRAC_ERROR_NO_ATRACID (0x80630003)
#define SCE_ATRAC_ERROR_BAD_CODECTYPE (0x80630004)
#define SCE_ATRAC_ERROR_BAD_ATRACID (0x80630005)
#define SCE_ATRAC_ERROR_UNKNOWN_FORMAT (0x80630006)
#define SCE_ATRAC_ERROR_UNMATCH_FORMAT (0x80630007)
#define SCE_ATRAC_ERROR_BAD_DATA (0x80630008)
#define SCE_ATRAC_ERROR_ALLDATA_IS_ONMEMORY (0x80630009)
#define SCE_ATRAC_ERROR_UNSET_DATA (0x80630010)
#define SCE_ATRAC_ERROR_READSIZE_IS_TOO_SMALL (0x80630011)
#define SCE_ATRAC_ERROR_NEED_SECOND_BUFFER (0x80630012)
#define SCE_ATRAC_ERROR_READSIZE_OVER_BUFFER (0x80630013)
#define SCE_ATRAC_ERROR_NOT_ALIGNED_ADDRESS (0x80630014)
#define SCE_ATRAC_ERROR_BAD_SAMPLE (0x80630015)
#define SCE_ATRAC_ERROR_WRITEBYTE_FIRST_BUFFER (0x80630016)
#define SCE_ATRAC_ERROR_WRITEBYTE_SECOND_BUFFER (0x80630017)
#define SCE_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG (0x80630018)
#define SCE_ATRAC_ERROR_NOT_MONO_DATA (0x80630019)
#define SCE_ATRAC_ERROR_UNSET_PARAM (0x80630021)
#define SCE_ATRAC_ERROR_NONEED_SECOND_BUFFER (0x80630022)
#define SCE_ATRAC_ERROR_NODATA_IN_BUFFER (0x80630023)
#define SCE_ATRAC_ERROR_ALLDATA_WAS_DECODED (0x80630024)
#define SCE_ATRAC_ERROR_LOWLEVEL_INIT_ID (0x80630031)
#define SCE_ATRAC_ERROR_NOT_LOWLEVEL_INIT_ID (0x80630032)
#define SCE_ATRAC_ERROR_USED_BY_SAS (0x80630040)
/* Audio Codec IDs */
#define SCE_ATRAC_AT3PLUS (0x00001000)
#define SCE_ATRAC_AT3 (0x00001001)
#endif /* LIB_ATRAC3PLUS_H */

48
include/sound/lib_sas.h Normal file
View File

@ -0,0 +1,48 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/sound/lib_sas.h
*
* Low-level sound library for the PSPs Software Audio Synthesizer (SAS).
*/
#ifndef LIB_SAS_H
#define LIB_SAS_H
/* SAS driver specific error codes. */
#define SCE_SAS_ERROR_ADDRESS (0x80420005)
#define SCE_SAS_ERROR_VOICE_INDEX (0x80420010)
#define SCE_SAS_ERROR_NOISE_CLOCK (0x80420011)
#define SCE_SAS_ERROR_PITCH_VAL (0x80420012)
#define SCE_SAS_ERROR_ADSR_MODE (0x80420013)
#define SCE_SAS_ERROR_ADPCM_SIZE (0x80420014)
#define SCE_SAS_ERROR_LOOP_MODE (0x80420015)
#define SCE_SAS_ERROR_INVALID_STATE (0x80420016)
#define SCE_SAS_ERROR_VOLUME_VAL (0x80420018)
#define SCE_SAS_ERROR_ADSR_VAL (0x80420019)
#define SCE_SAS_ERROR_PCM_SIZE (0x8042001a)
#define SCE_SAS_ERROR_ATRAC3_SIZE (0x8042001b)
#define SCE_SAS_ERROR_FX_TYPE (0x80420020)
#define SCE_SAS_ERROR_FX_FEEDBACK (0x80420021)
#define SCE_SAS_ERROR_FX_DELAY (0x80420022)
#define SCE_SAS_ERROR_FX_VOLUME_VAL (0x80420023)
#define SCE_SAS_ERROR_FX_UNAVAILABLE (0x80420024)
#define SCE_SAS_ERROR_BUSY (0x80420030)
#define SCE_SAS_ERROR_CHANGE_AT3_VOICE (0x80420040)
#define SCE_SAS_ERROR_NOT_AT3_VOICE (0x80420041)
#define SCE_SAS_ERROR_NO_CONCATENATE_SPACE (0x80420042)
#define SCE_SAS_ERROR_NOTINIT (0x80420100)
#define SCE_SAS_ERROR_ALRDYINIT (0x80420101)
#define SCE_SAS_ERROR_INVALID_ATRAC3 (0x80420102)
#define SCE_SAS_ERROR_SMALL_ATRAC3_SIZE (0x80420103)
#endif /* LIB_SAS_H */

36
include/sound/lib_wave.h Normal file
View File

@ -0,0 +1,36 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/sound/lib_wave.h
*
* lib_wave is a sound library that provides ADPCM (.vag) format fixed-pitch playback \n
* and 44.1 kHz 16-bit linear PCM format sound output functions.
*/
#ifndef LIB_WAVE_H
#define LIB_WAVE_H
/* lib_wave specific error codes (0x80440000 - 0x8044ffff). */
#define SCE_WAVE_ERROR_INITFAIL (0x80440001)
#define SCE_WAVE_ERROR_EXITFAIL (0x80440002)
#define SCE_WAVE_ERROR_STARTFAIL (0x80440003)
#define SCE_WAVE_ERROR_ENDFAIL (0x80440004)
#define SCE_WAVE_ERROR_VOICENUM (0x80440005)
#define SCE_WAVE_ERROR_BUFFPTR (0x80440006)
#define SCE_WAVE_ERROR_SIZE (0x80440007)
#define SCE_WAVE_ERROR_MODE (0x80440008)
#define SCE_WAVE_ERROR_VOICEPLAY (0x80440009)
#define SCE_WAVE_ERROR_VOL (0x8044000A)
#define SCE_WAVE_ERROR_VOLPTR (0x8044000B)
#define SCE_WAVE_ERROR_RESTPTR (0x8044000C)
#define SCE_WAVE_ERROR_LOOPMODE (0x8044000D)
#define SCE_WAVE_ERROR_AUDIOCH (0x80440010)
#define SCE_WAVE_ERROR_SAMPLE (0x80440011)
#define SCE_WAVE_ERROR_THPRIORITY (0x80440012)
#endif /* LIB_WAVE_H */

View File

@ -17,10 +17,11 @@
*/
#define PSP_SYSCON_CMD_NOP 0x00
#define PSP_SYSCON_CMD_GET_BARYON 0x01
#define PSP_SYSCON_CMD_GET_BARYON_VERSION 0x01
#define PSP_SYSCON_CMD_GET_DIGITAL_KEY 0x02
#define PSP_SYSCON_CMD_GET_ANALOG 0x03
#define PSP_SYSCON_CMD_GET_TACHYON_TEMP 0x05
#define PSP_SYSCON_CMD_GET_DIGITAL_KEY_ANALOG 0x06
#define PSP_SYSCON_CMD_GET_KERNEL_DIGITAL_KEY 0x07
#define PSP_SYSCON_CMD_GET_KERNEL_DIGITAL_KEY_ANALOG 0x08
@ -50,6 +51,8 @@
#define PSP_SYSCON_CMD_RESET_DEVICE 0x32
#define PSP_SYSCON_CMD_CTRL_ANALOG_XY_POLLING 0x33
#define PSP_SYSCON_CMD_CTRL_HR_POWER 0x34
#define PSP_SYSCON_CMD_POWER_STANDBY 0x35
#define PSP_SYSCON_CMD_POWER_SUSPEND 0x36
#define PSP_SYSCON_CMD_GET_BATT_VOLT_AD 0x37
@ -104,6 +107,16 @@
#define PSP_SYSCON_RX_RESPONSE (2)
#define PSP_SYSCON_RX_DATA(i) (3 + (i))
/**
* Below are macros to extract Baryon specific info returned by _sceSysconGetBaryonVersion()
* and sceSysconGetBaryonVersion().
*/
#define PSP_SYSCON_BARYON_GET_UNIT_TYPE(v) ((v) & 0xFF) /* 0 = Dev version, 1 = Retail */
#define PSP_SYSCON_BARYON_GET_VERSION_MAJOR(v) (((v) >> 20) & 0xF)
#define PSP_SYSCON_BARYON_GET_VERSION_MINOR(v) (((v) >> 16) & 0xF)
/**
* PSP Hardware LEDs which can be turned ON/OFF
* via ::sceSysconCtrlLED().
@ -772,6 +785,11 @@ s32 sceSysconWriteScratchPad(u32 dst, void *src, u32 size);
*/
s32 sceSysconReadScratchPad(u32 src, void *dst, u32 size);
#define SCE_SYSCON_SET_PARAM_POWER_BATTERY_SUSPEND_CAPACITY 0
#define SCE_SYSCON_SET_PARAM_POWER_BATTERY_TTC 4
#define SCE_SYSCON_SET_PARAM_PAYLOAD_SIZE 8
/**
* Set a parameter (used by power).
*
@ -853,6 +871,15 @@ s32 sceSysconGetBaryonVersion(s32 *baryonVersion);
*/
s32 sceSysconGetGValue(void);
/* Returned power supply status flags by ::sceSysconGetPowerSupplyStatus() */
/* Indicates that a battery is equipped. */
#define SCE_SYSCON_POWER_SUPPLY_STATUS_BATTERY_EQUIPPED 0x00000002
/* Indicates that remaining battery life is short (PSP-2000 and later). */
#define SCE_SYSCON_POWER_SUPPLY_STATUS_IS_LOW_BATTERY_02G_AND_LATER 0x00000020
/* Indicates that the battery is currently charging (using an AC adapter). */
#define SCE_SYSCON_POWER_SUPPLY_STATUS_BATTERY_CHARGING 0x00000080
/**
* Get the power supply status.
*

View File

@ -4,6 +4,10 @@
#include "common_header.h"
#define SCE_DECI2OP_GE_SETOPS 6
#define SCE_DECI2OP_GE_BREAK 7
#define SCE_DECI2OP_GE_PUT_BP 8
typedef struct {
int size;
int (*ops[])();

View File

@ -124,7 +124,7 @@ u32 sceKernelGetModel(void);
s32 sceKernelSetRebootKernel(s32 (*rebootKernel)());
s32 sceKernelRebootKernel(void *arg);
s32 sceKernelRegisterGetIdFunc(void *func);
s32 sceKernelGetId();
s32 sceKernelGetId(const char *path, char *id);
/*
* Debugging (disabled in release)
@ -239,9 +239,13 @@ s32 sceKernelGetSystemStatus(void);
s32 sceKernelSetSystemStatus(s32 newStatus);
typedef struct {
// Last display list for which a UpdateStallAddr() was run
s32 dlId;
// The stall address which was supposed to be set in the last call
void *stall;
// Number of times an update has been called on the current dlId
u32 count;
// Number of calls to updateStallAddr() required until we really set the address
u32 max;
} SceGeLazy;
@ -357,7 +361,7 @@ typedef struct SceSysmemUidLookupFunc {
SceSysmemUidFunc func;
} SceSysmemUidLookupFunc;
s32 sceKernelCallUIDFunction(SceUID id, int funcId, ...);
s32 sceKernelCallUIDFunction(SceUID id, s32 funcId, ...);
s32 sceKernelCallUIDObjFunction(SceSysmemUidCB *uid, s32 funcId, ...);
int sceKernelLookupUIDFunction(SceSysmemUidCB *uid, int id, SceSysmemUidFunc *func, SceSysmemUidCB **parentUidWithFunc);
s32 sceKernelCallUIDObjCommonFunction(SceSysmemUidCB *uid, SceSysmemUidCB *uidWithFunc, s32 funcId, va_list ap);

View File

@ -4,24 +4,24 @@
#include "common_header.h"
int sceKernelRegisterResumeHandler(int reg, int (*handler)(int unk, void *param), void *param);
int sceKernelRegisterSuspendHandler(int reg, int (*handler)(int unk, void *param), void *param);
s32 sceKernelRegisterResumeHandler(s32 reg, s32 (*handler)(s32 unk, void *param), void *param);
s32 sceKernelRegisterSuspendHandler(s32 reg, s32 (*handler)(s32 unk, void *param), void *param);
#define SCE_KERNEL_POWER_LOCK_DEFAULT (0)
int sceKernelPowerLock(int lockType);
int sceKernelPowerLockForUser(int lockType);
int sceKernelPowerUnlock(int lockType);
int sceKernelPowerUnlockForUser(int lockType);
s32 sceKernelPowerLock(s32 lockType);
s32 sceKernelPowerLockForUser(s32 lockType);
s32 sceKernelPowerUnlock(s32 lockType);
s32 sceKernelPowerUnlockForUser(s32 lockType);
#define SCE_KERNEL_POWER_TICK_DEFAULT (0) /** Cancel all timers. */
#define SCE_KERNEL_POWER_TICK_SUSPEND_ONLY (1) /** Cancel auto-suspend-related timer. */
#define SCE_KERNEL_POWER_TICK_LCD_ONLY (6) /** Cancel LCD-related timer .*/
int sceKernelPowerTick(int tickType);
s32 sceKernelPowerTick(s32 tickType);
#define SCE_KERNEL_VOLATILE_MEM_DEFAULT (0)
int sceKernelVolatileMemLock(int unk, void **ptr, int *size);
int sceKernelVolatileMemTryLock(int unk, void **ptr, int *size);
int sceKernelVolatileMemUnlock(int unk);
s32 sceKernelVolatileMemLock(s32 unk, void **ptr, s32 *size);
s32 sceKernelVolatileMemTryLock(s32 unk, void **ptr, s32 *size);
s32 sceKernelVolatileMemUnlock(s32 unk);
int sceKernelPowerRebootStart(int);
s32 sceKernelPowerRebootStart(s32);

View File

@ -47,7 +47,7 @@ int strtol(const char *nptr, char **endptr, int base);
u32 strtoul(char *nptr, char **endptr, int base);
int strncmp(const char *s1, const char *s2, int n);
char *strncpy(char *dest, const char *src, int n);
u32 strnlen(const char *s, int maxlen);
u32 strnlen(const char *s, u32 maxlen);
u32 strlen(const char *s);
char *strrchr(char *s, int c);
char *strpbrk(char *s, const char *accept);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
/* Copyright (C) The uOFW team
See the file COPYING for copying permission.
*/
@ -10,6 +10,103 @@ enum SceSysEventTypes {
SCE_SPEED_CHANGE_EVENTS = 0x01000000
};
/* PSP suspend events */
#define SCE_SYSTEM_SUSPEND_EVENT_QUERY 0x00000100 /* Cancel request can be sent. */
#define SCE_SYSTEM_SUSPEND_EVENT_CANCELLATION 0x00000101
#define SCE_SYSTEM_SUSPEND_EVENT_START 0x00000102
/* Different phases can be used to prioritize work/set up data. Phase2_16 is raised first, Phase2_0 last. */
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_0 0x00000200
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_1 0x00000201
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_2 0x00000202
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_3 0x00000203
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_4 0x00000204
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_5 0x00000205
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_6 0x00000206
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_7 0x00000207
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_8 0x00000208
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_9 0x00000209
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_10 0x0000020A
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_11 0x0000020B
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_12 0x0000020C
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_13 0x0000020D
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_14 0x0000020E
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_15 0x0000020F
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE2_16 0x00000210
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE1_0 0x00000400
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE1_1 0x00000401
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE1_2 0x00000402 /* Cancel request can be sent. */
#define SCE_SYSTEM_SUSPEND_EVENT_FREEZE 0x00001000
/* Different phases can be used to prioritize work/set up data. Phase0_15 is raised first, Phase0_0 last. */
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_0 0x00004000
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_1 0x00004001
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_2 0x00004002
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_3 0x00004003
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_4 0x00004004
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_5 0x00004005
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_6 0x00004006
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_7 0x00004007
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_8 0x00004008
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_9 0x00004009
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_10 0x0000400A
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_11 0x0000400B
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_12 0x0000400C
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_13 0x0000400D
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_14 0x0000400E
#define SCE_SYSTEM_SUSPEND_EVENT_PHASE0_15 0x0000400F
/* PSP resume events */
/* Different phases can be used to prioritize work/set up data. Phase0_0 is raised first, Phase0_15 last. */
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_0 0x00010000
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_1 0x00010001
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_2 0x00010002
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_3 0x00010003
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_4 0x00010004
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_5 0x00010005
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_6 0x00010006
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_7 0x00010007
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_8 0x00010008
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_9 0x00010009
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_10 0x0001000A
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_11 0x0001000B
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_12 0x0001000C
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_13 0x0001000D
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_14 0x0001000E
#define SCE_SYSTEM_RESUME_EVENT_PHASE0_15 0x0001000F
#define SCE_SYSTEM_RESUME_EVENT_MELT 0x00040000
#define SCE_SYSTEM_RESUME_EVENT_PHASE1_0 0x00100000
#define SCE_SYSTEM_RESUME_EVENT_PHASE1_1 0x00100001
#define SCE_SYSTEM_RESUME_EVENT_PHASE1_2 0x00100002 /* Cancel request can be sent. */
#define SCE_SYSTEM_RESUME_EVENT_COMPLETED 0x00400000
typedef struct {
SceSize size; // 0
u32 isStandbyOrRebootRequested; // 4
s64 systemTimePreSuspendOp; // 8
u32 *pWakeupCondition; // 16
void *pResumeData; // 20
u32 unk24; // 24
u32 unk28; // 28
u32 unk32; // 32
u32 unk36; // 36
u32 unk40; // 40
u32 unk44; // 44
u32 unk48; // 48
u32 unk52; // 52
u32 unk56; // 56
u32 unk60; // 60
} SceSysEventSuspendPayload; // size = 64
typedef struct SceSysEventHandler {
s32 size;
char *name;

View File

@ -26,9 +26,11 @@ enum SceSysMemPartitionId {
};
enum SceSysMemBlockType {
SCE_KERNEL_SMEM_Low = 0,
SCE_KERNEL_SMEM_High = 1,
SCE_KERNEL_SMEM_Addr = 2
SCE_KERNEL_SMEM_Low = 0,
SCE_KERNEL_SMEM_High = 1,
SCE_KERNEL_SMEM_Addr = 2,
SCE_KERNEL_SMEM_LOWALIGNED = 3,
SCE_KERNEL_SMEM_HIGHALIGNED = 4
};
#endif /* SYSMEM_USER_H */

View File

@ -13,11 +13,11 @@ void sceKernelDcacheWritebackInvalidateAll(void);
void sceKernelDcacheWritebackRange(const void *p, unsigned int size);
void sceKernelDcacheWritebackInvalidateRange(const void *p, unsigned int size);
int sceKernelDcacheInvalidateRange(const void *p, unsigned int size);
int UtilsForKernel_157A383A(const void *p, unsigned int size);
int sceKernelL1DcacheInvalidateRange(const void *p, unsigned int size);
void sceKernelIcacheInvalidateAll(void);
int sceKernelIcacheInvalidateRange(const void *addr, unsigned int size);
int sceKernelIcacheProbe(const void *addr);
int UtilsForKernel_43C9A8DB(const void *p, u32 size);
int sceKernelL1IcacheInvalidateRange(const void *p, u32 size);
int sceKernelRtcGetTick(u64 *tick);
@ -27,5 +27,3 @@ int sceKernelGzipDecompress(u8 *dest, u32 destSize, const void *src, u32 *unk);
int UtilsForKernel_39FFB756(int);
int UtilsForKernel_79D1C3FA(void);

View File

@ -1,265 +1,319 @@
/* Copyright (C) 2011, 2012, 2013 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef THREADMAN_KERNEL_H
#define THREADMAN_KERNEL_H
#include "common_header.h"
#include "threadman_user.h"
/* Threads */
typedef s32 (*SceKernelThreadEntry)(SceSize args, void *argp);
typedef struct {
SceSize size;
SceUID stackMpid;
} SceKernelThreadOptParam;
/* thread priority */
#define SCE_KERNEL_USER_HIGHEST_PRIORITY 16
#define SCE_KERNEL_MODULE_INIT_PRIORITY 32
#define SCE_KERNEL_USER_LOWEST_PRIORITY 111
SceUID sceKernelCreateThread(const char *name, SceKernelThreadEntry entry, int initPriority,
int stackSize, SceUInt attr, SceKernelThreadOptParam *option);
int sceKernelDeleteThread(SceUID thid);
int sceKernelStartThread(SceUID thid, SceSize arglen, void *argp);
int sceKernelExitThread(int status);
int sceKernelTerminateDeleteThread(SceUID thid);
int sceKernelDelayThread(SceUInt delay);
int sceKernelChangeThreadPriority(SceUID thid, int priority);
int sceKernelGetThreadCurrentPriority(void);
int sceKernelGetThreadId(void);
int sceKernelIsUserModeThread(void);
int sceKernelWaitThreadEnd(SceUID thid, SceUInt *timeout);
int sceKernelWaitThreadEndCB(SceUID thid, SceUInt *timeout);
int sceKernelReleaseWaitThread(SceUID thid);
int sceKernelSuspendAllUserThreads(void);
unsigned int sceKernelGetSystemTimeLow(void);
int sceKernelGetUserLevel(void);
typedef enum {
SCE_KERNEL_TMID_Thread = 1,
SCE_KERNEL_TMID_Semaphore = 2,
SCE_KERNEL_TMID_EventFlag = 3,
SCE_KERNEL_TMID_Mbox = 4,
SCE_KERNEL_TMID_Vpl = 5,
SCE_KERNEL_TMID_Fpl = 6,
SCE_KERNEL_TMID_Mpipe = 7,
SCE_KERNEL_TMID_Callback = 8,
SCE_KERNEL_TMID_ThreadEventHandler = 9,
SCE_KERNEL_TMID_Alarm = 10,
SCE_KERNEL_TMID_VTimer = 11,
SCE_KERNEL_TMID_SleepThread = 64,
SCE_KERNEL_TMID_DelayThread = 65,
SCE_KERNEL_TMID_SuspendThread = 66,
SCE_KERNEL_TMID_DormantThread = 67,
} SceKernelIdListType;
SceKernelIdListType sceKernelGetThreadmanIdType(SceUID uid);
/* Mutexes */
int sceKernelCreateMutex(char *, int, int, int);
int sceKernelTryLockMutex(int, int);
int sceKernelLockMutex(int, int, int);
int sceKernelUnlockMutex(int, int);
int sceKernelDeleteMutex(int);
/* Event flags */
typedef struct {
SceSize size;
char name[32];
SceUInt attr;
SceUInt initPattern;
SceUInt currentPattern;
int numWaitThreads;
} SceKernelEventFlagInfo;
typedef struct {
SceSize size;
} SceKernelEventFlagOptParam;
/* Event flag attributes. */
#define SCE_KERNEL_EA_SINGLE (0x0000) /** Multiple thread waits are prohibited. */
#define SCE_KERNEL_EA_MULTI (0x0200) /** Multiple thread waits are permitted. */
// NOTE: Deprecated. These types will be replaced by the below wait modes in future revisions.
enum SceEventFlagWaitTypes {
/** Wait for all bits in the pattern to be set */
SCE_EVENT_WAITAND = 0,
/** Wait for one or more bits in the pattern to be set */
SCE_EVENT_WAITOR = 1,
/** Clear the wait pattern when it matches */
SCE_EVENT_WAITCLEAR = 0x20
};
/* Event flag wait modes. */
#define SCE_KERNEL_EW_AND (0x00) /** Wait for all bits in the bit pattern to be set. */
#define SCE_KERNEL_EW_OR (0x01) /** Wait for one or more bits in the bit pattern to be set. */
#define SCE_KERNEL_EW_CLEAR_ALL (0x10) /** Clear all bits after wait condition is satisfied. */
#define SCE_KERNEL_EW_CLEAR_PAT (0x20) /** Clear bits specified by bit pattern after wait condition is satisfied. */
#define SCE_KERNEL_EW_CLEAR SCE_KERNEL_EW_CLEAR_ALL
SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt);
int sceKernelSetEventFlag(SceUID evid, u32 bits);
int sceKernelClearEventFlag(SceUID evid, u32 bits);
int sceKernelPollEventFlag(int evid, u32 bits, u32 wait, u32 *outBits);
int sceKernelWaitEventFlag(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
int sceKernelWaitEventFlagCB(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
int sceKernelCancelEventFlag(SceUID evid, SceUInt setpattern, s32 *numWaitThreads);
int sceKernelDeleteEventFlag(int evid);
int sceKernelReferEventFlagStatus(SceUID event, SceKernelEventFlagInfo *status);
/* MsgPipe */
SceUID sceKernelCreateMsgPipe(const char *name, int part, int attr, void *unk1, void *opt);
int sceKernelDeleteMsgPipe(SceUID uid);
int sceKernelSendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
int sceKernelSendMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
int sceKernelTrySendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2);
int sceKernelReceiveMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
int sceKernelReceiveMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
int sceKernelTryReceiveMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2);
int sceKernelCancelMsgPipe(SceUID uid, int *psend, int *precv);
typedef struct {
SceSize size;
char name[32];
SceUInt attr;
int bufSize;
int freeSize;
int numSendWaitThreads;
int numReceiveWaitThreads;
} SceKernelMppInfo;
int sceKernelReferMsgPipeStatus(SceUID uid, SceKernelMppInfo *info);
/* Semaphores */
typedef struct {
SceSize size;
} SceKernelSemaOptParam;
typedef struct {
SceSize size;
char name[32];
SceUInt attr;
int initCount;
int currentCount;
int maxCount;
int numWaitThreads;
} SceKernelSemaInfo;
SceUID sceKernelCreateSema(const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option);
int sceKernelDeleteSema(SceUID semaid);
int sceKernelSignalSema(SceUID semaid, int signal);
int sceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout);
int sceKernelWaitSemaCB(SceUID semaid, int signal, SceUInt *timeout);
int sceKernelPollSema(SceUID semaid, int signal);
int sceKernelReferSemaStatus(SceUID semaid, SceKernelSemaInfo *info);
/* KTLS */
int sceKernelAllocateKTLS(int id, int (*cb)(unsigned int *size, void *arg), void *arg);
int sceKernelFreeKTLS(int id);
void *sceKernelGetKTLS(int id);
void *sceKernelGetThreadKTLS(int id, SceUID thid, int mode);
/* Alarms. */
typedef SceUInt (*SceKernelAlarmHandler)(void *common);
typedef struct {
SceUInt32 low;
SceUInt32 hi;
} SceKernelSysClock;
typedef struct {
SceSize size;
SceKernelSysClock schedule;
SceKernelAlarmHandler handler;
void *common;
} SceKernelAlarmInfo;
SceUID sceKernelSetAlarm(SceUInt clock, SceKernelAlarmHandler handler, void *common);
SceUID sceKernelSetSysClockAlarm(SceKernelSysClock *clock, SceKernelAlarmHandler handler, void *common);
int sceKernelCancelAlarm(SceUID alarmid);
int sceKernelReferAlarmStatus(SceUID alarmid, SceKernelAlarmInfo *info);
/* Callbacks */
typedef s32 (*SceKernelCallbackFunction)(s32 arg1, s32 arg2, void *arg);
typedef struct {
SceSize size;
char name[32];
SceUID threadId;
SceKernelCallbackFunction callback;
void *common;
s32 notifyCount;
s32 notifyArg;
} SceKernelCallbackInfo;
int sceKernelNotifyCallback(SceUID cb, int arg2);
int sceKernelReferCallbackStatus(SceUID cb, SceKernelCallbackInfo *status);
/* VPL Functions */
typedef struct {
SceSize size;
} SceKernelVplOptParam;
SceUID sceKernelCreateVpl(const char *name, int part, int attr, unsigned int size, SceKernelVplOptParam *opt);
int sceKernelDeleteVpl(SceUID uid);
int sceKernelAllocateVpl(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
int sceKernelAllocateVplCB(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
int sceKernelTryAllocateVpl(SceUID uid, unsigned int size, void **data);
int sceKernelFreeVpl(SceUID uid, void *data);
int sceKernelCancelVpl(SceUID uid, int *pnum);
typedef struct {
SceSize size;
char name[32];
SceUInt attr;
int poolSize;
int freeSize;
int numWaitThreads;
} SceKernelVplInfo;
int sceKernelReferVplStatus(SceUID uid, SceKernelVplInfo *info);
/* FPL Functions */
typedef struct {
SceSize size;
} SceKernelFplOptParam;
int sceKernelCreateFpl(const char *name, int part, int attr, unsigned int size, unsigned int blocks, SceKernelFplOptParam *opt);
int sceKernelDeleteFpl(SceUID uid);
int sceKernelAllocateFpl(SceUID uid, void **data, unsigned int *timeout);
int sceKernelAllocateFplCB(SceUID uid, void **data, unsigned int *timeout);
int sceKernelTryAllocateFpl(SceUID uid, void **data);
int sceKernelFreeFpl(SceUID uid, void *data);
int sceKernelCancelFpl(SceUID uid, int *pnum);
typedef struct {
SceSize size;
char name[32];
SceUInt attr;
int blockSize;
int numBlocks;
int freeBlocks;
int numWaitThreads;
} SceKernelFplInfo;
int sceKernelReferFplStatus(SceUID uid, SceKernelFplInfo *info);
s64 sceKernelGetSystemTimeWide(void);
#endif /* THREADMAN_KERNEL_H */
/* Copyright (C) 2011 - 2015 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef THREADMAN_KERNEL_H
#define THREADMAN_KERNEL_H
#include "common_header.h"
#include "threadman_user.h"
/* Threads */
typedef s32 (*SceKernelThreadEntry)(SceSize args, void *argp);
typedef s32 (*SceKernelRebootKernelThreadEntry)(s32 arg1, u32 arg2, s32 arg3, s32 arg4);
typedef struct {
SceSize size;
SceUID stackMpid;
} SceKernelThreadOptParam;
#define SCE_KERNEL_THREAD_ID_SELF (0) /* UID representing calling thread. */
/**
* thread priority - lower numbers mean higher priority
*/
#define SCE_KERNEL_INVALID_PRIORITY (0)
#define SCE_KERNEL_HIGHEST_PRIORITY_KERNEL (1)
#define SCE_KERNEL_HIGHEST_PRIORITY_USER (16)
#define SCE_KERNEL_MODULE_INIT_PRIORITY (32)
#define SCE_KERNEL_LOWEST_PRIORITY_USER (111)
#define SCE_KERNEL_LOWEST_PRIORITY_KERNEL (126)
/* thread size */
#define SCE_KERNEL_TH_KERNEL_DEFAULT_STACKSIZE (4 * 1024) /* 4 KB */
#define SCE_KERNEL_TH_USER_DEFAULT_STACKSIZE (256 * 1024) /* 256 KB */
/* thread attributes */
#define SCE_KERNEL_TH_VSH_MODE (0xC0000000) /* Thread runs in VSH mode. */
#define SCE_KERNEL_TH_APP_MODE (0xB0000000) /* Thread runs in Application mode. */
#define SCE_KERNEL_TH_USB_WLAN_MODE (0xA0000000) /* Thread runs in USB_WLAN mode. */
#define SCE_KERNEL_TH_MS_MODE (0x90000000) /* Thread runs in MS mode. */
#define SCE_KERNEL_TH_USER_MODE (0x80000000) /* Thread runs in User mode. */
#define SCE_KERNEL_TH_NO_FILLSTACK (0x00100000)
#define SCE_KERNEL_TH_CLEAR_STACK (0x00200000) /* Specifies that thread memory area should be cleared to 0 when deleted. */
#define SCE_KERNEL_TH_LOW_STACK (0x00400000) /* Specifies that the stack area is allocated from the lower addresses in memory, not the higher ones. */
#define SCE_KERNEL_TH_UNK_800000 (0x00800000)
#define SCE_KERNEL_TH_USE_VFPU (0x00004000) /* Specifies that the VFPU is available. */
#define SCE_KERNEL_TH_NEVERUSE_FPU (0x00002000)
#define SCE_KERNEL_TH_DEFAULT_ATTR (0)
#define SCE_KERNEL_AT_THFIFO (0x00000000) /* Waiting threads are queued on a FIFO basis. */
#define SCE_KERNEL_AT_THPRI (0x00000100) /* Waiting threads are queued based on priority. */
SceUID sceKernelCreateThread(const char *name, SceKernelThreadEntry entry, s32 initPriority,
SceSize stackSize, SceUInt attr, SceKernelThreadOptParam *option);
int sceKernelDeleteThread(SceUID thid);
int sceKernelStartThread(SceUID thid, SceSize arglen, void *argp);
int sceKernelSuspendThread(SceUID thid);
int sceKernelExitThread(s32 status);
s32 sceKernelExitDeleteThread(s32 exitStatus);
int sceKernelTerminateDeleteThread(SceUID thid);
int sceKernelDelayThread(SceUInt delay);
int sceKernelChangeThreadPriority(SceUID thid, int priority);
int sceKernelGetThreadCurrentPriority(void);
s32 sceKernelGetThreadId(void);
int sceKernelIsUserModeThread(void);
int sceKernelWaitThreadEnd(SceUID thid, SceUInt *timeout);
int sceKernelWaitThreadEndCB(SceUID thid, SceUInt *timeout);
int sceKernelReleaseWaitThread(SceUID thid);
int sceKernelSuspendAllUserThreads(void);
unsigned int sceKernelGetSystemTimeLow(void);
enum SceUserLevel {
SCE_USER_LEVEL_MS = 1,
SCE_USER_LEVEL_USBWLAN = 2,
SCE_USER_LEVEL_APP = 3,
SCE_USER_LEVEL_VSH = 4,
};
int sceKernelGetUserLevel(void);
typedef enum {
SCE_KERNEL_TMID_Thread = 1,
SCE_KERNEL_TMID_Semaphore = 2,
SCE_KERNEL_TMID_EventFlag = 3,
SCE_KERNEL_TMID_Mbox = 4,
SCE_KERNEL_TMID_Vpl = 5,
SCE_KERNEL_TMID_Fpl = 6,
SCE_KERNEL_TMID_Mpipe = 7,
SCE_KERNEL_TMID_Callback = 8,
SCE_KERNEL_TMID_ThreadEventHandler = 9,
SCE_KERNEL_TMID_Alarm = 10,
SCE_KERNEL_TMID_VTimer = 11,
SCE_KERNEL_TMID_SleepThread = 64,
SCE_KERNEL_TMID_DelayThread = 65,
SCE_KERNEL_TMID_SuspendThread = 66,
SCE_KERNEL_TMID_DormantThread = 67,
} SceKernelIdListType;
SceKernelIdListType sceKernelGetThreadmanIdType(SceUID uid);
/* Mutexes */
typedef struct {
SceSize size;
} SceKernelMutexOptParam;
typedef struct {
SceSize size;
char name[SCE_UID_NAME_LEN + 1];
SceUInt attr;
s32 initCount;
s32 currentCount;
SceUID currentOwner;
s32 numWaitThreads;
} SceKernelMutexInfo;
/* Mutex attributes */
#define SCE_KERNEL_MUTEX_ATTR_TH_FIFO (SCE_KERNEL_AT_THFIFO)
#define SCE_KERNEL_MUTEX_ATTR_TH_PRI (SCE_KERNEL_AT_THPRI)
#define SCE_KERNEL_MUTEX_ATTR_RECURSIVE (0x0200) /*Allow recursive locks by threads that own the mutex. */
s32 sceKernelCreateMutex(char *name, s32 attr, s32 initCount, const SceKernelMutexOptParam *pOption);
s32 sceKernelDeleteMutex(SceUID mutexId);
s32 sceKernelLockMutex(SceUID mutexId, s32 lockCount, u32 *pTimeout);
s32 sceKernelLockMutexCB(SceUID mutexId, s32 lockCount, u32 *pTimeout);
s32 sceKernelTryLockMutex(SceUID mutexId, s32 lockCount);
s32 sceKernelUnlockMutex(SceUID mutexId, s32 unlockCount);
s32 sceKernelCancelMutex(SceUID mutexId, s32 newLockCount, s32 *pNumWaitThreads);
s32 sceKernelReferMutexStatus(SceUID mutexId, SceKernelMutexInfo *pInfo);
/* Event flags */
typedef struct {
SceSize size;
char name[SCE_UID_NAME_LEN + 1];
SceUInt attr;
SceUInt initPattern;
SceUInt currentPattern;
int numWaitThreads;
} SceKernelEventFlagInfo;
typedef struct {
SceSize size;
} SceKernelEventFlagOptParam;
/* Event flag attributes. */
#define SCE_KERNEL_EA_SINGLE (0x0000) /** Multiple thread waits are prohibited. */
#define SCE_KERNEL_EA_MULTI (0x0200) /** Multiple thread waits are permitted. */
/* Event flag wait modes. */
#define SCE_KERNEL_EW_AND (0x00) /** Wait for all bits in the bit pattern to be set. */
#define SCE_KERNEL_EW_OR (0x01) /** Wait for one or more bits in the bit pattern to be set. */
#define SCE_KERNEL_EW_CLEAR_ALL (0x10) /** Clear all bits after wait condition is satisfied. */
#define SCE_KERNEL_EW_CLEAR_PAT (0x20) /** Clear bits specified by bit pattern after wait condition is satisfied. */
#define SCE_KERNEL_EW_CLEAR SCE_KERNEL_EW_CLEAR_ALL
SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt);
int sceKernelSetEventFlag(SceUID evid, u32 bits);
int sceKernelClearEventFlag(SceUID evid, u32 bits);
int sceKernelPollEventFlag(int evid, u32 bits, u32 wait, u32 *outBits);
int sceKernelWaitEventFlag(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
int sceKernelWaitEventFlagCB(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
int sceKernelCancelEventFlag(SceUID evid, SceUInt setpattern, s32 *numWaitThreads);
int sceKernelDeleteEventFlag(int evid);
int sceKernelReferEventFlagStatus(SceUID event, SceKernelEventFlagInfo *status);
/* MsgPipe */
SceUID sceKernelCreateMsgPipe(const char *name, int part, int attr, void *unk1, void *opt);
int sceKernelDeleteMsgPipe(SceUID uid);
int sceKernelSendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
int sceKernelSendMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
int sceKernelTrySendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2);
int sceKernelReceiveMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
int sceKernelReceiveMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
int sceKernelTryReceiveMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2);
int sceKernelCancelMsgPipe(SceUID uid, int *psend, int *precv);
typedef struct {
SceSize size;
char name[SCE_UID_NAME_LEN + 1];
SceUInt attr;
int bufSize;
int freeSize;
int numSendWaitThreads;
int numReceiveWaitThreads;
} SceKernelMppInfo;
int sceKernelReferMsgPipeStatus(SceUID uid, SceKernelMppInfo *info);
/* Semaphores */
typedef struct {
SceSize size;
} SceKernelSemaOptParam;
typedef struct {
SceSize size;
char name[SCE_UID_NAME_LEN + 1];
SceUInt attr;
int initCount;
int currentCount;
int maxCount;
int numWaitThreads;
} SceKernelSemaInfo;
#define SCE_KERNEL_SA_THFIFO (0x0000) /* A FIFO queue is used for the waiting thread */
#define SCE_KERNEL_SA_THPRI (0x0100) /* The waiting thread is queued by its thread priority */
SceUID sceKernelCreateSema(const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option);
int sceKernelDeleteSema(SceUID semaid);
int sceKernelSignalSema(SceUID semaid, int signal);
int sceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout);
int sceKernelWaitSemaCB(SceUID semaid, int signal, SceUInt *timeout);
int sceKernelPollSema(SceUID semaid, int signal);
int sceKernelReferSemaStatus(SceUID semaid, SceKernelSemaInfo *info);
/* KTLS */
int sceKernelAllocateKTLS(int id, int (*cb)(unsigned int *size, void *arg), void *arg);
int sceKernelFreeKTLS(int id);
void *sceKernelGetKTLS(int id);
void *sceKernelGetThreadKTLS(int id, SceUID thid, int mode);
/* Alarms. */
typedef SceUInt (*SceKernelAlarmHandler)(void *common);
typedef struct {
SceUInt32 low;
SceUInt32 hi;
} SceKernelSysClock;
typedef struct {
SceSize size;
SceKernelSysClock schedule;
SceKernelAlarmHandler handler;
void *common;
} SceKernelAlarmInfo;
SceUID sceKernelSetAlarm(SceUInt clock, SceKernelAlarmHandler handler, void *common);
SceUID sceKernelSetSysClockAlarm(SceKernelSysClock *clock, SceKernelAlarmHandler handler, void *common);
int sceKernelCancelAlarm(SceUID alarmid);
int sceKernelReferAlarmStatus(SceUID alarmid, SceKernelAlarmInfo *info);
/* Callbacks */
typedef s32 (*SceKernelCallbackFunction)(s32 arg1, s32 arg2, void *arg);
typedef struct {
SceSize size;
char name[SCE_UID_NAME_LEN + 1];
SceUID threadId;
SceKernelCallbackFunction callback;
void *common;
s32 notifyCount;
s32 notifyArg;
} SceKernelCallbackInfo;
int sceKernelNotifyCallback(SceUID cb, int arg2);
int sceKernelReferCallbackStatus(SceUID cb, SceKernelCallbackInfo *status);
/* VPL Functions */
typedef struct {
SceSize size;
} SceKernelVplOptParam;
SceUID sceKernelCreateVpl(const char *name, int part, int attr, unsigned int size, SceKernelVplOptParam *opt);
int sceKernelDeleteVpl(SceUID uid);
int sceKernelAllocateVpl(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
int sceKernelAllocateVplCB(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
int sceKernelTryAllocateVpl(SceUID uid, unsigned int size, void **data);
int sceKernelFreeVpl(SceUID uid, void *data);
int sceKernelCancelVpl(SceUID uid, int *pnum);
typedef struct {
SceSize size;
char name[SCE_UID_NAME_LEN + 1];
SceUInt attr;
int poolSize;
int freeSize;
int numWaitThreads;
} SceKernelVplInfo;
int sceKernelReferVplStatus(SceUID uid, SceKernelVplInfo *info);
/* FPL Functions */
typedef struct {
SceSize size;
} SceKernelFplOptParam;
int sceKernelCreateFpl(const char *name, int part, int attr, unsigned int size, unsigned int blocks, SceKernelFplOptParam *opt);
int sceKernelDeleteFpl(SceUID uid);
int sceKernelAllocateFpl(SceUID uid, void **data, unsigned int *timeout);
int sceKernelAllocateFplCB(SceUID uid, void **data, unsigned int *timeout);
int sceKernelTryAllocateFpl(SceUID uid, void **data);
int sceKernelFreeFpl(SceUID uid, void *data);
int sceKernelCancelFpl(SceUID uid, int *pnum);
typedef struct {
SceSize size;
char name[SCE_UID_NAME_LEN + 1];
SceUInt attr;
int blockSize;
int numBlocks;
int freeBlocks;
int numWaitThreads;
} SceKernelFplInfo;
int sceKernelReferFplStatus(SceUID uid, SceKernelFplInfo *info);
s64 sceKernelGetSystemTimeWide(void);
#endif /* THREADMAN_KERNEL_H */

View File

@ -1,18 +1,22 @@
/* Copyright (C) 2011, 2012, 2013, 2014 The uOFW team
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
#include "common_header.h"
/**
* @defgroup UMD_ERROR UMD Errors
* @ingroup UMDDriveManagement
*
* uofw/include/umd_error.h \n
* Defines error codes specifically for the UMD facility. \n
*
* @{
*/
#ifndef UMD_ERROR_H
#define UMD_ERROR_H
#include "common_header.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -22,17 +26,17 @@ extern "C" {
SCE_ERROR_FACILITY_UMD = 0x021
*/
#define SCE_ERROR_UMD_NOT_READY 0x80210001 /** Device not ready. */
#define SCE_ERROR_UMD_LBA_OUT_OF_RANGE 0x80210002 /** Logical block addressing out of range. */
#define SCE_ERROR_UMD_NO_MEDIUM 0x80210003 /** No disc. */
#define SCE_ERROR_UMD_UNKNOWN_MEDIUM 0x80210004 /** Unknown disc medium. */
#define SCE_ERROR_UMD_HARDWARE_FAILURE 0x80210005 /** Hardware failure. */
#define SCE_ERROR_UMD_POWER_OFF 0x80210006 /** UMD device without power. */
#define SCE_UMD_ERROR_REPLACED 0x80210007 /** Media switching prohibited. */
#define SCE_UMD_ERROR_INVALID_LAYOUT 0x80210008 /** DVD data image layout is invalid. */
#define SCE_UMD_READAHEAD_REQ_FULL 0x80210009 /** Read ahead requests are full. */
#define SCE_UMD_READAHEAD_NOREQ 0x80210010 /** Non-existent read ahead request. */
#define SCE_UMD_READAHEAD_BUSY 0x80210011 /** Read ahead request already running. */
#define SCE_UMD_ERROR_NOT_DEVICE_READY 0x80210001 /*!< Device not ready. */
#define SCE_UMD_ERROR_LBA_OUT_OF_RANGE 0x80210002 /*!< Logical block addressing out of range. */
#define SCE_UMD_ERROR_NO_MEDIUM 0x80210003 /*!< No disc. */
#define SCE_UMD_ERROR_UNKNOWN_MEDIUM 0x80210004 /*!< Unknown disc medium. */
#define SCE_UMD_ERROR_HARDWARE_FAILURE 0x80210005 /*!< Hardware failure. */
#define SCE_UMD_ERROR_POWER_OFF 0x80210006 /*!< UMD device without power. */
#define SCE_UMD_ERROR_REPLACED 0x80210007 /*!< Media switching prohibited. */
#define SCE_UMD_ERROR_INVALID_LAYOUT 0x80210008 /*!< DVD data image layout is invalid. */
#define SCE_UMD_ERROR_READAHEAD_REQ_FULL 0x80210009 /*!< Read ahead requests are full. */
#define SCE_UMD_ERROR_READAHEAD_NOREQ 0x80210010 /*!< Non-existent read ahead request. */
#define SCE_UMD_ERROR_READAHEAD_BUSY 0x80210011 /*!< Read ahead request already running. */
#ifdef __cplusplus

170
include/usbbus.h Normal file
View File

@ -0,0 +1,170 @@
/* Copyright (C) The uOFW team
See the file COPYING for copying permission.
*/
/** @defgroup Chkreg Chkreg Module
* Region check and ConsoleId service.
* @{
*/
#ifndef USBBUS_H
#define USBBUS_H
#include "common_header.h"
/**
* USB driver endpoint
*/
struct UsbEndpoint {
/** Endpoint number (must be filled in sequentially) */
int endpnum;
/** Filled in by the bus driver */
int unk2;
/** Filled in by the bus driver */
int unk3;
};
/**
* USB Interface descriptor
*/
struct InterfaceDescriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bInterfaceNumber;
unsigned char bAlternateSetting;
unsigned char bNumEndpoints;
unsigned char bInterfaceClass;
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;
} __attribute__((packed));
/**
* USB driver interfaces structure
*/
struct UsbInterfaces {
/** Pointers to the individual interface descriptors */
struct InterfaceDescriptor *infp[2];
/** Number of interface descriptors */
unsigned int num;
};
/**
* USB string descriptor
*/
struct StringDescriptor {
unsigned char bLength;
unsigned char bDescriptorType;
short bString[32];
} __attribute__((packed));
/**
* USB EP0 Device Request
*/
struct DeviceRequest {
unsigned char bmRequestType;
unsigned char bRequest;
unsigned short wValue;
unsigned short wIndex;
unsigned short wLength;
} __attribute__((packed));
/**
* USB driver structure used by ::sceUsbbdRegister and ::sceUsbbdUnregister
*/
struct UsbDriver {
/** Name of the USB driver */
const char *name;
/** Number of endpoints in this driver (including default control) */
int endpoints;
/** List of endpoint structures (used when calling other functions) */
struct UsbEndpoint *endp;
/** Interface list */
struct UsbInterface *intp;
/** Pointer to hi-speed device descriptor */
void *devp_hi;
/** Pointer to hi-speed device configuration */
void *confp_hi;
/** Pointer to full-speed device descriptor */
void *devp;
/** Pointer to full-speed device configuration */
void *confp;
/** Default String descriptor */
struct StringDescriptor *str;
/** Received a control request arg0 is endpoint, arg1 is possibly data arg2 is data buffer */
int (*recvctl)(int arg1, int arg2, struct DeviceRequest *req);
/** Unknown */
int (*func28)(int arg1, int arg2, int arg3);
/** Configuration set (attach) function */
int (*attach)(int speed, void *arg2, void *arg3);
/** Configuration unset (detach) function */
int (*detach)(int arg1, int arg2, int arg3);
/** Unknown set to 0 */
int unk34;
/** Function called when the driver is started */
int (*start_func)(int size, void *args);
/** Function called when the driver is stopped */
int (*stop_func)(int size, void *args);
/** Link to next USB driver in the chain, set to NULL */
struct UsbDriver *link;
};
/**
* USB device request, used by ::sceUsbbdReqSend and ::sceUsbbdReqRecv.
*/
struct UsbdDeviceReq {
/** Pointer to the endpoint to queue request on */
struct UsbEndpoint *endp;
/** Pointer to the data buffer to use in the request */
void *data;
/** Size of the data buffer (send == size of data, recv == size of max receive) */
int size;
/** Unknown */
int unkc;
/** Pointer to the function to call on completion */
void *func;
/** Resultant size (send == size of data sent, recv == size of data received) */
int recvsize;
/** Return code of the request, 0 == success, -3 == cancelled */
int retcode;
/** Unknown */
int unk1c;
/** A user specified pointer for the device request */
void *arg;
/** Link pointer to next request used by the driver, set it to NULL */
void *link;
};
/**
* Register a USB driver.
*
* @param drv - Pointer to a filled out USB driver
*
* @return 0 on success, < 0 on error.
*/
int sceUsbbdRegister(struct UsbDriver *drv);
/**
* Unregister a USB driver
*
* @param drv - Pointer to a filled out USB driver
*
* @return 0 on success, < 0 on error
*/
int sceUsbbdUnregister(struct UsbDriver *drv);
/**
* Queue a send request (IN from host pov)
*
* @param req - Pointer to a filled out UsbdDeviceReq structure.
*
* @return 0 on success, < 0 on error
*/
int sceUsbbdReqSend(struct UsbdDeviceReq *req);
int sceUsbBus_driver_8A3EB5D2(void);
#endif // USBBUS_H
/** @} */

View File

@ -0,0 +1,22 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/utility/utility_common.h
*
*/
#ifndef UTILITY_COMMON_H
#define UTILITY_COMMON_H
#define SCE_UTILITY_COMMON_ERROR_INVALID_STATUS 0x80110001
#define SCE_UTILITY_COMMON_ERROR_INVALID_ADDRESS 0x80110002
#define SCE_UTILITY_COMMON_ERROR_UNKNOWN_UTILITY_TYPE 0x80110003
#define SCE_UTILITY_COMMON_ERROR_INVALID_PARAM_SIZE 0x80110004
#define SCE_UTILITY_COMMON_ERROR_DIALOG_TYPE_MISMATCH 0x80110005
#define SCE_UTILITY_COMMON_ERROR_CANT_OPEN_MODULE 0x80110006
#define SCE_UTILITY_COMMON_ERROR_STATUS_WAITING 0x80110007
#endif /* UTILITY_COMMON_H */

View File

@ -0,0 +1,19 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/utility/utility_module.h
*
*/
#ifndef UTILITY_MODULE_H
#define UTILITY_MODULE_H
#define SCE_UTILITY_MODULE_ERROR_INVALID_ID 0x80111101
#define SCE_UTILITY_MODULE_ERROR_ALREADY_LOADED 0x80111102
#define SCE_UTILITY_MODULE_ERROR_NOT_LOADED 0x80111103
#define SCE_UTILITY_MODULE_ERROR_CANNOT_START 0x80111104
#define SCE_UTILITY_MODULE_ERROR_CANNOT_STOP 0x80111105
#endif /* UTILITY_MODULE_H */

View File

@ -0,0 +1,22 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/utility/utility_netparam.h
*
*/
#ifndef UTILITY_NETPARAM_H
#define UTILITY_NETPARAM_H
/* Net_Param utility specific error codes (0x80110600 - 0x801106ff). */
#define SCE_UTILITY_NET_PARAM_ERROR_NO_SUCH_CNF 0x80110601
#define SCE_UTILITY_NET_PARAM_ERROR_INVALID_ID 0x80110602
#define SCE_UTILITY_NET_PARAM_ERROR_INVALID_POINTER 0x80110603
#define SCE_UTILITY_NET_PARAM_ERROR_INVALID_CODE 0x80110604
#define SCE_UTILITY_NET_PARAM_ERROR_INVALID_VALUE 0x80110605
#define SCE_UTILITY_NET_PARAM_ERROR_UNEXPECTED_PARAMTYPE 0x80110606
#endif /* UTILITY_NETPARAM_H */

View File

@ -0,0 +1,62 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/utility/utility_savedata.h
*
*/
#ifndef UTILITY_SAVEDATA_H
#define UTILITY_SAVEDATA_H
/* Savedata utility specific error codes (0x80110300 - 0x801103ff). */
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_MEMSTICK 0x80110301
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_MEMSTICK_REMOVED 0x80110302
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_ACCESS_ERROR 0x80110305
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_DATA_BROKEN 0x80110306
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA 0x80110307
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_BAD_PARAMS 0x80110308
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_UMD 0x80110309
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_INTERNAL_ERROR 0x80110309
#define SCE_UTILITY_SAVEDATA_ERROR_RW_NO_MEMSTICK 0x80110321
#define SCE_UTILITY_SAVEDATA_ERROR_RW_MEMSTICK_REMOVED 0x80110322
#define SCE_UTILITY_SAVEDATA_ERROR_RW_MEMSTICK_FULL 0x80110323
#define SCE_UTILITY_SAVEDATA_ERROR_RW_MEMSTICK_PROTECTED 0x80110324
#define SCE_UTILITY_SAVEDATA_ERROR_RW_ACCESS_ERROR 0x80110325
#define SCE_UTILITY_SAVEDATA_ERROR_RW_DATA_BROKEN 0x80110326
#define SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA 0x80110327
#define SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS 0x80110328
#define SCE_UTILITY_SAVEDATA_ERROR_RW_FILE_NOT_FOUND 0x80110329
#define SCE_UTILITY_SAVEDATA_ERROR_RW_CAN_NOT_SUSPEND 0x8011032A
#define SCE_UTILITY_SAVEDATA_ERROR_RW_INTERNAL_ERROR 0x8011032B
#define SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_STATUS 0x8011032C
#define SCE_UTILITY_SAVEDATA_ERROR_RW_SECURE_FILE_FULL 0x8011032D
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_MEMSTICK 0x80110341
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_MEMSTICK_REMOVED 0x80110342
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_MEMSTICK_PROTECTED 0x80110344
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_ACCESS_ERROR 0x80110345
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_DATA_BROKEN 0x80110346
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_DATA 0x80110347
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_BAD_PARAMS 0x80110348
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_INTERNAL_ERROR 0x8011034B
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_NO_MEMSTICK 0x80110381
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_MEMSTICK_REMOVED 0x80110382
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_NO_SPACE 0x80110383
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_MEMSTICK_PROTECTED 0x80110384
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_ACCESS_ERROR 0x80110385
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_BAD_PARAMS 0x80110388
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_NO_UMD 0x80110389
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_WRONG_UMD 0x8011038A
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_INTERNAL_ERROR 0x8011038B
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_MEMSTICK 0x801103C1
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_MEMSTICK_REMOVED 0x801103C2
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_ACCESS_ERROR 0x801103C5
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_DATA_BROKEN 0x801103C6
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA 0x801103C7
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_BAD_PARAMS 0x801103C8
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_INTERNAL_ERROR 0x801103CB
#endif /* UTILITY_SAVEDATA_H */

View File

@ -0,0 +1,55 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/utility/utility_screenshot.h
*
*/
#ifndef UTILITY_SCREENSHOT_H
#define UTILITY_SCREENSHOT_H
/* Screenshot utility specific error codes (0x80111200 - 0x801112ff). */
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_DISPLAY_PIXEL_FORMAT (0x80111206) /*!< The specified display pixel format is invalid. */
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_SCREENSHOT_EXTENT (0x80111207) /*!< The specified rectangular screenshot area is invalid. */
#define SCE_UTILITY_SCREENSHOT_ERROR_POINTER_IS_NULL (0x80111208) /*!< Detected NULL pointer error. */
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_IMAGE_TYPE (0x80111209) /*!< The specified image type is invalid. */
#define SCE_UTILITY_SCREENSHOT_ERROR_OPEN_FILE (0x8011120b)
#define SCE_UTILITY_SCREENSHOT_ERROR_CANT_WRITE_SCREENSHOT_IMAGE (0x8011120c)
#define SCE_UTILITY_SCREENSHOT_ERROR_LOAD_NO_MS (0x8011120d)
#define SCE_UTILITY_SCREENSHOT_ERROR_SAVE_MS_PROTECTED (0x8011120e)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_MAKE_SCREENSHOT_ROOT_DIR (0x8011120f)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_MAKE_SAVE_DIR (0x80111210)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_OPEN_SAVE_DIR (0x80111211)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_READ_SAVE_DIR_INFO (0x80111212)
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_FILE_NAME (0x80111213)
#define SCE_UTILITY_SCREENSHOT_ERROR_LOAD_EJECT_MS (0x80111214)
#define SCE_UTILITY_SCREENSHOT_ERROR_SAVE_MS_NOSPACE (0x80111215)
#define SCE_UTILITY_SCREENSHOT_ERROR_SAVE_ACCESS_ERROR (0x80111216)
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_FRAMEBUFFER (0x80111219)
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_TITLE_ID (0x8011121b)
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_BOOT_PARAM (0x8011121c)
#define SCE_UTILITY_SCREENSHOT_ERROR_NOT_FOUND_PSCMDAT_IMAGE_FILE (0x8011121d)
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_FILE_SIZE (0x8011121e)
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_PATH_SIZE (0x8011121f)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_OPEN_PSCMDAT (0x80111220)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_WRITE_PSCMDAT (0x80111221)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_OPEN_SRCFILE_FOR_PSCMDAT (0x80111222)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_READ_SRCFILE_FOR_PSCMDAT (0x80111223)
#define SCE_UTILITY_SCREENSHOT_ERROR_FAILED_SAVE_SCREENSHOT_WITH_NUMBER (0x80111224)
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_COMMENT_PARAMS (0x80111225)
#define SCE_UTILITY_SCREENSHOT_ERROR_DETECTED_INVALID_STRING (0x80111226)
#define SCE_UTILITY_SCREENSHOT_ERROR_INVALID_UTILITY_TYPE (0x80111227)
#define SCE_UTILITY_SCREENSHOT_ERROR_INCOMPLETE_WRITING_IMAGE (0x80111228)
#define SCE_UTILITY_SCREENSHOT_ERROR_HAVE_NOT_CONT_MODE_START_YET (0x80111229)
#define SCE_UTILITY_SCREENSHOT_ERROR_LOAD_EJECT_MS2 (0x80111233)
#define SCE_UTILITY_SCREENSHOT_ERROR_NOT_FOUND_THE_TARGET_DIR_FOR_VIEW (0x8011123c)
#define SCE_UTILITY_SCREENSHOT_ERROR_FOUND_SAME_FILE_NAME (0x8011123d)
#define SCE_UTILITY_SCREENSHOT_ERROR_VAST_THE_MAX_NUMBER_OF_IMAGE_FILE (0x8011123e)
#define SCE_UTILITY_SCREENSHOT_ERROR_VIEW_ACCESS_ERROR (0x80111241)
#endif /* UTILITY_SCREENSHOT_H */

52
include/video/lib_mpeg.h Normal file
View File

@ -0,0 +1,52 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/video/lib_mpeg.h
*
* lib_mpeg is a library that can be used for demultiplexing a PSP Movie Format \n
* (for game) stream (PSMF), and decoding the demultiplexed video and audio streams.
*
* PSMF is based on the MPEG2 program stream, and multiplexes together multiple \n
* video, audio, and user data streams into a single stream.
*/
#ifndef LIB_MPEG_H
#define LIB_MPEG_H
#include "common\errors.h"
/* lib_mpeg specific error codes. */
/* for general libmpeg & Demux */
#define SCE_MPEG_ERROR_OK SCE_ERROR_OK
#define SCE_MPEG_ERROR_NOT_COMPLETED 0x80618001
#define SCE_MPEG_ERROR_INVALID_VALUE 0x806101FE
#define SCE_MPEG_ERROR_UNMATCHED_VERSION 0x80610002
#define SCE_MPEG_ERROR_INVALID_POINTER 0x80610103
#define SCE_MPEG_ERROR_OUT_OF_MEMORY 0x80610022
#define SCE_MPEG_ERROR_NO_RAPI 0x80618004
#define SCE_MPEG_ERROR_ALREADY_USED 0x80618005
#define SCE_MPEG_ERROR_INTERNAL 0x80618006
#define SCE_MPEG_ERROR_ILLEGAL_STREAM 0x80618007
#define SCE_MPEG_ERROR_INSUFFICIENT_STACKSIZE 0x80618008
#define SCE_MPEG_ERROR_NOT_INITIALIZE 0x80618009
/* for VIDEO Decoder */
#define SCE_MPEG_ERROR_VIDEO_INVALID_VALUE 0x806201FE
#define SCE_MPEG_ERROR_VIDEO_UNMATCHED_VERSION 0x80620002
#define SCE_MPEG_ERROR_VIDEO_ERROR 0x80628001
#define SCE_MPEG_ERROR_VIDEO_FATAL 0x80628002
/* for AUDIO Decoder */
#define SCE_MPEG_ERROR_AUDIO_UNKNOWN_ERROR 0x807F0001
#define SCE_MPEG_ERROR_AUDIO_FATAL 0x807F00FC
#define SCE_MPEG_ERROR_AUDIO_ERROR 0x807F00FD
#define SCE_MPEG_ERROR_AUDIO_INVALID_VALUE 0x807F00FF
#endif /* LIB_MPEG_H */

26
include/video/lib_psmf.h Normal file
View File

@ -0,0 +1,26 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/video/lib_psmf.h
*
* lib_psmf is a library which parses the header portion of PSMF files \n
* and retrieves information on streams.
*/
#ifndef LIB_PSMF_H
#define LIB_PSMF_H
/* lib_psmf specific error codes. */
#define SCE_MPEG_ERROR_PSMF_NOT_INITIALIZED 0x80615001
#define SCE_MPEG_ERROR_PSMF_UNMATCHED_VERSION 0x80615002
#define SCE_MPEG_ERROR_PSMF_NOT_FOUND 0x80615025
#define SCE_MPEG_ERROR_PSMF_INVALID_ID 0x80615100
#define SCE_MPEG_ERROR_PSMF_INVALID_VALUE 0x806151FE
#define SCE_MPEG_ERROR_PSMF_INVALID_TIMESTAMP 0x80615500
#define SCE_MPEG_ERROR_PSMF_INVALID_PSMF 0x80615501
#endif /* LIB_PSMF_H */

View File

@ -0,0 +1,33 @@
/* Copyright (C) 2011 - 2016 The uOFW team
See the file COPYING for copying permission.
*/
/**
* uofw/include/video/lib_psmfplayer.h
*
* lib_psmfplayer is a library that can be used to easily implement PSMF stream playback.
*
*/
#ifndef LIB_PSMFPLAYER_H
#define LIB_PSMFPLAYER_H
/* lib_psmfplayer specific error codes. */
#define SCE_MPEG_ERROR_PSMFPLAYER_NOT_INITIALIZED 0x80616001
#define SCE_MPEG_ERROR_PSMFPLAYER_UNMATCHED_VERSION 0x80616002
#define SCE_MPEG_ERROR_PSMFPLAYER_NOT_SUPPORTED 0x80616003
#define SCE_MPEG_ERROR_PSMFPLAYER_BUSY 0x80616004
#define SCE_MPEG_ERROR_PSMFPLAYER_OUT_OF_MEMORY 0x80616005
#define SCE_MPEG_ERROR_PSMFPLAYER_INVALID_ID 0x80616006
#define SCE_MPEG_ERROR_PSMFPLAYER_INVALID_COMMAND 0x80616007
#define SCE_MPEG_ERROR_PSMFPLAYER_INVALID_VALUE 0x80616008
#define SCE_MPEG_ERROR_PSMFPLAYER_TOO_BIG_OFFSET 0x80616009
#define SCE_MPEG_ERROR_PSMFPLAYER_FAILED_READ_HEADER 0x8061600a
#define SCE_MPEG_ERROR_PSMFPLAYER_FATAL 0x8061600b
#define SCE_MPEG_ERROR_PSMFPLAYER_NODATA 0x8061600c
#define SCE_MPEG_ERROR_PSMFPLAYER_INVALID_PSMF 0x8061600d
#define SCE_MPEG_ERROR_PSMFPLAYER_ABORTED 0x8061600e
#endif /* LIB_PSMFPLAYER_H */

View File

@ -4,7 +4,7 @@
include ../../lib/common.mak
INCLUDE = -I../../include
WARNINGS = -Wall -Wextra -Werror
WARNINGS = -Wall -Wextra -Werror -Wno-pragmas
# Only keep builtins for memcpy, memset for their inline function
BUILTINS_DISABLE = -fno-builtin-bcmp \
@ -27,6 +27,7 @@ BUILTINS_DISABLE = -fno-builtin-bcmp \
-fno-builtin-strcmp \
-fno-builtin-strcpy \
-fno-builtin-strlen \
-fno-builtin-strnlen \
-fno-builtin-strncmp \
-fno-builtin-strncpy \
-fno-builtin-strpbrk \
@ -49,9 +50,8 @@ EXPORT_OBJ=$(patsubst %.exp,%.o,$(PRX_EXPORTS))
EXPORT_C=$(PRX_EXPORTS:.exp=.c)
ifeq ($(DEBUG),1)
CFLAGS += -DDEBUG -I$(PSPSDK)/include
LDFLAGS += -L$(PSPSDK)/lib
LIBS := -ldebug -lpspdebug $(LIBS) -lSysclibForKernel -lsceDisplay -lsceGe_user -lIoFileMgrForKernel -lsceSyscon_driver
CFLAGS += -DDEBUG
LIBS := -ldebug $(LIBS) -lSysclibForKernel -lsceDisplay -lsceGe_user -lIoFileMgrForKernel -lsceSyscon_driver
endif
ifeq ($(INSTALLER),1)
CFLAGS += -DINSTALLER

View File

@ -7,4 +7,5 @@ AS = psp-gcc
FIXUP = psp-fixup-imports
AR = psp-ar
RANLIB = psp-ranlib
PSPSDK = $(shell psp-config --pspsdk-path)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/libpspsemaphore.a Normal file

Binary file not shown.

BIN
lib/libsceAmctrl_driver.a Normal file

Binary file not shown.

BIN
lib/libsceChkreg_driver.a Normal file

Binary file not shown.

BIN
lib/libsceDdrdb.a Normal file

Binary file not shown.

BIN
lib/libsceDdrdb_driver.a Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/libsceDve_driver.a Normal file

Binary file not shown.

BIN
lib/libsceMlnpsnl_driver.a Normal file

Binary file not shown.

BIN
lib/libsceOpenPSID.a Normal file

Binary file not shown.

BIN
lib/libscePspNpDrm_user.a Normal file

Binary file not shown.

BIN
lib/libsceReg.a Normal file

Binary file not shown.

BIN
lib/libsceReg_driver.a Normal file

Binary file not shown.

BIN
lib/libsceRtc.a Normal file

Binary file not shown.

BIN
lib/libsceSamantha_driver.a Normal file

Binary file not shown.

BIN
lib/libsceUsbBus_driver.a Normal file

Binary file not shown.

BIN
lib/libsemaphore.a Normal file

Binary file not shown.

22
src/amctrl/exports.exp Normal file
View File

@ -0,0 +1,22 @@
# Export file automatically generated with prxtool
PSP_BEGIN_EXPORTS
PSP_EXPORT_START(syslib, 0x0000, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_VAR_HASH(module_sdk_version)
PSP_EXPORT_END
PSP_EXPORT_START(sceAmctrl_driver, 0x0011, 0x0001)
PSP_EXPORT_FUNC_NID(sceDrmBBCipherUpdate, 0x0785C974)
PSP_EXPORT_FUNC_NID(sceDrmBBCipherInit, 0x1CCB66D2)
PSP_EXPORT_FUNC_NID(sceDrmBBMacInit, 0x525B8218)
PSP_EXPORT_FUNC_NID(sceDrmBBMacUpdate, 0x58163FBE)
PSP_EXPORT_FUNC_NID(sceAmctrl_driver_9227EA79, 0x9227EA79)
PSP_EXPORT_FUNC_NID(sceDrmBBCipherFinal, 0x9951C50F)
PSP_EXPORT_FUNC_NID(sceAmctrl_driver_E04ADD4C, 0xE04ADD4C)
PSP_EXPORT_FUNC_NID(sceDrmBBMacFinal, 0xEF95A213)
PSP_EXPORT_FUNC_NID(sceDrmBBMacFinal2, 0xF5186D8E)
PSP_EXPORT_END
PSP_END_EXPORTS

View File

@ -4,7 +4,7 @@
TARGET = audio
OBJS = audio.o
DEBUG = 1
DEBUG = 0
LIBS = -lsceCodec_driver -lInterruptManagerForKernel -lSysclibForKernel -lThreadManForKernel -lsceSysEventForKernel -lSysMemForKernel -lDmacManForKernel -lsceDdr_driver -lsceSysreg_driver -lsceClockgen_driver -lUtilsForKernel

View File

@ -18,11 +18,6 @@
#include <audio.h>
asm(".set noat"); // needed for AUDIO_SET_BUSY()
/* Sets the audio controller busy state. */
#define AUDIO_SET_BUSY(busy) asm("lui $at, 0xBE00; sw %0, 0($at)" : : "r" (busy))
SCE_MODULE_INFO("sceAudio_Driver", SCE_MODULE_KERNEL | SCE_MODULE_ATTR_CANT_STOP | SCE_MODULE_ATTR_EXCLUSIVE_LOAD
| SCE_MODULE_ATTR_EXCLUSIVE_START, 1, 13);
SCE_MODULE_BOOTSTART("sceAudioInit");
@ -92,7 +87,7 @@ typedef struct
void audioHwInit();
int audioOutputDmaCb(int unused, int arg1);
int audioOutput(SceAudioChannel *channel, short leftVol, short rightVol, void *buf);
int audioOutput(SceAudioChannel *channel, int leftVol, int rightVol, void *buf);
int audioIntrHandler();
s32 audioEventHandler(s32 ev_id, char* ev_name __attribute__((unused)), void* param, s32* result);
int audioSRCOutput(int vol, void *buf);
@ -100,7 +95,7 @@ int audioSRCOutputDmaCb(int arg0, int arg1);
int audioInputSetup();
int audioInputInit(int arg0, int gain, int arg2, int arg3, int arg4, int arg5);
int audioInput(int sampleCount, int freq, void *buf);
int audioInputThread();
s32 audioInputThread();
int audioInputDmaCb(int arg0, int arg1);
SceAudio g_audio;
@ -119,7 +114,7 @@ void updateAudioBuf(int arg)
if (g_audio.flags == 0)
{
// 01D0
AUDIO_SET_BUSY(1);
HW(0xBE000000) = 1;
sceCodec_driver_376399B6(1);
}
// 0038
@ -129,7 +124,7 @@ void updateAudioBuf(int arg)
// 0054
while ((HW(0xBE00000C) & v) != 0)
;
sceKernelDmaOpQuit(g_audio.dmaPtr[0]);
sceKernelDmaOpQuit(g_audio.dmaPtr[arg]);
HW(0xBE000008) = v ^ 7;
HW(0xBE00002C) = v;
HW(0xBE000020) = v;
@ -145,13 +140,12 @@ void updateAudioBuf(int arg)
if (sceKernelDmaOpAssign(g_audio.dmaPtr[arg], 0xFF, 0xFF, (arg * 64 + 320) | 0x0100C801, 0) == 0)
{
// 0110
if (sceKernelDmaOpSetCallback(g_audio.dmaPtr[0], (arg == 0) ? audioOutputDmaCb : audioSRCOutputDmaCb, 0) == 0)
if (sceKernelDmaOpSetCallback(g_audio.dmaPtr[arg], (arg == 0) ? audioOutputDmaCb : audioSRCOutputDmaCb, 0) == 0)
{
char shift;
if (g_audio.hwBuf[arg * 16 + 1] != 0)
char shift = 2;
if (g_audio.hwBuf[arg * 16 + 2] != 0) {
shift = 0;
else
shift = 2;
}
if (sceKernelDmaOpSetupLink(g_audio.dmaPtr[arg], (arg * 64 + 320) | 0x0100C801, &g_audio.hwBuf[(arg * 4 + shift) * 4]) == 0) {
sceKernelSetEventFlag(g_audio.evFlagId, 0x20000000 << (arg & 0x1F));
sceKernelDmaOpEnQueue(g_audio.dmaPtr[arg]);
@ -161,9 +155,9 @@ void updateAudioBuf(int arg)
// 0180
// 0184
HW(0xBE000008) = 7;
HW(0xBE000004) = (int)g_audio.flags;
HW(0xBE000004) = (int)(char)g_audio.flags;
HW(0xBE000010) = g_audio.flags & 3;
HW(0xBE000024) = (int)g_audio.flags;
HW(0xBE000024) = (int)(char)g_audio.flags;
pspSync();
}
@ -192,7 +186,7 @@ int dmaUpdate(int arg)
if (g_audio.flags == 0)
{
// 0284
AUDIO_SET_BUSY(0);
HW(0xBE000000) = 0;
sceCodec_driver_376399B6(0);
}
return 0;
@ -200,12 +194,12 @@ int dmaUpdate(int arg)
// 02B8
/* The audio mixer thread. */
int audioMixerThread()
s32 audioMixerThread()
{
dbg_printf("Running %s\n", __FUNCTION__);
u32 sp0[128];
s32 sp0[128];
SceAudio *userAudio = UCACHED(&g_audio);
memset(sp0, 0, 512);
memset(sp0, 0, sizeof(sp0));
SceAudio *uncachedAudio = KUNCACHED(&g_audio);
u32 *unk = g_audio.dmaPtr[0];
// 0328
@ -218,8 +212,8 @@ int audioMixerThread()
sceKernelExitThread(0);
return 0;
}
char playedSamples = 0;
// 035C
s32 *buf2 = NULL;
int j;
for (j = 0; j < 8; j++)
{
@ -227,14 +221,15 @@ int audioMixerThread()
short *buf = chan->buf;
if (buf != NULL)
{
playedSamples = pspMin(chan->curSampleCnt, 64);
char playedSamples = pspMin(chan->curSampleCnt, 64);
// 038C
int i;
for (i = 0; i < playedSamples * 2; i += 2)
{
sp0[i + 0] += buf[0] * chan->leftVol / 128;
buf += chan->bytesPerSample / 2;
sp0[i + 1] += buf[-1] * chan->rightVol / 128;
sp0[i + 0] += (s32)((s32)buf[0] * (u32)chan->leftVol ) >> 7;
buf = (short *)((u32)buf + chan->bytesPerSample);
sp0[i + 1] += (s32)((s32)buf[-1] * (u32)chan->rightVol) >> 7;
buf2 = &sp0[i + 2];
}
chan->curSampleCnt -= playedSamples;
if (chan->curSampleCnt == 0)
@ -249,7 +244,7 @@ int audioMixerThread()
// 03DC
}
if (playedSamples == 0)
if (buf2 == NULL)
{
// 04BC
int oldIntr = sceKernelCpuSuspendIntr();
@ -259,26 +254,28 @@ int audioMixerThread()
else
{
char shift = g_audio.volumeOffset;
char unk1 = unk[8] < userAudio->buf0[64];
int *dstBuf = (int*)(uncachedAudio->buf0 + unk1 * 256);
char unk1 = unk[8] < (u32)&userAudio->buf240[16];
u32 *dstBuf = (u32*)(uncachedAudio->buf0 + unk1 * 256);
// 0408
u32 *u32buf = sp0;
s32 *u32buf = sp0;
int i;
for (i = 0; i < 128; i += 2)
{
dstBuf[i] = ((pspMax(pspMin(u32buf[0] >> (shift & 0x1F), 0x7FFF), 0x8000) << 0) & 0x0000FFFF)
| ((pspMax(pspMin(u32buf[1] >> (shift & 0x1F), 0x7FFF), 0x8000) << 16) & 0xFFFF0000);
dstBuf[i] =
((pspMax(pspMin(u32buf[0] >> (shift & 0x1F), 0x7FFF), -0x8000) << 0) & 0x0000FFFF)
| ((pspMax(pspMin(u32buf[1] >> (shift & 0x1F), 0x7FFF), -0x8000) << 16) & 0xFFFF0000);
u32buf[0] = 0;
u32buf[1] = 0;
u32buf += 2;
}
*(int*)(uncachedAudio + 1048 + unk1 * 32) = 0;
*(int*)(uncachedAudio + 1048 + (!unk1) * 32) = userAudio->hwBuf[unk1 * 2];
uncachedAudio->hwBuf[ unk1 * 8 + 6] = 0;
uncachedAudio->hwBuf[(!unk1) * 8 + 6] = (u32)&userAudio->hwBuf[unk1 * 8];
sceDdrFlush(4);
if ((g_audio.flags & 1) == 0)
{
*(int*)(uncachedAudio + 1080) = 0;
uncachedAudio->hwBuf[14] = 0;
// 0498
*(int*)(uncachedAudio + 1048) = 0;
uncachedAudio->hwBuf[6] = 0;
int oldIntr = sceKernelCpuSuspendIntr();
updateAudioBuf(0);
sceKernelCpuResumeIntr(oldIntr);
@ -299,6 +296,7 @@ int audioMixerThread()
int audioOutputDmaCb(int __attribute__((unused)) unused, int arg1)
{
dbg_printf("Running %s\n", __FUNCTION__);
//return 0; // TODO
sceKernelSetEventFlag(g_audio.evFlagId, 0x20000000);
if (arg1 != 0) {
// 056C
@ -311,14 +309,14 @@ int sceAudioOutput(u32 chanId, int vol, void *buf)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (vol > 0xFFFF)
return SCE_ERROR_AUDIO_INVALID_VOLUME;
return SCE_AUDIO_ERROR_INVALID_VOLUME;
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
int oldK1 = pspShiftK1();
if (!pspK1StaBufOk(buf, g_audio.chans[chanId].sampleCount * 4)) {
// 0654
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_PRIV_REQUIRED;
return SCE_AUDIO_ERROR_PRIV_REQUIRED;
}
int oldIntr = sceKernelCpuSuspendIntr();
int ret = audioOutput(&g_audio.chans[chanId], vol, vol, buf);
@ -330,21 +328,21 @@ int sceAudioOutput(u32 chanId, int vol, void *buf)
int sceAudioOutputBlocking(u32 chanId, int vol, void *buf)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (vol >= 0xFFFF)
return SCE_ERROR_AUDIO_INVALID_VOLUME;
if (vol > 0xFFFF)
return SCE_AUDIO_ERROR_INVALID_VOLUME;
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
SceAudioChannel *chan = &g_audio.chans[chanId];
int oldK1 = pspShiftK1();
if (!pspK1StaBufOk(buf, chan->sampleCount * 4))
{
// 07D8
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_PRIV_REQUIRED;
return SCE_AUDIO_ERROR_PRIV_REQUIRED;
}
int oldIntr = sceKernelCpuSuspendIntr();
int ret = audioOutput(chan, vol, vol, buf);
if ((u32)ret == SCE_ERROR_AUDIO_OUTPUT_BUSY)
if ((u32)ret == SCE_AUDIO_ERROR_OUTPUT_BUSY)
{
// 0758
if (chan->unk10 == 0)
@ -361,7 +359,7 @@ int sceAudioOutputBlocking(u32 chanId, int vol, void *buf)
}
oldIntr = sceKernelCpuSuspendIntr();
ret = audioOutput(chan, vol, vol, buf);
} while ((u32)ret == SCE_ERROR_AUDIO_OUTPUT_BUSY);
} while ((u32)ret == SCE_AUDIO_ERROR_OUTPUT_BUSY);
chan->unk10 = 0;
}
}
@ -374,16 +372,16 @@ int sceAudioOutputPanned(u32 chanId, int leftVol, int rightVol, void *buf)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (rightVol > 0xFFFF || leftVol > 0xFFFF)
return SCE_ERROR_AUDIO_INVALID_VOLUME;
return SCE_AUDIO_ERROR_INVALID_VOLUME;
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
SceAudioChannel *chan = &g_audio.chans[chanId];
int oldK1 = pspShiftK1();
if (!pspK1StaBufOk(buf, chan->sampleCount * 4))
{
// 08D4
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_PRIV_REQUIRED;
return SCE_AUDIO_ERROR_PRIV_REQUIRED;
}
int oldIntr = sceKernelCpuSuspendIntr();
int ret = audioOutput(chan, leftVol, rightVol, buf);
@ -395,21 +393,21 @@ int sceAudioOutputPanned(u32 chanId, int leftVol, int rightVol, void *buf)
int sceAudioOutputPannedBlocking(u32 chanId, int leftVol, int rightVol, void *buf)
{
dbg_printf("Running %s\n", __FUNCTION__);
if ((leftVol | rightVol) > 0xFFFF)
return SCE_ERROR_AUDIO_INVALID_VOLUME;
if ((u32)(leftVol | rightVol) > 0xFFFF)
return SCE_AUDIO_ERROR_INVALID_VOLUME;
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
SceAudioChannel *chan = &g_audio.chans[chanId];
int oldK1 = pspShiftK1();
if (!pspK1StaBufOk(buf, chan->sampleCount * 4))
{
// 0A9C
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_PRIV_REQUIRED;
return SCE_AUDIO_ERROR_PRIV_REQUIRED;
}
int oldIntr = sceKernelCpuSuspendIntr();
int ret = audioOutput(chan, leftVol, rightVol, buf);
if ((u32)ret == SCE_ERROR_AUDIO_OUTPUT_BUSY)
if ((u32)ret == SCE_AUDIO_ERROR_OUTPUT_BUSY)// && 0) // TODO
{
// 0A08
if (chan->unk10 == 0)
@ -426,13 +424,13 @@ int sceAudioOutputPannedBlocking(u32 chanId, int leftVol, int rightVol, void *bu
}
oldIntr = sceKernelCpuSuspendIntr();
ret = audioOutput(chan, leftVol, rightVol, buf);
} while ((u32)ret == SCE_ERROR_AUDIO_OUTPUT_BUSY);
} while ((u32)ret == SCE_AUDIO_ERROR_OUTPUT_BUSY);
chan->unk10 = 0;
}
}
// 09A8
sceKernelCpuResumeIntr(oldIntr);
if (chanId < (u32)(g_audio.delayShift + 5))
if (chanId - 5 < (u32)g_audio.delayShift)
sceKernelDelayThread(3000);
// 09D0
pspSetK1(oldK1);
@ -459,7 +457,7 @@ int sceAudioChReserve(int channel, int sampleCount, int format)
{
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_NOT_FOUND;
return SCE_AUDIO_ERROR_NOT_FOUND;
}
}
else if (channel >= 8 || g_audio.chans[channel].sampleCount != 0)
@ -467,15 +465,15 @@ int sceAudioChReserve(int channel, int sampleCount, int format)
// 0B08
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
}
// 0B38
if (sampleCount <= 0 || (sampleCount & 0x3F) != 0 || (u32)sampleCount > 0xFFC00000)
if (sampleCount <= 0 || (sampleCount & 0x3F) != 0 || (u32)sampleCount > 0xFFC0)
{
// 0B58
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INVALID_SIZE;
return SCE_AUDIO_ERROR_INVALID_SIZE;
}
// 0B6C
char bytesPerSample = 4;
@ -487,7 +485,7 @@ int sceAudioChReserve(int channel, int sampleCount, int format)
// 0BAC
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INVALID_FORMAT;
return SCE_AUDIO_ERROR_INVALID_FORMAT;
}
}
// 0B8C
@ -510,7 +508,7 @@ int sceAudioOneshotOutput(int chanId, int sampleCount, int fmt, int leftVol, int
// 0E30
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INVALID_VOLUME;
return SCE_AUDIO_ERROR_INVALID_VOLUME;
}
if (chanId < 0)
{
@ -524,7 +522,7 @@ int sceAudioOneshotOutput(int chanId, int sampleCount, int fmt, int leftVol, int
{
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_NOT_FOUND;
return SCE_AUDIO_ERROR_NOT_FOUND;
}
}
else if (chanId >= 8 || g_audio.chans[chanId].sampleCount != 0)
@ -532,7 +530,7 @@ int sceAudioOneshotOutput(int chanId, int sampleCount, int fmt, int leftVol, int
// 0CA4
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
}
SceAudioChannel *chan = &g_audio.chans[chanId];
// 0CE4
@ -541,14 +539,14 @@ int sceAudioOneshotOutput(int chanId, int sampleCount, int fmt, int leftVol, int
// 0DC8
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INVALID_SIZE;
return SCE_AUDIO_ERROR_INVALID_SIZE;
}
if (!pspK1StaBufOk(buf, chan->sampleCount * 4))
{
// 0DB0
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_PRIV_REQUIRED;
return SCE_AUDIO_ERROR_PRIV_REQUIRED;
}
char bytesPerSample = 4;
if (fmt != 0)
@ -559,7 +557,7 @@ int sceAudioOneshotOutput(int chanId, int sampleCount, int fmt, int leftVol, int
// 0D98
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INVALID_FORMAT;
return SCE_AUDIO_ERROR_INVALID_FORMAT;
}
}
// 0D28
@ -582,11 +580,13 @@ int sceAudioOneshotOutput(int chanId, int sampleCount, int fmt, int leftVol, int
return chanId;
}
// TODO - verified up to that point
int sceAudioChRelease(u32 channel)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (channel >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
int oldK1 = pspShiftK1();
int oldIntr = sceKernelCpuSuspendIntr();
SceAudioChannel *chan = &g_audio.chans[channel];
@ -595,14 +595,14 @@ int sceAudioChRelease(u32 channel)
// 0EE4
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_NOT_RESERVED;
return SCE_AUDIO_ERROR_NOT_RESERVED;
}
if (chan->unk10 != 0)
{
// 0ECC
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_OUTPUT_BUSY;
return SCE_AUDIO_ERROR_OUTPUT_BUSY;
}
chan->sampleCount = 0;
sceKernelCpuResumeIntr(oldIntr);
@ -614,19 +614,26 @@ int sceAudioGetChannelRestLength(u32 chanId)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
SceAudioChannel *chan = &g_audio.chans[chanId];
// 0F30
return ((chan->buf != NULL) ? chan->curSampleCnt : 0) + ((chan->unk10 != 0) ? 0 : chan->sampleCount);
u32 ret = 0;
if (chan->buf != NULL) {
ret = chan->curSampleCnt;
}
if (chan->unk10 != 0) {
ret += chan->sampleCount;
}
return ret;
}
int sceAudioSetChannelDataLen(u32 chanId, int sampleCount)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
if (sampleCount <= 0 || (sampleCount & 0x3F) != 0 || sampleCount > 0xFFC0)
return SCE_ERROR_AUDIO_INVALID_SIZE;
return SCE_AUDIO_ERROR_INVALID_CH;
if (sampleCount <= 0 || (sampleCount & 0x3F) != 0 || (u32)sampleCount > 0xFFC0)
return SCE_AUDIO_ERROR_INVALID_SIZE;
// 0FB8
int oldK1 = pspShiftK1();
int oldIntr = sceKernelCpuSuspendIntr();
@ -636,16 +643,16 @@ int sceAudioSetChannelDataLen(u32 chanId, int sampleCount)
// 1018
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_OUTPUT_BUSY;
return SCE_AUDIO_ERROR_OUTPUT_BUSY;
}
if (chan->sampleCount == 0)
{
// 1000
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_NOT_INITIALIZED;
return SCE_AUDIO_ERROR_NOT_INITIALIZED;
}
chan->sampleCount = sampleCount & 0xFFFF;
chan->sampleCount = (u16)sampleCount;
pspSetK1(oldK1);
return 0;
}
@ -654,17 +661,17 @@ int sceAudioChangeChannelVolume(u32 chanId, int leftVol, int rightVol)
{
dbg_printf("Running %s\n", __FUNCTION__);
if ((rightVol > 0xFFFF) || (leftVol > 0xFFFF))
return SCE_ERROR_AUDIO_INVALID_VOLUME;
return SCE_AUDIO_ERROR_INVALID_VOLUME;
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
int oldK1 = pspShiftK1();
int oldIntr = sceKernelCpuSuspendIntr();
SceAudioChannel *chan = &g_audio.chans[chanId];
if (leftVol >= 0)
chan->leftVol = leftVol & 0xFFFF;
chan->leftVol = (s16)leftVol;
// 10AC
if (rightVol >= 0)
chan->rightVol = rightVol & 0xFFFF;
chan->rightVol = (s16)rightVol;
// 10B4
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
@ -675,7 +682,7 @@ int sceAudioChangeChannelConfig(u32 chanId, int format)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
int oldK1 = pspShiftK1();
int oldIntr = sceKernelCpuSuspendIntr();
SceAudioChannel *chan = &g_audio.chans[chanId];
@ -684,15 +691,21 @@ int sceAudioChangeChannelConfig(u32 chanId, int format)
// 116C
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_OUTPUT_BUSY;
return SCE_AUDIO_ERROR_OUTPUT_BUSY;
}
// 1164
if ((sceKernelGetCompiledSdkVersion() > 0x01FFFFFF && (chan->curSampleCnt == 0 || chan->buf == NULL)) || chan->curSampleCnt == 0) // 1214
{
if (sceKernelGetCompiledSdkVersion() > 0x01FFFFFF) {
if (chan->curSampleCnt != 0 && chan->buf != NULL) {
// 116C
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_AUDIO_ERROR_OUTPUT_BUSY;
}
} else if (chan->curSampleCnt != 0) {
// 116C
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_OUTPUT_BUSY;
return SCE_AUDIO_ERROR_OUTPUT_BUSY;
}
// 11A4
if (chan->sampleCount == 0)
@ -700,7 +713,7 @@ int sceAudioChangeChannelConfig(u32 chanId, int format)
// 11FC
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_NOT_RESERVED;
return SCE_AUDIO_ERROR_NOT_RESERVED;
}
char bytesPerSample = 4;
if (format != 0)
@ -711,7 +724,7 @@ int sceAudioChangeChannelConfig(u32 chanId, int format)
// 11E4
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INVALID_FORMAT;
return SCE_AUDIO_ERROR_INVALID_FORMAT;
}
}
// 11CC
@ -724,16 +737,16 @@ int sceAudioChangeChannelConfig(u32 chanId, int format)
int sceAudioOutput2ChangeLength(int sampleCount)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (sampleCount < 17 || sampleCount > 4111)
return SCE_ERROR_AUDIO_INVALID_SIZE;
if (sampleCount < 0x11 || sampleCount > 0x1010)
return SCE_AUDIO_ERROR_INVALID_SIZE;
int oldIntr = sceKernelCpuSuspendIntr();
if (g_audio.srcChFreq == 0)
{
// 1280
sceKernelCpuResumeIntr(oldIntr);
return SCE_ERROR_AUDIO_NOT_RESERVED;
return SCE_AUDIO_ERROR_NOT_RESERVED;
}
g_audio.srcChSampleCnt = sampleCount;
g_audio.srcChSampleCnt = (u16)sampleCount;
sceKernelCpuResumeIntr(oldIntr);
return 0;
}
@ -743,7 +756,7 @@ int sceAudioOutput2GetRestSample(void)
dbg_printf("Running %s\n", __FUNCTION__);
int *ptr = KUNCACHED(&g_audio.hwBuf[16]);
if (g_audio.srcChFreq == 0)
return SCE_ERROR_AUDIO_NOT_RESERVED;
return SCE_AUDIO_ERROR_NOT_RESERVED;
// 12C8
return (ptr[ 2] != 0 ? g_audio.srcChSampleCnt : 0)
+ (ptr[10] != 0 ? g_audio.srcChSampleCnt : 0);
@ -753,7 +766,7 @@ int sceAudioGetChannelRestLen(u32 chanId)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (chanId >= 8)
return SCE_ERROR_AUDIO_INVALID_CH;
return SCE_AUDIO_ERROR_INVALID_CH;
SceAudioChannel *chan = &g_audio.chans[chanId];
if (chan->unk10 == 0)
return chan->curSampleCnt;
@ -789,13 +802,13 @@ int sceAudioOutput2Release(void)
*
* Returns the number of samples on success, otherwise less than zero.
*/
int audioOutput(SceAudioChannel *channel, short leftVol, short rightVol, void *buf)
int audioOutput(SceAudioChannel *channel, int leftVol, int rightVol, void *buf)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (channel->sampleCount == 0)
return SCE_ERROR_AUDIO_NOT_INITIALIZED;
return SCE_AUDIO_ERROR_NOT_INITIALIZED;
if (channel->buf != NULL)
return SCE_ERROR_AUDIO_OUTPUT_BUSY;
return SCE_AUDIO_ERROR_OUTPUT_BUSY;
channel->curSampleCnt = channel->sampleCount;
if (leftVol >= 0)
channel->leftVol = leftVol;
@ -804,13 +817,13 @@ int audioOutput(SceAudioChannel *channel, short leftVol, short rightVol, void *b
channel->rightVol = rightVol;
// 13C4
channel->buf = buf;
if (((g_audio.flags & 1) == 1) || ((u32)buf <= 0))
return channel->sampleCount;
// 1400
int i;
for (i = 0; i < 128; i++)
((int*)KUNCACHED(g_audio.buf0))[i] = 0;
updateAudioBuf(0);
if (((g_audio.flags & 1) == 0) && (buf != NULL)) {
// 1400
int i;
for (i = 0; i < 128; i++)
((int*)KUNCACHED(g_audio.buf0))[i] = 0;
updateAudioBuf(0);
}
return channel->sampleCount;
}
@ -828,12 +841,12 @@ int sceAudioSetFrequency(int freq)
hwFreq = 256;
else {
// 1504
return SCE_ERROR_AUDIO_INVALID_FREQUENCY;
return SCE_AUDIO_ERROR_INVALID_FREQUENCY;
}
// 1470
int oldIntr = sceKernelCpuSuspendIntr();
AUDIO_SET_BUSY(1);
g_audio.freq = freq;
HW(0xBE000000) = 1;
g_audio.freq = (u16)freq;
HW(0xBE000004) = 0;
// 149C
while (HW(0xBE00000C) != 0)
@ -841,9 +854,9 @@ int sceAudioSetFrequency(int freq)
HW(0xBE000040) = 1;
HW(0xBE000038) = hwFreq;
HW(0xBE00003C) = hwFreq;
HW(0xBE000004) = g_audio.flags;
if (g_audio.flags == 0)
AUDIO_SET_BUSY(0);
HW(0xBE000004) = (int)(char)g_audio.flags;
if ((char)g_audio.flags == 0)
HW(0xBE000000) = 0;
// 14D0
sceKernelCpuResumeIntr(oldIntr);
sceClockgenAudioClkSetFreq(freq);
@ -853,8 +866,10 @@ int sceAudioSetFrequency(int freq)
int sceAudioInit()
{
dbg_init(1, FB_NONE, FAT_AFTER_SYSCON);
//dbg_init(1, FB_NONE, FAT_AFTER_SYSCON);
dbg_init(1, FB_AFTER_DISPLAY, FAT_NONE);
dbg_printf("Running %s\n", __FUNCTION__);
memset(&g_audio, 0, sizeof(g_audio));
// 1558
int i;
@ -867,11 +882,11 @@ int sceAudioInit()
// 15FC
do
{
int shift = ((i + (i >> 31)) >> 1) << 8;
int shift = (i / 2) * 0x100;
u32 *buf = &g_audio.hwBuf[i * 4];
buf[0] = (int)UCACHED(g_audio.buf0 + shift);
buf[1] = (int)UCACHED(0xBE000060);
buf[2] = (int)UCACHED(g_audio.hwBuf[i * 4 + 4]);
buf[2] = (int)UCACHED(&g_audio.hwBuf[i * 4 + 4]);
buf[3] = 0x0448903C;
buf[4] = (int)UCACHED(g_audio.buf240 + shift);
buf[5] = (int)UCACHED(0xBE000060);
@ -886,7 +901,7 @@ int sceAudioInit()
buf[32] = (int)UCACHED(0xBE000080);
buf[33] = (int)UCACHED(g_audio.buf512 + shift);
buf[34] = (int)UCACHED(g_audio.hwBuf[i * 4 + 36]);
buf[34] = (int)UCACHED(&g_audio.hwBuf[i * 4 + 36]);
buf[35] = 0x0848903C;
buf[36] = (int)UCACHED(0xBE000080);
buf[37] = (int)UCACHED(g_audio.buf752 + shift);
@ -907,8 +922,8 @@ int sceAudioInit()
sceKernelRegisterSysEventHandler(&g_audioEvent);
sceKernelRegisterIntrHandler(10, 2, audioIntrHandler, 0, 0);
sceKernelEnableIntr(10);
sceKernelDcacheWritebackInvalidateRange(&g_audio, 1400);
*(int*)(g_audio.dmaPtr[0] + 8) = (int)UCACHED(&g_audio);
sceKernelDcacheWritebackInvalidateRange(&g_audio, sizeof(g_audio));
g_audio.dmaPtr[0][8] = (int)UCACHED(&g_audio);
g_audio.unkCodecArg = 1;
g_audio.unkCodecArgSet = 0;
g_audio.inputInited = 0;
@ -929,7 +944,7 @@ int sceAudioLoopbackTest(int arg0)
{
int oldIntr = sceKernelCpuSuspendIntr();
g_audio.flags = 7;
AUDIO_SET_BUSY(1);
HW(0xBE000000) = 1;
sceCodec_driver_376399B6(1);
HW(0xBE000004) = 7;
HW(0xBE00002C) = 7;
@ -987,7 +1002,8 @@ int sceAudioSetVolumeOffset(int arg)
*/
int audioIntrHandler()
{
dbg_printf("Running %s\n", __FUNCTION__);
//dbg_printf("Running %s\n", __FUNCTION__);
//return -1;
int oldIntr = sceKernelCpuSuspendIntr();
char attr = g_audio.flags;
char hwAttr = HW(0xBE00001C) & attr;
@ -1000,7 +1016,7 @@ int audioIntrHandler()
{
// 1A8C
sceKernelDmaOpQuit(g_audio.dmaPtr[0]);
*(int*)(g_audio.dmaPtr[0] + 8) = (u32)UCACHED(g_audio.buf240 + 16);
g_audio.dmaPtr[0][8] = (u32)UCACHED(g_audio.buf240 + 16);
}
// 1A1C
if ((hwAttr & 2) != 0)
@ -1028,7 +1044,7 @@ int audioIntrHandler()
if (attr == 0)
{
// 19EC
AUDIO_SET_BUSY(0);
HW(0xBE000000) = 0;
sceCodec_driver_376399B6(0);
}
// 19C4
@ -1049,7 +1065,7 @@ void audioHwInit()
sceSysregAudioIoEnable(0);
sceSysregAudioClkoutClkSelect(0);
sceSysregAudioClkoutIoEnable();
AUDIO_SET_BUSY(1);
HW(0xBE000000) = 1;
HW(0xBE000004) = 0;
// 1B00
while ((HW(0xBE00000C) & 7) != 0)
@ -1063,7 +1079,7 @@ void audioHwInit()
HW(0xBE000008) = 7;
HW(0xBE000014) = 0x1208;
// 1B50
while ((HW(0xBE000050) & 0x30) != 0)
while ((HW(0xBE000050) & 0x10000) != 0)
;
HW(0xBE000050) = 0x8000;
g_audio.srcVol = 0x0400;
@ -1092,7 +1108,7 @@ void audioHwInit()
;
}
// 1BD0
AUDIO_SET_BUSY(0);
HW(0xBE000000) = 0;
}
// 1C00
@ -1104,6 +1120,7 @@ void audioHwInit()
s32 audioEventHandler(s32 ev_id, char* ev_name __attribute__((unused)), void* param __attribute__((unused)), s32* result __attribute__((unused)))
{
dbg_printf("Running %s\n", __FUNCTION__);
//return 0; // TODO
switch (ev_id)
{
case 0x1000F:
@ -1131,17 +1148,17 @@ s32 audioEventHandler(s32 ev_id, char* ev_name __attribute__((unused)), void* pa
int *ptr = KUNCACHED(&g_audio.hwBuf[16]);
ptr[2] = 0;
ptr[10] = 0;
AUDIO_SET_BUSY(1);
HW(0xBE000000) = 1;
HW(0xBE000004) = 1;
sceKernelSetEventFlag(g_audio.evFlagId, (g_audio.inputCurSampleCnt != 0) ? 0x60000000 : 0xE0000000);
sceKernelSetEventFlag(g_audio.evFlagId, (g_audio.inputCurSampleCnt != 0) ? 0xE0000000 : 0x60000000);
g_audio.flags = 0;
HW(0xBE000004) = 0;
HW(0xBE000008) = 0;
pspSync();
sceSysregAudioIoDisable(0);
sceSysregAudioClkoutIoDisable();
break;
}
break;
}
return 0;
}
@ -1159,12 +1176,14 @@ int audioSRCOutputDmaCb(int arg0, int arg1)
dmaUpdate(1);
return -1;
}
int shift = (*(int*)(arg0 + 40) + 0x7FFFFBB0 - (u32)&g_audio < 32) ? 8 : 0; // ?
u32 addr = *(u32*)(arg0 + 40);
int shift = (addr - (u32)&g_audio.hwBuf[20] < 32) ? 8 : 0;
int *ptr1 = KUNCACHED(&g_audio.hwBuf[18 + shift]);
*ptr1 = 0;
int *ptr2 = UUNCACHED(&g_audio.hwBuf[26]);
if (*(int*)(arg0 + 40) == 0)
if (*(int*)(arg0 + 40) == 0) {
int *ptr2 = KUNCACHED(&g_audio.hwBuf[26]);
*ptr2 = 0;
}
// 1DB8
sceKernelSetEventFlag(g_audio.evFlagId, 0x40000000);
return 0;
@ -1226,7 +1245,7 @@ int sceAudioSRCChReserve(int sampleCount, int freq, int numChans)
break;
default:
// 1EB4
return SCE_ERROR_AUDIO_INVALID_FREQUENCY;
return SCE_AUDIO_ERROR_INVALID_FREQUENCY;
}
}
// 1EDC
@ -1240,7 +1259,7 @@ int sceAudioSRCChReserve(int sampleCount, int freq, int numChans)
g_audio.numChans = numChans << 1;
g_audio.srcChSampleCnt = sampleCount;
g_audio.srcChFreq = freq;
AUDIO_SET_BUSY(1);
HW(0xBE000000) = 1;
if ((g_audio.flags & 2) != 0)
{
HW(0xBE000004) = (int)(g_audio.flags ^ 2);
@ -1270,7 +1289,7 @@ int sceAudioSRCChReserve(int sampleCount, int freq, int numChans)
HW(0xBE000004) = g_audio.flags;
}
else
AUDIO_SET_BUSY(0);
HW(0xBE000000) = 0;
// 1F8C
sceKernelCpuResumeIntr(oldIntr);
return 0;
@ -1283,7 +1302,7 @@ int sceAudioSRCChRelease(void)
int *ptr = KUNCACHED(&g_audio.hwBuf[16]);
if (g_audio.srcChFreq == 0) {
sceKernelCpuResumeIntr(oldIntr);
return SCE_ERROR_AUDIO_NOT_RESERVED;
return SCE_AUDIO_ERROR_NOT_RESERVED;
}
// 20C0
if ((ptr[2] | ptr[10]) != 0) {
@ -1301,13 +1320,13 @@ int sceAudioSRCOutputBlocking(int vol, void *buf)
{
dbg_printf("Running %s\n", __FUNCTION__);
if (vol > 0xFFFFF)
return SCE_ERROR_AUDIO_INVALID_VOLUME;
return SCE_AUDIO_ERROR_INVALID_VOLUME;
int oldK1 = pspShiftK1();
if (!pspK1StaBufOk(buf, g_audio.srcChSampleCnt * g_audio.numChans))
{
// 224C
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_PRIV_REQUIRED;
return SCE_AUDIO_ERROR_PRIV_REQUIRED;
}
int oldIntr = sceKernelCpuSuspendIntr();
int ret = audioSRCOutput(vol, buf);
@ -1351,11 +1370,11 @@ int audioSRCOutput(int vol, void *buf)
dbg_printf("Running %s\n", __FUNCTION__);
int *ptr = KUNCACHED(&g_audio.hwBuf[16]);
if (g_audio.srcChFreq == 0)
return SCE_ERROR_AUDIO_NOT_RESERVED;
return SCE_AUDIO_ERROR_NOT_RESERVED;
if (ptr[2] != 0)
{
if (ptr[10] != 0)
return SCE_ERROR_AUDIO_OUTPUT_BUSY;
return SCE_AUDIO_ERROR_OUTPUT_BUSY;
ptr += 8;
}
// 22C4
@ -1422,7 +1441,7 @@ int audioSRCOutput(int vol, void *buf)
*
* Returns 0.
*/
int audioInputThread()
s32 audioInputThread()
{
dbg_printf("Running %s\n", __FUNCTION__);
// 2478
@ -1437,7 +1456,7 @@ int audioInputThread()
}
u32 *ptr1 = g_audio.dmaPtr[2];
int curSampleCount = g_audio.inputCurSampleCnt;
int unk = (ptr1[9] < g_audio.buf752[0x80000000 + 16]); // yes, it's correct, it reverses the kernel mode
int unk = (ptr1[9] < *(u8*)(0x80000000 + (u32)&g_audio.buf752[16])); // yes, it's correct, it reverses the kernel mode
short *uncached1 = KUNCACHED(&g_audio.buf512[unk << 8]);
char unk2 = g_audio.inputHwFreq;
u16 *ptr3 = g_audio.inputBuf;
@ -1526,13 +1545,13 @@ int sceAudioWaitInputEnd()
dbg_printf("Running %s\n", __FUNCTION__);
int ret = 0;
if (g_audio.inputOrigSampleCnt == 0)
return SCE_ERROR_AUDIO_NOT_INITIALIZED;
return SCE_AUDIO_ERROR_NOT_INITIALIZED;
int oldIntr = sceKernelCpuSuspendIntr();
if (g_audio.inputIsWaiting != 0)
{
// 27AC
sceKernelCpuResumeIntr(oldIntr);
return SCE_ERROR_AUDIO_INPUT_BUSY;
return SCE_AUDIO_ERROR_INPUT_BUSY;
}
g_audio.inputIsWaiting = 1;
sceKernelCpuResumeIntr(oldIntr);
@ -1552,7 +1571,7 @@ int sceAudioInputInitEx(SceAudioInputParams *param)
int oldK1 = pspShiftK1();
if (!pspK1StaBufOk(param, 24)) {
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_PRIV_REQUIRED;
return SCE_AUDIO_ERROR_PRIV_REQUIRED;
}
int ret = audioInputInit(param->unk0, param->gain, param->unk2, param->unk3, param->unk4, param->unk5);
pspSetK1(oldK1);
@ -1586,7 +1605,7 @@ int sceAudioGetInputLength()
dbg_printf("Running %s\n", __FUNCTION__);
int origSampleCount = g_audio.inputOrigSampleCnt;
if (origSampleCount == 0)
return SCE_ERROR_AUDIO_NOT_INITIALIZED;
return SCE_AUDIO_ERROR_NOT_INITIALIZED;
return origSampleCount - g_audio.inputCurSampleCnt;
}
@ -1640,7 +1659,7 @@ int audioInputSetup()
if (flags == 0)
{
// 2A68
AUDIO_SET_BUSY(1);
HW(0xBE000000) = 1;
sceCodec_driver_376399B6(1);
}
// 2A10
@ -1675,7 +1694,7 @@ int audioInput(int sampleCount, int freq, void *buf)
return 0x80000001;
if (sampleCount <= 0 || (sampleCount & 0x3F) != 0) {
// 2AD8
return SCE_ERROR_AUDIO_INVALID_SIZE;
return SCE_AUDIO_ERROR_INVALID_SIZE;
}
int hwFreq;
// 2B08
@ -1694,7 +1713,7 @@ int audioInput(int sampleCount, int freq, void *buf)
break;
default:
// 2B24
return SCE_ERROR_AUDIO_INVALID_FREQUENCY;
return SCE_AUDIO_ERROR_INVALID_FREQUENCY;
}
// 2B30
if (buf == NULL)
@ -1709,7 +1728,7 @@ int audioInput(int sampleCount, int freq, void *buf)
{
// 2C5C
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_PRIV_REQUIRED;
return SCE_AUDIO_ERROR_PRIV_REQUIRED;
}
int oldIntr = sceKernelCpuSuspendIntr();
if (g_audio.inputCurSampleCnt != 0)
@ -1717,7 +1736,7 @@ int audioInput(int sampleCount, int freq, void *buf)
// 2C44
sceKernelCpuResumeIntr(oldIntr);
pspSetK1(oldK1);
return SCE_ERROR_AUDIO_INPUT_BUSY;
return SCE_AUDIO_ERROR_INPUT_BUSY;
}
g_audio.inputBuf = buf;
g_audio.inputHwFreq = hwFreq;

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