Skip to content

Commit 0f2f391

Browse files
Add missing headers (#348)
* improved headers from adrenaline * add missing defs
1 parent bf9eed1 commit 0f2f391

13 files changed

Lines changed: 626 additions & 88 deletions

File tree

src/ctrl/pspctrl.h

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ extern "C" {
4040
* @see ::SceCtrlData
4141
* @see ::SceCtrlLatch
4242
*/
43-
enum PspCtrlButtons
44-
{
43+
enum PspCtrlButtons {
4544
/** Select button. */
4645
PSP_CTRL_SELECT = 0x000001,
46+
/** L3 button. */
47+
PSP_CTRL_L3 = 0x000002,
48+
/** R3 button. */
49+
PSP_CTRL_R3 = 0x000004,
4750
/** Start button. */
4851
PSP_CTRL_START = 0x000008,
4952
/** Up D-Pad button. */
@@ -58,6 +61,14 @@ enum PspCtrlButtons
5861
PSP_CTRL_LTRIGGER = 0x000100,
5962
/** Right trigger. */
6063
PSP_CTRL_RTRIGGER = 0x000200,
64+
/** L2 button. */
65+
PSP_CTRL_L2 = 0x000100,
66+
/** R2 button. */
67+
PSP_CTRL_R2 = 0x000200,
68+
/** L1 button. */
69+
PSP_CTRL_L1 = 0x000400,
70+
/** R1 button. */
71+
PSP_CTRL_R1 = 0x000800,
6172
/** Triangle button. */
6273
PSP_CTRL_TRIANGLE = 0x001000,
6374
/** Circle button. */
@@ -66,28 +77,25 @@ enum PspCtrlButtons
6677
PSP_CTRL_CROSS = 0x004000,
6778
/** Square button. */
6879
PSP_CTRL_SQUARE = 0x008000,
69-
/**
70-
* Kernel mode: Home button state.
71-
* User mode: Exit dialog visible.
72-
*/
80+
/** Home button. In user mode this bit is set if the exit dialog is visible. */
7381
PSP_CTRL_HOME = 0x010000,
7482
/** Hold button. */
7583
PSP_CTRL_HOLD = 0x020000,
76-
/** Music note button - kernel mode only.*/
84+
/** Music Note button. */
7785
PSP_CTRL_NOTE = 0x800000,
78-
/** Screen button - kernel mode only.*/
86+
/** Screen button. */
7987
PSP_CTRL_SCREEN = 0x400000,
80-
/** Volume up button - kernel mode only.*/
88+
/** Volume up button. */
8189
PSP_CTRL_VOLUP = 0x100000,
82-
/** Volume down button - kernel mode only.*/
90+
/** Volume down button. */
8391
PSP_CTRL_VOLDOWN = 0x200000,
84-
/** Wlan switch up - kernel mode only.*/
92+
/** Wlan switch up. */
8593
PSP_CTRL_WLAN_UP = 0x040000,
86-
/** Remote hold position - kernel mode only.*/
94+
/** Remote hold position. */
8795
PSP_CTRL_REMOTE = 0x080000,
88-
/** Disc present - kernel mode only.*/
96+
/** Disc present. */
8997
PSP_CTRL_DISC = 0x1000000,
90-
/** Memory stick present - kernel mode only.*/
98+
/** Memory stick present. */
9199
PSP_CTRL_MS = 0x2000000,
92100
};
93101

src/kernel/InitForKernel.S

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,35 @@
66
IMPORT_START "InitForKernel",0x00090000
77
#endif
88
#ifdef F_InitForKernel_0001
9-
IMPORT_FUNC "InitForKernel",0x1D3256BA,sceKernelRegisterChunk
9+
IMPORT_FUNC "InitForKernel",0x1D3256BA,sceKernelRegisterChunk
1010
#endif
1111
#ifdef F_InitForKernel_0002
12-
IMPORT_FUNC "InitForKernel",0x27932388,sceKernelBootFrom
12+
IMPORT_FUNC "InitForKernel",0x27932388,sceKernelBootFrom
1313
#endif
1414
#ifdef F_InitForKernel_0003
15-
IMPORT_FUNC "InitForKernel",0x2C6E9FE9,sceKernelGetChunk
15+
IMPORT_FUNC "InitForKernel",0x2C6E9FE9,sceKernelGetChunk
1616
#endif
1717
#ifdef F_InitForKernel_0004
18-
IMPORT_FUNC "InitForKernel",0x33D30F49,InitForKernel_33D30F49
18+
IMPORT_FUNC "InitForKernel",0x33D30F49,InitForKernel_33D30F49
1919
#endif
2020
#ifdef F_InitForKernel_0005
21-
IMPORT_FUNC "InitForKernel",0x7233B5BC,InitForKernel_7233B5BC
21+
IMPORT_FUNC_WITH_ALIAS "InitForKernel",0x7233B5BC,sceKernelApplicationType,sceKernelInitKeyConfig
2222
#endif
2323
#ifdef F_InitForKernel_0006
24-
IMPORT_FUNC "InitForKernel",0x7A2333AD,sceKernelInitApitype
24+
IMPORT_FUNC "InitForKernel",0x7A2333AD,sceKernelInitApitype
2525
#endif
2626
#ifdef F_InitForKernel_0007
27-
IMPORT_FUNC "InitForKernel",0x9F9AE99C,InitForKernel_9F9AE99C
27+
IMPORT_FUNC "InitForKernel",0x9F9AE99C,InitForKernel_9F9AE99C
2828
#endif
2929
#ifdef F_InitForKernel_0008
30-
IMPORT_FUNC "InitForKernel",0xA6E71B93,sceKernelInitFileName
30+
IMPORT_FUNC "InitForKernel",0xA6E71B93,sceKernelInitFileName
3131
#endif
3232
#ifdef F_InitForKernel_0009
33-
IMPORT_FUNC "InitForKernel",0xC4F1BA33,InitForKernel_C4F1BA33
33+
IMPORT_FUNC "InitForKernel",0xC4F1BA33,InitForKernel_C4F1BA33
3434
#endif
3535
#ifdef F_InitForKernel_0010
36-
IMPORT_FUNC "InitForKernel",0xCE88E870,sceKernelReleaseChunk
36+
IMPORT_FUNC "InitForKernel",0xCE88E870,sceKernelReleaseChunk
3737
#endif
3838
#ifdef F_InitForKernel_0011
39-
IMPORT_FUNC "InitForKernel",0xFD0F25AD,InitForKernel_FD0F25AD
40-
#endif
39+
IMPORT_FUNC "InitForKernel",0xFD0F25AD,InitForKernel_FD0F25AD
40+
#endif

src/kernel/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ libpspkernelinclude_HEADERS = \
7272
pspexception.h \
7373
pspsysclib.h \
7474
pspimpose_driver.h \
75-
pspinit.h \
75+
pspinit.h \
76+
pspamctrl.h \
7677
pspaudiorouting.h
7778

7879
lib_LIBRARIES = libpspkernel.a

src/kernel/pspamctrl.h

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* PSP Software Development Kit - http://www.pspdev.org
3+
* -----------------------------------------------------------------------
4+
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5+
*
6+
* pspamctrl.h - Prototypes for the sceAmctrl_driver library.
7+
*
8+
* Copyright (c) 2024 GrayJack <gr41.j4ck@gmail.com>
9+
*
10+
* TODO: Contribute this header to PSPSDK
11+
*/
12+
13+
#ifndef _PSP_AM_CTRL_H
14+
#define _PSP_AM_CTRL_H
15+
16+
#include <psptypes.h>
17+
18+
#ifdef __cplusplus
19+
extern "C" {
20+
#endif // __cplusplus
21+
22+
23+
typedef struct SceMacKey {
24+
int type;
25+
u8 key[16];
26+
u8 pad[16];
27+
int pad_size;
28+
} SceMacKey;
29+
30+
typedef struct SceCipherKey {
31+
u32 type;
32+
u32 seed;
33+
u8 key[16];
34+
} SceCipherKey;
35+
36+
enum SceMacKeyType {
37+
MAC_KEY_TYPE_UNK0 = 0,
38+
MAC_KEY_TYPE_UNK1 = 1,
39+
/** Use fuse ID */
40+
MAC_KEY_TYPE_FUSE_ID = 2,
41+
/** Use fixed key. MAC will need to encrypt again. */
42+
MAC_KEY_TYPE_FIXED = 3,
43+
MAC_KEY_TYPE_UNK6 = 6,
44+
};
45+
46+
enum SceCipherKeyType {
47+
/** Use fixed key */
48+
CIPHER_KEY_TYPE_FIXED = 1,
49+
/** Use fuse ID */
50+
CIPHER_KEY_TYPE_FUSE_ID = 2,
51+
};
52+
53+
enum SceCipherKeyMode {
54+
CIPHER_KEY_MODE_ENCRYPT = 1,
55+
CIPHER_KEY_MODE_DECRYPT = 2,
56+
};
57+
58+
#ifdef __KERNEL__
59+
60+
int sceDrmBBMacInit(SceMacKey *mac_key, int type);
61+
int sceDrmBBMacUpdate(SceMacKey *mac_key, u8 *buf, int size);
62+
int sceAmctrl_driver_9227EA79(SceMacKey *mac_key, u8 *buf, int size);
63+
int sceDrmBBMacFinal(SceMacKey *mac_key, u8 *buf, u8 *version_key);
64+
int sceDrmBBMacFinal2(SceMacKey *mac_key, u8 *buf, u8 *version_key);
65+
66+
int sceDrmBBCipherInit(SceCipherKey *cipher_key, int type, int mode, u8 *header_key, u8 *version_key, int seed);
67+
int sceDrmBBCipherUpdate(SceCipherKey *cipher_key, u8 *buf, int size);
68+
int sceAmctrl_driver_E04ADD4C(SceCipherKey *cipher_key, u8 *buf, int size);
69+
int sceDrmBBCipherFinal(SceCipherKey *cipher_key);
70+
71+
#endif // __KERNEL__
72+
73+
#ifdef __cplusplus
74+
}
75+
#endif // __cplusplus
76+
77+
#endif // AM_CTRL_H

0 commit comments

Comments
 (0)