mirror of
https://github.com/zeldaret/ss
synced 2026-09-07 03:00:21 -04:00
Misc Egg (#37)
* EGG: Archive, DvdFile, DvdRipper * start eggStream * FrmHeap and AssertHeap OK * progress on EggController * port in WPAD stuff * update WPAD/WUD/KPAD/SC symbols * eggController OK * bytematch more CoreController virtual funcs * eggDecomp/eggStreamDecomp Ok * eggDvdRipper OK * EGG gfx splits * Finished Splitting EGG * create egg Files * eggDecomp.h -> eggStreamDecomp.h * Revert some format changes
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#ifndef __STDC_STDINT_H__
|
||||
#define __STDC_STDINT_H__
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed long int32_t;
|
||||
typedef signed long long int64_t;
|
||||
|
||||
#endif // __STDC_STDINT_H__
|
||||
+3
-1
@@ -22,7 +22,7 @@
|
||||
#define DONT_INLINE __attribute__((never_inline))
|
||||
|
||||
// TODO - Fix MSL (stddef.h)
|
||||
#define offsetof(ST, M) ((size_t) & (((ST*)0)->M))
|
||||
#define offsetof(ST, M) ((size_t) & (((ST *)0)->M))
|
||||
|
||||
// Codewarrior tricks for matching decomp
|
||||
// (Functions are given prototypes for -requireprotos)
|
||||
@@ -73,6 +73,8 @@ typedef void UNKTYPE;
|
||||
enum { FALSE, TRUE };
|
||||
typedef int BOOL;
|
||||
|
||||
typedef unsigned char byte_t;
|
||||
|
||||
#ifdef __CWCC__
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,978 @@
|
||||
#ifndef CONTEXT_BTE_H
|
||||
#define CONTEXT_BTE_H
|
||||
|
||||
#include <MSL_C/stdint.h>
|
||||
|
||||
/* Contains the context of the BTE library that the WPAD library needs to
|
||||
* compile.
|
||||
*
|
||||
* This is not the full context; the other half of the context is in
|
||||
* "context_rvl.h".
|
||||
*
|
||||
* Most of this code is copyright (C) 2003-2012 Broadcom Corporation under the
|
||||
* Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0>. The original
|
||||
* source can be found at
|
||||
* <https://android.googlesource.com/platform/external/bluetooth/bluedroid>;
|
||||
* specifically, I used the earliest commit available (late 2012, commit hash
|
||||
* 5738f83aeb59361a0a2eda2460113f6dc9194271).
|
||||
*/
|
||||
|
||||
/* License redistribution conditions
|
||||
*
|
||||
* a. You may obtain a copy of the License at
|
||||
* <http://www.apache.org/licenses/LICENSE-2.0>.
|
||||
* b. Some of the code is modified. Comments will be marked with my name
|
||||
* (muff1n) to show what I modified and where.
|
||||
* c. See the following comment block, which is copied verbatim from bluedroid
|
||||
* source.
|
||||
* d. No NOTICE file is present in the commit that I used.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2003-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
// from bluedroid source
|
||||
|
||||
typedef uint8_t UINT8;
|
||||
typedef uint16_t UINT16;
|
||||
typedef uint32_t UINT32;
|
||||
|
||||
typedef int8_t INT8;
|
||||
|
||||
typedef unsigned char BOOLEAN;
|
||||
|
||||
#define BD_ADDR_LEN 6 /* Device address length */
|
||||
typedef UINT8 BD_ADDR[BD_ADDR_LEN]; /* Device address */
|
||||
typedef UINT8 *BD_ADDR_PTR; /* Pointer to Device Address */
|
||||
|
||||
#define LINK_KEY_LEN 16
|
||||
typedef UINT8 LINK_KEY[LINK_KEY_LEN]; /* Link Key */
|
||||
|
||||
#define DEV_CLASS_LEN 3
|
||||
typedef UINT8 DEV_CLASS[DEV_CLASS_LEN]; /* Device class */
|
||||
typedef UINT8 *DEV_CLASS_PTR; /* Pointer to Device class */
|
||||
|
||||
/* muff1n: TODO: bta_dm_pin_cback looks mostly the same except that BD_NAME_LEN
|
||||
* is 33 (or it was 32 and BD_NAME_LEN was not decreased by 1 in BCM_STRNCPY_S
|
||||
* calls)?
|
||||
* confirm this
|
||||
*
|
||||
* UPDATE: there is a case where it is 248
|
||||
*/
|
||||
#define BD_NAME_LEN 248
|
||||
typedef UINT8 BD_NAME[BD_NAME_LEN]; /* Device name */
|
||||
typedef UINT8 *BD_NAME_PTR; /* Pointer to Device name */
|
||||
|
||||
#define BD_FEATURES_LEN 8
|
||||
typedef UINT8 BD_FEATURES[BD_FEATURES_LEN]; /* LMP features supported by device */
|
||||
|
||||
#define BT_DEVICE_TYPE_BREDR 0x01
|
||||
#define BT_DEVICE_TYPE_BLE 0x02
|
||||
#define BT_DEVICE_TYPE_DUMO 0x03
|
||||
typedef UINT8 tBT_DEVICE_TYPE;
|
||||
|
||||
/* Maximum UUID size - 16 bytes, and structure to hold any type of UUID. */
|
||||
#define MAX_UUID_SIZE 16
|
||||
typedef struct {
|
||||
#define LEN_UUID_16 2
|
||||
#define LEN_UUID_32 4
|
||||
#define LEN_UUID_128 16
|
||||
|
||||
UINT16 len;
|
||||
|
||||
union {
|
||||
UINT16 uuid16;
|
||||
UINT32 uuid32;
|
||||
UINT8 uuid128[MAX_UUID_SIZE];
|
||||
} uu;
|
||||
|
||||
} tBT_UUID;
|
||||
|
||||
/* Status Return Value */
|
||||
#define BTA_SUCCESS 0 /* Successful operation. */
|
||||
#define BTA_FAILURE 1 /* Generic failure. */
|
||||
#define BTA_PENDING 2 /* API cannot be completed right now */
|
||||
#define BTA_BUSY 3
|
||||
#define BTA_NO_RESOURCES 4
|
||||
#define BTA_WRONG_MODE 5
|
||||
|
||||
typedef UINT8 tBTA_STATUS;
|
||||
|
||||
/*
|
||||
* Service ID
|
||||
*
|
||||
* NOTES: When you add a new Service ID for BTA AND require to change the value of BTA_MAX_SERVICE_ID,
|
||||
* make sure that the correct security ID of the new service from Security service definitions (btm_api.h)
|
||||
* should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in bta_dm_act.c.
|
||||
*/
|
||||
|
||||
#define BTA_RES_SERVICE_ID 0 /* Reserved */
|
||||
#define BTA_SPP_SERVICE_ID 1 /* Serial port profile. */
|
||||
#define BTA_DUN_SERVICE_ID 2 /* Dial-up networking profile. */
|
||||
#define BTA_A2DP_SOURCE_SERVICE_ID 3 /* A2DP Source profile. */
|
||||
#define BTA_LAP_SERVICE_ID 4 /* LAN access profile. */
|
||||
#define BTA_HSP_SERVICE_ID 5 /* Headset profile. */
|
||||
#define BTA_HFP_SERVICE_ID 6 /* Hands-free profile. */
|
||||
#define BTA_OPP_SERVICE_ID 7 /* Object push */
|
||||
#define BTA_FTP_SERVICE_ID 8 /* File transfer */
|
||||
#define BTA_CTP_SERVICE_ID 9 /* Cordless Terminal */
|
||||
#define BTA_ICP_SERVICE_ID 10 /* Intercom Terminal */
|
||||
#define BTA_SYNC_SERVICE_ID 11 /* Synchronization */
|
||||
#define BTA_BPP_SERVICE_ID 12 /* Basic printing profile */
|
||||
#define BTA_BIP_SERVICE_ID 13 /* Basic Imaging profile */
|
||||
#define BTA_PANU_SERVICE_ID 14 /* PAN User */
|
||||
#define BTA_NAP_SERVICE_ID 15 /* PAN Network access point */
|
||||
#define BTA_GN_SERVICE_ID 16 /* PAN Group Ad-hoc networks */
|
||||
#define BTA_SAP_SERVICE_ID 17 /* SIM Access profile */
|
||||
#define BTA_A2DP_SERVICE_ID 18 /* A2DP Sink */
|
||||
#define BTA_AVRCP_SERVICE_ID 19 /* A/V remote control */
|
||||
#define BTA_HID_SERVICE_ID 20 /* HID */
|
||||
#define BTA_VDP_SERVICE_ID 21 /* Video distribution */
|
||||
#define BTA_PBAP_SERVICE_ID 22 /* PhoneBook Access Server*/
|
||||
#define BTA_HSP_HS_SERVICE_ID 23 /* HFP HS role */
|
||||
#define BTA_HFP_HS_SERVICE_ID 24 /* HSP HS role */
|
||||
#define BTA_MAP_SERVICE_ID 25 /* Message Access Profile */
|
||||
#define BTA_MN_SERVICE_ID 26 /* Message Notification Service */
|
||||
#define BTA_HDP_SERVICE_ID 27 /* Health Device Profile */
|
||||
#define BTA_PCE_SERVICE_ID 28 /* PhoneBook Access Client*/
|
||||
|
||||
#define BTA_USER_SERVICE_ID 29 /* User requested UUID */
|
||||
#define BTA_MAX_SERVICE_ID 30
|
||||
|
||||
/* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1)
|
||||
* are used by BTA JV */
|
||||
#define BTA_FIRST_JV_SERVICE_ID (BTM_SEC_SERVICE_FIRST_EMPTY + 1)
|
||||
#define BTA_LAST_JV_SERVICE_ID (BTM_SEC_MAX_SERVICES - 1)
|
||||
|
||||
typedef UINT8 tBTA_SERVICE_ID;
|
||||
|
||||
/* Service ID Mask */
|
||||
#define BTA_RES_SERVICE_MASK 0x00000001 /* Reserved */
|
||||
#define BTA_SPP_SERVICE_MASK 0x00000002 /* Serial port profile. */
|
||||
#define BTA_DUN_SERVICE_MASK 0x00000004 /* Dial-up networking profile. */
|
||||
#define BTA_FAX_SERVICE_MASK 0x00000008 /* Fax profile. */
|
||||
#define BTA_LAP_SERVICE_MASK 0x00000010 /* LAN access profile. */
|
||||
#define BTA_HSP_SERVICE_MASK 0x00000020 /* HSP AG role. */
|
||||
#define BTA_HFP_SERVICE_MASK 0x00000040 /* HFP AG role */
|
||||
#define BTA_OPP_SERVICE_MASK 0x00000080 /* Object push */
|
||||
#define BTA_FTP_SERVICE_MASK 0x00000100 /* File transfer */
|
||||
#define BTA_CTP_SERVICE_MASK 0x00000200 /* Cordless Terminal */
|
||||
#define BTA_ICP_SERVICE_MASK 0x00000400 /* Intercom Terminal */
|
||||
#define BTA_SYNC_SERVICE_MASK 0x00000800 /* Synchronization */
|
||||
#define BTA_BPP_SERVICE_MASK 0x00001000 /* Print server */
|
||||
#define BTA_BIP_SERVICE_MASK 0x00002000 /* Basic Imaging */
|
||||
#define BTA_PANU_SERVICE_MASK 0x00004000 /* PAN User */
|
||||
#define BTA_NAP_SERVICE_MASK 0x00008000 /* PAN Network access point */
|
||||
#define BTA_GN_SERVICE_MASK 0x00010000 /* PAN Group Ad-hoc networks */
|
||||
#define BTA_SAP_SERVICE_MASK 0x00020000 /* PAN Group Ad-hoc networks */
|
||||
#define BTA_A2DP_SERVICE_MASK 0x00040000 /* Advanced audio distribution */
|
||||
#define BTA_AVRCP_SERVICE_MASK 0x00080000 /* A/V remote control */
|
||||
#define BTA_HID_SERVICE_MASK 0x00100000 /* HID */
|
||||
#define BTA_VDP_SERVICE_MASK 0x00200000 /* Video distribution */
|
||||
#define BTA_PBAP_SERVICE_MASK 0x00400000 /* Phone Book Server */
|
||||
#define BTA_HSP_HS_SERVICE_MASK 0x00800000 /* HFP HS role */
|
||||
#define BTA_HFP_HS_SERVICE_MASK 0x01000000 /* HSP HS role */
|
||||
#define BTA_MAS_SERVICE_MASK 0x02000000 /* Message Access Profile */
|
||||
#define BTA_MN_SERVICE_MASK 0x04000000 /* Message Notification Profile */
|
||||
#define BTA_HL_SERVICE_MASK 0x08000000 /* Health Device Profile */
|
||||
#define BTA_PCE_SERVICE_MASK 0x10000000 /* Phone Book Client */
|
||||
|
||||
// btla-specific ++
|
||||
#define BTA_USER_SERVICE_MASK 0x20000000 /* Message Notification Profile */
|
||||
// btla-specific --
|
||||
|
||||
#define BTA_ALL_SERVICE_MASK 0x1FFFFFFF /* All services supported by BTA. */
|
||||
|
||||
typedef UINT32 tBTA_SERVICE_MASK;
|
||||
|
||||
/* SW sub-systems */
|
||||
#define BTA_ID_SYS 0 /* system manager */
|
||||
/* BLUETOOTH PART - from 0 to BTA_ID_BLUETOOTH_MAX */
|
||||
#define BTA_ID_DM 1 /* device manager */
|
||||
#define BTA_ID_DM_SEARCH 2 /* device manager search */
|
||||
#define BTA_ID_DM_SEC 3 /* device manager security */
|
||||
#define BTA_ID_DG 4 /* data gateway */
|
||||
#define BTA_ID_AG 5 /* audio gateway */
|
||||
#define BTA_ID_OPC 6 /* object push client */
|
||||
#define BTA_ID_OPS 7 /* object push server */
|
||||
#define BTA_ID_FTS 8 /* file transfer server */
|
||||
#define BTA_ID_CT 9 /* cordless telephony terminal */
|
||||
#define BTA_ID_FTC 10 /* file transfer client */
|
||||
#define BTA_ID_SS 11 /* synchronization server */
|
||||
#define BTA_ID_PR 12 /* Printer client */
|
||||
#define BTA_ID_BIC 13 /* Basic Imaging Client */
|
||||
#define BTA_ID_PAN 14 /* Personal Area Networking */
|
||||
#define BTA_ID_BIS 15 /* Basic Imaging Server */
|
||||
#define BTA_ID_ACC 16 /* Advanced Camera Client */
|
||||
#define BTA_ID_SC 17 /* SIM Card Access server */
|
||||
#define BTA_ID_AV 18 /* Advanced audio/video */
|
||||
#define BTA_ID_AVK 19 /* Audio/video sink */
|
||||
#define BTA_ID_HD 20 /* HID Device */
|
||||
#define BTA_ID_CG 21 /* Cordless Gateway */
|
||||
#define BTA_ID_BP 22 /* Basic Printing Client */
|
||||
#define BTA_ID_HH 23 /* Human Interface Device Host */
|
||||
#define BTA_ID_PBS 24 /* Phone Book Access Server */
|
||||
#define BTA_ID_PBC 25 /* Phone Book Access Client */
|
||||
#define BTA_ID_JV 26 /* Java */
|
||||
#define BTA_ID_HS 27 /* Headset */
|
||||
#define BTA_ID_MSE 28 /* Message Server Equipment */
|
||||
#define BTA_ID_MCE 29 /* Message Client Equipment */
|
||||
#define BTA_ID_HL 30 /* Health Device Profile*/
|
||||
#define BTA_ID_GATTC 31 /* GATT Client */
|
||||
#define BTA_ID_GATTS 32 /* GATT Client */
|
||||
#define BTA_ID_BLUETOOTH_MAX 33 /* last BT profile */
|
||||
|
||||
/* FM */
|
||||
#define BTA_ID_FM 34 /* FM */
|
||||
#define BTA_ID_FMTX 35 /* FM TX */
|
||||
|
||||
/* SENSOR */
|
||||
#define BTA_ID_SSR 36 /* Sensor */
|
||||
|
||||
/* GPS */
|
||||
#define BTA_ID_GPS 37 /* GPS */
|
||||
|
||||
/* GENERIC */
|
||||
#define BTA_ID_PRM 38
|
||||
#define BTA_ID_SYSTEM 39 /* platform-specific */
|
||||
#define BTA_ID_SWRAP 40 /* Insight script wrapper */
|
||||
#define BTA_ID_MIP 41 /* Multicase Individual Polling */
|
||||
#define BTA_ID_RT 42 /* Audio Routing module: This module is always on. */
|
||||
|
||||
/* JV */
|
||||
#define BTA_ID_JV1 43 /* JV1 */
|
||||
#define BTA_ID_JV2 44 /* JV2 */
|
||||
|
||||
#define BTA_ID_MAX (43 + BTA_DM_NUM_JV_ID)
|
||||
|
||||
typedef UINT8 tBTA_SYS_ID;
|
||||
|
||||
enum {
|
||||
BTM_SUCCESS = 0, /* 0 Command succeeded */
|
||||
BTM_CMD_STARTED, /* 1 Command started OK. */
|
||||
BTM_BUSY, /* 2 Device busy with another command */
|
||||
BTM_NO_RESOURCES, /* 3 No resources to issue command */
|
||||
BTM_MODE_UNSUPPORTED, /* 4 Request for 1 or more unsupported modes */
|
||||
BTM_ILLEGAL_VALUE, /* 5 Illegal parameter value */
|
||||
BTM_WRONG_MODE, /* 6 Device in wrong mode for request */
|
||||
BTM_UNKNOWN_ADDR, /* 7 Unknown remote BD address */
|
||||
BTM_DEVICE_TIMEOUT, /* 8 Device timeout */
|
||||
BTM_BAD_VALUE_RET, /* 9 A bad value was received from HCI */
|
||||
BTM_ERR_PROCESSING, /* 10 Generic error */
|
||||
BTM_NOT_AUTHORIZED, /* 11 Authorization failed */
|
||||
BTM_DEV_RESET, /* 12 Device has been reset */
|
||||
BTM_CMD_STORED, /* 13 request is stored in control block */
|
||||
BTM_ILLEGAL_ACTION, /* 14 state machine gets illegal command */
|
||||
BTM_DELAY_CHECK, /* 15 delay the check on encryption */
|
||||
BTM_SCO_BAD_LENGTH, /* 16 Bad SCO over HCI data length */
|
||||
BTM_SUCCESS_NO_SECURITY, /* 17 security passed, no security set */
|
||||
BTM_FAILED_ON_SECURITY, /* 18 security failed */
|
||||
BTM_REPEATED_ATTEMPTS /* 19 repeated attempts for LE security requests */
|
||||
};
|
||||
typedef UINT8 tBTM_STATUS;
|
||||
|
||||
typedef struct {
|
||||
UINT16 event;
|
||||
UINT16 len;
|
||||
UINT16 offset;
|
||||
UINT16 layer_specific;
|
||||
} BT_HDR;
|
||||
|
||||
#define BT_HDR_SIZE (sizeof(BT_HDR))
|
||||
|
||||
/* Security Service Levels [bit mask] (BTM_SetSecurityLevel)
|
||||
** Encryption should not be used without authentication
|
||||
*/
|
||||
#define BTM_SEC_NONE 0x0000 /* Nothing required */
|
||||
#define BTM_SEC_IN_AUTHORIZE 0x0001 /* Inbound call requires authorization */
|
||||
#define BTM_SEC_IN_AUTHENTICATE 0x0002 /* Inbound call requires authentication */
|
||||
#define BTM_SEC_IN_ENCRYPT 0x0004 /* Inbound call requires encryption */
|
||||
#define BTM_SEC_OUT_AUTHORIZE 0x0008 /* Outbound call requires authorization */
|
||||
#define BTM_SEC_OUT_AUTHENTICATE 0x0010 /* Outbound call requires authentication */
|
||||
#define BTM_SEC_OUT_ENCRYPT 0x0020 /* Outbound call requires encryption */
|
||||
#define BTM_SEC_BOND 0x0040 /* Bonding */
|
||||
#define BTM_SEC_BOND_CONN 0x0080 /* bond_created_connection */
|
||||
#define BTM_SEC_FORCE_MASTER 0x0100 /* Need to switch connection to be master */
|
||||
#define BTM_SEC_ATTEMPT_MASTER 0x0200 /* Try to switch connection to be master */
|
||||
#define BTM_SEC_FORCE_SLAVE 0x0400 /* Need to switch connection to be master */
|
||||
#define BTM_SEC_ATTEMPT_SLAVE 0x0800 /* Try to switch connection to be slave */
|
||||
#define BTM_SEC_IN_MITM 0x1000 /* inbound Do man in the middle protection */
|
||||
#define BTM_SEC_OUT_MITM 0x2000 /* outbound Do man in the middle protection */
|
||||
|
||||
/* Security Setting Mask */
|
||||
#define BTA_SEC_NONE BTM_SEC_NONE /* No security. */
|
||||
#define BTA_SEC_AUTHORIZE (BTM_SEC_IN_AUTHORIZE) /* Authorization required (only needed for out going connection )*/
|
||||
#define BTA_SEC_AUTHENTICATE (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */
|
||||
#define BTA_SEC_ENCRYPT (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT) /* Encryption required. */
|
||||
|
||||
typedef UINT8 tBTA_SEC;
|
||||
|
||||
/* Pairable Modes */
|
||||
#define BTA_DM_PAIRABLE 1
|
||||
#define BTA_DM_NON_PAIRABLE 0
|
||||
|
||||
/* Connectable Paired Only Mode */
|
||||
#define BTA_DM_CONN_ALL 0
|
||||
#define BTA_DM_CONN_PAIRED 1
|
||||
|
||||
/* Inquiry modes
|
||||
* Note: These modes are associated with the inquiry active values (BTM_*ACTIVE) */
|
||||
#define BTM_GENERAL_INQUIRY 0
|
||||
#define BTM_LIMITED_INQUIRY 1
|
||||
#define BTM_BR_INQUIRY_MASK 0x0f
|
||||
/* high byte of inquiry mode for BLE inquiry mode */
|
||||
#define BTM_BLE_INQUIRY_NONE 0x00
|
||||
#define BTM_BLE_GENERAL_INQUIRY 0x10
|
||||
#define BTM_BLE_LIMITED_INQUIRY 0x20
|
||||
#define BTM_BLE_INQUIRY_MASK (BTM_BLE_GENERAL_INQUIRY | BTM_BLE_LIMITED_INQUIRY)
|
||||
|
||||
#define BTA_BLE_INQUIRY_NONE BTM_BLE_INQUIRY_NONE
|
||||
#define BTA_BLE_GENERAL_INQUIRY BTM_BLE_GENERAL_INQUIRY /* Perform LE general inquiry. */
|
||||
#define BTA_BLE_LIMITED_INQUIRY BTM_BLE_LIMITED_INQUIRY /* Perform LE limited inquiry. */
|
||||
typedef UINT8 tBTA_DM_INQ_MODE;
|
||||
|
||||
/* Inquiry Filter Type */
|
||||
#define BTA_DM_INQ_CLR BTM_CLR_INQUIRY_FILTER /* Clear inquiry filter. */
|
||||
#define BTA_DM_INQ_DEV_CLASS BTM_FILTER_COND_DEVICE_CLASS /* Filter on device class. */
|
||||
#define BTA_DM_INQ_BD_ADDR BTM_FILTER_COND_BD_ADDR /* Filter on a specific BD address. */
|
||||
|
||||
typedef UINT8 tBTA_DM_INQ_FILT;
|
||||
|
||||
/* Inquiry filter device class condition */
|
||||
typedef struct {
|
||||
DEV_CLASS dev_class; /* device class of interest */
|
||||
DEV_CLASS dev_class_mask; /* mask to determine the bits of device class of interest */
|
||||
} tBTA_DM_COD_COND;
|
||||
|
||||
/* Inquiry Filter Condition */
|
||||
typedef union {
|
||||
BD_ADDR bd_addr; /* BD address of device to filter. */
|
||||
tBTA_DM_COD_COND dev_class_cond; /* Device class filter condition */
|
||||
} tBTA_DM_INQ_COND;
|
||||
|
||||
/* Inquiry Parameters */
|
||||
typedef struct {
|
||||
tBTA_DM_INQ_MODE mode; /* Inquiry mode, limited or general. */
|
||||
UINT8 duration; /* Inquiry duration in 1.28 sec units. */
|
||||
UINT8 max_resps; /* Maximum inquiry responses. Set to zero for unlimited responses. */
|
||||
BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */
|
||||
tBTA_DM_INQ_FILT filter_type; /* Filter condition type. */
|
||||
tBTA_DM_INQ_COND filter_cond; /* Filter condition data. */
|
||||
} tBTA_DM_INQ;
|
||||
|
||||
/* Security Callback Events */
|
||||
#define BTA_DM_ENABLE_EVT 0 /* Enable Event */
|
||||
#define BTA_DM_DISABLE_EVT 1 /* Disable Event */
|
||||
#define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */
|
||||
#define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */
|
||||
#define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */
|
||||
#define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */
|
||||
#define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */
|
||||
#define BTA_DM_SIG_STRENGTH_EVT 7 /* Signal strength for bluetooth connection */
|
||||
#define BTA_DM_BUSY_LEVEL_EVT 8 /* System busy level */
|
||||
#define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */
|
||||
#define BTA_DM_SP_CFM_REQ_EVT 10 /* Simple Pairing User Confirmation request. */
|
||||
#define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */
|
||||
#define BTA_DM_SP_RMT_OOB_EVT 12 /* Simple Pairing Remote OOB Data request. */
|
||||
#define BTA_DM_SP_KEYPRESS_EVT 13 /* Key press notification event. */
|
||||
#define BTA_DM_ROLE_CHG_EVT 14 /* Role Change event. */
|
||||
#define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */
|
||||
#define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */
|
||||
#define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */
|
||||
#define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */
|
||||
#define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */
|
||||
#define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */
|
||||
#define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */
|
||||
// btla-specific ++
|
||||
#define BTA_DM_BLE_AUTH_CMPL_EVT 22 /* BLE Auth complete */
|
||||
// btla-specific --
|
||||
#define BTA_DM_DEV_UNPAIRED_EVT 23
|
||||
#define BTA_DM_HW_ERROR_EVT 24 /* BT Chip H/W error */
|
||||
typedef UINT8 tBTA_DM_SEC_EVT;
|
||||
|
||||
/* Structure associated with BTA_DM_ENABLE_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address of local device. */
|
||||
tBTA_STATUS status;
|
||||
} tBTA_DM_ENABLE;
|
||||
|
||||
/* Structure associated with BTA_DM_PIN_REQ_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
BD_NAME bd_name; /* Name of peer device. */
|
||||
DEV_CLASS dev_class; /* Class of Device */
|
||||
} tBTA_DM_PIN_REQ;
|
||||
|
||||
/* Link Key Notification Event (Key Type) definitions */
|
||||
#define HCI_LKEY_TYPE_COMBINATION 0x00
|
||||
#define HCI_LKEY_TYPE_LOCAL_UNIT 0x01
|
||||
#define HCI_LKEY_TYPE_REMOTE_UNIT 0x02
|
||||
#define HCI_LKEY_TYPE_DEBUG_COMB 0x03
|
||||
#define HCI_LKEY_TYPE_UNAUTH_COMB 0x04
|
||||
#define HCI_LKEY_TYPE_AUTH_COMB 0x05
|
||||
#define HCI_LKEY_TYPE_CHANGED_COMB 0x06
|
||||
|
||||
/* Structure associated with BTA_DM_AUTH_CMPL_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
BD_NAME bd_name; /* Name of peer device. */
|
||||
BOOLEAN key_present; /* Valid link key value in key element */
|
||||
LINK_KEY key; /* Link key associated with peer device. */
|
||||
UINT8 key_type; /* The type of Link Key */
|
||||
BOOLEAN success; /* TRUE of authentication succeeded, FALSE if failed. */
|
||||
UINT8 fail_reason; /* The HCI reason/error code for when success=FALSE */
|
||||
} tBTA_DM_AUTH_CMPL;
|
||||
|
||||
/* Structure associated with BTA_DM_AUTHORIZE_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
BD_NAME bd_name; /* Name of peer device. */
|
||||
tBTA_SERVICE_ID service; /* Service ID to authorize. */
|
||||
// btla-specific ++
|
||||
DEV_CLASS dev_class;
|
||||
// btla-specific --
|
||||
} tBTA_DM_AUTHORIZE;
|
||||
|
||||
/* Structure associated with BTA_DM_LINK_UP_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
} tBTA_DM_LINK_UP;
|
||||
|
||||
/*
|
||||
** Defentions for HCI Error Codes that are past in the events
|
||||
*/
|
||||
#define HCI_SUCCESS 0x00
|
||||
#define HCI_PENDING 0x00
|
||||
#define HCI_ERR_ILLEGAL_COMMAND 0x01
|
||||
#define HCI_ERR_NO_CONNECTION 0x02
|
||||
#define HCI_ERR_HW_FAILURE 0x03
|
||||
#define HCI_ERR_PAGE_TIMEOUT 0x04
|
||||
#define HCI_ERR_AUTH_FAILURE 0x05
|
||||
#define HCI_ERR_KEY_MISSING 0x06
|
||||
#define HCI_ERR_MEMORY_FULL 0x07
|
||||
#define HCI_ERR_CONNECTION_TOUT 0x08
|
||||
#define HCI_ERR_MAX_NUM_OF_CONNECTIONS 0x09
|
||||
#define HCI_ERR_MAX_NUM_OF_SCOS 0x0A
|
||||
#define HCI_ERR_CONNECTION_EXISTS 0x0B
|
||||
#define HCI_ERR_COMMAND_DISALLOWED 0x0C
|
||||
#define HCI_ERR_HOST_REJECT_RESOURCES 0x0D
|
||||
#define HCI_ERR_HOST_REJECT_SECURITY 0x0E
|
||||
#define HCI_ERR_HOST_REJECT_DEVICE 0x0F
|
||||
#define HCI_ERR_HOST_TIMEOUT 0x10
|
||||
#define HCI_ERR_UNSUPPORTED_VALUE 0x11
|
||||
#define HCI_ERR_ILLEGAL_PARAMETER_FMT 0x12
|
||||
#define HCI_ERR_PEER_USER 0x13
|
||||
#define HCI_ERR_PEER_LOW_RESOURCES 0x14
|
||||
#define HCI_ERR_PEER_POWER_OFF 0x15
|
||||
#define HCI_ERR_CONN_CAUSE_LOCAL_HOST 0x16
|
||||
#define HCI_ERR_REPEATED_ATTEMPTS 0x17
|
||||
#define HCI_ERR_PAIRING_NOT_ALLOWED 0x18
|
||||
#define HCI_ERR_UNKNOWN_LMP_PDU 0x19
|
||||
#define HCI_ERR_UNSUPPORTED_REM_FEATURE 0x1A
|
||||
#define HCI_ERR_SCO_OFFSET_REJECTED 0x1B
|
||||
#define HCI_ERR_SCO_INTERVAL_REJECTED 0x1C
|
||||
#define HCI_ERR_SCO_AIR_MODE 0x1D
|
||||
#define HCI_ERR_INVALID_LMP_PARAM 0x1E
|
||||
#define HCI_ERR_UNSPECIFIED 0x1F
|
||||
#define HCI_ERR_UNSUPPORTED_LMP_FEATURE 0x20
|
||||
#define HCI_ERR_ROLE_CHANGE_NOT_ALLOWED 0x21
|
||||
#define HCI_ERR_LMP_RESPONSE_TIMEOUT 0x22
|
||||
#define HCI_ERR_LMP_ERR_TRANS_COLLISION 0x23
|
||||
#define HCI_ERR_LMP_PDU_NOT_ALLOWED 0x24
|
||||
#define HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE 0x25
|
||||
#define HCI_ERR_UNIT_KEY_USED 0x26
|
||||
#define HCI_ERR_QOS_NOT_SUPPORTED 0x27
|
||||
#define HCI_ERR_INSTANT_PASSED 0x28
|
||||
#define HCI_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29
|
||||
#define HCI_ERR_DIFF_TRANSACTION_COLLISION 0x2A
|
||||
#define HCI_ERR_UNDEFINED_0x2B 0x2B
|
||||
#define HCI_ERR_QOS_UNACCEPTABLE_PARAM 0x2C
|
||||
#define HCI_ERR_QOS_REJECTED 0x2D
|
||||
#define HCI_ERR_CHAN_CLASSIF_NOT_SUPPORTED 0x2E
|
||||
#define HCI_ERR_INSUFFCIENT_SECURITY 0x2F
|
||||
#define HCI_ERR_PARAM_OUT_OF_RANGE 0x30
|
||||
#define HCI_ERR_UNDEFINED_0x31 0x31
|
||||
#define HCI_ERR_ROLE_SWITCH_PENDING 0x32
|
||||
#define HCI_ERR_UNDEFINED_0x33 0x33
|
||||
#define HCI_ERR_RESERVED_SLOT_VIOLATION 0x34
|
||||
#define HCI_ERR_ROLE_SWITCH_FAILED 0x35
|
||||
#define HCI_ERR_INQ_RSP_DATA_TOO_LARGE 0x36
|
||||
#define HCI_ERR_SIMPLE_PAIRING_NOT_SUPPORTED 0x37
|
||||
#define HCI_ERR_HOST_BUSY_PAIRING 0x38
|
||||
#define HCI_ERR_REJ_NO_SUITABLE_CHANNEL 0x39
|
||||
#define HCI_ERR_CONTROLLER_BUSY 0x3A
|
||||
#define HCI_ERR_UNACCEPT_CONN_INTERVAL 0x3B
|
||||
#define HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT 0x3C
|
||||
#define HCI_ERR_CONN_TOUT_DUE_TO_MIC_FAILURE 0x3D
|
||||
#define HCI_ERR_CONN_FAILED_ESTABLISHMENT 0x3E
|
||||
#define HCI_ERR_MAC_CONNECTION_FAILED 0x3F
|
||||
|
||||
#define HCI_ERR_MAX_ERR 0x40
|
||||
|
||||
#define HCI_HINT_TO_RECREATE_AMP_PHYS_LINK 0xFF
|
||||
|
||||
/* Structure associated with BTA_DM_LINK_DOWN_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
UINT8 status; /* connection open/closed */
|
||||
} tBTA_DM_LINK_DOWN;
|
||||
|
||||
typedef INT8 tBTA_DM_RSSI_VALUE;
|
||||
typedef UINT8 tBTA_DM_LINK_QUALITY_VALUE;
|
||||
|
||||
/* signal strength mask */
|
||||
#define BTA_SIG_STRENGTH_RSSI_MASK 1
|
||||
#define BTA_SIG_STRENGTH_LINK_QUALITY_MASK 2
|
||||
|
||||
typedef UINT8 tBTA_SIG_STRENGTH_MASK;
|
||||
|
||||
/* Structure associated with BTA_DM_SIG_STRENGTH_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
tBTA_SIG_STRENGTH_MASK mask; /* mask for the values that are valid */
|
||||
tBTA_DM_RSSI_VALUE rssi_value;
|
||||
tBTA_DM_LINK_QUALITY_VALUE link_quality_value;
|
||||
|
||||
} tBTA_DM_SIG_STRENGTH;
|
||||
|
||||
/* Structure associated with BTA_DM_BUSY_LEVEL_EVT */
|
||||
typedef struct {
|
||||
UINT8 level; /* when paging or inquiring, level is 10.
|
||||
Otherwise, the number of ACL links */
|
||||
} tBTA_DM_BUSY_LEVEL;
|
||||
|
||||
// muff1n: only filled with used members
|
||||
typedef union {
|
||||
tBTA_DM_ENABLE enable; /* BTA enabled */
|
||||
tBTA_DM_PIN_REQ pin_req; /* PIN request */
|
||||
tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication */
|
||||
tBTA_DM_AUTHORIZE authorize; /* Authorization request */
|
||||
tBTA_DM_LINK_UP link_up; /* ACL connection up event */
|
||||
tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */
|
||||
tBTA_DM_SIG_STRENGTH sig_strength; /* rssi and link quality value */
|
||||
tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */
|
||||
} tBTA_DM_SEC;
|
||||
|
||||
typedef void(tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data);
|
||||
|
||||
/* Search callback events */
|
||||
#define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */
|
||||
#define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */
|
||||
#define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */
|
||||
#define BTA_DM_DISC_BLE_RES_EVT 3 /* Discovery result for BLE GATT based service on a peer device. */
|
||||
#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */
|
||||
#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */
|
||||
#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */
|
||||
|
||||
typedef UINT8 tBTA_DM_SEARCH_EVT;
|
||||
|
||||
#define BTA_DM_INQ_RES_IGNORE_RSSI BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */
|
||||
|
||||
// muff1n: commented some fields out
|
||||
/* Structure associated with BTA_DM_INQ_RES_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
DEV_CLASS dev_class; /* Device class of peer device. */
|
||||
// BOOLEAN remt_name_not_required; /* Application sets this flag if it already knows the name of the device
|
||||
// */
|
||||
/* If the device name is known to application BTA skips the remote name request */
|
||||
// BOOLEAN is_limited; /* TRUE, if the limited inquiry bit is set in the CoD */
|
||||
INT8 rssi; /* The rssi value */
|
||||
UINT8 *p_eir; /* received EIR */
|
||||
} tBTA_DM_INQ_RES;
|
||||
|
||||
/* Structure associated with BTA_DM_INQ_CMPL_EVT */
|
||||
typedef struct {
|
||||
UINT8 num_resps; /* Number of inquiry responses. */
|
||||
} tBTA_DM_INQ_CMPL;
|
||||
|
||||
/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
UINT8 num_record; /* Number of DI record */
|
||||
tBTA_STATUS result;
|
||||
} tBTA_DM_DI_DISC_CMPL;
|
||||
|
||||
/* Structure associated with BTA_DM_DISC_RES_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
BD_NAME bd_name; /* Name of peer device. */
|
||||
tBTA_SERVICE_MASK services; /* Services found on peer device. */
|
||||
// btla-specific ++
|
||||
UINT8 *p_raw_data; /* Raw data for discovery DB */
|
||||
UINT32 raw_data_size; /* size of raw data */
|
||||
tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */
|
||||
UINT32 num_uuids;
|
||||
UINT8 *p_uuid_list;
|
||||
// btla-specific --
|
||||
tBTA_STATUS result;
|
||||
} tBTA_DM_DISC_RES;
|
||||
|
||||
/* Structure associated with tBTA_DM_DISC_BLE_RES */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
BD_NAME bd_name; /* Name of peer device. */
|
||||
tBT_UUID service; /* GATT based Services UUID found on peer device. */
|
||||
} tBTA_DM_DISC_BLE_RES;
|
||||
|
||||
/* Union of all search callback structures */
|
||||
typedef union {
|
||||
tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */
|
||||
tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */
|
||||
tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
|
||||
tBTA_DM_DISC_BLE_RES disc_ble_res; /* discovery result for GATT based service */
|
||||
tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */
|
||||
} tBTA_DM_SEARCH;
|
||||
|
||||
/* Search callback */
|
||||
typedef void(tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
|
||||
|
||||
/* type of protocol mode */
|
||||
#define BTA_HH_PROTO_RPT_MODE (0x00)
|
||||
#define BTA_HH_PROTO_BOOT_MODE (0x01)
|
||||
#define BTA_HH_PROTO_UNKNOWN (0xff)
|
||||
typedef UINT8 tBTA_HH_PROTO_MODE;
|
||||
|
||||
/* BTA HID Host callback events */
|
||||
#define BTA_HH_ENABLE_EVT 0 /* HH enabled */
|
||||
#define BTA_HH_DISABLE_EVT 1 /* HH disabled */
|
||||
#define BTA_HH_OPEN_EVT 2 /* connection opened */
|
||||
#define BTA_HH_CLOSE_EVT 3 /* connection closed */
|
||||
#define BTA_HH_GET_RPT_EVT 4 /* BTA_HhGetReport callback */
|
||||
#define BTA_HH_SET_RPT_EVT 5 /* BTA_HhSetReport callback */
|
||||
#define BTA_HH_GET_PROTO_EVT 6 /* BTA_GetProtoMode callback */
|
||||
#define BTA_HH_SET_PROTO_EVT 7 /* BTA_HhSetProtoMode callback */
|
||||
#define BTA_HH_GET_IDLE_EVT 8 /* BTA_HhGetIdle comes callback */
|
||||
#define BTA_HH_SET_IDLE_EVT 9 /* BTA_HhSetIdle finish callback */
|
||||
#define BTA_HH_GET_DSCP_EVT 10 /* Get report descripotor */
|
||||
#define BTA_HH_ADD_DEV_EVT 11 /* Add Device callback */
|
||||
#define BTA_HH_RMV_DEV_EVT 12 /* remove device finished */
|
||||
#define BTA_HH_VC_UNPLUG_EVT 13 /* virtually unplugged */
|
||||
#define BTA_HH_UPDATE_UCD_EVT 14
|
||||
#define BTA_HH_API_ERR_EVT 15 /* API error is caught */
|
||||
|
||||
typedef UINT16 tBTA_HH_EVT;
|
||||
|
||||
enum {
|
||||
BTA_HH_OK,
|
||||
BTA_HH_HS_HID_NOT_READY, /* handshake error : device not ready */
|
||||
BTA_HH_HS_INVALID_RPT_ID, /* handshake error : invalid report ID */
|
||||
BTA_HH_HS_TRANS_NOT_SPT, /* handshake error : transaction not spt */
|
||||
BTA_HH_HS_INVALID_PARAM, /* handshake error : invalid paremter */
|
||||
BTA_HH_HS_ERROR, /* handshake error : unspecified HS error */
|
||||
BTA_HH_ERR, /* general BTA HH error */
|
||||
BTA_HH_ERR_SDP, /* SDP error */
|
||||
BTA_HH_ERR_PROTO, /* SET_Protocol error,
|
||||
only used in BTA_HH_OPEN_EVT callback */
|
||||
BTA_HH_ERR_DB_FULL, /* device database full error, used in
|
||||
BTA_HH_OPEN_EVT/BTA_HH_ADD_DEV_EVT */
|
||||
BTA_HH_ERR_TOD_UNSPT, /* type of device not supported */
|
||||
BTA_HH_ERR_NO_RES, /* out of system resources */
|
||||
BTA_HH_ERR_AUTH_FAILED, /* authentication fail */
|
||||
BTA_HH_ERR_HDL
|
||||
};
|
||||
typedef UINT8 tBTA_HH_STATUS;
|
||||
|
||||
/* callback event data for BTA_HH_OPEN_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bda; /* HID device bd address */
|
||||
tBTA_HH_STATUS status; /* operation status */
|
||||
UINT8 handle; /* device handle */
|
||||
} tBTA_HH_CONN;
|
||||
|
||||
typedef tBTA_HH_CONN tBTA_HH_DEV_INFO;
|
||||
|
||||
/* callback event data */
|
||||
typedef struct {
|
||||
tBTA_HH_STATUS status; /* operation status */
|
||||
UINT8 handle; /* device handle */
|
||||
} tBTA_HH_CBDATA;
|
||||
|
||||
// muff1n: only filled with used members
|
||||
typedef union {
|
||||
tBTA_HH_DEV_INFO dev_info; /* BTA_HH_ADD_DEV_EVT, BTA_HH_RMV_DEV_EVT */
|
||||
tBTA_HH_CONN conn; /* BTA_HH_OPEN_EVT */
|
||||
tBTA_HH_CBDATA dev_status; /* BTA_HH_CLOSE_EVT,
|
||||
BTA_HH_SET_PROTO_EVT
|
||||
BTA_HH_SET_RPT_EVT
|
||||
BTA_HH_SET_IDLE_EVT */
|
||||
} tBTA_HH;
|
||||
|
||||
/* BTA HH callback function */
|
||||
typedef void(tBTA_HH_CBACK)(tBTA_HH_EVT event, tBTA_HH *p_data);
|
||||
|
||||
/* General callback function for notifying an application that a synchronous
|
||||
** BTM function is complete. The pointer contains the address of any returned data.
|
||||
*/
|
||||
typedef void(tBTM_CMPL_CB)(void *p1);
|
||||
/* Structure returned with local version information */
|
||||
|
||||
typedef struct {
|
||||
UINT8 hci_version;
|
||||
UINT16 hci_revision;
|
||||
UINT8 lmp_version;
|
||||
UINT16 manufacturer;
|
||||
UINT16 lmp_subversion;
|
||||
} tBTM_VERSION_INFO;
|
||||
|
||||
/* Structure returned with Vendor Specific Command complete callback */
|
||||
typedef struct {
|
||||
UINT16 opcode;
|
||||
UINT16 param_len;
|
||||
UINT8 *p_param_buf;
|
||||
} tBTM_VSC_CMPL;
|
||||
|
||||
#define BTM_VSC_CMPL_DATA_SIZE (BTM_MAX_VENDOR_SPECIFIC_LEN + sizeof(tBTM_VSC_CMPL))
|
||||
/* Callback function for when device status changes. Appl must poll for
|
||||
** what the new state is (BTM_IsDeviceUp). The event occurs whenever the stack
|
||||
** has detected that the controller status has changed. This asynchronous event
|
||||
** is enabled/disabled by calling BTM_RegisterForDeviceStatusNotif().
|
||||
*/
|
||||
enum { BTM_DEV_STATUS_UP, BTM_DEV_STATUS_DOWN, BTM_DEV_STATUS_CMD_TOUT };
|
||||
typedef UINT8 tBTM_DEV_STATUS;
|
||||
|
||||
typedef void(tBTM_DEV_STATUS_CB)(tBTM_DEV_STATUS status);
|
||||
|
||||
/* Callback function for when a vendor specific event occurs. The length and
|
||||
** array of returned parameter bytes are included. This asynchronous event
|
||||
** is enabled/disabled by calling BTM_RegisterForVSEvents().
|
||||
*/
|
||||
typedef void(tBTM_VS_EVT_CB)(UINT8 len, UINT8 *p);
|
||||
|
||||
/* VSC callback function for notifying an application that a synchronous
|
||||
** BTM function is complete. The pointer contains the address of any returned data.
|
||||
*/
|
||||
typedef void(tBTM_VSC_CMPL_CB)(tBTM_VSC_CMPL *p1);
|
||||
|
||||
/* Attributes mask values to be used in HID_HostAddDev API */
|
||||
#define HID_VIRTUAL_CABLE 0x0001
|
||||
#define HID_NORMALLY_CONNECTABLE 0x0002
|
||||
#define HID_RECONN_INIT 0x0004
|
||||
#define HID_SDP_DISABLE 0x0008
|
||||
#define HID_BATTERY_POWER 0x0010
|
||||
#define HID_REMOTE_WAKE 0x0020
|
||||
#define HID_SUP_TOUT_AVLBL 0x0040
|
||||
#define HID_SSR_MAX_LATENCY 0x0080
|
||||
#define HID_SSR_MIN_TOUT 0x0100
|
||||
|
||||
#define HID_SEC_REQUIRED 0x8000
|
||||
|
||||
#define BTA_HH_VIRTUAL_CABLE HID_VIRTUAL_CABLE
|
||||
#define BTA_HH_NORMALLY_CONNECTABLE HID_NORMALLY_CONNECTABLE
|
||||
#define BTA_HH_RECONN_INIT HID_RECONN_INIT
|
||||
#define BTA_HH_SDP_DISABLE HID_SDP_DISABLE
|
||||
#define BTA_HH_BATTERY_POWER HID_BATTERY_POWER
|
||||
#define BTA_HH_REMOTE_WAKE HID_REMOTE_WAKE
|
||||
#define BTA_HH_SUP_TOUT_AVLBL HID_SUP_TOUT_AVLBL
|
||||
#define BTA_HH_SEC_REQUIRED HID_SEC_REQUIRED
|
||||
typedef UINT16 tBTA_HH_ATTR_MASK;
|
||||
|
||||
typedef struct desc_info {
|
||||
UINT16 dl_len;
|
||||
UINT8 *dsc_list;
|
||||
} tHID_DEV_DSCP_INFO;
|
||||
|
||||
typedef tHID_DEV_DSCP_INFO tBTA_HH_DEV_DESCR;
|
||||
|
||||
/* Policy settings status */
|
||||
#define HCI_DISABLE_ALL_LM_MODES 0x0000
|
||||
#define HCI_ENABLE_MASTER_SLAVE_SWITCH 0x0001
|
||||
#define HCI_ENABLE_HOLD_MODE 0x0002
|
||||
#define HCI_ENABLE_SNIFF_MODE 0x0004
|
||||
#define HCI_ENABLE_PARK_MODE 0x0008
|
||||
|
||||
/* HCI mode defenitions */
|
||||
#define HCI_MODE_ACTIVE 0x00
|
||||
#define HCI_MODE_HOLD 0x01
|
||||
#define HCI_MODE_SNIFF 0x02
|
||||
#define HCI_MODE_PARK 0x03
|
||||
|
||||
/* BTM Power manager status codes */
|
||||
enum {
|
||||
BTM_PM_STS_ACTIVE = HCI_MODE_ACTIVE,
|
||||
BTM_PM_STS_HOLD = HCI_MODE_HOLD,
|
||||
BTM_PM_STS_SNIFF = HCI_MODE_SNIFF,
|
||||
BTM_PM_STS_PARK = HCI_MODE_PARK,
|
||||
BTM_PM_STS_SSR, /* report the SSR parameters in HCI_SNIFF_SUB_RATE_EVT */
|
||||
BTM_PM_STS_PENDING, /* when waiting for status from controller */
|
||||
BTM_PM_STS_ERROR /* when HCI command status returns error */
|
||||
};
|
||||
typedef UINT8 tBTM_PM_STATUS;
|
||||
|
||||
/* BTM Power manager modes */
|
||||
|
||||
enum {
|
||||
BTM_PM_MD_ACTIVE = BTM_PM_STS_ACTIVE,
|
||||
BTM_PM_MD_HOLD = BTM_PM_STS_HOLD,
|
||||
BTM_PM_MD_SNIFF = BTM_PM_STS_SNIFF,
|
||||
BTM_PM_MD_PARK = BTM_PM_STS_PARK,
|
||||
BTM_PM_MD_FORCE = 0x10 /* OR this to force ACL link to a certain mode */
|
||||
};
|
||||
typedef UINT8 tBTM_PM_MODE;
|
||||
|
||||
#define BTM_PM_SET_ONLY_ID 0x80
|
||||
|
||||
/* Operation codes */
|
||||
#define BTM_PM_REG_SET 1 /* The module wants to set the desired power mode */
|
||||
#define BTM_PM_REG_NOTIF 2 /* The module wants to receive mode change event */
|
||||
#define BTM_PM_DEREG 4 /* The module does not want to involve with PM anymore */
|
||||
|
||||
typedef struct {
|
||||
UINT16 max;
|
||||
UINT16 min;
|
||||
UINT16 attempt;
|
||||
UINT16 timeout;
|
||||
tBTM_PM_MODE mode;
|
||||
} tBTM_PM_PWR_MD;
|
||||
|
||||
/*************************************
|
||||
** Power Manager Callback Functions
|
||||
**************************************/
|
||||
typedef void(tBTM_PM_STATUS_CBACK)(BD_ADDR p_bda, tBTM_PM_STATUS status, UINT16 value, UINT8 hci_status);
|
||||
|
||||
/************************
|
||||
** Stored Linkkey Types
|
||||
*************************/
|
||||
#define BTM_CB_EVT_RETURN_LINK_KEYS 1
|
||||
#define BTM_CB_EVT_READ_STORED_LINK_KEYS 2
|
||||
#define BTM_CB_EVT_WRITE_STORED_LINK_KEYS 3
|
||||
#define BTM_CB_EVT_DELETE_STORED_LINK_KEYS 4
|
||||
|
||||
typedef struct {
|
||||
UINT8 event;
|
||||
|
||||
} tBTM_STORED_LINK_KEYS_EVT;
|
||||
|
||||
typedef struct {
|
||||
UINT8 event;
|
||||
UINT8 num_keys;
|
||||
|
||||
} tBTM_RETURN_LINK_KEYS_EVT;
|
||||
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr;
|
||||
LINK_KEY link_key;
|
||||
|
||||
} tBTM_BD_ADDR_LINK_KEY_PAIR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 event;
|
||||
UINT8 status;
|
||||
UINT16 max_keys;
|
||||
UINT16 read_keys;
|
||||
|
||||
} tBTM_READ_STORED_LINK_KEY_COMPLETE;
|
||||
|
||||
typedef struct {
|
||||
UINT8 event;
|
||||
UINT8 status;
|
||||
UINT8 num_keys;
|
||||
|
||||
} tBTM_WRITE_STORED_LINK_KEY_COMPLETE;
|
||||
|
||||
typedef struct {
|
||||
UINT8 event;
|
||||
UINT8 status;
|
||||
UINT16 num_keys;
|
||||
|
||||
} tBTM_DELETE_STORED_LINK_KEY_COMPLETE;
|
||||
|
||||
// ---
|
||||
|
||||
tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback);
|
||||
tBTA_STATUS BTA_DisableBluetooth(void);
|
||||
|
||||
// muff1n: most changed prototype so far
|
||||
tBTA_STATUS BTA_DmAddDevice(BD_ADDR bd_addr, LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask, BOOLEAN is_trusted);
|
||||
tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr);
|
||||
void BTA_DmSearch(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK services, tBTA_DM_SEARCH_CBACK *p_cback);
|
||||
void BTA_DmSearchCancel(void);
|
||||
void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len, UINT8 *p_pin);
|
||||
BOOLEAN BTA_DmIsDeviceUp(void);
|
||||
void BTA_DmSetDeviceName(char *p_name);
|
||||
|
||||
// muff1n: disc_mode and conn_mode might be the , based on usage
|
||||
void BTA_DmSetVisibility(UINT8, UINT8);
|
||||
|
||||
// muff1n: ucd_enabled might be the missing parameter
|
||||
void BTA_HhEnable(tBTA_SEC sec_mask, tBTA_HH_CBACK *p_cback);
|
||||
// muff1n: possibly takes just a tBTA_HH_DEV_DESCR in this version? i wrote it like that
|
||||
void BTA_HhAddDev(BD_ADDR bda, tBTA_HH_ATTR_MASK attr_mask, UINT8 sub_class, UINT8 app_id, tBTA_HH_DEV_DESCR descr);
|
||||
void BTA_HhRemoveDev(UINT8 dev_handle);
|
||||
void BTA_HhOpen(BD_ADDR dev_bda, tBTA_HH_PROTO_MODE mode, tBTA_SEC sec_mask);
|
||||
void BTA_HhClose(UINT8 dev_handle);
|
||||
|
||||
// muff1n: dev_bda is likely the missing parameter, as it is not used
|
||||
void BTA_HhSendData(UINT8 dev_handle, BT_HDR *p_data);
|
||||
|
||||
void bta_sys_set_trace_level(UINT8 level);
|
||||
|
||||
void BTM_DeviceReset(tBTM_CMPL_CB *p_cb);
|
||||
|
||||
tBTM_STATUS BTM_ReadStoredLinkKey(BD_ADDR bd_addr, tBTM_CMPL_CB *p_cb);
|
||||
tBTM_STATUS BTM_WriteStoredLinkKey(UINT8 num_keys, BD_ADDR *bd_addr, LINK_KEY *link_key, tBTM_CMPL_CB *p_cb);
|
||||
tBTM_STATUS BTM_DeleteStoredLinkKey(BD_ADDR bd_addr, tBTM_CMPL_CB *p_cb);
|
||||
|
||||
tBTM_STATUS BTM_SetPowerMode(UINT8 pm_id, BD_ADDR remote_bda, tBTM_PM_PWR_MD *p_mode);
|
||||
tBTM_STATUS BTM_SetAfhChannels(UINT8 first, UINT8 last);
|
||||
|
||||
tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode, UINT8 param_len, UINT8 *p_param_buf, tBTM_VSC_CMPL_CB *p_cb);
|
||||
|
||||
tBTM_STATUS BTM_ReadLocalVersion(tBTM_VERSION_INFO *p_vers);
|
||||
tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class);
|
||||
|
||||
tBTM_STATUS btm_remove_acl(BD_ADDR bd_addr);
|
||||
|
||||
// muff1n: is_register is probably the missing parameter here
|
||||
tBTM_STATUS BTM_RegisterForVSEvents(tBTM_VS_EVT_CB *p_cb);
|
||||
tBTM_DEV_STATUS_CB *BTM_RegisterForDeviceStatusNotif(tBTM_DEV_STATUS_CB *p_cb);
|
||||
|
||||
tBTM_STATUS BTM_PmRegister(UINT8 mask, UINT8 *p_pm_id, tBTM_PM_STATUS_CBACK *p_cb);
|
||||
tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout);
|
||||
void BTM_SetDefaultLinkPolicy(UINT16 settings);
|
||||
void BTM_SetDefaultLinkSuperTout(UINT16 timeout);
|
||||
|
||||
BOOLEAN BTM_SecAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, BD_FEATURES features,
|
||||
UINT32 trusted_mask[], LINK_KEY link_key);
|
||||
|
||||
void *GKI_getbuf(UINT16 size);
|
||||
|
||||
UINT8 L2CA_SetTraceLevel(UINT8 trace_level);
|
||||
|
||||
UINT8 SDP_SetTraceLevel(UINT8 new_level);
|
||||
|
||||
/* muff1n: not in bluedroid source; might be older removed API functions */
|
||||
void BTA_DmSendHciReset(void);
|
||||
void BTA_HhGetAclQueueInfo(void);
|
||||
void BTA_Init(void);
|
||||
void BTA_CleanUp(void (*p_cb)(tBTA_STATUS status)); // probably
|
||||
|
||||
// ---
|
||||
/* muff1n: I wrote this definition myself
|
||||
* TODO: would this be part of BLE or WUD?
|
||||
*/
|
||||
|
||||
struct small_dev_info {
|
||||
char devName[20]; // size 0x14? offset 0x00 // might be 0x13?
|
||||
char at_0x14[1]; // size 0x??, offset 0x14?
|
||||
char __pad0[0x20 - (0x14 + 0x01)];
|
||||
LINK_KEY linkKey; // size 0x10, offset 0x20
|
||||
char __pad1[0x10];
|
||||
}; // size 0x40
|
||||
|
||||
#endif // CONTEXT_BTE_H
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef EGG_AUDIO_ARC_PLAYER_MANAGER_H
|
||||
#define EGG_AUDIO_ARC_PLAYER_MANAGER_H
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class ArcPlayer {};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef EGG_AUDIO_HEAP_MANAGER_H
|
||||
#define EGG_AUDIO_HEAP_MANAGER_H
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class SoundHeapMgr {};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#ifndef EGG_IAUDIO_MANAGER_H
|
||||
#define EGG_IAUDIO_MANAGER_H
|
||||
#ifndef EGG_AUDIO_MANAGER_H
|
||||
#define EGG_AUDIO_MANAGER_H
|
||||
|
||||
#include "egg/audio/eggAudioArcPlayerMgr.h"
|
||||
#include "egg/audio/eggAudioHeapMgr.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "egg/egg_types.h"
|
||||
|
||||
|
||||
namespace EGG {
|
||||
class IAudioMgr {
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_AUDIO_REMOTE_SPEAKER_MANAGER_H
|
||||
#define EGG_AUDIO_REMOTE_SPEAKER_MANAGER_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_AUDIO_SYSTEM_H
|
||||
#define EGG_AUDIO_SYSTEM_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_AUDIO_ARC_UTILITY_H
|
||||
#define EGG_AUDIO_ARC_UTILITY_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -1,20 +1,21 @@
|
||||
#ifndef EGG_ALLOCATOR_H
|
||||
#define EGG_ALLOCATOR_H
|
||||
#include "rvl/MEM.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
/* 80495310 */ void MEMInitAllocatorFor_Heap(MEMAllocator *alloc, s32 align, void *heap);
|
||||
void MEMInitAllocatorFor_Heap(MEMAllocator *alloc, s32 align, void *heap);
|
||||
|
||||
namespace EGG {
|
||||
class Heap;
|
||||
class Allocator : public MEMAllocator {
|
||||
public:
|
||||
/* 80495330 */ Allocator(Heap *heap, s32 align);
|
||||
Allocator(Heap *heap, s32 align);
|
||||
|
||||
public:
|
||||
/* vt 0x08 | 80495380 */ virtual ~Allocator();
|
||||
/* vt 0x0C | 804953c0 */ virtual void *alloc(u32 size);
|
||||
/* vt 0x10 | 804953e0 */ virtual void free(void *block);
|
||||
/* vt 0x08 */ virtual ~Allocator();
|
||||
/* vt 0x0C */ virtual void *alloc(u32 size);
|
||||
/* vt 0x10 */ virtual void free(void *block);
|
||||
|
||||
inline MEMAllocator *getHandle() {
|
||||
return static_cast<MEMAllocator *>(this);
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
#include "egg/core/eggDisposer.h"
|
||||
#include "rvl/ARC.h"
|
||||
#include "rvl/NAND.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
typedef void (*FileCallbackFunc)(void *, void *, const ARCDirEntry *, const char *);
|
||||
|
||||
namespace EGG {
|
||||
// Functions that need a proper home:
|
||||
/* 80493510 */ void readNANDFile(NANDFileInfo *info, void *buf, u32 len, s32 offs);
|
||||
|
||||
class Archive : public Disposer {
|
||||
public:
|
||||
@@ -19,46 +18,46 @@ public:
|
||||
u32 mArcLength;
|
||||
};
|
||||
enum MountType { // enum name is correct, values arent official
|
||||
NOT_LOADED,
|
||||
LOADED_CAN_FAST_READ,
|
||||
NAND_File,
|
||||
MOUNT_NONE,
|
||||
MOUNT_MEM,
|
||||
MOUNT_NAND,
|
||||
};
|
||||
/* 0x10 */ MountType mMountType;
|
||||
/* 0x14 */ u32 mRefCount;
|
||||
/* 0x18 */ ARCHandle mHandle;
|
||||
/* 0x34 */ s32 mDvdEntryNum; // gets put into first param of DVDFastOpen
|
||||
/* 0x38 */ s32 mNandFile; // pointer to NANDFileInfo (was allocated)
|
||||
/* 0x34 */ s32 mDvdEntryNum; // gets put into first param of DVDFastOpen
|
||||
/* 0x38 */ NANDFileInfo *mNandFile; // pointer to NANDFileInfo (was allocated)
|
||||
/* 0x3C */ nw4r::ut::Node mLink;
|
||||
|
||||
public:
|
||||
/* 804935f0 */ virtual ~Archive();
|
||||
virtual ~Archive();
|
||||
|
||||
public:
|
||||
/* 80493580 */ Archive();
|
||||
/* 80493660 */ void initHandle(void *data, MountType mountType);
|
||||
/* 804936d0 */ static Archive *findArchive(void *data);
|
||||
/* 80493760 */ static Archive *findArchive(NANDFileInfo *file);
|
||||
/* 804937f0 */ static void appendList(Archive *); // prob private
|
||||
/* 80493850 */ static void removeList(Archive *);
|
||||
/* 80493860 */ static Archive *mount(void *data, Heap *heap, int align);
|
||||
/* 80493950 */ static Archive *mountFST(void *data, Heap *heap, s32 align);
|
||||
/* 80493a40 */ static Archive *mountNandFile(NANDFileInfo *, Heap *heap, s32 align);
|
||||
/* 80493ac0 */ static Archive *loadFST(const char *fileName, Heap *heap, s32 align);
|
||||
/* 80493b80 */ void unmount();
|
||||
/* 80493c20 */ void *getFile(const char *name, FileInfo *out);
|
||||
/* 80493cf0 */ s32 convertPathToEntryID(const char *path);
|
||||
/* 80493d00 */ void *getFileFast(s32 entryId, FileInfo *fileinfo);
|
||||
/* 80493dc0 */ void *getFileFast(s32 entryId, Heap *heap, s32 align);
|
||||
/* 80493f30 */ s32 countFile();
|
||||
/* 804940c0 */ void searchInside(FileCallbackFunc, void *);
|
||||
/* 80494140 */ static void *loadFromNAND(NANDFileInfo *fileInfo, Heap *heap, s32 align);
|
||||
Archive();
|
||||
bool initHandle(void *data, MountType mountType);
|
||||
static Archive *findArchive(void *data);
|
||||
static Archive *findArchive(NANDFileInfo *file);
|
||||
static Archive *mount(void *data, Heap *pHeap, int align);
|
||||
static Archive *mountFST(void *data, Heap *pHeap, int align); // name assumed
|
||||
static Archive *mountNAND(NANDFileInfo *, Heap *pHeap, int align); // name assumed
|
||||
static Archive *loadFST(const char *fileName, Heap *pHeap, int align); // name assumed
|
||||
void unmount();
|
||||
void *getFile(const char *name, FileInfo *out);
|
||||
s32 convertPathToEntryID(const char *path);
|
||||
void *getFileFast(s32 entryId, FileInfo *fileinfo);
|
||||
void *getFileFast(s32 entryId, Heap *pHeap, int align);
|
||||
s32 countFile();
|
||||
void searchInside(FileCallbackFunc, void *);
|
||||
|
||||
public:
|
||||
/* 80576728 */ static bool sIsArchiveListInitialized;
|
||||
/* 80673ac8 */ static nw4r::ut::List sArchiveList;
|
||||
static void *loadNAND(NANDFileInfo *fileInfo, Heap *pHeap, int align);
|
||||
|
||||
static nw4r::ut::List sArchiveList;
|
||||
|
||||
private:
|
||||
static bool sIsArchiveListInitialized;
|
||||
static void appendList(Archive *);
|
||||
static void removeList(Archive *);
|
||||
};
|
||||
/* 80493f10 */ void countFileCallbackFunc(void *, void *, const ARCDirEntry *, const char *);
|
||||
/* 80493f70 */ void searchInsideWithPath(Archive *arc, ARCHandle *handle, FileCallbackFunc, void *, char *outPath, u32);
|
||||
} // namespace EGG
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,28 +2,29 @@
|
||||
#define EGG_ASSERT_HEAP_H
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class AssertHeap : public Heap {
|
||||
public:
|
||||
// vtable at 0x0 | 8056ea00
|
||||
/* vt 0x08 | 804963e0 */ virtual ~AssertHeap();
|
||||
/* vt 0x0C | 80496820 */ virtual eHeapKind getHeapKind() const;
|
||||
/* vt 0x14 | 804966b0 */ virtual void *alloc(u32 size, s32 align);
|
||||
/* vt 0x18 | 80496710 */ virtual void free(void *block);
|
||||
/* vt 0x1C | 80496620 */ virtual void destroy();
|
||||
/* vt 0x20 | 80496760 */ virtual u32 resizeForMBlock(void *block, u32 size);
|
||||
/* vt 0x24 | 80496770 */ virtual u32 getTotalFreeSize();
|
||||
/* vt 0x28 | 80496780 */ virtual u32 getAllocatableSize(s32 align);
|
||||
/* vt 0x2C | 80496790 */ virtual u32 adjust();
|
||||
// vtable at 0x0
|
||||
virtual ~AssertHeap();
|
||||
virtual eHeapKind getHeapKind() const override;
|
||||
virtual void *alloc(u32 size, s32 align) override;
|
||||
virtual void free(void *block) override;
|
||||
virtual void destroy() override;
|
||||
virtual u32 resizeForMBlock(void *block, u32 size) override;
|
||||
virtual u32 getTotalFreeSize() override;
|
||||
virtual u32 getAllocatableSize(s32 align) override;
|
||||
virtual u32 adjust() override;
|
||||
|
||||
public:
|
||||
/* 804963a0 */ AssertHeap(MEMiHeapHead *heapHead);
|
||||
/* 80496460 */ static AssertHeap *create(void *block, size_t size, u16 attr);
|
||||
/* 80496530 */ static AssertHeap *create(size_t size, Heap *heap);
|
||||
/* 80496810 */ static size_t getSize(); // returns 0x7C
|
||||
AssertHeap(MEMiHeapHead *heapHead);
|
||||
static AssertHeap *create(void *block, u32 size);
|
||||
static AssertHeap *create(u32 size, Heap *heap);
|
||||
static size_t getSize(); // returns 0x7C
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -2,18 +2,19 @@
|
||||
#define EGG_ASYNC_DISPLAY_H
|
||||
|
||||
#include "egg/core/eggDisplay.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class AsyncDisplay : public Display {
|
||||
public:
|
||||
// vtable at 0x04 | 8056eb60
|
||||
/* vt 0x08 | 80497f20 */ virtual void beginFrame();
|
||||
/* vt 0x10 | 804980e0 */ virtual void endRender();
|
||||
/* vt 0x14 | 804980c0 */ virtual void endFrame();
|
||||
/* vt 0x18 | 804982d0 */ virtual u32 getTickPerFrame();
|
||||
/* vt 0x1C | 80498100 */ virtual void preVRetrace();
|
||||
// vtable at 0x04
|
||||
/* vt 0x08 */ virtual void beginFrame();
|
||||
/* vt 0x10 */ virtual void endRender();
|
||||
/* vt 0x14 */ virtual void endFrame();
|
||||
/* vt 0x18 */ virtual u32 getTickPerFrame();
|
||||
/* vt 0x1C */ virtual void preVRetrace();
|
||||
|
||||
private:
|
||||
inline void waitForMsg(bool);
|
||||
@@ -35,10 +36,10 @@ public:
|
||||
/* 0xBC */ u32 field_0xBC;
|
||||
|
||||
public:
|
||||
/* 80497e40 */ AsyncDisplay(u8 maxRetrace);
|
||||
/* 80497ec0 */ f32 calcS();
|
||||
/* 80498260 */ void clearEFB();
|
||||
/* 804982f0 */ void clearEFB(u16, u16, u16, u16, u16, u16, nw4r::ut::Color);
|
||||
AsyncDisplay(u8 maxRetrace);
|
||||
f32 calcS();
|
||||
void clearEFB();
|
||||
void clearEFB(u16, u16, u16, u16, u16, u16, nw4r::ut::Color);
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -4,20 +4,23 @@
|
||||
#include "egg/core/eggFader.h"
|
||||
#include "egg/prim/eggBitFlag.h"
|
||||
#include "nw4r/ut.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class ColorFader : public Fader {
|
||||
public:
|
||||
// vtable at 0x00 | 8056eae8
|
||||
/* vt 0x08 | 80497a10 */ virtual void setStatus(EStatus);
|
||||
/* vt 0x0C | 80067ec0 */ virtual EStatus getStatus() const { return mStatus; };
|
||||
/* vt 0x10 | 80497a50 */ virtual bool fadeIn();
|
||||
/* vt 0x14 | 80497a80 */ virtual bool fadeOut();
|
||||
/* vt 0x18 | 80497ab0 */ virtual bool calc();
|
||||
/* vt 0x1C | 80497ba0 */ virtual void draw();
|
||||
/* vt 0x1C | 80131b70 */ virtual ~ColorFader() {}
|
||||
// vtable at 0x00
|
||||
/* vt 0x08 */ virtual void setStatus(EStatus);
|
||||
/* vt 0x0C */ virtual EStatus getStatus() const {
|
||||
return mStatus;
|
||||
};
|
||||
/* vt 0x10 */ virtual bool fadeIn();
|
||||
/* vt 0x14 */ virtual bool fadeOut();
|
||||
/* vt 0x18 */ virtual bool calc();
|
||||
/* vt 0x1C */ virtual void draw();
|
||||
/* vt 0x1C */ virtual ~ColorFader() {}
|
||||
|
||||
public:
|
||||
/* 0x04 */ EStatus mStatus;
|
||||
@@ -32,11 +35,15 @@ public:
|
||||
/* 0x20 */ f32 mEndY;
|
||||
|
||||
public:
|
||||
/* 80497930 */ ColorFader(f32 startX, f32 startY, f32 lengthX, f32 lengthY, nw4r::ut::Color color, EStatus status);
|
||||
/* 804979e0 */ void setFrame(u16 frame);
|
||||
/* 804979f0 */ void setColor(nw4r::ut::Color);
|
||||
float getWidth() const { return mEndX - mStartX; }
|
||||
float getHeight() const { return mEndY - mStartY; }
|
||||
ColorFader(f32 startX, f32 startY, f32 lengthX, f32 lengthY, nw4r::ut::Color color, EStatus status);
|
||||
void setFrame(u16 frame);
|
||||
void setColor(nw4r::ut::Color);
|
||||
float getWidth() const {
|
||||
return mEndX - mStartX;
|
||||
}
|
||||
float getHeight() const {
|
||||
return mEndY - mStartY;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
+158
-102
@@ -1,14 +1,16 @@
|
||||
#ifndef EGG_CONTROLLER_H
|
||||
#define EGG_CONTROLLER_H
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#include "egg/math/eggMath.h"
|
||||
#include "egg/math/eggMatrix.h"
|
||||
#include "egg/math/eggVector.h"
|
||||
#include "egg/prim/eggBitFlag.h"
|
||||
#include "egg/prim/eggBuffer.h"
|
||||
#include "rvl/KPAD.h"
|
||||
#include "rvl/PAD.h"
|
||||
#include "rvl/WPAD.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
@@ -16,96 +18,138 @@ class ControllerRumbleMgr;
|
||||
class CoreController;
|
||||
|
||||
// To Be Filled out
|
||||
enum eCoreDevType {};
|
||||
enum eCoreDevType {
|
||||
};
|
||||
|
||||
typedef void (*ConnectCallback)(int args[]);
|
||||
typedef class CoreController *(*ControllerFactory)();
|
||||
|
||||
class CoreStatus {
|
||||
public:
|
||||
/* 0x00 */ u8 field_0x00[0x0C];
|
||||
/* 0x0C */ f32 accel[3];
|
||||
/* 0x00 */ u32 mHold;
|
||||
/* 0x04 */ u32 mTrig;
|
||||
/* 0x08 */ u32 mRelease;
|
||||
/* 0x0C */ Vector3f mAccel;
|
||||
/* 0x18 */ u8 field_0x01[0x20 - 0x18];
|
||||
/* 0x20 */ f32 dpdRawX;
|
||||
/* 0x24 */ f32 dpdRawY;
|
||||
/* 0x28 */ u8 field_0x02[0x54 - 0x28];
|
||||
/* 0x20 */ f32 mDpdRawX;
|
||||
/* 0x24 */ f32 mDpdRawY;
|
||||
/* 0x28 */ u8 field_0x02[0x48 - 0x28];
|
||||
/* 0x48 */ f32 mDpdDistance;
|
||||
/* 0x4C */ f32 float_0x4C;
|
||||
/* 0x50 */ f32 float_0x50;
|
||||
/* 0x54 */ f32 float_0x54;
|
||||
/* 0x58 */ f32 float_0x58;
|
||||
/* 0x5C */ u8 field_0x5C[0x5E - 0x5C];
|
||||
/* 0x5E */ s8 dpdDistance;
|
||||
/* 0x5C */ u8 mDevType;
|
||||
/* 0x5D */ u8 field_0x5D;
|
||||
/* 0x5E */ s8 mDpdValid;
|
||||
/* 0x5F */ s8 unknown;
|
||||
/* 0x60 */ f32 fsStickButton;
|
||||
/* 0x60 */ f32 fsStickButton2;
|
||||
/* 0x64 */ u8 field_0x03[0x88];
|
||||
/* 0x60 */ f32 mFSStickX;
|
||||
/* 0x64 */ f32 mFSStickY;
|
||||
/* 0x68 */ u8 field_0x03[0x88];
|
||||
|
||||
public:
|
||||
/* 80498f90 */ void init();
|
||||
/* 80498fa0 */ u32 getFSStickButton() const;
|
||||
void init();
|
||||
u32 getFSStickButton() const;
|
||||
f32 getFSStickX() const {
|
||||
return mFSStickX;
|
||||
}
|
||||
f32 getFSStickY() const {
|
||||
return mFSStickY;
|
||||
}
|
||||
bool down(u32 mask) const {
|
||||
return (mask & mHold);
|
||||
}
|
||||
bool up(u32 mask) const {
|
||||
return (mask & mHold) != mask;
|
||||
}
|
||||
bool downTrigger(u32 mask) const {
|
||||
return (mask & mTrig);
|
||||
}
|
||||
bool upTrigger(u32 mask) const {
|
||||
return (mask & mRelease);
|
||||
}
|
||||
bool downAll(u32 mask) const {
|
||||
return (mask & mHold) == mask;
|
||||
}
|
||||
bool upAll(u32 mask) const {
|
||||
return (mask & mHold) == 0;
|
||||
}
|
||||
|
||||
inline Vector2f getUnk() {
|
||||
s32 getDevType() const {
|
||||
return mDevType;
|
||||
}
|
||||
bool isCore() const {
|
||||
return getDevType() == WPAD_DEV_CORE;
|
||||
}
|
||||
bool isFreestyle() const {
|
||||
return getDevType() == WPAD_DEV_FS;
|
||||
}
|
||||
|
||||
u32 getHold() const {
|
||||
return mHold;
|
||||
}
|
||||
|
||||
s8 getDpdValidFlag() const {
|
||||
return mDpdValid;
|
||||
};
|
||||
|
||||
Vector2f getUnk() {
|
||||
return Vector2f(float_0x54, float_0x58);
|
||||
}
|
||||
|
||||
const Vector3f &getAccel() const {
|
||||
return mAccel;
|
||||
}
|
||||
};
|
||||
|
||||
class CoreController {
|
||||
public:
|
||||
// vtable 0x000 | 8056ec50
|
||||
// TODO all of these have inline implementations and are scattered
|
||||
// across the binary
|
||||
/* vt 0x08 | 80064920 */ virtual void setPosParam(f32, f32) {
|
||||
// TODO
|
||||
// vtable 0x0000
|
||||
/* vt 0x08 */ virtual void setPosParam(f32 f1, f32 f2) {
|
||||
KPADSetPosParam(mChannelID, f1, f2);
|
||||
}
|
||||
/* vt 0x0C | 8049a940 */ virtual void setHoriParam(f32, f32) {
|
||||
// TODO
|
||||
/* vt 0x0C */ virtual void setHoriParam(f32 f1, f32 f2) {
|
||||
KPADSetHoriParam(mChannelID, f1, f2);
|
||||
}
|
||||
/* vt 0x10 | 8049a930 */ virtual void setDistParam(f32, f32) {
|
||||
// TODO
|
||||
/* vt 0x10 */ virtual void setDistParam(f32 f1, f32 f2) {
|
||||
KPADSetDistParam(mChannelID, f1, f2);
|
||||
}
|
||||
/* vt 0x14 | 8049a920 */ virtual void setAccParam(f32, f32) {
|
||||
// TODO
|
||||
/* vt 0x14 */ virtual void setAccParam(f32 f1, f32 f2) {
|
||||
KPADSetAccParam(mChannelID, f1, f2);
|
||||
}
|
||||
/* vt 0x18 | 80059820 */ virtual bool isPressed(u32 mask) {
|
||||
// TODO
|
||||
return false;
|
||||
/* vt 0x18 */ virtual bool down(u32 mask) const {
|
||||
return mCoreStatus[0].down(mask);
|
||||
}
|
||||
/* vt 0x1C | 80059a60 */ virtual bool isAnyPressed(u32 mask) {
|
||||
// TODO
|
||||
return false;
|
||||
/* vt 0x1C */ virtual bool up(u32 mask) const {
|
||||
return mCoreStatus[0].up(mask);
|
||||
}
|
||||
/* vt 0x20 | 80014e30 */ virtual bool isTriggered(u32 mask) {
|
||||
// TODO
|
||||
return false;
|
||||
/* vt 0x20 */ virtual bool downTrigger(u32 mask) const {
|
||||
return mCoreStatus[0].downTrigger(mask);
|
||||
}
|
||||
/* vt 0x24 | 800599e0 */ virtual bool isReleased() {
|
||||
// TODO
|
||||
return false;
|
||||
/* vt 0x24 */ virtual bool upTrigger(u32 mask) const {
|
||||
return mCoreStatus[0].upTrigger(mask);
|
||||
}
|
||||
/* vt 0x28 | 80059840 */ virtual bool isAllPressed() {
|
||||
// TODO
|
||||
return false;
|
||||
/* vt 0x28 */ virtual bool downAll(u32 mask) const {
|
||||
return mCoreStatus[0].downAll(mask);
|
||||
}
|
||||
/* vt 0x2C | 80059a80 */ virtual bool isNotPressed() {
|
||||
// TODO
|
||||
return false;
|
||||
/* vt 0x2C */ virtual bool upAll(u32 mask) const {
|
||||
return mCoreStatus[0].upAll(mask);
|
||||
}
|
||||
// We know the above are inline because if a class has any non-inline virtual functions,
|
||||
// then the TU that contains an implementation of said function gets the vtable,
|
||||
// and we know that eggController.cpp contains the vtable and the functions below
|
||||
/* vt 0x30 | 80499660 */ virtual void beginFrame(void *padStatus); // Really needs to be PADStatus
|
||||
/* vt 0x34 | 80499a60 */ virtual void endFrame();
|
||||
/* vt 0x30 */ virtual void beginFrame(PADStatus *padStatus);
|
||||
/* vt 0x34 */ virtual void endFrame();
|
||||
|
||||
public:
|
||||
/* 0x004 */ s32 mChannelID;
|
||||
/* 0x008 */ u32 mButtonHeld; // these fields may need a slight amount of work
|
||||
/* 0x008 */ u32 mButtonHeld;
|
||||
/* 0x00C */ u32 mButtonTriggered;
|
||||
/* 0x010 */ u32 mButtonReleased;
|
||||
/* 0x014 */ u32 field_0x14;
|
||||
/* 0x018 */ CoreStatus coreStatus[16];
|
||||
/* 0xf18 */ int mKPADResult;
|
||||
/* 0x018 */ CoreStatus mCoreStatus[16];
|
||||
/* 0xf18 */ int mReadStatusIdx;
|
||||
/* 0xf1c */ TBitFlag<u8> mFlag;
|
||||
/* 0xf20 */ Vector3f mAccel;
|
||||
/* 0xf2c */ Vector2f mDpdPos;
|
||||
/* 0xf34 */ u32 field_0xf28;
|
||||
/* 0xf34 */ u32 mIdleTime;
|
||||
/* 0xf38 */ u32 mMotorPattern;
|
||||
/* 0xf3c */ bool mEnableMotor;
|
||||
/* 0xf40 */ s32 mMotorFrameDuration;
|
||||
@@ -114,67 +158,79 @@ public:
|
||||
/* 0xf48 */ ControllerRumbleMgr *mRumbleMgr;
|
||||
/* 0xf4c */ Matrix34f mPostureMatrix;
|
||||
/* 0xf7c */ Matrix34f mPostureMatrixPrev;
|
||||
/* 0xfac */ TBitFlag<u8> mAccelFlags;
|
||||
/* 0xfac */ TBitFlag<u8> mAccelFlags; // May not be TBitFlag?
|
||||
/* 0xfb0 */ s32 mMaxAccelFrameTime;
|
||||
/* 0xfb4 */ s32 mAccelFrameTimeX;
|
||||
/* 0xfb8 */ s32 mAccelFrameTimeY;
|
||||
/* 0xfbc */ s32 mAccelFrameTimeZ;
|
||||
/* 0xfb4 */ s32 mAccelFrameTime[3];
|
||||
/* 0xfc0 */ f32 mMaxAccelDiff;
|
||||
/* 0xfc4 */ Vector3f mPrevAccel;
|
||||
|
||||
public:
|
||||
/* 80499050 */ CoreController();
|
||||
/* 804990b0 */ void sceneReset();
|
||||
/* 80499170 */ Vector2f getDpdRawPos() const;
|
||||
/* 80499190 */ s32 getDpdDistance() const;
|
||||
/* 804991a0 */ void startMotor();
|
||||
/* 804991b0 */ void stopMotor();
|
||||
/* 804991c0 */ void createRumbleMgr(u8);
|
||||
/* 80499220 */ void startPatternRumble(const char *, int, bool);
|
||||
/* 80499240 */ void stopRumbleMgr();
|
||||
/* 80499260 */ CoreStatus *getCoreStatus(s32 idx);
|
||||
/* 80499270 */ void calc_posture_matrix(Matrix34f &mat, bool);
|
||||
/* 80499ac0 */ f32 getFreeStickX() const;
|
||||
/* 80499ae0 */ f32 getFreeStickY() const;
|
||||
CoreController();
|
||||
void sceneReset();
|
||||
Vector2f getDpdRawPos();
|
||||
f32 getDpdDistance();
|
||||
s32 getDpdValidFlag(); // Name Assumed. BBA hints at variable
|
||||
void startMotor();
|
||||
void stopMotor();
|
||||
void createRumbleMgr(u8);
|
||||
void startPatternRumble(const char *, int, bool);
|
||||
void stopRumbleMgr();
|
||||
CoreStatus *getCoreStatus(int idx);
|
||||
void calc_posture_matrix(Matrix34f &mat, bool);
|
||||
f32 getFreeStickX() const;
|
||||
f32 getFreeStickY() const;
|
||||
|
||||
const Vector3f &getAccel() const {
|
||||
return mCoreStatus[0].getAccel();
|
||||
}
|
||||
|
||||
// Guess ?
|
||||
bool isStable(u8 p1) const {
|
||||
return (mAccelFlags.getDirect() & p1) == p1;
|
||||
}
|
||||
};
|
||||
|
||||
class CoreControllerMgr {
|
||||
public:
|
||||
struct T__Disposer : Disposer {
|
||||
/* vt 0x08 | 80499b00 */ virtual ~T__Disposer();
|
||||
/* 805767ac */ static T__Disposer *sStaticDisposer;
|
||||
/* vt 0x08 */ virtual ~T__Disposer();
|
||||
static T__Disposer *sStaticDisposer;
|
||||
};
|
||||
// Disposer Vtable: 8056ec40
|
||||
/* 0x0000 */ T__Disposer mDisposer; // for the static T__Disposer
|
||||
/* 0x0000 */ T__Disposer mDisposer;
|
||||
|
||||
struct UnkField0x10A0 {
|
||||
virtual void v_08(UNKTYPE *);
|
||||
};
|
||||
|
||||
public:
|
||||
// 0x0010 vtable | 8056ebf8
|
||||
/* vt 0x08 | 8049a130 */ virtual void beginFrame();
|
||||
/* vt 0x0C | 8049a1e0 */ virtual void endFrame();
|
||||
// 0x0010 vtable
|
||||
/* vt 0x08 */ virtual void beginFrame();
|
||||
/* vt 0x0C */ virtual void endFrame();
|
||||
|
||||
public:
|
||||
/* 0x0014 */ TBuffer<CoreController *> mControllers;
|
||||
/* 0x0020 */ u8 field_0x20[0x10a0 - 0x0020];
|
||||
/* 0x10A0 */ u32 field_0x10A0;
|
||||
/* 0x10A0 */ UnkField0x10A0 *field_0x10A0;
|
||||
/* 0x10A4 */ TBuffer<eCoreDevType> mDevTypes;
|
||||
/* 0x10b0 */ u8 field_0x10B0[0x10e0 - 0x10b0];
|
||||
|
||||
public:
|
||||
/* 80499b80 */ static CoreControllerMgr *createInstance();
|
||||
/* 80499bd0 */ static void deleteInstance();
|
||||
/* 80499be0 */ CoreController *getNthController(int);
|
||||
static CoreControllerMgr *createInstance();
|
||||
static void deleteInstance();
|
||||
CoreController *getNthController(int);
|
||||
|
||||
static void *allocThunk(size_t size);
|
||||
static int deleteThunk(void *ptr);
|
||||
|
||||
/* 80499cd0 */ static void connectCallback(s32, s32);
|
||||
/* 80499d10 */ CoreControllerMgr();
|
||||
static void connectCallback(s32, s32);
|
||||
CoreControllerMgr();
|
||||
|
||||
public:
|
||||
/* 805767a8 */ static CoreControllerMgr *sInstance;
|
||||
/* 805767b0 */ static CoreController *(*sCoreControllerFactory)();
|
||||
/* 805767b4 */ static ConnectCallback sConnectCallback;
|
||||
/* 805767b8 */ static bool sUseBuiltinWpadAllocator;
|
||||
// /* 805767bc */ static sAllocator; // defined in cpp file
|
||||
static CoreControllerMgr *sInstance;
|
||||
static CoreController *(*sCoreControllerFactory)();
|
||||
static ConnectCallback sConnectCallback;
|
||||
static bool sUseBuiltinWpadAllocator;
|
||||
static s32 sWPADWorkSize;
|
||||
};
|
||||
|
||||
class NullController : public CoreController {
|
||||
@@ -188,11 +244,11 @@ public:
|
||||
|
||||
class ControllerRumbleUnit {
|
||||
public:
|
||||
// 0x00 vtable | 8056ebb4
|
||||
// 0x00 vtable
|
||||
inline ControllerRumbleUnit() : mFlag(0) {
|
||||
init();
|
||||
}
|
||||
/* vt 0x08 | 8049a8e0 */ virtual ~ControllerRumbleUnit() {}
|
||||
/* vt 0x08 */ virtual ~ControllerRumbleUnit() {}
|
||||
|
||||
public:
|
||||
/* 0x04 */ const char *mPattern;
|
||||
@@ -204,15 +260,15 @@ public:
|
||||
/* 0x1C */ nw4r::ut::Node mNode;
|
||||
/* 0x24 */ u32 field_0x24; // could just be part of the node (List)
|
||||
public:
|
||||
/* 8049a3b0 */ void init();
|
||||
/* 8049a3e0 */ void startPattern(const char *patter, int);
|
||||
/* 8049a440 */ f32 calc();
|
||||
void init();
|
||||
void startPattern(const char *patter, int);
|
||||
f32 calc();
|
||||
};
|
||||
|
||||
class ControllerRumbleMgr {
|
||||
public:
|
||||
// 0x00 vtable | 8056eba8
|
||||
/* vt 0x08 | 8049a8a0 */ virtual ~ControllerRumbleMgr() {}
|
||||
// 0x00 vtable
|
||||
/* vt 0x08 */ virtual ~ControllerRumbleMgr() {}
|
||||
|
||||
public:
|
||||
/* 0x04 */ nw4r::ut::List mActiveUnitList;
|
||||
@@ -220,12 +276,12 @@ public:
|
||||
/* 0x1C */ CoreController *mController;
|
||||
|
||||
public:
|
||||
/* 8049a530 */ ControllerRumbleMgr();
|
||||
/* 8049a590 */ void createUnit(u8 numUnits, CoreController *controller);
|
||||
/* 8049a620 */ void stop();
|
||||
/* 8049a690 */ void calc();
|
||||
/* 8049a7a0 */ void startPattern(const char *pattern, int, bool);
|
||||
/* 8049a7f0 */ ControllerRumbleUnit *getUnitFromList(bool bGrabActive);
|
||||
ControllerRumbleMgr();
|
||||
void createUnit(u8 numUnits, CoreController *controller);
|
||||
void stop();
|
||||
void calc();
|
||||
void startPattern(const char *pattern, int, bool);
|
||||
ControllerRumbleUnit *getUnitFromList(bool bGrabActive);
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
#ifndef EGG_STREAM_DECOMP_H
|
||||
#define EGG_STREAM_DECOMP_H
|
||||
|
||||
#include "rvl/CX/cx.h"
|
||||
#include <common.h>
|
||||
|
||||
// NOTE: I put StreamDecomp stuff here. im unsure of the correct place
|
||||
|
||||
namespace EGG {
|
||||
class StreamDecomp {
|
||||
public:
|
||||
/* vt 0x08 */ virtual bool init(void *dest, u32 maxCompressedSize);
|
||||
/* vt 0x0C */ virtual bool decomp(const void *src, u32 len);
|
||||
/* vt 0x10 */ virtual u32 getHeaderSize();
|
||||
/* vt 0x14 */ virtual u32 getUncompressedSize(const void *src);
|
||||
|
||||
public:
|
||||
/* 0x04 */ void *dest;
|
||||
/* 0x08 */ u32 maxCompressedSize;
|
||||
};
|
||||
|
||||
class StreamDecompLZ : public StreamDecomp {
|
||||
public:
|
||||
/* vt 0x08 | 80494c80 */ virtual bool init(void *dest, u32 maxCompressedSize);
|
||||
/* vt 0x0C | 80494cb0 */ virtual bool decomp(const void *src, u32 len);
|
||||
/* vt 0x10 | 804952c0 */ virtual u32 getHeaderSize();
|
||||
/* vt 0x14 | 804952b0 */ virtual u32 getUncompressedSize(const void *src);
|
||||
|
||||
public:
|
||||
/* 0x0C */ CXUncompContextLZ context;
|
||||
};
|
||||
class StreamDecompRL : public StreamDecomp {
|
||||
public:
|
||||
/* vt 0x08 | 80494ce0 */ virtual bool init(void *dest, u32 maxCompressedSize);
|
||||
/* vt 0x0C | 80494d10 */ virtual bool decomp(const void *src, u32 len);
|
||||
/* vt 0x10 | 804952a0 */ virtual u32 getHeaderSize();
|
||||
/* vt 0x14 | 80495290 */ virtual u32 getUncompressedSize(const void *src);
|
||||
|
||||
public:
|
||||
/* 0x0C */ CXUncompContextRL context;
|
||||
};
|
||||
|
||||
class StreamDecompLH : public StreamDecomp {
|
||||
public:
|
||||
/* vt 0x08 | 80494d40 */ virtual bool init(void *dest, u32 maxCompressedSize);
|
||||
/* vt 0x0C | 80494d70 */ virtual bool decomp(const void *src, u32 len);
|
||||
/* vt 0x10 | 80495280 */ virtual u32 getHeaderSize();
|
||||
/* vt 0x14 | 80495270 */ virtual u32 getUncompressedSize(const void *src);
|
||||
|
||||
public:
|
||||
/* 0x0C */ CXUncompContextLH context;
|
||||
};
|
||||
class StreamDecompLRC : public StreamDecomp {
|
||||
public:
|
||||
/* vt 0x08 | 80494da0 */ virtual bool init(void *dest, u32 maxCompressedSize);
|
||||
/* vt 0x0C | 80494dd0 */ virtual bool decomp(const void *src, u32 len);
|
||||
/* vt 0x10 | 80495260 */ virtual u32 getHeaderSize();
|
||||
/* vt 0x14 | 80495250 */ virtual u32 getUncompressedSize(const void *src);
|
||||
|
||||
public:
|
||||
/* 0x0C */ CXUncompContextLRC context;
|
||||
};
|
||||
class StreamDecompSZS : public StreamDecomp {
|
||||
public:
|
||||
/* vt 0x08 | 804951d0 */ virtual bool init(void *dest, u32 maxCompressedSize);
|
||||
/* vt 0x0C | 80495200 */ virtual bool decomp(const void *src, u32 len);
|
||||
/* vt 0x10 | 80495240 */ virtual u32 getHeaderSize();
|
||||
/* vt 0x14 | 80495230 */ virtual u32 getUncompressedSize(const void *src);
|
||||
|
||||
private:
|
||||
// NON-OFFICIAL
|
||||
struct SZSCompContext {
|
||||
u8 _[0x14];
|
||||
/* 80494e00 */ static u32 getUncompressedSize(const void *src);
|
||||
/* 80494e30 */ void init(u32 maxCompSize);
|
||||
/* 80494e60 */ static int readSzsHeader(/* unk params*/);
|
||||
/* 80494f60 */ void *decomp(const void *src, u32 len);
|
||||
};
|
||||
|
||||
public:
|
||||
/* 0x0C */ SZSCompContext context;
|
||||
};
|
||||
} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -6,29 +6,33 @@
|
||||
#include "egg/prim/eggBitFlag.h"
|
||||
#include "nw4r/ut.h"
|
||||
#include "rvl/VI.h"
|
||||
#include <common.h>
|
||||
|
||||
/* 80497530 */ // void PreRetraceCallback(void);
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class Display {
|
||||
public:
|
||||
enum EFlagBits { mFlag_SetClear, mFlag_WaitForRetrace };
|
||||
enum EFlagBits {
|
||||
mFlag_SetClear,
|
||||
mFlag_WaitForRetrace
|
||||
};
|
||||
/* 0x00*/ TBitFlag<u8> mFlag;
|
||||
enum EScreenStateBits {
|
||||
mScreenStateFlag_SetBlack
|
||||
};
|
||||
|
||||
public:
|
||||
// vtable at 0x04 | 8056eac8
|
||||
/* vt 0x08 | 80497600 */ virtual void beginFrame();
|
||||
/* vt 0x0C | 804976c0 */ virtual void beginRender();
|
||||
/* vt 0x10 | 804976d0 */ virtual void endRender();
|
||||
/* vt 0x14 | 804976e0 */ virtual void endFrame();
|
||||
/* vt 0x18 | 804975f0 */ virtual u32 getTickPerFrame();
|
||||
/* vt 0x1C | 804976f0 */ virtual void preVRetrace();
|
||||
// vtable at 0x04
|
||||
/* vt 0x08 */ virtual void beginFrame();
|
||||
/* vt 0x0C */ virtual void beginRender();
|
||||
/* vt 0x10 */ virtual void endRender();
|
||||
/* vt 0x14 */ virtual void endFrame();
|
||||
/* vt 0x18 */ virtual u32 getTickPerFrame();
|
||||
/* vt 0x1C */ virtual void preVRetrace();
|
||||
|
||||
public:
|
||||
/* 0x08 */ u8 mMaxRetraces;
|
||||
enum EScreenStateBits { mScreenStateFlag_SetBlack };
|
||||
/* 0x09 */ TBitFlag<u8> mScreenStateFlag;
|
||||
/* 0x0C */ u32 mRetraceCount;
|
||||
/* 0x10 */ u32 mFrameCount;
|
||||
@@ -40,13 +44,13 @@ public:
|
||||
/* 0x28 */ f32 mFrequency;
|
||||
|
||||
public:
|
||||
/* 80497570 */ Display(u8 maxRetrace);
|
||||
/* 804977d0 */ void copyEFBtoXFB();
|
||||
/* 80497870 */ void calcFrequency();
|
||||
/* inline */ void setBlack(bool b) {}
|
||||
Display(u8 maxRetrace);
|
||||
void copyEFBtoXFB();
|
||||
void calcFrequency();
|
||||
void setBlack(bool b) {}
|
||||
|
||||
public:
|
||||
/* 80497900 */ static u32 sTickPeriod;
|
||||
static u32 sTickPeriod;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -4,19 +4,22 @@
|
||||
// This file was adapted from https://github.com/riidefi/mkw/blob/master/source/egg/core/eggDisposer.hpp
|
||||
|
||||
#include "nw4r/ut.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class Heap;
|
||||
class Disposer : private NonCopyable {
|
||||
|
||||
public:
|
||||
/* vt 0x08 | 80496890 */ virtual ~Disposer();
|
||||
/* vt 0x08 */ virtual ~Disposer();
|
||||
/* 80496830 */ Disposer();
|
||||
|
||||
public:
|
||||
enum eLifetime { LIFETIME_UNMANAGED, LIFETIME_HEAP_GC };
|
||||
enum eLifetime {
|
||||
LIFETIME_UNMANAGED,
|
||||
LIFETIME_HEAP_GC
|
||||
};
|
||||
inline eLifetime getLifetime() const {
|
||||
return mContainHeap != nullptr ? LIFETIME_HEAP_GC : LIFETIME_UNMANAGED;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "nw4r/ut.h"
|
||||
#include "rvl/DVD.h"
|
||||
#include "rvl/OS.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
@@ -28,24 +29,25 @@ public:
|
||||
/* 0xc8 */ nw4r::ut::Node mNode;
|
||||
|
||||
public:
|
||||
/* vt 0x08 | 804942f0 */ virtual ~DvdFile();
|
||||
/* vt 0x0C | 80494450 */ virtual bool open(const char *path);
|
||||
/* vt 0x10 | 804944b0 */ virtual void close();
|
||||
/* vt 0x14 | 80494510 */ virtual s32 readData(void *buffer, s32 length, s32 offset);
|
||||
/* vt 0x18 | 804945e0 */ virtual s32 writeData(const void *buffer, s32 length, s32 offset);
|
||||
/* vt 0x1C | 80494670 */ virtual u32 getFileSize() const;
|
||||
/* vt 0x20 | 804943d0 */ virtual bool open(s32 entryNum);
|
||||
/* vt 0x24 | 804944a0 */ virtual bool open(const char *path, void *);
|
||||
/* vt 0x08 */ virtual ~DvdFile();
|
||||
/* vt 0x0C */ virtual bool open(const char *path);
|
||||
/* vt 0x10 */ virtual void close();
|
||||
/* vt 0x14 */ virtual s32 readData(void *buffer, s32 length, s32 offset);
|
||||
/* vt 0x18 */ virtual s32 writeData(const void *buffer, s32 length, s32 offset);
|
||||
/* vt 0x1C */ virtual u32 getFileSize() const;
|
||||
/* vt 0x20 */ virtual bool open(s32 entryNum);
|
||||
/* vt 0x24 */ virtual bool open(const char *path, void *);
|
||||
|
||||
public:
|
||||
/* 804942a0 */ DvdFile();
|
||||
/* 80494360 */ void initiate();
|
||||
/* 804945f0 */ s32 sync();
|
||||
/* 80494650 */ static void doneProcess(s32 result, DVDFileInfo *fileInfo);
|
||||
void initialize();
|
||||
DvdFile();
|
||||
void initiate();
|
||||
s32 sync();
|
||||
static void doneProcess(s32 result, DVDFileInfo *fileInfo);
|
||||
|
||||
public:
|
||||
/* 80576730 */ static bool sIsInitialized;
|
||||
/* 80673ad8 */ static nw4r::ut::List sDvdList;
|
||||
private:
|
||||
static bool sIsInitialized;
|
||||
static nw4r::ut::List sDvdList;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -1,30 +1,52 @@
|
||||
#ifndef EGG_DVD_RIPPER_H
|
||||
#define EGG_DVD_RIPPER_H
|
||||
|
||||
#include "egg/core/eggDecomp.h"
|
||||
#include "egg/core/eggDvdFile.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "egg/core/eggStreamDecomp.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class DvdRipper {
|
||||
public:
|
||||
enum EAllocDirection { ALLOC_CIR_PAD, ALLOC_DIR_TOP, ALLOC_DIR_BOTTOM };
|
||||
enum EAllocDirection {
|
||||
ALLOC_CIR_PAD,
|
||||
ALLOC_DIR_TOP,
|
||||
ALLOC_DIR_BOTTOM
|
||||
};
|
||||
|
||||
struct UnkCallback_Arg {
|
||||
u8 UNK_0x00[4];
|
||||
u32 UNK_0x04;
|
||||
u32 UNK_0x08;
|
||||
u32 UNK_0x0C;
|
||||
u32 UNK_0x10;
|
||||
void *buf;
|
||||
};
|
||||
typedef void (*UnkCallback)(void *);
|
||||
|
||||
public:
|
||||
/* 80494680 */ static u8 *loadToMainRAM(s32 entryNum, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset,
|
||||
u32 *amountRead, u32 *fileSize);
|
||||
/* 80494730 */ static u8 *loadToMainRAM(const char *path, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset,
|
||||
u32 *amountRead, u32 *fileSize);
|
||||
/* 804947e0 */ static u8 *loadToMainRAM(DvdFile *file, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset,
|
||||
u32 *amountRead, u32 *fileSize);
|
||||
/* 804949b0 */ static void *loadToMainRAMDecomp(DvdFile *file, StreamDecomp *decompressor, u8 *dst, Heap *heap,
|
||||
EAllocDirection allocDir, s32 offset, u32 size, u32 maxChunkSize, u32 *amountRead, u32 *fileSize);
|
||||
static u8 *
|
||||
loadToMainRAM(s32 entryNum, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize);
|
||||
|
||||
static u8 *loadToMainRAM(
|
||||
const char *path, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize
|
||||
);
|
||||
|
||||
static u8 *loadToMainRAM(
|
||||
DvdFile *pFile, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize
|
||||
);
|
||||
|
||||
static void *loadToMainRAMDecomp(
|
||||
DvdFile *pFile, StreamDecomp *decompressor, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, s32 offset,
|
||||
u32 size, u32 chunkSize, u32 *pRead, u32 *fileSize
|
||||
);
|
||||
|
||||
public:
|
||||
/* 80574ed0 */ static bool sErrorRetry;
|
||||
/* */ // static sCallback;
|
||||
static bool sErrorRetry;
|
||||
static UnkCallback sCallback;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -2,29 +2,30 @@
|
||||
#define EGG_EXP_HEAP_H
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class ExpHeap : public Heap {
|
||||
public:
|
||||
// vtable at 0x0 | 8056e980
|
||||
/* vt 0x08 | 80495af0 */ virtual ~ExpHeap();
|
||||
/* vt 0x0C | 80495f90 */ virtual eHeapKind getHeapKind() const;
|
||||
/* vt 0x14 | 80495d90 */ virtual void *alloc(u32 size, s32 align);
|
||||
/* vt 0x18 | 80495e50 */ virtual void free(void *block);
|
||||
/* vt 0x1C | 80495d00 */ virtual void destroy();
|
||||
/* vt 0x20 | 80495ec0 */ virtual u32 resizeForMBlock(void *block, u32 size);
|
||||
/* vt 0x24 | 80495ed0 */ virtual u32 getTotalFreeSize();
|
||||
/* vt 0x28 | 80495ee0 */ virtual u32 getAllocatableSize(s32 align);
|
||||
/* vt 0x2C | 80495f00 */ virtual u32 adjust();
|
||||
// vtable at 0x0
|
||||
/* vt 0x08 */ virtual ~ExpHeap();
|
||||
/* vt 0x0C */ virtual eHeapKind getHeapKind() const override;
|
||||
/* vt 0x14 */ virtual void *alloc(u32 size, s32 align) override;
|
||||
/* vt 0x18 */ virtual void free(void *block) override;
|
||||
/* vt 0x1C */ virtual void destroy() override;
|
||||
/* vt 0x20 */ virtual u32 resizeForMBlock(void *block, u32 size) override;
|
||||
/* vt 0x24 */ virtual u32 getTotalFreeSize() override;
|
||||
/* vt 0x28 */ virtual u32 getAllocatableSize(s32 align) override;
|
||||
/* vt 0x2C */ virtual u32 adjust() override;
|
||||
|
||||
public:
|
||||
/* 80495ab0 */ ExpHeap(MEMiHeapHead *heapHead);
|
||||
/* 80495b70 */ static ExpHeap *create(void *block, size_t size, u16 attr);
|
||||
/* 80495c30 */ static ExpHeap *create(size_t size, Heap *heap, u16 attr);
|
||||
/* 80495d00 */ void setGroupID(u16 groupId);
|
||||
/* 80495f80 */ static u32 getSizeForMBlock(const void *block);
|
||||
ExpHeap(MEMiHeapHead *heapHead);
|
||||
static ExpHeap *create(void *block, size_t size, u16 attr);
|
||||
static ExpHeap *create(size_t size, Heap *heap, u16 attr);
|
||||
void setGroupID(u16 groupId);
|
||||
static u32 getSizeForMBlock(const void *block);
|
||||
|
||||
// Placement new for ::create
|
||||
inline void *operator new(size_t size, void *ptr) {
|
||||
|
||||
@@ -16,12 +16,12 @@ public:
|
||||
|
||||
public:
|
||||
// vtable at 0x00
|
||||
/* vt 0x08 | 00000000 */ virtual void setStatus(EStatus) = 0;
|
||||
/* vt 0x0C | 00000000 */ virtual EStatus getStatus() const = 0;
|
||||
/* vt 0x10 | 00000000 */ virtual bool fadeIn() = 0;
|
||||
/* vt 0x14 | 00000000 */ virtual bool fadeOut() = 0;
|
||||
/* vt 0x18 | 00000000 */ virtual bool calc() = 0;
|
||||
/* vt 0x1C | 00000000 */ virtual void draw() = 0;
|
||||
/* vt 0x08 */ virtual void setStatus(EStatus) = 0;
|
||||
/* vt 0x0C */ virtual EStatus getStatus() const = 0;
|
||||
/* vt 0x10 */ virtual bool fadeIn() = 0;
|
||||
/* vt 0x14 */ virtual bool fadeOut() = 0;
|
||||
/* vt 0x18 */ virtual bool calc() = 0;
|
||||
/* vt 0x1C */ virtual void draw() = 0;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -2,29 +2,30 @@
|
||||
#define EGG_FRM_HEAP_H
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class FrmHeap : public Heap {
|
||||
public:
|
||||
// vtable at 0x0 | 8056e9d0
|
||||
/* vt 0x08 | 80495fe0 */ virtual ~FrmHeap();
|
||||
/* vt 0x0C | 80496390 */ virtual eHeapKind getHeapKind() const;
|
||||
/* vt 0x14 | 804961c0 */ virtual void *alloc(u32 size, s32 align);
|
||||
/* vt 0x18 | 80496250 */ virtual void free(void *block);
|
||||
/* vt 0x1C | 80496130 */ virtual void destroy();
|
||||
/* vt 0x20 | 804962b0 */ virtual u32 resizeForMBlock(void *block, u32 size);
|
||||
/* vt 0x24 | 804962c0 */ virtual u32 getTotalFreeSize();
|
||||
/* vt 0x28 | 804962e0 */ virtual u32 getAllocatableSize(s32 align);
|
||||
/* vt 0x2C | 804962f0 */ virtual u32 adjust();
|
||||
// vtable at 0x0
|
||||
virtual ~FrmHeap();
|
||||
virtual eHeapKind getHeapKind() const override;
|
||||
virtual void *alloc(u32 size, s32 align) override;
|
||||
virtual void free(void *block) override;
|
||||
virtual void destroy() override;
|
||||
virtual u32 resizeForMBlock(void *block, u32 size) override;
|
||||
virtual u32 getTotalFreeSize() override;
|
||||
virtual u32 getAllocatableSize(s32 align) override;
|
||||
virtual u32 adjust() override;
|
||||
|
||||
public:
|
||||
/* 80495fa0 */ FrmHeap(MEMiHeapHead *heapHead);
|
||||
/* 80496060 */ static FrmHeap *create(void *block, size_t size, u16 attr);
|
||||
/* 804962a0 */ void free(s32 flags);
|
||||
/* 80496370 */ void recordState(u32 id); // non official for now
|
||||
/* 80496380 */ void freeState(u32 id); // non official for now
|
||||
FrmHeap(MEMiHeapHead *heapHead);
|
||||
static FrmHeap *create(void *block, u32 size, u16 attr);
|
||||
void free(s32 flags);
|
||||
void recordState(u32 id);
|
||||
void freeByState(u32 id);
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
#define EGG_GRAPHICS_FIFO_H
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class GraphicsFifo {
|
||||
public:
|
||||
// vtable 0x00 | 8056eb80
|
||||
/* vt 0x08 | 80498e90*/ virtual ~GraphicsFifo();
|
||||
// vtable 0x00
|
||||
/* vt 0x08 */ virtual ~GraphicsFifo();
|
||||
|
||||
public:
|
||||
/* 0x04 */ void *mGxInitData;
|
||||
@@ -17,12 +18,12 @@ public:
|
||||
/* 0x0C */ u32 mBufSize;
|
||||
|
||||
public:
|
||||
/* 80498e20 */ static void create(u32 size, Heap *heap);
|
||||
/* 80498f30 */ GraphicsFifo(u32 size, Heap *heap);
|
||||
static void create(u32 size, Heap *heap);
|
||||
GraphicsFifo(u32 size, Heap *heap);
|
||||
|
||||
public:
|
||||
/* 80576798 */ static GraphicsFifo *sGraphicsFifo;
|
||||
/* 8057679c */ static u8 sGpStatus[5];
|
||||
static GraphicsFifo *sGraphicsFifo;
|
||||
static u8 sGpStatus[5];
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
+42
-41
@@ -9,6 +9,7 @@
|
||||
#include "nw4r/ut.h"
|
||||
#include "rvl/MEM.h"
|
||||
#include "rvl/OS.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
@@ -54,17 +55,17 @@ public:
|
||||
HEAP_KIND_UNIT,
|
||||
HEAP_KIND_ASSERT,
|
||||
};
|
||||
// vtable at 0x0 | 8056e950
|
||||
/* vt 0x08 | 804954c0 */ virtual ~Heap();
|
||||
/* vt 0x0C | 00000000 */ virtual eHeapKind getHeapKind() const = 0;
|
||||
/* vt 0x10 | 80495a40 */ virtual void initAllocator(Allocator *allocator, s32 align);
|
||||
/* vt 0x14 | 00000000 */ virtual void *alloc(u32 size, s32 align) = 0;
|
||||
/* vt 0x18 | 00000000 */ virtual void free(void *block) = 0;
|
||||
/* vt 0x1C | 00000000 */ virtual void destroy() = 0;
|
||||
/* vt 0x20 | 00000000 */ virtual u32 resizeForMBlock(void *block, u32 size) = 0;
|
||||
/* vt 0x24 | 00000000 */ virtual u32 getTotalFreeSize() = 0;
|
||||
/* vt 0x28 | 00000000 */ virtual u32 getAllocatableSize(s32 align) = 0;
|
||||
/* vt 0x2C | 00000000 */ virtual u32 adjust() = 0;
|
||||
// vtable at 0x0
|
||||
/* vt 0x08 */ virtual ~Heap();
|
||||
/* vt 0x0C */ virtual eHeapKind getHeapKind() const = 0;
|
||||
/* vt 0x10 */ virtual void initAllocator(Allocator *allocator, s32 align);
|
||||
/* vt 0x14 */ virtual void *alloc(u32 size, s32 align) = 0;
|
||||
/* vt 0x18 */ virtual void free(void *block) = 0;
|
||||
/* vt 0x1C */ virtual void destroy() = 0;
|
||||
/* vt 0x20 */ virtual u32 resizeForMBlock(void *block, u32 size) = 0;
|
||||
/* vt 0x24 */ virtual u32 getTotalFreeSize() = 0;
|
||||
/* vt 0x28 */ virtual u32 getAllocatableSize(s32 align) = 0;
|
||||
/* vt 0x2C */ virtual u32 adjust() = 0;
|
||||
|
||||
public:
|
||||
void setName(const char *name) {
|
||||
@@ -94,18 +95,18 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
/* 804953f0 */ static void initialize();
|
||||
/* 80495430 */ Heap(MEMiHeapHead *heapHandle);
|
||||
/* 80495690 */ static Heap *findHeap(MEMiHeapHead *heapHandle);
|
||||
/* 80495730 */ Heap *findParentHeap();
|
||||
/* 80495780 */ static Heap *findContainHeap(const void *memBlock);
|
||||
/* 80495560 */ static void *alloc(size_t size, int align, Heap *heap);
|
||||
/* 804957c0 */ static void free(void *memBlock, Heap *heap);
|
||||
/* 80495830 */ void dispose();
|
||||
/* 804958a0 */ void dump();
|
||||
/* 804958b0 */ static void dumpAll();
|
||||
/* 804959a0 */ Heap *becomeCurrentHeap();
|
||||
/* 80495a00 */ Heap *_becomeCurrentHeapWithoutLock();
|
||||
static void initialize();
|
||||
Heap(MEMiHeapHead *heapHandle);
|
||||
static Heap *findHeap(MEMiHeapHead *heapHandle);
|
||||
Heap *findParentHeap();
|
||||
static Heap *findContainHeap(const void *memBlock);
|
||||
static void *alloc(size_t size, int align, Heap *heap);
|
||||
static void free(void *memBlock, Heap *heap);
|
||||
void dispose();
|
||||
void dump();
|
||||
static void dumpAll();
|
||||
Heap *becomeCurrentHeap();
|
||||
Heap *_becomeCurrentHeapWithoutLock();
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
@@ -177,26 +178,26 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 80673ae8 */ static nw4r::ut::List sHeapList;
|
||||
/* 80673af8 */ static OSMutex sRootMutex;
|
||||
/* 80576740 */ static Heap *sCurrentHeap;
|
||||
/* 80576744 */ static int sIsHeapListInitialized;
|
||||
/* 80576748 */ static Heap *sAllocatableHeap;
|
||||
/* 8057674c */ static ErrorCallback sErrorCallback;
|
||||
/* 80576750 */ static HeapAllocCallback sAllocCallback;
|
||||
/* 80576754 */ static HeapFreeCallback sFreeCallback;
|
||||
/* 80576758 */ static void *sErrorCallbackArg;
|
||||
/* 8057675c */ static void *sAllocCallbackArg;
|
||||
/* 80576760 */ static void *sFreeCallbackArg;
|
||||
/* 80576764 */ static HeapCreateCallback sCreateCallback;
|
||||
/* 80576764 */ static HeapDestroyCallback sDestroyCallback;
|
||||
static nw4r::ut::List sHeapList;
|
||||
static OSMutex sRootMutex;
|
||||
static Heap *sCurrentHeap;
|
||||
static int sIsHeapListInitialized;
|
||||
static Heap *sAllocatableHeap;
|
||||
static ErrorCallback sErrorCallback;
|
||||
static HeapAllocCallback sAllocCallback;
|
||||
static HeapFreeCallback sFreeCallback;
|
||||
static void *sErrorCallbackArg;
|
||||
static void *sAllocCallbackArg;
|
||||
static void *sFreeCallbackArg;
|
||||
static HeapCreateCallback sCreateCallback;
|
||||
static HeapDestroyCallback sDestroyCallback;
|
||||
};
|
||||
} // namespace EGG
|
||||
|
||||
/* 80495a60 */ void *operator new(size_t, void *p);
|
||||
/* 80495a70 */ void *operator new(size_t size, EGG::Heap *heap, int align = 4);
|
||||
/* 80495a80 */ void *operator new(size_t size, EGG::Allocator *alloc);
|
||||
/* 80495a90 */ void *operator new[](size_t size, int align);
|
||||
/* 80495aa0 */ void *operator new[](size_t size, EGG::Heap *heap, int align = 4);
|
||||
void *operator new(size_t, void *p);
|
||||
void *operator new(size_t size, EGG::Heap *heap, int align = 4);
|
||||
void *operator new(size_t size, EGG::Allocator *alloc);
|
||||
void *operator new[](size_t size, int align);
|
||||
void *operator new[](size_t size, EGG::Heap *heap, int align = 4);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
#ifndef EGG_STREAM_DECOMP_H
|
||||
#define EGG_STREAM_DECOMP_H
|
||||
|
||||
#include "rvl/CX/cx.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
// NOTE: I put StreamDecomp stuff here. im unsure of the correct place
|
||||
|
||||
namespace EGG {
|
||||
class StreamDecomp {
|
||||
public:
|
||||
/* vt 0x08 */ virtual bool init(void *pDest, u32 maxCompressedSize);
|
||||
/* vt 0x0C */ virtual bool decomp(const void *pSrc, u32 len);
|
||||
/* vt 0x10 */ virtual u32 getHeaderSize();
|
||||
/* vt 0x14 */ virtual u32 getUncompressedSize(const void *pSrc);
|
||||
|
||||
public:
|
||||
/* 0x04 */ void *mpDest;
|
||||
/* 0x08 */ u32 mMaxCompressedSize;
|
||||
};
|
||||
|
||||
class StreamDecompLZ : public StreamDecomp {
|
||||
public:
|
||||
virtual bool init(void *pDest, u32 maxCompressedSize) override;
|
||||
virtual bool decomp(const void *pSrc, u32 len) override;
|
||||
virtual u32 getHeaderSize() override {
|
||||
return 0x20;
|
||||
}
|
||||
virtual u32 getUncompressedSize(const void *pSrc) override {
|
||||
return CXGetUncompressedSize(pSrc);
|
||||
}
|
||||
|
||||
public:
|
||||
/* 0x0C */ CXUncompContextLZ mContext;
|
||||
};
|
||||
class StreamDecompRL : public StreamDecomp {
|
||||
public:
|
||||
virtual bool init(void *pDest, u32 maxCompressedSize) override;
|
||||
virtual bool decomp(const void *pSrc, u32 len) override;
|
||||
virtual u32 getHeaderSize() override {
|
||||
return 0x20;
|
||||
}
|
||||
virtual u32 getUncompressedSize(const void *pSrc) override {
|
||||
return CXGetUncompressedSize(pSrc);
|
||||
}
|
||||
|
||||
public:
|
||||
/* 0x0C */ CXUncompContextRL mContext;
|
||||
};
|
||||
|
||||
class StreamDecompLH : public StreamDecomp {
|
||||
public:
|
||||
virtual bool init(void *pDest, u32 maxCompressedSize) override;
|
||||
virtual bool decomp(const void *pSrc, u32 len) override;
|
||||
virtual u32 getHeaderSize() override {
|
||||
return 0x20;
|
||||
}
|
||||
virtual u32 getUncompressedSize(const void *pSrc) override {
|
||||
return CXGetUncompressedSize(pSrc);
|
||||
}
|
||||
|
||||
public:
|
||||
/* 0x0C */ CXUncompContextLH mContext;
|
||||
};
|
||||
class StreamDecompLRC : public StreamDecomp {
|
||||
public:
|
||||
virtual bool init(void *pDest, u32 maxCompressedSize) override;
|
||||
virtual bool decomp(const void *pSrc, u32 len) override;
|
||||
virtual u32 getHeaderSize() override {
|
||||
return 0x20;
|
||||
}
|
||||
virtual u32 getUncompressedSize(const void *pSrc) override {
|
||||
return CXGetUncompressedSize(pSrc);
|
||||
}
|
||||
|
||||
public:
|
||||
/* 0x0C */ CXUncompContextLRC mContext;
|
||||
};
|
||||
|
||||
// NON-OFFICIAL
|
||||
struct UncompContextSZS {
|
||||
/* 80494e00 */ static u32 getUncompressedSize(const void *pSrc);
|
||||
/* 80494e30 */ void initUncompContext(void *pDest);
|
||||
/* 80494e60 */ static s32
|
||||
readHeader(u8 *pHeaderLen, s32 *pUncompSize, const u8 *src, u32 maxCompLen, s32 maxUncompSize);
|
||||
/* 80494f60 */ s32 readUncomp(const void *pSrca, u32 len);
|
||||
|
||||
/* 0x00 */ u8 *mpDest;
|
||||
/* 0x04 */ s32 mUncompSize;
|
||||
/* 0x08 */ s32 mMaxUncompSize;
|
||||
/* 0x0C */ u8 mGroupHead;
|
||||
/* 0x0D */ u8 mSecondByte;
|
||||
/* 0x0E */ u8 mFirstByte;
|
||||
/* 0x0F */ u8 mState;
|
||||
/* 0x10 */ u16 mCopySrc;
|
||||
/* 0x12 */ u8 mHeaderLen;
|
||||
};
|
||||
|
||||
class StreamDecompSZS : public StreamDecomp {
|
||||
public:
|
||||
virtual bool init(void *pDest, u32 maxCompressedSize) override;
|
||||
virtual bool decomp(const void *pSrc, u32 len) override;
|
||||
virtual u32 getHeaderSize() override {
|
||||
return 0x20;
|
||||
}
|
||||
virtual u32 getUncompressedSize(const void *pSrc) override {
|
||||
return mContext.getUncompressedSize(pSrc);
|
||||
}
|
||||
|
||||
public:
|
||||
/* 0x0C */ UncompContextSZS mContext;
|
||||
};
|
||||
} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
#define EGG_SYSTEM_H
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
@@ -12,19 +13,19 @@ class Video;
|
||||
|
||||
class ConfigurationData {
|
||||
public:
|
||||
// vtable at 0x0 | 8056ea8c
|
||||
/* vt 0x08 | 00000000 */ virtual Video *getVideo() = 0;
|
||||
/* vt 0x0C | 00000000 */ virtual Heap *getSystemHeap() = 0;
|
||||
/* vt 0x10 | 00000000 */ virtual Display *getDisplay() = 0;
|
||||
/* vt 0x14 | 00000000 */ virtual XfbManager *getXfbMgr() = 0;
|
||||
/* vt 0x18 | 00000000 */ virtual void getPerfView() = 0;
|
||||
/* vt 0x1C | 00000000 */ virtual void getScnMgr() = 0;
|
||||
/* vt 0x20 | 00000000 */ virtual void getAudioMgr() = 0;
|
||||
/* vt 0x24 | 800643d0 */ virtual void onBeginFrame();
|
||||
/* vt 0x28 | 80064430 */ virtual void onEndFrame();
|
||||
/* vt 0x2C | 80064ea0 */ virtual void initRenderMode();
|
||||
/* vt 0x30 | 80497170 */ virtual void initMemory();
|
||||
/* vt 0x34 | 804972f0 */ virtual void run();
|
||||
// vtable at 0x0
|
||||
/* vt 0x08 */ virtual Video *getVideo() = 0;
|
||||
/* vt 0x0C */ virtual Heap *getSystemHeap() = 0;
|
||||
/* vt 0x10 */ virtual Display *getDisplay() = 0;
|
||||
/* vt 0x14 */ virtual XfbManager *getXfbMgr() = 0;
|
||||
/* vt 0x18 */ virtual void getPerfView() = 0;
|
||||
/* vt 0x1C */ virtual void getScnMgr() = 0;
|
||||
/* vt 0x20 */ virtual void getAudioMgr() = 0;
|
||||
/* vt 0x24 */ virtual void onBeginFrame();
|
||||
/* vt 0x28 */ virtual void onEndFrame();
|
||||
/* vt 0x2C */ virtual void initRenderMode();
|
||||
/* vt 0x30 */ virtual void initMemory();
|
||||
/* vt 0x34 */ virtual void run();
|
||||
|
||||
public:
|
||||
/* 0x04 */ u32 mRoot1HeapStart;
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
};
|
||||
class BaseSystem {
|
||||
public:
|
||||
/* 80576780 */ static ConfigurationData *mConfigData;
|
||||
static ConfigurationData *mConfigData;
|
||||
static XfbManager *getXfbMgr() {
|
||||
return mConfigData->getXfbMgr();
|
||||
}
|
||||
|
||||
@@ -4,16 +4,19 @@
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "nw4r/ut.h"
|
||||
#include "rvl/OS.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class Thread {
|
||||
public: // vtable: 0x00 | 8056ea40
|
||||
/* 0x08 | 80496a60 */ virtual ~Thread();
|
||||
/* 0x0C | 80496dd0 */ virtual void *run() { return nullptr; }
|
||||
/* 0x10 | 800bd600 */ virtual void onEnter() {}
|
||||
/* 0x14 | 800bd5f0 */ virtual void onExit() {}
|
||||
public: // vtable: 0x00
|
||||
/* 0x08 */ virtual ~Thread();
|
||||
/* 0x0C */ virtual void *run() {
|
||||
return nullptr;
|
||||
}
|
||||
/* 0x10 */ virtual void onEnter() {}
|
||||
/* 0x14 */ virtual void onExit() {}
|
||||
|
||||
public:
|
||||
/* 0x04 */ Heap *mContainingHeap;
|
||||
@@ -30,18 +33,18 @@ public:
|
||||
/* 0x44 */ nw4r::ut::Node mLink;
|
||||
|
||||
public:
|
||||
/* 80496910 */ Thread(u32 stackSize, int msgCount, int priority, Heap *heap);
|
||||
/* 804969e0 */ Thread(OSThread *osThread, int msgCount);
|
||||
/* 80496b20 */ static Thread *findThread(OSThread *thread);
|
||||
/* 80496b90 */ static void initialize();
|
||||
/* 80496bd0 */ void setThreadCurrentHeap(Heap *heap);
|
||||
/* 80496c70 */ static void switchThreadCallback(OSThread *from, OSThread *to);
|
||||
/* 80496d60 */ void setCommonMesgQueue(int mesgCount, Heap *heap);
|
||||
/* 80496dc0 */ static void *start(void *thread);
|
||||
Thread(u32 stackSize, int msgCount, int priority, Heap *heap);
|
||||
Thread(OSThread *osThread, int msgCount);
|
||||
static Thread *findThread(OSThread *thread);
|
||||
static void initialize();
|
||||
void setThreadCurrentHeap(Heap *heap);
|
||||
static void switchThreadCallback(OSThread *from, OSThread *to);
|
||||
void setCommonMesgQueue(int mesgCount, Heap *heap);
|
||||
static void *start(void *thread);
|
||||
|
||||
public:
|
||||
/* 80673b10 */ static nw4r::ut::List sThreadList;
|
||||
/* 80576770 */ static void (*sOldSwitchThreadCallback)(OSThread *, OSThread *);
|
||||
static nw4r::ut::List sThreadList;
|
||||
static void (*sOldSwitchThreadCallback)(OSThread *, OSThread *);
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
#define EGG_UNK_H
|
||||
|
||||
#include "rvl/OS.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
|
||||
// This is seen in Animal Crossing: City Folk also. Idk where it belongs
|
||||
|
||||
// Seen between EGG::Thread and EGG::ConfigurationData (eggThread and eggSystem)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "egg/prim/eggBitFlag.h"
|
||||
#include "rvl/GX.h"
|
||||
#include "rvl/VI.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
@@ -20,15 +21,15 @@ public:
|
||||
/* 0x08 */ u32 mConfiguredTime;
|
||||
|
||||
public:
|
||||
/* inline */ Video() : pRenderMode(0), mFlag(), mConfiguredTime(){};
|
||||
/* 80498690 */ void initialize(GXRenderModeObj *, const RenderModeObjSet *);
|
||||
/* 804986f0 */ GXRenderModeObj *configure(GXRenderModeObj *, const RenderModeObjSet *);
|
||||
/* 80498800 */ static u32 getTickPerVRetrace(u32 tvFormat);
|
||||
/* 80498860 */ static u32 getTickPerVRetrace();
|
||||
/* 80498890 */ static const GXRenderModeObj *getStandardRenderModeObj(const RenderModeObjSet *);
|
||||
Video() : pRenderMode(0), mFlag(), mConfiguredTime(){};
|
||||
void initialize(GXRenderModeObj *, const RenderModeObjSet *);
|
||||
GXRenderModeObj *configure(GXRenderModeObj *, const RenderModeObjSet *);
|
||||
static u32 getTickPerVRetrace(u32 tvFormat);
|
||||
static u32 getTickPerVRetrace();
|
||||
static const GXRenderModeObj *getStandardRenderModeObj(const RenderModeObjSet *);
|
||||
|
||||
public:
|
||||
/* inline */ void setBlack(bool b) {
|
||||
void setBlack(bool b) {
|
||||
VISetBlack(!mFlag.onBit(0));
|
||||
mFlag.toggleBit(0);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define EGG_XFB_H
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
@@ -23,9 +24,10 @@ public:
|
||||
/* 0x0C */ Xfb *mNext; // idk the actual order, but they always link to each other
|
||||
/* 0x10 */ Xfb *mPrev; // idk the actual order, but they always link to each other
|
||||
public:
|
||||
/* 804989e0 */ void init(u16 width, u16 height, Heap *heap);
|
||||
/* 80498a60 */ Xfb(Heap *heap);
|
||||
/* 80498ad0 */ static u32 calcBufferSize(u16 width, u16 height);
|
||||
Xfb(Heap *heap);
|
||||
void init(u16 width, u16 height, Heap *heap);
|
||||
|
||||
static u32 calcBufferSize(u16 width, u16 height);
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define EGG_XFB_MANAGER_H
|
||||
|
||||
#include "egg/core/eggXfb.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
@@ -14,10 +15,10 @@ public:
|
||||
/* 0xC */ u8 mNumXfbs; // Total number of Xfbs ever attached
|
||||
/* 0xD */ u8 mNumXfbs_Copy; // Unsure of purpose yet, but showing wont proceed until its under 3
|
||||
public:
|
||||
/* 80498af0 */ bool isRegisterd(Xfb &xfb) const; // yes. this is correct spelling
|
||||
/* 80498b30 */ bool attach(Xfb *xfb);
|
||||
/* 80498c10 */ void copyEFB(bool);
|
||||
/* 80498d00 */ void setNextFrameBuffer();
|
||||
bool isRegisterd(Xfb &xfb) const; // yes. this is correct spelling
|
||||
bool attach(Xfb *xfb);
|
||||
void copyEFB(bool);
|
||||
void setNextFrameBuffer();
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_CAMERA_H
|
||||
#define EGG_CAMERA_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_CAP_TEXTURE_H
|
||||
#define EGG_CAP_TEXTURE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_CPU_TEXTURE_H
|
||||
#define EGG_CPU_TEXTURE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_DRAW_PATH_BASE_H
|
||||
#define EGG_DRAW_PATH_BASE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_DRAW_PATH_DOF_H
|
||||
#define EGG_DRAW_PATH_DOF_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_DRAW_PATH_UNK1_H
|
||||
#define EGG_DRAW_PATH_UNK1_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_DRAW_PATH_UNK2_H
|
||||
#define EGG_DRAW_PATH_UNK2_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -9,8 +9,12 @@ namespace EGG {
|
||||
// TODO: Fill out more
|
||||
class Frustum {
|
||||
public:
|
||||
enum CanvasMode {};
|
||||
enum ProjectionType { PROJ_ORTHO, PROJ_PERSP };
|
||||
enum CanvasMode {
|
||||
};
|
||||
enum ProjectionType {
|
||||
PROJ_ORTHO,
|
||||
PROJ_PERSP
|
||||
};
|
||||
|
||||
private:
|
||||
/* 0x00 */ ProjectionType mProjType;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_G3D_UTILITY_H
|
||||
#define EGG_G3D_UTILITY_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_GX_UTILITY_H
|
||||
#define EGG_GX_UTILITY_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_GLOBAL_DRAW_STATE_H
|
||||
#define EGG_GLOBAL_DRAW_STATE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_ISCNPROC_H
|
||||
#define EGG_ISCNPROC_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef EGG_LIGHT_H
|
||||
#define EGG_LIGHT_H
|
||||
|
||||
#include <egg/core/eggHeap.h>
|
||||
#include <egg/prim/eggBinary.h>
|
||||
#include <nw4r/types_nw4r.h>
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_LIGHT_TEXTURE_H
|
||||
#define EGG_LIGHT_TEXTURE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_LIGHT_TEXTURE_MGR_H
|
||||
#define EGG_LIGHT_TEXTURE_MGR_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_MODEL_EX_H
|
||||
#define EGG_MODEL_EX_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_PALETTE_H
|
||||
#define EGG_PALETTE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_POST_EFFECT_BASE_H
|
||||
#define EGG_POST_EFFECT_BASE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_POST_EFFECT_BLUR_H
|
||||
#define EGG_POST_EFFECT_BLUR_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_POST_EFFECT_MASK_H
|
||||
#define EGG_POST_EFFECT_MASK_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_POST_EFFECT_MASK_DOF_H
|
||||
#define EGG_POST_EFFECT_MASK_DOF_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_POST_EFFECT_SIMPLE_H
|
||||
#define EGG_POST_EFFECT_SIMPLE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_POST_EFFECT_UNK1_H
|
||||
#define EGG_POST_EFFECT_UNK1_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_POST_EFFECT_UNK2_H
|
||||
#define EGG_POST_EFFECT_UNK2_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -21,7 +21,13 @@ public:
|
||||
|
||||
u8 TODO_0x3C[0x88 - 0x3C];
|
||||
|
||||
enum TVMode { TV_MODE_1, TV_MODE_2, TV_MODE_3, TV_MODE_4, TV_MODE_MAX };
|
||||
enum TVMode {
|
||||
TV_MODE_1,
|
||||
TV_MODE_2,
|
||||
TV_MODE_3,
|
||||
TV_MODE_4,
|
||||
TV_MODE_MAX
|
||||
};
|
||||
|
||||
struct TVModeInfo {
|
||||
TVModeInfo() {}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_SCREEN_EFFECT_BASE_H
|
||||
#define EGG_SCREEN_EFFECT_BASE_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_SCREEN_EFFECT_BLUR_H
|
||||
#define EGG_SCREEN_EFFECT_BLUR_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_STATE_EFB_H
|
||||
#define EGG_STATE_EFB_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_TEXTURE_BUFFER_H
|
||||
#define EGG_TEXTURE_BUFFER_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_UNK_H
|
||||
#define EGG_UNK_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef EGG_MATH_H
|
||||
#define EGG_MATH_H
|
||||
|
||||
#include <common.h>
|
||||
#include <MSL_C/float.h>
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
@@ -32,7 +32,11 @@ public:
|
||||
}
|
||||
|
||||
static T abs(T t) {
|
||||
return t > 0 ? t : -t;
|
||||
return t > (T)0 ? t : -t;
|
||||
}
|
||||
|
||||
static T zero() {
|
||||
return (T)0;
|
||||
}
|
||||
|
||||
static T sqrt(T);
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
|
||||
#include "egg/math/eggQuat.h"
|
||||
#include "egg/math/eggVector.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
struct Matrix34f {
|
||||
Matrix34f() {}
|
||||
/* 8049acd0 */
|
||||
Matrix34f(f32 xx, f32 xy, f32 xz, f32 xw, f32 yx, f32 yy, f32 yz, f32 yw, f32 zx, f32 zy, f32 zz, f32 zw);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
f32 operator()(int i, int j) const {
|
||||
return m[i][j];
|
||||
}
|
||||
@@ -26,71 +25,76 @@ struct Matrix34f {
|
||||
return arr[i];
|
||||
}
|
||||
|
||||
/* */ void rotateBaseX(Vector3f &, Matrix34f &);
|
||||
/* */ void rotateVectorChange(Vector3f &, Vector3f &, Matrix34f &);
|
||||
/* 8049ac70 */ void inverseTo(Matrix34f &to) const;
|
||||
/* 8049ac80 */ void inverseTransposeTo(Matrix34f &to) const;
|
||||
/* 8049ac90 */ void makeIdentity();
|
||||
/* */ void makeSRT(const Vector3f &s, const Vector3f &r, const Vector3f &t);
|
||||
/* */ void makeRT(const Vector3f &r, const Vector3f &t);
|
||||
/* */ void makeR(const Vector3f &r);
|
||||
/* */ void makeST(const Vector3f &s, const Vector3f &t);
|
||||
/* */ void makeSQT(const Vector3f &s, const Quatf &q, const Vector3f &t);
|
||||
/* */ void makeSQ(const Vector3f &, const Quatf &);
|
||||
/* 8049ad20 */ void makeQT(const Quatf &, const Vector3f &);
|
||||
/* 8049ade0 */ void makeQ(const Quatf &);
|
||||
/* */ void makeS(const Vector3f &s);
|
||||
/* */ void makeT(const Vector3f &t);
|
||||
/* 8049ae90 */ void fromQuat(const Quatf &q);
|
||||
/* 8049af40 */ void toQuat(Quatf &q) const;
|
||||
/* 8049b250 */ void slerpTo(const Matrix34f &, Matrix34f &, f32) const;
|
||||
/* */ void copyTo16(f32 *pf) const;
|
||||
/* 8049b2d0 */ void setAxisRotation(const Vector3f &, f32);
|
||||
/* */ Vector3f multVector(const Vector3f &vec) const;
|
||||
/* 8049b310 */ void loadPosMtx(u32);
|
||||
/* */ void loadNrmMtx(u32 nrmMtxId);
|
||||
/* 8049b320 */ void multiplyTo(const Matrix34f &m2, Matrix34f &to) const;
|
||||
/* */ void dump();
|
||||
void rotateBaseX(Vector3f &, Matrix34f &);
|
||||
void rotateVectorChange(Vector3f &, Vector3f &, Matrix34f &);
|
||||
void inverseTo(Matrix34f &to) const;
|
||||
void inverseTransposeTo(Matrix34f &to) const;
|
||||
void makeIdentity();
|
||||
void makeSRT(const Vector3f &s, const Vector3f &r, const Vector3f &t);
|
||||
void makeRT(const Vector3f &r, const Vector3f &t);
|
||||
void makeR(const Vector3f &r);
|
||||
void makeST(const Vector3f &s, const Vector3f &t);
|
||||
void makeSQT(const Vector3f &s, const Quatf &q, const Vector3f &t);
|
||||
void makeSQ(const Vector3f &, const Quatf &);
|
||||
void makeQT(const Quatf &, const Vector3f &);
|
||||
void makeQ(const Quatf &);
|
||||
void makeS(const Vector3f &s);
|
||||
void makeT(const Vector3f &t);
|
||||
void fromQuat(const Quatf &q);
|
||||
void toQuat(Quatf &q) const;
|
||||
void slerpTo(const Matrix34f &, Matrix34f &, f32) const;
|
||||
void copyTo16(f32 *pf) const;
|
||||
void setAxisRotation(const Vector3f &, f32);
|
||||
Vector3f multVector(const Vector3f &vec) const;
|
||||
void loadPosMtx(u32);
|
||||
void loadNrmMtx(u32 nrmMtxId);
|
||||
void multiplyTo(const Matrix34f &m2, Matrix34f &to) const;
|
||||
void dump();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
void concat(const Matrix34f &, Matrix34f &) const;
|
||||
void copyFrom(const Matrix34f &other);
|
||||
void rotate(const Vector3f &rpy) const;
|
||||
void multVectorTo(const Vector3f &from, Vector3f &to) const;
|
||||
void transposeTo(Matrix34f &to) const;
|
||||
void copyFrom(const Matrix34f &other) {
|
||||
for (int i = 0; i < 12; i++) {
|
||||
(*this)(i) = other(i);
|
||||
}
|
||||
}
|
||||
void setBase(int idx, const Vector3f &b) {
|
||||
m[0][idx] = b.x;
|
||||
m[1][idx] = b.y;
|
||||
m[2][idx] = b.z;
|
||||
(*this)(0, idx) = b.x;
|
||||
(*this)(1, idx) = b.y;
|
||||
(*this)(2, idx) = b.z;
|
||||
}
|
||||
|
||||
void getBase(int idx, Vector3f &b) const {
|
||||
b.x = m[0][idx];
|
||||
b.y = m[1][idx];
|
||||
b.z = m[2][idx];
|
||||
b(0) = (*this)(0, idx);
|
||||
b(1) = (*this)(1, idx);
|
||||
b(2) = (*this)(2, idx);
|
||||
}
|
||||
|
||||
void setTranslation(const Vector3f &t) {
|
||||
setBase(3, t);
|
||||
}
|
||||
|
||||
void getTranslation(Vector3f &t) const {
|
||||
getBase(3, t);
|
||||
}
|
||||
|
||||
void makeZero() {
|
||||
for (int i = 0; i < 12; i++) {
|
||||
arr[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
union {
|
||||
f32 m[3][4];
|
||||
f32 arr[12];
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
/* 80674c00 */ static Matrix34f ident;
|
||||
static Matrix34f ident;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define EGG_QUAT_H
|
||||
|
||||
#include "egg/math/eggVector.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
@@ -3,75 +3,91 @@
|
||||
|
||||
#include "MSL_C/float.h"
|
||||
#include "egg/math/eggMath.h"
|
||||
|
||||
#include <common.h>
|
||||
#include <nw4r/math.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
struct Vector3f : public nw4r::math::VEC3 {
|
||||
Vector3f() {} // __ct__Q23EGG8Vector3fFv
|
||||
Vector3f(f32 fx, f32 fy, f32 fz) : VEC3(fx, fy, fz) {} // __ct__Q23EGG8Vector3fFfff
|
||||
// __ct__Q23EGG8Vector3fFv
|
||||
Vector3f() : nw4r::math::VEC3() {}
|
||||
|
||||
// __ct__Q23EGG8Vector3fFfff
|
||||
Vector3f(f32 fx, f32 fy, f32 fz) : VEC3(fx, fy, fz) {}
|
||||
|
||||
// ~Vector3f() {}
|
||||
|
||||
f32 &operator()(int i) { // __cl__Q23EGG8Vector3fFi
|
||||
// __cl__Q23EGG8Vector3fFi
|
||||
f32 &operator()(int i) {
|
||||
return ((f32 *)this)[i];
|
||||
}
|
||||
Vector3f operator*(f32 f) const { // __ml__Q23EGG8Vector3fCFf
|
||||
|
||||
// __ml__Q23EGG8Vector3fCFf
|
||||
Vector3f operator*(f32 f) const {
|
||||
return Vector3f(x * f, y * f, z * f);
|
||||
}
|
||||
|
||||
friend Vector3f operator*(f32 f, const Vector3f &v) {
|
||||
return v.operator*(f);
|
||||
}
|
||||
|
||||
Vector3f operator+(const Vector3f &v) { // __pl__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
// __pl__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
Vector3f operator+(const Vector3f &v) {
|
||||
return Vector3f(x + v.x, y + v.y, z + v.z);
|
||||
}
|
||||
|
||||
Vector3f &operator+=(const Vector3f &v) { // __apl__Q23EGG8Vector3fFRCQ23EGG8Vector3f
|
||||
// __apl__Q23EGG8Vector3fFRCQ23EGG8Vector3f
|
||||
Vector3f &operator+=(const Vector3f &v) {
|
||||
x += v.x;
|
||||
y += v.y;
|
||||
z += v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3f operator-() const { // __mi__Q23EGG8Vector3fCFv
|
||||
return Vector3f(-1.0f * x, -1.0f * y, -1.0f * z);
|
||||
// __mi__Q23EGG8Vector3fCFv
|
||||
Vector3f operator-() const {
|
||||
f32 z = this->z;
|
||||
f32 y = this->y;
|
||||
f32 x = this->x;
|
||||
return Vector3f(-x, -y, -z);
|
||||
}
|
||||
|
||||
Vector3f operator-(const Vector3f &v) { // __mi__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
// __mi__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
Vector3f operator-(const Vector3f &v) {
|
||||
return Vector3f(x - v.x, y - v.y, z - v.z);
|
||||
}
|
||||
|
||||
Vector3f &operator-=(const Vector3f &v) { // __ami__Q23EGG8Vector3fFRCQ23EGG8Vector3f
|
||||
// __ami__Q23EGG8Vector3fFRCQ23EGG8Vector3f
|
||||
Vector3f &operator-=(const Vector3f &v) {
|
||||
x -= v.x;
|
||||
y -= v.y;
|
||||
z -= v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3f &operator*=(f32 f) { // __amu__Q23EGG8Vector3fFf
|
||||
// __amu__Q23EGG8Vector3fFf
|
||||
Vector3f &operator*=(f32 f) {
|
||||
multScalar(f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3f operator/(f32 f) const { // __dv__Q23EGG8Vector3fCFf
|
||||
// __dv__Q23EGG8Vector3fCFf
|
||||
Vector3f operator/(f32 f) const {
|
||||
return Vector3f(x / f, y / f, z / f);
|
||||
}
|
||||
|
||||
Vector3f &operator/=(f32 f) { // __adv__Q23EGG8Vector3fCFf // assumed
|
||||
// __adv__Q23EGG8Vector3fCFf // assumed
|
||||
Vector3f &operator/=(f32 f) {
|
||||
divScalar(f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator!=(const Vector3f &v) { // __ne__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
// __ne__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
bool operator!=(const Vector3f &v) {
|
||||
return x != v.x || y != v.y || z != v.z;
|
||||
}
|
||||
|
||||
/* 8049bcc0 */ f32 normalise();
|
||||
/* 8049bd50 */ f32 setLength(const Vector3f &src, f32 len);
|
||||
/* 8049be10 */ f32 setLength(f32 len);
|
||||
|
||||
void multScalar(f32 f) {
|
||||
x *= f;
|
||||
y *= f;
|
||||
@@ -80,11 +96,14 @@ struct Vector3f : public nw4r::math::VEC3 {
|
||||
void divScalar(f32 f) {
|
||||
multScalar(1.0f / f);
|
||||
}
|
||||
f32 dot(const Vector3f &v) const { // dot__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
|
||||
// dot__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
f32 dot(const Vector3f &v) const {
|
||||
return x * v.x + y * v.y + z * v.z;
|
||||
}
|
||||
Vector3f cross(const Vector3f &b) const { // cross__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
|
||||
// cross__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
|
||||
Vector3f cross(const Vector3f &b) const {
|
||||
f32 _x = (y * b.z) - (z * b.y);
|
||||
f32 _y = (z * b.x) - (x * b.z);
|
||||
f32 _z = (x * b.y) - (y * b.x);
|
||||
@@ -102,25 +121,32 @@ struct Vector3f : public nw4r::math::VEC3 {
|
||||
z = fz;
|
||||
}
|
||||
|
||||
/* 80674c30 */ static const Vector3f zero;
|
||||
/* 80674c3c */ static const Vector3f ex;
|
||||
/* 80674c48 */ static const Vector3f ey;
|
||||
/* 80674c54 */ static const Vector3f ez;
|
||||
f32 normalise();
|
||||
f32 setLength(const Vector3f &src, f32 len);
|
||||
f32 setLength(f32 len);
|
||||
|
||||
static const Vector3f zero;
|
||||
static const Vector3f ex;
|
||||
static const Vector3f ey;
|
||||
static const Vector3f ez;
|
||||
};
|
||||
|
||||
struct Vector2f : nw4r::math::VEC2 {
|
||||
inline Vector2f() {}
|
||||
Vector2f() {}
|
||||
Vector2f(f32 fx, f32 fy) : VEC2(fx, fy) {}
|
||||
inline ~Vector2f() {}
|
||||
~Vector2f() {}
|
||||
|
||||
public:
|
||||
/* 805767c0 */ static const Vector2f zero;
|
||||
/* 805767c8 */ static const Vector2f ex;
|
||||
/* 805767d0 */ static const Vector2f ey;
|
||||
static const Vector2f zero;
|
||||
static const Vector2f ex;
|
||||
static const Vector2f ey;
|
||||
|
||||
Vector2f operator-(const Vector2f &v) {
|
||||
return Vector2f(x - v.x, y - v.y);
|
||||
}
|
||||
f32 squaredLength() const {
|
||||
return (x * x + y * y);
|
||||
}
|
||||
};
|
||||
|
||||
struct Vector3s {
|
||||
@@ -133,10 +159,10 @@ public:
|
||||
y = sy;
|
||||
z = sz;
|
||||
}
|
||||
/* 805767d8 */ static const Vector3s zero;
|
||||
/* 805767e0 */ static const Vector3s ex;
|
||||
/* 805767e8 */ static const Vector3s ey;
|
||||
/* 805767f0 */ static const Vector3s ez;
|
||||
static const Vector3s zero;
|
||||
static const Vector3s ex;
|
||||
static const Vector3s ey;
|
||||
static const Vector3s ez;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -11,15 +11,15 @@ namespace Assert {
|
||||
|
||||
typedef void (*AssertCallback)();
|
||||
|
||||
/* 8049bf90 */ void wait(u32 time);
|
||||
/* 8049c010 */ void system_vreport(const char *str, va_list list);
|
||||
/* 8049c010 */ void system_report(const char *str, ...);
|
||||
/* 8049c0a0 */ s32 getPeriodPos(const char *);
|
||||
/* 8049c100 */ char *getMapSymbol();
|
||||
/* 8049c150 */ bool isOutsideMEM1(u32 addr);
|
||||
/* 8049c180 */ AssertCallback setAssertCallback(AssertCallback cb);
|
||||
/* 8049c190 */ void system_halt(const char *file, u32 line, const char *msg, va_list list);
|
||||
/* 8049c530 */ void assert(const char *file, u32 line, const char *msg, ...);
|
||||
void wait(u32 time);
|
||||
void system_vreport(const char *str, va_list list);
|
||||
void system_report(const char *str, ...);
|
||||
s32 getPeriodPos(const char *);
|
||||
char *getMapSymbol();
|
||||
bool isOutsideMEM1(u32 addr);
|
||||
AssertCallback setAssertCallback(AssertCallback cb);
|
||||
void system_halt(const char *file, u32 line, const char *msg, va_list list);
|
||||
void assert(const char *file, u32 line, const char *msg, ...);
|
||||
|
||||
} // namespace Assert
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef EGG_BINARY_H
|
||||
#define EGG_BINARY_H
|
||||
|
||||
#include <common.h>
|
||||
|
||||
template <class T>
|
||||
class IBinary {
|
||||
public:
|
||||
|
||||
@@ -11,53 +11,53 @@ template <typename T>
|
||||
class TBitFlag {
|
||||
public:
|
||||
T value;
|
||||
inline void makeAllZero() {
|
||||
void makeAllZero() {
|
||||
value = T();
|
||||
}
|
||||
inline TBitFlag() {}
|
||||
inline TBitFlag(T value): value(value) {}
|
||||
inline T makeMask(u8 bit) const {
|
||||
TBitFlag() {}
|
||||
TBitFlag(T value) : value(value) {}
|
||||
T makeMask(u8 bit) const {
|
||||
return 1 << bit;
|
||||
}
|
||||
inline bool on(T mask) const {
|
||||
return value & mask;
|
||||
bool on(T mask) const {
|
||||
return (value & mask);
|
||||
}
|
||||
inline bool off(T mask) const {
|
||||
bool off(T mask) const {
|
||||
return !(value & mask);
|
||||
}
|
||||
inline void set(T mask) {
|
||||
void set(T mask) {
|
||||
value |= mask;
|
||||
}
|
||||
inline void reset(T mask) {
|
||||
void reset(T mask) {
|
||||
value &= ~mask;
|
||||
}
|
||||
inline bool onBit(u8 bit) const {
|
||||
bool onBit(u8 bit) const {
|
||||
return on(makeMask(bit));
|
||||
}
|
||||
inline bool offBit(u8 bit) const {
|
||||
bool offBit(u8 bit) const {
|
||||
return off(makeMask(bit));
|
||||
}
|
||||
inline void setBit(u8 bit) {
|
||||
void setBit(u8 bit) {
|
||||
set(makeMask(bit));
|
||||
}
|
||||
inline void resetBit(u8 bit) {
|
||||
void resetBit(u8 bit) {
|
||||
reset(makeMask(bit));
|
||||
}
|
||||
inline void toggleBit(u8 bit) {
|
||||
void toggleBit(u8 bit) {
|
||||
if (!onBit(bit)) {
|
||||
setBit(bit);
|
||||
} else {
|
||||
resetBit(bit);
|
||||
}
|
||||
}
|
||||
inline void changeBit(u8 bit, bool b) {
|
||||
void changeBit(u8 bit, bool b) {
|
||||
if (b) {
|
||||
setBit(bit);
|
||||
} else {
|
||||
resetBit(bit);
|
||||
}
|
||||
}
|
||||
inline T getDirect() {
|
||||
T getDirect() const {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define EGG_BUFFER_H
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
@@ -16,19 +17,8 @@ public:
|
||||
mBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
/* vt 0x0C */ virtual void allocate(int n, int) {
|
||||
mSize = n;
|
||||
mBuffer = new T[n];
|
||||
onAllocate(nullptr);
|
||||
}
|
||||
/* vt 0x10 */ virtual void allocate(int n, Heap *heap, int) {
|
||||
mSize = n;
|
||||
if (heap == nullptr) {
|
||||
heap = Heap::sCurrentHeap;
|
||||
}
|
||||
mBuffer = new (heap, 4) T[mSize];
|
||||
onAllocate(heap);
|
||||
}
|
||||
/* vt 0x0C */ virtual void allocate(int n, int);
|
||||
/* vt 0x10 */ virtual void allocate(int n, Heap *heap, int);
|
||||
/* vt 0x14 */ virtual void onAllocate(Heap *) {
|
||||
return;
|
||||
}
|
||||
@@ -60,6 +50,23 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void TBuffer<T>::allocate(int n, int) {
|
||||
mSize = n;
|
||||
mBuffer = new T[n];
|
||||
onAllocate(nullptr);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void TBuffer<T>::allocate(int n, Heap *heap, int) {
|
||||
mSize = n;
|
||||
if (heap == nullptr) {
|
||||
heap = Heap::sCurrentHeap;
|
||||
}
|
||||
mBuffer = new (heap, 4) T[mSize];
|
||||
onAllocate(heap);
|
||||
}
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EGG_EXCEPTION_H
|
||||
#define EGG_EXCEPTION_H
|
||||
|
||||
namespace EGG {} // namespace EGG
|
||||
|
||||
#endif
|
||||
+5
-13
@@ -2,8 +2,8 @@
|
||||
#define M_DVD_H
|
||||
|
||||
#include <egg/core/eggArchive.h>
|
||||
#include <egg/core/eggDecomp.h>
|
||||
#include <egg/core/eggHeap.h>
|
||||
#include <egg/core/eggStreamDecomp.h>
|
||||
#include <egg/core/eggThread.h>
|
||||
#include <m/m_heap.h>
|
||||
|
||||
@@ -19,9 +19,7 @@ class TUncompressInfo_Base_c {
|
||||
public:
|
||||
TUncompressInfo_Base_c(u8 type, const char *extension) : mType(type), mExtension(extension) {}
|
||||
virtual ~TUncompressInfo_Base_c() {}
|
||||
virtual EGG::StreamDecomp *Construct() const {
|
||||
return nullptr;
|
||||
}
|
||||
virtual EGG::StreamDecomp *Construct() const { return nullptr; }
|
||||
virtual void Destruct() const {}
|
||||
|
||||
u8 mType;
|
||||
@@ -32,9 +30,7 @@ template <typename T>
|
||||
class TUncompressInfo_c : public TUncompressInfo_Base_c {
|
||||
public:
|
||||
TUncompressInfo_c(u8 type, const char *extension) : TUncompressInfo_Base_c(type, extension) {}
|
||||
virtual T *Construct() const {
|
||||
return new (somePtr) T();
|
||||
}
|
||||
virtual T *Construct() const { return new (somePtr) T(); }
|
||||
virtual void Destruct() const {}
|
||||
};
|
||||
|
||||
@@ -172,13 +168,9 @@ public:
|
||||
|
||||
virtual void *run() override;
|
||||
|
||||
OSThread *getMyOsThread() {
|
||||
return mOSThread;
|
||||
}
|
||||
OSThread *getMyOsThread() { return mOSThread; }
|
||||
|
||||
void setThreadHeap(EGG::Heap *heap) {
|
||||
setThreadCurrentHeap(heap);
|
||||
}
|
||||
void setThreadHeap(EGG::Heap *heap) { setThreadCurrentHeap(heap); }
|
||||
|
||||
static void *run(mDvd_param_c *dvd);
|
||||
};
|
||||
|
||||
+17
-10
@@ -9,6 +9,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum CXReadResult {
|
||||
CX_READ_ERR_4 = -4,
|
||||
CX_READ_ERR_3 = -3,
|
||||
CX_READ_ERR_2 = -2,
|
||||
CX_READ_ERR_1 = -1,
|
||||
CX_READ_OK = 0,
|
||||
};
|
||||
|
||||
typedef struct CXUncompContextLZ {
|
||||
u8 _[0x18];
|
||||
} CXUncompContextLZ;
|
||||
@@ -40,19 +48,18 @@ typedef struct CXUncompContextLRC {
|
||||
u8 _[0x902C];
|
||||
} CXUncompContextLRC;
|
||||
|
||||
// TODO(Zeldex) : Fix Params
|
||||
/* 803cee90 */ void CXInitUncompContextRL();
|
||||
/* 803ceec0 */ void CXInitUncompContextLZ();
|
||||
/* 803cef00 */ void CXReadUncompRL();
|
||||
/* 803cf1b0 */ void CXReadUncompLZ();
|
||||
/* 803cf570 */ void CXInitUncompContextLH();
|
||||
/* 803cf5b0 */ void CXReadUncompLH();
|
||||
/* 803cee90 */ void CXInitUncompContextRL(CXUncompContextRL *);
|
||||
/* 803ceec0 */ void CXInitUncompContextLZ(CXUncompContextLZ *);
|
||||
/* 803cef00 */ s32 CXReadUncompRL(CXUncompContextRL *, const void *, u32);
|
||||
/* 803cf1b0 */ s32 CXReadUncompLZ(CXUncompContextLZ *, const void *, u32);
|
||||
/* 803cf570 */ void CXInitUncompContextLH(CXUncompContextLH *);
|
||||
/* 803cf5b0 */ s32 CXReadUncompLH(CXUncompContextLH *, const void *, u32);
|
||||
/* 803cfda0 */ void RCAddCount_();
|
||||
/* 803cff90 */ void RCSearch_();
|
||||
/* 803d0030 */ void RCGetData_();
|
||||
/* 803d0140 */ void CXInitUncompContextLRC();
|
||||
/* 803d0390 */ void CXReadUncompLRC();
|
||||
/* 803d0790 */ void CXGetUncompressedSize();
|
||||
/* 803d0140 */ void CXInitUncompContextLRC(CXUncompContextLRC *);
|
||||
/* 803d0390 */ s32 CXReadUncompLRC(CXUncompContextLRC *, const void *, u32);
|
||||
/* 803d0790 */ u32 CXGetUncompressedSize(const void *);
|
||||
/* 803d07d0 */ void CXUncompressLZ();
|
||||
/* 803d0920 */ void CXiLHVerifyTable();
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef RVL_SDK_PUBLIC_KPAD_H
|
||||
#define RVL_SDK_PUBLIC_KPAD_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rvl/KPAD/KPAD.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -6,8 +6,22 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
// TODO
|
||||
} KPADStatus;
|
||||
|
||||
typedef void (*KPADConnectCallback)(s32, s32);
|
||||
// TODO: Create Proper Headers
|
||||
void KPADInitEx(void * /* UNKTYPE */, u32);
|
||||
|
||||
s32 KPADReadEx(s32 chan, UNKTYPE *status, s32, s32 *);
|
||||
|
||||
void KPADSetConnectCallback(u32, KPADConnectCallback);
|
||||
|
||||
void KPADSetPosParam(u32, f32, f32);
|
||||
void KPADSetHoriParam(u32, f32, f32);
|
||||
void KPADSetDistParam(u32, f32, f32);
|
||||
void KPADSetAccParam(u32, f32, f32);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef s64 OSTime;
|
||||
typedef u32 OSTick;
|
||||
|
||||
// Time base frequency = 1/4 bus clock
|
||||
#define OS_TIME_SPEED (OS_BUS_CLOCK_SPEED / 4)
|
||||
|
||||
@@ -34,14 +37,14 @@ typedef struct OSCalendarTime {
|
||||
s32 usec; // at 0x24
|
||||
} OSCalendarTime;
|
||||
|
||||
s64 OSGetTime(void);
|
||||
s32 OSGetTick(void);
|
||||
OSTime OSGetTime(void);
|
||||
OSTick OSGetTick(void);
|
||||
|
||||
s64 __OSGetSystemTime(void);
|
||||
s64 __OSTimeToSystemTime(s64 time);
|
||||
OSTime __OSGetSystemTime(void);
|
||||
OSTime __OSTimeToSystemTime(OSTime time);
|
||||
|
||||
void OSTicksToCalendarTime(s64 time, OSCalendarTime *cal);
|
||||
s64 OSCalendarTimeToTicks(const OSCalendarTime *cal);
|
||||
void OSTicksToCalendarTime(OSTime time, OSCalendarTime *cal);
|
||||
OSTime OSCalendarTimeToTicks(const OSCalendarTime *cal);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
} PADStatus;
|
||||
|
||||
extern u32 __PADSpec;
|
||||
|
||||
BOOL __PADDisableRecalibration(BOOL);
|
||||
|
||||
@@ -5,6 +5,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rvl/WPAD/WPAD.h>
|
||||
#include <rvl/WPAD/WPADMem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+611
-28
@@ -1,44 +1,627 @@
|
||||
#ifndef REVOSDK_WPAD_H
|
||||
#define REVOSDK_WPAD_H
|
||||
#ifndef RVL_SDK_WPAD_H
|
||||
#define RVL_SDK_WPAD_H
|
||||
|
||||
// From
|
||||
// https://github.com/muff1n1634/wpad_11dec2009/blob/3c3aa5416d15ccc5867517d9ed4aaf6d25a70e9c/include/revolution/WPAD/WPAD.h
|
||||
|
||||
#include <common.h>
|
||||
#include <rvl/SC/scsystem.h>
|
||||
#include <rvl/WPAD/WUD.h>
|
||||
|
||||
/*******************************************************************************
|
||||
* macros
|
||||
*/
|
||||
|
||||
#define WPAD_MAX_DPD_OBJECTS 4
|
||||
|
||||
#define WPAD_MIN_DPD_SENS 1
|
||||
#define WPAD_MAX_DPD_SENS 5
|
||||
|
||||
/*******************************************************************************
|
||||
* types
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*WPADCallback)(s32 chan, s32 result);
|
||||
// for ease of use in ternaries
|
||||
typedef s32 WPADResult;
|
||||
enum WPADResult_et {
|
||||
WPAD_ERR_OK = 0,
|
||||
|
||||
typedef enum { WPAD_CHAN_0, WPAD_CHAN_1, WPAD_CHAN_2, WPAD_CHAN_3, WPAD_MAX_CONTROLLERS } WPADChan;
|
||||
WPAD_ERR_NO_CONTROLLER = -1, /* name known from asserts */
|
||||
WPAD_ERR_COMMUNICATION_ERROR = -2, // [RT3P54] has this as WPAD_ERR_BUSY
|
||||
WPAD_ERR_3 = -3, // [RT3P54] has this as WPAD_ERR_TRANSFER
|
||||
WPAD_ERR_INVALID = -4, /* name comes from [R89JEL] */
|
||||
// WPAD_ERR_5 = -5, /* unknown */
|
||||
// WPAD_ERR_6 = -6, /* unknown */
|
||||
WPAD_ERR_CORRUPTED = -7, /* name comes from [R89JEL] */
|
||||
|
||||
typedef enum {
|
||||
WPAD_RESULT_ERR_3 = -3,
|
||||
WPAD_RESULT_ERR_2,
|
||||
WPAD_RESULT_ERR_1,
|
||||
#define WPAD_ESUCCESS WPAD_ERR_OK
|
||||
#define WPAD_ENODEV WPAD_ERR_NO_CONTROLLER
|
||||
#define WPAD_ECOMM WPAD_ERR_COMMUNICATION_ERROR
|
||||
// #define WPAD_E3
|
||||
#define WPAD_EINVAL WPAD_ERR_INVALID
|
||||
|
||||
WPAD_RESULT_SUCCESS = 0,
|
||||
} WPADResult;
|
||||
/* maybe? i was scouring the internet for explanation and usage of this error
|
||||
* macro, and it seems close enough
|
||||
*
|
||||
* it's not ENODATA, that's more like if you got no data, but here it's that we
|
||||
* did get the data but it wasn't good
|
||||
*/
|
||||
#define WPAD_EBADE WPAD_ERR_CORRUPTED
|
||||
|
||||
// apparently enum vs literal is a thing. cool
|
||||
#define WPAD_CESUCCESS (WPAD_ESUCCESS + 0)
|
||||
#define WPAD_CENODEV (WPAD_ENODEV + 0)
|
||||
#define WPAD_CECOMM (WPAD_ECOMM + 0)
|
||||
#define WPAD_CERR_3 (WPAD_ERR_3 + 0)
|
||||
#define WPAD_CEINVAL (WPAD_EINVAL + 0)
|
||||
#define WPAD_CEBADE (WPAD_EBADE + 0)
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
u32 field_0x00;
|
||||
u32 field_0x04;
|
||||
u32 field_0x08;
|
||||
u32 field_0x0C;
|
||||
u32 field_0x10;
|
||||
bool field_0x14;
|
||||
bool field_0x15;
|
||||
bool field_0x16;
|
||||
bool field_0x17;
|
||||
} WPADInfo;
|
||||
typedef WUDLibStatus WPADLibStatus;
|
||||
enum WPADLibStatus_et {
|
||||
WPAD_LIB_STATUS_0 = WUD_LIB_STATUS_0,
|
||||
WPAD_LIB_STATUS_1 = WUD_LIB_STATUS_1,
|
||||
WPAD_LIB_STATUS_2 = WUD_LIB_STATUS_2,
|
||||
WPAD_LIB_STATUS_3 = WUD_LIB_STATUS_3,
|
||||
WPAD_LIB_STATUS_4 = WUD_LIB_STATUS_4,
|
||||
};
|
||||
|
||||
UNKTYPE WPADControlSpeaker(s32, UNKWORD, WPADCallback);
|
||||
BOOL WPADCanSendStreamData(s32);
|
||||
UNKWORD WPADSendStreamData(s32, UNKTYPE *, UNKWORD);
|
||||
// for ease of use in for loops
|
||||
typedef s32 WPADChannel;
|
||||
enum WPADChannel_et {
|
||||
WPAD_CHAN0,
|
||||
WPAD_CHAN1,
|
||||
WPAD_CHAN2,
|
||||
WPAD_CHAN3, /* name known from asserts */
|
||||
|
||||
s32 WPADProbe(s32 chan, u32 *type);
|
||||
s32 WPADReadFaceData(s32 chan, void *dst, u32 size, u32 src, WPADCallback cb);
|
||||
s32 WPADGetInfoAsync(s32 chan, WPADInfo *dst, WPADCallback cb);
|
||||
WPAD_MAX_CONTROLLERS, /* name known from asserts */
|
||||
WPAD_CHAN_INVALID = -1,
|
||||
};
|
||||
|
||||
typedef s32 WPADDeviceType;
|
||||
enum WPADDeviceType_et {
|
||||
WPAD_DEV_CORE = 0,
|
||||
WPAD_DEV_FS = 1,
|
||||
WPAD_DEV_CLASSIC = 2, /* name known from asserts, but not value */
|
||||
WPAD_DEV_BALANCE_CHECKER = 3,
|
||||
WPAD_DEV_VSM = 4,
|
||||
|
||||
WPAD_DEV_MOTION_PLUS = 5,
|
||||
WPAD_DEV_MPLS_PT_FS = 6,
|
||||
WPAD_DEV_MPLS_PT_CLASSIC = 7,
|
||||
|
||||
WPAD_DEV_TRAIN = 16,
|
||||
WPAD_DEV_GUITAR = 17,
|
||||
WPAD_DEV_DRUM = 18,
|
||||
WPAD_DEV_TAIKO = 19,
|
||||
WPAD_DEV_TURNTABLE = 20,
|
||||
|
||||
// seems to be like maybe general purpose non-specific device types
|
||||
// maybe this was for testing or something? idk
|
||||
WPAD_DEV_BULK_1 = 21,
|
||||
WPAD_DEV_BULK_2 = 22,
|
||||
WPAD_DEV_BULK_3 = 23,
|
||||
WPAD_DEV_BULK_4 = 24,
|
||||
WPAD_DEV_BULK_5 = 25,
|
||||
WPAD_DEV_BULK_6 = 26,
|
||||
WPAD_DEV_BULK_7 = 27,
|
||||
WPAD_DEV_BULK_8 = 28,
|
||||
|
||||
WPAD_DEV_MPLS_PT_UNKNOWN = 250,
|
||||
|
||||
WPAD_DEV_251 = 251,
|
||||
WPAD_DEV_252 = 252, // invalid device mode?
|
||||
WPAD_DEV_NONE =
|
||||
253, // sort of like WPAD_ENODEV (see __wpadAbortInitExtension in WPADHIDParser.c)
|
||||
// WPAD_DEV_254 = 254, /* unknown, doesn't seem to be used anywhere */
|
||||
WPAD_DEV_INITIALIZING = 255, // see __a1_20_status_report
|
||||
};
|
||||
|
||||
typedef u32 WPADDataFormat;
|
||||
enum WPADDataFormat_et {
|
||||
// see WPADiSendSetReportType and __wpadFmt2Size
|
||||
WPAD_FMT_CORE_BTN = 0,
|
||||
WPAD_FMT_CORE_BTN_ACC = 1,
|
||||
WPAD_FMT_CORE_BTN_ACC_DPD = 2,
|
||||
|
||||
WPAD_FMT_FS_BTN = 3,
|
||||
WPAD_FMT_FS_BTN_ACC = 4,
|
||||
WPAD_FMT_FS_BTN_ACC_DPD = 5,
|
||||
|
||||
WPAD_FMT_CLASSIC_BTN = 6,
|
||||
WPAD_FMT_CLASSIC_BTN_ACC = 7,
|
||||
WPAD_FMT_CLASSIC_BTN_ACC_DPD = 8,
|
||||
|
||||
WPAD_FMT_BTN_ACC_DPD_EXTENDED = 9,
|
||||
|
||||
// extensions
|
||||
WPAD_FMT_TRAIN = 10, /* name known from asserts */
|
||||
WPAD_FMT_GUITAR = 11, /* name known from asserts */
|
||||
WPAD_FMT_BALANCE_CHECKER = 12, /* name known from asserts */
|
||||
WPAD_FMT_VSM = 13, /* name known from asserts */
|
||||
// WPAD_FMT_14 = 14, /* unknown */
|
||||
WPAD_FMT_DRUM = 15, /* name known from asserts */
|
||||
WPAD_FMT_MOTION_PLUS = 16, // see __wpadFmt2Size
|
||||
WPAD_FMT_TAIKO = 17, /* name known from asserts */
|
||||
WPAD_FMT_TURNTABLE = 18, /* name known from asserts */
|
||||
WPAD_FMT_BULK = 19, /* name known from asserts */
|
||||
};
|
||||
|
||||
typedef s32 WPADDeviceMode;
|
||||
enum WPADDeviceMode_et {
|
||||
WPAD_DEV_MODE_NORMAL = 0,
|
||||
|
||||
WPAD_DEV_MODE_CLASSIC_REDUCED = 1,
|
||||
WPAD_DEV_MODE_CLASSIC_EXTENDED = 2,
|
||||
WPAD_DEV_MODE_CLASSIC_STANDARD = 3,
|
||||
|
||||
WPAD_DEV_MODE_MPLS_PT_MAIN = 4,
|
||||
WPAD_DEV_MODE_MPLS_PT_FS = 5,
|
||||
// WPAD_DEV_MODE_6 = 6, /* unknown */
|
||||
WPAD_DEV_MODE_MPLS_PT_CLASSIC = 7,
|
||||
};
|
||||
|
||||
// names from wiiuse/wpad.h
|
||||
typedef u16 WPADButton;
|
||||
enum WPADButton_et {
|
||||
// H..-AB12 ...+^v><
|
||||
/* NOTE: the bytes from the report are swapped when being placed into this
|
||||
* format (see MAKE_BUTTON in WPADHIDParser.c)
|
||||
*/
|
||||
WPAD_BUTTON_LEFT = (1 << 0),
|
||||
WPAD_BUTTON_RIGHT = (1 << 1),
|
||||
WPAD_BUTTON_DOWN = (1 << 2),
|
||||
WPAD_BUTTON_UP = (1 << 3),
|
||||
WPAD_BUTTON_PLUS = (1 << 4),
|
||||
// (1 << 5),
|
||||
// (1 << 6),
|
||||
// (1 << 7),
|
||||
WPAD_BUTTON_2 = (1 << 8),
|
||||
WPAD_BUTTON_1 = (1 << 9),
|
||||
WPAD_BUTTON_B = (1 << 10),
|
||||
WPAD_BUTTON_A = (1 << 11),
|
||||
WPAD_BUTTON_MINUS = (1 << 12),
|
||||
// (1 << 13), // WPAD_BUTTON_FS_Z
|
||||
// (1 << 14), // WPAD_BUTTON_FS_C
|
||||
WPAD_BUTTON_HOME = (1 << 15),
|
||||
|
||||
WPAD_BUTTON_ALL = 0x9f1f
|
||||
};
|
||||
|
||||
// names from wiiuse/wpad.h
|
||||
typedef u16 WPADExtButton;
|
||||
enum WPADExtButton_et {
|
||||
// Nunchuk (fight stick?)
|
||||
// .CZ..... ........
|
||||
/* NOTE: these bits are actually in the normal button variable, but are
|
||||
* enumerated here because they are buttons for an extension
|
||||
*/
|
||||
WPAD_BUTTON_FS_Z = (1 << 13),
|
||||
WPAD_BUTTON_FS_C = (1 << 14),
|
||||
|
||||
WPAD_BUTTON_FS_ALL = 0x6000,
|
||||
|
||||
// Classic Controller
|
||||
// >vL-H+R. lBYAXr<^
|
||||
WPAD_BUTTON_CL_UP = (1 << 0),
|
||||
WPAD_BUTTON_CL_LEFT = (1 << 1),
|
||||
WPAD_BUTTON_CL_ZR = (1 << 2),
|
||||
WPAD_BUTTON_CL_X = (1 << 3),
|
||||
WPAD_BUTTON_CL_A = (1 << 4),
|
||||
WPAD_BUTTON_CL_Y = (1 << 5),
|
||||
WPAD_BUTTON_CL_B = (1 << 6),
|
||||
WPAD_BUTTON_CL_ZL = (1 << 7),
|
||||
// (1 << 8),
|
||||
WPAD_BUTTON_CL_FULL_R = (1 << 9),
|
||||
WPAD_BUTTON_CL_PLUS = (1 << 10),
|
||||
WPAD_BUTTON_CL_HOME = (1 << 11),
|
||||
WPAD_BUTTON_CL_MINUS = (1 << 12),
|
||||
WPAD_BUTTON_CL_FULL_L = (1 << 13),
|
||||
WPAD_BUTTON_CL_DOWN = (1 << 14),
|
||||
WPAD_BUTTON_CL_RIGHT = (1 << 15),
|
||||
|
||||
WPAD_BUTTON_CL_ALL = 0xfeff,
|
||||
|
||||
// Shinkansen train controller
|
||||
// shares the same format as the Classic Controller
|
||||
// (see WPADiExcludeButton)
|
||||
WPAD_BUTTON_TR_UP = WPAD_BUTTON_CL_UP,
|
||||
WPAD_BUTTON_TR_LEFT = WPAD_BUTTON_CL_LEFT,
|
||||
WPAD_BUTTON_TR_ZR = WPAD_BUTTON_CL_ZR,
|
||||
WPAD_BUTTON_TR_X = WPAD_BUTTON_CL_X,
|
||||
WPAD_BUTTON_TR_A = WPAD_BUTTON_CL_A,
|
||||
WPAD_BUTTON_TR_Y = WPAD_BUTTON_CL_Y,
|
||||
WPAD_BUTTON_TR_B = WPAD_BUTTON_CL_B,
|
||||
WPAD_BUTTON_TR_ZL = WPAD_BUTTON_CL_ZL,
|
||||
// = WPAD_BUTTON_CL_8,
|
||||
WPAD_BUTTON_TR_FULL_R = WPAD_BUTTON_CL_FULL_R,
|
||||
WPAD_BUTTON_TR_PLUS = WPAD_BUTTON_CL_PLUS,
|
||||
WPAD_BUTTON_TR_HOME = WPAD_BUTTON_CL_HOME,
|
||||
WPAD_BUTTON_TR_MINUS = WPAD_BUTTON_CL_MINUS,
|
||||
WPAD_BUTTON_TR_FULL_L = WPAD_BUTTON_CL_FULL_L,
|
||||
WPAD_BUTTON_TR_DOWN = WPAD_BUTTON_CL_DOWN,
|
||||
WPAD_BUTTON_TR_RIGHT = WPAD_BUTTON_CL_RIGHT,
|
||||
|
||||
WPAD_BUTTON_TR_ALL = WPAD_BUTTON_CL_ALL,
|
||||
};
|
||||
|
||||
// WPADControlMotor
|
||||
typedef u32 WPADMotorCommand;
|
||||
enum WPADMotorCommand_et {
|
||||
WPAD_MOTOR_STOP = 0, /* name known from asserts */
|
||||
WPAD_MOTOR_RUMBLE = 1, /* name known from asserts */
|
||||
};
|
||||
|
||||
// WPADControlSpeaker
|
||||
typedef u32 WPADSpeakerCommand;
|
||||
enum WPADSpeakerCommand_et {
|
||||
WPAD_SPEAKER_DISABLE = 0,
|
||||
WPAD_SPEAKER_ENABLE = 1, // might be ON? see HBMRemoteSpk.cpp
|
||||
WPAD_SPEAKER_MUTE = 2,
|
||||
WPAD_SPEAKER_UNMUTE = 3,
|
||||
WPAD_SPEAKER_PLAY = 4, // figured out from HBM usage
|
||||
|
||||
// does the same thing as ENABLE? unless i'm missing something
|
||||
// not used so i don't know the context
|
||||
WPAD_SPEAKER_CMD_05 = 5,
|
||||
};
|
||||
|
||||
// WPADControlDpd
|
||||
typedef u32 WPADDpdCommand;
|
||||
enum WPADDpdCommand_et {
|
||||
WPAD_DPD_DISABLE = 0x00,
|
||||
|
||||
// the command here is actually the data format
|
||||
WPAD_DPD_BASIC = 0x01,
|
||||
WPAD_DPD_STANDARD = 0x03,
|
||||
WPAD_DPD_EXTENDED = 0x05,
|
||||
};
|
||||
|
||||
// WPADControlBLC
|
||||
typedef u8 WPADBLCCommand;
|
||||
enum WPADBLCCommand_et {
|
||||
WPAD_BLC_DISABLE = 0x00,
|
||||
WPAD_BLC_CMD_55 = 0x55,
|
||||
|
||||
/* NOTE: maybe? the code on this case in WPADControlBLC seems to follow what
|
||||
* WiiBrew describes as the initialization sequence after the generic one
|
||||
* (https://wiibrew.org/wiki/Wii_Balance_Board#Wii_Initialisation_Sequence).
|
||||
*/
|
||||
WPAD_BLC_ENABLE = 0xaa,
|
||||
};
|
||||
|
||||
// WPADMPStatus::stat
|
||||
typedef u8 WPADMPStatusFlags;
|
||||
enum WPADMPStatusFlags_et {
|
||||
WPAD_MPLS_STATUS_DATA_VALID = (1 << 7),
|
||||
WPAD_MPLS_STATUS_EXTENSION_DATA_VALID = (1 << 6),
|
||||
|
||||
WPAD_MPLS_STATUS_YAW_SLOW_MODE = (1 << 3),
|
||||
WPAD_MPLS_STATUS_PITCH_SLOW_MODE = (1 << 2),
|
||||
WPAD_MPLS_STATUS_ROLL_SLOW_MODE = (1 << 1),
|
||||
WPAD_MPLS_STATUS_EXTENSION_CONNECTED = (1 << 0), // just that it's present; not that it's actually being used
|
||||
};
|
||||
|
||||
// WPADGetAccGravityUnit
|
||||
typedef u32 WPADAccGravityUnitType;
|
||||
enum WPADAccGravityUnitType_et {
|
||||
WPAD_ACC_GRAVITY_UNIT_CORE,
|
||||
WPAD_ACC_GRAVITY_UNIT_FS,
|
||||
};
|
||||
|
||||
typedef WUDAllocFunc WPADAllocFunc;
|
||||
typedef WUDFreeFunc WPADFreeFunc;
|
||||
|
||||
typedef void WPADInitFunc(void); // see __wpadInitSub in WPAD.c
|
||||
|
||||
typedef void WPADCallback(WPADChannel chan, WPADResult result);
|
||||
|
||||
typedef void WPADSamplingCallback(WPADChannel chan);
|
||||
typedef void WPADConnectCallback(WPADChannel chan, s32 result);
|
||||
typedef void WPADExtensionCallback(WPADChannel chan, WPADDeviceType devType);
|
||||
|
||||
typedef WUDSyncDeviceCallback WPADSimpleSyncCallback;
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x79f49
|
||||
typedef struct DPDObject {
|
||||
s16 x; // size 0x02, offset 0x00
|
||||
s16 y; // size 0x02, offset 0x02
|
||||
u16 size; // size 0x02, offset 0x04
|
||||
u8 traceId; // size 0x01, offset 0x06
|
||||
// 1 byte padding
|
||||
} DPDObject; // size 0x08
|
||||
|
||||
// TODO: get a specific source (name, game id)
|
||||
// TODO: check library version of game that has this
|
||||
// dwarfv1_megadump.txt:21551-21559
|
||||
typedef struct DPDObjEx {
|
||||
s16 range_x1; // size 0x02, offset 0x00
|
||||
s16 range_y1; // size 0x02, offset 0x02
|
||||
s16 range_x2; // size 0x02, offset 0x04
|
||||
s16 range_y2; // size 0x02, offset 0x06
|
||||
u16 pixel; // size 0x02, offset 0x08
|
||||
s8 radius; // size 0x01, offset 0x0a
|
||||
// 1 byte padding
|
||||
} DPDObjEx; // size 0x0c
|
||||
|
||||
// [SPQE7T]/ISpyD.elf:.debug_info::0xd675b
|
||||
typedef struct WPADInfo {
|
||||
BOOL dpd; // size 0x04, offset 0x00
|
||||
BOOL speaker; // size 0x04, offset 0x04
|
||||
BOOL attach; // size 0x04, offset 0x08
|
||||
BOOL lowBat; // size 0x04, offset 0x0c
|
||||
BOOL nearempty; // size 0x04, offset 0x10
|
||||
u8 battery; // size 0x01, offset 0x14
|
||||
u8 led; // size 0x01, offset 0x15
|
||||
u8 protocol; // size 0x01, offset 0x16
|
||||
u8 firmware; // size 0x01, offset 0x17
|
||||
} WPADInfo; // size 0x18
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7ab19
|
||||
typedef struct WPADStatus {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
} WPADStatus; // size 0x2a
|
||||
|
||||
/* The following take their initial members from WPADStatus instead of including
|
||||
* an instance of it. For ease of use?
|
||||
*/
|
||||
|
||||
// TODO: get a specific source (name, game id)
|
||||
// TODO: check library version of game that has this
|
||||
// dwarfv1_megadump.txt:21560-21570
|
||||
typedef struct WPADStatusEx {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
|
||||
DPDObjEx exp[WPAD_MAX_DPD_OBJECTS]; // size 0x30, offset 0x2a
|
||||
} WPADStatusEx; // size 0x5a
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x79e65
|
||||
typedef struct WPADFSStatus {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
|
||||
s16 fsAccX; // size 0x02, offset 0x2a
|
||||
s16 fsAccY; // size 0x02, offset 0x2c
|
||||
s16 fsAccZ; // size 0x02, offset 0x2e
|
||||
s8 fsStickX; // size 0x01, offset 0x30
|
||||
s8 fsStickY; // size 0x01, offset 0x31
|
||||
} WPADFSStatus; // size 0x32
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7aba2
|
||||
typedef struct WPADCLStatus {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
|
||||
WPADExtButton clButton; // size 0x02, offset 0x2a
|
||||
s16 clLStickX; // size 0x02, offset 0x2c
|
||||
s16 clLStickY; // size 0x02, offset 0x2e
|
||||
s16 clRStickX; // size 0x02, offset 0x30
|
||||
s16 clRStickY; // size 0x02, offset 0x32
|
||||
u8 clTriggerL; // size 0x01, offset 0x34
|
||||
u8 clTriggerR; // size 0x01, offset 0x35
|
||||
} WPADCLStatus; // size 0x36
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7acba
|
||||
typedef struct WPADTRStatus {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
|
||||
WPADExtButton trButton; // size 0x02, offset 0x2a
|
||||
u8 brake; // size 0x01, offset 0x2c
|
||||
u8 mascon; // size 0x01, offset 0x2d
|
||||
} WPADTRStatus; // size 0x2e
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7ad79
|
||||
typedef struct WPADBLStatus {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
|
||||
u16 press[4]; // size 0x08, offset 0x2a
|
||||
s8 temp; // size 0x01, offset 0x32
|
||||
u8 battery; // size 0x01, offset 0x33
|
||||
} WPADBLStatus; // size 0x34
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7ae44
|
||||
typedef struct WPADMPStatus {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7af2c
|
||||
union /* explicitly untagged */
|
||||
{
|
||||
// Takes its members from WPADFSStatus
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7af54
|
||||
struct /* explicitly untagged */
|
||||
{
|
||||
s16 fsAccX; // size 0x02, offset 0x00
|
||||
s16 fsAccY; // size 0x02, offset 0x02
|
||||
s16 fsAccZ; // size 0x02, offset 0x04
|
||||
s8 fsStickX; // size 0x01, offset 0x06
|
||||
s8 fsStickY; // size 0x01, offset 0x07
|
||||
} fs; // size 0x08
|
||||
|
||||
// Takes its members from WPADCLStatus
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7afbb
|
||||
struct /* explicitly untagged */
|
||||
{
|
||||
WPADExtButton clButton; // size 0x02, offset 0x00
|
||||
s16 clLStickX; // size 0x02, offset 0x02
|
||||
s16 clLStickY; // size 0x02, offset 0x04
|
||||
s16 clRStickX; // size 0x02, offset 0x06
|
||||
s16 clRStickY; // size 0x02, offset 0x08
|
||||
u8 clTriggerL; // size 0x01, offset 0x0a
|
||||
u8 clTriggerR; // size 0x01, offset 0x0b
|
||||
} cl; // size 0x0c
|
||||
} ext; // size 0x0c, offset 0x2a
|
||||
|
||||
WPADMPStatusFlags stat; // size 0x01, offset 0x36
|
||||
u8 reserved; // size 0x01, offset 0x37
|
||||
|
||||
s16 pitch; // size 0x02, offset 0x38
|
||||
s16 yaw; // size 0x02, offset 0x3a
|
||||
s16 roll; // size 0x02, offset 0x3c
|
||||
} WPADMPStatus; // size 0x3e
|
||||
|
||||
// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7b056
|
||||
typedef struct WPADBKStatus {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
|
||||
byte_t bulk[21]; // size 0x15, offset 0x2a
|
||||
byte_t padding[1]; // size 0x01, offset 0x3f
|
||||
} WPADBKStatus; // size 0x40
|
||||
|
||||
typedef struct WPADVSStatus {
|
||||
WPADButton button; // size 0x02, offset 0x00
|
||||
s16 accX; // size 0x02, offset 0x02
|
||||
s16 accY; // size 0x02, offset 0x04
|
||||
s16 accZ; // size 0x02, offset 0x06
|
||||
DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08
|
||||
u8 dev; // size 0x01, offset 0x28
|
||||
s8 err; // size 0x01, offset 0x29
|
||||
|
||||
u16 at_0x2a[5]; // size 0x0a, offset 0x2a
|
||||
u8 at_0x34; // size 0x02, offset 0x34
|
||||
// 1 byte padding (alignment? probably)
|
||||
u16 at_0x36[5]; // size 0x0a, offset 0x36
|
||||
u8 at_0x40; // size 0x02, offset 0x40
|
||||
// 1 byte padding (alignment? probably)
|
||||
u16 at_0x42; // size 0x02, offset 0x42
|
||||
u8 at_0x44; // size 0x01, offset 0x44
|
||||
// 1 byte padding (alignment? probably)
|
||||
} WPADVSStatus; // size 0x46 (see __wpadFmt2Size)
|
||||
|
||||
typedef struct WPADAccGravityUnit {
|
||||
// probably maybe
|
||||
s16 x; // size 0x02, offset 0x00
|
||||
s16 y; // size 0x02, offset 0x02
|
||||
s16 z; // size 0x02, offset 0x04
|
||||
} WPADAccGravityUnit; // size 0x06
|
||||
|
||||
/*******************************************************************************
|
||||
* functions
|
||||
*/
|
||||
|
||||
BOOL WPADIsEnabledVSM(void);
|
||||
BOOL WPADIsEnabledTRN(void);
|
||||
BOOL WPADIsEnabledGTR(void);
|
||||
BOOL WPADIsEnabledDRM(void);
|
||||
BOOL WPADIsEnabledTKO(void);
|
||||
BOOL WPADIsEnabledTBL(void);
|
||||
BOOL WPADIsEnabledBLK(void);
|
||||
|
||||
// Likely overridden by a WBC-specific library
|
||||
__attribute__((weak)) WPADResult WBCSetupCalibration(void);
|
||||
__attribute__((weak)) signed WBCGetCalibrationStatus(void);
|
||||
__attribute__((weak)) signed WBCGetBatteryLevel(u8);
|
||||
__attribute__((weak)) WPADResult WBCRead(WPADBLStatus *, f64 *, int);
|
||||
__attribute__((weak)) WPADResult WBCSetZEROPoint(f64 *, int);
|
||||
__attribute__((weak)) WPADResult WBCGetTGCWeight(f64, f64 *, WPADBLStatus *);
|
||||
|
||||
void WPADInit(void);
|
||||
void WPADShutdown(void);
|
||||
|
||||
BOOL WPADStartFastSimpleSync(void);
|
||||
BOOL WPADStopSimpleSync(void);
|
||||
BOOL WPADCancelSyncDevice(void);
|
||||
WPADSimpleSyncCallback *WPADSetSimpleSyncCallback(WPADSimpleSyncCallback *cb);
|
||||
void WPADRegisterAllocator(WPADAllocFunc *alloc, WPADFreeFunc *free);
|
||||
WPADLibStatus WPADGetStatus(void);
|
||||
u8 WPADGetRadioSensitivity(WPADChannel chan);
|
||||
void WPADGetAddress(WPADChannel chan, BD_ADDR_PTR addr);
|
||||
u8 WPADGetSensorBarPosition(void);
|
||||
|
||||
void WPADGetAccGravityUnit(WPADChannel chan, WPADAccGravityUnitType type, WPADAccGravityUnit *acc);
|
||||
|
||||
void WPADDisconnect(WPADChannel chan);
|
||||
WPADResult WPADProbe(WPADChannel chan, WPADDeviceType *devTypeOut);
|
||||
WPADSamplingCallback *WPADSetSamplingCallback(WPADChannel chan, WPADSamplingCallback *cb);
|
||||
WPADConnectCallback *WPADSetConnectCallback(WPADChannel chan, WPADConnectCallback *cb);
|
||||
WPADExtensionCallback *WPADSetExtensionCallback(WPADChannel chan, WPADExtensionCallback *cb);
|
||||
WPADDataFormat WPADGetDataFormat(WPADChannel chan);
|
||||
WPADResult WPADSetDataFormat(WPADChannel chan, WPADDataFormat fmt);
|
||||
|
||||
WPADResult WPADGetInfoAsync(WPADChannel chan, WPADInfo *info, WPADCallback *cb);
|
||||
void WPADControlMotor(WPADChannel chan, WPADMotorCommand command);
|
||||
void WPADEnableMotor(BOOL enabled);
|
||||
BOOL WPADIsMotorEnabled(void);
|
||||
WPADResult WPADControlLed(WPADChannel chan, u8 ledFlags, WPADCallback cb);
|
||||
BOOL WPADSaveConfig(SCFlushCallback *cb);
|
||||
|
||||
/* NOTE: status should match the WPADStatus type for the channel; a check
|
||||
* against the currently assigned device type is made to know how much to copy
|
||||
*
|
||||
* for example, if devType[chan] == WPAD_DEV_CLASSIC, status should be a
|
||||
* pointer to WPADCLStatus cast to a pointer to WPADStatus
|
||||
*/
|
||||
void WPADRead(WPADChannel chan, WPADStatus *status);
|
||||
void WPADSetAutoSamplingBuf(WPADChannel chan, void *buf, u32 length);
|
||||
|
||||
BOOL WPADIsSpeakerEnabled(WPADChannel chan);
|
||||
WPADResult WPADControlSpeaker(WPADChannel chan, WPADSpeakerCommand command, WPADCallback *cb);
|
||||
u8 WPADGetSpeakerVolume(void);
|
||||
void WPADSetSpeakerVolume(u8 vol);
|
||||
|
||||
BOOL WPADCanSendStreamData(WPADChannel chan);
|
||||
WPADResult WPADSendStreamData(WPADChannel chan, void *p_buf, u16 len);
|
||||
u8 WPADGetDpdSensitivity(void);
|
||||
BOOL WPADIsDpdEnabled(WPADChannel chan);
|
||||
|
||||
WPADResult WPADControlDpd(WPADChannel chan, WPADDpdCommand command, WPADCallback *cb);
|
||||
WPADResult WPADControlBLC(WPADChannel chan, WPADBLCCommand command, WPADCallback *cb);
|
||||
|
||||
void WPADRecalibrate(WPADChannel chan);
|
||||
BOOL WPADIsUsedCallbackByKPAD(void);
|
||||
void WPADSetCallbackByKPAD(BOOL isKPAD);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // RVL_SDK_WPAD_H
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef RVL_SDK_WPAD_MEMORY_H
|
||||
#define RVL_SDK_WPAD_MEMORY_H
|
||||
|
||||
#include <common.h>
|
||||
#include <rvl/OS/OSTime.h>
|
||||
#include <rvl/WPAD/WPAD.h>
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* macros
|
||||
*/
|
||||
|
||||
#define WM_MEM_ADDR(addr_) ((addr_) & 0xffff)
|
||||
#define WM_EXT_REG_ADDR(type_, addr_) (((addr_) & 0xffff) | ((WPAD_EXT_REG_##type_) << 16) | (1 << 26))
|
||||
|
||||
/*******************************************************************************
|
||||
* types
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef u8 WPADExtRegType;
|
||||
enum WPADExtRegType_et {
|
||||
WPAD_EXT_REG_SPEAKER = 0xa2,
|
||||
WPAD_EXT_REG_EXTENSION = 0xa4,
|
||||
WPAD_EXT_REG_MOTION_PLUS = 0xa6,
|
||||
WPAD_EXT_REG_DPD = 0xb0,
|
||||
};
|
||||
|
||||
// https://wiibrew.org/wiki/Wiimote#EEPROM_Memory
|
||||
typedef struct WPADGameInfo {
|
||||
OSTime timestamp; // size 0x08, offset 0x00
|
||||
u16 gameName[17]; // size 0x22, offset 0x08
|
||||
char gameID[4]; // size 0x04, offset 0x2a
|
||||
u8 gameType; // size 0x01, offset 0x2e
|
||||
u8 checksum; // size 0x01, offset 0x2f
|
||||
|
||||
/* wiibrew says this exists in the header on the Wiimote but goes unused,
|
||||
* which matches up with the code I see here
|
||||
*/
|
||||
byte_t unknown[8];
|
||||
} WPADGameInfo; // size 0x38
|
||||
|
||||
/*******************************************************************************
|
||||
* functions
|
||||
*/
|
||||
|
||||
WPADResult
|
||||
WPADWriteExtReg(WPADChannel chan, const void *data, u16 length, WPADExtRegType extReg, u16 address, WPADCallback *cb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RVL_SDK_WPAD_MEMORY_H
|
||||
@@ -0,0 +1,108 @@
|
||||
#ifndef RVL_SDK_WPAD_WUD_H
|
||||
#define RVL_SDK_WPAD_WUD_H
|
||||
|
||||
#include <common.h>
|
||||
|
||||
// TODO: Fix when possible
|
||||
#include "context_bte.h"
|
||||
|
||||
#define WUD_MAX_DEV_ENTRY_FOR_STD 10 // name known from asserts
|
||||
#define WUD_MAX_DEV_ENTRY_FOR_SMP 6 // name known from asserts
|
||||
|
||||
#define WUD_MAX_DEV_ENTRY 16 // name known from asserts
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef s8 WUDDevHandle;
|
||||
#define WUD_DEV_HANDLE_INVALID (-1)
|
||||
|
||||
typedef s32 WUDChannel;
|
||||
enum WUDChannel_et {
|
||||
WUD_CHAN0,
|
||||
WUD_CHAN1,
|
||||
WUD_CHAN2,
|
||||
WUD_CHAN3,
|
||||
|
||||
WUD_MAX_CHANNELS,
|
||||
WUD_CHAN_INVALID = -1
|
||||
};
|
||||
|
||||
typedef s32 WUDLibStatus;
|
||||
enum WUDLibStatus_et {
|
||||
WUD_LIB_STATUS_0,
|
||||
WUD_LIB_STATUS_1,
|
||||
WUD_LIB_STATUS_2,
|
||||
WUD_LIB_STATUS_3,
|
||||
WUD_LIB_STATUS_4,
|
||||
};
|
||||
|
||||
typedef u8 WUDSyncType;
|
||||
enum WUDSyncType_et {
|
||||
WUD_SYNC_TYPE_STANDARD,
|
||||
WUD_SYNC_TYPE_SIMPLE,
|
||||
};
|
||||
|
||||
typedef void *WUDAllocFunc(size_t size);
|
||||
typedef int WUDFreeFunc(void *ptr); // signature from petari. not sure what the int is, though
|
||||
|
||||
typedef void WUDSyncDeviceCallback(s32 result, s32 num); // what is result?
|
||||
typedef void WUDClearDeviceCallback(signed);
|
||||
|
||||
typedef struct WUDDevInfo WUDDevInfo;
|
||||
typedef void WUDHidConnectCallback(WUDDevInfo *devInfo, u8 isOpenEvent);
|
||||
typedef void WUDHidReceiveCallback(UINT8 dev_handle, UINT8 *p_rpt, UINT16 len);
|
||||
|
||||
struct WUDDevInfo {
|
||||
struct small_dev_info small; // size 0x40, offset 0x00
|
||||
BD_ADDR devAddr; // size 0x06, offset 0x40
|
||||
LINK_KEY linkKey; // size 0x10, offset 0x46
|
||||
UINT8 devHandle; // size 0x01, offset 0x56
|
||||
UINT8 subclass; // size 0x01, offset 0x57
|
||||
UINT8 appID; // size 0x01, offset 0x58
|
||||
u8 at_0x59; // size 0x01, offset 0x59
|
||||
char signed at_0x5a; // size 0x01, offset 0x5a /* unknown */
|
||||
u8 at_0x5b; // size 0x01, offset 0x5b
|
||||
u8 at_0x5c; // size 0x01, offset 0x5c
|
||||
byte_t unk_0x5d[1]; // padding?
|
||||
tBTA_HH_ATTR_MASK hhAttrMask; // size 0x02, offset 0x5e
|
||||
}; // size 0x60
|
||||
|
||||
/*******************************************************************************
|
||||
* functions
|
||||
*/
|
||||
|
||||
BOOL WUDIsLinkedWBC(void);
|
||||
|
||||
BOOL WUDInit(void);
|
||||
void WUDRegisterAllocator(WUDAllocFunc *alloc, WUDFreeFunc *free);
|
||||
void WUDShutdown(BOOL saveSimpleDevs);
|
||||
WUDLibStatus WUDGetStatus(void);
|
||||
u8 WUDGetBufferStatus(void);
|
||||
void WUDSetSniffMode(BD_ADDR addr, int interval);
|
||||
WUDSyncDeviceCallback *WUDSetSyncSimpleCallback(WUDSyncDeviceCallback *cb);
|
||||
|
||||
BOOL WUDStartSyncDevice(void);
|
||||
BOOL WUDStartFastSyncSimple(void);
|
||||
|
||||
BOOL WUDCancelSyncDevice(void);
|
||||
BOOL WUDStopSyncSimple(void);
|
||||
BOOL WUDStartClearDevice(void);
|
||||
BOOL WUDSetDisableChannel(s8 afhChannel);
|
||||
WUDHidConnectCallback *WUDSetHidConnCallback(WUDHidConnectCallback *hidConn);
|
||||
WUDHidReceiveCallback *WUDSetHidRecvCallback(WUDHidReceiveCallback *hidRecv);
|
||||
void WUDSetVisibility(u8 discoverable, u8 connectable);
|
||||
u8 WUDGetConnectable(void);
|
||||
|
||||
BOOL WUDIsBusy(void);
|
||||
|
||||
void WUDSetDeviceHistory(WUDChannel chan, BD_ADDR addr);
|
||||
BOOL WUDIsLatestDevice(WUDChannel chan, BD_ADDR addr);
|
||||
void WUDUpdateSCSetting(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RVL_SDK_WPAD_WUD_H
|
||||
Reference in New Issue
Block a user